<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Just made another test with TLS, not WSS. Same behavior</p>
    <p>A -> Kamailio -> B<br>
    </p>
    <p><br>
    </p>
    <p><font face="Courier New, Courier, monospace">INVITE
        <a class="moz-txt-link-freetext" href="sip:88882@KAMAILIO_FQDN:5060">sip:88882@KAMAILIO_FQDN:5060</a> SIP/2.0<br>
        Via: SIP/2.0/UDP
A_IP_ADDRESS:5060;rport;branch=z9hG4bKPj84577fd7-611e-40ce-b095-835583310eab<br>
        From:
        <a class="moz-txt-link-rfc2396E" href="sip:88881@A_IP_ADDRESS"><sip:88881@A_IP_ADDRESS></a>;tag=62ce37c8-b186-40d9-ae88-31321338031d<br>
        To: <a class="moz-txt-link-rfc2396E" href="sip:88882@KAMAILIO_FQDN"><sip:88882@KAMAILIO_FQDN></a><br>
        Contact: <a class="moz-txt-link-rfc2396E" href="sip:asterisk@A_IP_ADDRESS:5060"><sip:asterisk@A_IP_ADDRESS:5060></a><br>
        Call-ID: 8c9f68bf-1514-4dfa-8ba0-72cd8922a22b<br>
        CSeq: 597 INVITE<br>
        Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE,
        CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER<br>
        Supported: 100rel, timer, replaces, norefersub<br>
        Session-Expires: 1800<br>
        Min-SE: 90<br>
        Max-Forwards: 70<br>
        User-Agent: Asterisk PBX 13.33.0<br>
        Content-Type: application/sdp<br>
        Content-Length:   387</font></p>
    <p><br>
    </p>
    <p>180 reply<br>
    </p>
    <p><font face="Courier New, Courier, monospace">SIP/2.0 180 Ringing<br>
        Via: SIP/2.0/UDP
A_IP_ADDRESS:5060;received=A_IP_ADDRESS;rport=5060;branch=z9hG4bKPj84577fd7-611e-40ce-b095-835583310eab<br>
        From:
<a class="moz-txt-link-rfc2396E" href="sip:+XXXXX688881@tone.cern.ch"><sip:+XXXXX688881@tone.cern.ch></a>;tag=62ce37c8-b186-40d9-ae88-31321338031d<br>
        To: "TEST 88882"
        <a class="moz-txt-link-rfc2396E" href="sip:88882@KAMAILIO_FQDN"><sip:88882@KAMAILIO_FQDN></a>;tag=5AE57984-651CED77<br>
        CSeq: 597 INVITE<br>
        Call-ID: 8c9f68bf-1514-4dfa-8ba0-72cd8922a22b<br>
        Contact: <a class="moz-txt-link-rfc2396E" href="sip:88882@192.168.0.30:54224;transport=tls"><sip:88882@192.168.0.30:54224;transport=tls></a><br>
        Record-Route:
<a class="moz-txt-link-rfc2396E" href="sip:KAMAILIO_FQDN:5061;transport=tls;r2=on;lr=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls"><sip:KAMAILIO_FQDN:5061;transport=tls;r2=on;lr=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls></a>,
<a class="moz-txt-link-rfc2396E" href="sip:KAMAILIO_FQDN;r2=on;lr=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls"><sip:KAMAILIO_FQDN;r2=on;lr=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls></a><br>
        User-Agent: PolycomVVX-VVX_411-UA/6.3.1.11465<br>
        Allow-Events: conference,talk,hold<br>
        Accept-Language: en<br>
        Require: 100rel<br>
        RSeq: 8193<br>
        Content-Length: 0</font></p>
    <p>And PRACK from A</p>
    <p><font face="Courier New, Courier, monospace">PRACK
        <a class="moz-txt-link-freetext" href="sip:88882@192.168.0.30:54224;transport=tls">sip:88882@192.168.0.30:54224;transport=tls</a> SIP/2.0<br>
        Via: SIP/2.0/UDP
A_IP_ADDRESS:5060;rport;branch=z9hG4bKPjc9d866c0-a483-404e-9b97-d0738490fd74<br>
        From:
        <a class="moz-txt-link-rfc2396E" href="sip:88881@A_IP_ADDRESS"><sip:88881@A_IP_ADDRESS></a>;tag=62ce37c8-b186-40d9-ae88-31321338031d<br>
        To: <a class="moz-txt-link-rfc2396E" href="sip:88882@KAMAILIO_FQDN"><sip:88882@KAMAILIO_FQDN></a>;tag=5AE57984-651CED77<br>
        Call-ID: 8c9f68bf-1514-4dfa-8ba0-72cd8922a22b<br>
        CSeq: 598 PRACK<br>
        Route:
<a class="moz-txt-link-rfc2396E" href="sip:KAMAILIO_FQDN;lr;r2=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls"><sip:KAMAILIO_FQDN;lr;r2=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls></a><br>
        Route:
<a class="moz-txt-link-rfc2396E" href="sip:KAMAILIO_FQDN:5061;transport=tls;lr;r2=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls"><sip:KAMAILIO_FQDN:5061;transport=tls;lr;r2=on;ftag=62ce37c8-b186-40d9-ae88-31321338031d;nat=tls></a><br>
        RAck: 8193 597 INVITE<br>
        Max-Forwards: 70<br>
        User-Agent: Asterisk PBX 13.33.0<br>
        Content-Length:  0</font></p>
    <p><br>
    </p>
    <p>on <b>loose_route() </b>Kamailio is trying to send it to
      192.168.0.30, which is just Contact address in 180 responce
      (incorrect one).</p>
    <p>If using IP addresses in RR - all is working as expected<br>
    </p>
    <p>Maybe I'm missing some part of RFC?<br>
    </p>
    <pre class="moz-signature" cols="72">Regards,
Igor</pre>
    <div class="moz-cite-prefix">On 07.05.2021 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>
    </blockquote>
  </body>
</html>