Subject: [alpine-aports] [PATCH] sems 3.8.1.1 (sipwise)

From: Nathan Angelacos <[email-masked]>
Date: Wed, 13 May 2015 22:45:14 +0000

sipwise.com's "fork" of sems - based on 1.6.0-dev, but maintained.
---
 testing/sems/APKBUILD                              | 232 +++++++++++++++++
 ...001-Force-to-use-system-wide-GSM-includes.patch |  26 ++
 ...llow-rewrite-of-custom-makefiles-by-CMake.patch |  33 +++
 ...Set-CFG_PREFIX-to-empty-string-by-default.patch |  26 ++
 testing/sems/sems-0004-fix-PRACK-route.patch       |  14 +
 .../sems-0004-remove-execinfo-dependency.patch     |  55 ++++
 testing/sems/sems-0005-define-SEMS_VERSION.patch   |  12 +
 testing/sems/sems-0006-std-types.patch             | 281 +++++++++++++++++++++
 testing/sems/sems.initd                            |  48 ++++
 testing/sems/sems.pre-install                      |  10 +
 10 files changed, 737 insertions(+)
 create mode 100644 testing/sems/APKBUILD
 create mode 100644 testing/sems/sems-0001-Force-to-use-system-wide-GSM-includes.patch
 create mode 100644 testing/sems/sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
 create mode 100644 testing/sems/sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
 create mode 100644 testing/sems/sems-0004-fix-PRACK-route.patch
 create mode 100644 testing/sems/sems-0004-remove-execinfo-dependency.patch
 create mode 100644 testing/sems/sems-0005-define-SEMS_VERSION.patch
 create mode 100644 testing/sems/sems-0006-std-types.patch
 create mode 100755 testing/sems/sems.initd
 create mode 100644 testing/sems/sems.pre-install

