<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Daniel,</p>
    <p>Seems to be it's really the case, but with other function</p>
    <p>With FQDN in RR <br>
    </p>
    <h3 class="title"> <code class="function">is_first_hop()</code></h3>
    <p>is not acting correctly for reply. <br>
    </p>
    <p>
      <blockquote type="cite">For incoming SIP replies, it means that
        top Record-Route URI is 'myself' and source address is not
        matching it</blockquote>
      But in Record-Route we have "myself", but <b>is_first_hop()</b>
      returning 0. <br>
    </p>
    <p>Thanks!<br>
    </p>
    <pre class="moz-signature" cols="72">Regards,
Igor</pre>
    <div class="moz-cite-prefix">On 07.05.2021 14:22, Daniel-Constantin
      Mierla wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:4f8a3d41-0c37-5031-3885-f2eadff2386c@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>OK, because looping was something that should not have happened
        in this case.</p>
      <p>Then the problem is that you do not do nat-traversal-like
        processing for websocket/webrtc traffic. You have to use
        set_contact_alias() + handle_ruri_alias() because the webrtc
        endpoints do not set "valid" contact addresses.</p>
      <p>Cheers,<br>
        Daniel<br>
      </p>
      <div class="moz-cite-prefix">On 07.05.21 14:13, Igor Olhovskiy
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:aabd2bf3-ad3a-2c8b-ed10-ec1372161407@gmail.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <p>Ah, no, sorry, I was wrong at this one,</p>
        <p>This just is not sent with "unable to resolve address
          toleivu2gdbh.invalid". <br>
        </p>
        <p>Sorry. Looping were something else during my tests, this just
          with <b>advertise</b> added<br>
        </p>
        <pre class="moz-signature" cols="72">Regards,
Igor</pre>
        <div class="moz-cite-prefix">On 07.05.2021 14:02,
          Daniel-Constantin Mierla wrote:<br>
        </div>
        <blockquote type="cite"
          cite="mid:4935457a-8c6f-29cd-ace2-72bfd848bed3@gmail.com">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <p>This looks like incoming ACK, because there is only one Via
            header, so it is not what proxy forwards -- that one is
            relevant to see what headers were consumed and added.</p>
          <p>Cheers,<br>
            Daniel<br>
          </p>
          <div class="moz-cite-prefix">On 07.05.21 13:51, Igor Olhovskiy
            wrote:<br>
          </div>
          <blockquote type="cite"
            cite="mid:bf82d67b-9a4f-123f-46cd-75a593fc315a@gmail.com">
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8">
            Sure.
            <p><font face="Courier New, Courier, monospace">ACK <a
                  class="moz-txt-link-freetext"
                  href="sip:88290@toleivu2gdbh.invalid;transport=wss"
                  moz-do-not-send="true">sip:88290@toleivu2gdbh.invalid;transport=wss</a>
                SIP/2.0<br>
                Via: SIP/2.0/UDP
A_IP_ADDRESS:5060;rport;branch=z9hG4bKPj8d05548a-91ef-4332-8617-32f8eeebf8f2<br>
                From: <a class="moz-txt-link-rfc2396E"
                  href="sip:88881@A_IP_ADDRESS" moz-do-not-send="true"><sip:88881@A_IP_ADDRESS></a>;tag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d<br>
                To: <a class="moz-txt-link-rfc2396E"
                  href="sip:88290@KAMAILIO_FQDN" moz-do-not-send="true"><sip:88290@KAMAILIO_FQDN></a>;tag=hvra7mj3q0<br>
                Call-ID: 46f44741-d155-4dd5-8fd8-78e540fc1acb<br>
                CSeq: 18326 ACK<br>
                Route: <a class="moz-txt-link-rfc2396E"
href="sip:KAMAILIO_FQDN;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss"
                  moz-do-not-send="true"><sip:KAMAILIO_FQDN;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                Route: <a class="moz-txt-link-rfc2396E"
href="sip:KAMAILIO_FQDN:8089;transport=ws;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss"
                  moz-do-not-send="true"><sip:KAMAILIO_FQDN:8089;transport=ws;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                Max-Forwards: 70<br>
                User-Agent: Asterisk PBX 13.33.0<br>
                Content-Length:  0</font></p>
            <p><br>
            </p>
            <p>By loop I meant, Kamailio just relaying it back to self
              and discard.<br>
            </p>
            <pre class="moz-signature" cols="72">Regards,
