Browse Source

Merge branch 'missing_imports'

Add various tools and scripts from Kamailio svn repository to
the shared sip-router git repository.

* missing_imports: (628 commits)
  - updated email address
  - fix kamctl for cr after table changes for 1.5.x, bug #2794168
  - 2 fixes in commented examples
  - call nat detection route (reported by Mark Sidell)
  - set 0 default values for the new columns
  - small rephrasing, extend man page a bit
  - layout fix in man page for kamdbctl
  - Fixed "kamctl ping": From and Contact in generated OPTIONS didn't contain "sip:"
  - build memcached module as own debian package
  - Added libmemcache-dev to "control" files for deb packages (patch by Andreas Heise)
  - Improved RR section in default config file: record_route() just for INVITE and SUBSCRIBE (credits to Jon Bonilla)
  - Improved Debian init script:
  - remove debian-sarge, etch is now oldstable
  - increment debian packaging version for trunk
  - add missing libpcre3-dev depencency
  - fix purple table name for non mysql databases setup
  - small spelling fix
  - remove purple module from sarge packaging
  - updated with more examples
  - regenerated db table creation for dialog and purplemap
  ...
Jan Janak 16 năm trước cách đây
mục cha
commit
4743d49958
100 tập tin đã thay đổi với 6792 bổ sung0 xóa
  1. 49 0
      etc/dictionary.radius
  2. 545 0
      etc/kamailio.cfg
  3. 22 0
      etc/tls/README
  4. 88 0
      etc/tls/ca.conf
  5. 58 0
      etc/tls/request.conf
  6. 22 0
      etc/tls/rootCA/cacert.pem
  7. 56 0
      etc/tls/rootCA/certs/01.pem
  8. 1 0
      etc/tls/rootCA/index.txt
  9. 30 0
      etc/tls/rootCA/private/cakey.pem
  10. 1 0
      etc/tls/rootCA/serial
  11. 16 0
      etc/tls/user.conf
  12. 22 0
      etc/tls/user/user-calist.pem
  13. 56 0
      etc/tls/user/user-cert.pem
  14. 9 0
      etc/tls/user/user-cert_req.pem
  15. 9 0
      etc/tls/user/user-privkey.pem
  16. 242 0
      examples/kamailio/acc-mysql.cfg
  17. 71 0
      examples/kamailio/acc.cfg
  18. 224 0
      examples/kamailio/ctd.sh
  19. 30 0
      examples/kamailio/exec_s3.cfg
  20. 41 0
      examples/kamailio/exec_s4.cfg
  21. 68 0
      examples/kamailio/exec_s5.cfg
  22. 103 0
      examples/kamailio/flag_reply.cfg
  23. 67 0
      examples/kamailio/fork.cfg
  24. 31 0
      examples/kamailio/logging.cfg
  25. 146 0
      examples/kamailio/msilo.cfg
  26. 237 0
      examples/kamailio/nathelper.cfg
  27. 148 0
      examples/kamailio/pstn.cfg
  28. 33 0
      examples/kamailio/redirect.cfg
  29. 76 0
      examples/kamailio/replicate.cfg
  30. 65 0
      examples/kamailio/serial_183.cfg
  31. 11 0
      examples/kamailio/web_im/README
  32. 40 0
      examples/kamailio/web_im/click_to_dial.html
  33. 76 0
      examples/kamailio/web_im/click_to_dial.php
  34. 37 0
      examples/kamailio/web_im/send_im.html
  35. 77 0
      examples/kamailio/web_im/send_im.php
  36. 14 0
      pkg/kamailio/debian-etch/changelog
  37. 1 0
      pkg/kamailio/debian-etch/compat
  38. 239 0
      pkg/kamailio/debian-etch/control
  39. 27 0
      pkg/kamailio/debian-etch/copyright
  40. 38 0
      pkg/kamailio/debian-etch/kamailio.README.Debian
  41. 24 0
      pkg/kamailio/debian-etch/kamailio.default
  42. 2 0
      pkg/kamailio/debian-etch/kamailio.dirs
  43. 2 0
      pkg/kamailio/debian-etch/kamailio.examples
  44. 170 0
      pkg/kamailio/debian-etch/kamailio.init
  45. 48 0
      pkg/kamailio/debian-etch/kamailio.postinst
  46. 3 0
      pkg/kamailio/debian-etch/patches/00list
  47. 27 0
      pkg/kamailio/debian-etch/patches/10_no_lib64_on_64_bits.dpatch
  48. 24 0
      pkg/kamailio/debian-etch/patches/11_always_smp.dpatch
  49. 374 0
      pkg/kamailio/debian-etch/rules
  50. 14 0
      pkg/kamailio/debian-lenny/changelog
  51. 1 0
      pkg/kamailio/debian-lenny/compat
  52. 242 0
      pkg/kamailio/debian-lenny/control
  53. 27 0
      pkg/kamailio/debian-lenny/copyright
  54. 38 0
      pkg/kamailio/debian-lenny/kamailio.README.Debian
  55. 24 0
      pkg/kamailio/debian-lenny/kamailio.default
  56. 2 0
      pkg/kamailio/debian-lenny/kamailio.dirs
  57. 2 0
      pkg/kamailio/debian-lenny/kamailio.examples
  58. 170 0
      pkg/kamailio/debian-lenny/kamailio.init
  59. 48 0
      pkg/kamailio/debian-lenny/kamailio.postinst
  60. 3 0
      pkg/kamailio/debian-lenny/patches/00list
  61. 27 0
      pkg/kamailio/debian-lenny/patches/10_no_lib64_on_64_bits.dpatch
  62. 24 0
      pkg/kamailio/debian-lenny/patches/11_always_smp.dpatch
  63. 374 0
      pkg/kamailio/debian-lenny/rules
  64. 14 0
      pkg/kamailio/debian/changelog
  65. 1 0
      pkg/kamailio/debian/compat
  66. 242 0
      pkg/kamailio/debian/control
  67. 27 0
      pkg/kamailio/debian/copyright
  68. 38 0
      pkg/kamailio/debian/kamailio.README.Debian
  69. 24 0
      pkg/kamailio/debian/kamailio.default
  70. 2 0
      pkg/kamailio/debian/kamailio.dirs
  71. 2 0
      pkg/kamailio/debian/kamailio.examples
  72. 170 0
      pkg/kamailio/debian/kamailio.init
  73. 48 0
      pkg/kamailio/debian/kamailio.postinst
  74. 3 0
      pkg/kamailio/debian/patches/00list
  75. 27 0
      pkg/kamailio/debian/patches/10_no_lib64_on_64_bits.dpatch
  76. 24 0
      pkg/kamailio/debian/patches/11_always_smp.dpatch
  77. 375 0
      pkg/kamailio/debian/rules
  78. 75 0
      pkg/kamailio/fedora/kamailio.init
  79. 201 0
      pkg/kamailio/freebsd/Makefile
  80. 3 0
      pkg/kamailio/freebsd/distinfo
  81. 78 0
      pkg/kamailio/freebsd/files/patch-Makefile
  82. 11 0
      pkg/kamailio/freebsd/files/patch-Makefile-mysql
  83. 42 0
      pkg/kamailio/freebsd/files/patch-Makefile.defs
  84. 24 0
      pkg/kamailio/freebsd/files/pkg-deinstall.in
  85. 12 0
      pkg/kamailio/freebsd/files/pkg-install.in
  86. 13 0
      pkg/kamailio/freebsd/pkg-descr
  87. 118 0
      pkg/kamailio/gentoo/kamailio-1.2.0.ebuild
  88. 22 0
      pkg/kamailio/gentoo/kamailio.init
  89. 1 0
      pkg/kamailio/netbsd/COMMENT
  90. 18 0
      pkg/kamailio/netbsd/DESCR
  91. 42 0
      pkg/kamailio/netbsd/Makefile
  92. 120 0
      pkg/kamailio/netbsd/PLIST
  93. 1 0
      pkg/kamailio/netbsd/distinfo
  94. 154 0
      pkg/kamailio/openbsd/Makefile
  95. 5 0
      pkg/kamailio/openbsd/distinfo
  96. 13 0
      pkg/kamailio/openbsd/patches/patch-etc_kamailio_cfg
  97. 15 0
      pkg/kamailio/openbsd/patches/patch-modules_perl_Makefile
  98. 12 0
      pkg/kamailio/openbsd/patches/patch-scripts_kamctlrc
  99. 1 0
      pkg/kamailio/openbsd/pkg/COMMENT
  100. 18 0
      pkg/kamailio/openbsd/pkg/DESCR

+ 49 - 0
etc/dictionary.radius

@@ -0,0 +1,49 @@
+#
+# $Id$
+#
+# SIP RADIUS attributes
+#
+# Proprietary indicates an attribute that hasn't
+# been standardized
+#
+#
+# NOTE: All standard (IANA registered) attributes are 
+#       defined in the default dictionary of the 
+#       radiusclient-ng library.
+#
+
+
+#### Attributes ###
+ATTRIBUTE Sip-Uri-User         208  string     # Proprietary, auth_radius
+ATTRIBUTE Sip-Group            211  string     # Proprietary, group_radius
+ATTRIBUTE Sip-Rpid             213  string     # Proprietary, auth_radius
+ATTRIBUTE SIP-AVP              225  string     # Proprietary, avp_radius
+
+### Acct-Status-Type Values ###
+#VALUE Acct-Status-Type   Failed           15   # RFC2866, acc
+
+### Service-Type Values ###
+#VALUE Service-Type       Call-Check       10   # RFC2865, uri_radius
+VALUE Service-Type       Group-Check      12   # Proprietary, group_radius
+##VALUE Service-Type       Sip-Session      15   # Schulzrinne, acc, auth_radius
+VALUE Service-Type       SIP-Caller-AVPs  30   # Proprietary, avp_radius
+VALUE Service-Type       SIP-Callee-AVPs  31   # Proprietary, avp_radius
+
+### Sip-Method Values ###
+VALUE Sip-Method         Undefined      0
+VALUE Sip-Method         Invite         1
+VALUE Sip-Method         Cancel         2
+VALUE Sip-Method         Ack            4
+VALUE Sip-Method         Bye            8
+VALUE Sip-Method         Info           16
+VALUE Sip-Method         Options        32
+VALUE Sip-Method         Update         64
+VALUE Sip-Method         Register       128
+VALUE Sip-Method         Message        256
+VALUE Sip-Method         Subscribe      512
+VALUE Sip-Method         Notify         1024
+VALUE Sip-Method         Prack          2048
+VALUE Sip-Method         Refer          4096
+VALUE Sip-Method         Other          8192
+
+

+ 545 - 0
etc/kamailio.cfg

