Skip to content

Commit

Permalink
dispatcher: updates to sameple config file
Browse files Browse the repository at this point in the history
(cherry picked from commit 0b3d6ad)
  • Loading branch information
miconda committed Nov 11, 2016
1 parent 852c47f commit 1d1e7c8
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions modules/dispatcher/doc/dispatcher.cfg
Expand Up @@ -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
#
Expand All @@ -16,14 +16,21 @@
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode:
# *** To run in debug mode:
# - define WITH_DEBUG
#

#!ifndef DBURL
#!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
Expand Down Expand Up @@ -54,16 +61,16 @@ 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

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"
Expand All @@ -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)
Expand All @@ -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 -----
Expand All @@ -122,7 +125,7 @@ modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)")

# main request routing logic

route {
request_route {

# per request initial checks
route(REQINIT);
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
}
}


0 comments on commit 1d1e7c8

Please sign in to comment.