<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>That's quite strange, the registrar/usrloc are not related to
      websocket in storing the connection id, they see it as a tcp/tls
      connection. I checked on a test server and all tcp/tls contacts
      have connection id and socket field set.</p>
    <p>Do you get any error messages when processing the REGISTER?</p>
    <p>If not, give here the parameters you set for registrar and usrloc
      modules along with all debug messages with debug-3 in cfg when
      processing the REGISTER (just replace any sensitive data).</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 17.04.20 14:34, Mack Hendricks
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:91D245C7-BA35-47F6-8DC3-0FCA481C9C29@dopensource.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="">Here is what one of my registrations look like</div>
      <div class=""><br class="">
      </div>
      <div class="">              id: 148</div>
               ruid: uloc-5e999161-1782-1<br class="">
           username: 2000<br class="">
             domain: <a href="http://ws-test.com" class=""
        moz-do-not-send="true">ws-test.com</a><br class="">
            contact: sips:<a href="mailto:2000@df7jal23ls0d.invalid"
        class="" moz-do-not-send="true">2000@df7jal23ls0d.invalid</a>;rtcweb-breaker=no;transport=wss<br
        class="">
           received: <a href="sip:98.209.240.245:63356;transport=ws"
        class="" moz-do-not-send="true">sip:98.209.240.245:63356;transport=ws</a><br
        class="">
               path: NULL<br class="">
            expires: 2020-04-17 12:30:14<br class="">
                  q: -1.00<br class="">
             callid: 73beb50f-65de-a461-be26-187c9aaa53c1<br class="">
               cseq: 48179<br class="">
      last_modified: 2020-04-17 12:26:54<br class="">
              flags: 0<br class="">
             cflags: 524352<br class="">
         user_agent: IM-client/OMA1.0 sipML5-v1.2016.03.04<br class="">
          <b class="">   socket: NULL</b><br class="">
            methods: NULL<br class="">
           instance: NULL<br class="">
             reg_id: 0<br class="">
          server_id: 0<br class="">
      <b class="">connection_id: -1</b><br class="">
          keepalive: 1<br class="">
          partition: 18
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On Apr 17, 2020, at 8:30 AM, Mack Hendricks <<a
              href="mailto:mack@dopensource.com" class=""
              moz-do-not-send="true">mack@dopensource.com</a>> wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8" class="">
            <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
              line-break: after-white-space;" class="">Hello,
              <div class=""><br class="">
              </div>
              <div class="">I upgrade to 5.3 and got the same result.
                 But, I noticed that changing the connection_id in the
                database to the connection_id of the web socket
                 connection listed by ws.dump made it work.</div>
              <div class=""><br class="">
              </div>
              <div class="">So, it looks like the socket or the
                connection_id is not being set when the record is stored
                by usrloc.  I think this is the true issue.  Any
                suggestions where to look?</div>
              <div class=""><br class="">
              </div>
              <div class=""><br class="">
                <div class=""><br class="">
                  <blockquote type="cite" class="">
                    <div class="">On Apr 16, 2020, at 2:44 AM,
                      Daniel-Constantin Mierla <<a
                        href="mailto:miconda@gmail.com" class=""
                        moz-do-not-send="true">miconda@gmail.com</a>>
                      wrote:</div>
                    <br class="Apple-interchange-newline">
                    <div class="">
                      <meta http-equiv="Content-Type"
                        content="text/html; charset=UTF-8" class="">
                      <div class="">
                        <p class="">Hello,</p>
                        <p class="">did you print the log message just
                          before t_relay()?</p>
                        <p class="">Can you also print the tcp and tls
                          connections via rpc? I am not sure if the
                          websocket keeps a separate list of
                          connections, but tcp/tls should have the lists
                          used for routing.<br class="">
                        </p>
                        <p class="">It would be better to upgrade to
                          5.3, because 5.1 is out of maintenance and if
                          there is still an issue, it is easier to
                          troubleshoot and fix. Then you can backport
                          locally to 5.1, if you have to run that
                          version on specific systems.</p>
                        <p class="">Cheers,<br class="">
                          Daniel<br class="">
                        </p>
                        <div class="moz-cite-prefix">On 16.04.20 05:10,
                          Mack Hendricks wrote:<br class="">
                        </div>
                        <blockquote type="cite"
                          cite="mid:46FE7E29-36EB-48B4-AD40-200514B7E512@dopensource.com"
                          class="">
                          <meta http-equiv="Content-Type"
                            content="text/html; charset=UTF-8" class="">
                          Hey Daniel,
                          <div class=""><br class="">
                          </div>
                          <div class="">It returns:</div>
                          <div class=""><br class="">
                          </div>
                          <div class=""> [LOCATION] ru: sips:<a
                              href="mailto:2000@df7jal23ls0d.invalid"
                              class="" moz-do-not-send="true">2000@df7jal23ls0d.invalid</a>;rtcweb-breaker=no;transport=wss,
                            <b class="">nh(u): <a
                                href="sip:98.209.240.245:50453;transport=ws"
                                class="" moz-do-not-send="true">sip:98.209.240.245:50453;transport=ws</a></b></div>
                          <div class=""><b class=""><br class="">
                            </b></div>
                          <div class="">This matches the output from</div>
                          <div class=""><br class="">
                          </div>
                          <div class="">kamcmd ws.dump</div>
                          <div class=""><br class="">
                          </div>
                          <div class="">
                            <div class=""><br class="">
                            </div>
                            <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>connections:
                              {</div>
                            <div class=""><span class="Apple-tab-span" style="white-space:pre">               </span>29:
                              wss:<b class="">98.209.240.245:50453</b>
                              -> <a class="moz-txt-link-freetext"
                                href="wss://134.122.27.49:4443/"
                                moz-do-not-send="true">wss:134.122.27.49:4443</a>
                              (state: OPEN,  last used 22s ago,
                              sub-protocol: sip)</div>
                            <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>}</div>
                            <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>info:
                              {</div>
                            <div class=""><span class="Apple-tab-span" style="white-space:pre">               </span>wscounter:
                              1</div>
                            <div class=""><span class="Apple-tab-span" style="white-space:pre">               </span>truncated:
                              no</div>
                            <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>}</div>
                            <div class="">}</div>
                          </div>
                          <div class=""><br class="">
                          </div>
                          <div class="">I can grade to 5.3 if you think
                            that’s best.</div>
                          <div class=""><br class="">
                          </div>
                          <div class=""><br class="">
                          </div>
                          <div class=""><b class=""><br class="">
                            </b>
                            <div class=""><br class="">
                              <blockquote type="cite" class="">
                                <div class="">On Apr 15, 2020, at 12:11
                                  PM, Daniel-Constantin Mierla <<a
                                    href="mailto:miconda@gmail.com"
                                    class="" moz-do-not-send="true">miconda@gmail.com</a>>
                                  wrote:</div>
                                <br class="Apple-interchange-newline">
                                <div class="">
                                  <meta http-equiv="Content-Type"
                                    content="text/html; charset=UTF-8"
                                    class="">
                                  <div class="">
                                    <p class="">Hello,</p>
                                    <p class="">when id is 0, then the
                                      search of the connection is done
                                      by target address. For some
                                      reason, the destination is not
                                      matching the connection. Try to
                                      print $nh(u) before relaying to
                                      see where it is supposed to be
                                      sent.</p>
                                    <p class="">Cheers,<br class="">
                                      Daniel<br class="">
                                    </p>
                                    <div class="moz-cite-prefix">On
                                      15.04.20 16:54, Mack Hendricks
                                      wrote:<br class="">
                                    </div>
                                    <blockquote type="cite"
                                      cite="mid:87386471-2DDB-4E58-AB5E-034D45562928@dopensource.com"
                                      class="">
                                      <meta http-equiv="Content-Type"
                                        content="text/html;
                                        charset=UTF-8" class="">
                                      Hello,
                                      <div class=""><br class="">
                                      </div>
                                      <div class="">I’m running kamailio
                                        5.1.10 (x86_64/linux)</div>
                                      <div class=""><br class="">
                                      </div>
                                      <div class="">The connection_id in
                                        usrloc is -1 for some reason so
                                        the id doesn’t match for sure.
                                         But, I thought that it would
                                        match on the received address of
                                        the WS client because the output
                                        from ws.dump shows that the
                                        connection address and port
                                        matches the received address and
                                        port in usrloc.</div>
                                      <div class=""><br class="">
                                      </div>
                                      <div class="">Any suggestions?</div>
                                      <div class=""><br class="">
                                      </div>
                                      <div class=""><br class="">
                                      </div>
                                      <div class=""><br class="">
                                      </div>
                                      <div class=""><br class="">
                                        <div class="">
                                          <blockquote type="cite"
                                            class="">
                                            <div class="">On Apr 15,
                                              2020, at 10:48 AM,
                                              Daniel-Constantin Mierla
                                              <<a
                                                href="mailto:miconda@gmail.com"
                                                class=""
                                                moz-do-not-send="true">miconda@gmail.com</a>>
                                              wrote:</div>
                                            <br
                                              class="Apple-interchange-newline">
                                            <div class="">
                                              <meta
                                                http-equiv="Content-Type"
                                                content="text/html;
                                                charset=UTF-8" class="">
                                              <div class="">
                                                <p class="">Hello,</p>
                                                <p class="">what version
                                                  of Kamailio do you
                                                  use?</p>
                                                <p class="">That message
                                                  is printed when the
                                                  connection is not
                                                  found by id or by
                                                  destination address.</p>
                                                <p class="">Cheers,<br
                                                    class="">
                                                  Daniel<br class="">
                                                </p>
                                                <div
                                                  class="moz-cite-prefix">On
                                                  15.04.20 07:11, Mack
                                                  Hendricks wrote:<br
                                                    class="">
                                                </div>
                                                <blockquote type="cite"