@@ -0,0 +1,545 @@
+#
+# $Id$
+#
+# Kamailio (OpenSER) SIP Server - basic configuration script
+#     - web: http://www.kamailio.org
+#     - svn: http://openser.svn.sourceforge.net/viewvc/openser/
+#
+# Direct your questions about this file to: <[email protected]>
+#
+# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
+# for an explanation of possible statements, functions and parameters.
+#
+# There are comments showing how to enable different features in th econfig
+# file. Such commented code starts with #X# where X is a letter to identify
+# a feature. Delete entire #X# if you want to enable that feature. Next are
+# sed commands that help you enable such features.
+#
+# *** To enamble mysql execute:
+#     sed -i 's/#m#//g' kamailio.cfg
+#
+# *** To enamble authentication execute:
+#     - enable mysql
+#     sed -i 's/#a#//g' kamailio.cfg
+#     - add users using 'kamctl'
+#
+# *** To enamble persistent user location execute:
+#     - enable mysql
+#     sed -i 's/#u#//g' kamailio.cfg
+#
+# *** To enamble presence server execute:
+#     - enable mysql
+#     sed -i 's/#p#//g' kamailio.cfg
+#
+# *** To enamble nat traversal execute:
+#     sed -i 's/#n#//g' kamailio.cfg
+#     - install RTPProxy: http://www.rtpproxy.org
+#     - start RTPProxy:
+#        rtpproxy -l _your_public_ip_ -s udp:localhost:7722
+#
+# *** To enhance accounting execute:
+#     - enable mysql
+#     sed -i 's/#c#//g' kamailio.cfg
+#     - add following columns to database
+# ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
+# ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
+# ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
+# ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
+# ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
+# ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
+# ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
+# ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
+# ALTER TABLE missed_call ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
+# ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
+#
+
+
+####### Global Parameters #########
+
+debug=3
+log_stderror=no
+log_facility=LOG_LOCAL0
+
+fork=yes
+children=4
+
+/* uncomment the following lines to enable debugging */
+#debug=6
+#fork=no
+#log_stderror=yes
+
+/* uncomment the next line to disable TCP (default on) */
+#disable_tcp=yes
+
+/* uncomment the next line to enable the auto temporary blacklisting of 
+   not available destinations (default disabled) */
+#disable_dns_blacklist=no
+
+/* uncomment the next line to enable IPv6 lookup after IPv4 dns 
+   lookup failures (default disabled) */
+#dns_try_ipv6=yes
+
+/* uncomment the next line to disable the auto discovery of local aliases
+   based on revers DNS on IPs (default on) */
+#auto_aliases=no
+
+/* uncomment the following lines to enable TLS support  (default off) */
+#disable_tls = no
+#listen = tls:your_IP:5061
+#tls_verify_server = 1
+#tls_verify_client = 1
+#tls_require_client_certificate = 0
+#tls_method = TLSv1
+#tls_certificate = "/usr/local/etc/kamailio/tls/user/user-cert.pem"
+#tls_private_key = "/usr/local/etc/kamailio/tls/user/user-privkey.pem"
+#tls_ca_list     = "/usr/local/etc/kamailio/tls/user/user-calist.pem"
+
+
+port=5060
+
+/* uncomment and configure the following line if you want Kamailio to 
+   bind on a specific interface/port/proto (default bind on all available) */
+#listen=udp:192.168.1.2:5060
+
+
+####### Modules Section ########
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+/* uncomment next line for MySQL DB support */
+#m#loadmodule "db_mysql.so"
+loadmodule "mi_fifo.so"
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "rr.so"
+loadmodule "pv.so"
+loadmodule "maxfwd.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "textops.so"
+loadmodule "uri_db.so"
+loadmodule "siputils.so"
+loadmodule "xlog.so"
+loadmodule "acc.so"
+/* uncomment next lines for MySQL based authentication support 
+   NOTE: a DB (like db_mysql) module must be also loaded */
+#a#loadmodule "auth.so"
+#a#loadmodule "auth_db.so"
+/* uncomment next line for aliases support
+   NOTE: a DB (like db_mysql) module must be also loaded */
+#loadmodule "alias_db.so"
+/* uncomment next line for multi-domain support
+   NOTE: a DB (like db_mysql) module must be also loaded
+   NOTE: be sure and enable multi-domain support in all used modules
+         (see "multi-module params" section ) */
+#loadmodule "domain.so"
+/* uncomment the next two lines for presence server support
+   NOTE: a DB (like db_mysql) module must be also loaded */
+#p#loadmodule "presence.so"
+#p#loadmodule "presence_xml.so"
+
+#n#loadmodule "nathelper.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+
+# ----- mi_fifo params -----
+modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+
+
+# ----- rr params -----
+# add value to ;lr param to cope with most of the UAs
+modparam("rr", "enable_full_lr", 1)
+# do not append from tag to the RR (no need for this script)
+modparam("rr", "append_fromtag", 0)
+
+
+# ----- rr params -----
+modparam("registrar", "method_filtering", 1)
+/* uncomment the next line to disable parallel forking via location */
+# modparam("registrar", "append_branches", 0)
+/* uncomment the next line not to allow more than 10 contacts per AOR */
+#modparam("registrar", "max_contacts", 10)
+
+
+# ----- uri_db params -----
+/* by default we disable the DB support in the module as we do not need it
+   in this configuration */
+modparam("uri_db", "use_uri_table", 0)
+modparam("uri_db", "db_url", "")
+
+
+# ----- acc params -----
+/* what sepcial events should be accounted ? */
+modparam("acc", "early_media", 1)
+modparam("acc", "report_ack", 1)
+modparam("acc", "report_cancels", 1)
+/* by default ww do not adjust the direct of the sequential requests.
+   if you enable this parameter, be sure the enable "append_fromtag"
+   in "rr" module */
+modparam("acc", "detect_direction", 0)
+/* account triggers (flags) */
+modparam("acc", "failed_transaction_flag", 3)
+modparam("acc", "log_flag", 1)
+modparam("acc", "log_missed_flag", 2)
+modparam("acc", "log_extra", 
+	"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
+/* uncomment the following lines to enable DB accounting also */
+#c#modparam("acc", "db_flag", 1)
+#c#modparam("acc", "db_missed_flag", 2)
+#c#modparam("acc", "db_url",
+#c#	"mysql://openser:openserrw@localhost/openser")
+#c#modparam("acc", "db_extra",
+#c#	"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
+
+
+# ----- usrloc params -----
+/* uncomment the following lines if you want to enable DB persistency
+   for location entries */
+#u#modparam("usrloc", "db_mode",   2)
+#u#modparam("usrloc", "db_url",
+#u#	"mysql://openser:openserrw@localhost/openser")
+
+# ----- auth_db params -----
+/* uncomment the following lines if you want to enable the DB based
+   authentication */
+#a#modparam("auth_db", "calculate_ha1", yes)
+#a#modparam("auth_db", "password_column", "password")
+#a#modparam("auth_db", "db_url",
+#a#	"mysql://openser:openserrw@localhost/openser")
+#a#modparam("auth_db", "load_credentials", "")
+
+
+# ----- alias_db params -----
+/* uncomment the following lines if you want to enable the DB based
+   aliases */
+#modparam("alias_db", "db_url",
+#	"mysql://openser:openserrw@localhost/openser")
+
+
+# ----- domain params -----
+/* uncomment the following lines to enable multi-domain detection
+   support */
+#modparam("domain", "db_url",
+#	"mysql://openser:openserrw@localhost/openser")
+#modparam("domain", "db_mode", 1)   # Use caching
+
+
+# ----- multi-module params -----
+/* uncomment the following line if you want to enable multi-domain support
+   in the modules (dafault off) */
+#modparam("alias_db|auth_db|usrloc|uri_db", "use_domain", 1)
+
+
+# ----- presence params -----
+/* uncomment the following lines if you want to enable presence */
+#p#modparam("presence|presence_xml", "db_url",
+#p#	"mysql://openser:openserrw@localhost/openser")
+#p#modparam("presence_xml", "force_active", 1)
+#p#modparam("presence", "server_address", "sip:192.168.1.2:5060")
+
+# -- nathelper
+#n#modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:7722")
+#n#modparam("nathelper", "natping_interval", 30)
+#n#modparam("nathelper", "ping_nated_only", 1)
+#n#modparam("nathelper", "sipping_bflag", 7)
+#n#modparam("nathelper", "sipping_from", "sip:[email protected]")
+#n#modparam("registrar|nathelper", "received_avp", "$avp(i:80)")
+#n#modparam("usrloc", "nat_bflag", 6)
+
+####### Routing Logic ########
+
+
+# main request routing logic
+
+route{
+
+	if (!mf_process_maxfwd_header("10")) {
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	}
+
+	# NAT detection
+	route(4);
+
+	if (has_totag()) {
+		# sequential request withing a dialog should
+		# take the path determined by record-routing
+		if (loose_route()) {
+			if (is_method("BYE")) {
+				setflag(1); # do accounting ...
+				setflag(3); # ... even if the transaction fails
+			}
+			route(1);
+		} else {
+			if (is_method("SUBSCRIBE") && uri == myself) {
+				# in-dialog subscribe requests
+				route(2);
+				exit;
+			}
+			if ( is_method("ACK") ) {
+				if ( t_check_trans() ) {
+					# non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server
+					t_relay();
+					exit;
+				} else {
+					# ACK without matching transaction ... ignore and discard.\n");
+					exit;
+				}
+			}
+			sl_send_reply("404","Not here");
+		}
+		exit;
+	}
+
+	#initial requests
+
+	# CANCEL processing
+	if (is_method("CANCEL"))
+	{
+		if (t_check_trans())
+			t_relay();
+		exit;
+	}
+
+	t_check_trans();
+
+	# authentication
+	route(3);
+
+	# record routing for dialog forming requests (in case they are routed)
+	if (is_method("INVITE|SUBSCRIBE"))
+		record_route();
+
+	# account only INVITEs
+	if (is_method("INVITE")) {
+		setflag(1); # do accounting
+	}
+	if (!uri==myself)
+	/* replace with following line if multi-domain support is used */
+	##if (!is_uri_host_local())
+	{
+		append_hf("P-hint: outbound\r\n"); 
+		# if you have some interdomain connections via TLS
+		##if($rd=="tls_domain1.net") {
+		##	t_relay("tls:domain1.net");
+		##	exit;
+		##} else if($rd=="tls_domain2.net") {
+		##	t_relay("tls:domain2.net");
+		##	exit;
+		##}
+		route(1);
+	}
+
+	# requests for my domain
+
+	if( is_method("PUBLISH|SUBSCRIBE"))
+		route(2);
+
+	if (is_method("REGISTER"))
+	{
+		if (!save("location"))
+			sl_reply_error();
+
+		exit;
+	}
+
+	if ($rU==NULL) {
+		# request with no Username in RURI
+		sl_send_reply("484","Address Incomplete");
+		exit;
+	}
+
+	# apply DB based aliases (uncomment to enable)
+	##alias_db_lookup("dbaliases");
+
+	if (!lookup("location")) {
+		switch ($retcode) {
+			case -1:
+			case -3:
+				t_newtran();
+				t_reply("404", "Not Found");
+				exit;
+			case -2:
+				sl_send_reply("405", "Method Not Allowed");
+				exit;
+		}
+	}
+
+	# when routing via usrloc, log the missed calls also
+	setflag(2);
+
+	route(1);
+}
+
+
+route[1] {
+#n#	if (check_route_param("nat=yes")) {
+#n#		setbflag(6);
+#n#	}
+#n#	if (isflagset(5) || isbflagset(6)) {
+#n#		route(5);
+#n#	}
+
+	/* example how to enable some additional event routes */
+	if (is_method("INVITE")) {
+		#t_on_branch("1");
+		t_on_reply("1");
+		t_on_failure("1");
+	}
+
+	if (!t_relay()) {
+		sl_reply_error();
+	}
+	exit;
+}
+
+
+# Presence route
+/* uncomment the whole following route for enabling presence server */
+route[2]
+{
+#p#	if (!t_newtran())
+#p#	{
+#p#		sl_reply_error();
+#p#		exit;
+#p#	};
+#p#
+#p#	if(is_method("PUBLISH"))
+#p#	{
+#p#		handle_publish();
+#p#		t_release();
+#p#	}
+#p#	else
+#p#	if( is_method("SUBSCRIBE"))
+#p#	{
+#p#		handle_subscribe();
+#p#		t_release();
+#p#	}
+#p#	exit;
+	
+	# if presence enabled, this part will not be executed
+	if (is_method("PUBLISH") || $rU==null)
+	{
+		sl_send_reply("404", "Not here");
+		exit;
+	}
+	return;
+}
+
+# Authentication route
+/* uncomment the whole following route for enabling authentication */
+route[3] {
+#a#	if (is_method("REGISTER"))
+#a#	{
+#a#		# authenticate the REGISTER requests (uncomment to enable auth)
+#a#		if (!www_authorize("", "subscriber"))
+#a#		{
+#a#			www_challenge("", "0");
+#a#			exit;
+#a#		}
+#a#
+#a#		if ($au!=$tU) 
+#a#		{
+#a#			sl_send_reply("403","Forbidden auth ID");
+#a#			exit;
+#a#		}
+#a#	} else {
+#a#		# authenticate if from local subscriber (uncomment to enable auth)
+#a#		if (from_uri==myself)
+#a#		{
+#a#			if (!proxy_authorize("", "subscriber")) {
+#a#				proxy_challenge("", "0");
+#a#				exit;
+#a#			}
+#a#			if (is_method("PUBLISH"))
+#a#			{
+#a#				if ($au!=$tU) {
+#a#					sl_send_reply("403","Forbidden auth ID");
+#a#					exit;
+#a#				}
+#a#			} else {
+#a#				if ($au!=$fU) {
+#a#					sl_send_reply("403","Forbidden auth ID");
+#a#					exit;
+#a#				}
+#a#			}
+#a#
+#a#			consume_credentials();
+#a#			# caller authenticated
+#a#		}
+#a#	}
+	return;
+}
+
+# Caller NAT detection route
+/* uncomment the whole following route for enabling Caller NAT Detection */
+route[4]{
+#n#	force_rport();
+#n#	if (nat_uac_test("19")) {
+#n#		if (method=="REGISTER") {
+#n#			fix_nated_register();
+#n#		} else {
+#n#			fix_nated_contact();
+#n#		}
+#n#		setflag(5);
+#n#	}
+	return;
+}
+
+# RTPProxy control
+/* uncomment the whole following route for enabling RTPProxy Control */
+route[5] {
+#n#	if (is_method("BYE")) {
+#n#		unforce_rtp_proxy();
+#n#	} else if (is_method("INVITE")){
+#n#		force_rtp_proxy();
+#n#	}
+#n#	if (!has_totag()) add_rr_param(";nat=yes");
+	return;
+}
+
+branch_route[1] {
+	xdbg("new branch at $ru\n");
+}
+
+
+onreply_route[1] {
+	xdbg("incoming reply\n");
+
+#n#	if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])") {
+#n#		force_rtp_proxy();
+#n#	}
+#n#	if (isbflagset(6)) {
+#n#		fix_nated_contact();
+#n#	}
+}
+
+
+failure_route[1] {
+#n#	if (is_method("INVITE")
+#n#			&& (isbflagset(6) || isflagset(5))) {
+#n#		unforce_rtp_proxy();
+#n#	}
+
+	if (t_was_cancelled()) {
+		exit;
+	}
+
+	# uncomment the following lines if you want to block client 
+	# redirect based on 3xx replies.
+	##if (t_check_status("3[0-9][0-9]")) {
+	##t_reply("404","Not found");
+	##	exit;
+	##}
+
+	# uncomment the following lines if you want to redirect the failed 
+	# calls to a different new destination
+	##if (t_check_status("486|408")) {
+	##	sethostport("192.168.2.100:5060");
+	##	append_branch();
+	##	# do not set the missed call flag again
+	##	t_relay();
+	##}
+}

+ 22 - 0
etc/tls/README

@@ -0,0 +1,22 @@
+
+
+This directory contains an already generated TLS certificate that can be
+used in your OpenSER configuration. It's a generic certificate with the 
+main purpose of serving as example and for testings.
+
+IMPORTANT: it's not a trustable certificate - the CA is also an example.
+
+All TLS configuration file may be found in "user" directory. If you want to
+generate your own certificate, you may find in the "rootCA" directory the 
+root CA to sign your request with. Use "kamctl tls userCERT" command to
+create a new certificate; the rootCA password is "openser".
+
+What is the purpose of these default CA and certificate? First to make an 
+out-of-the box TLS configuration for users not so familiar with SSL/TLS.
+Second, to give access to the same CA root to a large community in order to
+encourage testings and interconnections via TLS with minimum of troubles.
+
+For any questions, please address to :
+	[email protected] (if you want to keep your question private)
+	[email protected] (public mailing list)
+

+ 88 - 0
etc/tls/ca.conf

@@ -0,0 +1,88 @@
+#
+# Default configuration to use  when one
+# is not provided on the command line.
+#
+[ ca ]
+default_ca = local_ca
+
+
+#
+# Default location  of  directories  and
+# files needed to generate certificates.
+#
+[ local_ca ]
+dir              = ./rootCA
+certificate      = $dir/cacert.pem
+database         = $dir/index.txt
+new_certs_dir    = $dir/certs
+private_key      = $dir/private/cakey.pem
+serial           = $dir/serial
+
+
+#
+# Default   expiration   and  encryption
+# policies for certificates.
+#
+default_crl_days = 365
+default_days     = 1825
+default_md       = sha1
+
+policy = local_ca_policy
+x509_extensions = local_ca_extensions
+
+
+#
+# Default policy to use  when generating
+# server   certificates.  The  following
+# fields  must  be defined in the server
+# certificate.
+#
+[ local_ca_policy ]
+commonName             = supplied
+stateOrProvinceName    = supplied
+countryName            = supplied
+emailAddress           = supplied
+organizationName       = supplied
+organizationalUnitName = supplied
+
+
+#
+# x509 extensions to use when generating
+# server certificates.
+#
+[ local_ca_extensions ]
+#subjectAltName      = DNS:altname.somewhere.com
+basicConstraints    = CA:false
+nsCertType          = server
+
+
+#
+# The   default   policy   to  use  when
+# generating the root certificate.
+#
+[ req ]
+default_bits        = 2048
+default_keyfile     = ./private/cakey.pem
+default_md          = sha1
+
+prompt              = no
+distinguished_name  = root_ca_distinguished_name
+x509_extensions     = root_ca_extensions
+
+
+#
+# Root  Certificate  Authority   distin-
+# guished name.  Changes these fields to
+# your local environment.
+#
+[ root_ca_distinguished_name ]
+commonName          = Your_NAME          # please update
+stateOrProvinceName = Your_STATE         # please update
+countryName         = CO                 # please update
+emailAddress        = YOUR_EMAIL         # please update
+organizationName    = YOUR_ORG_NAME      # please update
+
+[ root_ca_extensions ]
+basicConstraints    = CA:true
+subjectAltName      = email:copy
+issuerAltName       = issuer:copy

+ 58 - 0
etc/tls/request.conf

@@ -0,0 +1,58 @@
+#
+# Default configuration to use  when one
+# is not provided on the command line.
+#
+[ ca ]
+default_ca     = CA_request
+
+
+#
+# Default location  of  directories  and
+# files needed to generate certificates.
+#
+[ CA_request ]
+dir            = ./rootCA
+database       = $dir/index.txt
+new_certs_dir  = $dir/certs
+
+certificate    = $dir/cacert.pem
+serial         = $dir/serial
+private_key    = $dir/private/cakey.pem
+
+
+#
+# Default   expiration   and  encryption
+# policies for certificates.
+#
+default_days     = 365
+default_crl_days = 1825
+default_md       = sha1
+
+policy           = req_policy
+
+
+#
+# Information to be moved from 
+# request to the certificate
+#
+nameopt          = ca_default
+certopt          = ca_default
+copy_extensions  = copy
+x509_extensions     = cert_extensions
+
+
+#
+# The   default   policy   to  use  when
+# generating the certificate.
+#
+[ req_policy ]
+countryName            = supplied
+stateOrProvinceName    = optional
+organizationName       = supplied
+organizationalUnitName = optional
+commonName             = supplied
+emailAddress           = supplied
+
+[ cert_extensions ]
+basicConstraints    = CA:false
+

+ 22 - 0
etc/tls/rootCA/cacert.pem

@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDlTCCAn2gAwIBAgIJAIajPSGooWsRMA0GCSqGSIb3DQEBBQUAMGQxEDAOBgNV
+BAMTB09wZW5TRVIxDDAKBgNVBAgTA1NJUDELMAkGA1UEBhMCSVAxHzAdBgkqhkiG
+9w0BCQEWEHRlYW1Ab3BlbnNlci5vcmcxFDASBgNVBAoTC29wZW5zZXIub3JnMB4X
+DTA1MTAyODE5MDk0NFoXDTA2MTAyODE5MDk0NFowZDEQMA4GA1UEAxMHT3BlblNF
+UjEMMAoGA1UECBMDU0lQMQswCQYDVQQGEwJJUDEfMB0GCSqGSIb3DQEJARYQdGVh
+bUBvcGVuc2VyLm9yZzEUMBIGA1UEChMLb3BlbnNlci5vcmcwggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQCtOHaQSReSuBpet7hGSJtAtqoKzPYpYdoIijiw
+9tlB/ODBFWjz583MKJuUxIWt7cqnUheBNgBGvrtZYVB6bUxjyTS4m3g8NrrIcWuw
+ASTYqYWRmdWbiyLraC6MeoNd8fUG50kbfZa6fh/pkBzZDQb/4Z1cfqIEJ4VpVTLO
+CRDreGNfTmG1BREtX+DnzGiKKpGCJVUs/ffX+pTViVC9Y9TDwinJyV9fdtwtI42U
+pAxJA+iiG1oOTuk5yjxKOkxKlHju4DIKND3XnPriU3cjdh/93XhMQDxb/jNZhL6R
+Y/XhcEsS567ZL3VMUw2VxaDiA+exjAaS/wA8b/rHR8af8+svAgMBAAGjSjBIMAwG
+A1UdEwQFMAMBAf8wGwYDVR0RBBQwEoEQdGVhbUBvcGVuc2VyLm9yZzAbBgNVHRIE
+FDASgRB0ZWFtQG9wZW5zZXIub3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAabH/C3EiJ
+1Dc3uq9KlF7hp2OODAI4928Yy6+pzcbppGoOhAzmDaEoXmlhIMomgeoD031rsESg
++WNavXs2IFCD0U4ocpCa7L0AKDYr8U+5lUtEi7DzXYkqNW17TB+HxkaQVdzvhGrh
++R3WasX0AIc+inxvgkXgzjm5M6IyRUE0FK3wDcACNfnjrDzzXVvdccrM0ZpCFr5T
+NWJjQYpGcqDB1HDXVBMPFxQ7XyqKOTOgDCMh4J9g9Ye8eL8uukKJx1eEjHoG4RbM
+uQmCYQcCWO0Z/oqiI0FObzsZigf8Xoi9GjK2RjdPEukG3QOflnAm7IjPOLMGzFBn
+peqgBkp+jZv5
+-----END CERTIFICATE-----

+ 56 - 0
etc/tls/rootCA/certs/01.pem

@@ -0,0 +1,56 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number: 1 (0x1)
+        Signature Algorithm: sha1WithRSAEncryption
+        Issuer: CN=OpenSER, ST=SIP, C=IP/[email protected], O=openser.org
+        Validity
+            Not Before: Oct 28 19:16:29 2005 GMT
+            Not After : Oct 28 19:16:29 2006 GMT
+        Subject: C=IP, ST=SIP, O=OpenSER project, OU=OpenSER TLS tester, CN=OpenSER/[email protected]
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+            RSA Public Key: (512 bit)
+                Modulus (512 bit):
+                    00:b6:13:f8:54:99:2a:c3:39:2d:fa:b0:5a:cc:4d:
+                    ca:8b:d0:53:9d:c9:59:ce:17:1e:ba:0a:8e:82:eb:
+                    9b:c2:69:33:93:3a:b1:68:aa:da:40:bd:de:b5:6f:
+                    c2:5e:99:72:59:f4:68:75:4c:01:05:94:1b:ba:1d:
+                    f2:bb:10:67:d7
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Basic Constraints: 
+                CA:FALSE
+    Signature Algorithm: sha1WithRSAEncryption
+        3d:41:b5:28:a4:10:c7:c8:de:29:6f:2e:ed:a8:30:28:2f:9e:
+        3c:a9:95:c4:df:73:7b:2e:1c:51:84:a2:bd:ff:56:94:6f:5b:
+        ac:e2:8f:77:31:74:82:29:8d:e7:a8:c7:da:14:7d:6c:62:dc:
+        2f:2e:70:0c:eb:53:67:fa:1b:0a:e5:e8:58:41:5e:dd:84:3d:
+        3d:22:c2:c3:b5:69:e5:11:86:2a:a6:4c:f3:07:98:00:f5:cf:
+        c8:f1:ea:a3:62:f6:40:ef:08:74:93:de:5b:f2:dc:01:dc:0f:
+        2a:81:e3:03:56:d1:ef:ca:22:fc:18:29:4f:b0:45:b1:d0:30:
+        6b:63:1b:72:ef:9d:ae:bf:ef:b3:0d:fa:39:49:25:48:46:6d:
+        68:a1:12:7a:23:1e:ba:53:8e:a5:a2:38:8e:3b:0f:df:b1:b6:
+        1e:61:69:80:57:c1:f1:8d:62:69:e0:85:e9:6b:e0:10:4d:37:
+        b0:3e:98:cc:b5:b5:ea:db:2f:a2:02:51:85:27:1d:65:74:2e:
+        e3:f4:1f:0c:52:3e:f8:86:6b:50:f1:38:1d:23:97:53:3c:84:
+        03:4e:25:a0:66:3a:16:aa:94:77:f2:c8:65:db:ce:c7:0d:c2:
+        44:7a:8e:af:ee:c5:bc:4e:aa:2f:29:c5:02:33:ea:c7:78:76:
+        02:d4:b4:ca
+-----BEGIN CERTIFICATE-----
+MIICqjCCAZKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMRAwDgYDVQQDEwdPcGVu
+U0VSMQwwCgYDVQQIEwNTSVAxCzAJBgNVBAYTAklQMR8wHQYJKoZIhvcNAQkBFhB0
+ZWFtQG9wZW5zZXIub3JnMRQwEgYDVQQKEwtvcGVuc2VyLm9yZzAeFw0wNTEwMjgx
+OTE2MjlaFw0wNjEwMjgxOTE2MjlaMIGFMQswCQYDVQQGEwJJUDEMMAoGA1UECBMD
+U0lQMRgwFgYDVQQKEw9PcGVuU0VSIHByb2plY3QxGzAZBgNVBAsTEk9wZW5TRVIg
+VExTIHRlc3RlcjEQMA4GA1UEAxMHT3BlblNFUjEfMB0GCSqGSIb3DQEJARYQdGVh
+bUBvcGVuc2VyLm9yZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC2E/hUmSrDOS36
+sFrMTcqL0FOdyVnOFx66Co6C65vCaTOTOrFoqtpAvd61b8JemXJZ9Gh1TAEFlBu6
+HfK7EGfXAgMBAAGjDTALMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQEFBQADggEBAD1B
+tSikEMfI3ilvLu2oMCgvnjyplcTfc3suHFGEor3/VpRvW6zij3cxdIIpjeeox9oU
+fWxi3C8ucAzrU2f6Gwrl6FhBXt2EPT0iwsO1aeURhiqmTPMHmAD1z8jx6qNi9kDv
+CHST3lvy3AHcDyqB4wNW0e/KIvwYKU+wRbHQMGtjG3Lvna6/77MN+jlJJUhGbWih
+EnojHrpTjqWiOI47D9+xth5haYBXwfGNYmnghelr4BBNN7A+mMy1terbL6ICUYUn
+HWV0LuP0HwxSPviGa1DxOB0jl1M8hANOJaBmOhaqlHfyyGXbzscNwkR6jq/uxbxO
+qi8pxQIz6sd4dgLUtMo=
+-----END CERTIFICATE-----

+ 1 - 0
etc/tls/rootCA/index.txt

@@ -0,0 +1 @@
+V	061028191629Z		01	unknown	/C=IP/ST=SIP/O=OpenSER project/OU=OpenSER TLS tester/CN=OpenSER/[email protected]

+ 30 - 0
etc/tls/rootCA/private/cakey.pem

@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,4FF5A11F3774B0A0
+
+55A4nhjLcx9PgAAnxRoYwkzCtM1D/2Rb3cLtUo6GTG8E+RzsKgo9PIZDDSDJAy9k
+39UXsC69C7jxmqP7oBQgU8M15yAKQwX9zIsi82tRb/oh58f331fK3vtCzvZrJCwQ
+5ZWUcmLCrtxVoDj2N9pItB3OizHcUYGmPVxhwWzLyA0Wnq5/EScVaIVEEUQUHZtU
+3iJCTUkgc8tFDsFAXEyfO9Y5MabQ3AKSYBgUklGJs0+4facYyCgfYWDwuoanxveQ
+2XIVtv2dcV0WOklGA/G+2tfwtRa0G0GBl4Jf49/bv2fONrhGX4KE4aJb7jp8LTZA
+nFokO8L/OPHQQDatZ4r9gqIJMzY8uMtzRdkccZvV+xecDieZ6PN4MW36s/AzMp3q
+oS72x413GSlDOLlrmDyy7NWo81yD5aYUCgoW6QOOtDCMwFGIJ+lEbt7vPasVp0GJ
+Qpsni2Kz7knpjZJHoAyARfm7rPX9Dsk60A16Up9/4LHyy2vsNfD8uXwRcYSTx3nF
+d5ClZYtwQp88cfe2qK2L5pegN+YoghXukE191OruZ3cU/ialPqGHefHTd46JyWsZ
+k1k0IxXwyAyLbWcFRJ0IKogYK/p/Jz2vAggGS/4utH6OWPkDObo6mclKO3nQk/AK
+YGtcAvbN+MOB9US6v/gqHSbh3FvjKtdeSdzkgOqJD0v9sYoshk9XlAcMKljPAqxt
+QuFlsNC221z9jpIPVWDoHiufVtuX2/qif0cYhy0T3ey1crgZ1Wf5Xt2VxRk8xCGs
+FN5bOmpQcFHhEAmeBS0/cRTM+P0RZ0qLoJUWgedxF9UHweNgpu/JgE8ReF7xIfbV
+OHi2ZEziydYuqAQaLi5rDditDJVz+8lnH9k8qWk9WKbFE+Oz/7i5/f10t+062aC2
+0pTg6dptI/X49p0TWuxrI/UTqQjreauTaNaR32pOZlKuCWngtcxLTg/XGfTahsLN
+EUKEdQk4T/2OzCICwStkwlayjs+O2osNEE2n79e9IxPG/L7KzWA4RF6dwuJ2Zh5J
+8xF/dAiL9C7EBIOQsPxLpjqQUUipedophsndkR5ADP4R3a97d2ZVsk6N0gGMfXHH
+6UghbSAcDQ3xj1eSBXYmb2cq36A0g6j3B9Clkh0yO07H7C6jlHeUbGw/5uaa69pX
+H9kyPDpPP/sJ26jIBDCC1hzWX2v3/wl7CZRBgf9OQ6lY3x1Mk6eQbxW+G0itI5T2
+MNWV0ae8Nr+vAi9OVmVUo3s0D2kUGtMRXC0ECwJUhXq68GDfLUy9y0ixeVrLnkix
+P1OHIu7VLawDvhWx+qQJRI6i0apAEWPTw+A9DiiwtrmILDTQJJWDHky+lja3zkt1
+heVVfeSuyPeS/EgzQgN2kkpr+3ZgNcLSRuKpFdpN2olSyxXt+fRcTj0kluZqJkBn
+7UpojLvzl6ODLZvIYFhHPrlZGVPer+YyuEQGt8Ni4NgFooJmOhzNlUOMQtEvo3kO
+lsll1jPUGO/5TIxoteHepTT/2nLhlbd2g6xsMNEMqqzmH/Q7OnLknI8IVE7AjkEv
+u138yr3yQfdZ+Q9/KDL9RICy/swCZct/dyIhZ6u6NGun2v6Kzzb3lw==
+-----END RSA PRIVATE KEY-----

+ 1 - 0
etc/tls/rootCA/serial

@@ -0,0 +1 @@
+02

+ 16 - 0
etc/tls/user.conf

@@ -0,0 +1,16 @@
+#
+# LocalServer.conf
+#
+
+[ req ]
+prompt = no
+distinguished_name = server_distinguished_name
+
+[ server_distinguished_name ]
+commonName             = somename.somewhere.com               # please update
+stateOrProvinceName    = Some State                           # please update
+countryName            = XY                                   # please update
+emailAddress           = [email protected]          # please update
+organizationName       = My Large Organization Name           # please update
+organizationalUnitName = My Subunit of Large Organization     # please update
+

+ 22 - 0
etc/tls/user/user-calist.pem

@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDlTCCAn2gAwIBAgIJAIajPSGooWsRMA0GCSqGSIb3DQEBBQUAMGQxEDAOBgNV
+BAMTB09wZW5TRVIxDDAKBgNVBAgTA1NJUDELMAkGA1UEBhMCSVAxHzAdBgkqhkiG
+9w0BCQEWEHRlYW1Ab3BlbnNlci5vcmcxFDASBgNVBAoTC29wZW5zZXIub3JnMB4X
+DTA1MTAyODE5MDk0NFoXDTA2MTAyODE5MDk0NFowZDEQMA4GA1UEAxMHT3BlblNF
+UjEMMAoGA1UECBMDU0lQMQswCQYDVQQGEwJJUDEfMB0GCSqGSIb3DQEJARYQdGVh
+bUBvcGVuc2VyLm9yZzEUMBIGA1UEChMLb3BlbnNlci5vcmcwggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQCtOHaQSReSuBpet7hGSJtAtqoKzPYpYdoIijiw
+9tlB/ODBFWjz583MKJuUxIWt7cqnUheBNgBGvrtZYVB6bUxjyTS4m3g8NrrIcWuw
+ASTYqYWRmdWbiyLraC6MeoNd8fUG50kbfZa6fh/pkBzZDQb/4Z1cfqIEJ4VpVTLO
+CRDreGNfTmG1BREtX+DnzGiKKpGCJVUs/ffX+pTViVC9Y9TDwinJyV9fdtwtI42U
+pAxJA+iiG1oOTuk5yjxKOkxKlHju4DIKND3XnPriU3cjdh/93XhMQDxb/jNZhL6R
+Y/XhcEsS567ZL3VMUw2VxaDiA+exjAaS/wA8b/rHR8af8+svAgMBAAGjSjBIMAwG
+A1UdEwQFMAMBAf8wGwYDVR0RBBQwEoEQdGVhbUBvcGVuc2VyLm9yZzAbBgNVHRIE
+FDASgRB0ZWFtQG9wZW5zZXIub3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAabH/C3EiJ
+1Dc3uq9KlF7hp2OODAI4928Yy6+pzcbppGoOhAzmDaEoXmlhIMomgeoD031rsESg
++WNavXs2IFCD0U4ocpCa7L0AKDYr8U+5lUtEi7DzXYkqNW17TB+HxkaQVdzvhGrh
++R3WasX0AIc+inxvgkXgzjm5M6IyRUE0FK3wDcACNfnjrDzzXVvdccrM0ZpCFr5T
+NWJjQYpGcqDB1HDXVBMPFxQ7XyqKOTOgDCMh4J9g9Ye8eL8uukKJx1eEjHoG4RbM
+uQmCYQcCWO0Z/oqiI0FObzsZigf8Xoi9GjK2RjdPEukG3QOflnAm7IjPOLMGzFBn
+peqgBkp+jZv5
+-----END CERTIFICATE-----

+ 56 - 0
etc/tls/user/user-cert.pem

@@ -0,0 +1,56 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number: 1 (0x1)
+        Signature Algorithm: sha1WithRSAEncryption
+        Issuer: CN=OpenSER, ST=SIP, C=IP/[email protected], O=openser.org
+        Validity
+            Not Before: Oct 28 19:16:29 2005 GMT
+            Not After : Oct 28 19:16:29 2006 GMT
+        Subject: C=IP, ST=SIP, O=OpenSER project, OU=OpenSER TLS tester, CN=OpenSER/[email protected]
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+            RSA Public Key: (512 bit)
+                Modulus (512 bit):
+                    00:b6:13:f8:54:99:2a:c3:39:2d:fa:b0:5a:cc:4d:
+                    ca:8b:d0:53:9d:c9:59:ce:17:1e:ba:0a:8e:82:eb:
+                    9b:c2:69:33:93:3a:b1:68:aa:da:40:bd:de:b5:6f:
+                    c2:5e:99:72:59:f4:68:75:4c:01:05:94:1b:ba:1d:
+                    f2:bb:10:67:d7
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Basic Constraints: 
+                CA:FALSE
+    Signature Algorithm: sha1WithRSAEncryption
+        3d:41:b5:28:a4:10:c7:c8:de:29:6f:2e:ed:a8:30:28:2f:9e:
+        3c:a9:95:c4:df:73:7b:2e:1c:51:84:a2:bd:ff:56:94:6f:5b:
+        ac:e2:8f:77:31:74:82:29:8d:e7:a8:c7:da:14:7d:6c:62:dc:
+        2f:2e:70:0c:eb:53:67:fa:1b:0a:e5:e8:58:41:5e:dd:84:3d:
+        3d:22:c2:c3:b5:69:e5:11:86:2a:a6:4c:f3:07:98:00:f5:cf:
+        c8:f1:ea:a3:62:f6:40:ef:08:74:93:de:5b:f2:dc:01:dc:0f:
+        2a:81:e3:03:56:d1:ef:ca:22:fc:18:29:4f:b0:45:b1:d0:30:
+        6b:63:1b:72:ef:9d:ae:bf:ef:b3:0d:fa:39:49:25:48:46:6d:
+        68:a1:12:7a:23:1e:ba:53:8e:a5:a2:38:8e:3b:0f:df:b1:b6:
+        1e:61:69:80:57:c1:f1:8d:62:69:e0:85:e9:6b:e0:10:4d:37:
+        b0:3e:98:cc:b5:b5:ea:db:2f:a2:02:51:85:27:1d:65:74:2e:
+        e3:f4:1f:0c:52:3e:f8:86:6b:50:f1:38:1d:23:97:53:3c:84:
+        03:4e:25:a0:66:3a:16:aa:94:77:f2:c8:65:db:ce:c7:0d:c2:
+        44:7a:8e:af:ee:c5:bc:4e:aa:2f:29:c5:02:33:ea:c7:78:76:
+        02:d4:b4:ca
+-----BEGIN CERTIFICATE-----
+MIICqjCCAZKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMRAwDgYDVQQDEwdPcGVu
+U0VSMQwwCgYDVQQIEwNTSVAxCzAJBgNVBAYTAklQMR8wHQYJKoZIhvcNAQkBFhB0
+ZWFtQG9wZW5zZXIub3JnMRQwEgYDVQQKEwtvcGVuc2VyLm9yZzAeFw0wNTEwMjgx
+OTE2MjlaFw0wNjEwMjgxOTE2MjlaMIGFMQswCQYDVQQGEwJJUDEMMAoGA1UECBMD
+U0lQMRgwFgYDVQQKEw9PcGVuU0VSIHByb2plY3QxGzAZBgNVBAsTEk9wZW5TRVIg
+VExTIHRlc3RlcjEQMA4GA1UEAxMHT3BlblNFUjEfMB0GCSqGSIb3DQEJARYQdGVh
+bUBvcGVuc2VyLm9yZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC2E/hUmSrDOS36
+sFrMTcqL0FOdyVnOFx66Co6C65vCaTOTOrFoqtpAvd61b8JemXJZ9Gh1TAEFlBu6
+HfK7EGfXAgMBAAGjDTALMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQEFBQADggEBAD1B
+tSikEMfI3ilvLu2oMCgvnjyplcTfc3suHFGEor3/VpRvW6zij3cxdIIpjeeox9oU
+fWxi3C8ucAzrU2f6Gwrl6FhBXt2EPT0iwsO1aeURhiqmTPMHmAD1z8jx6qNi9kDv
+CHST3lvy3AHcDyqB4wNW0e/KIvwYKU+wRbHQMGtjG3Lvna6/77MN+jlJJUhGbWih
+EnojHrpTjqWiOI47D9+xth5haYBXwfGNYmnghelr4BBNN7A+mMy1terbL6ICUYUn
+HWV0LuP0HwxSPviGa1DxOB0jl1M8hANOJaBmOhaqlHfyyGXbzscNwkR6jq/uxbxO
+qi8pxQIz6sd4dgLUtMo=
+-----END CERTIFICATE-----

+ 9 - 0
etc/tls/user/user-cert_req.pem

@@ -0,0 +1,9 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIIBQDCB6wIBADCBhTEQMA4GA1UEAxMHT3BlblNFUjEMMAoGA1UECBMDU0lQMQsw
+CQYDVQQGEwJJUDEfMB0GCSqGSIb3DQEJARYQdGVhbUBvcGVuc2VyLm9yZzEYMBYG
+A1UEChMPT3BlblNFUiBwcm9qZWN0MRswGQYDVQQLExJPcGVuU0VSIFRMUyB0ZXN0
+ZXIwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAthP4VJkqwzkt+rBazE3Ki9BTnclZ
+zhceugqOguubwmkzkzqxaKraQL3etW/CXplyWfRodUwBBZQbuh3yuxBn1wIDAQAB
+oAAwDQYJKoZIhvcNAQEFBQADQQA0mFBhg/bbxznLbLcc2nQo0022x0HeT3Qxl0lm
+SlIvfG2YphvBYuc54HFjqHfRNrmckAVoSrVpEpcVXSO/g+L6
+-----END CERTIFICATE REQUEST-----

+ 9 - 0
etc/tls/user/user-privkey.pem

@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOwIBAAJBALYT+FSZKsM5LfqwWsxNyovQU53JWc4XHroKjoLrm8JpM5M6sWiq
+2kC93rVvwl6Zcln0aHVMAQWUG7od8rsQZ9cCAwEAAQJBALCEy8u4cmyxkpHnRx+q
+iyLg5S+jdR0H7RIQCfmC0Y63LFIAsXasHQorV83r2br4eRRaeU87CsVLXdBUjvbe
+ywECIQDaq7ojtDBTGhNKILZ9CBOTk18jDdHgTJAC7ZpGvdGt+QIhANUpE9j5JWqA
+kIcR55eSJXmjoKB1IGnTz0kaMB/8B3hPAiEAw0351IXNW4vAisao9wdNpNNNd5uS
+RklbnqHk1yYWrtECIEXqi1AHqHYeZUloXgYhMZmMSgtXX6JWjw7zQAW9rNWRAiBe
+Xmwo0k9fY/KawVSsnY4rgYqk6PDWK98jl5/x/veDZA==
+-----END RSA PRIVATE KEY-----

+ 242 - 0
examples/kamailio/acc-mysql.cfg

@@ -0,0 +1,242 @@
+# $Id$
+#
+# Sample config for MySQL accouting with Kamailio 1.2.0
+#
+# - mysql module must be compiled and installed
+#
+# - new columns have to be added since by default only few are recorded
+# - here are full SQL statements to create acc and missed_calls tables
+#
+# CREATE TABLE `acc` (
+#   `id` int(10) unsigned NOT NULL auto_increment,
+#   `method` varchar(16) NOT NULL default '',
+#   `from_tag` varchar(64) NOT NULL default '',
+#   `to_tag` varchar(64) NOT NULL default '',
+#   `callid` varchar(128) NOT NULL default '',
+#   `sip_code` char(3) NOT NULL default '',
+#   `sip_reason` varchar(32) NOT NULL default '',
+#   `time` datetime NOT NULL default '0000-00-00 00:00:00',
+#   `src_ip` varchar(64) NOT NULL default '',
+#   `dst_user` varchar(64) NOT NULL default '',
+#   `dst_domain` varchar(128) NOT NULL default '',
+#   `src_user` varchar(64) NOT NULL default '',
+#   `src_domain` varchar(128) NOT NULL default '',
+#   INDEX acc_callid (`callid`),
+#   PRIMARY KEY  (`id`)
+# );
+#
+# CREATE TABLE `missed_calls` (
+#   `id` int(10) unsigned NOT NULL auto_increment,
+#   `method` varchar(16) NOT NULL default '',
+#   `from_tag` varchar(64) NOT NULL default '',
+#   `to_tag` varchar(64) NOT NULL default '',
+#   `callid` varchar(128) NOT NULL default '',
+#   `sip_code` char(3) NOT NULL default '',
+#   `sip_reason` varchar(32) NOT NULL default '',
+#   `time` datetime NOT NULL default '0000-00-00 00:00:00',
+#   `src_ip` varchar(64) NOT NULL default '',
+#   `dst_user` varchar(64) NOT NULL default '',
+#   `dst_domain` varchar(128) NOT NULL default '',
+#   `src_user` varchar(64) NOT NULL default '',
+#   `src_domain` varchar(128) NOT NULL default '',
+#   INDEX acc_callid (`callid`),
+#   PRIMARY KEY  (`id`)
+# );
+#
+#
+
+# ----------- global configuration parameters ------------------------
+
+debug=3            # debug level (cmd line: -dddddddddd)
+fork=yes
+log_stderror=no    # (cmd line: -E)
+
+/* Uncomment these lines to enter debugging mode 
+fork=no
+log_stderror=yes
+*/
+
+check_via=no	# (cmd. line: -v)
+dns=no          # (cmd. line: -r)
+rev_dns=no      # (cmd. line: -R)
+port=5060
+children=4
+
+#
+# uncomment the following lines for TLS support
+#disable_tls = 0
+#listen = tls:your_IP:5061
+#tls_verify_server = 1
+#tls_verify_client = 1
+#tls_require_client_certificate = 0
+#tls_method = TLSv1
+#tls_certificate = "/usr/local/etc/kamailio/tls/user/user-cert.pem"
+#tls_private_key = "/usr/local/etc/kamailio/tls/user/user-privkey.pem"
+#tls_ca_list = "/usr/local/etc/kamailio/tls/user/user-calist.pem"
+
+# ------------------ module loading ----------------------------------
+
+# set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+# Uncomment this if you want to use SQL database
+# - MySQL loaded for accounting as well
+loadmodule "db_mysql.so"
+
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "rr.so"
+loadmodule "maxfwd.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "textops.so"
+loadmodule "acc.so"
+loadmodule "mi_fifo.so"
+
+# Uncomment this if you want digest authentication
+# db_mysql.so must be loaded !
+#loadmodule "auth.so"
+#loadmodule "auth_db.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+# -- mi_fifo params --
+
+modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+
+# -- usrloc params --
+
+#modparam("usrloc", "db_mode",   0)
+
+# Uncomment this if you want to use SQL database 
+# for persistent storage and comment the previous line
+modparam("usrloc", "db_mode", 2)
+
+# -- auth params --
+# Uncomment if you are using auth module
+#
+#modparam("auth_db", "calculate_ha1", yes)
+#
+# If you set "calculate_ha1" parameter to yes (which true in this config), 
+# uncomment also the following parameter)
+#
+#modparam("auth_db", "password_column", "password")
+
+# -- rr params --
+# add value to ;lr param to make some broken UAs happy
+modparam("rr", "enable_full_lr", 1)
+
+# -- acc params --
+modparam("acc", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
+# flag to record to db
+modparam("acc", "db_flag", 1)
+modparam("acc", "db_missed_flag", 2)
+# flag to log to syslog
+modparam("acc", "log_flag", 1)
+modparam("acc", "log_missed_flag", 2)
+# use extra accounting to record caller and callee username/domain
+# - take them from From URI and R-URI
+modparam("acc", "log_extra", "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd")
+modparam("acc", "db_extra", "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd")
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+
+	# initial sanity checks -- messages with
+	# max_forwards==0, or excessively long requests
+	if (!mf_process_maxfwd_header("10")) {
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	};
+
+	if (msg:len >=  2048 ) {
+		sl_send_reply("513", "Message too big");
+		exit;
+	};
+
+	# we record-route all messages -- to make sure that
+	# subsequent messages will go through our proxy; that's
+	# particularly good if upstream and downstream entities
+	# use different transport protocol
+	if (!is_method("REGISTER"))
+		record_route();
+
+	# subsequent messages withing a dialog should take the
+	# path determined by record-routing
+	if (loose_route()) {
+		# mark routing logic in request
+		append_hf("P-hint: rr-enforced\r\n");
+		if(is_method("BYE")) {
+			# account BYE for STOP record
+			setflag(1);
+		}
+		route(1);
+	};
+
+	# account all calls
+	if(is_method("INVITE")) {
+		# set accounting on for INVITE (success or missed call)
+		setflag(1);
+		setflag(2);
+	}
+
+	if (!uri==myself) {
+		# mark routing logic in request
+		append_hf("P-hint: outbound\r\n"); 
+		# if you have some interdomain connections via TLS
+		#if(uri=~"@tls_domain1.net") {
+		#	t_relay("tls:domain1.net");
+		#	exit;
+		#} else if(uri=~"@tls_domain2.net") {
+		#	t_relay("tls:domain2.net");
+		#	exit;
+		#}
+		route(1);
+	};
+
+	# if the request is for other domain use UsrLoc
+	# (in case, it does not work, use the following command
+	# with proper names and addresses in it)
+	if (uri==myself) {
+
+		if (is_method("REGISTER")) {
+
+			# Uncomment this if you want to use digest authentication
+			#if (!www_authorize("kamailio.org", "subscriber")) {
+			#	www_challenge("kamailio.org", "0");
+			#	exit;
+			#};
+
+			save("location");
+			exit;
+		};
+
+		if (!uri==myself) {
+			append_hf("P-hint: outbound alias\r\n"); 
+			route(1);
+		};
+
+		# native SIP destinations are handled using our USRLOC DB
+		if (!lookup("location")) {
+			sl_send_reply("404", "Not Found");
+			exit;
+		};
+		append_hf("P-hint: usrloc applied\r\n"); 
+	};
+
+	route(1);
+}
+
+
+route[1] {
+	# send it out now; use stateful forwarding as it works reliably
+	# even for UDP2TCP
+	if (!t_relay()) {
+		sl_reply_error();
+	};
+	exit;
+}
+

+ 71 - 0
examples/kamailio/acc.cfg

@@ -0,0 +1,71 @@
+#
+# $Id$
+#
+# example: accounting calls to nummerical destinations
+#
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+loadmodule "tm.so"
+loadmodule "acc.so"
+loadmodule "sl.so"
+loadmodule "maxfwd.so"
+loadmodule "rr.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+# -- acc params --
+# set the reporting log level
+modparam("acc", "log_level", 1)
+# number of flag, which will be used for accounting; if a message is
+# labeled with this flag, its completion status will be reported
+modparam("acc", "log_flag", 1 )
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+
+	/* ********* ROUTINE CHECKS  ********************************** */
+
+	# filter too old messages
+	if (!mf_process_maxfwd_header("10")) {
+		log("LOG: Too many hops\n");
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	};
+	if (msg:len >=  2048 ) {
+		sl_send_reply("513", "Message too big");
+		exit;
+	};
+
+    #  Process record-routing
+    if (loose_route()) { 
+		# label BYEs for accounting
+		if (method=="BYE") 
+			setflag(1);
+		t_relay();
+		exit;
+	};
+
+
+	# labeled all transaction for accounting
+	setflag(1);
+
+	# record-route INVITES to make sure BYEs will visit our server too
+	if (method=="INVITE") record_route();
+
+	# forward the request statefuly now; (we need *stateful* forwarding,
+	# because the stateful mode correlates requests with replies and
+	# drops retranmissions; otherwise, we would have to report on
+	# every single message received)
+	if (!t_relay()) {
+		sl_reply_error(); 
+		exit; 
+	};
+
+}

