Hi All,
I would like to reduce the time it takes for kamailio to timeout an initial message to a dispatcher destination so that it will select the next destination in the set, before, hopefully, a restransmission. In this case I am testing registration messages.
I came accross the t_set_fr() function in the TM module documentation today and have been experimenting with it for some hours. I have an issue where a 408 timout is sent back to the UAC before the last destination in the dispatcher set is selected, I suspect I am hitting the timeout somewhere, but I cannot see where, I presume the fr_timeout is set every time I issue the t_set_fr() call and the associated t_relay.
I'm just wondering if I am doing this correctly, if one of the guru's out there wouldnt mind casting an eyeball over this config and let me know if I am on the right track, or if I am going about this in the wrong way. Any suggestions are most welcome.
What appears to be happening is, I have 3 destinations in the dispatcher set, it looks like the 1st 2 are tried, which correctly timeout and are set inactive-probing, but on the last destination, which is working, I appear to be getting a 408 timeout being sent back from kamailio.
Here is a snip of my configuration:
#!define NO_RESPONSE_TIMER 250
request_route { t_on_failure("DISPATCHER_FAILURE"); t_set_fr(0, NO_RESPONSE_TIMER); if(!ds_select_dst("1", "0")) { xlog("L_ERR", "No dispatcher destinations available for $ru\n"); sl_send_reply("500", "No destination available"); exit; } route("RELAY") }
route[RELAY] { if (!t_relay()) { sl_reply_error(); } exit; }
failure_route[DISPATCHER_FAILURE] { if (t_is_canceled()) { exit; }
# select next destination only for local timeout if (t_branch_timeout() && !t_branch_replied()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : timeout and no reply ($si:$sp->$Ri:$Rp->$du)\n"); xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : setting $du to probing state"); ds_mark_dst("ip"); if(ds_next_dst()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : next destination selected ($du)\n"); t_set_fr(0, NO_RESPONSE_TIMER); t_relay(); exit; } else { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : No destinations available for $rd"); send_reply("500", "No destination available"); exit; } } }
Hello,
you need to re-arm the failure route inside the failure_route, before relaying again. Failure routes are armed one time, when a final response is received, it is reset.
Cheers, Daniel
On 06/07/15 19:40, Asgaroth wrote:
Hi All,
I would like to reduce the time it takes for kamailio to timeout an initial message to a dispatcher destination so that it will select the next destination in the set, before, hopefully, a restransmission. In this case I am testing registration messages.
I came accross the t_set_fr() function in the TM module documentation today and have been experimenting with it for some hours. I have an issue where a 408 timout is sent back to the UAC before the last destination in the dispatcher set is selected, I suspect I am hitting the timeout somewhere, but I cannot see where, I presume the fr_timeout is set every time I issue the t_set_fr() call and the associated t_relay.
I'm just wondering if I am doing this correctly, if one of the guru's out there wouldnt mind casting an eyeball over this config and let me know if I am on the right track, or if I am going about this in the wrong way. Any suggestions are most welcome.
What appears to be happening is, I have 3 destinations in the dispatcher set, it looks like the 1st 2 are tried, which correctly timeout and are set inactive-probing, but on the last destination, which is working, I appear to be getting a 408 timeout being sent back from kamailio.
Here is a snip of my configuration:
#!define NO_RESPONSE_TIMER 250
request_route { t_on_failure("DISPATCHER_FAILURE"); t_set_fr(0, NO_RESPONSE_TIMER); if(!ds_select_dst("1", "0")) { xlog("L_ERR", "No dispatcher destinations available for $ru\n"); sl_send_reply("500", "No destination available"); exit; } route("RELAY") }
route[RELAY] { if (!t_relay()) { sl_reply_error(); } exit; }
failure_route[DISPATCHER_FAILURE] { if (t_is_canceled()) { exit; }
# select next destination only for local timeout if (t_branch_timeout() && !t_branch_replied()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : timeout and
no reply ($si:$sp->$Ri:$Rp->$du)\n"); xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : setting $du to probing state"); ds_mark_dst("ip"); if(ds_next_dst()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : next destination selected ($du)\n"); t_set_fr(0, NO_RESPONSE_TIMER); t_relay(); exit; } else { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : No destinations available for $rd"); send_reply("500", "No destination available"); exit; } } }
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hi Daniel,
Thanks for the info, that corrected the issue.
Just another quick one, I presume that when I set the fr_timout timer on an initial request, does it stay set for all subsequent messages during the transaction/dialog lifetime? If I only wanted it to fire for 250ms on the initial request (INVITE/SUBSCRIBE/REGESTER etc) in the main routing block (and failure routing block) do I need to reset the timer(s) to the defaults after the t_relay is issued, or do I need to catch and reset it on the reply?
For example, if I did something like this would it achieve what I'm trying to explain in the above paragraph:
#!define NO_RESPONSE_TIMER 250 request_route { t_on_failure("DISPATCHER_FAILURE"); t_set_fr(0, NO_RESPONSE_TIMER); if(!ds_select_dst("1", "0")) { xlog("L_ERR", "No dispatcher destinations available for $ru\n"); sl_send_reply("500", "No destination available"); exit; } route("RELAY"); *t_reset_fr()* }
route[RELAY] { if (!t_relay()) { sl_reply_error(); } exit; }
failure_route[DISPATCHER_FAILURE] { if (t_is_canceled()) { exit; }
# select next destination only for local timeout if (t_branch_timeout() && !t_branch_replied()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : timeout and no reply ($si:$sp->$Ri:$Rp->$du)\n"); xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : setting $du to probing state"); ds_mark_dst("ip"); if(ds_next_dst()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : next destination selected ($du)\n"); t_on_failure("DISPATCHER_FAILURE "); t_set_fr(0, NO_RESPONSE_TIMER); t_relay(); *t_reset_fr();* exit; } else { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : No destinations available for $rd"); send_reply("500", "No destination available"); exit; } } }
On 07/07/2015 08:06, Daniel-Constantin Mierla wrote:
Hello,
you need to re-arm the failure route inside the failure_route, before relaying again. Failure routes are armed one time, when a final response is received, it is reset.
Cheers, Daniel
On 06/07/15 19:40, Asgaroth wrote:
Hi All,
I would like to reduce the time it takes for kamailio to timeout an initial message to a dispatcher destination so that it will select the next destination in the set, before, hopefully, a restransmission. In this case I am testing registration messages.
I came accross the t_set_fr() function in the TM module documentation today and have been experimenting with it for some hours. I have an issue where a 408 timout is sent back to the UAC before the last destination in the dispatcher set is selected, I suspect I am hitting the timeout somewhere, but I cannot see where, I presume the fr_timeout is set every time I issue the t_set_fr() call and the associated t_relay.
I'm just wondering if I am doing this correctly, if one of the guru's out there wouldnt mind casting an eyeball over this config and let me know if I am on the right track, or if I am going about this in the wrong way. Any suggestions are most welcome.
What appears to be happening is, I have 3 destinations in the dispatcher set, it looks like the 1st 2 are tried, which correctly timeout and are set inactive-probing, but on the last destination, which is working, I appear to be getting a 408 timeout being sent back from kamailio.
Here is a snip of my configuration:
#!define NO_RESPONSE_TIMER 250
request_route { t_on_failure("DISPATCHER_FAILURE"); t_set_fr(0, NO_RESPONSE_TIMER); if(!ds_select_dst("1", "0")) { xlog("L_ERR", "No dispatcher destinations available for $ru\n"); sl_send_reply("500", "No destination available"); exit; } route("RELAY") }
route[RELAY] { if (!t_relay()) { sl_reply_error(); } exit; }
failure_route[DISPATCHER_FAILURE] { if (t_is_canceled()) { exit; }
# select next destination only for local timeout if (t_branch_timeout() && !t_branch_replied()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : timeout and
no reply ($si:$sp->$Ri:$Rp->$du)\n"); xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : setting $du to probing state"); ds_mark_dst("ip"); if(ds_next_dst()) { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : next destination selected ($du)\n"); t_set_fr(0, NO_RESPONSE_TIMER); t_relay(); exit; } else { xlog("L_INFO", "route[DISPATCHER_FAILURE] : $rm : No destinations available for $rd"); send_reply("500", "No destination available"); exit; } } }
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users