[SR-Users] Custom fr timer for dialog's OPTIONS keep alives

Vassilis Radis radisb at gmail.com
Thu Apr 17 14:25:12 CEST 2014

Thanks Alex,

What you said is correct: I want to shorten the timeout for non-response to
the OPTIONS keepalives in order to end calls with dead peers much more
faster. Right now, no matter how often those keep-alives are sent, since
the timeout is about 30s, I have to wait 30s when a peer does not respond.
In the meantime, dialog module, if ka_timer is less than 30s, keeps sending
more keepalives. So I thought that maybe we could set the ka_timer
parameter to represent the fr timer for the OPTIONS, and the ka_interval to
represent the interval between successfully responded keep-alives. So the
final result would be:
User sets ka_timer to e.g. 5 secs and ka_interval to e.g 3 secs. then
dialog module sends OPTIONS with timeout of 5 secs and waits for the fake
408 or 481 or a succesful 200 response, whichever hits first. If timer hits
first we expire the dialog. If 200 response comes first, we send another
OPTIONS again after 3 secs and so on. This way we can adjust it however we
want, and no keep-alive is sent before the previous is expired or is

The only way I can see this happening is the final response timer for those
OPTIONS. So I am trying to find out how to do it, because from script I
cant, since I have no control over the sending or creation of those keep
alives because dialog module doesnt expose any parameter to adjust it. You
are right it should be through a parameter, but I am new to kamailio
internals and just beginning messing with the source code and for now I am
just looking to succeed in reducing the timer.

See this
my last comment to see how I got to trying to reduce this timer.

Any advice on how to proceed?

On Thu, Apr 17, 2014 at 2:39 PM, Alex Balashov <abalashov at evaristesys.com>wrote:

> What are you going to do when this timer fires?
> Internally generated requests do not create TM transactions that are
> accessible from route script.
> What is your actual goal? To change the timeout for non-response to the
> OPTIONS keepalives? If so, that should probably be added as a modparam. In
> that case, fr_timer isn't quite the language in which to speak of it, as
> that makes it sound like a transaction to which you have access in script
> (with the implication that its failure can trigger a failure_route callback
> of your own making). That's not the case here.
> On 17 April 2014 15:33:57 GMT+04:00, Vassilis Radis <radisb at gmail.com>
> wrote:
>> Hello, I would like to try customizing the fr_timer for the OPTIONS
>> keep-alive msgs transactions that the dialog module sends. I tried to call
>> t_set_fr() function from inside the dialog modules's code (in
>> dlg_req_within.c , in dlg_send_ka() function after the call to d_tmb.
>> t_request_within(&uac_r);
>> But it seems that this tm function is not available from inside other
>> module's code.
>> Is the above is the correct place to try and do it, and how can I
>> programmatically ,inside a module's code, adjust fr_timer?
>> On a side note, i followed the call flow from dlg_send_ka() down to the
>> t_uac_prepare() function of tm module, where the fr_timer is set. In there,
>> there is this comment+code:
>> /* init timers hack, new_cell->fr_timer and new_cell->fr_inv_timer
>>   * must be set, or else the fr will happen immediately
>>   * we can't call init_new_t() because we don't have a sip msg
>>   * => we'll ignore t_set_fr() or avp timer value and will use directly the
>>   * module params fr_inv_timer and fr_timer -- andrei */
>>  new_cell->fr_timeout=cfg_get(tm, tm_cfg, fr_timeout);
>>  new_cell->fr_inv_timeout=cfg_get(tm, tm_cfg, fr_inv_timeout);
>>  new_cell->end_of_life=get_ticks_raw()+lifetime;
>> Does this mean that it cant be done in a straighforward way?
>> Any advice on how I can achieve the customized fr_timers for those
>> messages?
>> Thanks.
>> ------------------------------
>> 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
> --
> Sent from my mobile, and thus lacking in the refinement one might expect
> from a fully fledged keyboard.
> Alex Balashov - Principal
> Evariste Systems LLC
> 235 E Ponce de Leon Ave
> Suite 106
> Decatur, GA 30030
> United States
> Tel: +1-678-954-0671
> Web: http://www.evaristesys.com/, http://www.alexbalashov.com
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140417/91303b0b/attachment.html>

More information about the sr-users mailing list