+ 224 - 0
examples/kamailio/ctd.sh

@@ -0,0 +1,224 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Usage: ctd.sh $FROM $TARGET
+# 
+# click-to-dial example using REFER
+#----------------------------------
+#
+# About:
+# ------
+# this script initiates a call from SIP user $FROM to SIP
+# user $TARGET; it works as follows: a dummy user invites
+# $FROM to a dummy "call on hold"; as soon as it is set up, the
+# dummy user transfers $FROM to $TARGET  (REFER transaction)
+# and terminates the dummy session established previously
+# (BYE transaction). Note: the "dummy call" is used to
+# make $FROM accept $REFER -- most of SIP phones do not
+# accept REFER if no call has not been established yet.
+#
+# Requirements: 
+# -------------
+# - SER with FIFO server turned on and TM module loaded
+#
+# Limitations: 
+# ------------
+# it only works with UAs supporting REFER; it has been tested 
+# with Cisco 7960, Mitel 5055, Grandstream and Pingtel; Windows 
+# Messenger does not support REFER. Never tested on solaris. 
+# Some cisco 7960 images don't work (in particular, POS30202
+# doesnt, POS3-03-8-21 does)
+#
+# History:
+# --------
+# 2003-03-01 bug_fix: route set reversed
+# 2003-02-27 dialog support completed (jiri)
+# 2003-04-28 dialog info precomputed in SER (jiri)
+# 2007-04-06 updated for Kamailio 1.2.0+ (daniel)
+
+#--------------------------------
+# config: who with whom
+# address of the final destination to which we want to transfer
+# initial CSeq and CallId
+if [ -z "$2" ]; then
+	TARGET="sip:[email protected]"
+	echo "destination unspecified -- taking default value $TARGET"
+else
+	TARGET="$2"
+fi
+# address of user wishing to initiate conversation
+if [ -z "$1" ] ; then
+	URI="sip:[email protected]"
+	echo "caller unspecified -- taking default value $URI"
+else
+	URI="$1"
+fi
+
+#---------------------------------
+# fixed config data
+FIFO="/tmp/kamailio_fifo"
+# address of controller
+FROM="<sip:[email protected]>"
+CSEQ="1"
+CALLIDNR=`date '+%s'`$$
+CALLID="${CALLIDNR}.fifouacctd"
+name="ctd_fifo_$$"
+fifo_reply="/tmp/$name"
+dlg="/tmp/$CALLID.dlg"
+FIXED_DLG="From: $FROM;tag=$CALLIDNR\r\nCall-ID: $CALLID\r\nContact: <sip:caller@!!>\r\n"
+#----------------------------------
+
+# generate parts of FIFO-request essential to forming
+# subsequent in-dialog reuqests
+# 
+# limitations: parsing broken if <> in display names or
+# line-folding used
+filter_fl()
+{
+
+awk -F ' ' '
+BEGIN { IGNORECASE=1; line=0; eoh=0;ret=1 }
+END { exit ret; }
+
+{line++; }
+
+# line 2: status code
+line==2 && /^2[0-9][0-9] / { ret=0;next; }
+line==2 && /^[3-6][0-9][0-9] / { print; print $0 > "/dev/stderr"; next; }
+line==2 { print "reply error"; print; next; } 
+
+# skip body
+/^$/ { eoh=1 }
+eoh==1 { next }
+
+# uri and outbound uri at line 2,3: copy and paste
+line==3 { print $0; next; }
+line==4 { print $0; print "."; printf("\""); next; }
+# line 5: Route; empty if ".", copy and paste otherwise
+line==5 && /^\.$/ { next; }
+# if non-empty, copy and paste it
+line==5 { printf("%s\n", $0); next; }
+# filter out to header field for use in next requests
+/^(To|t):/ { printf("%s\n", $0); next; }
+# anything else will be ignored
+{next} 
+	' # end of awk script
+} # end of filter_fl
+
+#---------------------------
+# main
+
+# set up exit cleaner
+trap "rm -f $dlg $fifo_reply; exit 1" 0
+
+# set up FIFO communication
+
+if [ ! -w $FIFO ] ; then # can I write to FIFO server?
+	echo "Error opening ser's FIFO $FIFO"
+	exit 1
+fi
+mkfifo $fifo_reply # create a reply FIFO
+if [ $? -ne 0 ] ; then
+	echo "error opening reply fifo $fifo_reply"
+	exit 1
+fi
+chmod a+w $fifo_reply
+# start reader now so that it is ready for replies
+# immediately after a request is out
+
+cat < $fifo_reply | filter_fl > $dlg  &
+fifo_job="$!"
+
+# initiate dummy INVITE with pre-3261 "on-hold"
+# (note the dots -- they mean in order of appearance:
+# outbound uri, end of headers, end of body; eventualy
+# the FIFO request must be terminated with an empty line)
+#cat <<EOF
+cat > $FIFO <<EOF
+:t_uac_dlg:$name
+INVITE 
+$URI
+.
+.
+"`printf "${FIXED_DLG}To: <$URI>\r\nCSeq: $CSEQ INVITE\r\nContent-Type: application/sdp\r\n"`
+"
+"`printf "v=0\r\no=click-to-dial 0 0 IN IP4 0.0.0.0\r\ns=session\r\nc=IN IP4 0.0.0.0\r\nb=CT:1000\r\nt=0 0\r\nm=audio 9 RTP/AVP 8 0\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:0 PCMU/8000\r\n"`
+"
+
+EOF
+#exit
+
+# wait for reply 
+wait $fifo_job # returns completion status of filter_fl
+if [ "$?" -ne "0" ] ; then
+	echo "invitation failed"
+	exit 1
+fi
+
+echo "invitation succeeded"
+
+# proceed to REFER now
+if [ \! -r $dlg ] ; then
+	echo "dialog broken"
+	exit 1
+fi
+CSEQ=`expr $CSEQ + 1`
+
+# start reader now so that it is ready for replies
+# immediately after a request is out
+
+cat < $fifo_reply | filter_fl > /dev/null  &
+fifo_job="$!"
+
+# dump the REFER request to FIFO server 
+cat > $FIFO <<EOF
+:t_uac_dlg:$name
+REFER
+`cat $dlg; printf "${FIXED_DLG}CSeq: $CSEQ REFER\r\nReferred-By: $FROM\r\nRefer-To: $TARGET\r\n"`
+"
+
+EOF
+
+# report REFER status
+wait $fifo_job
+ref_ret="$?"
+
+if [ "$ref_ret" -ne "0" ] ; then
+	echo "refer failed"
+else
+	echo "refer succeeded"
+fi
+
+
+# well, URI is trying to call TARGET but still maintains the
+# dummy call we established with previous INVITE transaction:
+# tear it down
+
+
+# dump the BYE request to FIFO server 
+CSEQ=`expr $CSEQ + 1`
+cat < $fifo_reply | filter_fl > /dev/null  &
+fifo_job="$!"
+cat > $FIFO <<EOF
+:t_uac_dlg:$name
+BYE
+`cat $dlg; printf "${FIXED_DLG}CSeq: $CSEQ BYE\r\n"`
+"
+
+EOF
+
+# report BYE status
+wait $fifo_job
+ret="$?"
+
+if [ "$ret" -ne "0" ] ; then
+	echo "bye failed"
+	exit 1
+fi
+echo "bye succeeded"
+
+# clean-up
+trap 0
+rm -f $dlg $fifo_reply
+exit $ref_ret

+ 30 - 0
examples/kamailio/exec_s3.cfg

@@ -0,0 +1,30 @@
+#
+# $Id$
+#
+# email notification to email address from mysql database
+#
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+loadmodule "exec.so"
+loadmodule "sl.so"
+
+# send email if a request arrives
+route[0] {
+     if (!exec_msg('
+	QUERY="select email_address from subscriber 
+		where user=\"$$SIP_OUSER\"";
+	EMAIL=`mysql  -Bsuser -pheslo -e "$$QUERY" kamailio`;
+	if [ -z "$$EMAIL" ] ; then exit 1; fi ;
+	echo "SIP request received from $$SIP_HF_FROM for $$SIP_OUSER" |
+	mail -s "request for you" $$EMAIL ')) {
+		# exec returned error ... user does not exist
+		sl_send_reply("404", "User does not exist");
+	} else {
+		sl_send_reply("600", "No messages for this user");
+	};
+		
+}

+ 41 - 0
examples/kamailio/exec_s4.cfg

@@ -0,0 +1,41 @@
+#
+# $Id$
+#
+# email notification to email address from mysql database
+#
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+
+loadmodule "exec.so"
+loadmodule "sl.so"
+loadmodule "tm.so"
+
+# send email if a request arrives; process statefully
+# to avoid multiple execution on request retransmissions
+route[0] {
+	# stop script processing if transaction exists
+	if ( !t_newtran()) {
+		sl_reply_error();
+		return;
+	};
+
+  	if (!exec_msg('
+		QUERY="select email_address from subscriber 
+			where user=\"$$SIP_OUSER\"";
+		EMAIL=`mysql  -Bsuser -pheslo -e "$$QUERY" ser`;
+		if [ -z "$EMAIL" ] ; then exit 1; fi ;
+		echo "SIP request received from $$SIP_HF_FROM for $$SIP_OUSER" |
+		mail -s "request for you" $$EMAIL ')) 
+	{
+		# exec returned error ... user does not exist
+		# send a stateful reply
+		t_reply("404", "User does not exist");
+	} else {
+		t_reply("600", "No messages for this user");
+	};
+		
+}

+ 68 - 0
examples/kamailio/exec_s5.cfg

@@ -0,0 +1,68 @@
+#
+# $Id$
+#
+# simple quick-start config script
+#
+
+# ----------- global configuration parameters ------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "exec.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+route{
+	# uri for my domain ?
+	if (uri==myself) {
+
+		if (method=="REGISTER") {
+			save("location");
+			return;
+		};
+
+		# native SIP destinations are handled using our USRLOC DB
+		if (!lookup("location")) {
+			# proceed to email notification
+			if (method=="INVITE") route(1)
+			else sl_send_reply("404", "Not Found");
+			exit;
+		};
+	};
+	# user found, forward to his current uri now
+	if (!t_relay()) {
+		sl_reply_error();
+	};
+}
+
+/* handling of missed calls */
+route[1] {
+	# don't continue if it is a retransmission
+	if ( !t_newtran()) {
+		sl_reply_error();
+		exit;
+	};
+	# external script: lookup user, if user exists, send 
+	# an email notification to him
+    if (!exec_msg('
+		QUERY="select email_address from subscriber 
+			where user=\"$$SIP_OUSER\"";
+		EMAIL=`mysql  -Bsuser -pheslo -e "$$QUERY" ser`;
+		if [ -z "$$EMAIL" ] ; then exit 1; fi ;
+		echo "SIP request received from $$SIP_HF_FROM for $$SIP_OUSER" |
+		mail -s "request for you" $$EMAIL ')) 
+	{
+		# exec returned error ... user does not exist
+		# send a stateful reply
+		t_reply("404", "User does not exist");
+	} else {
+		t_reply("600", "No messages for this user");
+	};
+	exit;
+}

+ 103 - 0
examples/kamailio/flag_reply.cfg

@@ -0,0 +1,103 @@
+#
+# $Id$
+#
+# simple quick-start config script
+#
+
+# ----------- global configuration parameters ------------------------
+
+debug=3         # debug level (cmd line: -dddddddddd)
+fork=yes
+log_stderror=no	# (cmd line: -E)
+
+fork=no
+log_stderror=yes
+
+check_via=no	# (cmd. line: -v)
+dns=no           # (cmd. line: -r)
+rev_dns=no      # (cmd. line: -R)
+children=4
+
+port=5060
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+
+# Uncomment this if you want to use SQL database
+#loadmodule "db_mysql.so"
+
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "rr.so"
+loadmodule "maxfwd.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "textops.so"
+loadmodule "mi_fifo.so"
+
+# Uncomment this if you want digest authentication
+# mysql.so must be loaded !
+#loadmodule "auth.so"
+#loadmodule "auth_db.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+# -- mi_fifo params --
+
+modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+
+# -- usrloc params --
+
+modparam("usrloc", "db_mode",   0)
+
+# Uncomment this if you want to use SQL database 
+# for persistent storage and comment the previous line
+#modparam("usrloc", "db_mode", 2)
+
+# -- auth params --
+# Uncomment if you are using auth module
+#
+#modparam("auth_db", "calculate_ha1", yes)
+#
+# If you set "calculate_ha1" parameter to yes (which true in this config), 
+# uncomment also the following parameter)
+#
+#modparam("auth_db", "password_column", "password")
+
+# -- rr params --
+# add value to ;lr param to make some broken UAs happy
+modparam("rr", "enable_full_lr", 1)
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+	setflag(1);
+	t_on_failure("1");
+	t_on_reply("1");
+	log(1, "message received\n");
+	t_relay("udp:kamailio.org:5060");
+}
+
+onreply_route[1]
+{
+	if (isflagset(1)) {
+		log(1, "onreply: flag set\n");
+	} else {
+		log(1, "onreply: flag unset\n");
+	};
+}
+
+failure_route[1] 
+{
+	if (isflagset(1)) {
+		log(1, "failure: flag set\n");
+	} else {
+		log(1, "failure: flag unset\n");
+	};
+}
+

+ 67 - 0
examples/kamailio/fork.cfg

@@ -0,0 +1,67 @@
+#
+# $Id$
+#
+# example script showing both types of forking;
+# incoming message is forked in parallel to
+# 'nobody' and 'parallel', if no positive reply
+# appears with final_response timer, nonsense
+# is retried (serial forking); than, destination
+# 'foo' is given last chance
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+
+loadmodule "sl.so"
+loadmodule "tm.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+# -- tm params --
+# set time for which ser will be waiting for a final response;
+# fr_inv_timer sets value for INVITE transactions, fr_timer
+# for all others
+modparam("tm", "fr_inv_timer", 15 )
+modparam("tm", "fr_timer", 10 )
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+	# for testing purposes, simply okay all REGISTERs
+	if (method=="REGISTER") {
+		log("REGISTER");
+		sl_send_reply("200", "ok");
+		exit;
+	};
+	# try these two destinations first in parallel; the second
+	# destination is targeted to sink port -- that will make ser
+	# wait until timer hits
+	seturi("sip:[email protected]");
+	append_branch("sip:[email protected]:9");
+	# if we do not get a positive reply, continue at reply_route[1]
+	t_on_failure("1");
+	# forward the request to all destinations in destination set now 
+	t_relay();
+}
+
+failure_route[1] {
+	# forwarding failed -- try again at another destination 
+	append_branch("sip:[email protected]");
+	log(1,"first redirection\n");
+	# if this alternative destination fails too, proceed to reply_route[2] 
+	t_on_failure("2");
+	t_relay();
+}
+
+failure_route[2] {
+	# try out the last resort destination
+	append_branch("sip:[email protected]");
+	log(1, "second redirection\n");
+	# we no more call t_on_negative here; if this destination
+	# fails too, transaction will complete
+	t_relay();
+}

+ 31 - 0
examples/kamailio/logging.cfg

@@ -0,0 +1,31 @@
+#
+# $Id$
+#
+# logging example
+#
+
+# ------------------ module loading ----------------------------------
+
+fork=no
+port=5060
+log_stderror=yes
+debug=3
+
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+	# for testing purposes, simply okay all REGISTERs
+	if (method=="REGISTER") {
+		log(1, "REGISTER received\n");
+	} else {
+		log(1, "non-REGISTER received\n");
+	};
+	if (uri=~"sip:.*[@:]siphub.net") {
+		log(1, "request for siphub.net received\n");
+	} else {
+		log(1, "request for other domain received\n");
+	};
+}

+ 146 - 0
examples/kamailio/msilo.cfg

@@ -0,0 +1,146 @@
+#
+# MSILO usage example
+#
+# $ID: daniel $
+#
+
+
+
+children=2
+check_via=no      # (cmd. line: -v)
+dns=off           # (cmd. line: -r)
+rev_dns=off       # (cmd. line: -R)
+
+
+# ------------------ module loading ----------------------------------
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+loadmodule "textops.so"
+
+loadmodule "sl.so"
+loadmodule "db_mysql.so"
+loadmodule "maxfwd.so"
+loadmodule "tm.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "msilo.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+# -- registrar params --
+
+modparam("registrar", "default_expires", 120)
+
+# -- registrar params --
+
+modparam("usrloc", "db_mode", 0)
+
+# -- msilo params --
+
+modparam("msilo", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
+
+# -- tm params --
+
+modparam("tm", "fr_timer", 10 )
+modparam("tm", "fr_inv_timer", 15 )
+modparam("tm", "wt_timer", 10 )
+
+
+route{
+	if ( !mf_process_maxfwd_header("10") )
+	{
+		sl_send_reply("483","To Many Hops");
+		exit;
+	};
+
+
+	if (uri==myself) {
+		# for testing purposes, simply okay all REGISTERs
+		# is_method("XYZ") is faster than (method=="XYZ")
+		#  but requires textops module
+		if (is_method("REGISTER"))
+		{
+			save("location");
+			log("REGISTER received -> dumping messages with MSILO\n");
+
+			# MSILO - dumping user's offline messages
+			if (m_dump())
+			{
+				log("MSILO: offline messages dumped - if they were\n");
+			}else{
+				log("MSILO: no offline messages dumped\n");
+			};
+			exit;
+		};
+
+		# backup r-uri for m_dump() in case of delivery failure
+		$avp(i:11) = $ru;
+
+		# domestic SIP destinations are handled using our USRLOC DB
+		
+		if(!lookup("location")) 
+		{
+			if (! t_newtran())
+			{
+				sl_reply_error();
+				exit;
+			};
+			# we do not care about anything else but MESSAGEs
+			if (!is_method("MESSAGE"))
+			{
+				if (!t_reply("404", "Not found")) 
+				{
+					sl_reply_error();
+				};
+				exit;
+			};
+			log("MESSAGE received -> storing using MSILO\n");
+			# MSILO - storing as offline message
+			if (m_store("$ru"))
+			{
+				log("MSILO: offline message stored\n");
+				if (!t_reply("202", "Accepted")) 
+				{
+					sl_reply_error();
+				};
+			}else{
+				log("MSILO: offline message NOT stored\n");
+				if (!t_reply("503", "Service Unavailable")) 
+				{
+					sl_reply_error();
+				};
+			};
+			exit;
+		};
+		# if the downstream UA does not support MESSAGE requests
+		# go to failure_route[1]
+		t_on_failure("1");
+		t_relay();
+		exit;
+	};
+
+	# forward anything else
+	t_relay();
+}
+
+failure_route[1] {
+	# forwarding failed -- check if the request was a MESSAGE 
+	if (!is_method("MESSAGE"))
+	{
+		exit;
+	};
+	
+	log(1,"MSILO: the downstream UA does not support MESSAGE requests ...\n");
+	# we have changed the R-URI with the contact address -- ignore it now
+	if (m_store("$avp(i:11)"))
+	{
+		log("MSILO: offline message stored\n");
+		t_reply("202", "Accepted"); 
+	}else{
+		log("MSILO: offline message NOT stored\n");
+		t_reply("503", "Service Unavailable");
+	};
+}
+
+

+ 237 - 0
examples/kamailio/nathelper.cfg

@@ -0,0 +1,237 @@
+#
+# $Id$
+#
+# simple quick-start config script including nathelper support
+
+# This default script includes nathelper support. To make it work
+# you will also have to install Maxim's RTP proxy. The proxy is enforced
+# if one of the parties is behind a NAT.
+#
+# If you have an endpoing in the public internet which is known to
+# support symmetric RTP (Cisco PSTN gateway or voicemail, for example),
+# then you don't have to force RTP proxy. If you don't want to enforce
+# RTP proxy for some destinations than simply use t_relay() instead of
+# route(1)
+#
+# Sections marked with !! Nathelper contain modifications for nathelper
+#
+# NOTE !! This config is EXPERIMENTAL !
+#
+# ----------- global configuration parameters ------------------------
+
+debug=3         # debug level (cmd line: -dddddddddd)
+fork=yes
+log_stderror=no	# (cmd line: -E)
+
+/* Uncomment these lines to enter debugging mode 
+fork=no
+log_stderror=yes
+*/
+
+check_via=no	# (cmd. line: -v)
+dns=no           # (cmd. line: -r)
+rev_dns=no      # (cmd. line: -R)
+port=5060
+children=4
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+# Uncomment this if you want to use SQL database
+#loadmodule "mysql.so"
+
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "rr.so"
+loadmodule "maxfwd.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "textops.so"
+loadmodule "mi_fifo.so"
+
+# Uncomment this if you want digest authentication
+# db_mysql.so must be loaded !
+#loadmodule "auth.so"
+#loadmodule "auth_db.so"
+
+# !! Nathelper
+loadmodule "nathelper.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+# -- mi_fifo params --
+
+modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+
+# -- usrloc params --
+
+modparam("usrloc", "db_mode",   0)
+
+# Uncomment this if you want to use SQL database 
+# for persistent storage and comment the previous line
+#modparam("usrloc", "db_mode", 2)
+
+# -- auth params --
+# Uncomment if you are using auth module
+#
+#modparam("auth_db", "calculate_ha1", yes)
+#
+# If you set "calculate_ha1" parameter to yes (which true in this config), 
+# uncomment also the following parameter)
+#
+#modparam("auth_db", "password_column", "password")
+
+# -- rr params --
+# add value to ;lr param to make some broken UAs happy
+modparam("rr", "enable_full_lr", 1)
+
+# !! Nathelper
+modparam("usrloc","nat_bflag",6)
+modparam("nathelper","sipping_bflag",8)
+modparam("nathelper", "ping_nated_only", 1)   # Ping only clients behind NAT
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+
+	# initial sanity checks -- messages with
+	# max_forwards==0, or excessively long requests
+	if (!mf_process_maxfwd_header("10")) {
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	};
+	if (msg:len >=  2048 ) {
+		sl_send_reply("513", "Message too big");
+		exit;
+	};
+
+	# !! Nathelper
+	# Special handling for NATed clients; first, NAT test is
+	# executed: it looks for via!=received and RFC1918 addresses
+	# in Contact (may fail if line-folding is used); also,
+	# the received test should, if completed, should check all
+	# vias for rpesence of received
+	if (nat_uac_test("3")) {
+		# Allow RR-ed requests, as these may indicate that
+		# a NAT-enabled proxy takes care of it; unless it is
+		# a REGISTER
+
+		if (is_method("REGISTER") || !is_present_hf("Record-Route")) {
+		    log("LOG: Someone trying to register from private IP, rewriting\n");
+
+		    # This will work only for user agents that support symmetric
+		    # communication. We tested quite many of them and majority is
+		    # smart enough to be symmetric. In some phones it takes a configuration
+		    # option. With Cisco 7960, it is called NAT_Enable=Yes, with kphone it is
+		    # called "symmetric media" and "symmetric signalling".
+
+		    fix_nated_contact(); # Rewrite contact with source IP of signalling
+		    if ( is_method("INVITE") ) {
+		        fix_nated_sdp("1"); # Add direction=active to SDP
+		    };
+		    force_rport(); # Add rport parameter to topmost Via
+		    setbflag(6);    # Mark as NATed
+			
+			# if you want sip nat pinging
+			# setbflag(8);
+		};
+	};
+
+	# we record-route all messages -- to make sure that
+	# subsequent messages will go through our proxy; that's
+	# particularly good if upstream and downstream entities
+	# use different transport protocol
+	if (!is_method("REGISTER")) record_route();
+
+	# subsequent messages withing a dialog should take the
+	# path determined by record-routing
+	if (loose_route()) {
+		# mark routing logic in request
+		append_hf("P-hint: rr-enforced\r\n"); 
+		route(1);
+		exit;
+	};
+
+	if (!uri==myself) {
+		# mark routing logic in request
+		append_hf("P-hint: outbound\r\n"); 
+		route(1);
+		exit;
+	};
+
+	# if the request is for other domain use UsrLoc
+	# (in case, it does not work, use the following command
+	# with proper names and addresses in it)
+	if (uri==myself) {
+
+		if (method=="REGISTER") {
+
+# Uncomment this if you want to use digest authentication
+#			if (!www_authorize("siphub.org", "subscriber")) {
+#				www_challenge("siphub.org", "0");
+#				return;
+#			};
+
+			save("location");
+			exit;
+		};
+
+		lookup("aliases");
+		if (!uri==myself) {
+			append_hf("P-hint: outbound alias\r\n"); 
+			route(1);
+			exit;
+		};
+
+		# native SIP destinations are handled using our USRLOC DB
+		if (!lookup("location")) {
+			sl_send_reply("404", "Not Found");
+			exit;
+		};
+	};
+	append_hf("P-hint: usrloc applied\r\n"); 
+	route(1);
+}
+
+route[1] 
+{
+	# !! Nathelper
+	if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" && !search("^Route:")){
+		sl_send_reply("479", "We don't forward to private IP addresses");
+		exit;
+	};
+
+	# if client or server know to be behind a NAT, enable relay
+	if (isbflagset(6)) {
+		force_rtp_proxy();
+	};
+
+	# NAT processing of replies; apply to all transactions (for example,
+	# re-INVITEs from public to private UA are hard to identify as
+	# NATed at the moment of request processing); look at replies
+	t_on_reply("1");
+
+	# send it out now; use stateful forwarding as it works reliably
+	# even for UDP2TCP
+	if (!t_relay()) {
+		sl_reply_error();
+	};
+}
+
+# !! Nathelper
+onreply_route[1] {
+	# NATed transaction ?
+	if (isbflagset(6) && status =~ "(183)|2[0-9][0-9]") {
+		fix_nated_contact();
+		force_rtp_proxy();
+	# otherwise, is it a transaction behind a NAT and we did not
+	# know at time of request processing ? (RFC1918 contacts)
+	} else if (nat_uac_test("1")) {
+		fix_nated_contact();
+	};
+}
+

