Subject: [alpine-devel] Patch for Mediaproxy, init files and config.ini

From: Francesco <[email-masked]>
Date: Mon, 23 Nov 2009 09:32:24 +0100

Fixed dependencies for mediaproxy and added init files.
Added default config.ini file too.

Please review and commit, thanks!

:: Francesco Colista ::
From b346a5733034fcde7bbe36eab7a2a9c7be4cc29d Mon Sep 17 00:00:00 2001
From: Francesco Colista <[email-masked]>
Date: Mon, 23 Nov 2009 08:18:26 +0000
Subject: [PATCH] Fixed some dependencies and added initd files

---
 testing/mediaproxy/APKBUILD |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/testing/mediaproxy/APKBUILD b/testing/mediaproxy/APKBUILD
index 594c4e6..6ddd882 100644
--- a/testing/mediaproxy/APKBUILD
+++ b/testing/mediaproxy/APKBUILD
@@ -2,24 +2,40 @@
 # Maintainer: 
 pkgname=mediaproxy
 pkgver=2.3.8
-pkgrel=0
+pkgrel=1
 pkgdesc="MediaProxy"
-url="www.ag-projects.com/MediaProxy/"
+url="http://www.ag-projects.com/MediaProxy/"
 license="GPL"
 depends="python"
 makedepends="libnetfilter_conntrack-dev libnfnetlink-dev python26-buildutils
-	python26-setuptools python-dev"
+	python26-setuptools python-application python-cjson python-gnutls python-dev twisted"
 install=
 subpackages=""
 #subpackages="$pkgname-dev $pkgname-doc"
-source="http://download.ag-projects.com/MediaProxy/$pkgname-$pkgver.tar.gz"
+source="http://download.ag-projects.com/MediaProxy/$pkgname-$pkgver.tar.gz
+	mediaproxy-dispatcher.initd
+	mediaproxy-relay.initd
+	config.ini
+"
 
 build() {
 	cd "$srcdir"/$pkgname-$pkgver
-
 	mkdir -p "$pkgdir"/usr/lib/python2.6/site-packages
+
 	python setup.py install --root="$pkgdir"
+
 	echo "/usr/lib/python2.6/site-packages/$_pkgname-$pkgver-py2.6.egg" > "$pkgdir"/usr/lib/python2.6/site-packages/$_pkgname.pth
+
+	sed -i -e 's:net.ipv4.ip_forward = 0:net.ipv4.ip_forward = 1:' /etc/sysctl.conf
+
+	install -D -m755 "$srcdir"/$pkgname-dispatcher.initd "$pkgdir"/etc/init.d/$pkgname-dispatcher
+	install -D -m755 "$srcdir"/$pkgname-relay.initd "$pkgdir"/etc/init.d/$pkgname-relay
+	install -D -m755 "$srcdir"/config.ini "$pkgdir"/etc/mediaproxy/config.ini
+	install -d -o kamailio "$pkgdir"/etc/mediaproxy/tls/
+	install -d -o kamailio "$pkgdir"/var/run/$pkgname
 }
 
-md5sums="8914a2b69415946e5ffdb843823b3ef1  mediaproxy-2.3.8.tar.gz"
+md5sums="8914a2b69415946e5ffdb843823b3ef1  mediaproxy-2.3.8.tar.gz
+7fa7907b87777281c31e5ff49d8d5011  mediaproxy-dispatcher.initd
+842beb8bca2dbbf16a092fbc27ee4ac2  mediaproxy-relay.initd
+2e58c2bc3e5984f74f01e3c701fa3467  config.ini"
-- 
1.6.5.3

From c7b33a74fba3bf4f1bf2fb8af94ef291008f5330 Mon Sep 17 00:00:00 2001
From: Francesco Colista <[email-masked]>
Date: Mon, 23 Nov 2009 08:20:15 +0000
Subject: [PATCH] .ini file for mediaproxy

---
 main/kamailio/APKBUILD               |   15 +++++++--------
 testing/mediaproxy/config.ini        |   19 +++++++++++++++++++
 testing/python26-setuptools/APKBUILD |    4 ++--
 3 files changed, 28 insertions(+), 10 deletions(-)
 create mode 100644 testing/mediaproxy/config.ini

diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
index d9874aa..5d69cb0 100644
--- a/main/kamailio/APKBUILD
+++ b/main/kamailio/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=kamailio
 pkgver=1.5.3
-pkgrel=1
+pkgrel=2
 pkgdesc="Open Source SIP Server"
 url="http://www.kamailio.org/"
 pkgusers="kamailio"
@@ -17,7 +17,6 @@ subpackages="$pkgname-doc $pkgname-mysql $pkgname-postgres $pkgname-pcre
 source="http://www.kamailio.org/pub/kamailio/$pkgver/src/$pkgname-$pkgver-notls_src.tar.gz
 	kamailio.cfg
 	kamailio.initd
-	kamctl_dbtext-support.patch
 	kamailio.pre-install
 	kamailio.post-install
 	"
