<div dir="ltr">Liviu,<div><br></div><div>At some point we will most likely be upgrading to the latest LTS, but this isn&#39;t scheduled anytime in the near future.</div><div><br></div><div>I applied the patch, but this didn&#39;t resolve the issue.</div>
<div><br></div><div>The problem, in a nutshell, appears to be that the local ACK/CANCEL is created based on the initial INVITE (Internal-&gt;Internal), not the branch INVITE (Internal-&gt;External).  This works great if all branches are Internal-&gt;Internal, however it doesn&#39;t work in an N-branch scenario where the other branches might be communicating with an External device.  The end result is that the internal address is placed in the Via1 header for the local ACK/CANCEL to the external gateway.</div>
<div><br></div><div>After making the modification to t_msgbuilder.c line 153 below, all ACKs function correctly to all branches because we have a reply with the correct external address (or internal address), however CANCEL from the internal UAC to the External device is still broken because we don&#39;t have a reply.  Is there a way to access the INVITE for the current branch and pull out the Via1-&gt;host/port?  I apologize in advance if anything I am saying is incorrect, this is really the first time I&#39;ve ever looked at the source.</div>
<div><br></div><div>    set_hostport(&amp;hp, (is_local(Trans))?0:req);<br></div><div><br></div><div>To</div><div><br></div><div><div>    if (rpl &amp;&amp; rpl-&gt;via1)</div><div>    {</div><div>        hp.host = &amp;rpl-&gt;via1-&gt;host;</div>
<div>        hp.port = &amp;rpl-&gt;via1-&gt;port_str;</div><div>    }</div><div>    else</div><div>    {</div><div>        set_hostport(&amp;hp, (is_local(Trans))?0:req);</div><div>    }</div></div><div><br></div><div>Thanks,</div>
<div>Seth</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 27, 2014 at 5:31 AM, Liviu Chircu <span dir="ltr">&lt;<a href="mailto:liviu@opensips.org" target="_blank">liviu@opensips.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div><tt>Hello Seth,<br>
        <br>
        Earlier this year, there were some important fixes related to
        set_advertised_address() which solved some memory corruption
        issues and fixed the IP used when creating multiple branches
        [1]. Unfortunately, they did not get backported to 1.9, since it
        was not supported anymore. If upgrading to 1.11 is not a
        possibility (although we highly recommend you do so), I&#39;ve
        backported the patch for 1.9 [2].<br>
        <br>
        [1]: <a href="https://github.com/OpenSIPS/opensips/commit/ad92fa6ff6" target="_blank">https://github.com/OpenSIPS/opensips/commit/ad92fa6ff6</a><br>
        [2]: <a href="https://gist.github.com/liviuchircu/a72478ecd9a40588023d" target="_blank">https://gist.github.com/liviuchircu/a72478ecd9a40588023d</a><br>
        <br>
        Best regards,</tt>
      <pre cols="72">Liviu Chircu
OpenSIPS Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
      On 08/26/2014 01:51 AM, Seth Schultz wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div>
            <div dir="ltr">Răzvan,<br>
            </div>
          </div>
          <div dir="ltr"><br>
          </div>
          <div>After digging through the source code, I found the line
            of code causing my issues.  In the opensips_1_9 branch in
            t_msgbuilder.c on line 152 we have</div>
          <div><br>
          </div>
          <div>...</div>
          <div>
            <div>        <b>set_hostport(&amp;hp,
                (is_local(Trans))?0:req);</b></div>
            <div><span style="white-space:pre-wrap"> </span>via=via_builder(&amp;via_len,
              Trans-&gt;uac[branch].request.dst.send_sock,</div>
            <div><span style="white-space:pre-wrap"> </span>&amp;branch_str,
              0, Trans-&gt;uac[branch].request.dst.proto, &amp;hp );</div>
            <div><span style="white-space:pre-wrap"> </span>if
              (!via){</div>
            <div><span style="white-space:pre-wrap"> </span>LM_ERR(&quot;no
              via header got from builder\n&quot;);</div>
            <div><span style="white-space:pre-wrap"> </span>goto
              error;</div>
            <div><span style="white-space:pre-wrap"> </span>}</div>
            <div><span style="white-space:pre-wrap"> </span>*len+=
              via_len;</div>
          </div>
          <div>...</div>
          <div><br>
          </div>
          <div>Would it be incredibly stupid to modify it to always base
            the via on the reply?</div>
          <div><br>
          </div>
          <div>...</div>
          <div>
            <div>    <b>hp.host=&amp;rpl-&gt;via1-&gt;host;</b></div>
            <div><b>    hp.port=&amp;rpl-&gt;via1-&gt;port_str;</b></div>
            <div>    via=via_builder(&amp;via_len,
              Trans-&gt;uac[branch].request.dst.send_sock,</div>
            <div>        &amp;branch_str, 0,
              Trans-&gt;uac[branch].request.dst.proto, &amp;hp );</div>
            <div>    if (!via){</div>
            <div>        LM_ERR(&quot;no via header got from builder\n&quot;);</div>
            <div>        goto error;</div>
            <div>    }</div>
            <div>    *len+= via_len;</div>
          </div>
          <div>...</div>
          <div class="gmail_extra"><br>
          </div>
          After making this modification it does have the correct Via
          address for all failure ACK replies.</div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">Thanks,</div>
        <div class="gmail_extra">Seth</div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Fri, Aug 22, 2014 at 10:26 AM,
            Seth Schultz <span dir="ltr">&lt;<a href="mailto:sschultz@scholarchip.com" target="_blank">sschultz@scholarchip.com</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div dir="ltr">Răzvan,<br>
                <div><br>
                </div>
                <div>Unfortunately in my setup OpenSIPS is only using a
                  single interface 172.16.1.115.  The external IP NATing
                  is handled by the firewall, so I can&#39;t use
                  force_send_socket, because it would still be
                  172.16.1.115.</div>
                <div><br>
                </div>
                <div>Thanks,</div>
                <div>Seth</div>
              </div>
              <div class="gmail_extra"><br>
                <div class="gmail_quote">On Fri, Aug 22, 2014 at 5:07
                  AM, Răzvan Crainea <span dir="ltr">&lt;<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;</span>
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                    <div bgcolor="#FFFFFF" text="#000000">
                      <div><tt>Hi, Seth!<br>
                          <br>
                          So basically you want to change the outgoing
                          interface for the second leg of the call,
                          right? Instead of record_route_preset()
                          function, have you considered using the
                          force_send_socket() function? This forces
                          OpenSIPS to switch the interfaces and should
                          change the VIA headers properly without any
                          issues. Let me know your answer </tt>
                        <div><br>
                        </div>
                      </div>
                      <blockquote type="cite">
                        <div dir="ltr"> </div>
                        <br>
                        <fieldset></fieldset>
                        <br>
                        <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                      </blockquote>
                      <br>
                    </div>
                    <br>
                    _______________________________________________<br>
                    Users mailing list<br>
                    <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
                    <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
                    <br>
                  </blockquote>
                </div>
                <br>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<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" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div></div></div>