+ 148 - 0
examples/kamailio/pstn.cfg

@@ -0,0 +1,148 @@
+#
+# $Id$
+#
+# example: ser configured as PSTN gateway guard; PSTN gateway is located
+# at 192.168.0.10
+#
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "acc.so"
+loadmodule "rr.so"
+loadmodule "maxfwd.so"
+loadmodule "db_mysql.so"
+loadmodule "auth.so"
+loadmodule "auth_db.so"
+loadmodule "group.so"
+loadmodule "uri.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+modparam("auth_db", "db_url","mysql://kamailio:kamailiorw@localhost/kamailio")
+modparam("auth_db", "calculate_ha1", yes)
+modparam("auth_db", "password_column", "password")
+
+# -- acc params --
+modparam("acc", "log_level", 1)
+# that is the flag for which we will account -- don't forget to
+# set the same one :-)
+modparam("acc", "log_flag", 1 )
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+
+	/* ********* ROUTINE CHECKS  ********************************** */
+
+	# filter too old messages
+	if (!mf_process_maxfwd_header("10")) {
+		log("LOG: Too many hops\n");
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	};
+	if (msg:len >=  2048 ) {
+		sl_send_reply("513", "Message too big");
+		exit;
+	};
+
+	/* ********* RR ********************************** */
+
+	/* grant Route routing if route headers present */
+	if (loose_route()) { t_relay(); exit; };
+	
+	/* record-route INVITEs -- all subsequent requests must visit us */
+	if (method=="INVITE") {
+		record_route();
+	};
+
+	# now check if it really is a PSTN destination which should be handled
+	# by our gateway; if not, and the request is an invitation, drop it --
+	# we cannot terminate it in PSTN; relay non-INVITE requests -- it may
+	# be for example BYEs sent by gateway to call originator
+	if (!uri=~"sip:\+?[0-9]+@.*") {
+		if (method=="INVITE") {
+			sl_send_reply("403", "Call cannot be served here");
+		} else {
+			forward();
+		};
+		exit;
+	}; 
+
+	# account completed transactions via syslog
+	setflag(1);
+
+	# free call destinations ... no authentication needed
+	if ( is_user_in("Request-URI", "free-pstn")  /* free destinations */
+			||  uri=~"sip:[79][0-9][0-9][0-9]@.*"  /* local PBX */
+			|| uri=~"sip:98[0-9][0-9][0-9][0-9]") {
+		log("free call");
+	} else if (src_ip==192.168.0.10) {
+		# our gateway doesn't support digest authentication;
+		# verify that a request is coming from it by source
+		# address
+		log("gateway-originated request");
+	} else {
+		# in all other cases, we need to check the request against
+		# access control lists; first of all, verify request
+		# originator's identity
+
+		if (!proxy_authorize(	"gateway" /* realm */,
+				"subscriber" /* table name */))  {
+			proxy_challenge( "gateway" /* realm */, "0" /* no qop */ );
+			exit;
+		};
+
+		# authorize only for INVITEs -- RR/Contact may result in weird
+		# things showing up in d-uri that would break our logic; our
+		# major concern is INVITE which causes PSTN costs 
+
+		if (method=="INVITE") {
+
+			# does the authenticated user have a permission for local
+			# calls (destinations beginning with a single zero)? 
+			# (i.e., is he in the "local" group?)
+			if (uri=~"sip:0[1-9][0-9]+@.*") {
+				if (!is_user_in("credentials", "local")) {
+					sl_send_reply("403", "No permission for local calls"); 
+					exit;
+				};
+			# the same for long-distance (destinations begin with two zeros")
+			} else if (uri=~"sip:00[1-9][0-9]+@.*") {
+				if (!is_user_in("credentials", "ld")) {
+					sl_send_reply("403", " no permission for LD ");
+					exit;
+				};
+			# the same for international calls (three zeros)
+			} else if (uri=~"sip:000[1-9][0-9]+@.*") {
+				if (!is_user_in("credentials", "int")) {
+					sl_send_reply("403", "International permissions needed");
+					exit;
+				};
+			# everything else (e.g., interplanetary calls) is denied
+			} else {
+				sl_send_reply("403", "Forbidden");
+				exit;
+			};
+
+		}; # INVITE to authorized PSTN
+
+	}; # authorized PSTN
+
+	# if you have passed through all the checks, let your call go to GW!
+
+	rewritehostport("192.168.0.10:5060");
+
+	# forward the request now
+	if (!t_relay()) {
+		sl_reply_error(); 
+		exit; 
+	};
+
+}

+ 33 - 0
examples/kamailio/redirect.cfg

@@ -0,0 +1,33 @@
+#
+# $Id$
+#
+# this example shows use of ser as stateless redirect server
+#
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+loadmodule "sl.so"
+
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+	# for testing purposes, simply okay all REGISTERs
+	if (method=="REGISTER") {
+		log("REGISTER");
+		sl_send_reply("200", "ok");
+		return;
+	};
+	# rewrite current URI, which is always part of destination ser
+	rewriteuri("sip:[email protected]:9");
+	# append one more URI to the destination ser
+	append_branch("sip:[email protected]:9");
+	# redirect now
+	sl_send_reply("300", "Redirect");
+}
+

+ 76 - 0
examples/kamailio/replicate.cfg

@@ -0,0 +1,76 @@
+#
+# $Id$
+#
+# demo script showing how to set-up usrloc replication
+#
+
+# ----------- global configuration parameters ------------------------
+
+debug=3          # debug level (cmd line: -dddddddddd)
+fork=no
+log_stderror=yes # (cmd line: -E)
+
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+loadmodule "db_mysql.so"
+loadmodule "sl.so"
+loadmodule "tm.so"
+loadmodule "maxfwd.so"
+loadmodule "usrloc.so"
+loadmodule "registrar.so"
+loadmodule "auth.so"
+loadmodule "auth_db.so"
+
+# ----------------- setting module-specific parameters ---------------
+
+# digest generation secret; use the same in backup server;
+# also, make sure that the backup server has sync'ed time
+modparam("auth", "secret", "alsdkhglaksdhfkloiwr")
+
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+
+	# initial sanity checks -- messages with
+	# max_forwars==0, or excessively long requests
+	if (!mf_process_maxfwd_header("10")) {
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	};
+	if (msg:len >=  2048 ) {
+		sl_send_reply("513", "Message too big");
+		exit;
+	};
+
+	# if the request is for other domain use UsrLoc
+	# (in case, it does not work, use the following command
+	# with proper names and addresses in it)
+	if (uri==myself) {
+
+		if (method=="REGISTER") {
+
+			# verify credentials
+			if (!www_authorize("foo.bar", "subscriber")) {
+				www_challenge("foo.bar", "0");
+				exit;
+			};
+
+			# if ok, update contacts and ...
+			save("location");
+			# ... if this REGISTER is not a replica from our
+			# peer server, replicate to the peer server
+			if (!src_ip==backup.foo.bar) {
+				t_replicate("sip:backup.foo.bar:5060");
+			};
+			exit;
+		};
+		# do whatever else appropriate for your domain
+		log("non-REGISTER\n");
+	};
+}
+

+ 65 - 0
examples/kamailio/serial_183.cfg

@@ -0,0 +1,65 @@
+#
+# $Id$
+#
+# this example shows how to use forking on failure
+#
+
+log_stderror=1
+fork=no
+listen=192.168.2.16
+debug=3
+# ------------------ module loading ----------------------------------
+
+#set module path
+mpath="/usr/local/lib/kamailio/modules/"
+
+# Uncomment this if you want to use SQL database
+loadmodule "tm.so"
+loadmodule "sl.so"
+loadmodule "maxfwd.so"
+# -------------------------  request routing logic -------------------
+
+# main routing logic
+
+route{
+
+	# initial sanity checks -- messages with
+	# max_forwards==0, or excessively long requests
+	if (!mf_process_maxfwd_header("10")) {
+		sl_send_reply("483","Too Many Hops");
+		exit;
+	};
+	if (msg:len >=  2048 ) {
+		sl_send_reply("513", "Message too big");
+		exit;
+	};
+
+	/* skip register for testing purposes */
+	if (method=="REGISTER") { sl_send_reply("200", "ok"); exit; };
+
+	if (!method=="ACK")
+		log(1, "forwarding now to primary destination\n");
+	if (method=="INVITE") {
+		rewriteuri("sip:[email protected]:5064");
+		# if transaction broken, try other an alternative
+		# route
+		t_on_failure("1");
+		# if a provisional came, stop alternating
+		t_on_reply("1");
+	};
+	t_relay();
+}
+
+failure_route[1] {
+	log(1, "trying at alternate destination\n");
+	append_branch("sip:[email protected]:5064");
+	t_relay();
+}
+
+onreply_route[1] {
+	log(1, "reply came in\n");
+	if (status=~"18[0-9]")  {
+		log(1, "provisional -- resetting negative failure\n");
+		t_on_failure("0");
+	};
+}

+ 11 - 0
examples/kamailio/web_im/README

@@ -0,0 +1,11 @@
+#
+# $Id$
+#
+
+This examle illustrate how to use ser's FIFO interface
+to initate sending an instant message from a webpage.
+
+To enable this example, you need
+- web server with PHP support
+- install the example webpages on the server
+- have running ser with enabled fifo

+ 40 - 0
examples/kamailio/web_im/click_to_dial.html

@@ -0,0 +1,40 @@
+<html>
+<!-- $Id$ -->
+<header>
+<title>
+Click-To-Dial
+</title>
+</header>
+
+<body>
+<h1>
+Click-To-Dial (using REFER)
+</h1>
+
+<i>Unfortunately, this example does not work. The reason is use of
+REFER for third-party call-control has not been standardized due
+to resistance of proponents of B2BUA use (which is somewhat bloated
+and not always operational).
+</i>
+
+<form method=POST action=click_to_dial.php>
+<table>
+<tr>
+<td>
+Caller's SIP Address
+<td>
+<input name=caller>
+<tr>
+<td>
+Callee's SIP Address
+<td>
+<input name=callee>
+<tr>
+<td>Click to dial
+<td>
+<input type=submit value=now>
+</table>
+</form>
+
+
+</body>

+ 76 - 0
examples/kamailio/web_im/click_to_dial.php

@@ -0,0 +1,76 @@
+<html>
+<!-- $Id$ -->
+<header>
+<title>
+Click-To-Dial
+</title>
+</header>
+
+<body>
+<h1>
+Click-To-Dial
+</h1>
+
+<?php
+
+/* config values */
+$web_contact="sip:[email protected]";
+$fifo="/tmp/kamailio_fifo";
+$signature="web_dialer_0.1.0";
+
+/* open reply fifo */
+$myfilename="webfifo_".rand();
+$mypath="/tmp/".$myfilename;
+$outbound_proxy=".";
+
+
+$caller = $_POST['caller'];
+$callee = $_POST['callee'];
+
+echo "Initiating your request...<p>";
+/* open fifo now */
+$fifo_handle=fopen( $fifo, "w" );
+if (!$fifo_handle) {
+    exit ("Sorry -- cannot open fifo: ".$fifo);
+}
+
+/* construct FIFO command */
+
+$fifo_cmd=":t_uac_dlg:".$myfilename."\n".
+    "REFER\n".
+     $caller."\n".
+	 $outbound_proxy."\n".
+	 ".\n".
+     "\"From: ".$web_contact."\r\n".
+     "To: ".$callee."\r\n".
+     "p-version: ".$signature."\r\n".
+    "Contact: ".$web_contact."\r\n".
+    "Referred-By: ".$web_contact."\r\n".
+	"Refer-To: ".$callee."\r\n".
+	"\"\n\n";
+	
+    
+/* create fifo for replies */
+system("mkfifo -m 666 ".$mypath );
+
+/* write fifo command */
+if (fwrite( $fifo_handle, $fifo_cmd)==-1) {
+    unlink($mypath);
+    fclose($fifo_handle);
+    exit("Sorry -- fifo writing error");
+}
+fclose($fifo_handle);
+
+/* read output now */
+if (readfile( $mypath )==-1) {
+    unlink($mypath);
+	exit("Sorry -- fifo reading error");
+}
+unlink($mypath);
+echo "<p>Thank you for using click-to-dial<p>";
+
+?>
+
+</body>
+</html>
+

+ 37 - 0
examples/kamailio/web_im/send_im.html

@@ -0,0 +1,37 @@
+<html>
+<!-- $Id$ -->
+<header>
+<title>
+Send IM
+</title>
+</header>
+
+<body>
+<h1>
+Send IM
+</h1>
+
+<form method=POST action=send_im.php>
+<table>
+<tr>
+<td>
+SIP Address
+<br>
+Example: [email protected]
+<td>
+<input name=sip_address>
+<tr>
+<td>
+Message
+<td>
+<textarea name=instant_message rows=6 cols=40>
+</textarea>
+<tr>
+<td>Click to send
+<td>
+<input type=submit value=submit>
+</table>
+</form>
+
+
+</body>

+ 77 - 0
examples/kamailio/web_im/send_im.php

@@ -0,0 +1,77 @@
+<html>
+<!-- $Id$ -->
+<header>
+<title>
+Send IM Status
+</title>
+</header>
+
+<body>
+<h1>
+Send IM Status
+</h1>
+
+<?php
+
+/* config values */
+$web_contact="sip:[email protected]";
+$fifo="/tmp/kamailio_fifo";
+$signature="web_im_0.1.0";
+
+/* open reply fifo */
+$myfilename="webfifo_".rand();
+$mypath="/tmp/".$myfilename;
+$outbound_proxy=".";
+
+
+$sip_address = $_POST['sip_address'];
+$instant_message = $_POST['instant_message'];
+
+
+echo "Initiating your request...<p>";
+
+/* open fifo now */
+$fifo_handle=fopen( $fifo, "w" );
+if (!$fifo_handle) {
+    exit ("Sorry -- cannot open fifo: ".$fifo);
+}
+
+/* construct FIFO command */
+$fifo_cmd=":t_uac_dlg:".$myfilename."\n".
+    "MESSAGE\n".
+    $sip_address."\n".
+	$outbound_proxy."\n".
+    ".\n".
+    "\"From: ".$web_contact."\r\n".
+	"To: ".$sip_address."\r\n".
+	"p-version: ".$signature."\r\n".
+    "Contact: ".$web_contact."\r\n".
+    "Content-Type: text/plain; charset=UTF-8\r\n".
+    "\"\n".
+    "\"".$instant_message."\"".
+  	"\n\n";  
+
+/* create fifo for replies */
+system("mkfifo -m 666 ".$mypath );
+
+/* write fifo command */
+if (fwrite( $fifo_handle, $fifo_cmd)==-1) {
+    unlink($mypath);
+    fclose($fifo_handle);
+    exit("Sorry -- fifo writing error");
+}
+fclose($fifo_handle);
+
+/* read output now */
+if (readfile( $mypath )==-1) {
+    unlink($mypath);
+	exit("Sorry -- fifo reading error");
+}
+unlink($mypath);
+echo "<p>Thank you for using IM<p>";
+
+?>
+
+</body>
+</html>
+

+ 14 - 0
pkg/kamailio/debian-etch/changelog

@@ -0,0 +1,14 @@
+kamailio (1.5.0-svn1) unstable; urgency=low
+
+  * increment debian packaging for trunk
+
+ -- Henning Westerholt <[email protected]>  Mon, 02 Mar 2009 17:40:02 +0100
+
+kamailio (1.4.0-svn1) unstable; urgency=low
+
+  [ Klaus Darilion ]
+  * first release of Kamailio (after renaming from Openser)
+
+ -- Julien BLACHE <[email protected]>  Wed, 12 Dec 2007 17:25:31 +0100
+
+

+ 1 - 0
pkg/kamailio/debian-etch/compat

@@ -0,0 +1 @@
+5

+ 239 - 0
pkg/kamailio/debian-etch/control

@@ -0,0 +1,239 @@
+Source: kamailio
+Section: net
+Priority: optional
+Maintainer: Debian VoIP Team <[email protected]>
+Uploaders: Kilian Krause <[email protected]>
+Build-Depends: debhelper (>= 5), dpatch, libmysqlclient15-dev, libexpat1-dev, libxml2-dev, libpq-dev, libradiusclient-ng-dev, flex, bison, zlib1g-dev, unixodbc-dev, libxmlrpc-c3-dev, libperl-dev, libsnmp-dev, dpkg-dev (>= 1.13.19), libdb4.4-dev , xsltproc, libconfuse-dev, libldap2-dev, libcurl3-gnutls-dev, python, libpcre3-dev, docbook-xml, libpurple-dev, libmemcache-dev
+Standards-Version: 3.7.2
+
+Package: kamailio
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
+Suggests: kamailio-mysql-module, kamailio-postgres-module, kamailio-unixodbc-module, kamailio-jabber-module, kamailio-cpl-module, kamailio-radius-modules, kamailio-presence-modules, kamailio-xmlrpc-module, kamailio-perl-modules, kamailio-snmpstats-module, kamailio-xmpp-module, kamailio-carrierroute-module, kamailio-berkeley-module, kamailio-ldap-modules
+Description: very fast and configurable SIP proxy
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ C Shell-like scripting language provides full control over the server's
+ behaviour. Its modular architecture allows only required functionality to be
+ loaded.
+ .
+ Among others, the following modules are available: Digest Authentication, CPL
+ scripts, Instant Messaging, MySQL support, Presence Agent, Radius
+ Authentication, Record Routing, SMS Gateway, Jabber/XMPP Gateway, Transaction
+ Module, Registrar and User Location, XMLRPC Interface.
+ .
+ This package contains the main Kamailio binary along with the principal modules
+ and support binaries.
+
+Package: kamailio-dbg
+Priority: extra
+Architecture: any
+Depends: kamailio (= ${binary:Version})
+Conflicts: kamailio (<< ${binary:Version})
+Description: very fast and configurable SIP proxy [debug symbols]
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package contains the debugging symbols for the Kamailio binaries and
+ modules. You only need to install it if you need to debug Kamailio.
+
+Package: kamailio-mysql-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), mysql-client
+Description: MySQL database connectivity module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the MySQL database driver for Kamailio.
+
+Package: kamailio-postgres-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), postgresql-client
+Description: PostgreSQL database connectivity module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the PostgreSQL database driver for Kamailio.
+
+Package: kamailio-jabber-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Jabber gateway module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the SIP to Jabber translator module for Kamailio.
+
+Package: kamailio-cpl-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: CPL module (CPL interpreter engine) for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides a CPL (Call Processing Language) interpreter for
+ Kamailio, turning Kamailio into a CPL server (storage and interpreter).
+
+Package: kamailio-radius-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: radius modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides a set of Radius modules for Kamailio, for
+ authentication, peering, group membership and messages URIs checking
+ against a Radius Server.
+
+Package: kamailio-unixodbc-module 
+Architecture: any 
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: unixODBC database connectivity module for Kamailio 
+ Kamailio is a very fast and flexible SIP (RFC3261) 
+ proxy server. Written entirely in C, Kamailio can handle thousands calls 
+ per second even on low-budget hardware. 
+ . 
+ This package provides the unixODBC database driver for Kamailio. 
+
+Package: kamailio-presence-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: SIMPLE presence modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides several Kamailio modules for implementing presence
+ server and presence user agent for RICH presence, registrar-based presence,
+ external triggered presence and XCAP support.
+
+Package: kamailio-xmlrpc-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: XMLRPC support for Kamailio's Management Interface
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the XMLRPC transport implementation for Kamailio's
+ Management Interface.
+
+Package: kamailio-perl-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Replaces: kamailio-perl-module
+Conflicts: kamailio-perl-module
+Description: Perl extensions and database driver for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides an interface for Kamailio to write Perl extensions and
+ the perlvdb database driver for Kamailio.
+
+Package: kamailio-snmpstats-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), snmpd
+Description: SNMP AgentX subagent module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the snmpstats module for Kamailio. This module acts
+ as an AgentX subagent which connects to a master agent.
+
+Package: kamailio-xmpp-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: XMPP gateway module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the SIP to XMPP IM translator module for Kamailio.
+
+Package: kamailio-carrierroute-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Carrierroute module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the carrierroute module for Kamailio, an integrated
+ solution for routing, balancing and blacklisting.
+
+Package: kamailio-berkeley-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), db4.4-util
+Description: Berkeley Database module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the berkeley database module for Kamailio, a
+ high-performance embedded DB kernel. All database tables are stored
+ in files, no additional server is necessary.
+
+Package: kamailio-ldap-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: LDAP modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the ldap and h350 modules for Kamailio, enabling LDAP
+ queries from the Kamailio config and storage of SIP account data in an LDAP
+ directory.
+
+Package: kamailio-utils-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides a set utility functions for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ Provides a set of utility functions for Kamailio, which are not related
+ to the server configuration.
+
+Package: kamailio-regex-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the lcr, diaplan and regex modules
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ Contains the lcr, diaplan and regex modules that depends on the pcre library.
+
+Package: kamailio-purple-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the purple module, a multi-protocol IM gateway
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the purple module, a multi-protocol instant
+ messaging gateway module.
+
+Package: kamailio-memcached-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the memcached module, an interface to the memcached server
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the memcached module, an interface to the memcached
+ server, a high-performance, distributed memory object caching system.

+ 27 - 0
pkg/kamailio/debian-etch/copyright

