<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <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"><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"><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@">sip:88290@</a><KAMAILIO_FQDN>>;tag=hvra7mj3q0<br>
        From:
<<a class="moz-txt-link-freetext" href="sip:+XXXX7688881@">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"><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">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"><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"><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"><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"><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">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>
  </body>
</html>