diff --git a/testing/sems/APKBUILD b/testing/sems/APKBUILD
new file mode 100644
index 0000000..0e3f0bd
--- /dev/null
+++ b/testing/sems/APKBUILD
@@ -0,0 +1,232 @@
+# Contributor: Francesco Colista <[email-masked]>
+# Maintainer: Nathan Angelacos <[email-masked]>
+#
+# NOTE: This is based on the sipwise "fork" of sems.
+
+pkgname=sems
+pkgver=3.8.1.1
+pkgrel=0
+pkgdesc="SIP Express Media Server, an extensible SIP media server"
+url="http://iptel.org/sems/"
+arch="all"
+license="GPLv2+"
+pkgusers="sems"
+pkggroups="sems"
+install="$pkgname.pre-install"
+makedepends="python-dev cmake bash openssl-dev linux-headers
+	libsamplerate-dev spandsp-dev flite-dev gsm-dev speex-dev
+	libevent-dev"
+subpackages="$pkgname-doc $pkgname-conf_auth $pkgname-conference
+	$pkgname-diameter_client $pkgname-dsm $pkgname-early_announce
+	$pkgname-g722 $pkgname-gsm $pkgname-ivr $pkgname-mailbox
+	$pkgname-pin_collect $pkgname-speex $pkgname-xmlrpc2di"
+
+source="https://github.com/sipwise/sems/archive/mr$pkgver.tar.gz
+	sems-0001-Force-to-use-system-wide-GSM-includes.patch
+	sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
+	sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
+	sems-0004-remove-execinfo-dependency.patch
+	sems-0005-define-SEMS_VERSION.patch
+	sems-0006-std-types.patch
+	sems.initd
+	"
+
+#	sems-0005-Add-sw_prepaid_sip-plugin-to-default-exclude-list-du.patch
+#	sems-0006-last-minute-fix-proper-version.patch
+#	sems-0008-Install-email-template.patch
+#	sems-0009-Don-t-start-py_sems-by-default.patch
+
+# applied:
+#	sems-0004-fix-PRACK-route.patch
+#	sems-0007-Fix-gateway-module-s-version-passing-in-CMake.patch
+#	sems-0010-Move-CMake-defines.patch
+
+_builddir="$srcdir/$pkgname-mr$pkgver"
+prepare() {
+	cd "$_builddir"
+	rm -rf core/plug-in/gsm/gsm-1.0-pl10/
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+
+build() {
+	cd "$_builddir"
+	# force cmake to use relative paths. It helps us avoid having the
+	# full file path in the logs
+	cmake \
+		-DCMAKE_BUILD_TYPE=Release \
+		-DCMAKE_USE_RELATIVE_PATHS=yes \
+		-DSEMS_USE_SPANDSP=yes \
+		-DSEMS_USE_LIBSAMPLERATE=yes \
+		-DSEMS_USE_ZRTP=NO \
+		-DSEMS_USE_MP3=NO \
+		-DSEMS_USE_ILBC=NO \
+		-DSEMS_USE_TTS=yes \
+		-DSEMS_USE_OPENSSL=yes \
+		-DSEMS_USE_MONITORING=yes \
+		-DSEMS_USE_IPV6=NO \
+		-DSEMS_CFG_PREFIX= \
+		-DSEMS_AUDIO_PREFIX=/usr/share \
+		-DSEMS_EXEC_PREFIX=/usr \
+		-DSEMS_LIBDIR=lib \
+		|| return 1
+	make 
+}
+
+package() {
+	cd "$_builddir"
+	make install DESTDIR="$pkgdir"
+	install -m755 -D "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname || return 1
+	# is empty
+	rm -f "$pkgdir"/etc/sems/etc/conf_auth.conf
+
+	install -o sems -g sems -d "$pkgdir"/var/spool/voicebox
+	install -d -o sems  "$pkgdir"/var/run/sems
+}
+
+_mv_sub() {
+	local i
+	for i in "$@"; do
+		mkdir -p "$subpkgdir"/${i%/*}
+		mv "$pkgdir"/$i "$subpkgdir"/$i
+	done
+}
+
+conf_auth() {
+	pkgdesc="Conference with authorization for SEMS"
+	depends="sems sems-ivr"
+	cd "$pkgdir"
+	_mv_sub usr/lib/sems/ivr/conf_auth*
+}
+
+conference() {
+	pkgdesc="Conferencing application for SEMS"
+	depends="sems"
+	cd "$pkgdir"
+	_mv_sub etc/sems/etc/conference.conf \
+		usr/lib/sems/plug-in/conference.so \
+		usr/share/sems/audio/conference
+}
+
+diameter_client() {
+	pkgdesc="A simple DIAMETER client implementation for SEMS"
+	depends="sems"
+	cd "$pkgdir"
+	_mv_sub usr/lib/sems/plug-in/diameter_client.so
+}
+
+dsm() {
+	pkgdesc="The state machine interpreter for SEMS"
+	depends="sems"
+	cd "$pkgdir"
+	_mv_sub etc/sems/etc/dsm* \
+		usr/lib/sems/plug-in/dsm.so \
+		usr/lib/sems/dsm
+}
+
+early_announce() {
+	pkgdesc="Early announce application for SEMS"
+	depends="sems"
+	cd "$pkgdir"
+	_mv_sub etc/sems/etc/early_announce.conf \
+		usr/lib/sems/plug-in/early_announce.so
+}
+
+g722() {
+	pkgdesc="G.722 support for SEMS"
+	depends="sems"
+	_mv_sub usr/lib/sems/plug-in/g722.so
+}
+
+#gateway() {
+#	pkgdesc="ISDN gateway for SEMS"
+#	depends="sems"
+#}
+
+gsm() {
+	pkgdesc="GSM support for SEMS"
+	depends="sems"
+	_mv_sub usr/lib/sems/plug-in/gsm.so
+}
+
+ivr() {
+	pkgdesc="IVR functionallity for SEMS"
+	depends="sems python"
+	cd "$pkgdir"
+	_mv_sub etc/sems/etc/ivr.conf \
+		usr/lib/sems/plug-in/ivr.so \
+		usr/lib/sems/ivr/log.*
+}
+
+mailbox() {
+	pkgdesc="Mailbox application for SEMS"
+	depends="sems sems-ivr"
+	cd "$pkgdir"
+	_mv_sub etc/sems/etc/mailbox*.conf \
+		usr/share/sems/audio/mailbox \
+		usr/lib/sems/plug-in/ivr.so \
+		usr/lib/sems/ivr/*mailbox*
+}
+
+pin_collect() {
+	pkgdesc="Collects a PIN for SEMS"
+	depends="sems sems-ivr"
+	cd "$pkgdir"
+	_mv_sub etc/sems/etc/pin_collect.conf \
+		usr/share/sems/audio/pin_collect \
+		usr/lib/sems/plug-in/ivr.so \
+		usr/lib/sems/ivr/pin_collect*
+}
+
+_python() {
+	pkgdesc="Python bindings for SEMS"
+	depends="python sems"
+	cd "$pkgdir"
+	_mv_sub \
+		usr/lib/sems/plug-in/py_sems*
+}
+
+speex() {
+	pkgdesc="Speex support for SEMS"
+	depends="sems"
+	_mv_sub usr/lib/sems/plug-in/speex.so
+}
+
+xmlrpc2di() {
+	pkgdesc="XMLRPC interface for SEMS"
+	depends="sems"
+	_mv_sub \
+		etc/sems/etc/xmlrpc2di.conf \
+		usr/lib/sems/plug-in/xmlrpc2di.so
+}
+
+
+md5sums="8442d03df6ad52fbd8d9ee6c304d4932  mr3.8.1.1.tar.gz
+5b2fded836b44bda33f39adc37de4de7  sems-0001-Force-to-use-system-wide-GSM-includes.patch
+b8efd1a6415afa08f7c676f6976fca36  sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
+331e7529833c906b4738006f32a65fde  sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
+80cffaa7c8963b6619a69133a9ffc2f8  sems-0004-remove-execinfo-dependency.patch
+a680e142ee9b83e6d34fd0757940c5cc  sems-0005-define-SEMS_VERSION.patch
+bbcbee0f73342b4c35deff15c1d708d5  sems-0006-std-types.patch
+4b537f18cda6c72d7afda582a6f5858e  sems.initd"
+sha256sums="5260f02ecc3b7c623b7385b607aed34af3c09e2fc6620e11da8dd3021f077a72  mr3.8.1.1.tar.gz
+a36950f68e78af21f0e1152bb01e2f25f74b8c63210eecc01e4a4f90cf841371  sems-0001-Force-to-use-system-wide-GSM-includes.patch
+0992f15e2a5c58d63a5a06dda027323e203fbf67d57022c11d5d63fd953088bc  sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
+04e0b2a944c5f64305e5711f5dfdcf4675fc7980225ef87267fcaff241168d46  sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
+6e8d8a08004e44e603e32cb8e62809c7865b7e1c70bf66d37e8701dd308782d5  sems-0004-remove-execinfo-dependency.patch
+0ecc448b3f90261af984bcd0c7ebd6e76e0e696b3c285b6c1837f9296a429b68  sems-0005-define-SEMS_VERSION.patch
+c4aac6f50d8ba85d389a859d9067fb7e7589daf4b84cd1d68ac231bcdb0d2aeb  sems-0006-std-types.patch
+5bc8ece09cf1c47c8f0880fdeca40d1e72eb4bc5c6356ffc2d738179b9463e19  sems.initd"
+sha512sums="d9dc35725a5e1493d5c7fe1ef11db8f3821d6fc9bdf9c4090d3747e20a1caa7dcf6e28bd6be74f8b4c249680fd38035a801027a0d6693888f3a5a54ad75ddf39  mr3.8.1.1.tar.gz
+87c6f878c3ad5e947a9a80431ddf28f08c04ce1415b7c42878f66b423c78d909efda836c7c2d3ed97e075c08d7a07c4707a49c14ce42c1a3aa350de1878c8d09  sems-0001-Force-to-use-system-wide-GSM-includes.patch
+4c09033d6acd1bbef2aa2d02571f74da29532decca67b9ce861872d8d9522ca31808d6e26c3b536913ef7a988f90d374e217187b9cadb6a79d5c830571e94b67  sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
+ba6f0d917464729c63628255bee3d864a954af4a510b802f0de1d51f35ff5d7c1c33cbe14db31818133a3c94f84da0f4bea4184ce1e8eae6aa9a1ba79f2e5347  sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
+b23f47640e495513abc85a9ae08b8ff7e2fbc9b57d072eb9b0b3875b9141ee9e67f1aebdbe3f2b09447dbae0e179490f2de7390da07127919ddf85c1a47c4e5c  sems-0004-remove-execinfo-dependency.patch
+02574aeb5b94f4a549fe71e1a8a0efad950d66dfd57ed2ee47befb8aa1c508dd6b05a55586ef1d237e9d61e64aa27fcd8689dc86552e69aff43aa4c96ea2245b  sems-0005-define-SEMS_VERSION.patch
+79e3ac2b202b3f6c710b3d2bc8ac459e3622f2bf5945eaaa81778f53bcbddc7951266f88c2fd9862fbed44f10a160368af7d19b5e81929a3b1e8ee150111f74b  sems-0006-std-types.patch
+5be93b6444a9592daa6c883c78e5906e9e662891e1daa850d872bdaa657eb756f1bc0879732033479b279b75c2fd42ef79aa530ebf3b1692e7fb222d484f804b  sems.initd"
diff --git a/testing/sems/sems-0001-Force-to-use-system-wide-GSM-includes.patch b/testing/sems/sems-0001-Force-to-use-system-wide-GSM-includes.patch
new file mode 100644
index 0000000..d09b793
--- /dev/null
+++ b/testing/sems/sems-0001-Force-to-use-system-wide-GSM-includes.patch
@@ -0,0 +1,26 @@
+From de3c54f85f893e4ee985b1da93cc014b00456fa8 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <[email-masked]>
+Date: Wed, 31 Mar 2010 11:52:52 +0400
+Subject: [PATCH 01/11] Force to use system-wide GSM includes
+
+Signed-off-by: Peter Lemenkov <[email-masked]>
+---
+ core/plug-in/gsm/gsm.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/core/plug-in/gsm/gsm.c b/core/plug-in/gsm/gsm.c
+index 286a989..3517e59 100644
+--- a/core/plug-in/gsm/gsm.c
++++ b/core/plug-in/gsm/gsm.c
+@@ -27,7 +27,7 @@
+ 
+ #include "amci.h"
+ #include "codecs.h"
+-#include "gsm-1.0-pl10/inc/gsm.h"
++#include <gsm.h>
+ #include "../../log.h"
+ 
+ #include <stdlib.h>
+-- 
+1.7.3.4
+
diff --git a/testing/sems/sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch b/testing/sems/sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
new file mode 100644
index 0000000..0cfeab8
--- /dev/null
+++ b/testing/sems/sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
@@ -0,0 +1,33 @@
+From 26929b6a7a62299b71bf7c99f17f75670a2040e2 Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <[email-masked]>
+Date: Wed, 31 Mar 2010 11:53:48 +0400
+Subject: [PATCH 02/11] Allow rewrite of custom makefiles by CMake
+
+Signed-off-by: Peter Lemenkov <[email-masked]>
+---
+ CMakeLists.txt |    9 ---------
+ 1 files changed, 0 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a6ff425..ef3934e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,15 +26,6 @@ ELSE(IS_DEVEL)
+ ENDIF(IS_DEVEL)
+ MESSAGE(STATUS "Configuring ${CMAKE_PROJECT_NAME} v. ${SEMS_VERSION}")
+ 
+-IF(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
+-	message(FATAL_ERROR "In-source builds are not allowed.
+-CMake would overwrite all makefiles distributed with SEMS.
+-Please create a directory and run cmake from there, passing the path
+-to this source directory as the last argument.
+-This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
+-Please delete them.")
+-ENDIF(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
+-
+ OPTION(SEMS_USE_SPANDSP       "Build with spandsp" OFF)
+ OPTION(SEMS_USE_LIBSAMPLERATE "Build with libsamplerate" OFF)
+ OPTION(SEMS_USE_ZRTP          "Build with ZRTP" OFF)
+-- 
+1.7.3.4
+
diff --git a/testing/sems/sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch b/testing/sems/sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
new file mode 100644
index 0000000..df0a5ad
--- /dev/null
+++ b/testing/sems/sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
@@ -0,0 +1,26 @@
+From e322f2e00e48b639b5d87ed06738aa24d99396bf Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <[email-masked]>
+Date: Wed, 31 Mar 2010 18:56:39 +0400
+Subject: [PATCH 03/11] Set CFG_PREFIX to empty string by default
+
+Signed-off-by: Peter Lemenkov <[email-masked]>
+---
+ CMakeLists.txt |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ef3934e..c36ce62 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -48,7 +48,7 @@ ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STREQUAL "2.4")
+ SET(CMAKE_DL_LIBS ${CMAKE_DL_LIBS} m pthread)
+ 
+ IF (NOT SEMS_CFG_PREFIX)
+-	SET(SEMS_CFG_PREFIX "/usr/local")
++	SET(SEMS_CFG_PREFIX "")
+ ENDIF (NOT SEMS_CFG_PREFIX)
+ MESSAGE(STATUS "SEMS cfg prefix was set to: ${SEMS_CFG_PREFIX}")
+ 
+-- 
+1.7.3.4
+
diff --git a/testing/sems/sems-0004-fix-PRACK-route.patch b/testing/sems/sems-0004-fix-PRACK-route.patch
new file mode 100644
index 0000000..af28271
--- /dev/null
+++ b/testing/sems/sems-0004-fix-PRACK-route.patch
@@ -0,0 +1,14 @@
+diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
+index d121606..17c9731 100644
+--- a/core/AmSipDialog.cpp
++++ b/core/AmSipDialog.cpp
+@@ -406,6 +406,9 @@ void AmSipDialog::onRxReply(const AmSipReply& reply)
+ 	else {
+ 	  status = Early;
+ 	  remote_tag = reply.to_tag;
++	  route = reply.route;
++	  if(!reply.to_uri.empty())
++	    remote_uri = reply.to_uri;
+ 	}
+       }
+       else if(reply.code < 300){
diff --git a/testing/sems/sems-0004-remove-execinfo-dependency.patch b/testing/sems/sems-0004-remove-execinfo-dependency.patch
new file mode 100644
index 0000000..12379a2
--- /dev/null
+++ b/testing/sems/sems-0004-remove-execinfo-dependency.patch
@@ -0,0 +1,55 @@
+diff --git a/core/AmBasicSipDialog.cpp b/core/AmBasicSipDialog.cpp
+index f0aeef4..c177766 100644
+--- a/core/AmBasicSipDialog.cpp
++++ b/core/AmBasicSipDialog.cpp
+@@ -577,7 +577,7 @@ int AmBasicSipDialog::reply(const AmSipRequest& req,
+ 	  "remote_tag=%s\n",
+ 	  req.cseq,code,callid.c_str(),
+ 	  local_tag.c_str(),remote_tag.c_str());
+-    log_stacktrace(L_ERR);
++    /* log_stacktrace(L_ERR); */
+     return -1;
+   }
+   DBG("reply: transaction found!\n");
+diff --git a/core/log.cpp b/core/log.cpp
+index d1de02f..9e59464 100644
+--- a/core/log.cpp
++++ b/core/log.cpp
+@@ -209,6 +209,7 @@ void register_log_hook(AmLoggingFacility* fac)
+ /**
+  * Print stack-trace through logging function
+  */
++/* 
+ void log_stacktrace(int ll)
+ {
+    void* callstack[128];
+@@ -219,3 +220,4 @@ void log_stacktrace(int ll)
+    }
+    free(strs);
+ }
++*/
+diff --git a/core/log.h b/core/log.h
+index 7eb2480..892c926 100644
+--- a/core/log.h
++++ b/core/log.h
+@@ -33,8 +33,9 @@
+ #include <stdio.h>
+ #include <unistd.h>	/* getpid() */
+ #include <pthread.h>	/* pthread_self() */
++#if defined (__GLIBC__)
+ #include <execinfo.h>   /* backtrace_symbols() */
+-
++#endif
+ 
+ #ifdef __cplusplus
+ extern "C" {
+@@ -174,7 +175,9 @@ void run_log_hooks(int, pid_t, pthread_t, const char*, const char*, int, char*);
+ int set_syslog_facility(const char*);
+ #endif
+ 
++/*
+ void log_stacktrace(int ll);
++*/
+ 
+ #ifdef __cplusplus
+ }
diff --git a/testing/sems/sems-0005-define-SEMS_VERSION.patch b/testing/sems/sems-0005-define-SEMS_VERSION.patch
new file mode 100644
index 0000000..b540751
--- /dev/null
+++ b/testing/sems/sems-0005-define-SEMS_VERSION.patch
@@ -0,0 +1,12 @@
+diff --git a/core/plug-in/stats/StatsUDPServer.cpp b/core/plug-in/stats/StatsUDPServer.cpp
+index b5c7909..2a946b4 100644
+--- a/core/plug-in/stats/StatsUDPServer.cpp
++++ b/core/plug-in/stats/StatsUDPServer.cpp
+@@ -37,6 +37,7 @@
+ #include "AmApi.h"
+ 
+ #include "sip/trans_table.h"
++#include "../../sems.h"
+ 
+ #include <string>
+ using std::string;
diff --git a/testing/sems/sems-0006-std-types.patch b/testing/sems/sems-0006-std-types.patch
new file mode 100644
index 0000000..edaf8d5
--- /dev/null
+++ b/testing/sems/sems-0006-std-types.patch
@@ -0,0 +1,281 @@
+diff --git a/apps/gateway/mISDNChannel.cpp b/apps/gateway/mISDNChannel.cpp
+index 8abd77a..36e8778 100644
+--- a/apps/gateway/mISDNChannel.cpp
++++ b/apps/gateway/mISDNChannel.cpp
+@@ -118,8 +118,8 @@ int mISDN_get_free_ext_ie(mISDN::Q931_info_t *qi) {
+         return (-1);
+ }
+ 
+-int mISDN_AddIE(mISDN::Q931_info_t *qi, u_char *p, u_char ie, u_char *iep) {
+-        u_char          *ps;
++int mISDN_AddIE(mISDN::Q931_info_t *qi, unsigned char *p, unsigned char ie, unsigned char *iep) {
++        unsigned char          *ps;
+         mISDN::ie_info_t       *ies;
+         int             l;
+ 
+@@ -158,7 +158,7 @@ int mISDN_AddIE(mISDN::Q931_info_t *qi, u_char *p, u_char ie, u_char *iep) {
+                 }
+                 l = iep[0] + 1;
+         }
+-        ps = (u_char *) qi;
++        ps = (unsigned char *) qi;
+         ps += L3_EXTRA_SIZE;
+         ies->off = (u16)(p - ps);
+         *p++ = ie;
+diff --git a/core/sip/parse_dns.cpp b/core/sip/parse_dns.cpp
+index 2b62f3e..d24f537 100644
+--- a/core/sip/parse_dns.cpp
++++ b/core/sip/parse_dns.cpp
+@@ -6,10 +6,10 @@
+ #define SECTION_COUNTS_OFF 4
+ #define HEADER_OFFSET      12
+ 
+-unsigned short dns_msg_count(u_char* begin, dns_section_type sect);
+-int dns_skip_name(u_char** p, u_char* end);
+-int dns_expand_name(u_char** ptr, u_char* begin, u_char* end, 
+-		    u_char* buf, unsigned int len);
++unsigned short dns_msg_count(unsigned char* begin, dns_section_type sect);
++int dns_skip_name(unsigned char** p, unsigned char* end);
++int dns_expand_name(unsigned char** ptr, unsigned char* begin, unsigned char* end, 
++		    unsigned char* buf, unsigned int len);
+ 
+ 
+ const char* dns_rr_type_str(dns_rr_type t)
+@@ -27,11 +27,11 @@ const char* dns_rr_type_str(dns_rr_type t)
+ 
+ 
+ 
+-int dns_msg_parse(u_char* msg, int len, dns_parse_fct fct, void* data)
++int dns_msg_parse(unsigned char* msg, int len, dns_parse_fct fct, void* data)
+ {
+-  u_char* begin = msg;
+-  u_char* p = begin + HEADER_OFFSET;
+-  u_char* end = msg + len;
++  unsigned char* begin = msg;
++  unsigned char* p = begin + HEADER_OFFSET;
++  unsigned char* end = msg + len;
+ 
+   if(p >= end) return -1;
+ 
+@@ -48,7 +48,7 @@ int dns_msg_parse(u_char* msg, int len, dns_parse_fct fct, void* data)
+     for(int i=0; i<dns_msg_count(begin,(dns_section_type)s); i++){
+ 
+       // expand name
+-      if(dns_expand_name(&p,begin,end,(u_char*)rr.name,NS_MAXDNAME) < 0) return -1;
++      if(dns_expand_name(&p,begin,end,(unsigned char*)rr.name,NS_MAXDNAME) < 0) return -1;
+ 
+       // at least 8 bytes for type+class+ttl left?
+       if((p + 8) > end) return -1;
+@@ -79,14 +79,14 @@ int dns_msg_parse(u_char* msg, int len, dns_parse_fct fct, void* data)
+   return 0;
+ }
+ 
+-unsigned short dns_msg_count(u_char* begin, dns_section_type sect)
++unsigned short dns_msg_count(unsigned char* begin, dns_section_type sect)
+ {
+-  u_char* p = begin + SECTION_COUNTS_OFF + 2*sect;
++  unsigned char* p = begin + SECTION_COUNTS_OFF + 2*sect;
+ 
+   return ((u_short)*p)<<8 | ((u_short)*(p+1));
+ }
+ 
+-int dns_skip_name(u_char** p, u_char* end)
++int dns_skip_name(unsigned char** p, unsigned char* end)
+ {
+   while(*p < end) {
+     
+@@ -106,11 +106,11 @@ int dns_skip_name(u_char** p, u_char* end)
+   return -1;
+ }
+ 
+-int dns_expand_name(u_char** ptr, u_char* begin, u_char* end, 
+-		    u_char* start_buf, unsigned int len)
++int dns_expand_name(unsigned char** ptr, unsigned char* begin, unsigned char* end, 
++		    unsigned char* start_buf, unsigned int len)
+ {
+-  u_char* buf = start_buf;
+-  u_char* p = *ptr;
++  unsigned char* buf = start_buf;
++  unsigned char* p = *ptr;
+   bool    is_ptr=false;
+ 
+   while(p < end) {
+diff --git a/core/sip/parse_dns.h b/core/sip/parse_dns.h
+index c5de8b6..34406b0 100644
+--- a/core/sip/parse_dns.h
++++ b/core/sip/parse_dns.h
+@@ -39,18 +39,18 @@ struct dns_record
+ 
+ class dns_entry;
+ 
+-typedef int (*dns_parse_fct)(dns_record* rr, dns_section_type t, u_char* begin, u_char* end, void* data);
++typedef int (*dns_parse_fct)(dns_record* rr, dns_section_type t, unsigned char* begin, unsigned char* end, void* data);
+ 
+-int dns_msg_parse(u_char* msg, int len, dns_parse_fct fct, void* data);
+-int dns_expand_name(u_char** ptr, u_char* begin, u_char* end, 
+-		    u_char* buf, unsigned int len);
++int dns_msg_parse(unsigned char* msg, int len, dns_parse_fct fct, void* data);
++int dns_expand_name(unsigned char** ptr, unsigned char* begin, unsigned char* end, 
++		    unsigned char* buf, unsigned int len);
+ 
+-inline uint16_t dns_get_16(const u_char* p)
++inline uint16_t dns_get_16(const unsigned char* p)
+ {
+   return ntohs(*(uint16_t*)p);
+ }
+ 
+-inline uint32_t dns_get_32(const u_char* p)
++inline uint32_t dns_get_32(const unsigned char* p)
+ {
+   return ntohl(*(uint32_t*)p);
+ }
+diff --git a/core/sip/resolver.cpp b/core/sip/resolver.cpp
+index 9793069..80c547c 100644
+--- a/core/sip/resolver.cpp
++++ b/core/sip/resolver.cpp
+@@ -169,7 +169,7 @@ public:
+ 	stable_sort(ip_vec.begin(),ip_vec.end(),srv_less);
+     }
+ 
+-    dns_base_entry* get_rr(dns_record* rr, u_char* begin, u_char* end);
++    dns_base_entry* get_rr(dns_record* rr, unsigned char* begin, unsigned char* end);
+ 
+     int next_ip(dns_handle* h, sockaddr_storage* sa)
+     {
+@@ -316,7 +316,7 @@ dns_entry* dns_entry::make_entry(dns_rr_type t)
+     }
+ }
+ 
+-void dns_entry::add_rr(dns_record* rr, u_char* begin, u_char* end, long now)
++void dns_entry::add_rr(dns_record* rr, unsigned char* begin, unsigned char* end, long now)
+ {
+     dns_base_entry* e = get_rr(rr,begin,end);
+     if(!e) return;
+@@ -451,7 +451,7 @@ void ip_entry::to_sa(sockaddr_storage* sa)
+ string ip_entry::to_str()
+ {
+     if(type == IPv4) {
+-	u_char* cp = (u_char*)&addr;
++	unsigned char* cp = (unsigned char*)&addr;
+ 	return int2str(cp[0]) + 
+ 	    "." + int2str(cp[1]) + 
+ 	    "." + int2str(cp[2]) + 
+@@ -496,7 +496,7 @@ string ip_port_entry::to_str()
+     return ip_entry::to_str() + ":" + int2str(port);
+ }
+ 
+-dns_base_entry* dns_ip_entry::get_rr(dns_record* rr, u_char* begin, u_char* end)
++dns_base_entry* dns_ip_entry::get_rr(dns_record* rr, unsigned char* begin, unsigned char* end)
+ {
+     if(rr->type != dns_r_a)
+ 	return NULL;
+@@ -516,16 +516,16 @@ dns_base_entry* dns_ip_entry::get_rr(dns_record* rr, u_char* begin, u_char* end)
+     return new_ip;
+ }
+ 
+-dns_base_entry* dns_srv_entry::get_rr(dns_record* rr, u_char* begin, u_char* end)
++dns_base_entry* dns_srv_entry::get_rr(dns_record* rr, unsigned char* begin, unsigned char* end)
+ {
+     if(rr->type != dns_r_srv)
+ 	return NULL;
+ 
+-    u_char name_buf[NS_MAXDNAME];
+-    const u_char * rdata = ns_rr_rdata(*rr);
++    unsigned char name_buf[NS_MAXDNAME];
++    const unsigned char * rdata = ns_rr_rdata(*rr);
+ 	
+     /* Expand the target's name */
+-    u_char* p = (u_char*)rdata+6;
++    unsigned char* p = (unsigned char*)rdata+6;
+     if (dns_expand_name(&p,begin,end,
+     			   name_buf,         /* Result                */
+     			   NS_MAXDNAME)      /* Size of result buffer */
+@@ -570,7 +570,7 @@ struct dns_search_h
+ };
+ 
+ int rr_to_dns_entry(dns_record* rr, dns_section_type t,
+-		    u_char* begin, u_char* end, void* data)
++		    unsigned char* begin, unsigned char* end, void* data)
+ {
+     // only answer and additional sections
+     if(t != dns_s_an && t != dns_s_ar)
+@@ -668,7 +668,7 @@ void dns_naptr_entry::init()
+     stable_sort(ip_vec.begin(),ip_vec.end(),naptr_less);
+ }
+ 
+-dns_base_entry* dns_naptr_entry::get_rr(dns_record* rr, u_char* begin, u_char* end)
++dns_base_entry* dns_naptr_entry::get_rr(dns_record* rr, unsigned char* begin, unsigned char* end)
+ {
+     enum NAPTR_FieldIndex {
+ 	NAPTR_Flags       = 0,
+@@ -681,7 +681,7 @@ dns_base_entry* dns_naptr_entry::get_rr(dns_record* rr, u_char* begin, u_char* e
+     if(rr->type != dns_r_naptr)
+ 	return NULL;
+ 
+-    const u_char * rdata = ns_rr_rdata(*rr);
++    const unsigned char * rdata = ns_rr_rdata(*rr);
+ 
+     unsigned short order = dns_get_16(rdata);
+     rdata += 2;
+@@ -856,7 +856,7 @@ _resolver::~_resolver()
+ 
+ int _resolver::query_dns(const char* name, dns_entry_map& entry_map, dns_rr_type t)
+ {
+-    u_char dns_res[NS_PACKETSZ];
++    unsigned char dns_res[NS_PACKETSZ];
+ 
+     if(!name) return -1;
+ 
+diff --git a/core/sip/resolver.h b/core/sip/resolver.h
+index 7565898..caa81e8 100644
+--- a/core/sip/resolver.h
++++ b/core/sip/resolver.h
+@@ -77,7 +77,7 @@ class dns_entry
+     : public atomic_ref_cnt,
+       public dns_base_entry
+ {
+-    virtual dns_base_entry* get_rr(dns_record* rr, u_char* begin, u_char* end)=0;
++    virtual dns_base_entry* get_rr(dns_record* rr, unsigned char* begin, unsigned char* end)=0;
+ 
+ public:
+     vector<dns_base_entry*> ip_vec;
+@@ -87,7 +87,7 @@ public:
+     dns_entry();
+     virtual ~dns_entry();
+     virtual void init()=0;
+-    virtual void add_rr(dns_record* rr, u_char* begin, u_char* end, long now);
++    virtual void add_rr(dns_record* rr, unsigned char* begin, unsigned char* end, long now);
+     virtual int next_ip(dns_handle* h, sockaddr_storage* sa)=0;
+ 
+     virtual string to_str();
+@@ -140,7 +140,7 @@ public:
+     {}
+ 
+     void init(){};
+-    dns_base_entry* get_rr(dns_record* rr, u_char* begin, u_char* end);
++    dns_base_entry* get_rr(dns_record* rr, unsigned char* begin, unsigned char* end);
+     int next_ip(dns_handle* h, sockaddr_storage* sa);
+ 
+     int fill_ip_list(const list<sip_destination>& ip_list);
+@@ -199,7 +199,7 @@ public:
+     {}
+ 
+     void init();
+-    dns_base_entry* get_rr(dns_record* rr, u_char* begin, u_char* end);
++    dns_base_entry* get_rr(dns_record* rr, unsigned char* begin, unsigned char* end);
+ 
+     // not needed
+     int next_ip(dns_handle* h, sockaddr_storage* sa) { return -1; }
+diff --git a/core/sip/udp_trsp.cpp b/core/sip/udp_trsp.cpp
+index eb3a1ce..e33a156 100644
+--- a/core/sip/udp_trsp.cpp
++++ b/core/sip/udp_trsp.cpp
+@@ -300,7 +300,7 @@ void udp_trsp::run()
+     msg.msg_namelen    = sizeof(sockaddr_storage);
+     msg.msg_iov        = iov;
+     msg.msg_iovlen     = 1;
+-    msg.msg_control    = new u_char[DSTADDR_DATASIZE];
++    msg.msg_control    = new unsigned char[DSTADDR_DATASIZE];
+     msg.msg_controllen = DSTADDR_DATASIZE;
+ 
+     if(sock->get_sd()<=0){
diff --git a/testing/sems/sems.initd b/testing/sems/sems.initd
new file mode 100755
index 0000000..fda1e8a
--- /dev/null
+++ b/testing/sems/sems.initd
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# SIP Express Media Server configuration file
+# Follows Gentoo/AlpineLinux standards 
+# GPL 2 License - N. Angelacos 2011
+
+SVC="${SVCNAME#*.}"
+SEMS_CFG_FILE=${SEMS_CFG_FILE:-/etc/sems/${SVC}.conf}
+SEMS_PIDDIR=/var/run/sems
+SEMS_PIDFILE=${SEMS_PIDFILE:-${SEMS_PIDDIR}/${SVC}.pid}
+SEMS_BINARY=${SEMS_BINARY:-/usr/sbin/sems}
+SEMS_USER=${SEMS_USER:-sems}
+SEMS_GROUP=${SEMS_GROUP:-sems}
+
+checkconfig() {
+	if [ ! -f "${SEMS_CFG_FILE}" ] ; then
+		eerror "You need a "${SEMS_CFG_FILE}" file to run sems"
+		return 1;
+	fi
+}
+
+
+start() {
+	checkconfig || return 1
+	ebegin "Starting ${SVCNAME}"
+	mkdir -p "${SEMS_PIDDIR}"
+	chown ${SEMS_USER}:${SEMS_GROUP} "${SEMS_PIDDIR}"
+
+	start-stop-daemon --start --exec "${SEMS_BINARY}" \
+		--pidfile "${SEMS_PIDFILE}" \
+		--wait ${SEMS_WAIT:-500} \
+		-- \
+		-f "${SEMS_CFG_FILE}" \
+		-P "${SEMS_PIDFILE}" \
+		-u "${SEMS_USER}" \
+		-g "${SEMS_GROUP}"
+	eend $?
+}
+
+stop() {
+	if [ "${RC_CMD}" = "restart" ] ; then
+		checkconfig || return 1
+	fi
+
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --exec "${SEMS_BINARY}" \
+		--pidfile "${SEMS_PIDFILE}" --quiet
+	eend $?
+}
diff --git a/testing/sems/sems.pre-install b/testing/sems/sems.pre-install
new file mode 100644
index 0000000..6241566
--- /dev/null
+++ b/testing/sems/sems.pre-install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if ! getent group sems >/dev/null; then
+	addgroup -S sems
+fi
+if ! getent passwd sems >/dev/null; then
+	adduser -S -H -h /var/empty -s /sbin/nologin -D -G sems sems 2>/dev/null
+fi
+
+exit 0
-- 
2.4.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Thu, 14 May 2015 14:16:02 +0200

On Wed, 13 May 2015 22:45:14 +0000

> 	sipwise.com's "fork" of sems - based on 1.6.0-dev, but maintained.

since we already have the 'original' sems in main/sems, maybe just
rename the package to sipwise-sems?

Thanks!

-nc

---