cite="mid:AC99C0EA-7AE7-4EEB-BD53-2A9D4DD20C7D@dopensource.com" class="">
                                                  <meta
                                                    http-equiv="content-type"
                                                    content="text/html;
                                                    charset=UTF-8"
                                                    class="">
                                                  <div class="">
                                                    <div class="">Hey
                                                      All,</div>
                                                    <div class=""><br
                                                        class="">
                                                    </div>
                                                    <div class=""><br
                                                        class="">
                                                    </div>
                                                    <div class=""><br
                                                        class="">
                                                    </div>
                                                    <div class="">I get
                                                      this message when
                                                      trying to route
                                                      request to a
                                                      WebSocket client:</div>
                                                    <div class=""><br
                                                        class="">
                                                    </div>
                                                    <div class=""><br
                                                        class="">
                                                    </div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: DEBUG: <core>
                                                      [core/msg_translator.c:1762]:
check_boundaries(): no multi-part body</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: DEBUG: <core>
                                                      [core/msg_translator.c:429]:
                                                      clen_builder():
                                                      content-length:
                                                      651 (651)</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: WARNING: <core>
                                                      [core/msg_translator.c:2786]:
                                                      via_builder(): <b
                                                        class="">TCP/TLS
                                                        connection (id:
                                                        0) for WebSocket
                                                        could not be
                                                        found</b></div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: ERROR: <core>
                                                      [core/msg_translator.c:2002]:
