[SR-Users] Sending to an announcement server from a failure_route

Boden Garman bpgarman at fastmail.fm
Mon Dec 17 02:02:30 CET 2018


Hi list, 
 
I'm trying to play an announcement for my users when my PSTN gateway responds with a 404 Not Found (Reason: Q.850;cause=3), indicating a wrong number. I'm a bit lost and would appreciate any advice. 
 
What I am seeing is two parallel SIP invites, one to my announcement server (hooray!) and one to the PSTN gateway again (which I don't want). How do I stop the original branch from starting again?  
 
I've tried changing the order of rewritehostport and append_branch without any difference. I've also tried to use t_relay() instead of the RELAY route. 
 
I'm using Kamailio 5.1 and have modified the deafult kamailio.cfg 
 
Thanks! 
Boden 
 
I think this is the relevant parts of the config: 
 
# PSTN GW routing 
route[PSTN] { 
 [PSTN regex logic omitted] 
 
 # classify as an outbound call 
 set_dlg_profile("outbound_calls"); 
 
 # select a PSTN gateway from the dispatcher 
 if (!ds_select_dst("66", "8")) { 
 send_reply("404", "No destination"); 
 exit; 
 } 
 
 # failover if the selected PSTN gateway is down 
 t_on_failure("RTF_DISPATCH"); 
 
 route(RELAY); 
 exit; 
} 
 
 
# Try next destinations in failure route 
failure_route[RTF_DISPATCH] { 
 xlog("inside RTF_DISPATCH"); 
 if (t_is_canceled()) { 
 exit; 
 } 
 
 # wrong number from PSTN 
 if (t_check_status("404")) { 
 append_branch(); 
 append_hf("X-Application: announcement\r\n"); 
 append_hf("X-Announcement-Playback: wrong-number\r\n"); 
 route(TO_ANNOUNCEMENT); 
 exit; 
 } 
 
 # next DST - only for 500 or local timeout 
 if (t_check_status("500") or (t_branch_timeout() and !t_branch_replied())) { 
 xlog("selecting next destination"); 
 if (ds_next_dst()) { 
 t_on_failure("RTF_DISPATCH"); 
 route(RELAY); 
 exit; 
 } 
 } 
} 
 
 
# Routing to announcement server 
route[TO_ANNOUNCEMENT] { 
 if (!is_method("INVITE")) { 
 return; 
 } 
 rewritehostport('ANNOUNCEMENT_SERVER:5060'); 
 route(RELAY); 
 exit; 
} 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181216/a0645e49/attachment.html>


More information about the sr-users mailing list