Igor</pre>
            <div class="moz-cite-prefix">On 07.05.2021 13:48,
              Daniel-Constantin Mierla wrote:<br>
            </div>
            <blockquote type="cite"
              cite="mid:13af5047-aa7c-3a96-6684-385fb883d206@gmail.com">
              <meta http-equiv="Content-Type" content="text/html;
                charset=UTF-8">
              <p>Can you paste the ACK that loops, after being handled
                once by Kamailio?</p>
              <p>Cheers,<br>
                Daniel<br>
              </p>
              <div class="moz-cite-prefix">On 07.05.21 13:25, Igor
                Olhovskiy wrote:<br>
              </div>
              <blockquote type="cite"
                cite="mid:6ca545db-e3f1-f47e-e95f-966864bb8e1a@gmail.com">
                <meta http-equiv="Content-Type" content="text/html;
                  charset=UTF-8">
                <p>Daniel,</p>
                <p>Yes, it is.</p>
                <p><font face="Courier New, Courier, monospace">alias=...<br>
                  </font></p>
                <p>Also tried with</p>
                <p><font face="Courier New, Courier, monospace">listen =
                    IP advertise FQDN</font><br>
                </p>
                <p>same behavior, <font face="Courier New, Courier,
                    monospace">loose_route()</font> stops acting
                  correctly.<br>
                </p>
                <p>PS: Forgot to add, Kamailio 5.4.3 / 5.4.4<br>
                </p>
                <pre class="moz-signature" cols="72">Regards,
Igor</pre>
                <div class="moz-cite-prefix">On 07.05.2021 13:21,
                  Daniel-Constantin Mierla wrote:<br>
                </div>
                <blockquote type="cite"
                  cite="mid:6d9f566b-2815-f119-0a8d-7e5bdf06c660@gmail.com">
                  <meta http-equiv="Content-Type" content="text/html;
                    charset=UTF-8">
                  <p>Hello,</p>
                  <p>is the KAMAILIO_FQDN set as local domain for
                    Kamailio (via alias parameter or domain
                    module+register myself)?</p>
                  <p>Cheers,<br>
                    Daniel<br>
                  </p>
                  <div class="moz-cite-prefix">On 07.05.21 11:17, Igor
                    Olhovskiy wrote:<br>
                  </div>
                  <blockquote type="cite"
                    cite="mid:193b9e24-0edb-442a-8df1-27bc04293fb6@gmail.com">
                    <meta http-equiv="content-type" content="text/html;
                      charset=UTF-8">
                    <p>Hello,</p>
                    <p>I saw there are some topics on this already and
                      carefully walked through all of them, but can't
                      solve following issue.</p>
                    <p>For a reason I do need that in Record-Route
                      header sent to endpoint would present FQDN. If it
                      matters, it's UDP/WSS conversion done on Kamailio.</p>
                    <p>So, scheme is quite simple<br>
                    </p>
                    <p>Enpoint A  ->UDP-> Kamailio ->WSS->
                      Endpoint B (NAT)<br>
                    </p>
                    <p>Main issue here, that if in Record-Route headers
                      it's FQDN, but not IP addresses, on a new
                      transactions with a dialog (ACK on 200, PRACK,
                      BYE), Kamailio<b> loose_route()</b> function
                      resolves address of destination not current
                      dialog, but actual R-URI (or itself, if R-URI is
                      something from WebRTC world) that is not correct
                      due to NAT.<br>
                    </p>
                    <p>If in RR headers IP addresses are present - all
                      is working as expected.</p>
                    <p>As an example (RR with FQDN)<br>
                    </p>
                    <p>B answers 200</p>
                    <p><font face="Courier New, Courier, monospace">SIP/2.0
                        200 OK<br>
                        Record-Route: <a class="moz-txt-link-rfc2396E"
href="sip:KAMAILIO_FQDN:8089;transport=ws;r2=on;lr=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss"
                          moz-do-not-send="true"><sip:KAMAILIO_FQDN:8089;transport=ws;r2=on;lr=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                        Record-Route: <a class="moz-txt-link-rfc2396E"
href="sip:KAMAILIO_FQDN;r2=on;lr=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss"
                          moz-do-not-send="true"><sip:KAMAILIO_FQDN;r2=on;lr=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                        Via: SIP/2.0/UDP
                        <A_IP_ADDRESS>:5060;received=A IP
