I am having trouble setting up a failure route to roll over to another on failure. I have failure_route[1] set up to catch 302 redirects and act accordingly. If no redirect is detected then the INVITE should roll to failure route 2, as per the line that says t_on_failure("2");. This is however not what occurs. When an INVITE comes in, and hits failure_route[1] I can see in /var/log/messages that it hit that route, however it never gets to failure_route[2] even though there is no 302, instead the 408 is sent to my sip provider, they ack it, and the call is dropped. Any help is as always greatly appreciated.
######################################################################## ################################# # FAILURE ROUTE 1 --- 302 REDIRECT --- ######################################################################## ################################ failure_route[1] { xlog("got to failure route 1"); t_on_failure("2"); if(t_check_status("302")){ xlog("$tU has a forward"); get_redirects("*", "redirect"); t_relay("my.sip.proxy"); exit; }; }
######################################################################## ############################### # FAILURE ROUTE 2 ----- VOICEMAIL ------- ######################################################################## ################################ failure_route[2] { xlog("got to failure route 2"); xlog("$tU getting a vmail"); if (t_check_status("408|486|487")){ revert_uri(); strip(1); prefix("201"); rewriteport("5070"); append_branch(); t_relay(); exit; };
}
failure_route 2 will only be executed if the t_relay in failure route 1 generates a failure again. In your case, the you just forward the failure back to the client.
Try this:
failure_route[1] { xlog("got to failure route 1"); if(t_check_status("302")){ xlog("$tU has a forward"); get_redirects("*", "redirect"); t_relay("my.sip.proxy"); exit; };
xlog("$tU getting a vmail"); if (t_check_status("408|486|487")){ revert_uri(); strip(1); prefix("201"); rewriteport("5070"); append_branch(); t_relay(); exit; }; }
or if you want ot use route blocks:
failure_route[1] { xlog("got to failure route 1"); if(t_check_status("302")){ xlog("$tU has a forward"); get_redirects("*", "redirect"); t_relay("my.sip.proxy"); exit; };
route(22); }
failure_route[2] { route(22); }
route[22] { xlog("got to failure route 2"); xlog("$tU getting a vmail"); if (t_check_status("408|486|487")){ revert_uri(); strip(1); prefix("201"); rewriteport("5070"); append_branch(); t_relay(); exit; }; }
regards klaus
I didn't do it exactly that way, but that logic worked well for me. Thank you.
On Jul 24, 2006, at 4:03 AM, Klaus Darilion wrote:
failure_route 2 will only be executed if the t_relay in failure route 1 generates a failure again. In your case, the you just forward the failure back to the client.
Try this:
failure_route[1] { xlog("got to failure route 1"); if(t_check_status("302")){ xlog("$tU has a forward"); get_redirects("*", "redirect"); t_relay("my.sip.proxy"); exit; };
xlog("$tU getting a vmail"); if (t_check_status("408|486|487")){ revert_uri(); strip(1); prefix("201"); rewriteport("5070"); append_branch(); t_relay(); exit; };
}
or if you want ot use route blocks:
failure_route[1] { xlog("got to failure route 1"); if(t_check_status("302")){ xlog("$tU has a forward"); get_redirects("*", "redirect"); t_relay("my.sip.proxy"); exit; };
route(22);
}
failure_route[2] { route(22); }
route[22] { xlog("got to failure route 2"); xlog("$tU getting a vmail"); if (t_check_status("408|486|487")){ revert_uri(); strip(1); prefix("201"); rewriteport("5070"); append_branch(); t_relay(); exit; }; }
regards klaus