<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
tt
{mso-style-priority:99;
font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Gerwin,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Specifically, it is the t_relay() call within your failure_route. t_relay() is used to send requests, not responses. The automatic action of failure_route if no retransmission is attempted is to send the reply back upstream [1]. So you
don’t have to do anything if that is the functionality you desire.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">[1] <a href="http://www.opensips.org/Documentation/Script-Routes-2-4#toc3">
http://www.opensips.org/Documentation/Script-Routes-2-4#toc3</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:black">Ben Newlin </span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Users <users-bounces@lists.opensips.org> on behalf of Liviu Chircu <liviu@opensips.org><br>
<b>Reply-To: </b>OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Date: </b>Tuesday, July 17, 2018 at 8:50 AM<br>
<b>To: </b>"users@lists.opensips.org" <users@lists.opensips.org><br>
<b>Subject: </b>Re: [OpenSIPS-Users] Multiple branches for a single AOR<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p><tt><span style="font-size:10.0pt">Hi Gerwin,</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Inside your failure route, you are always attempting a retry of any failed request. This logic conflicts with your initial statement that "The intent is to ensure that the response code gets sent through to A-party".</span></tt><o:p></o:p></p>
<p><tt><span style="font-size:10.0pt">Best regards,</span></tt><o:p></o:p></p>
<pre>Liviu Chircu<o:p></o:p></pre>
<pre>OpenSIPS Developer<o:p></o:p></pre>
<pre><a href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 17.07.2018 14:35, Gerwin van de Steeg wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">Folks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I'm trying to narrow down a 482 Merged Request problem on calls from one SIP device to another via OpenSIPS 2.4.1. Yealink T41P SIP device (A-party), calls via OpenSIPS, to another AOR owned by a Zoiper5 device (B-party).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The intent is to ensure that when the B-party rejects the call with a 486 Busy Here, that the response code gets sent through to A-party. However what I'm seeing is the 486 gets sent to OpenSIPS which ACK's it, but doesn't go anywhere
from there, and then something causes a second invite to be sent from OpenSIPS to the B-party which then responds of course with 482 Merged Request.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The call as it is progressing through the call flow seems to be starting a second branch to the AOR (only one SIP device registered using UDP per AOR).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">What would be causing that second call so that I can eliminate it and get to the behaviour I'm expecting. Just using a slightly modified residential default config template with websocket support (the problem was noticed using SIP.JS but
exists also in generic SIP device to SIP device calls).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Image containing sngrep of call: <a href="https://imgur.com/RCZXkO6">
https://imgur.com/RCZXkO6</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Subscribers are in the form of <username>@<domain><br>
With an alias setup for an extension number.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">ie.<br>
alfred.anderson@... = 552<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"> alice.bell@... = 553<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">excerpt from opensips.cfg<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><span style="font-family:"Courier New""> if ($rU==NULL) {<br>
# request with no Username in RURI<br>
send_reply("484","Address Incomplete");<br>
exit;<br>
}<br>
<br>
$acc_extra(src_ip) = $si; # source IP of the request<br>
$acc_leg(caller) = $fu;<br>
$acc_leg(callee) = $ru;<br>
<br>
# apply DB based aliases<br>
if (alias_db_lookup("dbaliases")) {<br>
xlog("Alias lookup success [$fu/$tu/$ru/$ci]");<br>
}<br>
else { <br>
xlog("Alias lookup failure [$fu/$tu/$ru/$ci]");<br>
}<br>
<br>
# do blind callforward lookup<br>
if (avp_db_load("rU", "$avp(callfwd)")) {<br>
t_reply("181", "Call Is Being Forwarded");<br>
$ru = $avp(callfwd);<br>
xlog("forwarded call to: $avp(callfwd)");<br>
route(relay);<br>
exit;<br>
}<br>
<br>
# apply transformations from dialplan table<br>
dp_translate("0", "$rU/$rU");<br>
<br>
# check if the call needs to be routed to freeswitch<br>
route(freeswitch);<br>
<br>
# here we would set the redirect URI if it had one<br>
route(lookup);<br>
}<br>
<br>
route[lookup] {<br>
</span><span style="font-size:12.0pt;font-family:"Courier New";background:white"> script_trace(1, "$rm from $si, rur=$ru", "me");</span><span style="font-size:12.0pt;font-family:"Courier New""><br>
</span><span style="font-family:"Courier New""> xlog("route:lookup");<br>
# do lookup with method filtering<br>
if (!lookup("location","m")) {<br>
xlog("lookup failure");<br>
t_newtran();<br>
if (!db_does_uri_exist()) {<br>
xlog("$cfg_line: URI doesn't exist");<br>
send_reply("420", "Bad Extension");<br>
exit;<br>
}<br>
t_reply("404", "Not Found");<br>
exit;<br>
}<br>
<br>
# when routing via usrloc, log the missed calls also<br>
do_accounting("db","missed");<br>
<br>
route(relay);<br>
}<br>
<br>
route[freeswitch] {<br>
xlog("route:freeswitch");<br>
if (!is_method("INVITE")) {<br>
return;<br>
}<br>
<br>
# if the called number begins with the right dialplan redirect it to freeswitch<br>
# here we take everythign prefixed with a *, strip it, and send it to freeswitch<br>
if ($rU=~"^\*") {<br>
strip(1);<br>
$du = "sip:<a href="http://10.23.4.192:50600">10.23.4.192:50600</a>";<br>
route(relay);<br>
}<br>
}<br>
<br>
<br>
route[relay] {<br>
xlog("route:relay: Relaying: method=$rm");<br>
# for INVITEs enable some additional helper routes<br>
if (is_method("INVITE")) {<br>
t_on_branch("per_branch_ops");<br>
t_on_reply("handle_nat");<br>
t_on_failure("missed_call");<br>
}<br>
else if (is_method("BYE|CANCEL")) {<br>
# cancel the rtpengine transcoding<br>
rtpengine_delete();<br>
}<br>
<br>
if (!t_relay()) {<br>
send_reply("500","Internal Error");<br>
}<br>
exit;<br>
}<br>
<br>
<br>
branch_route[per_branch_ops] {<br>
script_trace(1, "$rm from $si, rur=$ru", "me");<br>
xlog("[$ci/$T_branch_idx] branch_route:per_branch_ops: new branch at $ru\n");<br>
<br>
# WebSocket specific handling with NORMAL SDP negotiation<br>
# assumes SDP offer in the INVITE from the UAC, and SDP<br>
# answer is in 200 OK from the UAS<br>
if (!is_method("INVITE") || !has_body("application/sdp"))<br>
return;<br>
<br>
if (isflagset(SRC_WS) && isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "ICE=force-relay DTLS=passive";<br>
else if (isflagset(SRC_WS) && !isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";<br>
else if (!isflagset(SRC_WS) && isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "UDP/TLS/RTP/SAVPF ICE=force";<br>
else if (!isflagset(SRC_WS) && !isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";<br>
<br>
# only enable transcoding if websocket call for now<br>
if (isflagset(SRC_WS) || isbflagset(DST_WS)) {<br>
rtpengine_offer("$var(rtpengine_flags)");<br>
}<br>
}<br>
<br>
onreply_route[handle_nat] {<br>
script_trace(1, "$rm from $si, rur=$ru", "me");<br>
xlog("[$ci/$T_branch_idx] onreply_route:handle_nat: $ru\n");<br>
<br>
# WebSocket specific handling with NORMAL SDP negotiation<br>
# assumes SDP offer in the INVITE from the UAC, and SDP<br>
# answer is in 200 OK from the UAS<br>
if (!has_body("application/sdp"))<br>
return;<br>
<br>
if (isflagset(SRC_WS) && isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "ICE=force-relay DTLS=passive";<br>
else if (isflagset(SRC_WS) && !isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "UDP/TLS/RTP/SAVPF ICE=force";<br>
else if (!isflagset(SRC_WS) && isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";<br>
else if (!isflagset(SRC_WS) && !isbflagset(DST_WS))<br>
$var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin ICE=remove";<br>
<br>
# only enable transcoding if websocket call for now<br>
if (isflagset(SRC_WS) || isbflagset(DST_WS)) {<br>
rtpengine_answer("$var(rtpengine_flags)");<br>
}<br>
}<br>
<br>
failure_route[missed_call] {<br>
script_trace(1, "$rm from $si, rur=$ru", "me");<br>
xlog("[$ci/$T_branch_idx] failure_route:missed_call: incoming failure response to $rm <- $T_reply_code/$T_ruri");<br>
if (t_was_cancelled()) {<br>
xlog("[$ci/$T_branch_idx] was cancelled");<br>
exit;<br>
}<br>
do_accounting("db", "missed");<br>
<br>
if (!t_relay()) {<br>
send_reply("500","Internal Error");<br>
}<br>
else {<br>
xlog("[$ci/$T_branch_idx] Relay success $rm/$T_reply_code");<br>
}<br>
}</span> <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><br>
Cheers,<br>
Gerwin <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Courier New""><br>
<br>
</span><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<pre><a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
<pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
</div>
</body>
</html>