<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><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've
        backported the patch for 1.9 [2].<br>
        <br>
        [1]: <a class="moz-txt-link-freetext"
          href="https://github.com/OpenSIPS/opensips/commit/ad92fa6ff6">https://github.com/OpenSIPS/opensips/commit/ad92fa6ff6</a><br>
        [2]: <a class="moz-txt-link-freetext"
          href="https://gist.github.com/liviuchircu/a72478ecd9a40588023d">https://gist.github.com/liviuchircu/a72478ecd9a40588023d</a><br>
        <br>
        Best regards,</tt>
      <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
      On 08/26/2014 01:51 AM, Seth Schultz wrote:<br>
    </div>
    <blockquote
cite="mid:CAM0g+seFio4u+r3whPNun=fAHyeRM-4+pUnVQNT+kqXT5pAU1A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div>
            <div dir="ltr">R&#259;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. &nbsp;In the opensips_1_9 branch in
            t_msgbuilder.c on line 152 we have</div>
          <div><br>
          </div>
          <div>...</div>
          <div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; <b>set_hostport(&amp;hp,
                (is_local(Trans))?0:req);</b></div>
            <div><span class="" style="white-space:pre"> </span>via=via_builder(&amp;via_len,
              Trans-&gt;uac[branch].request.dst.send_sock,</div>
            <div><span class="" style="white-space:pre"> </span>&amp;branch_str,
              0, Trans-&gt;uac[branch].request.dst.proto, &amp;hp );</div>
            <div><span class="" style="white-space:pre"> </span>if
              (!via){</div>
            <div><span class="" style="white-space:pre"> </span>LM_ERR("no
              via header got from builder\n");</div>
            <div><span class="" style="white-space:pre"> </span>goto
              error;</div>
            <div><span class="" style="white-space:pre"> </span>}</div>
            <div><span class="" style="white-space:pre"> </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>&nbsp; &nbsp; <b>hp.host=&amp;rpl-&gt;via1-&gt;host;</b></div>
            <div><b>&nbsp; &nbsp; hp.port=&amp;rpl-&gt;via1-&gt;port_str;</b></div>
            <div>&nbsp; &nbsp; via=via_builder(&amp;via_len,
              Trans-&gt;uac[branch].request.dst.send_sock,</div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; &amp;branch_str, 0,
              Trans-&gt;uac[branch].request.dst.proto, &amp;hp );</div>
            <div>&nbsp; &nbsp; if (!via){</div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; LM_ERR("no via header got from builder\n");</div>
            <div>&nbsp; &nbsp; &nbsp; &nbsp; goto error;</div>
            <div>&nbsp; &nbsp; }</div>
            <div>&nbsp; &nbsp; *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 moz-do-not-send="true"
                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&#259;zvan,<br>
                <div><br>
                </div>
                <div>Unfortunately in my setup OpenSIPS is only using a
                  single interface 172.16.1.115. &nbsp;The external IP NATing
                  is handled by the firewall, so I can'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&#259;zvan Crainea <span dir="ltr">&lt;<a
                      moz-do-not-send="true"
                      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 moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" 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 moz-do-not-send="true"
                      href="mailto:Users@lists.opensips.org"
                      target="_blank">Users@lists.opensips.org</a><br>
                    <a moz-do-not-send="true"
                      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 class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>