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.

Do you get any error messages when processing the REGISTER?

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).

Cheers,
Daniel

On 17.04.20 14:34, Mack Hendricks wrote:
Here is what one of my registrations look like

              id: 148
         ruid: uloc-5e999161-1782-1
     username: 2000
       domain: ws-test.com
      contact: sips:2000@df7jal23ls0d.invalid;rtcweb-breaker=no;transport=wss
     received: sip:98.209.240.245:63356;transport=ws
         path: NULL
      expires: 2020-04-17 12:30:14
            q: -1.00
       callid: 73beb50f-65de-a461-be26-187c9aaa53c1
         cseq: 48179
last_modified: 2020-04-17 12:26:54
        flags: 0
       cflags: 524352
   user_agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
       socket: NULL
      methods: NULL
     instance: NULL
       reg_id: 0
    server_id: 0
connection_id: -1
    keepalive: 1
    partition: 18

On Apr 17, 2020, at 8:30 AM, Mack Hendricks <mack@dopensource.com> wrote:

Hello,

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.

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?



On Apr 16, 2020, at 2:44 AM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:

Hello,

did you print the log message just before t_relay()?

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.

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.

Cheers,
Daniel

On 16.04.20 05:10, Mack Hendricks wrote:
Hey Daniel,

It returns:

 [LOCATION] ru: sips:2000@df7jal23ls0d.invalid;rtcweb-breaker=no;transport=wss, nh(u): sip:98.209.240.245:50453;transport=ws

This matches the output from

kamcmd ws.dump


connections: {
29: wss:98.209.240.245:50453 -> wss:134.122.27.49:4443 (state: OPEN,  last used 22s ago, sub-protocol: sip)
}
info: {
wscounter: 1
truncated: no
}
}

I can grade to 5.3 if you think that’s best.




On Apr 15, 2020, at 12:11 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:

Hello,

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.

Cheers,
Daniel

On 15.04.20 16:54, Mack Hendricks wrote:
Hello,

I’m running kamailio 5.1.10 (x86_64/linux)

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.

Any suggestions?




On Apr 15, 2020, at 10:48 AM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:

Hello,

what version of Kamailio do you use?

That message is printed when the connection is not found by id or by destination address.

Cheers,
Daniel

On 15.04.20 07:11, Mack Hendricks wrote:
Hey All,



I get this message when trying to route request to a WebSocket client:


Apr 15 04:59:37 dSIP060entNightly-0 /usr/sbin/kamailio[22071]: DEBUG: <core> [core/msg_translator.c:1762]: check_boundaries(): no multi-part body
Apr 15 04:59:37 dSIP060entNightly-0 /usr/sbin/kamailio[22071]: DEBUG: <core> [core/msg_translator.c:429]: clen_builder(): content-length: 651 (651)
Apr 15 04:59:37 dSIP060entNightly-0 /usr/sbin/kamailio[22071]: WARNING: <core> [core/msg_translator.c:2786]: via_builder(): TCP/TLS connection (id: 0) for WebSocket could not be found
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
Apr 15 04:59:37 dSIP060entNightly-0 /usr/sbin/kamailio[22071]: ERROR: tm [t_fwd.c:476]: prepare_new_uac(): could not build request
Apr 15 04:59:37 dSIP060entNightly-0 /usr/sbin/kamailio[22071]: ERROR: tm [t_fwd.c:1738]: t_forward_nonack(): failure to add branches
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)
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
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
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)
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



Here is what my location table looks like.  It should try to send the call to  sip:98.209.240.245:56291;transport=ws


*************************** 2. row ***************************
           id: 124
         ruid: uloc-5e9685e8-5650-92
     username: 2000
       domain: ws-test.com
      contact: sips:2000@df7jal23ls0d.invalid;rtcweb-breaker=no;transport=wss
     received: sip:98.209.240.245:56291;transport=ws

         path: NULL
      expires: 2020-04-15 05:03:17
            q: -1.00
       callid: 7ef0a550-b2b9-24c6-5c3b-8e0c667f5533
         cseq: 50096
last_modified: 2020-04-15 04:59:57
        flags: 0
       cflags: 524352
   user_agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
       socket: NULL
      methods: NULL
     instance: NULL
       reg_id: 0
    server_id: 0
connection_id: -1
    keepalive: 1
    partition: 18


The Websocket list looks like this:


Server01:~# kamcmd ws.dump
{
connections: {
8: wss:98.209.240.245:56291 -> wss:134.122.27.49:4443 (state: OPEN,  last used 47s ago, sub-protocol: sip)
}
info: {
wscounter: 1
truncated: no
}
}


I’m not sure what I’m doing wrong.  Any ideas?


Thanks in advance

-Mack


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda


-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda