Hello Everyone,
I am really having an issue getting kamailio to try another dispatch route
when I get a 500 back from one of my freeswitch servers.
Currently I have a list of freeswitch servers located in my dispatch.list
file. If one of then is to busy it will respond with a 500 Maximum Call in
Progress. I am trying to get Kamailio to go to the next route in the
dispatch.list when it get one of these 503 and if it should exhaust the
whole list respond with a 503. Here is my kamailio config
####### Global Parameters #########
#!ifdef WITH_DEBUG
debug=4
log_stderror=yes
#!else
debug=4
log_stderror=yes
#!endif
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
fork=yes
children=10
/* comment the next line to enable TCP */
disable_tcp=yes
/* uncomment the next line to disable the auto discovery of local aliases
based on revers DNS on IPs (default on) */
auto_aliases=no
/* 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:eth0:5060
sip_warning=no
####### Modules Section ########
#set module path
mpath="/usr/local/lib64/kamailio/modules_k/:/usr/local/lib64/kamailio/modules/"
loadmodule "mi_fifo.so"
loadmodule "kex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "mi_rpc.so"
loadmodule "acc.so"
loadmodule "dispatcher.so"
# ----------------- setting module-specific parameters ---------------
# ----- mi_fifo params -----
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
modparam("xlog", "buf_size", 8192)
# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)
# ----- acc params -----
modparam("acc", "log_flag", 1)
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_extra",
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")
# ----- tm params -----
modparam("tm", "fr_timer", 2000)
modparam("tm", "fr_inv_timer", 40000)
modparam("tm", "remap_503_500", 0)
# ----- dispatcher params -----
modparam("dispatcher", "list_file",
"/usr/local/etc/kamailio/dispatcher.list")
modparam("dispatcher", "flags", 2)
modparam("dispatcher", "dst_avp", "$avp(i:271)")
modparam("dispatcher", "grp_avp", "$avp(i:272)")
modparam("dispatcher", "cnt_avp", "$avp(i:273)")
#modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
#modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
#modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
#modparam("dispatcher", "ds_append_branch", 1)
####### Routing Logic ########
# main request routing logic
route {
append_hf("X-VSIP-CUST-IP: $si\r\n");
route(DISPATCH);
route(RELAY);
}
# Dispatch requests
route[DISPATCH] {
# round robin dispatching on gateways group '1'
if(!ds_select_dst("1", "4"))
{
send_reply("404", "No destination");
exit;
}
# xlog("L_DBG", "--- SCRIPT: going to <$ru> via
<$du>\n");
t_on_failure("RTF_DISPATCH");
return;
}
# Sample 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())
{
t_on_failure("DISPATCH");
route(RELAY);
exit;
}
}
}
route[RELAY] {
if (!t_relay()) {
send_reply("503", "LB01 - All Circuits Are Busy");
# sl_reply_error();
}
exit;
}
I am very new to kamailio and still learning my way around. Any help you
can provide with be fantastic!
Thank you,
Joe Watson