@@ -0,0 +1,27 @@
+This package was debianized by Andrei Pelinescu-Onciul
+<[email protected]> on Tue, 16 Jul 2002 15:41:31 +0200.
+This package was debianized by Julien BLACHE <[email protected]>
+on Thu, 29 Jun 2006 09:55:24 +0200, based on Andrei's work.
+
+It was downloaded from: http://kamailio.org
+
+Upstream Authors:
+       Andrei Pelinescu-Onciul <[email protected]>
+       Bogdan-Andrei Iancu <[email protected]>
+       Daniel-Constantin Mierla <[email protected]>
+       Jan Janak <[email protected]>
+       Jiri Kuthan <[email protected]>
+       Juha Heinanen
+       Ramona-Elena Modroiu
+       Maxim Sobolev
+       Miklos Tirpak
+       Nils Ohlmeier
+       and others ; see the AUTHORS file in the source code tree for details
+
+This software is copyright (c) 2002-2003 by FhG Fokus
+
+You are free to distribute this software under the terms of
+the GNU General Public License.
+
+On Debian systems, the complete text of the GNU General Public
+License can be found in the file `/usr/share/common-licenses/GPL.

+ 38 - 0
pkg/kamailio/debian-etch/kamailio.README.Debian

@@ -0,0 +1,38 @@
+Kamailio for Debian
+------------------
+
+* init script check for fork=no
+-------------------------------
+
+The Kamailio init script will not start Kamailio on boot if fork=no is
+specified in the config file. The check in the initscript will match
+any occurrence of fork=no in the file, even inside C-style comments.
+
+You can disable this check in the init script if you wish; just comment
+out the calls to the check_fork function in the script. Your changes to
+the init script will be preserved upon upgrade, as the file is tagged
+as a conffile.
+
+
+* Kamailio setup
+---------------
+
+To setup Kamailio, you need to:
+ - configure Kamailio properly to suit your needs
+ - edit /etc/default/kamailio, adjust the MEMORY parameter and set
+   RUN_KAMAILIO to "yes"
+
+If you are building an HA cluster using heartbeat or similar, you'll want
+to disable the init script by running:
+
+  update-rc.d kamailio remove
+
+so that Kamailio will not be launched at system startup. You still need
+to set RUN_KAMAILIO to "yes" if you want to use the /etc/init.d/kamailio init
+script.
+
+Set the DUMP_CORE parameter in /etc/default/kamailio to "yes" if you want to
+get a core dump in case Kamailio crashes. The debug symbols for Kamailio are
+provided by the kamailio-dbg package.
+
+-- Julien BLACHE <[email protected]>, Fri, 08 Sep 2006 14:43:21 +0200

+ 24 - 0
pkg/kamailio/debian-etch/kamailio.default

@@ -0,0 +1,24 @@
+#
+# Kamailio startup options
+#
+
+# Set to yes to enable kamailio, once configured properly.
+RUN_KAMAILIO=no
+
+# User to run as
+USER=kamailio
+
+# Group to run as
+GROUP=kamailio
+
+# Amount of memory to allocate for the running Kamailio server (in Mb)
+MEMORY=64
+
+# Enable the server to leave a core file when it crashes.
+# Set this to 'yes' to enable Kamailio to leave a core file when it crashes
+# or 'no' to disable this feature. This option is case sensitive and only
+# accepts 'yes' and 'no' and only in lowercase letters.
+# On some systems (e.g. Ubuntu 6.10, Debian 4.0) it is necessary to specify
+# a directory for the core files to get a dump. Look into the kamailio
+# init file for an example configuration.
+DUMP_CORE=no

+ 2 - 0
pkg/kamailio/debian-etch/kamailio.dirs

@@ -0,0 +1,2 @@
+var/run/kamailio
+

+ 2 - 0
pkg/kamailio/debian-etch/kamailio.examples

@@ -0,0 +1,2 @@
+examples/*
+

+ 170 - 0
pkg/kamailio/debian-etch/kamailio.init

@@ -0,0 +1,170 @@
+#! /bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          kamailio
+# Required-Start:    $syslog $network $local_fs $time
+# Required-Stop:     $syslog $network $local_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start the Kamailio SIP proxy server
+# Description:       Start the Kamailio SIP proxy server
+### END INIT INFO
+#
+# TODO:
+# The following fields should be added (and completed):
+# Should-Start:      postgresql mysql radius
+# Should-Stop:       postgresql mysql radius
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/kamailio
+NAME=kamailio
+DESC=kamailio
+HOMEDIR=/var/run/kamailio
+PIDFILE=$HOMEDIR/$NAME.pid
+DEFAULTS=/etc/default/kamailio
+RUN_KAMAILIO=no
+
+# Do not start kamailio if fork=no is set in the config file
+# otherwise the boot process will just stop
+check_fork ()
+{
+    if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/kamailio/kamailio.cfg; then
+	echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
+	exit 1
+    fi
+}
+
+check_kamailio_config ()
+{
+	# Check if kamailio configuration is valid before starting the server
+	set +e
+	out=$($DAEMON -c 2>&1 > /dev/null)
+	retcode=$?
+	set -e
+	if [ "$retcode" != '0' ]; then
+	    echo "Not starting $DESC: invalid configuration file!"
+	    echo -e "\n$out\n"
+	    exit 1
+	fi
+}
+
+check_homedir ()
+{
+    # Create HOMEDIR directory in case it doesn't exist
+    if [ ! -d $HOMEDIR ]; then
+        mkdir $HOMEDIR
+    fi
+
+    # Set the appropiate owner and group
+    chown ${USER}:${GROUP} $HOMEDIR
+}
+
+
+create_radius_seqfile ()
+{
+    # Create a radius sequence file to be used by the radius client if
+    # radius accounting is enabled. This is needed to avoid any issue
+    # with the file not being writable if kamailio first starts as user
+    # root because DUMP_CORE is enabled and creates this file as user
+    # root and then later it switches back to user kamailio and cannot
+    # write to the file. If the file exists before kamailio starts, it
+    # won't change it's ownership and will be writable for both root
+    # and kamailio, no matter what options are chosen at install time
+    RADIUS_SEQ_FILE=$HOMEDIR/kamailio_radius.seq
+
+    if [ ! -f $RADIUS_SEQ_FILE ]; then
+        touch $RADIUS_SEQ_FILE
+    fi
+
+    chown ${USER}:${GROUP} $RADIUS_SEQ_FILE
+    chmod 660 $RADIUS_SEQ_FILE
+}
+
+test -f $DAEMON || exit 0
+
+# Load startup options if available
+if [ -f $DEFAULTS ]; then
+   . $DEFAULTS || true
+fi
+
+if [ "$RUN_KAMAILIO" != "yes" ]; then
+    echo "Kamailio not yet configured. Edit /etc/default/kamailio first."
+    exit 0
+fi
+
+set -e
+
+MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+[ -z "$USER" ]  && USER=kamailio
+[ -z "$GROUP" ] && GROUP=kamailio
+[ $MEMORY -le 0 ] && MEMORY=32
+
+if test "$DUMP_CORE" = "yes" ; then
+    # set proper ulimit
+    ulimit -c unlimited
+    
+    # directory for the core dump files
+    # COREDIR=/home/corefiles
+    # [ -d $COREDIR ] || mkdir $COREDIR
+    # chmod 777 $COREDIR
+    # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
+fi
+
+OPTIONS="-P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+
+case "$1" in
+  start|debug)
+	check_kamailio_config
+	check_homedir
+	create_radius_seqfile
+
+	if [ "$1" != "debug" ]; then
+	    check_fork
+	fi
+
+	echo -n "Starting $DESC: $NAME"
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+		--exec $DAEMON -- $OPTIONS || echo -n " already running"
+	echo "."
+	;;
+  stop)
+	echo -n "Stopping $DESC: $NAME"
+	start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
+		--exec $DAEMON
+	echo "."
+	;;
+  restart|force-reload)
+	check_kamailio_config
+	check_homedir
+	create_radius_seqfile
+
+	echo -n "Restarting $DESC: $NAME"
+	start-stop-daemon --oknodo --stop --quiet --pidfile \
+		$PIDFILE --exec $DAEMON
+	sleep 1
+	start-stop-daemon --start --quiet --pidfile \
+		$PIDFILE --exec $DAEMON  -- $OPTIONS
+	echo "."
+	;;
+  status)
+	echo -n "Status of $DESC: "
+	if [ ! -r "$PIDFILE" ]; then
+		echo "$NAME is not running."
+		exit 3
+	fi
+	if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
+		echo "$NAME is running."
+		exit 0
+	else
+		echo "$NAME is not running but $PIDFILE exists."
+		exit 1
+	fi
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart|force-reload|debug|status}" >&2
+	exit 1
+	;;
+esac
+
+exit 0

+ 48 - 0
pkg/kamailio/debian-etch/kamailio.postinst

@@ -0,0 +1,48 @@
+#! /bin/sh
+#
+# $Id$
+
+PKG=kamailio
+DEFAULTS=/etc/default/kamailio
+HOMEDIR=/var/run/kamailio
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+        adduser --quiet --system --group --disabled-password \
+                --shell /bin/false --gecos "Kamailio" \
+                --home $HOMEDIR kamailio || true
+
+        ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+        ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+        ;;
+esac
+
+#DEBHELPER#
+

+ 3 - 0
pkg/kamailio/debian-etch/patches/00list

@@ -0,0 +1,3 @@
+10_no_lib64_on_64_bits
+11_always_smp
+

+ 27 - 0
pkg/kamailio/debian-etch/patches/10_no_lib64_on_64_bits.dpatch

@@ -0,0 +1,27 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 10_no_lib64_on_64_bits.dpatch by  <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Debian uses /usr/lib even for 64bit architectures.
+
+@DPATCH@
+diff -urNad kamailio-1.2.0~/Makefile.defs kamailio-1.2.0/Makefile.defs
+--- kamailio-1.2.0~/Makefile.defs	2007-02-24 12:35:45.000000000 +0100
++++ kamailio-1.2.0/Makefile.defs	2007-02-24 16:26:45.886854110 +0100
+@@ -123,14 +123,12 @@
+ bin-dir = sbin/
+ 
+ ARCH_B= $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/')
+-ifeq ($(ARCH_B),64b)
+-	LIBDIR ?= lib64
+-else
+-	LIBDIR ?= lib
++ifneq ($(ARCH_B),64b)
+ 	# assume 32b - it is not really used further
+ 	ARCH_B=32b
+ endif
+ 
++LIBDIR ?= lib
+ lib-dir = $(LIBDIR)/$(MAIN_NAME)
+ modules-dir = $(LIBDIR)/$(MAIN_NAME)/modules/
+ 

+ 24 - 0
pkg/kamailio/debian-etch/patches/11_always_smp.dpatch

@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 11_always_smp.dpatch by  <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Always build for SMP.
+
+@DPATCH@
+diff -urNad kamailio-1.2.0~/Makefile.defs kamailio-1.2.0/Makefile.defs
+--- kamailio-1.2.0~/Makefile.defs	2007-02-24 16:28:43.152825070 +0100
++++ kamailio-1.2.0/Makefile.defs	2007-02-24 16:28:46.123102964 +0100
+@@ -82,12 +82,7 @@
+ 	endif
+ endif
+ 
+-SMP_STR = $(shell uname -v | grep -i "SMP")
+-ifeq (,$(SMP_STR))
+-	ISSMP=no
+-else
+-	ISSMP=yes
+-endif
++ISSMP=yes
+ 
+ OSREL = $(shell uname -r)
+ # numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)

+ 374 - 0
pkg/kamailio/debian-etch/rules

@@ -0,0 +1,374 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+
+ALL_PACKAGES = kamailio kamailio-mysql-module kamailio-postgres-module \
+	kamailio-jabber-module kamailio-cpl-module kamailio-radius-modules \
+	kamailio-unixodbc-module kamailio-presence-modules kamailio-xmlrpc-module \
+	kamailio-perl-modules kamailio-snmpstats-module kamailio-xmpp-module \
+	kamailio-carrierroute-module kamailio-berkeley-module kamailio-ldap-modules \
+	kamailio-utils-module kamailio-regex-modules kamailio-purple-module \
+	kamailio-memcached-module
+
+DEBVERSION:=$(shell head -n 1 debian/changelog \
+                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
+UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//')
+
+FILENAME := kamailio_$(UPVERSION).orig.tar.gz
+UPFILENAME := kamailio-$(UPVERSION)-tls_src.tar.gz
+URL := http://kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)-tls_src.tar.gz
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+# Include dpatch rules
+include /usr/share/dpatch/dpatch.make
+
+
+# Do we want the TLS version ?
+# Disabled by default due to license issues, set to non-void to enable
+TLS=
+
+# modules depending on mysql
+MYSQL_MODULES = db_mysql
+# modules depending on postgres
+POSTGRES_MODULES = db_postgres
+# modules depending on unixODBC
+UNIXODBC_MODULES=db_unixodbc
+# jabber module
+JABBER_MODULES = jabber
+# cpl related modules
+CPL_MODULES = cpl-c
+# module depending on radiusclient
+RADIUS_MODULES = auth_radius misc_radius peering
+# presence related modules
+PRESENCE_MODULES = presence presence_xml presence_mwi presence_dialoginfo pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo xcap_client rls
+# XMLRPC module
+XMLRPC_MODULES = mi_xmlrpc
+# Perl module
+PERL_MODULES = perl perlvdb
+# SNMPstats module
+SNMPSTATS_MODULES = snmpstats
+# XMPP module
+XMPP_MODULES = xmpp
+# Carrierroute module
+CROUTE_MODULES = carrierroute
+# Berkeley DB module
+BERKELEY_MODULES = db_berkeley
+# LDAP modules
+LDAP_MODULES = ldap h350
+# utils module
+UTILS_MODULES = utils
+# modules depending on libpcre
+REGEX_MODULES = dialplan regex lcr
+# purple module
+PURPLE_MODULES = purple
+# memcached module
+MEMCACHED_MODULES = memcached
+
+ALL_MODULES = $(MYSQL_MODULES) $(POSTGRES_MODULES) $(UNIXODBC_MODULES) $(JABBER_MODULES) $(CPL_MODULES) $(RADIUS_MODULES) $(PRESENCE_MODULES) $(XMLRPC_MODULES) $(PERL_MODULES) $(SNMPSTATS_MODULES) $(XMPP_MODULES) $(CROUTE_MODULES) $(BERKELEY_MODULES) $(LDAP_MODULES) $(UTILS_MODULES) $(REGEX_MODULES) $(PURPLE_MODULES) $(MEMCACHED_MODULES)
+
+# modules not in the "main" package or unstable modules
+EXCLUDED_MODULES = $(ALL_MODULES) pa osp
+
+# the same but with path prepended (needed for modules="...")
+MYSQL_MOD_PATH=$(addprefix modules/, $(MYSQL_MODULES))
+POSTGRES_MOD_PATH=$(addprefix modules/, $(POSTGRES_MODULES))
+UNIXODBC_MOD_PATH=$(addprefix modules/, $(UNIXODBC_MODULES))
+JABBER_MOD_PATH=$(addprefix modules/, $(JABBER_MODULES))
+CPL_MOD_PATH=$(addprefix modules/, $(CPL_MODULES))
+RADIUS_MOD_PATH=$(addprefix modules/, $(RADIUS_MODULES))
+PRESENCE_MOD_PATH=$(addprefix modules/, $(PRESENCE_MODULES))
+XMLRPC_MOD_PATH=$(addprefix modules/, $(XMLRPC_MODULES))
+PERL_MOD_PATH=$(addprefix modules/, $(PERL_MODULES))
+SNMPSTATS_MOD_PATH=$(addprefix modules/, $(SNMPSTATS_MODULES))
+XMPP_MOD_PATH=$(addprefix modules/, $(XMPP_MODULES))
+CROUTE_MOD_PATH=$(addprefix modules/, $(CROUTE_MODULES))
+BERKELEY_MOD_PATH=$(addprefix modules/, $(BERKELEY_MODULES))
+LDAP_MOD_PATH=$(addprefix modules/, $(LDAP_MODULES))
+UTILS_MOD_PATH=$(addprefix modules/, $(UTILS_MODULES))
+REGEX_MOD_PATH=$(addprefix modules/, $(REGEX_MODULES))
+PURPLE_MOD_PATH=$(addprefix modules/, $(PURPLE_MODULES))
+MEMCACHED_MOD_PATH=$(addprefix modules/, $(MEMCACHED_MODULES))
+
+ifeq (cc, $(CC))
+	CC = gcc
+endif
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+        CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+build-stamp: patch-stamp configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) all skip_modules="$(EXCLUDED_MODULES)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(MYSQL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(POSTGRES_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(UNIXODBC_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(JABBER_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(CPL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(RADIUS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PRESENCE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(XMLRPC_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PERL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(SNMPSTATS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(XMPP_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(CROUTE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(BERKELEY_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(LDAP_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(UTILS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(REGEX_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PURPLE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(MEMCACHED_MOD_PATH)" cfg-target=/etc/kamailio/
+
+	# generate the man pages for modules
+	$(MAKE) modules-docbook-man include_modules="$(ALL_MODULES)"
+
+	# generate the utils db_berkeley
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) utils include_modules="db_berkeley"
+
+	touch build-stamp
+
+clean: real-clean unpatch
+real-clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	$(MAKE) TLS=$(TLS) include_modules="$(ALL_MODULES)" proper
+	rm -f cfg.tab.h
+	rm -f utils/kamunix/kamunix.o utils/kamunix/kamunix
+	rm -f utils/db_berkeley/kambdb_recover.o utils/db_berkeley/kambdb_recover
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/kamailio
+	# kamailio base package
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install skip_modules="$(EXCLUDED_MODULES)" \
+		basedir=$(CURDIR)/debian/kamailio \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio
+
+	find $(CURDIR)/debian/kamailio/etc/kamailio -type f -exec chmod -x {} \;
+	sed -i -e "s/^PATH.*//" $(CURDIR)/debian/kamailio/usr/sbin/kamctl
+
+	# install only the mysql module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(MYSQL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-mysql-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-mysql-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-mysql-module
+
+	# install only the postgres module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(POSTGRES_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-postgres-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-postgres-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-postgres-module
+
+	# install only the unixodbc module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(UNIXODBC_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-unixodbc-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-unixodbc-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-unixodbc-module
+
+	# install only the jabber module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(JABBER_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-jabber-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-jabber-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-jabber-module
+
+	# install only the cpl module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(CPL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-cpl-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-cpl-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-cpl-module
+
+	# install only the radius modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(RADIUS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-radius-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-radius-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-radius-modules
+
+	# install only the presence modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PRESENCE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-presence-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-presence-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-presence-modules
+
+	# install only the xmlrpc module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(XMLRPC_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-xmlrpc-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-xmlrpc-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-xmlrpc-module
+
+	# install only the perl modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PERL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-perl-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-perl-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-perl-modules
+
+	# install only the snmpstats module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(SNMPSTATS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-snmpstats-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-snmpstats-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-snmpstats-module
+
+	# install only the xmpp module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(XMPP_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-xmpp-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-xmpp-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-xmpp-module
+
+	# install only the carrierroute module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(CROUTE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-carrierroute-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-carrierroute-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-carrierroute-module
+
+	# install only the db_berkeley module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(BERKELEY_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-berkeley-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-berkeley-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-berkeley-module
+
+	# install only the ldap modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(LDAP_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-ldap-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-ldap-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-ldap-modules
+
+	# install only the utils modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(UTILS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-utils-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-utils-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-utils-module
+
+	# install only the regex modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(REGEX_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-regex-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-regex-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-regex-modules
+
+	# install only the purple modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PURPLE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-purple-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-purple-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-purple-module
+
+	# install only the memcached modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(MEMCACHED_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-memcached-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-memcached-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-memcached-module
+
+	# the modules packages all ship an empty /usr/sbin directory, let's clean that up
+	for p in $(ALL_PACKAGES); \
+		do rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/$$p/usr/sbin; done
+
+# This single target is used to build all the packages, all at once, or
+# one at a time. So keep in mind: any options passed to commands here will
+# affect _all_ packages. Anything you want to only affect one package
+# should be put in another target, such as the install target.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples --exclude=".svn"
+#	dh_installlogrotate
+	dh_installinit -pkamailio -- defaults 23
+	dh_installcron
+	dh_installman
+	dh_installinfo
+	dh_installchangelogs
+	dh_link
+	dh_strip --dbg-package=kamailio-dbg
+	dh_compress 
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+# Build architecture-independent packages using the common target
+binary-indep: build install
+# We have nothing to do by default.
+
+binary: binary-indep binary-arch
+
+print-version:
+	@@echo "Debian version:          $(DEBVERSION)"
+	@@echo "Upstream version:        $(UPVERSION)"
+
+get-orig-source:
+	@@dh_testdir
+	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
+	@@echo Downloading $(FILENAME) from $(URL) ...
+	@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
+
+.PHONY: build clean binary-indep binary-arch binary install configure patch unpatch real-clean

+ 14 - 0
pkg/kamailio/debian-lenny/changelog

@@ -0,0 +1,14 @@
+kamailio (1.5.0-svn1) unstable; urgency=low
+
+  * increment debian packaging for trunk
+
+ -- Henning Westerholt <[email protected]>  Mon, 02 Mar 2009 17:40:02 +0100
+
+kamailio (1.4.0-svn1) unstable; urgency=low
+
+  [ Klaus Darilion ]
+  * first release of Kamailio (after renaming from Openser)
+
+ -- Julien BLACHE <[email protected]>  Wed, 12 Dec 2007 17:25:31 +0100
+
+

+ 1 - 0
pkg/kamailio/debian-lenny/compat

@@ -0,0 +1 @@
+5

+ 242 - 0
pkg/kamailio/debian-lenny/control

@@ -0,0 +1,242 @@
+Source: kamailio
+Section: net
+Priority: optional
+Maintainer: Debian VoIP Team <[email protected]>
+Uploaders: Kilian Krause <[email protected]>
+Build-Depends: debhelper (>= 5), dpatch, libmysqlclient15-dev, libexpat1-dev, libxml2-dev, libpq-dev, libradiusclient-ng-dev, flex, bison, zlib1g-dev, unixodbc-dev, libxmlrpc-c3-dev, libperl-dev, libsnmp-dev, dpkg-dev (>= 1.13.19), libdb-dev (>= 4.6.19), xsltproc, libconfuse-dev, libldap2-dev, libcurl4-gnutls-dev, python, libpcre3-dev, docbook-xml, libpurple-dev, libmemcache-dev
+Standards-Version: 3.8.0
+Homepage: http://www.kamailio.org/
+Vcs-Svn: svn://svn.debian.org/pkg-voip/kamailio/trunk/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/kamailio/?op=log
+
+Package: kamailio
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
+Suggests: kamailio-mysql-module, kamailio-postgres-module, kamailio-unixodbc-module, kamailio-jabber-module, kamailio-cpl-module, kamailio-radius-modules, kamailio-presence-modules, kamailio-xmlrpc-module, kamailio-perl-modules, kamailio-snmpstats-module, kamailio-xmpp-module, kamailio-carrierroute-module, kamailio-berkeley-module, kamailio-ldap-modules
+Description: very fast and configurable SIP proxy
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ C Shell-like scripting language provides full control over the server's
+ behaviour. Its modular architecture allows only required functionality to be
+ loaded.
+ .
+ Among others, the following modules are available: Digest Authentication, CPL
+ scripts, Instant Messaging, MySQL support, Presence Agent, Radius
+ Authentication, Record Routing, SMS Gateway, Jabber/XMPP Gateway, Transaction
+ Module, Registrar and User Location, XMLRPC Interface.
+ .
+ This package contains the main Kamailio binary along with the principal modules
+ and support binaries.
+
+Package: kamailio-dbg
+Priority: extra
+Architecture: any
+Depends: kamailio (= ${binary:Version})
+Conflicts: kamailio (<< ${binary:Version})
+Description: very fast and configurable SIP proxy [debug symbols]
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package contains the debugging symbols for the Kamailio binaries and
+ modules. You only need to install it if you need to debug Kamailio.
+
+Package: kamailio-mysql-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), mysql-client
+Description: MySQL database connectivity module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the MySQL database driver for Kamailio.
+
+Package: kamailio-postgres-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), postgresql-client
+Description: PostgreSQL database connectivity module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the PostgreSQL database driver for Kamailio.
+
+Package: kamailio-jabber-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Jabber gateway module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the SIP to Jabber translator module for Kamailio.
+
+Package: kamailio-cpl-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: CPL module (CPL interpreter engine) for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides a CPL (Call Processing Language) interpreter for
+ Kamailio, turning Kamailio into a CPL server (storage and interpreter).
+
+Package: kamailio-radius-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: radius modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides a set of Radius modules for Kamailio, for
+ authentication, peering, group membership and messages URIs checking
+ against a Radius Server.
+
+Package: kamailio-unixodbc-module 
+Architecture: any 
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: unixODBC database connectivity module for Kamailio 
+ Kamailio is a very fast and flexible SIP (RFC3261) 
+ proxy server. Written entirely in C, Kamailio can handle thousands calls 
+ per second even on low-budget hardware. 
+ . 
+ This package provides the unixODBC database driver for Kamailio. 
+
+Package: kamailio-presence-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: SIMPLE presence modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides several Kamailio modules for implementing presence
+ server and presence user agent for RICH presence, registrar-based presence,
+ external triggered presence and XCAP support.
+
+Package: kamailio-xmlrpc-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: XMLRPC support for Kamailio's Management Interface
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the XMLRPC transport implementation for Kamailio's
+ Management Interface.
+
+Package: kamailio-perl-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Replaces: kamailio-perl-module
+Conflicts: kamailio-perl-module
+Description: Perl extensions and database driver for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides an interface for Kamailio to write Perl extensions and
+ the perlvdb database driver for Kamailio.
+
+Package: kamailio-snmpstats-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), snmpd
+Description: SNMP AgentX subagent module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the snmpstats module for Kamailio. This module acts
+ as an AgentX subagent which connects to a master agent.
+
+Package: kamailio-xmpp-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: XMPP gateway module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the SIP to XMPP IM translator module for Kamailio.
+
+Package: kamailio-carrierroute-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Carrierroute module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the carrierroute module for Kamailio, an integrated
+ solution for routing, balancing and blacklisting.
+
+Package: kamailio-berkeley-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), db4.6-util
+Description: Berkeley Database module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the berkeley database module for Kamailio, a
+ high-performance embedded DB kernel. All database tables are stored
+ in files, no additional server is necessary.
+
+Package: kamailio-ldap-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: LDAP modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the ldap and h350 modules for Kamailio, enabling LDAP
+ queries from the Kamailio config and storage of SIP account data in an LDAP
+ directory.
+
+Package: kamailio-utils-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides a set utility functions for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ Provides a set of utility functions for Kamailio, which are not related
+ to the server configuration.
+
+Package: kamailio-regex-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the lcr, diaplan and regex modules
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ Contains the lcr, diaplan and regex modules that depends on the pcre library.
+
+Package: kamailio-purple-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the purple module, a multi-protocol IM gateway
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the purple module, a multi-protocol instant
+ messaging gateway module.
+
+Package: kamailio-memcached-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the memcached module, an interface to the memcached server
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the memcached module, an interface to the memcached
+ server, a high-performance, distributed memory object caching system.

+ 27 - 0
pkg/kamailio/debian-lenny/copyright

@@ -0,0 +1,27 @@
+This package was debianized by Andrei Pelinescu-Onciul
+<[email protected]> on Tue, 16 Jul 2002 15:41:31 +0200.
+This package was debianized by Julien BLACHE <[email protected]>
+on Thu, 29 Jun 2006 09:55:24 +0200, based on Andrei's work.
+
+It was downloaded from: http://kamailio.org
+
+Upstream Authors:
+       Andrei Pelinescu-Onciul <[email protected]>
+       Bogdan-Andrei Iancu <[email protected]>
+       Daniel-Constantin Mierla <[email protected]>
+       Jan Janak <[email protected]>
+       Jiri Kuthan <[email protected]>
+       Juha Heinanen
+       Ramona-Elena Modroiu
+       Maxim Sobolev
+       Miklos Tirpak
+       Nils Ohlmeier
+       and others ; see the AUTHORS file in the source code tree for details
+
+This software is copyright (c) 2002-2003 by FhG Fokus
+
+You are free to distribute this software under the terms of
+the GNU General Public License.
+
+On Debian systems, the complete text of the GNU General Public
+License can be found in the file `/usr/share/common-licenses/GPL.

+ 38 - 0
pkg/kamailio/debian-lenny/kamailio.README.Debian

@@ -0,0 +1,38 @@
+Kamailio for Debian
+------------------
+
+* init script check for fork=no
+-------------------------------
+
+The Kamailio init script will not start Kamailio on boot if fork=no is
+specified in the config file. The check in the initscript will match
+any occurrence of fork=no in the file, even inside C-style comments.
+
+You can disable this check in the init script if you wish; just comment
+out the calls to the check_fork function in the script. Your changes to
+the init script will be preserved upon upgrade, as the file is tagged
+as a conffile.
+
+
+* Kamailio setup
+---------------
+
+To setup Kamailio, you need to:
+ - configure Kamailio properly to suit your needs
+ - edit /etc/default/kamailio, adjust the MEMORY parameter and set
+   RUN_KAMAILIO to "yes"
+
+If you are building an HA cluster using heartbeat or similar, you'll want
+to disable the init script by running:
+
+  update-rc.d kamailio remove
+
+so that Kamailio will not be launched at system startup. You still need
+to set RUN_KAMAILIO to "yes" if you want to use the /etc/init.d/kamailio init
+script.
+
+Set the DUMP_CORE parameter in /etc/default/kamailio to "yes" if you want to
+get a core dump in case Kamailio crashes. The debug symbols for Kamailio are
+provided by the kamailio-dbg package.
+
+-- Julien BLACHE <[email protected]>, Fri, 08 Sep 2006 14:43:21 +0200

+ 24 - 0
pkg/kamailio/debian-lenny/kamailio.default

@@ -0,0 +1,24 @@
+#
+# Kamailio startup options
+#
+
+# Set to yes to enable kamailio, once configured properly.
+RUN_KAMAILIO=no
+
+# User to run as
+USER=kamailio
+
+# Group to run as
+GROUP=kamailio
+
+# Amount of memory to allocate for the running Kamailio server (in Mb)
+MEMORY=64
+
+# Enable the server to leave a core file when it crashes.
+# Set this to 'yes' to enable Kamailio to leave a core file when it crashes
+# or 'no' to disable this feature. This option is case sensitive and only
+# accepts 'yes' and 'no' and only in lowercase letters.
+# On some systems (e.g. Ubuntu 6.10, Debian 4.0) it is necessary to specify
+# a directory for the core files to get a dump. Look into the kamailio
+# init file for an example configuration.
+DUMP_CORE=no

+ 2 - 0
pkg/kamailio/debian-lenny/kamailio.dirs

@@ -0,0 +1,2 @@
+var/run/kamailio
+

+ 2 - 0
pkg/kamailio/debian-lenny/kamailio.examples

