Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Oct 2015 16:34:42 +0000 (UTC)
From:      Kurt Jaeger <pi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r398368 - in head/net: . opensips opensips/files
Message-ID:  <201510011634.t91GYgKh085051@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pi
Date: Thu Oct  1 16:34:41 2015
New Revision: 398368
URL: https://svnweb.freebsd.org/changeset/ports/398368

Log:
  New port: net/opensips
  
  OpenSIPS (Open SIP Server) is a mature Open Source implementation
  of a SIP server.
  
  It includes application-level functionalities and is the core component
  of any SIP-based VoIP solution. With a very flexible and customizable
  routing engine, OpenSIPS unifies voice, video, IM and presence
  services in a highly efficient way, thanks to its scalable (modular)
  design.
  
  It is reliable and fast, for enterprise or carrier-grade use cases.
  
  WWW: http://www.opensips.org/
  
  PR:		203407
  Submitted by:	Euan Thoms <euan@potensol.com>

Added:
  head/net/opensips/
  head/net/opensips/Makefile   (contents, props changed)
  head/net/opensips/distinfo   (contents, props changed)
  head/net/opensips/files/
  head/net/opensips/files/Makefile.conf   (contents, props changed)
  head/net/opensips/files/opensips.cfg.sample   (contents, props changed)
  head/net/opensips/files/opensips.in   (contents, props changed)
  head/net/opensips/files/patch-Makefile   (contents, props changed)
  head/net/opensips/files/patch-Makefile.defs   (contents, props changed)
  head/net/opensips/files/patch-io_wait.h   (contents, props changed)
  head/net/opensips/files/patch-net__net_tcp.c   (contents, props changed)
  head/net/opensips/files/patch-net__net_tcp_proc.c   (contents, props changed)
  head/net/opensips/pkg-descr   (contents, props changed)
  head/net/opensips/pkg-plist   (contents, props changed)
Modified:
  head/net/Makefile

Modified: head/net/Makefile
==============================================================================
--- head/net/Makefile	Thu Oct  1 16:33:35 2015	(r398367)
+++ head/net/Makefile	Thu Oct  1 16:34:41 2015	(r398368)
@@ -477,6 +477,7 @@
     SUBDIR += openospfd
     SUBDIR += openpgm
     SUBDIR += openradius
+    SUBDIR += opensips
     SUBDIR += openslp
     SUBDIR += opentracker
     SUBDIR += openvswitch

