From 6ca9d7f656434f67c7409e408c980f824db897af Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 30 Sep 2009 06:11:36 +0000 Subject: main/kamailio: moved from testing --- main/kamailio/APKBUILD | 109 ++++++++++++++++++++++++++++++++++++ main/kamailio/kamailio.cfg | 107 +++++++++++++++++++++++++++++++++++ main/kamailio/kamailio.initd | 26 +++++++++ main/kamailio/kamailio.post-install | 5 ++ main/kamailio/kamailio.pre-install | 5 ++ 5 files changed, 252 insertions(+) create mode 100644 main/kamailio/APKBUILD create mode 100644 main/kamailio/kamailio.cfg create mode 100644 main/kamailio/kamailio.initd create mode 100644 main/kamailio/kamailio.post-install create mode 100644 main/kamailio/kamailio.pre-install (limited to 'main/kamailio') diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD new file mode 100644 index 0000000000..d414f8e14a --- /dev/null +++ b/main/kamailio/APKBUILD @@ -0,0 +1,109 @@ +# Contributor: Michael Mason +# Maintainer: Natanael Copa +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 0000000000..9c101a871f --- /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 0000000000..ee4e2ecef1 --- /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 0000000000..19fc932dd6 --- /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 0000000000..78dfa38bf3 --- /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 -- cgit v1.2.3