@@ -0,0 +1,2 @@
+examples/*
+

+ 170 - 0
pkg/kamailio/debian-lenny/kamailio.init

@@ -0,0 +1,170 @@
+#! /bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          kamailio
+# Required-Start:    $syslog $network $local_fs $time
+# Required-Stop:     $syslog $network $local_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start the Kamailio SIP proxy server
+# Description:       Start the Kamailio SIP proxy server
+### END INIT INFO
+#
+# TODO:
+# The following fields should be added (and completed):
+# Should-Start:      postgresql mysql radius
+# Should-Stop:       postgresql mysql radius
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/kamailio
+NAME=kamailio
+DESC=kamailio
+HOMEDIR=/var/run/kamailio
+PIDFILE=$HOMEDIR/$NAME.pid
+DEFAULTS=/etc/default/kamailio
+RUN_KAMAILIO=no
+
+# Do not start kamailio if fork=no is set in the config file
+# otherwise the boot process will just stop
+check_fork ()
+{
+    if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/kamailio/kamailio.cfg; then
+	echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
+	exit 1
+    fi
+}
+
+check_kamailio_config ()
+{
+	# Check if kamailio configuration is valid before starting the server
+	set +e
+	out=$($DAEMON -c 2>&1 > /dev/null)
+	retcode=$?
+	set -e
+	if [ "$retcode" != '0' ]; then
+	    echo "Not starting $DESC: invalid configuration file!"
+	    echo -e "\n$out\n"
+	    exit 1
+	fi
+}
+
+check_homedir ()
+{
+    # Create HOMEDIR directory in case it doesn't exist
+    if [ ! -d $HOMEDIR ]; then
+        mkdir $HOMEDIR
+    fi
+
+    # Set the appropiate owner and group
+    chown ${USER}:${GROUP} $HOMEDIR
+}
+
+
+create_radius_seqfile ()
+{
+    # Create a radius sequence file to be used by the radius client if
+    # radius accounting is enabled. This is needed to avoid any issue
+    # with the file not being writable if kamailio first starts as user
+    # root because DUMP_CORE is enabled and creates this file as user
+    # root and then later it switches back to user kamailio and cannot
+    # write to the file. If the file exists before kamailio starts, it
+    # won't change it's ownership and will be writable for both root
+    # and kamailio, no matter what options are chosen at install time
+    RADIUS_SEQ_FILE=$HOMEDIR/kamailio_radius.seq
+
+    if [ ! -f $RADIUS_SEQ_FILE ]; then
+        touch $RADIUS_SEQ_FILE
+    fi
+
+    chown ${USER}:${GROUP} $RADIUS_SEQ_FILE
+    chmod 660 $RADIUS_SEQ_FILE
+}
+
+test -f $DAEMON || exit 0
+
+# Load startup options if available
+if [ -f $DEFAULTS ]; then
+   . $DEFAULTS || true
+fi
+
+if [ "$RUN_KAMAILIO" != "yes" ]; then
+    echo "Kamailio not yet configured. Edit /etc/default/kamailio first."
+    exit 0
+fi
+
+set -e
+
+MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+[ -z "$USER" ]  && USER=kamailio
+[ -z "$GROUP" ] && GROUP=kamailio
+[ $MEMORY -le 0 ] && MEMORY=32
+
+if test "$DUMP_CORE" = "yes" ; then
+    # set proper ulimit
+    ulimit -c unlimited
+    
+    # directory for the core dump files
+    # COREDIR=/home/corefiles
+    # [ -d $COREDIR ] || mkdir $COREDIR
+    # chmod 777 $COREDIR
+    # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
+fi
+
+OPTIONS="-P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+
+case "$1" in
+  start|debug)
+	check_kamailio_config
+	check_homedir
+	create_radius_seqfile
+
+	if [ "$1" != "debug" ]; then
+	    check_fork
+	fi
+
+	echo -n "Starting $DESC: $NAME"
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+		--exec $DAEMON -- $OPTIONS || echo -n " already running"
+	echo "."
+	;;
+  stop)
+	echo -n "Stopping $DESC: $NAME"
+	start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
+		--exec $DAEMON
+	echo "."
+	;;
+  restart|force-reload)
+	check_kamailio_config
+	check_homedir
+	create_radius_seqfile
+
+	echo -n "Restarting $DESC: $NAME"
+	start-stop-daemon --oknodo --stop --quiet --pidfile \
+		$PIDFILE --exec $DAEMON
+	sleep 1
+	start-stop-daemon --start --quiet --pidfile \
+		$PIDFILE --exec $DAEMON  -- $OPTIONS
+	echo "."
+	;;
+  status)
+	echo -n "Status of $DESC: "
+	if [ ! -r "$PIDFILE" ]; then
+		echo "$NAME is not running."
+		exit 3
+	fi
+	if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
+		echo "$NAME is running."
+		exit 0
+	else
+		echo "$NAME is not running but $PIDFILE exists."
+		exit 1
+	fi
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart|force-reload|debug|status}" >&2
+	exit 1
+	;;
+esac
+
+exit 0

+ 48 - 0
pkg/kamailio/debian-lenny/kamailio.postinst

@@ -0,0 +1,48 @@
+#! /bin/sh
+#
+# $Id$
+
+PKG=kamailio
+DEFAULTS=/etc/default/kamailio
+HOMEDIR=/var/run/kamailio
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+        adduser --quiet --system --group --disabled-password \
+                --shell /bin/false --gecos "Kamailio" \
+                --home $HOMEDIR kamailio || true
+
+        ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+        ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+        ;;
+esac
+
+#DEBHELPER#
+

+ 3 - 0
pkg/kamailio/debian-lenny/patches/00list

@@ -0,0 +1,3 @@
+10_no_lib64_on_64_bits
+11_always_smp
+

+ 27 - 0
pkg/kamailio/debian-lenny/patches/10_no_lib64_on_64_bits.dpatch

@@ -0,0 +1,27 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 10_no_lib64_on_64_bits.dpatch by  <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Debian uses /usr/lib even for 64bit architectures.
+
+@DPATCH@
+diff -urNad kamailio-1.2.0~/Makefile.defs kamailio-1.2.0/Makefile.defs
+--- kamailio-1.2.0~/Makefile.defs	2007-02-24 12:35:45.000000000 +0100
++++ kamailio-1.2.0/Makefile.defs	2007-02-24 16:26:45.886854110 +0100
+@@ -123,14 +123,12 @@
+ bin-dir = sbin/
+ 
+ ARCH_B= $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/')
+-ifeq ($(ARCH_B),64b)
+-	LIBDIR ?= lib64
+-else
+-	LIBDIR ?= lib
++ifneq ($(ARCH_B),64b)
+ 	# assume 32b - it is not really used further
+ 	ARCH_B=32b
+ endif
+ 
++LIBDIR ?= lib
+ lib-dir = $(LIBDIR)/$(MAIN_NAME)
+ modules-dir = $(LIBDIR)/$(MAIN_NAME)/modules/
+ 

+ 24 - 0
pkg/kamailio/debian-lenny/patches/11_always_smp.dpatch

@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 11_always_smp.dpatch by  <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Always build for SMP.
+
+@DPATCH@
+diff -urNad kamailio-1.2.0~/Makefile.defs kamailio-1.2.0/Makefile.defs
+--- kamailio-1.2.0~/Makefile.defs	2007-02-24 16:28:43.152825070 +0100
++++ kamailio-1.2.0/Makefile.defs	2007-02-24 16:28:46.123102964 +0100
+@@ -82,12 +82,7 @@
+ 	endif
+ endif
+ 
+-SMP_STR = $(shell uname -v | grep -i "SMP")
+-ifeq (,$(SMP_STR))
+-	ISSMP=no
+-else
+-	ISSMP=yes
+-endif
++ISSMP=yes
+ 
+ OSREL = $(shell uname -r)
+ # numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)

+ 374 - 0
pkg/kamailio/debian-lenny/rules

@@ -0,0 +1,374 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+
+ALL_PACKAGES = kamailio kamailio-mysql-module kamailio-postgres-module \
+	kamailio-jabber-module kamailio-cpl-module kamailio-radius-modules \
+	kamailio-unixodbc-module kamailio-presence-modules kamailio-xmlrpc-module \
+	kamailio-perl-modules kamailio-snmpstats-module kamailio-xmpp-module \
+	kamailio-carrierroute-module kamailio-berkeley-module kamailio-ldap-modules \
+	kamailio-utils-module kamailio-regex-modules kamailio-purple-module \
+	kamailio-memcached-module
+
+DEBVERSION:=$(shell head -n 1 debian/changelog \
+                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
+UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//')
+
+FILENAME := kamailio_$(UPVERSION).orig.tar.gz
+UPFILENAME := kamailio-$(UPVERSION)-tls_src.tar.gz
+URL := http://kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)-tls_src.tar.gz
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+# Include dpatch rules
+include /usr/share/dpatch/dpatch.make
+
+
+# Do we want the TLS version ?
+# Disabled by default due to license issues, set to non-void to enable
+TLS=
+
+# modules depending on mysql
+MYSQL_MODULES = db_mysql
+# modules depending on postgres
+POSTGRES_MODULES = db_postgres
+# modules depending on unixODBC
+UNIXODBC_MODULES=db_unixodbc
+# jabber module
+JABBER_MODULES = jabber
+# cpl related modules
+CPL_MODULES = cpl-c
+# module depending on radiusclient
+RADIUS_MODULES = auth_radius misc_radius peering
+# presence related modules
+PRESENCE_MODULES = presence presence_xml presence_mwi presence_dialoginfo pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo xcap_client rls
+# XMLRPC module
+XMLRPC_MODULES = mi_xmlrpc
+# Perl module
+PERL_MODULES = perl perlvdb
+# SNMPstats module
+SNMPSTATS_MODULES = snmpstats
+# XMPP module
+XMPP_MODULES = xmpp
+# Carrierroute module
+CROUTE_MODULES = carrierroute
+# Berkeley DB module
+BERKELEY_MODULES = db_berkeley
+# LDAP modules
+LDAP_MODULES = ldap h350
+# utils module
+UTILS_MODULES = utils
+# modules depending on libpcre
+REGEX_MODULES = dialplan regex lcr
+# purple module
+PURPLE_MODULES = purple
+# memcached module
+MEMCACHED_MODULES = memcached
+
+ALL_MODULES = $(MYSQL_MODULES) $(POSTGRES_MODULES) $(UNIXODBC_MODULES) $(JABBER_MODULES) $(CPL_MODULES) $(RADIUS_MODULES) $(PRESENCE_MODULES) $(XMLRPC_MODULES) $(PERL_MODULES) $(SNMPSTATS_MODULES) $(XMPP_MODULES) $(CROUTE_MODULES) $(BERKELEY_MODULES) $(LDAP_MODULES) $(UTILS_MODULES) $(REGEX_MODULES) $(PURPLE_MODULES) $(MEMCACHED_MODULES)
+
+# modules not in the "main" package or unstable modules
+EXCLUDED_MODULES = $(ALL_MODULES) pa osp
+
+# the same but with path prepended (needed for modules="...")
+MYSQL_MOD_PATH=$(addprefix modules/, $(MYSQL_MODULES))
+POSTGRES_MOD_PATH=$(addprefix modules/, $(POSTGRES_MODULES))
+UNIXODBC_MOD_PATH=$(addprefix modules/, $(UNIXODBC_MODULES))
+JABBER_MOD_PATH=$(addprefix modules/, $(JABBER_MODULES))
+CPL_MOD_PATH=$(addprefix modules/, $(CPL_MODULES))
+RADIUS_MOD_PATH=$(addprefix modules/, $(RADIUS_MODULES))
+PRESENCE_MOD_PATH=$(addprefix modules/, $(PRESENCE_MODULES))
+XMLRPC_MOD_PATH=$(addprefix modules/, $(XMLRPC_MODULES))
+PERL_MOD_PATH=$(addprefix modules/, $(PERL_MODULES))
+SNMPSTATS_MOD_PATH=$(addprefix modules/, $(SNMPSTATS_MODULES))
+XMPP_MOD_PATH=$(addprefix modules/, $(XMPP_MODULES))
+CROUTE_MOD_PATH=$(addprefix modules/, $(CROUTE_MODULES))
+BERKELEY_MOD_PATH=$(addprefix modules/, $(BERKELEY_MODULES))
+LDAP_MOD_PATH=$(addprefix modules/, $(LDAP_MODULES))
+UTILS_MOD_PATH=$(addprefix modules/, $(UTILS_MODULES))
+REGEX_MOD_PATH=$(addprefix modules/, $(REGEX_MODULES))
+PURPLE_MOD_PATH=$(addprefix modules/, $(PURPLE_MODULES))
+MEMCACHED_MOD_PATH=$(addprefix modules/, $(MEMCACHED_MODULES))
+
+ifeq (cc, $(CC))
+	CC = gcc
+endif
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+        CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+build-stamp: patch-stamp configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) all skip_modules="$(EXCLUDED_MODULES)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(MYSQL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(POSTGRES_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(UNIXODBC_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(JABBER_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(CPL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(RADIUS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PRESENCE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(XMLRPC_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PERL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(SNMPSTATS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(XMPP_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(CROUTE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(BERKELEY_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(LDAP_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(UTILS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(REGEX_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PURPLE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(MEMCACHED_MOD_PATH)" cfg-target=/etc/kamailio/
+
+	# generate the utils db_berkeley
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) utils include_modules="db_berkeley"
+
+	# generate the man pages for modules
+	$(MAKE) modules-docbook-man include_modules="$(ALL_MODULES)"
+
+	touch build-stamp
+
+clean: real-clean unpatch
+real-clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	$(MAKE) TLS=$(TLS) include_modules="$(ALL_MODULES)" proper
+	rm -f cfg.tab.h
+	rm -f utils/kamunix/kamunix.o utils/kamunix/kamunix
+	rm -f utils/db_berkeley/kambdb_recover.o utils/db_berkeley/kambdb_recover
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/kamailio
+	# kamailio base package
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install skip_modules="$(EXCLUDED_MODULES)" \
+		basedir=$(CURDIR)/debian/kamailio \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio
+
+	find $(CURDIR)/debian/kamailio/etc/kamailio -type f -exec chmod -x {} \;
+	sed -i -e "s/^PATH.*//" $(CURDIR)/debian/kamailio/usr/sbin/kamctl
+
+	# install only the mysql module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(MYSQL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-mysql-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-mysql-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-mysql-module
+
+	# install only the postgres module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(POSTGRES_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-postgres-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-postgres-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-postgres-module
+
+	# install only the unixodbc module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(UNIXODBC_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-unixodbc-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-unixodbc-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-unixodbc-module
+
+	# install only the jabber module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(JABBER_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-jabber-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-jabber-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-jabber-module
+
+	# install only the cpl module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(CPL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-cpl-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-cpl-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-cpl-module
+
+	# install only the radius modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(RADIUS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-radius-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-radius-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-radius-modules
+
+	# install only the presence modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PRESENCE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-presence-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-presence-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-presence-modules
+
+	# install only the xmlrpc module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(XMLRPC_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-xmlrpc-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-xmlrpc-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-xmlrpc-module
+
+	# install only the perl modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PERL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-perl-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-perl-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-perl-modules
+
+	# install only the snmpstats module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(SNMPSTATS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-snmpstats-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-snmpstats-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-snmpstats-module
+
+	# install only the xmpp module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(XMPP_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-xmpp-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-xmpp-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-xmpp-module
+
+	# install only the carrierroute module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(CROUTE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-carrierroute-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-carrierroute-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-carrierroute-module
+
+	# install only the db_berkeley module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(BERKELEY_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-berkeley-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-berkeley-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-berkeley-module
+
+	# install only the ldap modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(LDAP_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-ldap-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-ldap-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-ldap-modules
+
+	# install only the utils modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(UTILS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-utils-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-utils-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-utils-module
+
+	# install only the regex modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(REGEX_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-regex-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-regex-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-regex-modules
+
+	# install only the purple modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PURPLE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-purple-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-purple-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-purple-module
+
+	# install only the memcached modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(MEMCACHED_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-memcached-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-memcached-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-memcached-module
+
+	# the modules packages all ship an empty /usr/sbin directory, let's clean that up
+	for p in $(ALL_PACKAGES); \
+		do rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/$$p/usr/sbin; done
+
+# This single target is used to build all the packages, all at once, or
+# one at a time. So keep in mind: any options passed to commands here will
+# affect _all_ packages. Anything you want to only affect one package
+# should be put in another target, such as the install target.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples --exclude=".svn"
+#	dh_installlogrotate
+	dh_installinit -pkamailio -- defaults 23
+	dh_installcron
+	dh_installman
+	dh_installinfo
+	dh_installchangelogs
+	dh_link
+	dh_strip --dbg-package=kamailio-dbg
+	dh_compress 
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+# Build architecture-independent packages using the common target
+binary-indep: build install
+# We have nothing to do by default.
+
+binary: binary-indep binary-arch
+
+print-version:
+	@@echo "Debian version:          $(DEBVERSION)"
+	@@echo "Upstream version:        $(UPVERSION)"
+
+get-orig-source:
+	@@dh_testdir
+	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
+	@@echo Downloading $(FILENAME) from $(URL) ...
+	@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
+
+.PHONY: build clean binary-indep binary-arch binary install configure patch unpatch real-clean

+ 14 - 0
pkg/kamailio/debian/changelog

@@ -0,0 +1,14 @@
+kamailio (1.5.0-svn1) unstable; urgency=low
+
+  * increment debian packaging for trunk
+
+ -- Henning Westerholt <[email protected]>  Mon, 02 Mar 2009 17:40:02 +0100
+
+kamailio (1.4.0-svn1) unstable; urgency=low
+
+  [ Klaus Darilion ]
+  * first release of Kamailio (after renaming from Openser)
+
+ -- Julien BLACHE <[email protected]>  Wed, 12 Dec 2007 17:25:31 +0100
+
+

+ 1 - 0
pkg/kamailio/debian/compat

@@ -0,0 +1 @@
+5

+ 242 - 0
pkg/kamailio/debian/control

@@ -0,0 +1,242 @@
+Source: kamailio
+Section: net
+Priority: optional
+Maintainer: Debian VoIP Team <[email protected]>
+Uploaders: Kilian Krause <[email protected]>
+Build-Depends: debhelper (>= 5), dpatch, libmysqlclient15-dev, libexpat1-dev, libxml2-dev, libpq-dev, libradiusclient-ng-dev, flex, bison, zlib1g-dev, unixodbc-dev, libxmlrpc-c3-dev, libperl-dev, libsnmp-dev, dpkg-dev (>= 1.13.19), libdb-dev (>= 4.6.19), xsltproc, libconfuse-dev, libldap2-dev, libcurl4-gnutls-dev, python, libpcre3-dev, docbook-xml, libpurple-dev, libmemcache-dev
+Standards-Version: 3.8.0
+Homepage: http://www.kamailio.org/
+Vcs-Svn: svn://svn.debian.org/pkg-voip/kamailio/trunk/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/kamailio/?op=log
+
+Package: kamailio
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
+Suggests: kamailio-mysql-module, kamailio-postgres-module, kamailio-unixodbc-module, kamailio-jabber-module, kamailio-cpl-module, kamailio-radius-modules, kamailio-presence-modules, kamailio-xmlrpc-module, kamailio-perl-modules, kamailio-snmpstats-module, kamailio-xmpp-module, kamailio-carrierroute-module, kamailio-berkeley-module, kamailio-ldap-modules
+Description: very fast and configurable SIP proxy
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ C Shell-like scripting language provides full control over the server's
+ behaviour. Its modular architecture allows only required functionality to be
+ loaded.
+ .
+ Among others, the following modules are available: Digest Authentication, CPL
+ scripts, Instant Messaging, MySQL support, Presence Agent, Radius
+ Authentication, Record Routing, SMS Gateway, Jabber/XMPP Gateway, Transaction
+ Module, Registrar and User Location, XMLRPC Interface.
+ .
+ This package contains the main Kamailio binary along with the principal modules
+ and support binaries.
+
+Package: kamailio-dbg
+Priority: extra
+Architecture: any
+Depends: kamailio (= ${binary:Version})
+Conflicts: kamailio (<< ${binary:Version})
+Description: very fast and configurable SIP proxy [debug symbols]
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package contains the debugging symbols for the Kamailio binaries and
+ modules. You only need to install it if you need to debug Kamailio.
+
+Package: kamailio-mysql-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), mysql-client
+Description: MySQL database connectivity module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the MySQL database driver for Kamailio.
+
+Package: kamailio-postgres-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), postgresql-client
+Description: PostgreSQL database connectivity module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the PostgreSQL database driver for Kamailio.
+
+Package: kamailio-jabber-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Jabber gateway module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the SIP to Jabber translator module for Kamailio.
+
+Package: kamailio-cpl-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: CPL module (CPL interpreter engine) for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides a CPL (Call Processing Language) interpreter for
+ Kamailio, turning Kamailio into a CPL server (storage and interpreter).
+
+Package: kamailio-radius-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: radius modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides a set of Radius modules for Kamailio, for
+ authentication, peering, group membership and messages URIs checking
+ against a Radius Server.
+
+Package: kamailio-unixodbc-module 
+Architecture: any 
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: unixODBC database connectivity module for Kamailio 
+ Kamailio is a very fast and flexible SIP (RFC3261) 
+ proxy server. Written entirely in C, Kamailio can handle thousands calls 
+ per second even on low-budget hardware. 
+ . 
+ This package provides the unixODBC database driver for Kamailio. 
+
+Package: kamailio-presence-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: SIMPLE presence modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides several Kamailio modules for implementing presence
+ server and presence user agent for RICH presence, registrar-based presence,
+ external triggered presence and XCAP support.
+
+Package: kamailio-xmlrpc-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: XMLRPC support for Kamailio's Management Interface
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the XMLRPC transport implementation for Kamailio's
+ Management Interface.
+
+Package: kamailio-perl-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Replaces: kamailio-perl-module
+Conflicts: kamailio-perl-module
+Description: Perl extensions and database driver for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides an interface for Kamailio to write Perl extensions and
+ the perlvdb database driver for Kamailio.
+
+Package: kamailio-snmpstats-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), snmpd
+Description: SNMP AgentX subagent module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the snmpstats module for Kamailio. This module acts
+ as an AgentX subagent which connects to a master agent.
+
+Package: kamailio-xmpp-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: XMPP gateway module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the SIP to XMPP IM translator module for Kamailio.
+
+Package: kamailio-carrierroute-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Carrierroute module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the carrierroute module for Kamailio, an integrated
+ solution for routing, balancing and blacklisting.
+
+Package: kamailio-berkeley-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}), db4.6-util
+Description: Berkeley Database module for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the berkeley database module for Kamailio, a
+ high-performance embedded DB kernel. All database tables are stored
+ in files, no additional server is necessary.
+
+Package: kamailio-ldap-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: LDAP modules for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the ldap and h350 modules for Kamailio, enabling LDAP
+ queries from the Kamailio config and storage of SIP account data in an LDAP
+ directory.
+
+Package: kamailio-utils-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides a set utility functions for Kamailio
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ Provides a set of utility functions for Kamailio, which are not related
+ to the server configuration.
+
+Package: kamailio-regex-modules
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the lcr, diaplan and regex modules
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ Contains the lcr, diaplan and regex modules that depends on the pcre library.
+
+Package: kamailio-purple-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the purple module, a multi-protocol IM gateway
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the purple module, a multi-protocol instant
+ messaging gateway module.
+
+Package: kamailio-memcached-module
+Architecture: any
+Depends: ${shlibs:Depends}, kamailio (= ${binary:Version})
+Description: Provides the memcached module, an interface to the memcached server
+ Kamailio is a very fast and flexible SIP (RFC3261)
+ proxy server. Written entirely in C, Kamailio can handle thousands calls
+ per second even on low-budget hardware.
+ .
+ This package provides the memcached module, an interface to the memcached
+ server, a high-performance, distributed memory object caching system.

+ 27 - 0
pkg/kamailio/debian/copyright