build_req_buf_from_sip_req(): could not create Via header</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: ERROR: tm [t_fwd.c:476]: prepare_new_uac():
                                                      could not build
                                                      request</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: ERROR: tm [t_fwd.c:1738]: t_forward_nonack():
                                                      failure to add
                                                      branches</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: DEBUG: tm [t_funcs.c:337]: t_relay_to():
                                                      t_forward_nonack
                                                      returned error -2
                                                      (-2)</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: DEBUG: tm [t_funcs.c:355]: t_relay_to(): -2
                                                      error reply
                                                      generation delayed</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: exec: *** cfgtrace:request_route=[RELAY]
                                                      c=[/etc/kamailio/kamailio.cfg]
                                                      l=1176 a=24
                                                      n=sl_reply_error</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: ERROR: sl [sl_funcs.c:362]: sl_reply_error():
                                                      stateless error
                                                      reply used: No
                                                      error (2/SL)</div>
                                                    <div class="">Apr 15
                                                      04:59:37
                                                      dSIP060entNightly-0
/usr/sbin/kamailio[22071]: exec: *** cfgtrace:request_route=[RELAY]
                                                      c=[/etc/kamailio/kamailio.cfg]
                                                      l=1178 a=2 n=exit</div>
                                                  </div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class="">Here is
                                                    what my location
                                                    table looks like.
                                                     It should try to
                                                    send the call to <b
                                                      class=""> <a
                                                        href="sip:98.209.240.245:56291;transport=ws"
                                                        class=""
                                                        moz-do-not-send="true">sip:98.209.240.245:56291;transport=ws</a></b></div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
