[OpenSIPS-Users] Request for clarification on tm timers

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Mar 9 10:00:05 CET 2010


Hi,

First of all, if you want to dynamically change the final response 
timeout (fr_timeout), you need to have the "restart_fr_on_each_reply" 
enabled .See :
       http://www.opensips.org/html/docs/modules/1.6.x/tm.html#id270372

Regards,
Bodgan

Flatbush Telecom wrote:
> I have a question regarding the final response and how to accelerate 
> failover.
>  
> I have studied the documentation and have watched the discussions 
> regarding fr_timer and fr_inv_timer. I do not think I understand the 
> fine points of tm and would appreciated your assistance.
>  
> My question is how do I accelerate the final response back to UAC? 
> Right now it takes up to 30 seconds from when I know I have received a 
> negative response to INVITE until my failure_route gets executed. If I 
> do not call failure_route, it still takes up to 30 seconds
>  
> Right now when UAC sends an INVITE, fr_timer has a default value of 3. 
> In my onreply_route, fr_inv_timer gets set to 30 when I receive 
> provisional response 100. If there is further progress to a 
> provisional response >= 180, fr_inv_timer gets set to 90. If I receive 
> a negative response, I call failure _route from my onreply_route.
>  
> At that point, I know I have received a negative acknowledge but will 
> not signal UAC for another 30 seconds that the call failed.
>  
> I have attached appropriate pieces of my config your your review. 
> Thank you very much for any help you can provide.
>  
> Mike Montgomery
>  
> # ------------lcr params (to get to functionality) ------------
> modparam("lcr", "contact_avp", "$avp(i:711)")
> modparam("lcr|tm", "fr_inv_timer_avp", "$avp(i:704)")
> modparam("lcr", "gw_uri_avp", "$avp(i:709)")
> modparam("^auth$|lcr", "rpid_avp", "$avp(i:302)")
> modparam("lcr", "ruri_user_avp", "$avp(i:500)")
> modparam("lcr", "flags_avp", "$avp(i:712)")
>        /* Turning on the regex mode for prefix */
> #modparam("lcr", "prefix_mode", 1)
> modparam("lcr","fr_inv_timer_next",10)
> modparam("lcr|tm","fr_inv_timer",10)
> modparam("tm", "fr_timer", 3)
> modparam("tm", "onreply_avp_mode", 1)
> modparam("tm", "fr_timer_avp", "$avp(i:24)")
> modparam("tm", "pass_provisional_replies", 1)
> avp_aliases="fr_timer=i:24"
> avp_aliases="fr_inv_timer=i:704"
> modparam("tm", "restart_fr_on_each_reply", 0)
>  
> route[13] {
> xlog("L_INFO","enter route [13] RequestURI=$ru RequestUser=$rU 
> Source=$si Method=$rm TO $tu FromURI=$fu FromUser=$fU \n");
>     #From an external domain outbound
>         if(allow_trusted()) {
>  
>                 xlog("L_INFO","PRE Strip requested URI = $ru \n");
>  
>             prefix2domain("0", "2");
>  
>                 xlog("L_INFO","Strip prefix >>>> requested URI = $ru \n");
>  
>             $avp(s:can_uri) = $ru;
>  
>                 xlog("L_INFO"," Canonical URI = $avp(s:can_uri) \n");
>  
>             revert_uri();
>  
> # if no caller ID add dummy callerID
>  
>             if ($fU!~"^[0-9]*") {
>                 uac_replace_from("sip:14436230000@$si");
>                 xlog("L_INFO","NO CALLERID inserted>>>>> ............ 
> $fu  \n");
>             } else {
>                 xlog("L_INFO","valid CALLERID <<<<< ............ $fu  
> \n");
>             }
>
>             if (!load_gws()) {
>                 xlog("L_INFO"," load_gws() FAILED >>> gw_uri_avp = 
> $avp(i:709) \n");
>                 sl_send_reply("503", "Unable to load gateways");
>                 exit;
>             }
>  
>                xlog("L_INFO"," load gateway... flags = $avp(i:712) \n");
>  
>             if(!next_gw()){
>                 xlog("L_INFO"," next_gw() FAILED >>> ruri_user_avp = 
> $avp(i:500) \n");
>                 sl_send_reply("503", "Unable to find a gateway");
>                 exit;
>             }
>                 xlog("L_INFO"," 1. next gateway... flags = $avp(i:712) 
> \n");
>  
> # set provisional response timer
>             $avp(fr_timer)=3;
>  
>             t_on_reply("2");
>  
>             if (!t_relay()) {
>                 sl_reply_error();
>             };
>             exit;
>  
>         } else {
>                 sl_send_reply("403", "Forbidden r13");
>                 exit;
>         };
> }
> onreply_route[2] {
>         xlog("L_INFO","enter onreply_route [2] RequestURI=$ru 
> RequestUser=$rU Source=$si Method=$rm TO $tu FromURI=$fu FromUser=$fU 
> \n");
>  
>         if(status=~"100"){
>            $avp(fr_inv_timer) = 35;
>            xlog("L_INFO"," ----- Reply Route 100 Trying = $rs, $rr \n");
>         };
>  
>         if(status=~"18[0-3]"){
>            $avp(fr_inv_timer) = 100;
>            xlog("L_INFO"," ----- Reply Route $rs $rr \n");
>         };
>  
>         if(status=~"[3-6][0-9][0-9]"){
>            xlog("L_INFO"," ----- Reply Route  FAILURE status = $rs, 
> $rr \n");
>           t_on_failure("2");
>         };
>     exit;
>         }
>
> failure_route[2] {
> xlog("L_INFO","enter failure_route [2] Source=$si Method=$rm TO $tu 
> FROM $fu \n");
> xlog("L_INFO"," ----- \n");
> xlog("L_INFO"," ----- FAILURE status = $rs \n");
> xlog("L_INFO"," ----- \n");
>  
>     ##--
>     ##-- If cancelled, exit.
>     ##--
>     if (t_was_cancelled()) {
>         exit;
>     };
>  
>      if (!use_next_gw()) {
>          t_reply("503", "No gateways available");
>           xlog("L_INFO"," failure route NO MORE GATEWAYS 503 back to 
> caller \n");
>          exit;
>          };
>  
>         xlog("L_INFO"," failure route next gateway... dr_ruri= 
> $avp(dr_ruri) ... dr_attrs = $avp(dr_attrs) destination = $dd \n");
>  
>         # Set accounting flags again Account INVITE packets
>         setflag(5);
>         # Set accounting flags again Account Missed calls
>         setflag(8);
>  
>     t_on_reply("2");
>  
>     t_relay();
>  
>     exit;
> }
>  
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list