Hello list,
I have a question to the dispatcher module in Kamailio version 3.0.4.
In my integration I use this module for distributing calls to a set of gateways (with the round robin algorithm). Sometimes a gateway does not react or send back a negative response. In that case I use the function 'ds_mark_dst("p")' in the failure_route and mark the current destination with the flag 'probing'. I have set the threshhold value for probing mode to '10'. This means that a gateway is effectively set to probing mode only when it was marked with the flag 'probing' for 10 times. However, sometimes a gateway is sending back a negative response for e.g. 5 times and is afterwards working fine - without any problems. A few hours later (e.g.) it is sending a negative reply again for one time. This means: the counter for the probing_flags is increasing every time when the function ds_mark_dst("p") is executed (in case that the process was not restarted in the meantime!). So the problem is, that the counter is reaching the threshhold value at any time and at that moment the gateway is set to probing mode. Even if the gateway has sent a negative reply for only one time (at that moment) - but according the history the proging_flag was set several times.
What I miss in this module is a function to _reset_ that flag counter from a REPLY_ROUTE. Note: I have to reset the counter, because the gateway does not yet SIP OPTIONS requests and therefore it is set to 'probing' all time until it is manually set back to active via MI command or after a process restart. According the README file (and practical experience) the function ds_mark_dst() is executable only within the failure_route. However, when I want to set the flag ("a") for the current destination I will do it within a reply_route, but not in the failure_route (because I have received a positive response and not a negative one). From my point of view it does not make sense setting the 'active' flag for a destination from within a FAILURE route.
Does anybody have an idea, how the 'flag-counter' could be reset (from within the script)? I do not want to use a MI command.....
configuration excerpt:
[...] modparam("dispatcher", "db_url", "mysql://openser:openserrw@localhost/openser") modparam("dispatcher", "table_name", "dispatcher") modparam("dispatcher", "dst_avp", "$avp(AVP_DST)") modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)") modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)") modparam("dispatcher", "ds_ping_from", "sip:proxy@192.168.37.87") modparam("dispatcher", "ds_probing_mode", 0) modparam("dispatcher", "ds_probing_threshhold", 10) modparam("dispatcher", "ds_ping_interval", 30) modparam("dispatcher", "flags", 2) modparam("dispatcher", "force_dst", 1) [...] if (!ds_select_dst("1", "4")) { sl_send_reply("404", "No destination (disp)"); exit; } t_on_failure("failureroute"); t_on_reply("replyroute"); [...] failure_route[failureroute] { [...] if (t_check_status("[45][08]0") || (t_branch_timeout() && !t_branch_replied())) { ds_mark_dst("p"); if (!ds_next_dst()) { t_reply("404", "No destination (disp)"); exit; } t_on_failure("failureroute"); t_on_reply("replyroute"); }
[...] } onreply_route [replyroute] { if (t_check_status("180|200") { # nice to have...... # ds_mark_dst("a"); } }
Thanks in advance!
regards, Klaus