[SR-Users] Timeout Handling (update)

Alex Balashov abalashov at evaristesys.com
Mon Mar 28 21:27:14 CEST 2016


Hello,

You cannot handle SIP eventualities by checking the return value of 
t_relay(); a call to t_relay() will almost always succeed immediately, 
unless there is an a priori failure out of hand (e.g. cannot send from 
socket, DNS lookup failure, etc.).

Instead, you must do this in a failure_route:

route {
    ...
    t_on_failure("FAILURE_ROUTE");

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

failure_route[FAILURE_ROUTE] {
    if(t_is_canceled())
       exit;

    if(t_branch_timeout()) {
       # Handle your timeout case here.

       $ru = new value etc.

       t_relay();
       exit;
    }
}


-- 
Alex Balashov | Principal | Evariste Systems LLC
1447 Peachtree Street NE, Suite 700
Atlanta, GA 30309
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/



More information about the sr-users mailing list