@@ -0,0 +1,27 @@
+This package was debianized by Andrei Pelinescu-Onciul
+<[email protected]> on Tue, 16 Jul 2002 15:41:31 +0200.
+This package was debianized by Julien BLACHE <[email protected]>
+on Thu, 29 Jun 2006 09:55:24 +0200, based on Andrei's work.
+
+It was downloaded from: http://kamailio.org
+
+Upstream Authors:
+       Andrei Pelinescu-Onciul <[email protected]>
+       Bogdan-Andrei Iancu <[email protected]>
+       Daniel-Constantin Mierla <[email protected]>
+       Jan Janak <[email protected]>
+       Jiri Kuthan <[email protected]>
+       Juha Heinanen
+       Ramona-Elena Modroiu
+       Maxim Sobolev
+       Miklos Tirpak
+       Nils Ohlmeier
+       and others ; see the AUTHORS file in the source code tree for details
+
+This software is copyright (c) 2002-2003 by FhG Fokus
+
+You are free to distribute this software under the terms of
+the GNU General Public License.
+
+On Debian systems, the complete text of the GNU General Public
+License can be found in the file `/usr/share/common-licenses/GPL.

+ 38 - 0
pkg/kamailio/debian/kamailio.README.Debian

@@ -0,0 +1,38 @@
+Kamailio for Debian
+------------------
+
+* init script check for fork=no
+-------------------------------
+
+The Kamailio init script will not start Kamailio on boot if fork=no is
+specified in the config file. The check in the initscript will match
+any occurrence of fork=no in the file, even inside C-style comments.
+
+You can disable this check in the init script if you wish; just comment
+out the calls to the check_fork function in the script. Your changes to
+the init script will be preserved upon upgrade, as the file is tagged
+as a conffile.
+
+
+* Kamailio setup
+---------------
+
+To setup Kamailio, you need to:
+ - configure Kamailio properly to suit your needs
+ - edit /etc/default/kamailio, adjust the MEMORY parameter and set
+   RUN_KAMAILIO to "yes"
+
+If you are building an HA cluster using heartbeat or similar, you'll want
+to disable the init script by running:
+
+  update-rc.d kamailio remove
+
+so that Kamailio will not be launched at system startup. You still need
+to set RUN_KAMAILIO to "yes" if you want to use the /etc/init.d/kamailio init
+script.
+
+Set the DUMP_CORE parameter in /etc/default/kamailio to "yes" if you want to
+get a core dump in case Kamailio crashes. The debug symbols for Kamailio are
+provided by the kamailio-dbg package.
+
+-- Julien BLACHE <[email protected]>, Fri, 08 Sep 2006 14:43:21 +0200

+ 24 - 0
pkg/kamailio/debian/kamailio.default

@@ -0,0 +1,24 @@
+#
+# Kamailio startup options
+#
+
+# Set to yes to enable kamailio, once configured properly.
+RUN_KAMAILIO=no
+
+# User to run as
+USER=kamailio
+
+# Group to run as
+GROUP=kamailio
+
+# Amount of memory to allocate for the running Kamailio server (in Mb)
+MEMORY=64
+
+# Enable the server to leave a core file when it crashes.
+# Set this to 'yes' to enable Kamailio to leave a core file when it crashes
+# or 'no' to disable this feature. This option is case sensitive and only
+# accepts 'yes' and 'no' and only in lowercase letters.
+# On some systems (e.g. Ubuntu 6.10, Debian 4.0) it is necessary to specify
+# a directory for the core files to get a dump. Look into the kamailio
+# init file for an example configuration.
+DUMP_CORE=no

+ 2 - 0
pkg/kamailio/debian/kamailio.dirs

@@ -0,0 +1,2 @@
+var/run/kamailio
+

+ 2 - 0
pkg/kamailio/debian/kamailio.examples

@@ -0,0 +1,2 @@
+examples/*
+

+ 170 - 0
pkg/kamailio/debian/kamailio.init

@@ -0,0 +1,170 @@
+#! /bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          kamailio
+# Required-Start:    $syslog $network $local_fs $time
+# Required-Stop:     $syslog $network $local_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start the Kamailio SIP proxy server
+# Description:       Start the Kamailio SIP proxy server
+### END INIT INFO
+#
+# TODO:
+# The following fields should be added (and completed):
+# Should-Start:      postgresql mysql radius
+# Should-Stop:       postgresql mysql radius
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/kamailio
+NAME=kamailio
+DESC=kamailio
+HOMEDIR=/var/run/kamailio
+PIDFILE=$HOMEDIR/$NAME.pid
+DEFAULTS=/etc/default/kamailio
+RUN_KAMAILIO=no
+
+# Do not start kamailio if fork=no is set in the config file
+# otherwise the boot process will just stop
+check_fork ()
+{
+    if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/kamailio/kamailio.cfg; then
+	echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
+	exit 1
+    fi
+}
+
+check_kamailio_config ()
+{
+	# Check if kamailio configuration is valid before starting the server
+	set +e
+	out=$($DAEMON -c 2>&1 > /dev/null)
+	retcode=$?
+	set -e
+	if [ "$retcode" != '0' ]; then
+	    echo "Not starting $DESC: invalid configuration file!"
+	    echo -e "\n$out\n"
+	    exit 1
+	fi
+}
+
+check_homedir ()
+{
+    # Create HOMEDIR directory in case it doesn't exist
+    if [ ! -d $HOMEDIR ]; then
+        mkdir $HOMEDIR
+    fi
+
+    # Set the appropiate owner and group
+    chown ${USER}:${GROUP} $HOMEDIR
+}
+
+
+create_radius_seqfile ()
+{
+    # Create a radius sequence file to be used by the radius client if
+    # radius accounting is enabled. This is needed to avoid any issue
+    # with the file not being writable if kamailio first starts as user
+    # root because DUMP_CORE is enabled and creates this file as user
+    # root and then later it switches back to user kamailio and cannot
+    # write to the file. If the file exists before kamailio starts, it
+    # won't change it's ownership and will be writable for both root
+    # and kamailio, no matter what options are chosen at install time
+    RADIUS_SEQ_FILE=$HOMEDIR/kamailio_radius.seq
+
+    if [ ! -f $RADIUS_SEQ_FILE ]; then
+        touch $RADIUS_SEQ_FILE
+    fi
+
+    chown ${USER}:${GROUP} $RADIUS_SEQ_FILE
+    chmod 660 $RADIUS_SEQ_FILE
+}
+
+test -f $DAEMON || exit 0
+
+# Load startup options if available
+if [ -f $DEFAULTS ]; then
+   . $DEFAULTS || true
+fi
+
+if [ "$RUN_KAMAILIO" != "yes" ]; then
+    echo "Kamailio not yet configured. Edit /etc/default/kamailio first."
+    exit 0
+fi
+
+set -e
+
+MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+[ -z "$USER" ]  && USER=kamailio
+[ -z "$GROUP" ] && GROUP=kamailio
+[ $MEMORY -le 0 ] && MEMORY=32
+
+if test "$DUMP_CORE" = "yes" ; then
+    # set proper ulimit
+    ulimit -c unlimited
+    
+    # directory for the core dump files
+    # COREDIR=/home/corefiles
+    # [ -d $COREDIR ] || mkdir $COREDIR
+    # chmod 777 $COREDIR
+    # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
+fi
+
+OPTIONS="-P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+
+case "$1" in
+  start|debug)
+	check_kamailio_config
+	check_homedir
+	create_radius_seqfile
+
+	if [ "$1" != "debug" ]; then
+	    check_fork
+	fi
+
+	echo -n "Starting $DESC: $NAME"
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+		--exec $DAEMON -- $OPTIONS || echo -n " already running"
+	echo "."
+	;;
+  stop)
+	echo -n "Stopping $DESC: $NAME"
+	start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
+		--exec $DAEMON
+	echo "."
+	;;
+  restart|force-reload)
+	check_kamailio_config
+	check_homedir
+	create_radius_seqfile
+
+	echo -n "Restarting $DESC: $NAME"
+	start-stop-daemon --oknodo --stop --quiet --pidfile \
+		$PIDFILE --exec $DAEMON
+	sleep 1
+	start-stop-daemon --start --quiet --pidfile \
+		$PIDFILE --exec $DAEMON  -- $OPTIONS
+	echo "."
+	;;
+  status)
+	echo -n "Status of $DESC: "
+	if [ ! -r "$PIDFILE" ]; then
+		echo "$NAME is not running."
+		exit 3
+	fi
+	if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
+		echo "$NAME is running."
+		exit 0
+	else
+		echo "$NAME is not running but $PIDFILE exists."
+		exit 1
+	fi
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart|force-reload|debug|status}" >&2
+	exit 1
+	;;
+esac
+
+exit 0

+ 48 - 0
pkg/kamailio/debian/kamailio.postinst

@@ -0,0 +1,48 @@
+#! /bin/sh
+#
+# $Id$
+
+PKG=kamailio
+DEFAULTS=/etc/default/kamailio
+HOMEDIR=/var/run/kamailio
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    configure)
+        adduser --quiet --system --group --disabled-password \
+                --shell /bin/false --gecos "Kamailio" \
+                --home $HOMEDIR kamailio || true
+
+        ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+        ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+        ;;
+esac
+
+#DEBHELPER#
+

+ 3 - 0
pkg/kamailio/debian/patches/00list

@@ -0,0 +1,3 @@
+10_no_lib64_on_64_bits
+11_always_smp
+

+ 27 - 0
pkg/kamailio/debian/patches/10_no_lib64_on_64_bits.dpatch

@@ -0,0 +1,27 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 10_no_lib64_on_64_bits.dpatch by  <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Debian uses /usr/lib even for 64bit architectures.
+
+@DPATCH@
+diff -urNad kamailio-1.2.0~/Makefile.defs kamailio-1.2.0/Makefile.defs
+--- kamailio-1.2.0~/Makefile.defs	2007-02-24 12:35:45.000000000 +0100
++++ kamailio-1.2.0/Makefile.defs	2007-02-24 16:26:45.886854110 +0100
+@@ -123,14 +123,12 @@
+ bin-dir = sbin/
+ 
+ ARCH_B= $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/')
+-ifeq ($(ARCH_B),64b)
+-	LIBDIR ?= lib64
+-else
+-	LIBDIR ?= lib
++ifneq ($(ARCH_B),64b)
+ 	# assume 32b - it is not really used further
+ 	ARCH_B=32b
+ endif
+ 
++LIBDIR ?= lib
+ lib-dir = $(LIBDIR)/$(MAIN_NAME)
+ modules-dir = $(LIBDIR)/$(MAIN_NAME)/modules/
+ 

+ 24 - 0
pkg/kamailio/debian/patches/11_always_smp.dpatch

@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 11_always_smp.dpatch by  <[email protected]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Always build for SMP.
+
+@DPATCH@
+diff -urNad kamailio-1.2.0~/Makefile.defs kamailio-1.2.0/Makefile.defs
+--- kamailio-1.2.0~/Makefile.defs	2007-02-24 16:28:43.152825070 +0100
++++ kamailio-1.2.0/Makefile.defs	2007-02-24 16:28:46.123102964 +0100
+@@ -82,12 +82,7 @@
+ 	endif
+ endif
+ 
+-SMP_STR = $(shell uname -v | grep -i "SMP")
+-ifeq (,$(SMP_STR))
+-	ISSMP=no
+-else
+-	ISSMP=yes
+-endif
++ISSMP=yes
+ 
+ OSREL = $(shell uname -r)
+ # numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)

+ 375 - 0
pkg/kamailio/debian/rules

@@ -0,0 +1,375 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+
+ALL_PACKAGES = kamailio kamailio-mysql-module kamailio-postgres-module \
+	kamailio-jabber-module kamailio-cpl-module kamailio-radius-modules \
+	kamailio-unixodbc-module kamailio-presence-modules kamailio-xmlrpc-module \
+	kamailio-perl-modules kamailio-snmpstats-module kamailio-xmpp-module \
+	kamailio-carrierroute-module kamailio-berkeley-module kamailio-ldap-modules \
+	kamailio-utils-module kamailio-regex-modules kamailio-purple-module \
+	kamailio-memcached-module
+
+DEBVERSION:=$(shell head -n 1 debian/changelog \
+                    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
+UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//')
+
+FILENAME := kamailio_$(UPVERSION).orig.tar.gz
+UPFILENAME := kamailio-$(UPVERSION)-tls_src.tar.gz
+URL := http://kamailio.org/pub/kamailio/$(UPVERSION)/src/kamailio-$(UPVERSION)-tls_src.tar.gz
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+# Include dpatch rules
+include /usr/share/dpatch/dpatch.make
+
+
+# Do we want the TLS version ?
+# Disabled by default due to license issues, set to non-void to enable
+TLS=
+
+# modules depending on mysql
+MYSQL_MODULES = db_mysql
+# modules depending on postgres
+POSTGRES_MODULES = db_postgres
+# modules depending on unixODBC
+UNIXODBC_MODULES=db_unixodbc
+# jabber module
+JABBER_MODULES = jabber
+# cpl related modules
+CPL_MODULES = cpl-c
+# module depending on radiusclient
+RADIUS_MODULES = auth_radius misc_radius peering
+# presence related modules
+PRESENCE_MODULES = presence presence_xml presence_mwi presence_dialoginfo pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo xcap_client rls
+# XMLRPC module
+XMLRPC_MODULES = mi_xmlrpc
+# Perl module
+PERL_MODULES = perl perlvdb
+# SNMPstats module
+SNMPSTATS_MODULES = snmpstats
+# XMPP module
+XMPP_MODULES = xmpp
+# Carrierroute module
+CROUTE_MODULES = carrierroute
+# Berkeley DB module
+BERKELEY_MODULES = db_berkeley
+# LDAP modules
+LDAP_MODULES = ldap h350
+# utils module
+UTILS_MODULES = utils
+# modules depending on libpcre
+REGEX_MODULES = dialplan regex lcr
+# purple module
+PURPLE_MODULES = purple
+# memcached module
+MEMCACHED_MODULES = memcached
+
+ALL_MODULES = $(MYSQL_MODULES) $(POSTGRES_MODULES) $(UNIXODBC_MODULES) $(JABBER_MODULES) $(CPL_MODULES) $(RADIUS_MODULES) $(PRESENCE_MODULES) $(XMLRPC_MODULES) $(PERL_MODULES) $(SNMPSTATS_MODULES) $(XMPP_MODULES) $(CROUTE_MODULES) $(BERKELEY_MODULES) $(LDAP_MODULES) $(UTILS_MODULES) $(REGEX_MODULES) $(PURPLE_MODULES) $(MEMCACHED_MODULES)
+
+# modules not in the "main" package or unstable modules
+EXCLUDED_MODULES = $(ALL_MODULES) pa osp
+
+# the same but with path prepended (needed for modules="...")
+MYSQL_MOD_PATH=$(addprefix modules/, $(MYSQL_MODULES))
+POSTGRES_MOD_PATH=$(addprefix modules/, $(POSTGRES_MODULES))
+UNIXODBC_MOD_PATH=$(addprefix modules/, $(UNIXODBC_MODULES))
+JABBER_MOD_PATH=$(addprefix modules/, $(JABBER_MODULES))
+CPL_MOD_PATH=$(addprefix modules/, $(CPL_MODULES))
+RADIUS_MOD_PATH=$(addprefix modules/, $(RADIUS_MODULES))
+PRESENCE_MOD_PATH=$(addprefix modules/, $(PRESENCE_MODULES))
+XMLRPC_MOD_PATH=$(addprefix modules/, $(XMLRPC_MODULES))
+PERL_MOD_PATH=$(addprefix modules/, $(PERL_MODULES))
+SNMPSTATS_MOD_PATH=$(addprefix modules/, $(SNMPSTATS_MODULES))
+XMPP_MOD_PATH=$(addprefix modules/, $(XMPP_MODULES))
+CROUTE_MOD_PATH=$(addprefix modules/, $(CROUTE_MODULES))
+BERKELEY_MOD_PATH=$(addprefix modules/, $(BERKELEY_MODULES))
+LDAP_MOD_PATH=$(addprefix modules/, $(LDAP_MODULES))
+UTILS_MOD_PATH=$(addprefix modules/, $(UTILS_MODULES))
+REGEX_MOD_PATH=$(addprefix modules/, $(REGEX_MODULES))
+PURPLE_MOD_PATH=$(addprefix modules/, $(PURPLE_MODULES))
+MEMCACHED_MOD_PATH=$(addprefix modules/, $(MEMCACHED_MODULES))
+
+ifeq (cc, $(CC))
+	CC = gcc
+endif
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+        CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+build-stamp: patch-stamp configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) all skip_modules="$(EXCLUDED_MODULES)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(MYSQL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(POSTGRES_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(UNIXODBC_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(JABBER_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(CPL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(RADIUS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PRESENCE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(XMLRPC_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PERL_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(SNMPSTATS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(XMPP_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(CROUTE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(BERKELEY_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(LDAP_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(UTILS_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(REGEX_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(PURPLE_MOD_PATH)" cfg-target=/etc/kamailio/
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) modules modules="$(MEMCACHED_MOD_PATH)" cfg-target=/etc/kamailio/
+
+	# generate the utils db_berkeley
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) utils include_modules="db_berkeley"
+
+	# generate the man pages for modules
+	$(MAKE) modules-docbook-man include_modules="$(ALL_MODULES)"
+
+	touch build-stamp
+
+clean: real-clean unpatch
+real-clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	$(MAKE) TLS=$(TLS) include_modules="$(ALL_MODULES)" proper
+	rm -f cfg.tab.h
+	rm -f utils/kamunix/kamunix.o utils/kamunix/kamunix
+	rm -f utils/db_berkeley/kambdb_recover.o utils/db_berkeley/kambdb_recover
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/kamailio
+	# kamailio base package
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install skip_modules="$(EXCLUDED_MODULES)" \
+		basedir=$(CURDIR)/debian/kamailio \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio
+
+	find $(CURDIR)/debian/kamailio/etc/kamailio -type f -exec chmod -x {} \;
+	sed -i -e "s/^PATH.*//" $(CURDIR)/debian/kamailio/usr/sbin/kamctl
+
+	# install only the mysql module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(MYSQL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-mysql-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-mysql-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-mysql-module
+
+	# install only the postgres module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(POSTGRES_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-postgres-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-postgres-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-postgres-module
+
+	# install only the unixodbc module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(UNIXODBC_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-unixodbc-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-unixodbc-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-unixodbc-module
+
+	# install only the jabber module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(JABBER_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-jabber-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-jabber-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-jabber-module
+
+	# install only the cpl module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(CPL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-cpl-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-cpl-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-cpl-module
+
+	# install only the radius modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(RADIUS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-radius-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-radius-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-radius-modules
+
+	# install only the presence modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PRESENCE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-presence-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-presence-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-presence-modules
+
+	# install only the xmlrpc module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(XMLRPC_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-xmlrpc-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-xmlrpc-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-xmlrpc-module
+
+	# install only the perl modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PERL_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-perl-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-perl-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-perl-modules
+
+	# install only the snmpstats module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(SNMPSTATS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-snmpstats-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-snmpstats-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-snmpstats-module
+
+	# install only the xmpp module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(XMPP_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-xmpp-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-xmpp-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-xmpp-module
+
+	# install only the carrierroute module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(CROUTE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-carrierroute-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-carrierroute-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-carrierroute-module
+
+	# install only the db_berkeley module
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(BERKELEY_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-berkeley-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-berkeley-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-berkeley-module
+
+	# install only the ldap modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(LDAP_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-ldap-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-ldap-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-ldap-modules
+
+	# install only the utils modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(UTILS_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-utils-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-utils-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-utils-module
+
+	# install only the regex modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(REGEX_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-regex-modules \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-regex-modules \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-regex-modules
+
+	# install only the purple modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(PURPLE_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-purple-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-purple-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-purple-module
+
+	# install only the memcached modules
+	CC="$(CC)" CFLAGS="$(CFLAGS)" TLS=$(TLS) $(MAKE) install-modules-all modules="$(MEMCACHED_MOD_PATH)"  \
+		basedir=$(CURDIR)/debian/kamailio-memcached-module \
+		prefix=/usr \
+		cfg-prefix=$(CURDIR)/debian/kamailio-memcached-module \
+		cfg-target=/etc/kamailio/ \
+		doc-dir=share/doc/kamailio-memcached-module
+
+
+	# the modules packages all ship an empty /usr/sbin directory, let's clean that up
+	for p in $(ALL_PACKAGES); \
+		do rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/$$p/usr/sbin; done
+
+# This single target is used to build all the packages, all at once, or
+# one at a time. So keep in mind: any options passed to commands here will
+# affect _all_ packages. Anything you want to only affect one package
+# should be put in another target, such as the install target.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installexamples --exclude=".svn"
+#	dh_installlogrotate
+	dh_installinit -pkamailio -- defaults 23
+	dh_installcron
+	dh_installman
+	dh_installinfo
+	dh_installchangelogs
+	dh_link
+	dh_strip --dbg-package=kamailio-dbg
+	dh_compress 
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+# Build architecture-independent packages using the common target
+binary-indep: build install
+# We have nothing to do by default.
+
+binary: binary-indep binary-arch
+
+print-version:
+	@@echo "Debian version:          $(DEBVERSION)"
+	@@echo "Upstream version:        $(UPVERSION)"
+
+get-orig-source:
+	@@dh_testdir
+	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
+	@@echo Downloading $(FILENAME) from $(URL) ...
+	@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
+
+.PHONY: build clean binary-indep binary-arch binary install configure patch unpatch real-clean

+ 75 - 0
pkg/kamailio/fedora/kamailio.init

@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# Startup script for Kamailio
+#
+# chkconfig: - 85 15
+# description: Kamailio is a fast SIP Proxy.
+#
+# processname: kamailio
+# pidfile: /var/run/kamailio.pid
+# config: /etc/kamailio/kamailio.cfg
+#
+### BEGIN INIT INFO
+# Provides: kamailio
+# Required-Start: $local_fs $network $named
+# Should-Start: mysqld postgresql
+# Short-Description: start, stop Open SIP express router
+# Description: Kamailio or OPEN SIP Express Router is a very fast and flexible
+# 	SIP (RFC3261) proxy server.
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+oser=/usr/sbin/kamailio
+prog=kamailio
+RETVAL=0
+
+[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+start() {
+	echo -n $"Starting $prog: "
+	# there is something at end of this output which is needed to
+	# report proper [ OK ] status in Fedora scripts
+	daemon $oser $OPTIONS 2>/dev/null | tail -1
+	RETVAL=$?
+	echo
+	[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
+}
+
+stop() {
+	echo -n $"Stopping $prog: "
+	killproc $oser
+	RETVAL=$?
+	echo
+	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog /var/run/$prog.pid
+}
+
+# See how we were called.
+case "$1" in
+	start)
+		start
+		;;
+	stop)
+		stop
+		;;
+	status)
+		status $oser
+		RETVAL=$?
+		;;
+	restart|reload)
+		stop
+		start
+		;;
+	condrestart)
+		if [ -f /var/run/kamailio.pid ] ; then
+			stop
+			start
+		fi
+		;;
+	*)
+		echo $"Usage: $prog {start|stop|reload|restart|condrestart|status|help}"
+		exit 1
+esac
+
+exit $RETVAL

+ 201 - 0
pkg/kamailio/freebsd/Makefile

@@ -0,0 +1,201 @@
+# New ports collection makefile for:	kamailio
+# Date created:				20 October 2005
+# Whom:					jesusr
+#
+# $FreeBSD: ports/net/kamailio/Makefile,v 1.9 2007/08/20 09:12:42 miwi Exp $
+#
+
+PORTNAME=	kamailio
+PORTVERSION=	1.3.0
+CATEGORIES=	net
+MASTER_SITES=	http://kamailio.org/pub/kamailio/${PORTVERSION}/src/
+DISTNAME=	${PORTNAME}-${PORTVERSION}-tls_src
+
+MAINTAINER=	[email protected]
+COMMENT=	A very fast and configurable SIP proxy with TLS support
+
+LIB_DEPENDS=	radiusclient-ng.2:${PORTSDIR}/net/radiusclient
+
+WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}-tls
+
+USE_GMAKE=	yes
+MAKE_ENV=	CC="${CC}" \
+		CC_EXTRA_OPTS="${CFLAGS}" \
+		PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
+		PTHREAD_LIBS="${PTHREAD_LIBS}"
+
+PLIST_FILES=	sbin/kamailio sbin/kamctl sbin/kamdbctl sbin/kamunix \
+		lib/kamailio/kamctl/kamctl.base lib/kamailio/kamctl/kamctl.ctlbase \
+		lib/kamailio/kamctl/kamctl.dbtext lib/kamailio/kamctl/kamctl.fifo \
+		lib/kamailio/kamctl/kamctl.sqlbase lib/kamailio/kamctl/kamctl.unixsock \
+		lib/kamailio/kamctl/kamdbctl.base lib/kamailio/kamctl/kamdbctl.dbtext \
+		etc/kamailio/kamctlrc
+
+PLIST_DIRS=	lib/kamailio/modules lib/kamailio/kamctl lib/kamailio
+
+MODULES=	acc alias_db auth auth_db auth_diameter avpops benchmark \
+		cfgutils dbtext dialog dispatcher diversion domain \
+		domainpolicy enum exec flatstore gflags group imc lcr \
+		mangler maxfwd mediaproxy mi_datagram mi_fifo msilo nathelper \
+		options path pdt permissions pike registrar rr seas \
+		siptrace sl sms speeddial sst statistics textops tm uac \
+		uac_redirect uri uri_db usrloc xlog
+
+RC_FILES=	acc/radiusclient.conf \
+		acc/servers \
+		dictionary.radius \
+		kamailio.cfg
+RC_DIRS=	acc
+
+ONLY_FOR_ARCHS=	i386
+
+MAN5=		kamailio.cfg.5
+MAN8=		kamailio.8 \
+		kamctl.8 \
+		kamunix.8
+
+PORTDOCS=	*
+
+SUB_FILES=	pkg-install pkg-deinstall
+SUB_LIST=	RC_DIRS="${RC_DIRS}" RC_FILES="${RC_FILES}"
+
+OPTIONS=	MYSQL "MySQL support" on \
+		POSTGRESQL "PostgreSQL support" off \
+		UNIXODBC "UnixODBC support" off \
+		CPL "CPL-C support" off \
+		TLS "TLS support" off \
+		SNMPSTATS "SNMPStats support" off
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_MYSQL)
+USE_MYSQL=	yes
+MODULES+=	mysql
+PLIST_FILES+=	lib/kamailio/kamctl/kamdbctl.mysql lib/kamailio/kamctl/kamctl.mysql
+.else
+MAKE_ENV+=	MYSQL=mysql
+.endif
+
+.if defined(WITH_POSTGRESQL)
+USE_PGSQL=	yes
+MODULES+=	postgres
+PLIST_FILES+=	lib/kamailio/kamctl/kamdbctl.pgsql lib/kamailio/kamctl/kamctl.pgsql
+.else
+MAKE_ENV+=	POSTGRESQL=postgres
+.endif
+
+.if defined(WITH_UNIXODBC)
+LIB_DEPENDS+=	odbc.1:${PORTSDIR}/databases/unixODBC
+MODULES+=	unixodbc
+.else
+MAKE_ENV+=	UNIXODBC=unixodbc
+.endif
+
+.if defined(WITH_CPL)
+USE_GNOME=	libxml2
+MODULES+=	cpl-c
+PLIST_FILES+=	etc/kamailio/cpl-06.dtd
+.else
+MAKE_ENV+=	CPL=cpl-c
+.endif
+
+.if defined(WITH_TLS)
+MODULES+=	tlsops
+.include "${PORTSDIR}/Mk/bsd.openssl.mk"
+TLS_RC_FILES=	tls/rootCA/cacert.pem \
+		tls/rootCA/certs/01.pem \
+		tls/rootCA/index.txt \
+		tls/rootCA/private/cakey.pem \
+		tls/rootCA/serial \
+		tls/user/user-calist.pem \
+		tls/user/user-cert.pem \
+		tls/user/user-cert_req.pem \
+		tls/user/user-privkey.pem \
+		tls/README \
+		tls/ca.conf \
+		tls/request.conf \
+		tls/user.conf
+RC_FILES+=	${TLS_RC_FILES}
+TLS_RC_DIRS=	tls/user \
+		tls/rootCA/certs \
+		tls/rootCA/private \
+		tls/rootCA \
+		tls
+RC_DIRS+=	${TLS_RC_DIRS}
+.else
+MAKE_ENV+=	TLSOPS=tlsops
+MAKE_ARGS+=	TLS=""
+.endif
+
+.if defined(WITH_SNMPSTATS)
+RUN_DEPENDS+=	snmpcheck:${PORTSDIR}/net-mgmt/net-snmp
+MODULES+=	snmpstats
+.else
+MAKE_ENV+=	SNMPSTATS=snmpstats
+.endif
+
+PLIST_FILES+=	${MODULES:S|^|lib/kamailio/modules/|:S|$|.so|} \
+		${RC_FILES:S|^|etc/kamailio/|:S|$|.default|}
+
+post-patch:
+.if defined(NOPORTDOCS)
+	@${REINPLACE_CMD} -e 's|install-doc install-man|install-man|' \
+		${WRKSRC}/Makefile
+.endif
+	@${REINPLACE_CMD} -e 's|-g -O9 ||' -e 's|-O9 ||' ${WRKSRC}/Makefile.defs
+	@${REINPLACE_CMD} -e 's|/usr/local/etc/kamailio|${PREFIX}/etc/kamailio|' \
+		${WRKSRC}/scripts/kamdbctl.dbtext
+	@${REINPLACE_CMD} -e 's|/usr/local/share/kamailio|${PREFIX}/share/kamailio|' \
+		${WRKSRC}/scripts/kamdbctl.dbtext
+	@${REINPLACE_CMD} -e 's|/etc/kamailio|${PREFIX}/etc/kamailio|' \
+		${WRKSRC}/modules/mediaproxy/README \
+		${WRKSRC}/modules/cpl-c/README \
+		${WRKSRC}/INSTALL
+	@${REINPLACE_CMD} -e 's|/usr/local/sbin/kamailio|${PREFIX}/sbin/kamailio|' \
+		${WRKSRC}/INSTALL
+	@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|' \
+		${WRKSRC}/etc/kamailio.cfg \
+		${WRKSRC}/scripts/kamctl \
+		${WRKSRC}/scripts/kamctl.8 \
+		${WRKSRC}/scripts/kamctl.base \
+		${WRKSRC}/scripts/kamctl.db_berkeley \
+		${WRKSRC}/scripts/kamctl.dbtext \
+		${WRKSRC}/scripts/kamctlrc \
+		${WRKSRC}/scripts/kamdbctl \
+		${WRKSRC}/scripts/kamdbctl.base \
+		${WRKSRC}/scripts/kamdbctl.db_berkeley \
+		${WRKSRC}/scripts/kamdbctl.dbtext \
+		${WRKSRC}/scripts/kamdbctl.mysql \
+		${WRKSRC}/scripts/kamdbctl.pgsql \
+		${WRKSRC}/modules/acc/README \
+		${WRKSRC}/modules/avp_radius/README \
+		${WRKSRC}/modules/db_berkeley/README \
+		${WRKSRC}/modules/ldap/README \
+		${WRKSRC}/modules/osp/README \
+		${WRKSRC}/modules/perl/README \
+		${WRKSRC}/modules/seas/README \
+		${WRKSRC}/modules/snmpstats/README \
+		${WRKSRC}/modules/speeddial/README \
+		${WRKSRC}/modules/unixodbc/README
+	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' \
+		${WRKSRC}/modules/acc/etc/radiusclient.conf
+	@${REINPLACE_CMD} -e 's|/usr/local/etc/radiusclient|${PREFIX}/etc/kamailio/acc|' \
+		${WRKSRC}/modules/acc/acc_mod.c ${WRKSRC}/modules/acc/README
+
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/etc/kamailio.cfg \
+		${PREFIX}/etc/kamailio/kamailio.cfg.default
+	${MKDIR} ${PREFIX}/etc/kamailio/acc
+	${INSTALL_DATA} ${WRKSRC}/modules/acc/etc/radiusclient.conf \
+		${PREFIX}/etc/kamailio/acc/radiusclient.conf.default
+	${INSTALL_DATA} ${WRKSRC}/modules/acc/etc/servers \
+		${PREFIX}/etc/kamailio/acc/servers.default
+.for d in ${TLS_RC_DIRS}
+	${MKDIR} ${PREFIX}/etc/kamailio/${d}
+.endfor
+.for f in ${TLS_RC_FILES}
+	${INSTALL_DATA} ${WRKSRC}/etc/${f} ${PREFIX}/etc/kamailio/${f}.default
+.endfor
+	@PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+
+.include <bsd.port.post.mk>

+ 3 - 0
pkg/kamailio/freebsd/distinfo

@@ -0,0 +1,3 @@
+MD5 (kamailio-1.3.0-tls_src.tar.gz) = e380fa73095274162fac129e16d7c7d8
+SHA256 (kamailio-1.3.0-tls_src.tar.gz) = afd43b70e5887c5f91769bbc22506e8a6e0da90a91bf699da17f73988fc61fcf
+SIZE (kamailio-1.3.0-tls_src.tar.gz) = 3405325

+ 78 - 0
pkg/kamailio/freebsd/files/patch-Makefile

@@ -0,0 +1,78 @@
+--- Makefile.orig	Thu Dec 13 18:49:12 2007
++++ Makefile	Thu Dec 13 21:49:54 2007
+@@ -48,11 +48,11 @@
+ skip_modules?=
+ 
+ # if not set on the cmd. line or the env, exclude this modules:
+-exclude_modules?= jabber cpl-c mysql postgres osp unixodbc \
+-	avp_radius auth_radius group_radius uri_radius xmpp \
++exclude_modules?= 	$(MYSQL) $(POSTGRESQL) $(CPL) $(SNMPSTATS) $(TLSOPS) $(UNIXODBC) \
++	jabber osp avp_radius auth_radius group_radius uri_radius xmpp \
+ 	presence presence_xml presence_mwi pua pua_bla pua_mi \
+ 	pua_usrloc pua_xmpp rls mi_xmlrpc perl snmpstats perlvdb \
+-	ldap carrierroute h350 xcap_client db_berkeley seas
++	ldap carrierroute h350 xcap_client db_berkeley
+ ifeq ($(TLS),)
+ 	exclude_modules+= tlsops
+ endif
+@@ -392,24 +392,11 @@
+ 		
+ # note: on solaris 8 sed: ? or \(...\)* (a.s.o) do not work
+ install-cfg: $(cfg-prefix)/$(cfg-dir)
+-		sed -e "s#/usr/.*lib/$(NAME)/modules/#$(modules-target)#g" \
+-			< etc/$(NAME).cfg > $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0
+-		sed -e "s#/usr/.*etc/$(NAME)/tls/#$(cfg-target)tls/#g" \
+-			< $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0 \
+-			> $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample
+-		rm -fr $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample0
+-		chmod 644 $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample
+-		if [ -z "${skip_cfg_install}" -a \
+-				! -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg ]; then \
+-			mv -f $(cfg-prefix)/$(cfg-dir)$(NAME).cfg.sample \
+-				$(cfg-prefix)/$(cfg-dir)$(NAME).cfg; \
+-		fi
+ 		# radius dictionary
+-		$(INSTALL_TOUCH) $(cfg-prefix)/$(cfg-dir)/dictionary.radius.sample
+-		$(INSTALL_CFG) etc/dictionary.radius \
+-			$(cfg-prefix)/$(cfg-dir)/dictionary.radius.sample
++		$(INSTALL_TOUCH) $(cfg-prefix)/$(cfg-dir)/dictionary.radius.default
++		$(INSTALL_CFG) etc/dictionary.radius $(cfg-prefix)/$(cfg-dir)/dictionary.radius.default
+ 		if [ ! -f $(cfg-prefix)/$(cfg-dir)/dictionary.radius ]; then \
+-			mv -f $(cfg-prefix)/$(cfg-dir)/dictionary.radius.sample \
++			cp -f $(cfg-prefix)/$(cfg-dir)/dictionary.radius.default \
+ 				$(cfg-prefix)/$(cfg-dir)/dictionary.radius; \
+ 		fi
+ 		# kamctl config
+@@ -445,7 +432,7 @@
+ 		sed -e "s#/usr/local/lib/kamailio/#$(lib-target)#g" | \
+ 		sed -e "s#/usr/local/etc/kamailio/#$(cfg-target)#g"  >/tmp/kamctl
+ 		$(INSTALL_TOUCH) $(bin-prefix)/$(bin-dir)/kamctl
+-		$(INSTALL_BIN) /tmp/kamctl $(bin-prefix)/$(bin-dir)
++		$(BSD_INSTALL_SCRIPT) /tmp/kamctl $(bin-prefix)/$(bin-dir)
+ 		rm -fr /tmp/kamctl
+ 		sed -e "s#/usr/local/sbin#$(bin-target)#g" \
+ 			< scripts/kamctl.base > /tmp/kamctl.base
+@@ -492,10 +479,10 @@
+ 		sed -e "s#/usr/local/lib/kamailio/#$(lib-target)#g" | \
+ 		sed -e "s#/usr/local/etc/kamailio/#$(cfg-target)#g"  >/tmp/kamdbctl
+ 		$(INSTALL_TOUCH) $(bin-prefix)/$(bin-dir)/kamdbctl
+-		$(INSTALL_BIN) /tmp/kamdbctl $(bin-prefix)/$(bin-dir)
++		$(BSD_INSTALL_SCRIPT) /tmp/kamdbctl $(bin-prefix)/$(bin-dir)
+ 		rm -fr /tmp/kamdbctl
+ 		$(INSTALL_TOUCH)   $(bin-prefix)/$(bin-dir)/$(NAME)unix
+-		$(INSTALL_BIN) utils/$(NAME)unix/$(NAME)unix $(bin-prefix)/$(bin-dir)
++		$(BSD_INSTALL_SCRIPT) utils/$(NAME)unix/$(NAME)unix $(bin-prefix)/$(bin-dir)
+ 		# install dbtext stuff
+ 		mkdir -p $(modules-prefix)/$(lib-dir)/kamctl ; \
+ 		sed -e "s#/usr/local/share/kamailio/#$(data-target)#g" \
+@@ -624,9 +611,7 @@
+ 			if [ -f modules/"$$r"/README ]; then \
+ 				$(INSTALL_TOUCH)  $(doc-prefix)/$(doc-dir)/README ; \
+ 				$(INSTALL_DOC)  modules/"$$r"/README  \
+-									$(doc-prefix)/$(doc-dir)/README ; \
+-				mv -f $(doc-prefix)/$(doc-dir)/README \
+-						$(doc-prefix)/$(doc-dir)/README."$$r" ; \
++					$(doc-prefix)/$(doc-dir)/README."$$r" ; \
+ 			fi ; \
+ 		fi ; \
+ 	done 

+ 11 - 0
pkg/kamailio/freebsd/files/patch-Makefile-mysql

@@ -0,0 +1,11 @@
+--- modules/mysql/Makefile.orig	Thu Dec 13 20:15:16 2007
++++ modules/mysql/Makefile	Thu Dec 13 20:15:20 2007
+@@ -8,7 +8,7 @@
+ 
+ # set CROSS_COMPILE to true if you want to skip
+ # the autodetection
+-# CROSS_COMPILE=true
++CROSS_COMPILE=true
+ 
+ ifeq ($(CROSS_COMPILE),)
+ MYSQLCFG=$(shell which mysql_config)

+ 42 - 0
pkg/kamailio/freebsd/files/patch-Makefile.defs

@@ -0,0 +1,42 @@
+--- Makefile.defs.orig	Thu Dec 13 18:56:53 2007
++++ Makefile.defs	Thu Dec 13 20:31:40 2007
+@@ -135,7 +135,7 @@
+ ifeq ($(ARCH_B),64b)
+ 	LIBDIR ?= lib64
+ else
+-	LIBDIR ?= lib
++	LIBDIR = lib
+ 	# assume 32b - it is not really used further
+ 	ARCH_B=32b
+ endif
+@@ -228,13 +228,13 @@
+ TAR ?= tar
+ endif
+ 
+-INSTALL_TOUCH = touch          # used to create the file first (good to 
++INSTALL_TOUCH = :          # used to create the file first (good to 
+                                #  make solaris install work)
+-INSTALL_CFG = $(INSTALL) -m 644
+-INSTALL_BIN = $(INSTALL) -m 755
+-INSTALL_MODULES = $(INSTALL) -m 755
+-INSTALL_DOC = $(INSTALL) -m 644
+-INSTALL_MAN = $(INSTALL) -m 644
++INSTALL_CFG = $(BSD_INSTALL_DATA) -m 644
++INSTALL_BIN = $(BSD_INSTALL_PROGRAM) -m 755
++INSTALL_MODULES = $(BSD_INSTALL_PROGRAM) -m 755
++INSTALL_DOC = $(BSD_INSTALL_DATA) -m 644
++INSTALL_MAN = $(BSD_INSTALL_MAN) -m 644
+ 
+ #set some vars from the environment (and not make builtins)
+ CC   := $(shell echo "$${CC}")
+@@ -1254,8 +1254,8 @@
+ 
+ #add libssl if needed
+ ifneq ($(TLS),)
+-DEFS+= -I$(LOCALBASE)/ssl/include -I$(LOCALBASE)/include
+-LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl  -lcrypto
++DEFS+= -I$(OPENSSLINC)
++LIBS+= -L$(OPENSSLLIB) -lssl  -lcrypto
+ endif
+ 
+ #add libsctp if needed

+ 24 - 0
pkg/kamailio/freebsd/files/pkg-deinstall.in

@@ -0,0 +1,24 @@
+#!/bin/sh
+
+rc_dir=$PKG_PREFIX/etc/kamailio/
+
+if [ "$2" = DEINSTALL ]; then
+	for f in %%RC_FILES%%; do
+		if /usr/bin/cmp -s $rc_dir/$f.default $rc_dir/$f; then
+			/bin/rm -f $rc_dir/$f
+		fi
+	done
+elif [ "$2" = POST-DEINSTALL ]; then
+	rc_dirs=`for d in %%RC_DIRS%%; do echo $d; done | /usr/bin/sort -r`
+
+	for d in $rc_dirs ""; do
+		/bin/rmdir $rc_dir/$d 2>/dev/null || /usr/bin/true
+	done
+
+	if [ -e $rc_dir ]; then
+		echo "==============================================================================="
+		echo "If you are permanently removing this port, you should manually remove the"
+		echo "$rc_dir directory."
+		echo "==============================================================================="
+	fi
+fi

+ 12 - 0
pkg/kamailio/freebsd/files/pkg-install.in

@@ -0,0 +1,12 @@
+#!/bin/sh
+
+[ "$2" != POST-INSTALL ] && exit
+
+rc_dir=$PKG_PREFIX/etc/kamailio/
+
+for f in %%RC_FILES%%; do
+	if ! [ -e $rc_dir/$f ]; then
+		/usr/bin/install -o root -g wheel -m 644 \
+			$rc_dir/$f.default $rc_dir/$f
+	fi
+done

+ 13 - 0
pkg/kamailio/freebsd/pkg-descr

@@ -0,0 +1,13 @@
+Kamailio is a very fast and flexible SIP (RFC3261)
+proxy server. Written entirely in C, kamailio can handle thousands calls
+per second even on low-budget hardware. A C Shell like scripting language
+provides full control over the server's behaviour. It's modular
+architecture allows only required functionality to be loaded.
+Currently the following modules are available: digest authentication,
+CPL scripts, instant messaging, MySQL and UNIXODBC support, a presence agent,
+radius authentication, record routing, an SMS gateway, a jabber gateway, a 
+transaction and dialog module, OSP module, statistics support, 
+registrar and user location, SIMPLE Presence, Perl programming interface,
+SNMP and Java SIP Servlet.
+
+WWW: http://www.kamailio.org/

+ 118 - 0
pkg/kamailio/gentoo/kamailio-1.2.0.ebuild

@@ -0,0 +1,118 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+inherit eutils
+
+DESCRIPTION="Kamailio - flexible and robust SIP (RFC3261) server"
+HOMEPAGE="http://www.kamailio.org/"
+MY_P="${P}_src"
+SRC_URI="http://kamailio.org/pub/kamailio/${PV}/src/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE="debug ipv6 mysql postgres radius jabber ssl cpl unixodbc"
+
+RDEPEND="
+	mysql? ( >=dev-db/mysql-4.1.20 )
+	radius? ( >=net-dialup/radiusclient-ng-0.5.0 )
+	postgres? ( >=dev-db/postgresql-8.0.8 )
+	jabber? ( dev-libs/expat )
+	ssl? ( dev-libs/openssl )
+	cpl? ( dev-libs/libxml2 )
+	unixodbc? ( dev-libs/unixodbc-2.2.6 )"
+
+inc_mod=""
+make_options=""
+
+pkg_setup() {
+	use mysql && \
+		inc_mod="${inc_mod} mysql"
+
+	use postgres && \
+		inc_mod="${inc_mod} postgres"
+
+	use radius && \
+		inc_mod="${inc_mod} auth_radius misc_radius peering
+
+	use jabber && \
+		inc_mod="${inc_mod} jabber"
+
+	use cpl && \
+		inc_mod="${inc_mod} cpl-c"
+
+	use unixodbc && \
+		inc_mod="${inc_mod} unixodbc"
+
+	export inc_mod
+}
+
+src_unpack() {
+	unpack ${MY_P}.tar.gz
+
+	cd ${S}
+	use ipv6 || \
+		sed -i -e "s/-DUSE_IPV6//g" Makefile.defs
+}
+
+src_compile() {
+	local compile_options
+
+	pkg_setup
+
+	# optimization can result in strange debuging symbols so omit it in case
+	if use debug; then
+		compile_options="${compile_options} mode=debug"
+	else
+		compile_options="${compile_options} CFLAGS=${CFLAGS}"
+	fi
+	
+	if use ssl; then
+		compile_options="TLS=1 ${compile_options}"
+	fi
+
+	emake all "${compile_options}" \
+		prefix=${ROOT}/ \
+		include_modules="${inc_mod}" \
+		cfg-prefix=${ROOT}/ \
+		cfg-target=${ROOT}/etc/kamailio/ || die
+}
+
+src_install () {
+	local install_options
+
+	emake install \
+		prefix=${D}/ \
+		include_modules="${inc_mod}" \
+		bin-prefix=${D}/usr/sbin \
+		bin-dir="" \
+		cfg-prefix=${D}/etc \
+		cfg-dir=kamailio/ \
+		cfg-target=${D}/etc/kamailio \
+		modules-prefix=${D}/usr/lib/kamailio \
+		modules-dir=modules \
+		modules-target=${D}/usr/lib/kamailio/modules/ \
+		man-prefix=${D}/usr/share/man \
+		man-dir="" \
+		doc-prefix=${D}/usr/share/doc \
+		doc-dir=${PF} || die
+	exeinto /etc/init.d
+	newexe ${FILESDIR}/kamailio.init kamailio
+
+	# fix what the Makefile don't do
+	use mysql || \
+		rm ${D}/usr/sbin/kamailio_mysql.sh
+}
+
+pkg_postinst() {
+	einfo "WARNING: If you upgraded from a previous Kamailio version"
+	einfo "please read the README, NEWS and INSTALL files in the"
+	einfo "documentation directory because the database and the"
+	einfo "configuration file of old Kamailio versions are incompatible"
+	einfo "with the current version."
+}
+
+pkg_prerm () {
+	${D}/etc/init.d/kamailio stop >/dev/null
+}

+ 22 - 0
pkg/kamailio/gentoo/kamailio.init

@@ -0,0 +1,22 @@
+#!/sbin/runscript
+# Copyright 2002 Frauenhofer Gesellschaft FOKUS, Germany.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header$
+
+depend() {
+	need net
+}
+
+start() {
+	ebegin "Starting Kamailio"
+	start-stop-daemon --start --quiet --pidfile /var/run/kamailio.pid \
+		--exec /usr/sbin/kamailio -- -P /var/run/kamailio.pid
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping Kamailio"
+	start-stop-daemon --stop --quiet --pidfile /var/run/kamailio.pid
+	eend $?
+}
+

+ 1 - 0
pkg/kamailio/netbsd/COMMENT

@@ -0,0 +1 @@
+Kamailio, very fast and configurable SIP proxy

+ 18 - 0
pkg/kamailio/netbsd/DESCR

@@ -0,0 +1,18 @@
+Kamailio is a very fast and flexible SIP (RFC3261)
+proxy server. Written entirely in C, ser can handle thousands calls
+per second even on low-budget hardware. C Shell like scripting language
+provides full control over the server's behaviour. It's modular
+architecture allows only required functionality to be loaded.
+Currently the following modules are available: Digest Authentication,
+CPL scripts, Instant Messaging, MySQL support, UNIXODBC support,
+OSP support, Radius Authentication, Record Routing, SMS Gateway,
+Jabber Gateway, Transaction Module, Dialog Module, Registrar and
+User Location, Perl programming interface, SIMPLE Presence and SNMP.
+
+
+WWW: http://www.kamailio.org/
+
+- Bogdan-Andrei Iancu
[email protected]
+- Daniel-Constantin Mierla
[email protected]

+ 42 - 0
pkg/kamailio/netbsd/Makefile

@@ -0,0 +1,42 @@
+# New ports collection makefile for:    kamailio
+#
+# $NetBSD$
+#
+# $Id$
+#
+
+COMMENT= "Kamailio"
+
+PORTNAME= kamailio
+PORTVERSION= 1.2.0-notls
+CATEGORIES= net
+MASTER_SITES= http://kamailio.org/pub/kamailio/1.2.0/src/
+
+MAINTAINER= [email protected]
+
+MAN8=kamailio.8
+MAN5=kamailio.cfg.5
+# MANCOMPRESSED must not be specified (if defined is assumed to be yes)
+
+
+USE_GMAKE= yes
+USE_TOOLS+= gmake
+# we override the DISTFILE NAME
+DISTNAME= ${PORTNAME}-${PORTVERSION}
+DISTFILES= ${DISTNAME}_src.tar.gz
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
+
+# build by default mysql and jabber
+MAKE_ENV= include_modules="mysql jabber"
+
+# depends on expat and mysqlclient because of the above modules
+DEPENDS= expat-[0-9]*:../../textproc/expat \
+         mysql-client>=3.23.35:../../databases/mysql-client
+
+#.include "/usr/pkgsrc/mk/bsd.prefs.mk"
+
+pre-fetch:
+
+.include "../../mk/bsd.pkg.mk"
+
+

+ 120 - 0
pkg/kamailio/netbsd/PLIST

@@ -0,0 +1,120 @@
+etc/kamailio/kamailio.cfg
+etc/kamailio/kamctlrc
+sbin/kamailio
+sbin/kamctl
+sbin/kamailio_mysql.sh
+lib/kamailio/modules/acc.so
+lib/kamailio/modules/alias_db.so
+lib/kamailio/modules/auth.so
+lib/kamailio/modules/auth_db.so
+lib/kamailio/modules/auth_diameter.so
+lib/kamailio/modules/avpops.so
+lib/kamailio/modules/dbtext.so
+lib/kamailio/modules/dialog.so
+lib/kamailio/modules/dispatcher.so
+lib/kamailio/modules/diversion.so
+lib/kamailio/modules/domain.so
+lib/kamailio/modules/domainpolicy.so
+lib/kamailio/modules/enum.so
+lib/kamailio/modules/exec.so
+lib/kamailio/modules/flatstore.so
+lib/kamailio/modules/gflags.so
+lib/kamailio/modules/group.so
+lib/kamailio/modules/jabber.so
+lib/kamailio/modules/lcr.so
+lib/kamailio/modules/mangler.so
+lib/kamailio/modules/maxfwd.so
+lib/kamailio/modules/mediaproxy.so
+lib/kamailio/modules/mi_fifo.so
+lib/kamailio/modules/msilo.so
+lib/kamailio/modules/mysql.so
+lib/kamailio/modules/nathelper.so
+lib/kamailio/modules/options.so
+lib/kamailio/modules/pa.so
+lib/kamailio/modules/path.so
+lib/kamailio/modules/pdt.so
+lib/kamailio/modules/permissions.so
+lib/kamailio/modules/pike.so
+lib/kamailio/modules/registrar.so
+lib/kamailio/modules/rr.so
+lib/kamailio/modules/seas.so
+lib/kamailio/modules/siptrace.so
+lib/kamailio/modules/sl.so
+lib/kamailio/modules/sms.so
+lib/kamailio/modules/speeddial.so
+lib/kamailio/modules/sst.so
+lib/kamailio/modules/statistics.so
+lib/kamailio/modules/textops.so
+lib/kamailio/modules/tm.so
+lib/kamailio/modules/uac.so
+lib/kamailio/modules/uac_redirect.so
+lib/kamailio/modules/uri.so
+lib/kamailio/modules/uri_db.so
+lib/kamailio/modules/usrloc.so
+lib/kamailio/modules/xlog.so
+lib/kamailio/modules/xmpp.so
+lib/kamctl/kamctl.base
+lib/kamctl/kamctl.sqlbase
+lib/kamctl/kamctl.ctlbase
+lib/kamctl/kamctl.fifo
+lib/kamctl/kamctl.unixsock
+lib/kamctl/kamctl.mysql
+share/doc/kamailio/README
+share/doc/kamailio/INSTALL
+share/doc/kamailio/README-MODULES
+share/doc/kamailio/AUTHORS
+share/doc/kamailio/NEWS
+share/doc/kamailio/README.acc
+share/doc/kamailio/README.alias_db
+share/doc/kamailio/README.auth
+share/doc/kamailio/README.auth_db
+share/doc/kamailio/README.auth_diameter
+share/doc/kamailio/README.avpops
+share/doc/kamailio/README.dbtext
+share/doc/kamailio/README.dialog
+share/doc/kamailio/README.dispatcher
+share/doc/kamailio/README.diversion
+share/doc/kamailio/README.domain
+share/doc/kamailio/README.domainpolicy
+share/doc/kamailio/README.enum
+share/doc/kamailio/README.exec
+share/doc/kamailio/README.flatstore
+share/doc/kamailio/README.gflags
+share/doc/kamailio/README.group
+share/doc/kamailio/README.jabber
+share/doc/kamailio/README.lcr
+share/doc/kamailio/README.mangler
+share/doc/kamailio/README.maxfwd
+share/doc/kamailio/README.mediaproxy
+share/doc/kamailio/README.mi_fifo
+share/doc/kamailio/README.msilo
+share/doc/kamailio/README.mysql
+share/doc/kamailio/README.nathelper
+share/doc/kamailio/README.options
+share/doc/kamailio/README.pa
+share/doc/kamailio/README.path
+share/doc/kamailio/README.pdt
+share/doc/kamailio/README.permissions
+share/doc/kamailio/README.pike
+share/doc/kamailio/README.registrar
+share/doc/kamailio/README.rr
+share/doc/kamailio/README.seas
+share/doc/kamailio/README.siptrace
+share/doc/kamailio/README.sl
+share/doc/kamailio/README.sms
+share/doc/kamailio/README.speeddial
+share/doc/kamailio/README.sst
+share/doc/kamailio/README.statistics
+share/doc/kamailio/README.textops
+share/doc/kamailio/README.tm
+share/doc/kamailio/README.uac
+share/doc/kamailio/README.uac_redirect
+share/doc/kamailio/README.uri
+share/doc/kamailio/README.uri_db
+share/doc/kamailio/README.usrloc
+share/doc/kamailio/README.xlog
+share/doc/kamailio/README.xmpp
+@dirrm share/doc/kamailio
+@dirrm etc/kamailio
+@dirrm lib/kamailio/modules
+@dirrm lib/kamailio

+ 1 - 0
pkg/kamailio/netbsd/distinfo

@@ -0,0 +1 @@
+MD5 (kamailio-1.2.0-notls_src.tar.gz) = 9ca396cb5d95623206b109bdfb4c6374

+ 154 - 0
pkg/kamailio/openbsd/Makefile

@@ -0,0 +1,154 @@
+# $OpenBSD$
+
+COMMENT-main =		mature and flexible open source SIP server
+COMMENT-postgresql =	kamailio postgresql module
+COMMENT-mysql =		kamailio mysql module
+COMMENT-radius =	kamailio RADIUS modules
+COMMENT-berkeleydb =	kamailio berkeley DB module
+COMMENT-ldap =		kamailio LDAP modules
+COMMENT-xmlrpc =	kamailio XML-RPC module
+COMMENT-xcap_client =	kamailio XCAP client module
+COMMENT-carrierroute =	kamailio carrierroute module
+COMMENT-snmpstats =	kamailio snmpstats module
+COMMENT-perl =		kamailio perl modules
+
+VERSION =		1.5.0
+DISTNAME =		kamailio-${VERSION}
+PKGNAME-main =		kamailio-${VERSION}
+PKGNAME-mysql =		kamailio-mysql-${VERSION}
+PKGNAME-postgresql =	kamailio-postgresql-${VERSION}
+PKGNAME-radius =	kamailio-radius-${VERSION}
+PKGNAME-berkeleydb =	kamailio-berkeleydb-${VERSION}
+PKGNAME-ldap =		kamailio-ldap-${VERSION}
+PKGNAME-xmlrpc =	kamailio-xmlrpc-${VERSION}
+PKGNAME-xcap_client =	kamailio-xcap_client-${VERSION}
+PKGNAME-carrierroute =	kamailio-carrierroute-${VERSION}
+PKGNAME-snmpstats =	kamailio-snmpstats-${VERSION}
+PKGNAME-perl =		kamailio-perl-${VERSION}
+
+CATEGORIES =		telephony
+MAINTAINER =		[email protected]
+
+HOMEPAGE =		http://www.kamailio.org/
+
+# GPL
+PERMIT_PACKAGE_CDROM =	Yes
+PERMIT_PACKAGE_FTP =	Yes
+PERMIT_DISTFILES_CDROM =Yes
+PERMIT_DISTFILES_FTP =	Yes
+
+MASTER_SITES =		http://www.kamailio.org/pub/kamailio/${VERSION}/src/
+DISTFILES =		${DISTNAME}-tls_src.tar.gz
+WRKDIST =		${WRKDIR}/${DISTNAME}-tls
+
+BUILD_DEPENDS =		::devel/gmake
+
+WANTLIB-main =		c expat crypto ssl
+LIB_DEPENDS-main =	xml2::textproc/libxml,-main,no_python
+# kamctl and kamdbctl use bash
+RUN_DEPENDS-main =	::shells/bash
+
+WANTLIB-berkeleydb =	c
+LIB_DEPENDS-berkeleydb =db::databases/db/v4,-main
+RUN_DEPENDS-berkeleydb =::telephony/kamailio
+
+LIB_DEPENDS-postgresql =pq:postgresql-client-*:databases/postgresql,-main
+RUN_DEPENDS-postgresql =::telephony/kamailio
+
+WANTLIB-mysql =		crypto m ssl z
+LIB_DEPENDS-mysql =	mysqlclient:mysql-client-*:databases/mysql,-main
+RUN_DEPENDS-mysql =	::telephony/kamailio
+
+LIB_DEPENDS-radius =	radiusclient-ng:radiusclient-ng-*:net/radiusclient-ng
+RUN_DEPENDS-radius =	::telephony/kamailio
+
+LIB_DEPENDS-ldap =	ldap:openldap-client-*:databases/openldap,-main
+RUN_DEPENDS-ldap =	::telephony/kamailio
+
+LIB_DEPENDS-xmlrpc =	xmlrpc::net/xmlrpc-c \
+			xmlrpc_server::net/xmlrpc-c \
+			xmlrpc_util::net/xmlrpc-c \
+			xmlrpc_xmlparse::net/xmlrpc-c \
+			xmlrpc_xmltok::net/xmlrpc-c
+RUN_DEPENDS-xmlrpc =	::telephony/kamailio
+
+LIB_DEPENDS-xcap_client =	curl::net/curl \
+				xml2::textproc/libxml,-main
+RUN_DEPENDS-xcap_client =	::telephony/kamailio
+
+LIB_DEPENDS-carrierroute =	confuse::devel/libconfuse
+RUN_DEPENDS-carrierroute =	::telephony/kamailio
+
+WANTLIB-snmpstats =	c m perl util
+LIB_DEPENDS-snmpstats =	netsnmp:net-snmp-*:net/net-snmp \
+			netsnmpagent:net-snmp-*:net/net-snmp \
+			netsnmphelpers:net-snmp-*:net/net-snmp
+RUN_DEPENDS-snmpstats =	::telephony/kamailio
+
+RUN_DEPENDS-perl =	::telephony/kamailio \
+			::databases/p5-ldap
+WANTLIB-perl =		c m perl util
+
+PSEUDO_FLAVORS =	no_berkeleydb no_postgresql no_mysql no_radius no_ldap no_xmlrpc no_xcap_client no_carrierroute no_snmpstats no_perl
+
+KAMAILIO_MODULES =	cpl-c jabber presence presence_mwi presence_xml pua pua_bla pua_mi pua_usrloc pua_xmpp rls seas xmpp
+FLAVOR ?=
+MULTI_PACKAGES =	-main
+
+.if !${FLAVOR:L:Mno_berkeleydb}
+MULTI_PACKAGES +=	-berkeleydb
+KAMAILIO_MODULES +=	db_berkeley
+.endif
+.if !${FLAVOR:L:Mno_postgresql}
+MULTI_PACKAGES +=	-postgresql
+KAMAILIO_MODULES +=	db_postgres
+.endif
+.if !${FLAVOR:L:Mno_mysql}
+MULTI_PACKAGES +=	-mysql
+KAMAILIO_MODULES +=	db_mysql
+.endif
+.if !${FLAVOR:L:Mno_radius}
+MULTI_PACKAGES +=	-radius
+KAMAILIO_MODULES +=	avp_radius auth_radius group_radius uri_radius peering
+.endif
+.if !${FLAVOR:L:Mno_ldap}
+MULTI_PACKAGES +=	-ldap
+KAMAILIO_MODULES +=	ldap h350
+.endif
+.if !${FLAVOR:L:Mno_xmlrpc}
+MULTI_PACKAGES +=	-xmlrpc
+KAMAILIO_MODULES +=	mi_xmlrpc
+.endif
+.if !${FLAVOR:L:Mno_xcap_client}
+MULTI_PACKAGES +=	-xcap_client
+KAMAILIO_MODULES +=	xcap_client
+.endif
+.if !${FLAVOR:L:Mno_snmpstats}
+MULTI_PACKAGES +=	-snmpstats
+KAMAILIO_MODULES +=	snmpstats
+.endif
+.if !${FLAVOR:L:Mno_carrierroute}
+MULTI_PACKAGES +=	-carrierroute
+KAMAILIO_MODULES +=	carrierroute
+.endif
+.if !${FLAVOR:L:Mno_perl}
+MULTI_PACKAGES +=	-perl
+KAMAILIO_MODULES +=	perl perlvdb
+.endif
+
+MAKE_FLAGS =		TLS=1 LIBDIR="lib" cfg-prefix="${WRKINST}" cfg-target="/etc/kamailio/" include_modules="${KAMAILIO_MODULES}"
+FAKE_FLAGS =		PREFIX=${PREFIX}
+USE_GMAKE =		Yes
+CONFIGURE_STYLE =	none
+DESTDIRNAME=BASEDIR
+NO_REGRESS =		Yes
+
+post-patch:
+.for f in kamctl kamdbctl
+	@cp ${WRKDIST}/scripts/${f} ${WRKDIST}/scripts/${f}.bak
+	@sed -e '1s,^#!/bin/bash,#!/usr/local/bin/bash,' ${WRKDIST}/scripts/${f}.bak > ${WRKDIST}/scripts/${f}
+.endfor
+
+post-install:
+	mv ${WRKINST}${SYSCONFDIR}/kamailio ${WRKINST}${LOCALBASE}/share/examples
+.include <bsd.port.mk>

+ 5 - 0
pkg/kamailio/openbsd/distinfo

@@ -0,0 +1,5 @@
+MD5 (kamailio-1.5.0-tls_src.tar.gz) = 
+RMD160 (kamailio-1.5.0-tls_src.tar.gz) = 
+SHA1 (kamailio-1.5.0-tls_src.tar.gz) = 
+SHA256 (kamailio-1.5.0-tls_src.tar.gz) = 
+SIZE (kamailio-1.5.0-tls_src.tar.gz) = 

+ 13 - 0
pkg/kamailio/openbsd/patches/patch-etc_kamailio_cfg

@@ -0,0 +1,13 @@
+$OpenBSD$
+--- etc/kamailio.cfg.orig	Thu Oct 23 19:32:11 2008
++++ etc/kamailio.cfg	Thu Oct 23 19:33:14 2008
+@@ -18,6 +18,9 @@ log_facility=LOG_LOCAL0
+ fork=yes
+ children=4
+ 
++user="_kamailio"
++group="_kamailio"
++
+ /* uncomment the following lines to enable debugging */
+ #debug=6
+ #fork=no

+ 15 - 0
pkg/kamailio/openbsd/patches/patch-modules_perl_Makefile

@@ -0,0 +1,15 @@
+$OpenBSD$
+--- modules/perl/Makefile.orig	Thu Oct 23 12:04:58 2008
++++ modules/perl/Makefile	Mon Nov  3 21:33:22 2008
+@@ -5,6 +5,11 @@
+ # 
+ # WARNING: do not run this directly, it should be run by the master Makefile
+ 
++# Force inclusion due to bug in gmake 3.81 on OpenBSD which causes the 
++# "export" command to fail when the variable name contains hyphens. (!)
++ifeq ($(OS),openbsd)
++	makefile_defs=0
++endif
+ include ../../Makefile.defs
+ auto_gen=
+ NAME=perl.so

+ 12 - 0
pkg/kamailio/openbsd/patches/patch-scripts_kamctlrc

@@ -0,0 +1,12 @@
+$OpenBSD$
+--- scripts/kamctlrc.orig	Thu Oct 23 12:04:49 2008
++++ scripts/kamctlrc	Mon Nov  3 20:15:24 2008
+@@ -135,7 +135,7 @@
+ 
+ ## OPENSER START Options
+ ## PID file path - default is: /var/run/kamailio.pid
+-# PID_FILE=/var/run/kamailio.pid
++PID_FILE=/var/kamailio/kamailio.pid
+ 
+ ## Extra start options - default is: not set
+ # example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64"

+ 1 - 0
pkg/kamailio/openbsd/pkg/COMMENT

@@ -0,0 +1 @@
+Kamailio, very fast and configurable SIP proxy

+ 18 - 0
pkg/kamailio/openbsd/pkg/DESCR

@@ -0,0 +1,18 @@
+Kamailio is a very fast and flexible SIP (RFC3261)
+proxy server. Written entirely in C, ser can handle thousands calls
+per second even on low-budget hardware. C Shell like scripting language
+provides full control over the server's behaviour. It's modular
+architecture allows only required functionality to be loaded.
+Currently the following modules are available: Digest Authentication,
+CPL scripts, Instant Messaging, MySQL support, UNIXODBC support,
+OSP support, Radius Authentication, Record Routing, SMS Gateway,
+Jabber Gateway, Transaction Module, Dialog Module, Registrar and
+User Location, SIMPLE Presence, Perl programming interface, SNMP.
+
+
+WWW: http://www.kamailio.org/
+
+- Bogdan-Andrei Iancu
[email protected]
+- Daniel-Constantin Mierla
[email protected]

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác