Pārlūkot izejas kodu

etc: kamailio.cfg - several updates

- use force_rport() at the beginning of processing requests, note added
in the top comments to inform that config performs symmetric signaling
- load textopsx module and added define option to apply changes before
presence handling, so changes to headers or body are visible to presence
functions
- modparams to enable use of Path for registrar module
- modparam timer_procs for usrloc module
- a bit of refactoring for debug mode, level being set by a defined
token and log_stderror is set always to no, so even with higher debug
level logs are sent to syslog (added comment how to enable it via
setting value to 'yes' or using -E cli option)
- updated notes for debug mode and listen param
- GH #2381
Daniel-Constantin Mierla 5 gadi atpakaļ
vecāks
revīzija
aebae41bcc
1 mainītis faili ar 42 papildinājumiem un 18 dzēšanām
  1. 42 18
      etc/kamailio.cfg

+ 42 - 18
etc/kamailio.cfg

@@ -15,11 +15,16 @@
 #       #!subst, #!substdef, ...
 #       #!subst, #!substdef, ...
 #     - lines starting with //
 #     - lines starting with //
 #     - blocks enclosed in between /* */
 #     - blocks enclosed in between /* */
+# Note: the config performs symmetric SIP signaling
+#     - it sends the reply to the source address of the request
+#     - remove the use of force_rport() for asymmetric SIP signaling
 #
 #
 # Several features can be enabled using '#!define WITH_FEATURE' directives:
 # Several features can be enabled using '#!define WITH_FEATURE' directives:
 #
 #
 # *** To run in debug mode:
 # *** To run in debug mode:
 #     - define WITH_DEBUG
 #     - define WITH_DEBUG
+#     - debug level increased to 3, logs still sent to syslog
+#     - debugger module loaded with cfgtrace endabled
 #
 #
 # *** To enable mysql:
 # *** To enable mysql:
 #     - define WITH_MYSQL
 #     - define WITH_MYSQL
@@ -27,7 +32,7 @@
 # *** To enable authentication execute:
 # *** To enable authentication execute:
 #     - enable mysql
 #     - enable mysql
 #     - define WITH_AUTH
 #     - define WITH_AUTH
-#     - add users using 'kamctl'
+#     - add users using 'kamctl' or 'kamcli'
 #
 #
 # *** To enable IP authentication execute:
 # *** To enable IP authentication execute:
 #     - enable mysql
 #     - enable mysql
@@ -42,6 +47,8 @@
 # *** To enable presence server execute:
 # *** To enable presence server execute:
 #     - enable mysql
 #     - enable mysql
 #     - define WITH_PRESENCE
 #     - define WITH_PRESENCE
+#     - if modified headers or body in config must be used by presence handling:
+#     - define WITH_MSGREBUILD
 #
 #
 # *** To enable nat traversal execute:
 # *** To enable nat traversal execute:
 #     - define WITH_NAT
 #     - define WITH_NAT
@@ -122,13 +129,18 @@ import_file "kamailio-local.cfg"
 ####### Defined Values #########
 ####### Defined Values #########
 
 
 # *** Value defines - IDs used later in config
 # *** Value defines - IDs used later in config
+#!ifdef WITH_DEBUG
+#!define DBGLEVEL 3
+#!else
+#!define DBGLEVEL 2
+#!endif
+
 #!ifdef WITH_MYSQL
 #!ifdef WITH_MYSQL
 # - database URL - used to connect to database server by modules such
 # - database URL - used to connect to database server by modules such
 #       as: auth_db, acc, usrloc, a.s.o.
 #       as: auth_db, acc, usrloc, a.s.o.
-#!ifndef DBURL
-#!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
-#!endif
+#!trydef DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
 #!endif
 #!endif
+
 #!ifdef WITH_MULTIDOMAIN
 #!ifdef WITH_MULTIDOMAIN
 # - the value for 'use_domain' parameters
 # - the value for 'use_domain' parameters
 #!define MULTIDOMAIN 1
 #!define MULTIDOMAIN 1
@@ -149,14 +161,11 @@ import_file "kamailio-local.cfg"
 
 
 ####### Global Parameters #########
 ####### Global Parameters #########
 
 
-### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
-#!ifdef WITH_DEBUG
-debug=4
-log_stderror=yes
-#!else
-debug=2
+/* LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR, ... */
+debug=DBGLEVEL
+
+/* set to 'yes' to print log messages to terminal or use '-E' cli option */
 log_stderror=no
 log_stderror=no
-#!endif
 
 
 memdbg=5
 memdbg=5
 memlog=5
 memlog=5
@@ -178,11 +187,13 @@ children=8
  * based on reverse DNS on IPs (default on) */
  * based on reverse DNS on IPs (default on) */
 # auto_aliases=no
 # auto_aliases=no
 
 
-/* add local domain aliases */
+/* add local domain aliases - it can be set many times */
 # alias="sip.mydomain.com"
 # alias="sip.mydomain.com"
 
 
