Hi, I am trying to re-route to a different $ru after timeout and right before Kamailio reply with a 408.I made the changes right before sl_reply_error(), however it does not work as I expected. Any help will be appreciated. Also, $rm represents the request message received by Kamailio. Is there a variable represents the messages leaving Kamailio?.
route[RELAY] { # enable additional event routes for forwarded requests # - serial forking, RTP relaying handling, a.s.o. if (is_method("INVITE|SUBSCRIBE")) { t_on_branch("MANAGE_BRANCH"); t_on_reply("MANAGE_REPLY"); } if (is_method("INVITE")) { t_on_failure("MANAGE_FAILURE"); } if (!t_relay()) { // re-route to a new $ru before sending 408 sl_reply_error(); } exit;} Thanks,AS
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; } }