<div dir="ltr">Hi Alex,<div><br></div><div><div># ----- tm params -----</div><div>modparam("tm", "failure_reply_mode", 3)<br></div></div><div><br></div><div>I use drouting, here's the main logic.</div><div><br></div><div>request_route {<br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div> ...</div><div><br></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div>if (is_method("INVITE") && !has_totag()) {</div><div> ...</div></div></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"> # handle DR failure</div></div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"> t_on_failure("MANAGE_DR_FAILURE");</div></div></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></div></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> if (!do_routing("$avp(drgroup)")) {</div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"> sl_reply("503", "Unknown destination");</div></div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"> exit;</div></div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"> }</div></div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px"><br></div></div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div><div> # Relay the request to gateway</div></div></div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div><div> route(DR_RELAY);</div></div></div></div><div><div style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-transform:none;white-space:normal;word-spacing:0px">}</div></div></div></blockquote><div>}</div><div><br></div><div><div># DR relay<br></div></div><div><div>route[DR_RELAY] {</div><div><br></div><div> if (!route(RELAY)) {<br></div><div> sl_reply_error();<br></div><div> };</div><div> exit;<br></div><div>}</div></div><div><br></div><div># DRouting failure route<br></div><div><div>failure_route[MANAGE_DR_FAILURE] {</div><div><br></div><div> if (t_is_canceled()) {</div><div> exit;<br></div><div> }</div><div><br></div><div> if (t_check_status("486|600")) {<br></div><div> xlog("L_INFO", "received BUSY, stop trying");
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"># -- curious, 486 gets relayed fine</span>
</div><div> exit;<br></div><div> }</div><div><br></div><div> # try next GW</div><div> if (use_next_gw()) {</div><div> t_on_failure("MANAGE_DR_FAILURE");</div><div><br></div><div> xlog("L_INFO", "MANAGE_DR_FAILURE: Call from <$fu> with username <$fU> going to <$ru>\n");<br></div><div> route(RELAY);</div><div> exit;</div><div><br></div><div> # -- Trunk failover to PSTN number</div><div> } else if (is_avp_set("$avp(s:failover)") && $avp(direction) == "in") {</div><div> $ru="sip:" + $avp(s:failover) + "@<a href="http://someothergateway.com">someothergateway.com</a>"; # -- basic routing, to improve by sending back to DRouting with updated $rU<br></div><div> xlog("L_INFO", "MANAGE_DR_FAILURE: No more gateways, sending call to trunk failover destination <$ru>...\n");</div><div> route(RELAY);</div><div><br></div><div> } else {<br></div><div> xlog("L_WARN", "No more routes available\n");</div><div> #t_reply ("503", "Service Unavailable"); # -- why do we have to force a reply instead of proxy relaying whatever it is<br></div><div> exit;</div><div> }</div><div>}</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 14, 2018 at 11:34 AM, Alex Balashov <span dir="ltr"><<a href="mailto:abalashov@evaristesys.com" target="_blank">abalashov@evaristesys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
1. Do you have a failure_route for this transaction? If so, can you provide it?<br>
<br>
2. Make sure the `failure_reply_mode` modparam for TM is set to 3, which<br>
is default anyway:<br>
<br>
<a href="https://kamailio.org/docs/modules/5.1.x/modules/tm.html#tm.p.failure_reply_mode" rel="noreferrer" target="_blank">https://kamailio.org/docs/<wbr>modules/5.1.x/modules/tm.html#<wbr>tm.p.failure_reply_mode</a><br>
<br>
-- Alex<br>
<span class=""><br>
On Mon, May 14, 2018 at 11:33:15AM -0400, Sergiu Pojoga wrote:<br>
<br>
> Not sure if it's a default Kamailio behavior or something I'm doing wrong...<br>
> <br>
> When receiving a negative reply for an INVITE (more like in the 5xx range),<br>
> proxy doesn't relay the message to the originator but instead issues it's<br>
> own "500 Service Unavailable".<br>
> <br>
> That doesn't happen, from observations so far, to "603 Declined" or "486<br>
> Busy Here" or "404 Not Found" or "200 OK" replies.<br>
> <br>
</span>> *For example, here's the negative reply proxy receives from the callee:*<br>
<span class="">> <br>
> 2018/05/14 10:52:37.716627 65.XX.XX.166:5060 -> 65.XX.XX.167:5060<br>
> SIP/2.0 503 Service Unavailable<br>
> Via: SIP/2.0/UDP<br>
> 65.xx.xx.167;branch=<wbr>z9hG4bK9223.<wbr>00b4f3143d245a895c4bb6a107add2<wbr>58.0;received=65.xx.xx.167;<wbr>rport=5060<br>
> Via: SIP/2.0/UDP<br>
> 205.xx.xx.221;received=205.xx.<wbr>xx.221;rport=5060;branch=<wbr>z9hG4bKQ4XpXga0vgZ8B<br>
> From: "514XXXXXXX" <sip: 514XXXXXXX @205.xx.xx.221>;tag=<wbr>tXj0NHrje9jNS<br>
> To: <sip:450XXXXXXX@65.xx.xx.167>;<wbr>tag=as18e452b7<br>
> Call-ID: 48eac296-d229-1236-a685-<wbr>005056a149a4<br>
> CSeq: 122818714 INVITE<br>
> Server: Asterisk<br>
> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO,<br>
> PUBLISH, MESSAGE<br>
> Supported: replaces, timer<br>
> Session-Expires: 1800;refresher=uas<br>
> X-Asterisk-HangupCause: Subscriber absent<br>
> X-Asterisk-HangupCauseCode: 20<br>
> Content-Length: 0<br>
> <br>
</span>> *Here's what the originator gets in the final message:*<br>
<span class="">> <br>
> 2018/05/14 10:52:37.718143 65.xx.xx.167:5060 -> 205.xx.xx.221:5060<br>
> SIP/2.0 500 Service Unavailable<br>
> Via: SIP/2.0/UDP<br>
> 205.xx.xx.221;rport=5060;<wbr>branch=z9hG4bKQ4XpXga0vgZ8B;<wbr>received=205.xx.xx.221<br>
> From: "514XXXXXXX" <sip:514XXXXXXX@205.xx.xx.221><wbr>;tag=tXj0NHrje9jNS<br>
> To: <sip:450XXXXXXX@65.xx.xx.167>;<wbr>tag=<wbr>31a2c69b5d434ef4a60796e26f568b<wbr>f0-9343<br>
> Call-ID: 48eac296-d229-1236-a685-<wbr>005056a149a4<br>
> CSeq: 122818714 INVITE<br>
> Server: Kamailio 5.1<br>
> Content-Length: 0<br>
> <br>
> I'd like any reply to be relayed back as is, unless I do some<br>
> t_check_status() => t_reply() for specific reasons (which I have none at<br>
> this point).<br>
> <br>
> Thanks<br>
> Sergiu<br>
<br>
</span>> ______________________________<wbr>_________________<br>
> Kamailio (SER) - Users Mailing List<br>
> <a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
> <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Alex Balashov | Principal | Evariste Systems LLC<br>
<br>
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) <br>
Web: <a href="http://www.evaristesys.com/" rel="noreferrer" target="_blank">http://www.evaristesys.com/</a>, <a href="http://www.csrpswitch.com/" rel="noreferrer" target="_blank">http://www.csrpswitch.com/</a><br>
<br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
</font></span></blockquote></div><br></div>