[sr-dev] git:master: kamailio.cfg: multi-domain support handled via define

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 7 00:32:35 CEST 2010


Module: sip-router
Branch: master
Commit: 0eef0a5e396f1be6e902ad17fcdb8a9d5a7be643
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0eef0a5e396f1be6e902ad17fcdb8a9d5a7be643

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Sep  6 23:09:23 2010 +0200

kamailio.cfg: multi-domain support handled via define

- #!define WITH_MULTIDOMAIN can be used to enable multi-domain support

---

 etc/kamailio.cfg |   92 ++++++++++++++++++++++++++++++++---------------------
 1 files changed, 55 insertions(+), 37 deletions(-)

diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index c74a7d4..9d33ec0 100644
--- a/etc/kamailio.cfg
+++ b/etc/kamailio.cfg
@@ -51,6 +51,10 @@
 #     - enable mysql
 #     - define WITH_ALIASDB
 #
+# *** To enable multi-domain support execute:
+#     - enable mysql
+#     - define WITH_MULTIDOMAIN
+#
 # *** To enhance accounting execute:
 #     - enable mysql
 #     - define WITH_ACCDB
@@ -74,6 +78,12 @@
 #       as: auth_db, acc, usrloc, a.s.o.
 #!define DBURL "mysql://openser:openserrw@localhost/openser"
 #!endif
+#!ifdef WITH_MULTIDOMAIN
+# - the value for 'use_domain' parameters
+#!define MULTIDOMAIN 1
+#!else
+#!define MULTIDOMAIN 0
+#!endif
 
 ####### Global Parameters #########
 
@@ -135,10 +145,10 @@ pstn.gw_ip = "" desc "PSTN GW Address"
 #set module path
 mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/"
 
-/* uncomment next line for MySQL DB support */
 #!ifdef WITH_MYSQL
 loadmodule "db_mysql.so"
 #!endif
+
 loadmodule "mi_fifo.so"
 loadmodule "kex.so"
 loadmodule "tm.so"
@@ -157,6 +167,7 @@ loadmodule "sanity.so"
 loadmodule "ctl.so"
 loadmodule "mi_rpc.so"
 loadmodule "acc.so"
+
 #!ifdef WITH_AUTH
 loadmodule "auth.so"
 loadmodule "auth_db.so"
@@ -169,11 +180,10 @@ loadmodule "permissions.so"
 loadmodule "alias_db.so"
 #!endif
 
-/* 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"
+#!ifdef WITH_MULTIDOMAIN
+loadmodule "domain.so"
+#!endif
+
 #!ifdef WITH_PRESENCE
 loadmodule "presence.so"
 loadmodule "presence_xml.so"
@@ -206,7 +216,7 @@ modparam("rr", "enable_full_lr", 1)
 modparam("rr", "append_fromtag", 0)
 
 
-# ----- rr params -----
+# ----- registrar params -----
 modparam("registrar", "method_filtering", 1)
 /* uncomment the next line to disable parallel forking via location */
 # modparam("registrar", "append_branches", 0)
@@ -219,13 +229,14 @@ modparam("registrar", "method_filtering", 1)
    in this configuration */
 modparam("uri_db", "use_uri_table", 0)
 modparam("uri_db", "db_url", "")
+modparam("uri_db", "use_domain", MULTIDOMAIN)
 
 
 # ----- acc params -----
-/* what sepcial events should be accounted ? */
-modparam("acc", "early_media", 1)
-modparam("acc", "report_ack", 1)
-modparam("acc", "report_cancels", 1)
+/* what special events should be accounted ? */
+modparam("acc", "early_media", 0)
+modparam("acc", "report_ack", 0)
+modparam("acc", "report_cancels", 0)
 /* 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 */
@@ -245,21 +256,25 @@ modparam("acc", "db_extra",
 	"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
 #!endif
 
+
 # ----- usrloc params -----
 /* enable DB persistency for location entries */
 #!ifdef WITH_USRLOCDB
-modparam("usrloc", "db_mode", 2)
 modparam("usrloc", "db_url", DBURL)
+modparam("usrloc", "db_mode", 2)
+modparam("usrloc", "use_domain", MULTIDOMAIN)
 #!endif
 
+
 # ----- auth_db params -----
-/* enable the DB based authentication */
 #!ifdef WITH_AUTH
+modparam("auth_db", "db_url", DBURL)
 modparam("auth_db", "calculate_ha1", yes)
 modparam("auth_db", "password_column", "password")
-modparam("auth_db", "db_url", DBURL)
 modparam("auth_db", "load_credentials", "")
+modparam("auth_db", "use_domain", MULTIDOMAIN)
 
+# ----- permissions params -----
 #!ifdef WITH_IPAUTH
 modparam("permissions", "db_url", DBURL)
 modparam("permissions", "db_mode", 1)
@@ -267,49 +282,52 @@ modparam("permissions", "db_mode", 1)
 
 #!endif
 
+
 # ----- alias_db params -----
 #!ifdef WITH_ALIASDB
 modparam("alias_db", "db_url", DBURL)
+modparam("alias_db", "use_domain", MULTIDOMAIN)
 #!endif
 
-# ----- domain params -----
-/* uncomment the following lines to enable multi-domain detection
-   support */
-#modparam("domain", "db_url", DBURL)
-#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)
+# ----- domain params -----
+#!ifdef WITH_MULTIDOMAIN
+modparam("domain", "db_url", DBURL)
+# use caching
+modparam("domain", "db_mode", 1)
+# register callback to match myself condition with domains list
+modparam("domain", "register_myself", 1)
+#!endif
 
 
-# ----- presence params -----
-/* enable presence server support */
 #!ifdef WITH_PRESENCE
-modparam("presence|presence_xml", "db_url", DBURL)
+# ----- presence params -----
+modparam("presence", "db_url", DBURL)
+
+# ----- presence_xml params -----
+modparam("presence_xml", "db_url", DBURL)
 modparam("presence_xml", "force_active", 1)
-modparam("presence", "server_address", "sip:10.0.0.10:5060")
 #!endif
 
+
 #!ifdef WITH_NAT
-# ----- rtpproxy -----
+# ----- rtpproxy params -----
 modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
-# ----- nathelper -----
+
+# ----- nathelper params -----
 modparam("nathelper", "natping_interval", 30)
 modparam("nathelper", "ping_nated_only", 1)
 modparam("nathelper", "sipping_bflag", 7)
 modparam("nathelper", "sipping_from", "sip:pinger at kamailio.org")
-modparam("registrar|nathelper", "received_avp", "$avp(i:80)")
+modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
 modparam("usrloc", "nat_bflag", 6)
 #!endif
 
 ####### Routing Logic ########
 
 
-# main request routing logic
-
+# Main SIP request routing logic
+# - processing of any incoming SIP request starts with this route
 route {
 
 	# per request initial checks
@@ -432,11 +450,13 @@ route[WITHINDLG] {
 			}
 			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
+					# no 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");
+					# ACK without matching transaction ... ignore and discard
 					exit;
 				}
 			}
@@ -621,8 +641,6 @@ route[RTPPROXY] {
 # Routing to foreign domains
 route[SIPOUT] {
 	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");
 		route(RELAY);




More information about the sr-dev mailing list