From 1d1e7c87c117dae367b3dc476fe1bbe6aa5aeef5 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 11 Nov 2016 12:15:59 +0100 Subject: [PATCH] dispatcher: updates to sameple config file (cherry picked from commit 0b3d6ad3238d28c1c3aaf8c39052405ffdaa21df) --- modules/dispatcher/doc/dispatcher.cfg | 64 +++++++++++++-------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/modules/dispatcher/doc/dispatcher.cfg b/modules/dispatcher/doc/dispatcher.cfg index 08ea285b570..475941d1a7a 100644 --- a/modules/dispatcher/doc/dispatcher.cfg +++ b/modules/dispatcher/doc/dispatcher.cfg @@ -5,9 +5,9 @@ # - no TPC listening # - don't dispatch REGISTER and presence requests # -# Kamailio (OpenSER) SIP Server v3.2 +# Kamailio SIP Server # - web: http://www.kamailio.org -# - git: http://sip-router.org +# - git: http://github.com/kamailio/ # # Direct your questions about this file to: sr-users@lists.sip-router.org # @@ -16,7 +16,7 @@ # # Several features can be enabled using '#!define WITH_FEATURE' directives: # -# *** To run in debug mode: +# *** To run in debug mode: # - define WITH_DEBUG # @@ -24,6 +24,13 @@ #!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio" #!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 ######### #!ifdef WITH_DEBUG @@ -54,7 +61,7 @@ auto_aliases=no port=5060 -/* uncomment and configure the following line if you want Kamailio to +/* 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:127.0.0.1:5060 @@ -62,8 +69,8 @@ sip_warning=no ####### 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 "mi_fifo.so" @@ -87,10 +94,6 @@ loadmodule "dispatcher.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) @@ -99,9 +102,9 @@ modparam("rr", "append_fromtag", 0) # ----- acc params ----- -modparam("acc", "log_flag", 1) -modparam("acc", "failed_transaction_flag", 3) -modparam("acc", "log_extra", +modparam("acc", "log_flag", FLT_ACC) +modparam("acc", "failed_transaction_flag", FLT_ACCFAILED) +modparam("acc", "log_extra", "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si") # ----- tm params ----- @@ -122,7 +125,7 @@ modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)") # main request routing logic -route { +request_route { # per request initial checks route(REQINIT); @@ -140,6 +143,11 @@ route { exit; } + # handle retransmissions + if(t_precheck_trans()) { + t_check_trans(); + exit; + } t_check_trans(); # record routing for dialog forming requests (in case they are routed) @@ -149,9 +157,8 @@ route { record_route(); # account only INVITEs - if (is_method("INVITE")) - { - setflag(1); # do accounting + if (is_method("INVITE")) { + setflag(FLT_ACC); # do accounting } # handle presence related requests @@ -160,8 +167,7 @@ route { # handle registrations route(REGISTRAR); - if ($rU==$null) - { + if ($rU==$null) { # request with no Username in RURI sl_send_reply("484","Address Incomplete"); exit; @@ -186,8 +192,7 @@ route[REQINIT] { exit; } - if(!sanity_check("1511", "7")) - { + if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; } @@ -200,8 +205,8 @@ route[WITHINDLG] { # 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 + setflag(FLT_ACC); # do accounting ... + setflag(FLT_ACCFAILED); # ... even if the transaction fails } route(RELAY); } else { @@ -247,8 +252,7 @@ route[PRESENCE] { # Dispatch requests route[DISPATCH] { # round robin dispatching on gateways group '1' - if(!ds_select_dst("1", "4")) - { + if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } @@ -258,22 +262,18 @@ route[DISPATCH] { exit; } -# Sample failure route +# Try next destionations in failure route failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # next DST - only for 500 or local timeout 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"); route(RELAY); exit; } } } - -