Added: head/net/opensips/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/Makefile	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,228 @@
+# Created by: Euan Thoms <euan@potensol.com>
+# $FreeBSD$
+
+PORTNAME=		opensips
+PORTVERSION=		2.1.0
+CATEGORIES=		net
+MASTER_SITES=		http://opensips.org/pub/opensips/${PORTVERSION}/src/
+# DISTNAME=		opensips-${PORTVERSION}
+
+MAINTAINER=		euan@potensol.com
+COMMENT=		Open SIP Server
+
+LICENSE=		GPLv2
+LICENSE_FILE=		${WRKSRC}/COPYING
+
+LIB_DEPENDS=		libxml2.so:${PORTSDIR}/textproc/libxml2 \
+			libxmlrpc.so:${PORTSDIR}/net/xmlrpc-c-devel \
+			libpcre.so:${PORTSDIR}/devel/pcre \
+			libconfuse.so:${PORTSDIR}/devel/libconfuse \
+			librabbitmq.so:${PORTSDIR}/net/rabbitmq-c-devel \
+			libhiredis.so:${PORTSDIR}/databases/hiredis \
+			libexpat.so:${PORTSDIR}/textproc/expat2 \
+			libjson-c.so:${PORTSDIR}/devel/json-c
+BUILD_DEPENDS=		ginstall:${PORTSDIR}/sysutils/coreutils \
+			gtar:${PORTSDIR}/archivers/gtar \
+			gm4:${PORTSDIR}/devel/m4 \
+			redis-server:${PORTSDIR}/databases/redis-devel \
+			python2:${PORTSDIR}/lang/python2 \
+			python:${PORTSDIR}/lang/python
+RUN_DEPENDS=		${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash \
+			${LOCALBASE}/bin/python2:${PORTSDIR}/lang/python2 \
+			${LOCALBASE}/bin/grep:${PORTSDIR}/textproc/gnugrep
+
+#CFLAGS+=		-I${LOCALBASE}/include/json-c
+#CPPFLAGS+=		-I${LOCALBASE}/include/json-c
+
+GINSTALL=		ginstall
+
+WRKSRC=			${WRKDIR}/opensips-${PORTVERSION}
+DOCSDIR=		share/doc/opensips
+
+USE_RC_SUBR=		opensips
+
+USES=			gmake perl5 pkgconfig shebangfix
+USE_GCC=		yes
+
+OPTIONS_DEFINE=		DEBUG DOCS EXAMPLES GEOIP HTTP LDAP MEMCACHED MYSQL PGSQL RADIUS TESTS TLS UNIXODBC
+OPTIONS_DEFAULT=	DOCS EXAMPLES GEOIP HTTP LDAP MEMCACHED PGSQL RADIUS TLS
+OPTIONS_SUB=		yes
+
+GEOIP_DESC=		Build with GeoIP support
+HTTP_DESC=		Enable HTTP transport via libmicrohttpd
+MEMCACHED_DESC=		Build with memcached support
+TESTS_DESC=		Install smoke tests
+
+LDAP_USE=		OPENLDAP=client
+MYSQL_USE=		MYSQL=client
+PGSQL_USES+=		pgsql
+
+PGSQL_BUILD_DEPENDS+=	p5-DBD-Pg>=3.4:${PORTSDIR}/databases/p5-DBD-Pg
+RADIUS_BUILD_DEPENDS+=	radiusclient:${PORTSDIR}/net/radiusclient
+HTTP_LIB_DEPENDS+=	libmicrohttpd.so:${PORTSDIR}/www/libmicrohttpd
+GEOIP_LIB_DEPENDS+=	libGeoIP.so:${PORTSDIR}/net/GeoIP
+MEMCACHED_LIB_DEPENDS+=	libmemcached.so:${PORTSDIR}/databases/libmemcached
+UNIXODBC_LIB_DEPENDS+=	libodbc.so:${PORTSDIR}/databases/unixODBC
+
+SHEBANG_FILES=		scripts/osipsconsole \
+			modules/jabber/doc/jabberreg.pl \
+			modules/sipcapture/examples/partrotate_unixtimestamp.pl \
+			scripts/dbtextdb/__init__.py \
+			scripts/dbtextdb/dbtextdb.py \
+			scripts/dbtextdb/dbtextdb_test.py \
+			packaging/fedora/opensips.m4cfg \
+			packaging/fedora/opensips.init \
+			packaging/rpm/opensips.init \
+			modules/seas/doc/xml2sgml.sh \
+			utils/fifo_relay/fifo_server.php \
+			test/1.sh \
+			test/2.sh \
+			test/3.sh \
+			test/4.sh \
+			test/5.sh \
+			test/6.sh \
+			test/7.sh \
+			test/8.sh \
+			test/9.sh \
+			test/10.sh \
+			test/11.sh \
+			test/12.sh \
+			test/13.sh \
+			test/14.sh \
+			test/15.sh \
+			test/16.sh \
+			test/17.sh \
+			test/18.sh \
+			test/19.sh \
+			test/20.sh \
+			test/21.sh \
+			test/22.sh \
+			test/23.sh \
+			test/24.sh \
+			test/25.sh \
+			test/26.sh \
+			test/27.sh \
+			test/28.sh \
+			test/29.sh \
+			test/30.sh \
+			test/31.sh \
+			test/32.sh \
+			test/33.sh \
+			test/34.sh \
+			test/35.sh
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MGEOIP}
+EXTRA_MODULES+=		mmgeoip
+.endif
+
+.if ${PORT_OPTIONS:MHTTP}
+EXTRA_MODULES+=		httpd
+.endif
+
+.if ${PORT_OPTIONS:MLDAP}
+EXTRA_MODULES+=		ldap h350
+.endif
+
+.if ${PORT_OPTIONS:MMEMCACHED}
+EXTRA_MODULES+=		cachedb_memcached
+.endif
+
+.if ${PORT_OPTIONS:MMYSQL}
+EXTRA_MODULES+=		db_mysql
+.endif
+
+.if ${PORT_OPTIONS:MPGSQL}
+#USES+=			pgsql
+EXTRA_MODULES+=		db_postgres
+.endif
+
+.if ${PORT_OPTIONS:MRADIUS}
+EXTRA_MODULES+=		aaa_radius
+.endif
+
+.if ${PORT_OPTIONS:MUNIXODBC}
+EXTRA_MODULES+=		db_unixodbc
+.endif
+
+OPENSIPS_MAKE_ENV=	CC="${CC}" CXX="${CXX}" CPP="${CPP}" _GCC_RUNTIME="${_GCC_RUNTIME}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}"
+
+do-configure:
+	(cp files/Makefile.conf ${WRKSRC})
+
+	@${REINPLACE_CMD} -e "s|_PREFIX_|${PREFIX}|" ${WRKSRC}/Makefile.conf
+	@${REINPLACE_CMD} -e "s|_STAGE_DIR_|${STAGEDIR}|" ${WRKSRC}/Makefile.conf
+
+.for i in ${EXTRA_MODULES}
+	@${REINPLACE_CMD} -e "s/\(^include_modules=.*\)/\1 ${i}/" ${WRKSRC}/Makefile.conf
+.endfor
+
+.if ${PORT_OPTIONS:MTLS}
+	@${REINPLACE_CMD} -e "s/^#DEFS+= -DUSE_TLS/DEFS+= -DUSE_TLS/" ${WRKSRC}/Makefile.conf
+	@${ECHO_CMD} "TLS=1" >> ${WRKSRC}/Makefile.conf
+.endif
+
+.if ! ${PORT_OPTIONS:MDEBUG}
+	@${REINPLACE_CMD} -e "s/^#DEFS+= -DNO_DEBUG/DEFS+= -DNO_DEBUG/" ${WRKSRC}/Makefile.conf
+.endif
+
+do-build:
+	cd ${WRKSRC} && ${OPENSIPS_MAKE_ENV} ${GMAKE} ${_MAKE_JOBS} ${ALL_TARGET}
+
+do-install:
+	cd ${WRKSRC} && ${OPENSIPS_MAKE_ENV} ${GMAKE} ${INSTALL_TARGET}
+
+.if ${PORT_OPTIONS:MTESTS}
+	(cp -r ${WRKSRC}/test ${STAGEDIR}${PREFIX}/tests/opensips)
+.endif
+
+.if ${PORT_OPTIONS:MEXAMPLES}
+	(cp -r ${WRKSRC}/examples ${STAGEDIR}${PREFIX}/share/examples/opensips)
+.endif
+
+post-stage:
+	@${REINPLACE_CMD} -e "s|^# MD5=.*|MD5=\"md5\"|" ${STAGEDIR}${PREFIX}/etc/opensips/opensipsctlrc.sample
+	@${REINPLACE_CMD} -e "s|^# GREP=.*|GREP=\"${LOCALBASE}/bin/grep\"|" ${STAGEDIR}${PREFIX}/etc/opensips/opensipsctlrc.sample
+	@${REINPLACE_CMD} -e "s|^# MD5=.*|MD5=\"md5\"|" ${STAGEDIR}${PREFIX}/etc/opensips/osipsconsolerc.sample
+	@${REINPLACE_CMD} -e "s|^# GREP=.*|GREP=\"${LOCALBASE}/bin/egrep\"|" ${STAGEDIR}${PREFIX}/etc/opensips/osipsconsolerc.sample
+	(cp ${FILESDIR}/opensips.cfg.sample ${STAGEDIR}${ETCDIR}/opensips.cfg.sample)
+
+# Strip binaries in sbin
+	@${ECHO_CMD} "Stripping binaries in ${STAGEDIR}${PREFIX}/sbin/"
+
+.for i in opensipsunix opensips osipsconfig
+	@if [ -e ${STAGEDIR}${PREFIX}/sbin/${i} ]; then \
+		${STRIP_CMD} ${STAGEDIR}${PREFIX}/sbin/${i}; \
+	fi
+.endfor
+
+# Strip binaries in lib/opensips/modules
+	@${ECHO_CMD} "Stripping binaries in ${STAGEDIR}${PREFIX}/lib/opensips/modules/"
+
+.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 \
+		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 \
+		gflags.so group.so h350.so httpd.so identity.so imc.so jabber.so json.so ldap.so \
+		load_balancer.so mangler.so mathops.so maxfwd.so mediaproxy.so mi_datagram.so \
+		mi_fifo.so mi_http.so mi_json.so mi_xmlrpc.so mi_xmlrpc_ng.so mmgeoip.so msilo.so \
+		nat_traversal.so nathelper.so options.so path.so pdt.so peering.so perl.so \
+		permissions.so pi_http.so pike.so presence.so presence_callinfo.so \
+		presence_dialoginfo.so presence_mwi.so presence_xcapdiff.so presence_xml.so pua.so \
+		pua_bla.so pua_dialoginfo.so pua_mi.so pua_usrloc.so pua_xmpp.so python.so qos.so \
+		ratelimit.so regex.so registrar.so rest_client.so rls.so rr.so rtpproxy.so \
+		script_helper.so seas.so signaling.so sipcapture.so sipmsgops.so siptrace.so sl.so \
+		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
+		@if [ -e ${STAGEDIR}${PREFIX}/lib/opensips/modules/${i} ]; then \
+			${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/opensips/modules/${i}; \
+		fi
+.endfor
+
+.include <bsd.port.mk>

Added: head/net/opensips/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/distinfo	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,2 @@
+SHA256 (opensips-2.1.0.tar.gz) = 9dffa61bcf91e17bc6d6d700f669516448875c61accf9c46a67731e260ad958c
+SIZE (opensips-2.1.0.tar.gz) = 8470358

Added: head/net/opensips/files/Makefile.conf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/files/Makefile.conf	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,87 @@
+#aaa_radius= Radius implementation for the AAA API from the core | Radius client development library, tipically radiusclient-ng 0.5.0 or higher
+#b2b_logic= Logic engine of B2BUA, responsible of actually implementing the B2BUA services | xml parsing development library, typically libxml2-dev
+#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_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
+#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_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
+#event_rabbitmq= Provides the implementation of a RabbitMQ client for the Event Interface | RabbitMQ development library, librabbitmq-dev
+#h350= Enables access to SIP account data stored in an LDAP [RFC4510] directory containing H.350 commObjects | OpenLDAP library & development files, tipically libldap and libldap-dev
+#regex= Offers matching operations against regular expressions using the powerful PCRE library. | Development library for PCRE, tipically libpcre-dev
+#identity= Adds support for SIP Identity (see RFC 4474). | SSL library, tipically libssl
+#jabber= Integrates XODE XML parser for parsing Jabber messages | Expat library.
+#json= Introduces a new type of variable that provides both serialization and de-serialization from JSON format. | JSON library, libjson
+#ldap= Implements an LDAP search interface for OpenSIPS | OpenLDAP library & development files, tipically libldap and libldap-dev
+#lua= Easily implement your own OpenSIPS extensions in Lua | liblua5.1-0-dev, libmemcache-dev and libmysqlclient-dev
+#httpd= Provides an HTTP transport layer implementation for OpenSIPS. | libmicrohttpd
+#mi_xmlrpc_ng= New version of the xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml
+#mmgeoip= Lightweight wrapper for the MaxMind GeoIP API | libGeoIP
+#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 
+#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
+#presence_xml= Does specific handling for notify-subscribe events using xml bodies. | XML parsing & building library, tipically libxml-dev
+#pua= Offers the functionality of a presence user agent client, sending Subscribe and Publish messages. | XML parsing & building library, tipically libxml-dev
+#pua_bla= Enables Bridged Line Appearances support according | XML parsing & building library, tipically libxml-dev
+#pua_dialoginfo= Retrieves dialog state information from the dialog module and PUBLISHes the dialog-information using the pua module. | XML parsing & building library,tipically libxml-dev
+#pua_mi= Offers the possibility to publish presence information and subscribe to presence information via MI transports. | XML parsing & building library,tipically libxml-dev
+#pua_usrloc= Connector between usrloc and pua modules. | XML parsing & building library,tipically libxml-dev
+#pua_xmpp= Gateway for presence between SIP and XMPP. | XML parsing & building library,tipically libxml-dev
+#python= Easily implement your own OpenSIPS extensions in Python | Shared Python runtime library, libpython
+#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 
+#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 
+
+include_modules= b2b_logic 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+= -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+= -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+= -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+= -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+= -DEXTRA_DEBUG #Compiles in some extra debugging code
+#DEFS+= -DORACLE_USRLOC #Uses Oracle compatible queries for USRLOC
+
+PREFIX=_PREFIX_
+BASEDIR=_STAGE_DIR_
+INSTALL=ginstall -p -v
+TAR=gtar

Added: head/net/opensips/files/opensips.cfg.sample
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/files/opensips.cfg.sample	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,517 @@
+#
+# $Id$
+#
+# OpenSIPS residential configuration script
+#     by OpenSIPS Solutions <team@opensips-solutions.com>
+#
+# This script was generated via "make menuconfig", from
+#   the "Residential" scenario.
+# You can enable / disable more features / functionalities by
+#   re-generating the scenario with different options.#
+#
+# Please refer to the Core CookBook at:
+#      http://www.opensips.org/Resources/DocsCookbooks
+# for a explanation of possible statements, functions and parameters.
+#
+
+
+####### Global Parameters #########
+
+debug=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
+
+/* uncomment the next line to enable the auto temporary blacklisting of 
+   not available destinations (default disabled) */
+disable_dns_blacklist=yes
+
+/* uncomment the next line to enable IPv6 lookup after IPv4 dns 
+   lookup failures (default disabled) */
+#dns_try_ipv6=yes
+
+/* comment the next line to enable the auto discovery of local aliases
+   based on revers DNS on IPs */
+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
+
+#alias=111.222.333.444   # CUSTOMIZE ME
+#alias=example.org   # CUSTOMIZE ME
+
+db_default_url="postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
+
+####### Modules Section ########
+
+#set module path
+mpath="/usr/local/lib/opensips/modules/"
+
+#### SIGNALING module
+loadmodule "signaling.so"
+
+#### StateLess module
+loadmodule "sl.so"
+
+#### Transaction Module
+loadmodule "tm.so"
+modparam("tm", "fr_timeout", 5)
+modparam("tm", "fr_inv_timeout", 30)
+modparam("tm", "restart_fr_on_each_reply", 0)
+modparam("tm", "onreply_avp_mode", 1)
+
+#### Record Route Module
+loadmodule "rr.so"
+/* do not append from tag to the RR (no need for this script) */
+modparam("rr", "append_fromtag", 0)
+
+#### MAX ForWarD module
+loadmodule "maxfwd.so"
+
+#### SIP MSG OPerationS module
+loadmodule "sipmsgops.so"
+
+#### FIFO Management Interface
+loadmodule "mi_fifo.so"
+modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
+modparam("mi_fifo", "fifo_mode", 0666)
+
+
+#### URI module
+loadmodule "uri.so"
+modparam("uri", "use_uri_table", 0)
+
+
+
+#### PGSQL module
+loadmodule "db_postgres.so"
+
+#### MYSQL module
+#loadmodule "db_mysql.so"
+
+
+#### HTTPD module
+#loadmodule "httpd.so"
+#modparam("httpd", "port", 8888)
+
+#### USeR LOCation module
+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)
+
+
+#### REGISTRAR module
+loadmodule "registrar.so"
+modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")
+modparam("registrar", "received_avp", "$avp(received_nh)")
+modparam("registrar", "max_contacts", 10)
+
+#### ACCounting module
+loadmodule "acc.so"
+/* what special events should be accounted ? */
+modparam("acc", "early_media", 0)
+modparam("acc", "report_cancels", 0)
+/* by default we do not adjust the direct of the sequential requests.
+   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
+
+
+#### AUTHentication modules
+loadmodule "auth.so"
+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", "load_credentials", "")
+
+
+#### ALIAS module
+loadmodule "alias_db.so"
+modparam("alias_db", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
+
+
+#### DOMAIN module
+loadmodule "domain.so"
+modparam("domain", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # 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("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", "max_expires_subscribe", 600)
+#modparam("presence", "max_expires_publish", 600)
+
+
+#### DIALOG module
+loadmodule "dialog.so"
+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
+
+
+####  NAT modules
+loadmodule "nathelper.so"
+modparam("nathelper", "natping_interval", 10)
+modparam("nathelper", "ping_nated_only", 1)
+modparam("nathelper", "received_avp", "$avp(received_nh)")
+
+loadmodule "rtpproxy.so"
+modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:22222") # CUSTOMIZE ME
+
+
+####  DIALPLAN module
+loadmodule "dialplan.so"
+modparam("dialplan", "db_url", "postgres://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME
+
+
+
+
+####  MI_HTTP module
+#loadmodule "mi_http.so"
+
+
+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")
+
+ 
+
+####### Routing Logic ########
+
+# main request routing logic
+
+route{
+	force_rport();
+	if (nat_uac_test("23")) {
+		if (is_method("REGISTER")) {
+			fix_nated_register();
+			setbflag(NAT);
+		} else {
+			fix_nated_contact();
+			setflag(NAT);
+		}
+	}
+ 	
+
+	if (!mf_process_maxfwd_header("10")) {
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	}
+
+	if (has_totag()) {
+		# sequential request withing a dialog should
+		# take the path determined by record-routing
+		if (loose_route()) {
+			
+			# validate the sequential request against dialog
+			if ( $DLG_status!=NULL && !validate_dialog() ) {
+				xlog("In-Dialog $rm from $si (callid=$ci) is not valid according to dialog\n");
+				## exit;
+			}
+			
+			if (is_method("BYE")) {
+				setflag(ACC_DO); # do accounting ...
+				setflag(ACC_FAILED); # ... even if the transaction fails
+			} 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
+				# during the dialog.
+				record_route();
+			}
+
+			if (check_route_param("nat=yes")) 
+				setflag(NAT);
+
+			# route it out to whatever destination was set by loose_route()
+			# in $du (destination URI).
+			route(relay);
+		} else {
+			if (is_method("SUBSCRIBE") && $rd == "127.0.0.1:5060") { # CUSTOMIZE ME
+				# in-dialog subscribe requests
+				route(handle_presence);
+				exit;
+			}
+			if ( is_method("ACK") ) {
+				if ( t_check_trans() ) {
+					# non loose-route, but stateful ACK; must be an ACK after 
+					# a 487 or e.g. 404 from upstream server
+					t_relay();
+					exit;
+				} else {
+					# ACK without matching transaction ->
+					# ignore and discard
+					exit;
+				}
+			}
+			sl_send_reply("404","Not here");
+		}
+		exit;
+	}
+
+	# CANCEL processing
+	if (is_method("CANCEL"))
+	{
+		if (t_check_trans())
+			t_relay();
+		exit;
+	}
+
+	t_check_trans();
+
+	if ( !(is_method("REGISTER")  ) ) {
+		
+		if (is_from_local())
+		{
+			
+			# authenticate if from local subscriber
+			# authenticate all initial non-REGISTER request that pretend to be
+			# generated by local subscriber (domain from FROM URI is local)
+			if (!proxy_authorize("", "subscriber")) {
+				proxy_challenge("", "0");
+				exit;
+			}
+			if (!db_check_from()) {
+				sl_send_reply("403","Forbidden auth ID");
+				exit;
+			}
+		
+			consume_credentials();
+			# caller authenticated
+			
+		} else {
+			# if caller is not local, then called number must be local
+			
+			if (!is_uri_host_local()) {
+				send_reply("403","Rely forbidden");
+				exit;
+			}
+		}
+
+	}
+
+	# preloaded route checking
+	if (loose_route()) {
+		xlog("L_ERR",
+		"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
+		if (!is_method("ACK"))
+			sl_send_reply("403","Preload Route denied");
+		exit;
+	}
+
+	# record routing
+	if (!is_method("REGISTER|MESSAGE"))
+		record_route();
+
+	# account only INVITEs
+	if (is_method("INVITE")) {
+		
+		# create dialog with timeout
+		if ( !create_dialog("B") ) {
+			send_reply("500","Internal Server Error");
+			exit;
+		}
+		
+		setflag(ACC_DO); # do accounting
+	}
+
+	
+	if (!is_uri_host_local()) {
+		append_hf("P-hint: outbound\r\n"); 
+		
+		# if you have some interdomain connections via TLS
+		## CUSTOMIZE IF NEEDED
+		##if ($rd=="tls_domain1.net"
+		## || $rd=="tls_domain2.net"
+		##) {
+		##	force_send_socket(tls:127.0.0.1:5061); # CUSTOMIZE
+		##}
+		
+		route(relay);
+	}
+
+	# requests for my domain
+	
+	if( is_method("PUBLISH|SUBSCRIBE"))
+			route(handle_presence);
+
+	if (is_method("REGISTER"))
+	{
+		
+		# authenticate the REGISTER requests
+		if (!www_authorize("", "subscriber"))
+		{
+			www_challenge("", "0");
+			exit;
+		}
+		
+		if (!db_check_to()) 
+		{
+			sl_send_reply("403","Forbidden auth ID");
+			exit;
+		}
+
+		if ( proto==TCP || proto==TLS || 0 ) setflag(TCP_PERSISTENT);
+
+		if (!save("location"))
+			sl_reply_error();
+
+		exit;
+	}
+
+	if ($rU==NULL) {
+		# request with no Username in RURI
+		sl_send_reply("484","Address Incomplete");
+		exit;
+	}
+
+	
+	# apply DB based aliases
+	alias_db_lookup("dbaliases");
+
+	
+	# apply transformations from dialplan table
+	dp_translate("0","$rU/$rU");
+
+	 
+
+	# do lookup with method filtering
+	if (!lookup("location","m")) {
+		if (!db_does_uri_exist()) {
+			send_reply("420","Bad Extension");
+			exit;
+		}
+		
+		t_newtran();
+		t_reply("404", "Not Found");
+		exit;
+	} 
+
+	if (isbflagset(NAT)) setflag(NAT);
+
+	# when routing via usrloc, log the missed calls also
+	setflag(ACC_MISSED);
+	route(relay);
+}
+
+
+route[relay] {
+	# for INVITEs enable some additional helper routes
+	if (is_method("INVITE")) {
+		
+		if (isflagset(NAT)) {
+			rtpproxy_offer("ro");
+		}
+
+		t_on_branch("per_branch_ops");
+		t_on_reply("handle_nat");
+		t_on_failure("missed_call");
+	}
+
+	if (isflagset(NAT)) {
+		add_rr_param(";nat=yes");
+		}
+
+	if (!t_relay()) {
+		send_reply("500","Internal Error");
+	};
+	exit;
+}
+
+
+# Presence route
+route[handle_presence]
+{
+	if (!t_newtran())
+	{
+		sl_reply_error();
+		exit;
+	}
+
+	if(is_method("PUBLISH"))
+	{
+		handle_publish();
+	}
+	else
+	if( is_method("SUBSCRIBE"))
+	{
+		handle_subscribe();
+	}
+
+	exit;
+}
+
+
+branch_route[per_branch_ops] {
+	xlog("new branch at $ru\n");
+}
+
+
+onreply_route[handle_nat] {
+	if (nat_uac_test("1"))
+		fix_nated_contact();
+	if ( isflagset(NAT) )
+		rtpproxy_answer("ro");
+	xlog("incoming reply\n");
+}
+
+
+failure_route[missed_call] {
+	if (t_was_cancelled()) {
+		exit;
+	}
+
+	# uncomment the following lines if you want to block client 
+	# redirect based on 3xx replies.
+	##if (t_check_status("3[0-9][0-9]")) {
+	##t_reply("404","Not found");
+	##	exit;
+	##}
+
+	
+}
+
+
+
+local_route {
+	if (is_method("BYE") && $DLG_dir=="UPSTREAM") {
+		
+		acc_db_request("200 Dialog Timeout", "acc");
+		
+	}
+}

Added: head/net/opensips/files/opensips.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/files/opensips.in	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD: net/opensips/files/opensips.in
+#
+# PROVIDE: opensips
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable this service
+# at system startup:
+#
+# opensips_enable (bool): Set to NO by default.
+#                         Set it to YES to enable opensips.
+#
+
+prefix=/usr/local
+
+. /etc/rc.subr
+
+name=opensips
+rcvar=`set_rcvar`
+
+load_rc_config opensips
+
+opensips_enable=${opensips_enable:-"NO"}
+opensips_shmem_size=${opensips_shmem_size:-"32"}
+opensips_pkmem_size=${opensips_pkmem_size:-"2"}
+
+command="${prefix}/sbin/opensips"
+command_args="-m ${opensips_shmem_size} -M ${opensips_pkmem_size}"
+required_files="${prefix}/etc/opensips/opensipsctlrc"
+
+run_rc_command "${1}"

Added: head/net/opensips/files/patch-Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/files/patch-Makefile	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,50 @@
+--- Makefile.orig	2015-04-22 08:20:03 UTC
++++ Makefile
+@@ -39,7 +39,7 @@ auto_gen=lex.yy.c cfg.tab.c   #lexx, yac
+ # whether or not to install opensips.cfg or just opensips.cfg.default
+ # (opensips.cfg will never be overwritten by make install, this is usefull
+ #  when creating packages)
+-skip_cfg_install?=
++skip_cfg_install=yes
+ 
+ #extra modules to exclude
+ skip_modules?=
+@@ -540,38 +540,21 @@ install-cfg: $(cfg-prefix)/$(cfg-dir)
+ 		rm -fr $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0
+ 		chmod 600 $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample
+ 		chmod 700 $(cfg-prefix)/$(cfg-dir)
+-		if [ -z "${skip_cfg_install}" -a \
+-				! -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg ]; then \
+-			mv -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample \
+-				$(cfg-prefix)/$(cfg-dir)$(NAME).cfg; \
+-		fi
+ 		# radius dictionary
+ 		if [ "$(RADIUSDEPON)" = "yes" ]; then \
+ 			$(INSTALL_TOUCH) \
+ 				$(cfg-prefix)/$(cfg-dir)/dictionary.opensips.sample ; \
+ 			$(INSTALL_CFG) etc/dictionary.opensips \
+ 				$(cfg-prefix)/$(cfg-dir)/dictionary.opensips.sample ; \
+-			if [ ! -f $(cfg-prefix)/$(cfg-dir)/dictionary.opensips ]; then \
+-				mv -f $(cfg-prefix)/$(cfg-dir)/dictionary.opensips.sample \
+-					$(cfg-prefix)/$(cfg-dir)/dictionary.opensips; \
+-			fi; \
+ 		fi
+ 		# opensipsctl config
+ 		$(INSTALL_TOUCH)   $(cfg-prefix)/$(cfg-dir)/opensipsctlrc.sample
+ 		$(INSTALL_CFG) scripts/opensipsctlrc \
+ 			$(cfg-prefix)/$(cfg-dir)/opensipsctlrc.sample
+-		if [ ! -f $(cfg-prefix)/$(cfg-dir)/opensipsctlrc ]; then \
+-			mv -f $(cfg-prefix)/$(cfg-dir)/opensipsctlrc.sample \
+-				$(cfg-prefix)/$(cfg-dir)/opensipsctlrc; \
+-		fi
+ 		# osipsconsole config
+ 		$(INSTALL_TOUCH)   $(cfg-prefix)/$(cfg-dir)/osipsconsolerc.sample
+ 		$(INSTALL_CFG) scripts/osipsconsolerc \
+ 			$(cfg-prefix)/$(cfg-dir)/osipsconsolerc.sample
+-		if [ ! -f $(cfg-prefix)/$(cfg-dir)/osipsconsolerc ]; then \
+-			mv -f $(cfg-prefix)/$(cfg-dir)/osipsconsolerc.sample \
+-				$(cfg-prefix)/$(cfg-dir)/osipsconsolerc; \
+-		fi
+ 		#$(INSTALL_CFG) etc/$(NAME).cfg $(cfg-prefix)/$(cfg-dir)
+ 		mkdir -p $(cfg-prefix)/$(cfg-dir)/tls ; \
+ 		mkdir -p $(cfg-prefix)/$(cfg-dir)/tls/rootCA ; \

Added: head/net/opensips/files/patch-Makefile.defs
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/files/patch-Makefile.defs	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,43 @@
+--- Makefile.defs.orig	2015-05-07 16:45:43 UTC
++++ Makefile.defs
+@@ -118,6 +118,14 @@ ifeq ($(OS),solaris)
+ 		ISSMP ?= yes
+ 	endif
+ else
++ifeq ($(OS),freebsd)
++	SMP_STR = $(shell sysctl kern.smp.active | grep 1)
++	ifeq (,$(SMP_STR))
++		ISSMP ?= no
++	else
++		ISSMP ?= yes
++	endif
++else
+ 	SMP_STR = $(shell uname -v | grep -i "SMP")
+ 	ifeq (,$(SMP_STR))
+ 		ISSMP ?= no
+@@ -125,6 +133,7 @@ else
+ 		ISSMP ?= yes
+ 	endif
+ endif
++endif
+ 
+ OSREL = $(shell uname -r)
+ # numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)
+@@ -162,6 +171,9 @@ cfg-dir = etc/$(MAIN_NAME)/
+ bin-dir = sbin/
+ 
+ ARCH_B = $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/')
++ifeq ($(OS),freebsd)
++	LIBDIR ?= lib
++else
+ ifeq ($(ARCH_B),64b)
+ 	LIBDIR ?= lib64
+ else
+@@ -169,6 +181,7 @@ else
+ 	# assume 32b - it is not really used further
+ 	ARCH_B=32b
+ endif
++endif
+ 
+ lib-dir = $(LIBDIR)/$(MAIN_NAME)
+ modules-dir = $(LIBDIR)/$(MAIN_NAME)/modules/

Added: head/net/opensips/files/patch-io_wait.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opensips/files/patch-io_wait.h	Thu Oct  1 16:34:41 2015	(r398368)
@@ -0,0 +1,34 @@
+--- io_wait.h.orig	2015-05-07 14:13:54 UTC
++++ io_wait.h
+@@ -56,6 +56,7 @@
+ 
+ #include <errno.h>
+ #include <string.h>

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510011634.t91GYgKh085051>