ADDRESS;rport=5060;branch=z9hG4bKPj67fb6d86-97d7-4231-995b-e54b0f62881e<br>
                        To: <<a class="moz-txt-link-freetext"
                          href="sip:88290@" moz-do-not-send="true">sip:88290@</a><KAMAILIO_FQDN>>;tag=hvra7mj3q0<br>
                        From: <<a class="moz-txt-link-freetext"
                          href="sip:+XXXX7688881@"
                          moz-do-not-send="true">sip:+XXXX7688881@</a><KAMAILIO_FQDN>>;tag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d<br>
                        Call-ID: 46f44741-d155-4dd5-8fd8-78e540fc1acb<br>
                        CSeq: 18326 INVITE<br>
                        Contact: <a class="moz-txt-link-rfc2396E"
                          href="sip:88290@toleivu2gdbh.invalid;transport=wss"
                          moz-do-not-send="true"><sip:88290@toleivu2gdbh.invalid;transport=wss></a><br>
                        Allow:
                        ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER<br>
                        Supported: outbound<br>
                        Content-Type: application/sdp<br>
                        Content-Length: 817</font></p>
                    <p><br>
                    </p>
                    <p>ACK looks like</p>
                    <p><font face="Courier New, Courier, monospace">ACK
                        <a class="moz-txt-link-freetext"
                          href="sip:88290@toleivu2gdbh.invalid;transport=wss"
                          moz-do-not-send="true">sip:88290@toleivu2gdbh.invalid;transport=wss</a>
                        SIP/2.0<br>
                        Via: SIP/2.0/UDP
A_IP_ADDRESS:5060;rport;branch=z9hG4bKPj8d05548a-91ef-4332-8617-32f8eeebf8f2<br>
                        From: <a class="moz-txt-link-rfc2396E"
                          href="sip:88881@A_IP_ADDRESS"
                          moz-do-not-send="true"><sip:88881@A_IP_ADDRESS></a>;tag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d<br>
                        To: <a class="moz-txt-link-rfc2396E"
                          href="sip:88290@KAMAILIO_FQDN"
                          moz-do-not-send="true"><sip:88290@KAMAILIO_FQDN></a>;tag=hvra7mj3q0<br>
                        Call-ID: 46f44741-d155-4dd5-8fd8-78e540fc1acb<br>
                        CSeq: 18326 ACK<br>
                        Route: <a class="moz-txt-link-rfc2396E"
href="sip:FQDN;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss"
                          moz-do-not-send="true"><sip:FQDN;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                        Route: <a class="moz-txt-link-rfc2396E"
href="sip:FQDN:8089;transport=ws;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss"
                          moz-do-not-send="true"><sip:FQDN:8089;transport=ws;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                        Max-Forwards: 70<br>
                        User-Agent: Asterisk PBX 13.33.0<br>
                        Content-Length:  0</font><br>
                    </p>
                    <p>And Kamailio on <b>loose_route()</b> loops ACK
                      to itself. (with result of function == 1)<br>
                    </p>
                    <p>In a case if in Record-Route/Route headers just
                      IP address of Kamailio present, all works as
                      expected, but it's not really behavior I want to
                      achieve.</p>
                    <p>I've tried to play with <b>record_route_preset("...")</b>
                      specifying only WSS part (as suggested in <a
                        class="moz-txt-link-freetext"
                        href="https://skalatan.de/de/blog/kamailio-sbc-teams"
                        moz-do-not-send="true">https://skalatan.de/de/blog/kamailio-sbc-teams</a>)
                      with FQDN, but no luck.</p>
                    <p>Also wanted to try approach using
                      record_route_preset() function in branch route,
                      but it was working only with first branch, not
                      affecting others (but I assume having different RR
                      headers across branches is not a good idea)</p>
                    <pre class="moz-signature" cols="72">-- 
Regards,
Igor</pre>
                    <br>
                    <fieldset class="mimeAttachmentHeader"></fieldset>
                    <pre class="moz-quote-pre" wrap="">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                  </blockquote>
                  <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com" moz-do-not-send="true">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/" moz-do-not-send="true">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
                </blockquote>
                <br>
                <fieldset class="mimeAttachmentHeader"></fieldset>
                <pre class="moz-quote-pre" wrap="">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
              </blockquote>
              <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com" moz-do-not-send="true">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/" moz-do-not-send="true">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
            </blockquote>
          </blockquote>
          <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com" moz-do-not-send="true">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/" moz-do-not-send="true">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
        </blockquote>
      </blockquote>
      <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com" moz-do-not-send="true">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/" moz-do-not-send="true">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
    </blockquote>
  </body>
</html>