<div dir="auto">Did you add the handle_ruri_alias() as suggested by Daniel? I had something like this where I would get “unable to resolve blah blah blah" and it’s because the RURI is the actual wss “address” which is unresolvable, so executing the function forces kamailio to take the alias instead.</div><div dir="auto"><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 7 May 2021 at 13:48, Igor Olhovskiy <<a href="mailto:igorolhovskiy@gmail.com">igorolhovskiy@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div>
    <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> <code>is_first_hop()</code></h3>
    <p>is not acting correctly for reply. <br>
    </p>
    <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>
    <p>Thanks!<br>
    </p>
    <pre cols="72">Regards,
Igor</pre></div><div>
    <div>On 07.05.2021 14:22, Daniel-Constantin
      Mierla wrote:<br>
    </div>
    <blockquote type="cite">
      
      <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>On 07.05.21 14:13, Igor Olhovskiy
        wrote:<br>
      </div>
      <blockquote type="cite">
        
        <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 cols="72">Regards,
Igor</pre>
        <div>On 07.05.2021 14:02,
          Daniel-Constantin Mierla wrote:<br>
        </div>
        <blockquote type="cite">
          
          <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>On 07.05.21 13:51, Igor Olhovskiy
            wrote:<br>
          </div>
          <blockquote type="cite">
            
            Sure.
            <p><font face="Courier New, Courier, monospace">ACK <a>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><sip:88881@A_IP_ADDRESS></a>;tag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d<br>
                To: <a><sip:88290@KAMAILIO_FQDN></a>;tag=hvra7mj3q0<br>
                Call-ID: 46f44741-d155-4dd5-8fd8-78e540fc1acb<br>
                CSeq: 18326 ACK<br>
                Route: <a><sip:KAMAILIO_FQDN;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                Route: <a><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 cols="72">Regards,
Igor</pre>
            <div>On 07.05.2021 13:48,
              Daniel-Constantin Mierla wrote:<br>
            </div>
            <blockquote type="cite">
              
              <p>Can you paste the ACK that loops, after being handled
                once by Kamailio?</p>
              <p>Cheers,<br>
                Daniel<br>
              </p>
              <div>On 07.05.21 13:25, Igor
                Olhovskiy wrote:<br>
              </div>
              <blockquote type="cite">
                
                <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 cols="72">Regards,
Igor</pre>
                <div>On 07.05.2021 13:21,
                  Daniel-Constantin Mierla wrote:<br>
                </div>
                <blockquote type="cite">
                  
                  <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>On 07.05.21 11:17, Igor
                    Olhovskiy wrote:<br>
                  </div>
                  <blockquote type="cite">
                    
                    <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><sip:KAMAILIO_FQDN:8089;transport=ws;r2=on;lr=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                        Record-Route: <a><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>sip:88290@</a><KAMAILIO_FQDN>>;tag=hvra7mj3q0<br>
                        From: <<a>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><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>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><sip:88881@A_IP_ADDRESS></a>;tag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d<br>
                        To: <a><sip:88290@KAMAILIO_FQDN></a>;tag=hvra7mj3q0<br>
                        Call-ID: 46f44741-d155-4dd5-8fd8-78e540fc1acb<br>
                        CSeq: 18326 ACK<br>
                        Route: <a><sip:FQDN;lr;r2=on;ftag=0a3e31a6-96ad-42d0-9310-81b35cedbd3d;nat=wss></a><br>
                        Route: <a><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 href="https://skalatan.de/de/blog/kamailio-sbc-teams" target="_blank">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 cols="72">-- 
Regards,
Igor</pre>
                    <br>
                    <fieldset></fieldset>
                    <pre>__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">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 href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                  </blockquote>
                  <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a href="https://www.asipto.com/sw/kamailio-advanced-training-online/" target="_blank">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
                </blockquote>
                <br>
                <fieldset></fieldset>
                <pre>__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">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 href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
              </blockquote>
              <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a href="https://www.asipto.com/sw/kamailio-advanced-training-online/" target="_blank">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
            </blockquote>
          </blockquote>
          <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a href="https://www.asipto.com/sw/kamailio-advanced-training-online/" target="_blank">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
        </blockquote>
      </blockquote>
      <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * <a href="https://www.asipto.com/sw/kamailio-advanced-training-online/" target="_blank">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
    </blockquote>
  </div>

__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
Edit mailing list options or unsubscribe:<br>
  * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div>