<div dir="ltr">Perfect, thanks that fixed it.</div><div class="gmail_extra"><br><div class="gmail_quote">On 18 July 2018 at 01:02, Liviu Chircu <span dir="ltr"><<a href="mailto:liviu@opensips.org" target="_blank">liviu@opensips.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Ben,</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Just for the sake of completeness, <tt>if we do d<tt>ecide
          to re<tt>tr<tt>y a reques<tt>t within a failure route, we will
                not do a "retransmission<tt>", but <tt>actually create
                    a bran<tt>d </tt>new transaction (with <tt>a</tt>
                    unique ";branch=" param)<tt> o<tt>n the SIP proxy's
                        UAC side (the outgoing side)</tt>.<br>
                      <br>
                      <tt>Best regards,</tt><br>
                    </tt></tt></tt></tt></tt></tt></tt></tt><tt></tt></tt><span class=""><br>
    <pre class="m_-7123893274009282313moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="m_-7123893274009282313moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a></pre>
    </span><div><div class="h5"><div class="m_-7123893274009282313moz-cite-prefix">On 17.07.2018 15:54, Ben Newlin wrote:<br>
    </div>
    <blockquote type="cite">
      
      
      
      <div class="m_-7123893274009282313WordSection1">
        <p class="MsoNormal">Gerwin,<u></u><u></u></p>
        <p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p>
        <p class="MsoNormal"><u></u> <u></u></p>
        <p class="MsoNormal">[1] <a href="http://www.opensips.org/Documentation/Script-Routes-2-4#toc3" target="_blank">
            http://www.opensips.org/<wbr>Documentation/Script-Routes-2-<wbr>4#toc3</a><u></u><u></u></p>
        <p class="MsoNormal"><u></u> <u></u></p>
        <p class="MsoNormal"><span style="color:black">Ben Newlin </span><u></u><u></u></p>
        <p class="MsoNormal"><u></u> <u></u></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
              <a class="m_-7123893274009282313moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org" target="_blank"><users-bounces@lists.opensips.<wbr>org></a> on behalf of
              Liviu Chircu <a class="m_-7123893274009282313moz-txt-link-rfc2396E" href="mailto:liviu@opensips.org" target="_blank"><liviu@opensips.org></a><br>
              <b>Reply-To: </b>OpenSIPS users mailling list
              <a class="m_-7123893274009282313moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org" target="_blank"><users@lists.opensips.org></a><br>
              <b>Date: </b>Tuesday, July 17, 2018 at 8:50 AM<br>
              <b>To: </b><a class="m_-7123893274009282313moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org" target="_blank">"users@lists.opensips.org"</a>
              <a class="m_-7123893274009282313moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org" target="_blank"><users@lists.opensips.org></a><br>
              <b>Subject: </b>Re: [OpenSIPS-Users] Multiple branches
              for a single AOR<u></u><u></u></span></p>
        </div>
        <div>
          <p class="MsoNormal"><u></u> <u></u></p>
        </div>
        <p><tt><span style="font-size:10.0pt">Hi Gerwin,</span></tt><u></u><u></u></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><u></u><u></u></p>
        <p><tt><span style="font-size:10.0pt">Best regards,</span></tt><u></u><u></u></p>
        <pre>Liviu Chircu<u></u><u></u></pre>
        <pre>OpenSIPS Developer<u></u><u></u></pre>
        <pre><a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a><u></u><u></u></pre>
        <div>
          <p class="MsoNormal">On 17.07.2018 14:35, Gerwin van de Steeg
            wrote:<u></u><u></u></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <div>
              <p class="MsoNormal">Folks,<u></u><u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></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).<u></u><u></u></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.<u></u><u></u></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).<u></u><u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></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).<u></u><u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <div>
              <p class="MsoNormal">Image containing sngrep of call:  <a href="https://imgur.com/RCZXkO6" target="_blank">
                  https://imgur.com/RCZXkO6</a><u></u><u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <div>
              <p class="MsoNormal">Subscribers are in the form of
                <username>@<domain><br>
                With an alias setup for an extension number.<u></u><u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <div>
              <p class="MsoNormal">ie.<br>
                  alfred.anderson@... = 552<u></u><u></u></p>
            </div>
            <div>
              <div>
                <p class="MsoNormal"><span style="font-size:12.0pt"> 
                    alice.bell@... = 553<u></u><u></u></span></p>
              </div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <div>
              <p class="MsoNormal">excerpt from opensips.cfg<u></u><u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <p class="MsoNormal"><span>       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>       script_trace(1, "$rm
                from $si, rur=$ru", "me");</span><span><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" target="_blank">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")<wbr>;<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(<wbr>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(<wbr>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> <u></u><u></u></p>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <div>
              <p class="MsoNormal"><u></u> <u></u></p>
            </div>
            <p class="MsoNormal"><br>
              Cheers,<br>
                 Gerwin <u></u><u></u></p>
            <div>
              <div>
                <p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Courier New""><br>
                    <br>
                  </span><u></u><u></u></p>
              </div>
            </div>
          </div>
          <p class="MsoNormal"><br>
            <br>
            <br>
            <u></u><u></u></p>
          <pre>______________________________<wbr>_________________<u></u><u></u></pre>
          <pre>Users mailing list<u></u><u></u></pre>
          <pre><a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><u></u><u></u></pre>
          <pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><u></u><u></u></pre>
        </blockquote>
        <p class="MsoNormal"><br>
          <br>
          <u></u><u></u></p>
      </div>
      <br>
      <fieldset class="m_-7123893274009282313mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_-7123893274009282313moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_-7123893274009282313moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>