[SR-Users] Kamailio 3.0.4: dispatcher module request

Carsten Bock lists at bock.info
Mon Mar 7 21:41:02 CET 2011


Hi,

sorry for the delay... it was a busy week.
I have just commited a change to the current master branch so that you
may call "ds_mark_dst("a")" in a reply route. Setting the gateway to
"active" will now also reset the failure counter. I have adapted the
docs accordingly.
Please feel free to test...

Yes, you are correct: There is (except from calling kamctl fifo
ds_set_state 1 1 sip:....) no way, to reset a gateway to an active
state, if the failure-counter was increased....

Carsten

P.S.: If you are using Asterisk, i think there is a way to do this
from config, but i have to search....


2011/2/24 Klaus Feichtinger <klaus.lists at inode.at>:
> thanks Carsten for your information. So I'm not the first one who wishes
> this functionality :-) I'm looking forward to using this function in the
> new release.
>
> Does this mean that in Kamailio 3.0.4 no possibility is given for
> automatically changing the state of a destination from 'nearly-probing' to
> 'active'? Could the state being changed manually only?
>
> regards
> Klaus
>
> P.S. I think we have to speed up implementation of SIP OPTIONS support in
> the gateway - this would reset the state from probing to active.....
>
>> Hi Klaus,
>>
>> I used to use that function especially for the purpose of resetting the
>> failure-counter.
>> We are using the "ds_set_state("r")" ("r" as "reset counter") in a
>> "onreply"-route; i will check, why i never commited that patch to the
>> Kamailio-Repository.
>> I will add this functionality to git-Trunk in the next few days;
>> however, since it is a new feature, i will not backport it (but i can
>> provide patches for 3.1).
>>
>> Kind regards,
>> Carsten
>>
>>
>>
>> 2011/2/24 Klaus Feichtinger <klaus.lists at inode.at>:
>>> 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 at 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
>>>
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>>> list sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>
>>
>>
>> --
>> Carsten Bock
>> Schomburgstr. 80
>> 22767 Hamburg
>> Germany
>>
>> Mobile +49 179 2021244
>> Home +49 40 34927217
>> Büro (Verl) +49 5246 801427
>> Fax +49 40 34927218
>> mailto:carsten at bock.info
>
>
>
>



-- 
Carsten Bock
http://www.ng-voice.com
mailto:carsten at ng-voice.com

Schomburgstr. 80
22767 Hamburg
Germany

Mobile +49 179 2021244
Office +49 40 34927219
Fax +49 40 34927220



More information about the sr-users mailing list