-/* uncomment and configure the following line if you want Kamailio to
- * bind on a specific interface/port/proto (default bind on all available) */
+/* listen sockets - if none set, Kamailio binds to all local IP addresses
+ * - basic prototype (full prototype can be found in Wiki - Core Cookbook):
+ *      listen=[proto]:[localip]:[lport] advertise [publicip]:[pport]
+ * - it can be set many times to add more sockets to listen to */
 # listen=udp:10.0.0.10:5060
 # listen=udp:10.0.0.10:5060
 
 
 /* life time of TCP connection when there is no traffic
 /* life time of TCP connection when there is no traffic
@@ -204,7 +215,7 @@ tls_max_connections=2048
 #!endif
 #!endif
 
 
 /* set it to yes to enable sctp and load sctp.so module */
 /* set it to yes to enable sctp and load sctp.so module */
-disable_sctp = yes
+disable_sctp=yes
 
 
 ####### Custom Parameters #########
 ####### Custom Parameters #########
 
 
@@ -257,6 +268,7 @@ loadmodule "maxfwd.so"
 loadmodule "usrloc.so"
 loadmodule "usrloc.so"
 loadmodule "registrar.so"
 loadmodule "registrar.so"
 loadmodule "textops.so"
 loadmodule "textops.so"
+loadmodule "textopsx.so"
 loadmodule "siputils.so"
 loadmodule "siputils.so"
 loadmodule "xlog.so"
 loadmodule "xlog.so"
 loadmodule "sanity.so"
 loadmodule "sanity.so"
@@ -356,6 +368,10 @@ modparam("registrar", "method_filtering", 1)
 modparam("registrar", "max_expires", 3600)
 modparam("registrar", "max_expires", 3600)
 /* set it to 1 to enable GRUU */
 /* set it to 1 to enable GRUU */
 modparam("registrar", "gruu_enabled", 0)
 modparam("registrar", "gruu_enabled", 0)
+/* set it to 0 to disable Path handling */
+modparam("registrar", "use_path", 1)
+/* save Path even if not listed in Supported header */
+modparam("registrar", "path_mode", 0)
 
 
 # ----- acc params -----
 # ----- acc params -----
 /* what special events should be accounted ? */
 /* what special events should be accounted ? */
@@ -384,11 +400,13 @@ modparam("acc", "db_extra",
 #!endif
 #!endif
 
 
 # ----- usrloc params -----
 # ----- usrloc params -----
+modparam("usrloc", "timer_interval", 60)
+modparam("usrloc", "timer_procs", 1)
+modparam("usrloc", "use_domain", MULTIDOMAIN)
 /* enable DB persistency for location entries */
 /* enable DB persistency for location entries */
 #!ifdef WITH_USRLOCDB
 #!ifdef WITH_USRLOCDB
 modparam("usrloc", "db_url", DBURL)
 modparam("usrloc", "db_url", DBURL)
 modparam("usrloc", "db_mode", 2)
 modparam("usrloc", "db_mode", 2)
-modparam("usrloc", "use_domain", MULTIDOMAIN)
 #!endif
 #!endif
 
 
 # ----- auth_db params -----
 # ----- auth_db params -----
@@ -576,6 +594,9 @@ route[RELAY] {
 route[REQINIT] {
 route[REQINIT] {
 	# no connect for sending replies
 	# no connect for sending replies
 	set_reply_no_connect();
 	set_reply_no_connect();
+	# enforce symmetric signaling
+	# - send back replies to the source address of request
+	force_rport();
 
 
 #!ifdef WITH_ANTIFLOOD
 #!ifdef WITH_ANTIFLOOD
 	# flood detection from same IP and traffic ban for a while
 	# flood detection from same IP and traffic ban for a while
@@ -732,6 +753,10 @@ route[PRESENCE] {
 	}
 	}
 
 
 #!ifdef WITH_PRESENCE
 #!ifdef WITH_PRESENCE
+#!ifdef WITH_MSGREBUILD
+	# apply changes in case the request headers or body were modified
+	msg_apply_changes();
+#!endif
 	if (!t_newtran()) {
 	if (!t_newtran()) {
 		sl_reply_error();
 		sl_reply_error();
 		exit;
 		exit;
@@ -798,7 +823,6 @@ route[AUTH] {
 # Caller NAT detection
 # Caller NAT detection
 route[NATDETECT] {
 route[NATDETECT] {
 #!ifdef WITH_NAT
 #!ifdef WITH_NAT
-	force_rport();
 	if (nat_uac_test("19")) {
 	if (nat_uac_test("19")) {
 		if (is_method("REGISTER")) {
 		if (is_method("REGISTER")) {
 			fix_nated_register();
 			fix_nated_register();
@@ -879,7 +903,7 @@ route[DLGURI] {
 route[SIPOUT] {
 route[SIPOUT] {
 	if (uri==myself) return;
 	if (uri==myself) return;
 
 
-	append_hf("P-hint: outbound\r\n");
+	append_hf("P-Hint: outbound\r\n");
 	route(RELAY);
 	route(RELAY);
 	exit;
 	exit;
 }
 }