summaryrefslogtreecommitdiffstats
path: root/main/kamailio
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-09-30 06:11:36 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-09-30 06:11:36 +0000
commit6ca9d7f656434f67c7409e408c980f824db897af (patch)
tree72edb8cc4390cf2e08548dd03ff7ff0294d68d49 /main/kamailio
parente92cddc8802b50ba8d81819040bbc20b78a51715 (diff)
downloadaports-6ca9d7f656434f67c7409e408c980f824db897af.tar.bz2
aports-6ca9d7f656434f67c7409e408c980f824db897af.tar.xz
main/kamailio: moved from testing
Diffstat (limited to 'main/kamailio')
-rw-r--r--main/kamailio/APKBUILD109
-rw-r--r--main/kamailio/kamailio.cfg107
-rw-r--r--main/kamailio/kamailio.initd26
-rw-r--r--main/kamailio/kamailio.post-install5
-rw-r--r--main/kamailio/kamailio.pre-install5
5 files changed, 252 insertions, 0 deletions
diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
new file mode 100644
index 00000000..d414f8e1
--- /dev/null
+++ b/main/kamailio/APKBUILD
@@ -0,0 +1,109 @@
+# Contributor: Michael Mason <ms13sp@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=kamailio
+pkgver=1.5.2
+pkgrel=6
+pkgdesc="Open Source SIP Server"
+url="http://www.kamailio.org/"
+pkgusers="kamailio"
+pkggroups="kamailio"
+license="GPL"
+depends=
+makedepends="bison flex expat-dev postgresql-dev mysql-dev pcre-dev
+ libxml2-dev curl-dev"
+install=
+subpackages="$pkgname-doc $pkgname-mysql $pkgname-postgres $pkgname-pcre
+ $pkgname-presence"
+source="http://www.kamailio.org/pub/kamailio/$pkgver/src/$pkgname-$pkgver-notls_src.tar.gz
+ kamailio.cfg
+ kamailio.initd
+ kamailio.pre-install
+ kamailio.post-install"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver-notls"
+ 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 \
+ || return 1
+ cd ..
+
+ make prefix=/usr \
+ cfg-dir=/etc/kamailio/ \
+ MODS_MYSQL=yes \
+ MODS_PCRE=yes \
+ MODS_PRESENCE=yes \
+ MODS_RADIUS= \
+ TLS= \
+ include_modules=db_postgres \
+ all || return 1
+ make prefix=/usr \
+ cfg-dir=/etc/kamailio/ \
+ MODS_MYSQL=yes \
+ MODS_PCRE=yes \
+ MODS_PRESENCE=yes \
+ MODS_RADIUS= \
+ TLS= \
+ include_modules=db_postgres \
+ basedir="$pkgdir" install || return 1
+
+ # move default config to -doc package and use our own default config
+ mv "$pkgdir"/etc/kamailio/kamailio.cfg \
+ "$pkgdir"/usr/share/doc/kamailio/
+ install -m644 -D "$srcdir"/kamailio.cfg \
+ "$pkgdir"/etc/kamailio/kamailio.cfg
+
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+ install -d -o kamailio "$pkgdir"/var/run/kamailio
+}
+
+_mv_mod() {
+ local moddir=usr/lib/kamailio/modules i=
+ mkdir -p "$subpkgdir"/$moddir
+ for i in $@; do
+ mv "$pkgdir"/$moddir/$i.so "$subpkgdir"/$moddir/ || return 1
+ done
+}
+
+
+mysql() {
+ pkgdesc="MySQL support for kamailio"
+ depends="kamailio mysql-client"
+ _mv_mod db_mysql
+ mkdir -p "$subpkgdir"/usr/share/kamailio
+ mv "$pkgdir"/usr/share/kamailio/mysql \
+ "$subpkgdir"/usr/share/kamailio/
+}
+
+postgres() {
+ pkgdesc="PostgreSQL support for kamailio"
+ depends="kamailio postgresql-client"
+ _mv_mod db_postgres
+ mkdir -p "$subpkgdir"/usr/share/kamailio
+ mv "$pkgdir"/usr/share/kamailio/postgres \
+ "$subpkgdir"/usr/share/kamailio/
+}
+
+pcre() {
+ pkgdesc="Regular expressions support for kamailio"
+ _mv_mod dialplan lcr regex
+}
+
+presence() {
+ pkgdesc="Precense support for kamailio"
+ _mv_mod presence presence_xml presence_mwi pua pua_bla pua_mi \
+ pua_usrloc pua_xmpp rls xcap_client presence_dialoginfo \
+ pua_dialoginfo
+}
+
+md5sums="6c6f4ed6fbcb4d008b8ac3de5b99ce99 kamailio-1.5.2-notls_src.tar.gz
+eb665248ee39cf755a247286affc5cbb kamailio.cfg
+81100c479890a2a8c2628db22fdd1a0c kamailio.initd
+c646af2dd31f5c4289a2f802c873d98f kamailio.pre-install
+3fbaf633ff1620d0d526fc4047c7bed9 kamailio.post-install"
diff --git a/main/kamailio/kamailio.cfg b/main/kamailio/kamailio.cfg
new file mode 100644
index 00000000..9c101a87
--- /dev/null
+++ b/main/kamailio/kamailio.cfg
@@ -0,0 +1,107 @@
+# Demonstration Kamailio Configuration for AlpineLinux
+
+
+#--------------------------------------------------------
+# Section 1: Global Definitions
+#--------------------------------------------------------
+debug = 3
+fork = yes
+log_stderror = no
+listen = 0.0.0.0
+port = 5060
+children = 4
+
+dns = no
+rev_dns = no
+
+mpath = "/usr/lib/kamailio/modules/"
+#--------------------------------------------------------
+# Section 2: Modules
+#--------------------------------------------------------
+
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "rr.so"
+loadmodule "maxfwd.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "mi_fifo.so"
+
+#--------------------------------------------------------
+# Section 1: Module Configuration
+#--------------------------------------------------------
+
+modparam ( "usrloc", "db_mode", 0 )
+modparam ( "rr", "enable_full_lr", 1 )
+modparam ( "mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+
+#--------------------------------------------------------
+# Section 1: Main Route Block
+#--------------------------------------------------------
+
+route
+ {
+ if (!mf_process_maxfwd_header("10"))
+ {
+ sl_send_reply("483", "Too Many Hops");
+ return;
+ }
+
+ if (msg:len > max_len)
+ {
+ sl_send_reply("513", "Message Overflow");
+ return;
+ }
+
+ if (method == "REGISTER" )
+ {
+ route(2);
+ return;
+ }
+
+ loose_route();
+
+ if (!lookup("location")) {
+ sl_send_reply("404", "User Not Found");
+ return;
+ }
+
+ route(1);
+
+}
+#--------------------------------------------------------
+# Section 1: Secondary Route Blocks
+#--------------------------------------------------------
+
+# - Default message handler
+route[1] {
+ if (!t_relay()) {
+ sl_reply_error();
+ }
+}
+
+#- Registration Request
+route[2] {
+ if (!save("location")) {
+ sl_reply_error();
+ }
+}
+
+#--------------------------------------------------------
+# Section 1: Reply Route Block
+#--------------------------------------------------------
+
+
+#--------------------------------------------------------
+# Section 1: Failure Route Block
+#--------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
diff --git a/main/kamailio/kamailio.initd b/main/kamailio/kamailio.initd
new file mode 100644
index 00000000..ee4e2ece
--- /dev/null
+++ b/main/kamailio/kamailio.initd
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+
+daemon=/usr/sbin/kamailio
+pidfile=/var/run/kamailio/kamailio.pid
+
+depend() {
+ need net
+ after firewall
+}
+
+start() {
+ ebegin "Starting Kamailio"
+ start-stop-daemon --start --quiet --pidfile $pidfile --exec $daemon \
+ -- \
+ -u ${KAMAILIO_USER:-kamailio} \
+ -g ${KAMAILIO_GROUP:-kamailio} \
+ -P $pidfile \
+ ${KAMAILIO_OPTS:-}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping Kamailio"
+ start-stop-daemon --stop --quiet --pidfile $pidfile
+ eend $?
+}
diff --git a/main/kamailio/kamailio.post-install b/main/kamailio/kamailio.post-install
new file mode 100644
index 00000000..19fc932d
--- /dev/null
+++ b/main/kamailio/kamailio.post-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+chown -R kamailio:kamailio /var/run/kamailio
+chgrp kamailio /etc/kamailio/kamailio.cfg
+exit 0
diff --git a/main/kamailio/kamailio.pre-install b/main/kamailio/kamailio.pre-install
new file mode 100644
index 00000000..78dfa38b
--- /dev/null
+++ b/main/kamailio/kamailio.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+adduser -H -h /var/empty -s /bin/false -D kamailio 2>/dev/null
+
+exit 0