diff -ruN net/opensips.orig/Makefile net/opensips/Makefile --- net/opensips.orig/Makefile 2018-03-11 01:46:04.000000000 +0800 +++ net/opensips/Makefile 2018-03-16 11:50:38.083940000 +0800 @@ -2,8 +2,7 @@ # $FreeBSD: head/net/opensips/Makefile 464084 2018-03-10 17:46:04Z gerald $ PORTNAME= opensips -PORTVERSION= 2.2.3 -PORTREVISION= 5 +PORTVERSION= 2.2.6 CATEGORIES= net MASTER_SITES= http://opensips.org/pub/opensips/${PORTVERSION}/ @@ -34,7 +33,8 @@ WRKSRC= ${WRKDIR}/opensips-${PORTVERSION} DOCSDIR= share/doc/opensips -USE_RC_SUBR= opensips +USERS= opensips +GROUPS= opensips USES= gmake ncurses perl5 pkgconfig python:2.7 shebangfix ssl USE_GCC= yes @@ -55,6 +55,8 @@ MYSQL_USE= MYSQL=client PGSQL_USES+= pgsql +USE_RC_SUBR= opensips + PGSQL_BUILD_DEPENDS+= p5-DBD-Pg>=3.4:databases/p5-DBD-Pg RADIUS_LIB_DEPENDS+= libradiusclient-ng.so:net/radiusclient HTTP_LIB_DEPENDS+= libmicrohttpd.so:www/libmicrohttpd @@ -69,12 +71,12 @@ modules/jabber/doc/jabberreg.pl \ modules/seas/doc/xml2sgml.sh \ modules/sipcapture/examples/partrotate_unixtimestamp.pl \ - packaging/debian/common/rules \ + packaging/debian/rules \ packaging/freebsd/files/pkg-deinstall.in \ packaging/freebsd/files/pkg-install.in \ packaging/gentoo/opensips.init \ packaging/redhat_fedora/opensips.init \ - packaging/redhat_fedora/opensips.m4cfg \ + packaging/redhat_fedora/opensips-m4cfg \ packaging/rpm/opensips.init \ packaging/solaris/berkeley-postinstall \ packaging/solaris/berkeley-preinstall \ @@ -116,6 +118,7 @@ test/18.sh \ test/19.sh \ test/2.sh \ + test/20.sh \ test/21.sh \ test/22.sh \ test/23.sh \ @@ -177,7 +180,7 @@ .endif .if ${PORT_OPTIONS:MTLS} -EXTRA_MODULES+= proto_tls +EXTRA_MODULES+= proto_tls proto_wss tls_mgm .endif .if ${PORT_OPTIONS:MSQLITE} @@ -238,7 +241,7 @@ .for i in aaa_radius.so acc.so alias_db.so auth.so auth_aaa.so auth_db.so auth_diameter.so \ avpops.so b2b_entities.so b2b_logic.so b2b_sca.so benchmark.so cachedb_local.so \ cachedb_memcached.so cachedb_sql.so call_center.so call_control.so carrierroute.so \ - cfgutils.so closeddial.so cpl-c.so db_cachedb.so db_flatstore.so db_mysql.so \ + cfgutils.so closeddial.so cpl_c.so db_cachedb.so db_flatstore.so db_mysql.so \ db_postgres.so db_text.so db_unixodbc.so db_virtual.so dialog.so dialplan.so \ dispatcher.so diversion.so dns_cache.so domain.so domainpolicy.so drouting.so \ enum.so event_datagram.so event_rabbitmq.so event_route.so event_xmlrpc.so exec.so \ @@ -254,7 +257,9 @@ sms.so speeddial.so sst.so statistics.so stun.so textops.so tlsops.so tm.so uac.so \ uac_auth.so uac_redirect.so uac_registrant.so uri.so userblacklist.so usrloc.so \ xcap.so xcap_client.so xmpp.so topology_hiding.so fraud_detection.so rtpengine.so \ - proto_ws.so proto_tls.so cachedb_redis.so db_sqlite.so + proto_ws.so proto_tls.so cachedb_redis.so db_sqlite.so proto_bin.so tls_mgm.so \ + tls_mgm.so event_flatstore.so event_virtual.so proto_hep.so proto_wss.so \ + clusterer.so sql_cacher.so @if [ -e ${STAGEDIR}${PREFIX}/lib/opensips/modules/${i} ]; then \ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/opensips/modules/${i}; \ fi diff -ruN net/opensips.orig/distinfo net/opensips/distinfo --- net/opensips.orig/distinfo 2017-03-28 17:29:36.000000000 +0800 +++ net/opensips/distinfo 2018-03-16 10:11:45.169976000 +0800 @@ -1,3 +1,3 @@ -TIMESTAMP = 1488823435 -SHA256 (opensips-2.2.3.tar.gz) = ccf540f7aae4335a8319b83f6cb87b562e665991fe1c2adc4e8eb4d4f3042dd7 -SIZE (opensips-2.2.3.tar.gz) = 9111509 +TIMESTAMP = 1520992193 +SHA256 (opensips-2.2.6.tar.gz) = a48323435e656f6e8de6ff82ef08a55665e2331fc5ad009bf3a2ddc883906e7f +SIZE (opensips-2.2.6.tar.gz) = 9154213 diff -ruN net/opensips.orig/files/Makefile.conf net/opensips/files/Makefile.conf --- net/opensips.orig/files/Makefile.conf 2017-03-28 17:29:36.000000000 +0800 +++ net/opensips/files/Makefile.conf 2018-03-16 10:11:45.170736000 +0800 @@ -3,17 +3,18 @@ #cachedb_cassandra= Implementation of a cache system designed to work with Cassandra servers | thrift 0.6.1 #cachedb_couchbase= Implementation of a cache system designed to work with CouchBase servers | libcouchbase >= 2.0 #cachedb_memcached= Implementation of a cache system designed to work with a memcached server. | Memcached client library, tipically libmemcached -#cachedb_mongodb= Implementation of a cache system designed to work with a MongoDB server. | libjson and the mongo-c-driver +#cachedb_mongodb= Implementation of a cache system designed to work with a MongoDB server. | libjson and the mongo-c-driver #cachedb_redis= Implementation of a cache system designed to work with Redis servers | Redis client library, hiredis #carrierroute= Provides routing, balancing and blacklisting capabilities. | libconfuse, a configuration file parser library #compression= Implements SIP message compression/decompression and base64 encoding | zlib dev library, tipically zlib1g-dev -#cpl-c= Implements a CPL (Call Processing Language) interpreter | library for parsing XML files, tipically libxml2 and libxml2-devel +#cpl_c= Implements a CPL (Call Processing Language) interpreter | library for parsing XML files, tipically libxml2 and libxml2-devel #db_berkeley= Integrates the Berkeley DB into OpenSIPS | Berkeley embedded database #db_http= Provides access to a database that is implemented as a HTTP server. | CURL library - libcurl #db_mysql= Provides MySQL connectivity for OpenSIPS | development libraries of mysql-client , tipically libmysqlclient-dev #db_oracle= Provides Oracle connectivity for OpenSIPS. | Development library of OCI, tipically instantclient-sdk-10.2.0.3 #db_perlvdb= Provides a virtualization framework for OpenSIPS's database access. | Perl library development files, tipically libperl-dev #db_postgres= Provides Postgres connectivity for OpenSIPS | PostgreSQL library and development library - tipically libpq5 and libpq-dev +#db_sqlite= Provides SQLite connectivity for OpenSIPS | SQLite library and development library - tipically libsqlite3 and libsqlite3-dev #db_unixodbc= Allows to use the unixodbc package with OpenSIPS | ODBC library and ODBC development library #dialplan= Implements generic string translations based on matching and replacement rules | PCRE development library, tipically libpcre-dev #emergency= Provides emergency call treatment for OpenSIPS | CURL dev library - tipically libcurl4-openssl-dev @@ -31,8 +32,9 @@ #osp= Enables OpenSIPS to support secure, multi-lateral peering using the OSP standard | OSP development kit, tipically osptoolkit #perl= Easily implement your own OpenSIPS extensions in Perl | Perl library development files, tipically libperl-dev #pi_http= Provides a simple web database provisioning interface | XML parsing & building library, tipically libxml-dev -#proto_sctp= Provides support for SCTP listeners in OpenSIPS | SCTP development library, tipically libsctp-dev -#proto_tls= Provides support for TLS listeners in OpenSIPS | SSL development library, tipically libssl-dev +#proto_sctp= Provides support for SCTP listeners in OpenSIPS | SCTP development library, tipically libsctp-dev +#proto_tls= Provides support for TLS listeners in OpenSIPS | SSL development library, tipically libssl-dev +#proto_wss= Provides support for Secure WebSocket listeners in OpenSIPS | SSL development library, tipically libssl-dev #presence= Handles PUBLISH and SUBSCRIBE messages and generates NOTIFY messages in a general, event independent way | XML parsing & Building library, tipically libxml-dev #presence_dialoginfo= Enables the handling of "Event: dialog" (as defined in RFC 4235) | XML parsing & building library, tipically libxml-dev #presence_mwi= Does specific handling for notify-subscribe message-summary (message waiting indication) events as specified in RFC 3842 | XML parsing & building library, tipically libxml-dev @@ -47,39 +49,46 @@ #rest_client= Simple HTTP client | CURL library - libcurl #rls= Resource List Server implementation following the specification in RFC 4662 and RFC 4826 | parsing/building XML library, tipically libxml-dev #sngtc= Voice Transcoding using the D-series Sangoma transcoding cards | libsngtc_node -#snmpstats= Provides an SNMP management interface to OpenSIPS | NetSNMP v5.3 +#snmpstats= Provides an SNMP management interface to OpenSIPS | NetSNMP v5.3 +#tls_mgm= Provides a TLS interface to manage certificates for OpenSIPS | SSL development library, tipically libssl-dev #xcap= XCAP utility functions for OpenSIPS. | libxml-dev #xcap_client= XCAP client for OpenSIPS.It fetches XCAP elements, either documents or part of them, by sending HTTP GET requests | libxml-dev and libcurl-dev #xmpp= Gateway between OpenSIPS and a jabber server. It enables the exchange of IMs between SIP clients and XMPP(jabber) clients. | parsing/building XML files, tipically libexpat1-devel -exclude_modules= aaa_radius b2b_logic cachedb_cassandra cachedb_couchbase cachedb_memcached cachedb_mongodb cachedb_redis carrierroute compression cpl-c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_unixodbc dialplan emergency event_rabbitmq h350 regex identity jabber json ldap lua httpd mi_xmlrpc_ng mmgeoip osp perl pi_http presence presence_dialoginfo presence_mwi presence_xml proto_sctp proto_tls pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls sngtc snmpstats xcap xcap_client xmpp db_sqlite +exclude_modules= aaa_radius b2b_logic cachedb_cassandra cachedb_couchbase cachedb_memcached cachedb_mongodb cachedb_redis carrierroute compression cpl_c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dialplan emergency event_rabbitmq h350 regex identity jabber json ldap lua httpd mi_xmlrpc_ng mmgeoip osp perl pi_http presence presence_dialoginfo presence_mwi presence_xml proto_sctp proto_tls proto_wss pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls sngtc snmpstats tls_mgm xcap xcap_client xmpp -include_modules= b2b_logic cachedb_redis carrierroute cpl-c dialplan event_rabbitmq regex identity jabber json mi_xmlrpc_ng perl pi_http presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls xcap xcap_client xmpp +include_modules= b2b_logic cachedb_redis carrierroute cpl_c dialplan event_rabbitmq regex identity jabber json mi_xmlrpc_ng perl pi_http presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls xcap xcap_client xmpp -DEFS+= -DPKG_MALLOC #Uses a faster malloc (exclusive w/ USE_SHM_MEM) +#DEFS_GROUP_START +DEFS+= -DPKG_MALLOC #Uses a faster malloc +#DEFS+= -DUSE_SHM_MEM #All PKG allocations are mapped to SHM +#DEFS_GROUP_END DEFS+= -DSHM_MMAP #Use mmap instead of SYSV shared memory DEFS+= -DUSE_MCAST #Compile in support for IP Multicast DEFS+= -DDISABLE_NAGLE #Disabled the TCP NAgle Algorithm ( lower delay ) DEFS+= -DSTATISTICS #Enables the statistics manager DEFS+= -DHAVE_RESOLV_RES #Support for changing some of the resolver parameters +#DEFS_GROUP_START +##DEFS+= -DVQ_MALLOC #Very quick & wasteful mem allocator (currently disabled) +#DEFS+= -DQM_MALLOC #Quality assurance memory allocator with runtime safety checks +DEFS+= -DF_MALLOC #Fast memory allocator with minimal runtime overhead #DEFS+= -DHP_MALLOC #High performance allocator with fine-grained locking -DEFS+= -DF_MALLOC #An even faster allocator. Not recommended for debugging -#DEFS+= -DF_MALLOC_OPTIMIZATIONS #Remove all internal checks in F_MALLOC -#DEFS+= -DDBG_QM_MALLOC #Allocator used for debugging information -#DEFS+= -DUSE_SHM_MEM #All PKG allocations are mapped to SHM ( exclusive w/ PKG_MALLOC ) -#DEFS+= -DDBG_F_MALLOC #TODO ? +#DEFS_GROUP_END +#DEFS+= -DDBG_MALLOC #Enables debugging for memory allocators +#DEFS+= -DF_MALLOC_OPTIMIZATIONS #Remove all safety checks in F_MALLOC #DEFS+= -DNO_DEBUG #Turns off all debug messages #DEFS+= -DNO_LOG #Completely turns off all the logging -#DEFS+= -DVQ_MALLOC #TODO ? #DEFS+= -DFAST_LOCK #Uses fast architecture specific locking #DEFS+= -DUSE_FUTEX #Uses linux futexs with fast architecture specific locking #DEFS+= -DUSE_SYSV_SEM #Uses SYSV sems for locking ( slower & limited number of locks -#DEFS+= -DUSE_PTHREAD_MUTEX #Uses pthread mutexes +#DEFS+= -DUSE_PTHREAD_MUTEX #Uses pthread mutexes for locking +#DEFS+= -DUSE_POSIX_SEM #Uses POSIX sems for locking #DEFS+= -DBUSY_WAIT #Uses busy waiting on the lock -#DEFS+= -DDBG_LOCK #TODO ? -#DEFS+= -DNOSMP #Do not use SMP sompliant locking. Faster but won't work on SMP machines +#DEFS+= -DDBG_LOCK #Attach debug info to all lock structures +#DEFS+= -DNOSMP #Do not use SMP sompliant locking. Faster but won't work on SMP machines #DEFS+= -DEXTRA_DEBUG #Compiles in some extra debugging code #DEFS+= -DORACLE_USRLOC #Uses Oracle compatible queries for USRLOC +#DEFS+= -DSHM_EXTRA_STATS #Needed when using the mem-group core parameter PREFIX=_PREFIX_ BASEDIR=_STAGE_DIR_ diff -ruN net/opensips.orig/files/opensips.cfg.sample net/opensips/files/opensips.cfg.sample --- net/opensips.orig/files/opensips.cfg.sample 2015-10-02 00:34:41.000000000 +0800 +++ net/opensips/files/opensips.cfg.sample 2018-03-16 10:11:45.170891000 +0800 @@ -1,37 +1,45 @@ # -# $Id$ -# # OpenSIPS residential configuration script -# by OpenSIPS Solutions # -# This script was generated via "make menuconfig", from -# the "Residential" scenario. +# This script was originally generated via +# 'CC=gcc6 gmake menuconfig', from the "Residential" scenario. # You can enable / disable more features / functionalities by -# re-generating the scenario with different options.# +# re-generating the scenario with different options. +# +# To generate an opensips script in FreeBSD, run the following commands, +# after installing the port / package. +# $ cd /usr/ports/net/opensips +# $ make patch +# $ cd work/opensips-*/ +# $ CC=gcc6 gmake menuconfig +# $ ls tmp/ +# +# As the FreeBSD port maintainer, I have tailored it a little +# to resemble the (hopefully) sane set of defaults for a residential +# SIP router running on FreeBSD and using PostgreSQL as backend database. +# For other supported databases, it should be as simple as changing all +# the db_url variables throughout this script. # # Please refer to the Core CookBook at: -# http://www.opensips.org/Resources/DocsCookbooks -# for a explanation of possible statements, functions and parameters. +# http://www.opensips.org/Resources/DocsCookbooks +# for an explanation of possible statements, functions and parameters. # ####### Global Parameters ######### -debug=3 +log_level=3 log_stderror=no log_facility=LOG_LOCAL0 -fork=yes children=4 /* uncomment the following lines to enable debugging */ -#debug=6 -#fork=no -#log_stderror=yes +#debug_mode=yes /* uncomment the next line to enable the auto temporary blacklisting of not available destinations (default disabled) */ -disable_dns_blacklist=yes +#disable_dns_blacklist=no /* uncomment the next line to enable IPv6 lookup after IPv4 dns lookup failures (default disabled) */ @@ -42,17 +50,15 @@ auto_aliases=no -listen=udp:127.0.0.1:5060 # CUSTOMIZE ME - -#listen=tcp:127.0.0.1:5060 # CUSTOMIZE ME -#listen=tls:127.0.0.1:5061 # CUSTOMIZE ME - -#advertised_address=111.222.333.444 # CUSTOMIZE ME +listen=udp:192.168.10.12:5060 # CUSTOMIZE ME +listen=tcp:192.168.10.12:5060 # CUSTOMIZE ME +listen=tls:192.168.10.12:5061 # CUSTOMIZE ME +#advertised_address=12.34.56.78 # CUSTOMIZE ME (for running behind a NAT router) +#alias=12.34.56.78 # CUSTOMIZE ME +alias="domain1.net" # CUSTOMIZE ME +#alias="domain2.com" # CUSTOMIZE ME -#alias=111.222.333.444 # CUSTOMIZE ME -#alias=example.org # CUSTOMIZE ME - -db_default_url="postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +db_default_url="postgres://dbuser:dbpass@dbhostname/dbname" ####### Modules Section ######## @@ -92,6 +98,7 @@ #### URI module loadmodule "uri.so" modparam("uri", "use_uri_table", 0) + @@ -101,7 +108,6 @@ #### MYSQL module #loadmodule "db_mysql.so" - #### HTTPD module #loadmodule "httpd.so" #modparam("httpd", "port", 8888) @@ -110,15 +116,16 @@ loadmodule "usrloc.so" modparam("usrloc", "nat_bflag", "NAT") modparam("usrloc", "db_mode", 2) -modparam("usrloc", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME -modparam("usrloc", "hash_size", 11) +modparam("usrloc", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME +#modparam("usrloc", "hash_size", 11) # increases size of userloc hash table #### REGISTRAR module loadmodule "registrar.so" modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT") modparam("registrar", "received_avp", "$avp(received_nh)") -modparam("registrar", "max_contacts", 10) +/* uncomment the next line not to allow more than 10 contacts per AOR */ +#modparam("registrar", "max_contacts", 10) #### ACCounting module loadmodule "acc.so" @@ -129,11 +136,8 @@ if you enable this parameter, be sure the enable "append_fromtag" in "rr" module */ modparam("acc", "detect_direction", 0) -modparam("acc", "failed_transaction_flag", "ACC_FAILED") -/* account triggers (flags) */ -modparam("acc", "db_flag", "ACC_DO") -modparam("acc", "db_missed_flag", "ACC_MISSED") -modparam("acc", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +modparam("acc", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME + #### AUTHentication modules @@ -141,31 +145,34 @@ loadmodule "auth_db.so" modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password") -modparam("auth_db", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +modparam("auth_db", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME modparam("auth_db", "load_credentials", "") + #### ALIAS module loadmodule "alias_db.so" -modparam("alias_db", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +modparam("alias_db", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME + #### DOMAIN module loadmodule "domain.so" -modparam("domain", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +modparam("domain", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME modparam("domain", "db_mode", 1) # Use caching modparam("auth_db|usrloc|uri", "use_domain", 1) + #### PRESENCE modules loadmodule "xcap.so" loadmodule "presence.so" loadmodule "presence_xml.so" -modparam("xcap|presence", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +modparam("xcap|presence", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060") # CUSTOMIZE ME -modparam("presence", "subs_htable_size", 11) -modparam("presence", "pres_htable_size", 11) +#modparam("presence", "subs_htable_size", 11) # increases size of presence subs hash table +#modparam("presence", "pres_htable_size", 11) # increases size of presence pres hash table #modparam("presence", "max_expires_subscribe", 600) #modparam("presence", "max_expires_publish", 600) @@ -175,43 +182,64 @@ modparam("dialog", "dlg_match_mode", 1) modparam("dialog", "default_timeout", 21600) # 6 hours timeout modparam("dialog", "db_mode", 2) -modparam("dialog", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +modparam("dialog", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME + #### NAT modules loadmodule "nathelper.so" modparam("nathelper", "natping_interval", 10) modparam("nathelper", "ping_nated_only", 1) +modparam("nathelper", "sipping_bflag", "SIP_PING_FLAG") +modparam("nathelper", "sipping_from", "sip:pinger@127.0.0.1") #CUSTOMIZE ME modparam("nathelper", "received_avp", "$avp(received_nh)") loadmodule "rtpproxy.so" -modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:22222") # CUSTOMIZE ME +modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:12221") # CUSTOMIZE ME (make sure rtpproxy port matches server) #### DIALPLAN module loadmodule "dialplan.so" -modparam("dialplan", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME +modparam("dialplan", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME + +#### DYNAMMIC ROUTING module +loadmodule "drouting.so" +modparam("drouting", "db_url", "postgres://dbuser:dbpass@dbhostname/dbname") # CUSTOMIZE ME + #### MI_HTTP module #loadmodule "mi_http.so" +#### UDP module loadmodule "proto_udp.so" -#loadmodule "proto_tcp.so" -#loadmodule "proto_tls.so" -#modparam("proto_tls","verify_cert", "1") -#modparam("proto_tls","require_cert", "0") -#modparam("proto_tls","tls_method", "TLSv1") -#modparam("proto_tls","certificate", "/usr/local/etc/opensips/tls/user/user-cert.pem") -#modparam("proto_tls","private_key", "/usr/local/etc/opensips/tls/user/user-privkey.pem") -#modparam("proto_tls","ca_list", "/usr/local/etc/opensips/tls/user/user-calist.pem") +#### TCP module +loadmodule "proto_tcp.so" +#modparam("proto_tcp", "tcp_send_timeout", 200) +#modparam("proto_tcp", "tcp_max_msg_chunks", 8) + + +#### TLS modules +loadmodule "proto_tls.so" +loadmodule "tls_mgm.so" +modparam("tls_mgm","verify_cert", "1") +modparam("tls_mgm","require_cert", "0") +modparam("tls_mgm","tls_method", "TLSv1") +#modparam("tls_mgm","ca_dir", "/usr/local/etc/opensips/tls/user/") +modparam("tls_mgm","certificate", "/usr/local/etc/opensips/tls/user/user-cert.pem") +modparam("tls_mgm","private_key", "/usr/local/etc/opensips/tls/user/user-privkey.pem") +modparam("tls_mgm","ca_list", "/usr/local/etc/opensips/tls/user/user-calist.pem") +#modparam("tls_mgm", "tls_send_timeout", 200) +#modparam("tls_mgm", "tls_handshake_timeout", 119) +#modparam("proto_tls", "tls_max_msg_chunks", 8) + ####### Routing Logic ######## # main request routing logic @@ -246,8 +274,9 @@ } if (is_method("BYE")) { - setflag(ACC_DO); # do accounting ... - setflag(ACC_FAILED); # ... even if the transaction fails + # do accounting even if the transaction fails + do_accounting("db","failed"); + } else if (is_method("INVITE")) { # even if in most of the cases is useless, do RR for # re-INVITEs alos, as some buggy clients do change route set @@ -294,7 +323,7 @@ t_check_trans(); - if ( !(is_method("REGISTER") ) ) { + if ( !(is_method("REGISTER") || is_from_gw() ) ) { if (is_from_local()) { @@ -347,7 +376,8 @@ exit; } - setflag(ACC_DO); # do accounting + do_accounting("db"); + } @@ -372,7 +402,6 @@ if (is_method("REGISTER")) { - # authenticate the REGISTER requests if (!www_authorize("", "subscriber")) { @@ -388,6 +417,10 @@ if ( proto==TCP || proto==TLS || 0 ) setflag(TCP_PERSISTENT); + if (isflagset(NAT)) { + setbflag(SIP_PING_FLAG); + } + if (!save("location")) sl_reply_error(); @@ -408,6 +441,17 @@ # apply transformations from dialplan table dp_translate("0","$rU/$rU"); + + if ($rU=~"^\+[1-9][0-9]+$") { + + if (!do_routing("0")) { + send_reply("500","No PSTN Route found"); + exit; + } + + route(relay); + exit; + } # do lookup with method filtering @@ -417,15 +461,17 @@ exit; } - t_newtran(); - t_reply("404", "Not Found"); - exit; + # redirect to a different VM system + $du = "sip:127.0.0.2:5060"; # CUSTOMIZE ME + route(relay); + } if (isbflagset(NAT)) setflag(NAT); # when routing via usrloc, log the missed calls also - setflag(ACC_MISSED); + do_accounting("db","missed"); + route(relay); } @@ -504,6 +550,12 @@ ##} + # redirect the failed to a different VM system + if (t_check_status("486|408")) { + $du = "sip:127.0.0.2:5060"; # CUSTOMIZE ME + # do not set the missed call flag again + route(relay); + } } diff -ruN net/opensips.orig/files/opensips.in net/opensips/files/opensips.in --- net/opensips.orig/files/opensips.in 2015-10-02 00:34:41.000000000 +0800 +++ net/opensips/files/opensips.in 2018-03-16 10:11:45.171520000 +0800 @@ -23,8 +23,10 @@ load_rc_config opensips opensips_enable=${opensips_enable:-"NO"} -opensips_shmem_size=${opensips_shmem_size:-"32"} -opensips_pkmem_size=${opensips_pkmem_size:-"2"} +opensips_shmem_size=${opensips_shmem_size:-"64"} +opensips_pkmem_size=${opensips_pkmem_size:-"4"} +opensips_user=${opensips_user:-"opensips"} +opensips_group=${opensips_group:-"opensips"} command="${prefix}/sbin/opensips" command_args="-m ${opensips_shmem_size} -M ${opensips_pkmem_size}" diff -ruN net/opensips.orig/files/patch-modules__proto_tls__proto_tls.c net/opensips/files/patch-modules__proto_tls__proto_tls.c --- net/opensips.orig/files/patch-modules__proto_tls__proto_tls.c 2016-07-17 23:41:55.000000000 +0800 +++ net/opensips/files/patch-modules__proto_tls__proto_tls.c 1970-01-01 07:30:00.000000000 +0730 @@ -1,10 +0,0 @@ ---- modules/proto_tls/proto_tls.c.orig 2016-05-30 14:13:27 UTC -+++ modules/proto_tls/proto_tls.c -@@ -42,6 +42,7 @@ - #include - #include - -+#include - #include - #include - #include diff -ruN net/opensips.orig/pkg-message net/opensips/pkg-message --- net/opensips.orig/pkg-message 1970-01-01 07:30:00.000000000 +0730 +++ net/opensips/pkg-message 2018-03-16 10:11:45.170115000 +0800 @@ -0,0 +1,18 @@ +############################################################################### + +OpenSIPS was installed + +For further installation and configuration instructions, +visit the following web page: + +http://www.opensips.org/Documentation/Manual-2-2 + +For migrating from a previous major release, visit the following web page: + +http://www.opensips.org/Documentation/Migration + + +An rtpproxy server will most likely be needed, running on an accessible host. +It may be worth looking at net/rtpproxy. + +############################################################################## diff -ruN net/opensips.orig/pkg-plist net/opensips/pkg-plist --- net/opensips.orig/pkg-plist 2017-03-28 17:29:36.000000000 +0800 +++ net/opensips/pkg-plist 2018-03-16 11:16:27.127622000 +0800 @@ -1,7 +1,3 @@ -%%RADIUS%%@sample %%ETCDIR%%/dictionary.opensips.sample -@sample %%ETCDIR%%/opensips.cfg.sample -@sample %%ETCDIR%%/opensipsctlrc.sample -@sample %%ETCDIR%%/osipsconsolerc.sample %%TLS%%%%ETCDIR%%/tls/README %%TLS%%%%ETCDIR%%/tls/ca.conf %%TLS%%%%ETCDIR%%/tls/request.conf @@ -101,7 +97,7 @@ lib/opensips/modules/proto_hep.so %%TLS%%lib/opensips/modules/proto_tls.so lib/opensips/modules/proto_ws.so -lib/opensips/modules/proto_wss.so +%%TLS%%lib/opensips/modules/proto_wss.so lib/opensips/modules/pua.so lib/opensips/modules/pua_bla.so lib/opensips/modules/pua_dialoginfo.so @@ -132,7 +128,7 @@ lib/opensips/modules/statistics.so lib/opensips/modules/stun.so lib/opensips/modules/textops.so -lib/opensips/modules/tls_mgm.so +%%TLS%%lib/opensips/modules/tls_mgm.so lib/opensips/modules/tm.so lib/opensips/modules/topology_hiding.so lib/opensips/modules/uac.so @@ -680,3 +676,10 @@ %%TESTS%%tests/opensips/subscribe_notify.csv %%TESTS%%tests/opensips/subscribe_notify_scenario.xml %%TESTS%%tests/opensips/unregister.sip +@mode 600 +@sample %%ETCDIR%%/opensipsctlrc.sample +@sample %%ETCDIR%%/osipsconsolerc.sample +%%RADIUS%%@sample %%ETCDIR%%/dictionary.opensips.sample +@owner opensips +@group opensips +@sample %%ETCDIR%%/opensips.cfg.sample