<div dir="auto"><div>Upon inspection I think you should set enable_double_rr to value '2'. It will always add two record route headers. It is a small line in documentation. </div><div dir="auto"><br></div><div dir="auto">I don't see how loose_route can be fixed if you only have 1 route header. It won't be compatible with multi homed kamailio. </div><div dir="auto"><br></div><div dir="auto">Kind regards, </div><div dir="auto">Timmo Verlaan<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On 3 Feb 2018 00:15, "Emmanuel BUU" <<a href="mailto:emmanuel.buu@ives.fr">emmanuel.buu@ives.fr</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div class="quoted-text">
    <br>
    <div class="m_2974285220172056243moz-cite-prefix">Le 2018-02-02 à 23:12, Timmo Verlaan a
      écrit :<br>
    </div>
    <blockquote type="cite">
      <div dir="auto">
        <div>Hi Emmanuel, </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">I now understand what you're dealing with. No,
          we always go out over a different interface so a double header
          is always present. Although I'd say that enable_double_rr
          should always add two route headers. Even if both route
          headers are equal. <br>
        </div>
      </div>
    </blockquote></div>
    I don't think this is the correct behavior to add to identical SIP
    URI in the route set.<div class="quoted-text"><br>
    <blockquote type="cite">
      <div dir="auto">
        <div dir="auto"><br>
        </div>
        <div dir="auto">As a workaround you could add the route headers
          manually using some kamailio scripting. We did this for a
          while until we were able to fix loose route to cover our
          usecase (it ignored default port). <br>
        </div>
      </div>
    </blockquote></div>
    We will post a ticket and submit a patch to fix loose_route()
    instead. Don't want to add some strange cases to out script which is
    already quite complex.<br>
    <blockquote type="cite">
      <div dir="auto">
        <div dir="auto"><br>
        </div>
        <div dir="auto">Regards, </div>
        <div dir="auto">Timmo</div><font color="#888888">
      </font></div><font color="#888888">
    </font></blockquote><font color="#888888">
    Emmanuel</font><div class="elided-text"><br>
    <blockquote type="cite">
      <div dir="auto">
        <div dir="auto">
          <div class="gmail_extra" dir="auto"><br>
            <div class="gmail_quote">On 2 Feb 2018 16:50, "Emmanuel BUU"
              <<a href="mailto:emmanuel.buu@ives.fr" target="_blank">emmanuel.buu@ives.fr</a>>
              wrote:<br type="attribution">
              <blockquote class="m_2974285220172056243m_-9058323366501565518quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                <div text="#000000" bgcolor="#FFFFFF">
                  <p>Hi Timmo,</p>
                  <p>We do have <b>enable_double_rr</b> set to 1 but
                    the route set added by the proxy when record_route()
                    on the INVITE consists in a single route. This is
                    because Alice and Bob are BOTH registered with the
                    alternate port 5066 on the same interfacec and using
                    the same protocol (UDP). To us, this seems logical.<br>
                  </p>
                  Do you have a double route in your case even though
                  both party are on the same port, same interface and
                  both UDP? If so, could you send us an exemple of
                  Route: header?<font color="#888888"><br>
                    <br>
                    Emmanuel BUU<br>
                    IVèS</font>
                  <div class="m_2974285220172056243m_-9058323366501565518elided-text"><br>
                    <br>
                    <div class="m_2974285220172056243m_-9058323366501565518m_938679815086291337moz-cite-prefix">Le
                      2018-02-02 à 14:18, Timmo Verlaan a écrit :<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">
                        <div dir="auto">Hi Thomas,
                          <div dir="auto"><br>
                          </div>
                          <div>We have a similar situation but we use
                            double route headers so the correct egress
                            socket is chosen. You can enable this by
                            setting a modparam: enable_double_rr.</div>
                          <div>Would this be a solution for you?</div>
                          <div><br>
                          </div>
                          <div>Kind regards,</div>
                          <div>Timmo Verlaan</div>
                        </div>
                        <div class="gmail_extra"><br>
                          <div class="gmail_quote">On 2 Feb 2018 13:57,
                            "Thomas Carvello" <<a href="mailto:thomas.carvello@ives.fr" target="_blank">thomas.carvello@ives.fr</a>>
                            wrote:<br type="attribution">
                            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                              <div bgcolor="#FFFFFF">
                                <p>Thank you for you answer.</p>
                                <p>We have tried to change the local
                                  port for Bob, but it doesnt change
                                  anything. And the contact value in 200
                                  OK message has no influence in this
                                  case.</p>
                                <p>In fact, we have made a further
                                  investigation regarding the socket
                                  selection <b>and read the code. </b>The
                                  issue seems to be located in the RR
                                  module and the loose_route() function.<br>
                                </p>
                                In the  after_loose() function in
                                loose.c, the  function
                                set_force_socket()  is called only if a
                                DOUBLE route is mentioned in the route
                                set of the ACK message <br>
                                <br>
                                But when both users are using 5066 as
                                proxy port, we get only ONE route for
                                the proxy in the route set (and to us it
                                is OK). In this case, we get a trace:<br>
                                <br>
                                "No next URI found"<br>
                                <br>
                                and the code exits. Later in the message
                                processing, when t_relay() is called,
                                the forward_request() selects the first
                                socket defined in our configuration
                                instead. <br>
                                <br>
                                At this point, we can't presume what
                                socket we be select. We believe that it
                                is a software bug  and that
                                after_loose() should force the
                                send_socket even though we have only one
                                route in the route set. We also checked
                                the 5.1 code and there is no change in
                                this module that would alter this
                                behavior.<br>
                                <p> </p>
                                <p>Are we missing something? <br>
                                </p>
                                <p>Thank you for you time,</p>
                                Thomas<br>
                                <br>
                                <div class="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358moz-cite-prefix">Le
                                  26/01/2018 à 15:43, Евгений Голей a
                                  écrit :<br>
                                </div>
                                <blockquote type="cite"> <span id="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358result_box" lang="en"><span>Hi<br>
                                      <br>
                                      Could it be because of Bob happend
                                      to use 5060 as local port?</span><br>
                                    <span>Yes, the port and the address
                                      in the ACK are indicated by what
                                      the value in Contact was in reply
                                      200 Ok.</span> <span>Look at the
                                      message 200 Ok</span></span><br>
                                  <br>
                                  <br>
                                  <blockquote style="border-left:1px solid rgb(8,87,166);margin:10px;padding:0px 0px 0px 10px"> Четверг, 25 января
                                    2018, 13:00 +03:00 от Thomas
                                    Carvello <a class="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358moz-txt-link-rfc2396E" href="mailto:thomas.carvello@ives.fr" target="_blank"><thomas.carvello@ives.fr></a>:<br>
                                    <br>
                                    <div id="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358">
                                      <div class="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358js-helpergmail-m_-8764234924071474810m_-7815440543160779358js-readmsg-msg">
                                        <div>
                                          <div id="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358style_15168744520000000704_BODY">
                                            <div class="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358class_1517002402">
                                              <br>
                                              <div class="m_2974285220172056243m_-9058323366501565518m_938679815086291337gmail-m_-8764234924071474810m_-7815440543160779358moz-forward-container_mailru_css_attribute_postfix">
                                                Hello,
                                                <p>i have an issue with
                                                  my Kamailio 4.1.9
                                                  configuration.</p>
                                                <p>This configuration is
                                                  multi-homed, we have<b>
                                                    two network</b>
                                                  interfaces, one on a
                                                  private network and on
                                                  the public Internet.
                                                  Kamailio is configured
                                                  to listen on port 5060
                                                  and 5066 on both
                                                  interfaces. We
                                                  register two users
                                                  Alice and Bob on the 
                                                  public Internet using
                                                  port 5066.  Both users
                                                  are behind a NAT and
                                                  we capture the SIP
                                                  exchange on the proxy
                                                  server.</p>
                                                <p>We have set the
                                                  parameter mhomed=1<br>
                                                </p>
                                                <p>When Alice calls Bob,
                                                  we have <br>
                                                </p>
                                                <pre>Alice                        Proxy                           Bob</pre>
                                                <pre>src=5063             dst=5066
