aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/sems/0003-cc-and-cflags.patch45
-rw-r--r--main/sems/APKBUILD228
-rw-r--r--main/sems/sems-0001-Force-to-use-system-wide-GSM-includes.patch26
-rw-r--r--main/sems/sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch33
-rw-r--r--main/sems/sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch26
-rw-r--r--main/sems/sems-0010-Move-CMake-defines.patch66
-rw-r--r--main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch67
-rw-r--r--main/sems/sems.conf352
-rwxr-xr-x[-rw-r--r--]main/sems/sems.initd51
-rw-r--r--main/sems/sems.post-install6
-rw-r--r--main/sems/sems.pre-install7
11 files changed, 435 insertions, 472 deletions
diff --git a/main/sems/0003-cc-and-cflags.patch b/main/sems/0003-cc-and-cflags.patch
deleted file mode 100644
index a17c1f774a..0000000000
--- a/main/sems/0003-cc-and-cflags.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From b411106aa364fd13e87d85e94ade9eeb1d6aeb8e Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Fri, 18 Dec 2009 09:13:58 +0000
-Subject: [PATCH] cc and cflags
-
----
- core/plug-in/binrpcctrl/Makefile | 2 +-
- core/plug-in/gsm/gsm-1.0-pl10/Makefile | 6 +++---
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/core/plug-in/binrpcctrl/Makefile b/core/plug-in/binrpcctrl/Makefile
-index 71680f3..753779a 100644
---- a/core/plug-in/binrpcctrl/Makefile
-+++ b/core/plug-in/binrpcctrl/Makefile
-@@ -35,7 +35,7 @@ libbinrpc:
- $(MAKE) all
-
- $(LIBBINRPC_LIB)/libbinrpc.a:
-- $(MAKE) -C $(LIBBINRPC_DIR) all CC=$(CC) LD=$(LD) AR=$(AR)
-+ $(MAKE) -C $(LIBBINRPC_DIR) all CC="$(CC)" LD="$(LD)" AR="$(AR)"
-
- libbinrpc_clean:
- $(MAKE) -C $(LIBBINRPC_DIR) clean
-diff --git a/core/plug-in/gsm/gsm-1.0-pl10/Makefile b/core/plug-in/gsm/gsm-1.0-pl10/Makefile
-index 396fb7f..6a1a1a1 100644
---- a/core/plug-in/gsm/gsm-1.0-pl10/Makefile
-+++ b/core/plug-in/gsm/gsm-1.0-pl10/Makefile
-@@ -43,11 +43,11 @@ WAV49 =
- # CC = /usr/lang/acc
- # CCFLAGS = -c -O
-
--CC = gcc -ansi -pedantic
--CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1 -fPIC
-+CC ?= gcc
-+CCFLAGS += -ansi -pedantic -c -O2 -DNeedFunctionPrototypes=1 -fPIC
- MODULE_CFLAGS = -I inc -DHAS_STDLIB_H
-
--LD = $(CC)
-+LD ?= $(CC)
-
- # LD = gcc
- # LDFLAGS =
---
-1.6.5.6
-
diff --git a/main/sems/APKBUILD b/main/sems/APKBUILD
index 04ab8bc5b8..80a387e028 100644
--- a/main/sems/APKBUILD
+++ b/main/sems/APKBUILD
@@ -1,72 +1,204 @@
# Contributor: Francesco Colista <francesco.colista@gmail.com>
-# Maintainer: Francesco Colista <francesco.colista@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=sems
-pkgver=1.2.1
+pkgver=1.4.0
pkgrel=1
-pkgdesc="High performance, extensible media server for SIP (RFC3261) based VoIP services"
+pkgdesc="SIP Express Media Server, an extensible SIP media server"
url="http://iptel.org/sems/"
arch="all"
-license="GPL-2"
-install="$pkgname.pre-install $pkgname.post-install"
-makedepends="python-dev openssl-dev cmake bash"
+license="GPLv2+"
+pkgusers="sems"
+pkggroups="sems"
+install="$pkgname.pre-install"
+makedepends="python-dev cmake bash openssl-dev
+ libsamplerate-dev spandsp-dev flite-dev gsm-dev speex-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="http://ftp.iptel.org/pub/sems/sems-$pkgver.tar.gz
- 0003-cc-and-cflags.patch
- sems.conf
+ 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-0011-Avoid-using-private-Glibc-functions.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-0007-Fix-gateway-module-s-version-passing-in-CMake.patch
+# sems-0010-Move-CMake-defines.patch
+
+_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
- cd "$srcdir"/$pkgname-$pkgver
- for i in "$srcdir"/*.patch; do
- [ -f "$i" ] || continue
- msg "Applying $i"
- patch -p1 -i $i || return 1
+ 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
+}
- sed -i -e 's:^cfg-prefix.*:cfg-prefix = $(basedir):' \
- -e 's:^cfg-target.*:cfg-target = $(cfg-dir):' \
- Makefile.defs \
+
+build() {
+ cd "$_builddir"
+ cmake \
+ -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
- # Patch for fixin unistd.h
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' core/AmArg.cpp
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' core/AmMediaProcessor.cpp
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' core/AmRtpReceiver.cpp
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' core/plug-in/sipctrl/udp_trsp.cpp
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' core/plug-in/stats/query_stats.cxx
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' apps/annrecorder/AnnRecorder.cpp
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' apps/callback/CallBack.cpp
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' apps/diameter_client/ServerConnection.cpp
- sed -i -e 's:\*\/:\n*\/\n#include <unistd.h>:' apps/dsm/mods/mod_sys/ModSys.cpp
+ 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
+}
-build() {
- cd "$srcdir"/$pkgname-$pkgver
+conf_auth() {
+ pkgdesc="Conference with authorization for SEMS"
+ depends="sems sems-ivr"
+ cd "$pkgdir"
+ _mv_sub usr/lib/sems/ivr/conf_auth*
+}
- make PREFIX=/usr \
- cfg-target=/etc/sems/ \
- exclude_modules+="ivr examples py_sems speex gateway mp3 echo g722" \
- WITH_MPG123DECODER=no \
- all || return 1
+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
}
-package() {
- cd "$srcdir"/$pkgname-$pkgver
+diameter_client() {
+ pkgdesc="A simple DIAMETER client implementation for SEMS"
+ depends="sems"
+ cd "$pkgdir"
+ _mv_sub usr/lib/sems/plug-in/diameter_client.so
+}
- make PREFIX=/usr \
- DESTDIR="$pkgdir" \
- cfg-target=/etc/sems/ \
- cfg-prefix="$pkgdir" \
- exclude_modules+="ivr examples py_sems speex gateway mp3 echo g722" \
- WITH_MPG123DECODER=no \
- install || return 1
+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
+}
- install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
- install -m644 -D "$srcdir"/$pkgname.conf "$pkgdir"/etc/sems/$pkgname.conf
+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
}
-md5sums="f0545c0708849e1a723d453244c2a79e sems-1.2.1.tar.gz
-0054e6ed7e11393e71204876179d3199 0003-cc-and-cflags.patch
-8b74528c8605b7adb01a0133fcd0c247 sems.conf
-14aee84a05afc347b6e6b34889ed9504 sems.initd"
+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="ebd5d646f71c8f62c7da51d1f4b89b9d sems-1.4.0.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
+bf4070f110489ef21540b009347fcd81 sems-0011-Avoid-using-private-Glibc-functions.patch
+36c2f993ba874781f5d3974b4f4c1503 sems.initd"
diff --git a/main/sems/sems-0001-Force-to-use-system-wide-GSM-includes.patch b/main/sems/sems-0001-Force-to-use-system-wide-GSM-includes.patch
new file mode 100644
index 0000000000..d09b793395
--- /dev/null
+++ b/main/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 <lemenkov@gmail.com>
+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 <lemenkov@gmail.com>
+---
+ 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/main/sems/sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch b/main/sems/sems-0002-Allow-rewrite-of-custom-makefiles-by-CMake.patch
new file mode 100644
index 0000000000..0cfeab8c83
--- /dev/null
+++ b/main/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 <lemenkov@gmail.com>
+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 <lemenkov@gmail.com>
+---
+ 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/main/sems/sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch b/main/sems/sems-0003-Set-CFG_PREFIX-to-empty-string-by-default.patch
new file mode 100644
index 0000000000..df0a5ad405
--- /dev/null
+++ b/main/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 <lemenkov@gmail.com>
+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 <lemenkov@gmail.com>
+---
+ 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/main/sems/sems-0010-Move-CMake-defines.patch b/main/sems/sems-0010-Move-CMake-defines.patch
new file mode 100644
index 0000000000..be1b8be7a8
--- /dev/null
+++ b/main/sems/sems-0010-Move-CMake-defines.patch
@@ -0,0 +1,66 @@
+From c6fe28de4a05e33c317019261711f2babe98b95d Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Mon, 3 Jan 2011 22:16:24 +0300
+Subject: [PATCH 10/11] Move CMake defines
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ CMakeLists.txt | 3 +++
+ core/CMakeLists.txt | 6 ------
+ 2 files changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 78a6dfb..fdc88f4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -80,6 +80,7 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
+ # (which means that current debian and gentoo packages don't work)
+ IF(SEMS_USE_SPANDSP)
+ FIND_PACKAGE(Spandsp REQUIRED)
++ ADD_DEFINITIONS(-DUSE_SPANDSP -D__STDC_LIMIT_MACROS)
+ MESSAGE(STATUS "Using spandsp: YES")
+ ELSE(SEMS_USE_SPANDSP)
+ MESSAGE(STATUS "Using spandsp: NO (default)")
+@@ -89,6 +90,7 @@ ENDIF(SEMS_USE_SPANDSP)
+ # (see http://www.mega-nerd.com/SRC/)
+ IF(SEMS_USE_LIBSAMPLERATE)
+ FIND_PACKAGE(Libsamplerate REQUIRED)
++ ADD_DEFINITIONS(-DUSE_LIBSAMPLERATE)
+ MESSAGE(STATUS "Using libsamplerate: YES")
+ ELSE(SEMS_USE_LIBSAMPLERATE)
+ MESSAGE(STATUS "Using libsamplerate: NO (default)")
+@@ -128,6 +130,7 @@ ELSE(SEMS_USE_MONITORING)
+ ENDIF(SEMS_USE_MONITORING)
+
+ IF(SEMS_USE_IPV6)
++ ADD_DEFINITIONS(-DSUPPORT_IPV6)
+ MESSAGE(STATUS "Enable IPv6 support: YES")
+ ELSE(SEMS_USE_IPV6)
+ MESSAGE(STATUS "Enable IPv6 support: NO (default)")
+diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
+index 7bd1341..5f0fb3f 100644
+--- a/core/CMakeLists.txt
++++ b/core/CMakeLists.txt
+@@ -18,19 +18,13 @@ ENDIF(NOT MAX_RTP_SESSIONS)
+ ADD_DEFINITIONS(-DMAX_RTP_SESSIONS=${MAX_RTP_SESSIONS})
+
+ IF(SPANDSP_FOUND)
+- ADD_DEFINITIONS(-DUSE_SPANDSP -D__STDC_LIMIT_MACROS)
+ TARGET_LINK_LIBRARIES(sems ${CMAKE_DL_LIBS} spandsp)
+ ENDIF(SPANDSP_FOUND)
+
+ IF(LIBSAMPLERATE_FOUND)
+- ADD_DEFINITIONS(-DUSE_LIBSAMPLERATE)
+ TARGET_LINK_LIBRARIES(sems ${CMAKE_DL_LIBS} samplerate)
+ ENDIF(LIBSAMPLERATE_FOUND)
+
+-IF(SEMS_USE_IPV6)
+- ADD_DEFINITIONS(-DSUPPORT_IPV6)
+-ENDIF(SEMS_USE_IPV6)
+-
+ ADD_SUBDIRECTORY(plug-in)
+
+ # Create config-file from template
+--
+1.7.3.4
+
diff --git a/main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch b/main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch
new file mode 100644
index 0000000000..048a0a9ba4
--- /dev/null
+++ b/main/sems/sems-0011-Avoid-using-private-Glibc-functions.patch
@@ -0,0 +1,67 @@
+From fb437ef493d6023e936bd55088df7e6d99452cfb Mon Sep 17 00:00:00 2001
+From: Peter Lemenkov <lemenkov@gmail.com>
+Date: Tue, 4 Jan 2011 22:34:03 +0300
+Subject: [PATCH 11/11] Avoid using private Glibc functions
+
+Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
+---
+ core/sip/resolver.cpp | 33 +++++++++++++++++++++++++++------
+ 1 files changed, 27 insertions(+), 6 deletions(-)
+
+diff --git a/core/sip/resolver.cpp b/core/sip/resolver.cpp
+index e3443c7..3b3e4a6 100644
+--- a/core/sip/resolver.cpp
++++ b/core/sip/resolver.cpp
+@@ -54,6 +54,27 @@ using std::list;
+ // (the limit is the # bits in dns_handle::srv_used)
+ #define MAX_SRV_RR (sizeof(unsigned int)*8)
+
++/* The SEMS_GET16 macro and the sems_get16 function were copied from glibc 2.7
++ * (include/arpa/nameser.h (NS_GET16) and resolv/ns_netint.c (ns_get16)) to
++ * avoid using private glibc functions.
++ */
++
++# define SEMS_GET16(s, cp) \
++ do { \
++ uint16_t *t_cp = (uint16_t *) (cp); \
++ (s) = ntohs (*t_cp); \
++ (cp) += NS_INT16SZ; \
++} while (0)
++
++u_int
++sems_get16(const u_char *src)
++{
++ u_int dst;
++
++ SEMS_GET16(dst, src);
++ return (dst);
++}
++
+ struct ip_entry
+ : public dns_base_entry
+ {
+@@ -399,15 +420,15 @@ dns_base_entry* dns_srv_entry::get_rr(dns_record* rr, u_char* begin, u_char* end
+ DBG("SRV:\tTTL=%i\t%s\tP=<%i> W=<%i> P=<%i> T=<%s>\n",
+ ns_rr_ttl(*rr),
+ ns_rr_name(*rr),
+- ns_get16(rdata),
+- ns_get16(rdata+2),
+- ns_get16(rdata+4),
++ sems_get16(rdata),
++ sems_get16(rdata+2),
++ sems_get16(rdata+4),
+ name_buf);
+
+ srv_entry* srv_r = new srv_entry();
+- srv_r->p = ns_get16(rdata);
+- srv_r->w = ns_get16(rdata+2);
+- srv_r->port = ns_get16(rdata+4);
++ srv_r->p = sems_get16(rdata);
++ srv_r->w = sems_get16(rdata+2);
++ srv_r->port = sems_get16(rdata+4);
+ srv_r->target = (const char*)name_buf;
+
+ return srv_r;
+--
+1.7.3.4
+
diff --git a/main/sems/sems.conf b/main/sems/sems.conf
deleted file mode 100644
index 5e0ba4935e..0000000000
--- a/main/sems/sems.conf
+++ /dev/null
@@ -1,352 +0,0 @@
-# $Id: sems.conf.sample 1541 2009-10-14 12:00:58Z sayer $
-#
-# sems.conf.sample
-#
-# Sip Express Media Server (sems)
-#
-# sample configuration file
-#
-#
-# whitespaces (spaces and tabs) are ignored
-# comments start with a "#" and may be used inline
-#
-# example: option=value # i like this option
-#
-# @filename includes mod_config_path/filename
-# @/absolute/path/to/file includes file
-
-############################################################
-# Network configuration
-
-# optional parameter: media_ip=<ip_address>|<device>
-#
-# - this informs SEMS about the IP address or interface that
-# SEMS uses to send and receive media. If not set, defaults
-# to first non-loopback interface.
-#
-# Examples:
-# media_ip=10.0.0.34
-# media_ip=eth0
-
-# optional parameter: sip_ip=<ip_address>
-#
-# - this informs SEMS about the SIP IP where its SIP stack is
-# bound to or should be bound to. If 'sipctrl' SIP stack is used,
-# the SIP stack will bind to this address. This also sets
-# the value used for contact header in outgoing calls and
-# registrations. If not set, defaults to first non-loopback
-# interface.
-#
-# Example:
-# sip_ip=10.0.0.34
-#
-
-# optional parameter: public_ip=<ip_address>
-#
-# - when running SEMS behind certain simple NAT configurations,
-# you can use this parameter to inform SEMS of its public IP
-# address. If this parameter is set, SEMS will write this value
-# into SDP bodies.
-# If this parameter is not set, the local IP address is used.
-# N.B., there is no support for port translation; the local
-# RTP port is advertised in SDP in either case.
-#
-# Example:
-# public_ip=75.101.219.48
-#
-
-# optional parameter: sip_port=<port_number>
-#
-# - this informs SEMS about the port where its SIP stack is
-# bound to or should be bound to. SEMS needs this information
-# to correctly set the contact header in outgoing calls
-# and registrations. Should be set to equal the 'port'
-# configuration option in ser_sems.cfg.
-# This does not need to be set if sipctrl SIP stack, outgoing
-# calls and registrations from SEMS are not used.
-#
-# default: 5060
-#
-sip_port=5080
-
-# optional parameter: outbound_proxy=uri
-#
-# - this sets a next hop for calls and registrations outgoing
-# from SEMS. This does not apply to requests in a dialog that
-# is initiated by someone else and incoming to SEMS, as in
-# this case the next_hop is taken by SEMS from the incoming
-# request that established the dialog.
-# If this is not set (default setting), then for dialogs
-# initiated by SEMS the r-uri is resolved and the request
-# is sent there directly.
-# This is resolved by the SIP stack with DNS if a name is given.
-# Warning: If the value set here can not be resolved, no
-# requests will be sent out at all!
-#
-# default: empty
-#
-# Example:
-# outbound_proxy=sip:proxy.mydomain.net
-
-# optional parameter: rtp_low_port=<port>
-#
-# - sets lowest for RTP used port
-rtp_low_port=10000
-
-# optional parameter: rtp_high_port=<port>
-#
-# - sets highest for RTP used port
-rtp_high_port=60000
-
-############################################################
-# modules and application configuration
-#
-# Configuration of plugin (module) loading:
-# - if load_plugins is set, only those are loaded.
-# - if load_plugins is not set, all modules in the plugin_path
-# directory are loaded, except those which are listed
-# in exclude_plugins.
-#
-
-# optional parameter: plugin_path=<path>
-#
-# - sets the path to the plug-ins' binaries
-# - may be absolute or relative to CWD
-plugin_path=/usr/lib/sems/plug-in/
-
-# optional parameter: load_plugins=<modules list>
-#
-# semicolon-separated list of modules to load.
-# If empty, all modules in plugin_path are loaded.
-# One of [sipctrl,unixsockctrl,binrpcctrl] must be loaded.
-#
-# example for announcement with only g711 and ilbc codecs
-# load_plugins=wav;ilbc;announcement;sipctrl
-
-# optional parameter: exclude_plugins=<modules list>
-#
-# semicolon-separated list of modules to exclude from loading
-# ('blacklist'). If empty, all modules in plugin_path are loaded.
-# This has only effect it load_plugins is not set.
-#
-# o binrpcctrl and unixsockctrl: excluded as sipctrl is default ctrl
-# o precoded_announce: no precoded sample files present
-exclude_plugins=binrpcctrl;unixsockctrl;precoded_announce
-
-# optional parameter: application
-#
-# This controls which application is to be executed if there
-# is no explicit application requested from the SIP stack
-# (i.e. unixsockctrl and second parameter of t_write_unix).
-#
-# This can be one of
-# $(ruri.user) - user part of ruri is taken as application,
-# e.g. sip:announcement@host
-# $(ruri.param) - uri parameter "app", e.g.
-# sip:joe@host.net;app=announcement
-# $(apphdr) - the value of the P-App-Name header is used
-#
-# $(mapping) - regex=>application mapping is read from
-# app_mapping.conf (see app_mapping.conf)
-# <application name> - application name configured here, e.g.
-# application=announcement
-#
-# examples:
-# application = conference
-# application = $(mapping)
-# application = $(ruri.user)
-# application = $(ruri.param)
-application = $(apphdr)
-
-# parameter: plugin_config_path=<path>
-#
-# - in this path configuration files of the applications
-# (e.g. announcement.conf) are searched
-plugin_config_path=/etc/sems/etc/
-
-# optional parameter: exclude_payloads=<payload list>
-#
-# semicolon-separated list of payloads to exclude from loading
-# ('blacklist').
-#
-# For example, to only use low bandwidth codecs:
-# exclude_payloads=PCMU;PCMA;G726-40;G726-32;G721;L16
-# or, to use only codecs which are not CPU-intensive:
-# exclude_payloads=iLBC;speex;
-# only use G711 (exclude everything else):
-# exclude_payloads=iLBC;speex;G726-40;G726-32;G721;G726-24;G726-16;GSM;L16
-
-############################################################
-# logging and running
-
-# optional parameter: fork={yes|no}
-#
-# - specifies if sems should run in daemon mode (background)
-# (fork=no is the same as -E)
-fork=yes
-
-# optional parameter: stderr={yes|no}
-#
-# - debug mode: do not fork and log to stderr
-# (stderr=yes is the same as -E)
-stderr=no
-
-# optional parameter: loglevel={0|1|2|3}
-#
-# - sets log level (error=0, warning=1, info=2, debug=3)
-# (same as -D)
-loglevel=2
-
-# optional parameter: syslog_facility={DAEMON|USER|LOCAL[0-7]}
-#
-# - sets the log facility that is used for syslog. Using this,
-# the log can for example be filtered into a special file
-# by the syslog daemon.
-#
-# Default: DAEMON
-#
-# Example:
-# syslog_facility=LOCAL0
-
-# optional parameter: log_sessions=[yes|no]
-#
-# Default: no
-#
-# If log_sessions=yes is set, INFO level log messages are generated
-# for each session when it is started and stopped.
-#
-# log_sessions=yes
-
-# optional parameter: log_events=[yes|no]
-#
-# Default: no
-#
-# If log_eventy=yes is set, generic DBG level log messages are
-# generated for each event that is posted into an event queue.
-#
-# log_events=yes
-
-
-############################################################
-# tuning
-
-# optional parameter: media_processor_threads=<num_value>
-#
-# - controls how many threads should be created that
-# process media - on single-processor systems set this
-# parameter to 1 (default), on MP systems to a higher
-# value
-#
-# media_processor_threads=1
-
-
-# optional parameter: session_limit=<limit>;<err code>;<err reason>
-#
-# - this sets a maximum active session limit. If that limit is
-# reached, no further calls are accepted, but the error reply
-# with err code/err reason is sent out.
-#
-# Default: 0 (None)
-#
-# Example:
-# session_limit="1000;503;Server overload"
-
-# optional parameter: options_session_limit=<limit>;<err code>;<err reason>
-#
-# - this sets a custom response to OPTIONS, if the session count reaches
-# a certain limit. This way health monitor could raise an alarm to syste
-# administrator.
-#
-# Default: 0 (None)
-#
-# Example:
-# options_session_limit="900;503;Warning, server soon overloaded"
-
-
-# optional parameter: dead_rtp_time=<unsigned int>
-#
-# - if != 0, after this time (in seconds) of no RTP
-# a session is considered dead and stopped. If set
-# to 0 no check is done for rtp timeout.
-#
-# default=300 (5 minutes)
-#
-# Examples:
-# # disable RTP timeout
-# dead_rtp_time=0
-# # RTP timeout after 10 seconds
-# dead_rtp_time=10
-
-# optional parameter: use_default_signature={yes|no}
-#
-# - use a Server/User-Agent header with the SEMS server
-# signature and version.
-# Set server_signature=0 in ser_sems.cfg if you use SER
-# as SIP stack.
-#
-# default=no
-#
-use_default_signature=yes
-
-# optional parameter: signature=<signature string>
-#
-# - use a Server/User-Agent header with a custom user agent
-# signature.
-# Overridden by default signature if
-# use_default_signature is set.
-# Set server_signature=0 in ser_sems.cfg if you use it.
-#
-#
-# signature="SEMS media server 1.0"
-
-# optional parameter: single_codec_in_ok={yes|no}
-#
-# - use single codec in 200 OK response
-#
-# default=no
-#
-# single_codec_in_ok=no
-
-# optional parameter: codec_order=codec_name_1,codec_name2,...
-#
-# - Codec order used when sending INVITE requests. Codecs in codec_order
-# will be on the top of the list followed by other supported codecs
-# (if any).
-#
-# default=empty
-#
-# codec_order=iLBC,GSM
-
-# optional parameter: ignore_rtpxheaders={yes|no}
-#
-# - if this is set to yes, RTP extension headers (e.g. when using ZRTP)
-# are ignored. If set to no, the whole RTP packets with extension
-# headers will be ignored and a debug message is printed on every
-# received packet.
-#
-# default=no
-#
-# ignore_rtpxheaders=yes
-
-# optional parameter: dtmf_detector={spandsp|internal}
-#
-# sets inband DTMF detector to use. spandsp support must be compiled in
-# for this to have effect if dtmf_detector=spandsp.
-#
-# default: internal
-#
-# dtmf_detector=spandsp
-
-# optional parameter: unhandled_reply_loglevel={error|warn|info|debug|no}
-#
-# the default application logic implemented in the applications is to stop
-# the session right after sending BYE, without waiting for a reply. this
-# leads to many log entries of the form
-# ERROR: [b6fa6bb0] handleSipMsg (AmSipDispatcher.cpp:48): unhandled
-# reply: [code:200;phrase:[OK];... ]
-#
-# This parameter sets the log lovel of unhandled positive (200 class) replies.
-#
-# default: error
-#
-# unhandled_reply_loglevel=info
diff --git a/main/sems/sems.initd b/main/sems/sems.initd
index 0e96f8a21a..3b6973b55c 100644..100755
--- a/main/sems/sems.initd
+++ b/main/sems/sems.initd
@@ -3,35 +3,46 @@
# Follows Gentoo/AlpineLinux standards
# GPL 2 License - N. Angelacos 2011
-CONFDIR="/etc/sems"
SVC="${SVCNAME#*.}"
-if [ -n "${SVC}" ] && [ "${SVCNAME}" != "sems" ]; then
- SEMSPID="/var/run/sems/${SVC}.pid"
- else
- SEMSPID="/var/run/sems/sems.pid"
- fi
-SEMSCONF="${CONFDIR}/${SVC}.conf"
-daemon=/usr/sbin/sems
+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}
-depend() {
- need net
- after firewall
+checkconfig() {
+ if [ ! -f "${SEMS_CFG_FILE}" ] ; then
+ eerror "You need a "${SEMS_CFG_FILE}" file to run sems"
+ return 1;
+ fi
}
+
start() {
- ebegin "Starting ${SVCNAME}"
- echo $SEMSPID $SEMSCONF
- start-stop-daemon --start --quiet --pidfile $SEMSPID --exec $daemon \
+ 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} \
-- \
- -u sems \
- -g sems \
- -P $SEMSPID \
- -f $SEMSCONF
+ -f "${SEMS_CFG_FILE}" \
+ -P "${SEMS_PIDFILE}" \
+ -u "${SEMS_USER}" \
+ -g "${SEMS_GROUP}"
eend $?
}
stop() {
- ebegin "Stopping ${SVCNAME}"
- start-stop-daemon --stop --quiet --pidfile $SEMSPID
+ 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/main/sems/sems.post-install b/main/sems/sems.post-install
deleted file mode 100644
index cd800bdcd6..0000000000
--- a/main/sems/sems.post-install
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-mkdir -p /var/run/sems 2>/dev/null
-chown -R sems:sems /var/run/sems 2>/dev/null
-chgrp sems /etc/sems/sems.cfg 2>/dev/null
-exit 0
diff --git a/main/sems/sems.pre-install b/main/sems/sems.pre-install
index 3e82578a3e..f126694087 100644
--- a/main/sems/sems.pre-install
+++ b/main/sems/sems.pre-install
@@ -1,5 +1,10 @@
#!/bin/sh
-adduser -H -h /var/empty -s /bin/false -D sems 2>/dev/null
+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 /bin/false -D -G sems sems 2>/dev/null
+fi
exit 0