[OpenSIPS-Users] t_on_failure()

Patrick phigaro at dmv.com
Fri Jul 10 00:04:25 CEST 2009


Sorry, I should have included the code like you have to illustrate my  
question (if you don't mind, I will borrow it):


route {

   ...

   t_on_failure("1");

   if(!t_relay()) {
       sl_reply_error();
       exit;
   }

}

...

failure_route[1] {
    t_on_failure("1");              <-----   here is what I am asking  
about t_on_failure inside of a failure_route[x]
    t_relay();
   ...
}


Prior to setting this, I only saw entries in failure route twice:
    1) the first time the call was attempted
    2) if the call failed

It would stop there even when I had a third option.   Now it is trying  
all three options, but just wanted to make sure this was a logical  
methodology ....  I have safe guards in place to stop it from  
endlessly looping


Patrick


On Jul 9, 2009, at 6:00 PM, Alex Balashov wrote:

You need both;  they do different things.

The failure_route[x] won't get triggered by default unless you  
associate it with a transaction - in effect, telling OpenSIPS to  
trigger failure_route[x] if a failure code is received for this  
transaction after stateful relay.  That's what t_on_failure() does.

route {

   ...

   t_on_failure("1");

   if(!t_relay()) {
       sl_reply_error();
       exit;
   }

}

...

# This will never be run unless t_on_failure("1") is set
# above.

failure_route[1] {
   ...
}


Patrick wrote:

> Is it wise to have a t_on_failure inside of a failure_route[x] ?   
> Or  is there another method I could / should use?
> Thanks,
> Patrick
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


-- 
Alex Balashov
Evariste Systems
Web     : http://www.evaristesys.com/
Tel     : (+1) (678) 954-0670
Direct  : (+1) (678) 954-0671




More information about the Users mailing list