INVITE ------------------>

                        src=5066
                        ------  INVITE ---------------> dst=5060

                        dst=5066  
                        <------- 200 OK -------------- src=5060


dst=5063 
<------- 200 OK --------- src=5066

src=5063                dst=5066
-------- ACK ----------->

                        <b>src=5060      (blocked by NAT)</b>
                        ------  ACK-----x            dst=5060


</pre>
                                                <p>The ACK packet gets
                                                  relayed with the wrong
                                                  source port. Then the
                                                  NAT rejects the packet
                                                  and the call cannot be
                                                  established.</p>
                                                <p>For some reason, when
                                                  Bob calls Alice, the
                                                  call is correctly
                                                  established. Could it
                                                  be because Bob happend
                                                  to use 5060 as local
                                                  port?<br>
                                                </p>
                                                <p>Also, if we set
                                                  nhomed=0 it works BUT
                                                  we are not sure that
                                                  multi homed is handled
                                                  correctly.</p>
                                                I was wondering if you
                                                have encounter this
                                                issue before?<br>
                                                <p> I have investigated
                                                  the code for selection
                                                  socket and what is the
                                                  logic of this
                                                  selection ?</p>
                                                <p><i><b>How does
                                                      kamailo knows that
                                                      it should choose
                                                      5066 as src port
                                                      if the user is
                                                      registered using
                                                      port 5066 instead
                                                      of 5066?</b><br>
                                                  </i></p>
                                                <p>Thank you for your
                                                  time.</p>
                                                <p>Thomas<br>
                                                </p>
                                                <p><br>
                                                </p>
                                                <p><br>
                                                </p>
                                              </div>
                                            </div>
                                          </div>
                                          <div>______________________________<wbr>_________________<br>
                                            Kamailio (SER) - Users
                                            Mailing List<br>
                                            <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
                                            <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </blockquote>
                                  <br>
                                  <br>
                                  Best <br>
                                  Evgeniy<br>
                                </blockquote>
                                <br>
                              </div>
                              <br>
                              ______________________________<wbr>_________________<br>
                              Kamailio (SER) - Users Mailing List<br>
                              <a href="mailto:sr-users@lists.kamailio.org" target="_blank">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/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
                              <br>
                            </blockquote>
                          </div>
                        </div>
                      </div>
                      <br>
                      <fieldset class="m_2974285220172056243m_-9058323366501565518m_938679815086291337mimeAttachmentHeader"></fieldset>
                      <br>
                      <pre>______________________________<wbr>_________________
Kamailio (SER) - Users Mailing List
<a class="m_2974285220172056243m_-9058323366501565518m_938679815086291337moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a class="m_2974285220172056243m_-9058323366501565518m_938679815086291337moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a>
</pre>
                    </blockquote>
                    <br>
                  </div>
                </div>
                <br>
                ______________________________<wbr>_________________<br>
                Kamailio (SER) - Users Mailing List<br>
                <a href="mailto:sr-users@lists.kamailio.org" target="_blank">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/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
                <br>
              </blockquote>
            </div>
            <br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="m_2974285220172056243mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
Kamailio (SER) - Users Mailing List
<a class="m_2974285220172056243moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a class="m_2974285220172056243moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a>
</pre>
    </blockquote>
    <br>
  </div></div>

<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>
<br></blockquote></div><br></div></div></div>