*************************** 2. row ***************************<br
                                                    class="">
                                                             id: 124<br
                                                    class="">
                                                           ruid:
                                                  uloc-5e9685e8-5650-92<br
                                                    class="">
                                                       username: 2000<br
                                                    class="">
                                                         domain: <a
                                                    href="http://ws-test.com/"
                                                    class=""
                                                    moz-do-not-send="true">ws-test.com</a><br
                                                    class="">
                                                       <b class="">
                                                    contact: sips:<a
                                                      href="mailto:2000@df7jal23ls0d.invalid"
                                                      class=""
                                                      moz-do-not-send="true">2000@df7jal23ls0d.invalid</a>;rtcweb-breaker=no;transport=wss<br
                                                      class="">
                                                         received: <a
                                                      href="sip:98.209.240.245:56291;transport=ws"
                                                      class=""
                                                      moz-do-not-send="true">sip:98.209.240.245:56291;transport=ws</a></b><br
                                                    class="">
                                                           path: NULL<br
                                                    class="">
                                                        expires:
                                                  2020-04-15 05:03:17<br
                                                    class="">
                                                              q: -1.00<br
                                                    class="">
                                                         callid:
                                                  7ef0a550-b2b9-24c6-5c3b-8e0c667f5533<br
                                                    class="">
                                                           cseq: 50096<br
                                                    class="">
                                                  last_modified:
                                                  2020-04-15 04:59:57<br
                                                    class="">
                                                          flags: 0<br
                                                    class="">
                                                         cflags: 524352<br
                                                    class="">
                                                     user_agent:
                                                  IM-client/OMA1.0
                                                  sipML5-v1.2016.03.04<br
                                                    class="">
                                                         socket: NULL<br
                                                    class="">
                                                        methods: NULL<br
                                                    class="">
                                                       instance: NULL<br
                                                    class="">
                                                         reg_id: 0<br
                                                    class="">
                                                      server_id: 0<br
                                                    class="">
                                                  connection_id: -1<br
                                                    class="">
                                                      keepalive: 1<br
                                                    class="">
                                                      partition: 18<br
                                                    class="">
                                                  <br class="">
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class=""><b
                                                      class="">The
                                                      Websocket list
                                                      looks like this:</b></div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class="">
                                                    <div class="">Server01:~#
                                                      kamcmd ws.dump</div>
                                                    <div class="">{</div>
                                                    <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>connections:
                                                      {</div>
                                                    <div class=""><span class="Apple-tab-span" style="white-space:pre">               </span><b
                                                        class="">8: <a
class="moz-txt-link-freetext" href="wss://98.209.240.245:56291/"
                                                          moz-do-not-send="true">wss:98.209.240.245:56291</a>
                                                        -> <a
                                                          class="moz-txt-link-freetext"
href="wss://134.122.27.49:4443/" moz-do-not-send="true">wss:134.122.27.49:4443</a>
                                                        (state: OPEN,
                                                         last used 47s
                                                        ago,
                                                        sub-protocol:
                                                        sip)</b></div>
                                                    <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>}</div>
                                                    <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>info:
                                                      {</div>
                                                    <div class=""><span class="Apple-tab-span" style="white-space:pre">               </span>wscounter:
                                                      1</div>
                                                    <div class=""><span class="Apple-tab-span" style="white-space:pre">               </span>truncated:
                                                      no</div>
                                                    <div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>}</div>
                                                    <div class="">}</div>
                                                  </div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class=""><b
                                                      class=""><br
                                                        class="">
                                                    </b></div>
                                                  <div class=""><b
                                                      class="">I’m not
                                                      sure what I’m
                                                      doing wrong.  Any
                                                      ideas?</b></div>
                                                  <div class=""><b
                                                      class=""><br
                                                        class="">
                                                    </b></div>
                                                  <div class=""><b
                                                      class=""><br
                                                        class="">
                                                    </b></div>
                                                  <div class="">Thanks
                                                    in advance</div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <div class="">-Mack</div>
                                                  <div class=""><br
                                                      class="">
                                                  </div>
                                                  <br class="">
                                                  <fieldset
                                                    class="mimeAttachmentHeader"></fieldset>
                                                  <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<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></pre>
                                              </div>
                                            </div>
                                          </blockquote>
                                        </div>
                                        <br class="">
                                      </div>
                                    </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></pre>
                                  </div>
                                </div>
                              </blockquote>
                            </div>
                            <br class="">
                          </div>
                        </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></pre>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br class="">
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a></pre>
  </body>
</html>