Hello experts

I have a setup where webrtc client registrations (from behind a NAT / VPN) are on kamailio and the INVITE to begin a call is sent by freeswitch to kamailio which is then expected to relay it to the subscribed webrtc client.

i understand, from documentation and general thinking, that kamailio cannot open a new connection to such a client and should reuse an open connection (a websocket in my case).

i have setup kamailio as generic as it may sound and expect t_relay() to do the magic of forwarding the invite, however, from logs i don't see anything indicating kamailio is using any existing connection and hence my outgoing invite requests are stuck showing pointed towards a vpn gateway which was the registered "location" of client (which is the public ip of VPN gateway)

please advise what relevant information can i produce here to make the query more readable and clear.

headed here after trying just about all the resources available on the topic.

e.g. if my location record looks like

          AoR: 1004@mydomain.com
          Contacts:
          - Contact:
              Address: sip:1004@11.22.33.44:49179
              CFlags: 64
              CSeq: 3087
              Call-ID: 189jss21e24ntve1ggsuli
              Expires: 593
              Flags: 0
              Instance: <urn:uuid:8a936bbc-514f-4755-bed0-edc644dd4453>
              KA-Roundtrip: 0
              Keepalive: 1
              Last-Keepalive: 1683652755
              Last-Modified: 1683652755
              Methods: 7071
              Path: <sip:10.10.6.196:3040;received=sip:mydomain.com;lr;nat=yes>
              Q: -1
              Received: sip:11.22.33.44:49179;transport=ws
              Reg-Id: 1
              Ruid: uloc-645601c4-131220-3764
              Server-Id: 0
              Socket: tls:1.2.3.4:4443
              State: CS_SYNC
              Tcpconn-Id: 3916
              User-Agent: JsSIP 3.9.0

i try to lookup the location and find the address, and then route to that address by setting $ru
in sngrep it does show that kamailio is trying to send INVITE to 11.22.33.44:port (which is the VPN gateway) but it isn't exactly clear from logs if this is being done over an existing connection.

how does kamailio identify if a connection exists for a user (for each contact in AOR, if multiple contacts exist for a user -- i.e. different browser sessions?)


 if(reg_fetch_contacts("location", "$ru", "caller")) {
    $var(i) = 0;
    while($var(i) < $(ulc(caller=>count)))
    {
        $ru = $(ulc(caller=>addr)[$var(i)]);
        $var(i) = $var(i) + 1;
        setflag(FLT_DLGINFO);
        dlg_manage();
        t_relay();
    }
  }

--
Shwetank