I'm trying to route failed calls to a voicemail URI. The failure route couldn't be simpler:
failure_route[FAIL_ONE] {
if (t_is_canceled()) { exit; }
if( t_check_status("486|408") { append_branch( "sip:foo@2.2.2.2"); t_relay(); } }
But, it doesn't work. For example, let's say the initial INVITE resolves to a local device "me@1.1.1.1". This works fine, and the phone rings. After a timeout, the failure_route executes. The branch "foo@2.2.2.2" gets appended, and kamailio sends a new INVITE, but instead of determining the correct proxy for the new address, it sends the INVITE, with the new URI, to the device that original received the INVITE, "me@1.1.1.1". Obviously, this doesn't work.
I've been able to force kamailio to route the call correctly by modifying failure_route[ to use t_relay_to_udp() as follows:
failure_route[FAIL_ONE] {
if (t_is_canceled()) { exit; }
if( t_check_status("486|408") { append_branch( "sip:foo@2.2.2.2"); t_relay_to_udp( "2.2.2.2", "5060"); } }
But, it seems like kamailio should figure what where to send the new INVITE itself. What am I doing wrong?