@@ -27,17 +26,18 @@ build() {
 	sed -i -e 's:^cfg-target.*:cfg-target = $(cfg-dir):' \
 		-e 's:^cfg-prefix.*:cfg-prefix = $(basedir):' Makefile.defs \
 		|| return 1
-
 	cd scripts
 	sed -i -e 's:/var/run/kamailio.pid:/var/run/kamailio/kamailio.pid:g' \
 		kamctl.base kamctlrc || return 1
 	# we actually dont need bash
-	sed -i -e '1s:/bin/bash:/bin/sh:' kamctl kamdbctl \
+	sed -i -e 's:/bin/bash:/bin/sh:' kamctl kamdbctl \
+		|| return 1
+	# Set email_address field as not required field (could be null)
+	cd dbtext/kamailio
+	sed -i -e 's:email_address(string):email_address(string,null):' subscriber \
 		|| return 1
-	# patch for dbtext support kamctl script
-	patch kamctl < "$srcdir"/kamctl_dbtext-support.patch
 
-	cd ..
+	cd ../../../
 
 	make prefix=/usr \
 		cfg-dir=/etc/kamailio/ \
@@ -123,6 +123,5 @@ unixodbc() {
 md5sums="17eeea5cdc2fdd28b2f9a1bad6598de2  kamailio-1.5.3-notls_src.tar.gz
 eb665248ee39cf755a247286affc5cbb  kamailio.cfg
 81100c479890a2a8c2628db22fdd1a0c  kamailio.initd
-57fcf6ba3ab7ab7081a9c512881b2a05  kamctl_dbtext-support.patch
 c646af2dd31f5c4289a2f802c873d98f  kamailio.pre-install
 3fbaf633ff1620d0d526fc4047c7bed9  kamailio.post-install"
diff --git a/testing/mediaproxy/config.ini b/testing/mediaproxy/config.ini
new file mode 100644
index 0000000..995c006
--- /dev/null
+++ b/testing/mediaproxy/config.ini
@@ -0,0 +1,19 @@
+[Dispatcher]           
+socket = /var/run/mediaproxy/proxydispatcher.sock
+defaultproxy = /var/run/mediaproxy/mediaproxy.sock
+
+[MediaProxy] 
+start = yes 
+socket = /var/run/mediaproxy/mediaproxy.sock                   
+group = kamailio
+listen = 0.0.0.0        
+allow = None 
+proxyIP =                   # This is where your Kamailio is installed 
+portRange = 9000:9049       # These values are set same in ATA's configs for RTP Port Range 
+idleTimeout = 60             
+holdTimeout = 180         
+forceClose = 0 
+
+[Accounting]            
+accounting = off
+
diff --git a/testing/python26-setuptools/APKBUILD b/testing/python26-setuptools/APKBUILD
index e8322dd..4aac16a 100644
--- a/testing/python26-setuptools/APKBUILD
+++ b/testing/python26-setuptools/APKBUILD
@@ -19,9 +19,9 @@ build() {
 	python setup.py install --root="$pkgdir"
 	echo "/usr/lib/python2.6/site-packages/$_pkgname-$pkgver-py2.6.egg" > "$pkgdir"/usr/lib/python2.6/site-packages/$_pkgname.pth
 
-	# we don't provide a non-suffixed easy_install
 	echo "Removing non-suffixed easy_install ( $pkgdir/usr/bin/easy_install)"
-	rm "$pkgdir"/usr/bin/easy_install
+        rm "$pkgdir"/usr/bin/easy_install
+
 }
 
 md5sums="7df2a529a074f613b509fb44feefe74e  setuptools-0.6c11.tar.gz"
-- 
1.6.5.3

From cc6149a8cf1a57b37bd219dff46233c45ecedb01 Mon Sep 17 00:00:00 2001
From: Francesco Colista <[email-masked]>
Date: Mon, 23 Nov 2009 08:21:31 +0000
Subject: [PATCH] Init file for mediaproxy-dispatcher

---
 testing/mediaproxy/mediaproxy-dispatcher.initd |   26 ++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 testing/mediaproxy/mediaproxy-dispatcher.initd

diff --git a/testing/mediaproxy/mediaproxy-dispatcher.initd b/testing/mediaproxy/mediaproxy-dispatcher.initd
new file mode 100644
index 0000000..7736410
--- /dev/null
+++ b/testing/mediaproxy/mediaproxy-dispatcher.initd
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+
+daemon=/usr/bin/media-dispatcher
+pidfile=/var/run/mediaproxy/mediaproxy-dispatcher.pid
+
+depend() {
+	need net
+	after firewall
+	after kamailio
+}
+
+start() {
+	ebegin "Starting Mediaproxy Dispatcher"
+	start-stop-daemon --start --quiet --pidfile $pidfile --exec $daemon \
+		-- \
+		-u kamailio \
+		-g kamailio \
+		-P $pidfile \
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping Mediaproxy Dispatcher"
+	start-stop-daemon --stop --quiet --pidfile $pidfile
+	eend $?
+}
-- 
1.6.5.3

From 1d0b5c355cca7b9659d923b8177af9c83842675a Mon Sep 17 00:00:00 2001
From: Francesco Colista <[email-masked]>
Date: Mon, 23 Nov 2009 08:22:08 +0000
Subject: [PATCH] Init file for mediaproxy-relay

---
 testing/mediaproxy/mediaproxy-relay.initd |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 testing/mediaproxy/mediaproxy-relay.initd

diff --git a/testing/mediaproxy/mediaproxy-relay.initd b/testing/mediaproxy/mediaproxy-relay.initd
new file mode 100644
index 0000000..73dc32a
--- /dev/null
+++ b/testing/mediaproxy/mediaproxy-relay.initd
@@ -0,0 +1,23 @@
+#!/sbin/runscript
+
+daemon=/usr/bin/media-relay
+pidfile=/var/run/mediaproxy/mediaproxy-relay.pid
+
+depend() {
+	need net
+	after firewall
+	after mediaproxy-dispatcher
+}
+
+start() {
+	ebegin "Starting Mediaproxy Relay"
+	start-stop-daemon --start --quiet --pidfile $pidfile --exec $daemon \
+		-P $pidfile \
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping Mediaproxy Relay"
+	start-stop-daemon --stop --quiet --pidfile $pidfile
+	eend $?
+}
-- 
1.6.5.3