|
@@ -1355,7 +1355,7 @@ r,opt)
|
|
|
|
|
|
7.2. Kamailio config file
|
|
7.2. Kamailio config file
|
|
|
|
|
|
- Next picture shows a sample usage of the dispatcher module.
|
|
|
|
|
|
+ Next listing shows a sample config for using the dispatcher module.
|
|
|
|
|
|
Example 1.43. Kamailio config script - sample dispatcher usage
|
|
Example 1.43. Kamailio config script - sample dispatcher usage
|
|
...
|
|
...
|
|
@@ -1366,9 +1366,9 @@ r,opt)
|
|
# - no TPC listening
|
|
# - no TPC listening
|
|
# - don't dispatch REGISTER and presence requests
|
|
# - don't dispatch REGISTER and presence requests
|
|
#
|
|
#
|
|
-# Kamailio (OpenSER) SIP Server v3.2
|
|
|
|
|
|
+# Kamailio SIP Server
|
|
# - web: http://www.kamailio.org
|
|
# - web: http://www.kamailio.org
|
|
-# - git: http://sip-router.org
|
|
|
|
|
|
+# - git: http://github.com/kamailio/
|
|
#
|
|
#
|
|
# Direct your questions about this file to: [email protected]
|
|
# Direct your questions about this file to: [email protected]
|
|
#
|
|
#
|
|
@@ -1385,6 +1385,13 @@ r,opt)
|
|
#!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
|
|
#!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
|
|
#!endif
|
|
#!endif
|
|
|
|
|
|
|
|
+# - flags
|
|
|
|
+# FLT_ - per transaction (message) flags
|
|
|
|
+# FLB_ - per branch flags
|
|
|
|
+#!define FLT_ACC 1
|
|
|
|
+#!define FLT_ACCMISSED 2
|
|
|
|
+#!define FLT_ACCFAILED 3
|
|
|
|
+
|
|
####### Global Parameters #########
|
|
####### Global Parameters #########
|
|
|
|
|
|
#!ifdef WITH_DEBUG
|
|
#!ifdef WITH_DEBUG
|
|
@@ -1423,8 +1430,8 @@ sip_warning=no
|
|
|
|
|
|
####### Modules Section ########
|
|
####### Modules Section ########
|
|
|
|
|
|
-#set module path
|
|
|
|
-mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/"
|
|
|
|
|
|
+# set module path
|
|
|
|
+mpath="/usr/local/lib/kamailio/modules/"
|
|
|
|
|
|
loadmodule "db_mysql.so"
|
|
loadmodule "db_mysql.so"
|
|
loadmodule "mi_fifo.so"
|
|
loadmodule "mi_fifo.so"
|
|
@@ -1448,10 +1455,6 @@ loadmodule "dispatcher.so"
|
|
# ----------------- setting module-specific parameters ---------------
|
|
# ----------------- setting module-specific parameters ---------------
|
|
|
|
|
|
|
|
|
|
-# ----- mi_fifo params -----
|
|
|
|
-modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
|
|
|
|
-
|
|
|
|
-
|
|
|
|
# ----- rr params -----
|
|
# ----- rr params -----
|
|
# add value to ;lr param to cope with most of the UAs
|
|
# add value to ;lr param to cope with most of the UAs
|
|
modparam("rr", "enable_full_lr", 1)
|
|
modparam("rr", "enable_full_lr", 1)
|
|
@@ -1460,8 +1463,8 @@ modparam("rr", "append_fromtag", 0)
|
|
|
|
|
|
|
|
|
|
# ----- acc params -----
|
|
# ----- acc params -----
|
|
-modparam("acc", "log_flag", 1)
|
|
|
|
-modparam("acc", "failed_transaction_flag", 3)
|
|
|
|
|
|
+modparam("acc", "log_flag", FLT_ACC)
|
|
|
|
+modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
|
|
modparam("acc", "log_extra",
|
|
modparam("acc", "log_extra",
|
|
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;s
|
|
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;s
|
|
rc_ip=$si")
|
|
rc_ip=$si")
|
|
@@ -1484,7 +1487,7 @@ modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)")
|
|
|
|
|
|
# main request routing logic
|
|
# main request routing logic
|
|
|
|
|
|
-route {
|
|
|
|
|
|
+request_route {
|
|
|
|
|
|
# per request initial checks
|
|
# per request initial checks
|
|
route(REQINIT);
|
|
route(REQINIT);
|
|
@@ -1502,6 +1505,11 @@ route {
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ # handle retransmissions
|
|
|
|
+ if(t_precheck_trans()) {
|
|
|
|
+ t_check_trans();
|
|
|
|
+ exit;
|
|
|
|
+ }
|
|
t_check_trans();
|
|
t_check_trans();
|
|
|
|
|
|
# record routing for dialog forming requests (in case they are routed)
|
|
# record routing for dialog forming requests (in case they are routed)
|
|
@@ -1511,9 +1519,8 @@ route {
|
|
record_route();
|
|
record_route();
|
|
|
|
|
|
# account only INVITEs
|
|
# account only INVITEs
|
|
- if (is_method("INVITE"))
|
|
|
|
- {
|
|
|
|
- setflag(1); # do accounting
|
|
|
|
|
|
+ if (is_method("INVITE")) {
|
|
|
|
+ setflag(FLT_ACC); # do accounting
|
|
}
|
|
}
|
|
|
|
|
|
# handle presence related requests
|
|
# handle presence related requests
|
|
@@ -1522,8 +1529,7 @@ route {
|
|
# handle registrations
|
|
# handle registrations
|
|
route(REGISTRAR);
|
|
route(REGISTRAR);
|
|
|
|
|
|
- if ($rU==$null)
|
|
|
|
- {
|
|
|
|
|
|
+ if ($rU==$null) {
|
|
# request with no Username in RURI
|
|
# request with no Username in RURI
|
|
sl_send_reply("484","Address Incomplete");
|
|
sl_send_reply("484","Address Incomplete");
|
|
exit;
|
|
exit;
|
|
@@ -1548,8 +1554,7 @@ route[REQINIT] {
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
|
|
|
|
- if(!sanity_check("1511", "7"))
|
|
|
|
- {
|
|
|
|
|
|
+ if(!sanity_check("1511", "7")) {
|
|
xlog("Malformed SIP message from $si:$sp\n");
|
|
xlog("Malformed SIP message from $si:$sp\n");
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
@@ -1562,8 +1567,9 @@ route[WITHINDLG] {
|
|
# take the path determined by record-routing
|
|
# take the path determined by record-routing
|
|
if (loose_route()) {
|
|
if (loose_route()) {
|
|
if (is_method("BYE")) {
|
|
if (is_method("BYE")) {
|
|
- setflag(1); # do accounting ...
|
|
|
|
- setflag(3); # ... even if the transaction fails
|
|
|
|
|
|
+ setflag(FLT_ACC); # do accounting ...
|
|
|
|
+ setflag(FLT_ACCFAILED); # ... even if the transa
|
|
|
|
+ction fails
|
|
}
|
|
}
|
|
route(RELAY);
|
|
route(RELAY);
|
|
} else {
|
|
} else {
|
|
@@ -1611,8 +1617,7 @@ route[PRESENCE] {
|
|
# Dispatch requests
|
|
# Dispatch requests
|
|
route[DISPATCH] {
|
|
route[DISPATCH] {
|
|
# round robin dispatching on gateways group '1'
|
|
# round robin dispatching on gateways group '1'
|
|
- if(!ds_select_dst("1", "4"))
|
|
|
|
- {
|
|
|
|
|
|
+ if(!ds_select_dst("1", "4")) {
|
|
send_reply("404", "No destination");
|
|
send_reply("404", "No destination");
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
@@ -1622,17 +1627,15 @@ route[DISPATCH] {
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
|
|
|
|
-# Sample failure route
|
|
|
|
|
|
+# Try next destionations in failure route
|
|
failure_route[RTF_DISPATCH] {
|
|
failure_route[RTF_DISPATCH] {
|
|
if (t_is_canceled()) {
|
|
if (t_is_canceled()) {
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
# next DST - only for 500 or local timeout
|
|
# next DST - only for 500 or local timeout
|
|
if (t_check_status("500")
|
|
if (t_check_status("500")
|
|
- or (t_branch_timeout() and !t_branch_replied()))
|
|
|
|
- {
|
|
|
|
- if(ds_next_dst())
|
|
|
|
- {
|
|
|
|
|
|
+ or (t_branch_timeout() and !t_branch_replied())) {
|
|
|
|
+ if(ds_next_dst()) {
|
|
t_on_failure("RTF_DISPATCH");
|
|
t_on_failure("RTF_DISPATCH");
|
|
route(RELAY);
|
|
route(RELAY);
|
|
exit;
|
|
exit;
|
|
@@ -1640,8 +1643,6 @@ failure_route[RTF_DISPATCH] {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
...
|
|
...
|
|
|
|
|
|
8. Event routes
|
|
8. Event routes
|