Hi,
the Contact in a WS request/message has always an invalid URI, so your edge proxy cannot resolve it (hence the 487 error).
As suggested you should add, in the edge proxy, an alias to the contact in REGISTER and SUBSCRIBE requests using nathelper module add_contact_alias function (https://www.kamailio.org/docs/modules/5.6.x/modules/nathelper.html#nathelper.f.add_contact_alias),
and then in the in-dialog request use handle-ruri_alias to set the destination uri (https://www.kamailio.org/docs/modules/5.6.x/modules/nathelper.html#nathelper.f.handle_ruri_alias).
The websocket module has an example of this (https://www.kamailio.org/docs/modules/5.6.x/modules/websocket.html#idm37).

Cheers,

Federico

On Sun, Dec 25, 2022 at 7:10 PM Giovanni Iamonte <iamonte@quintetto.it> wrote:

Hi

I tried to figured out what you said and I made some tests but without success.

Let me give you more info.

Scenario 1

Our issue  is due to the Proxy Edge, indeed if we configuring the Register (We have followed the websocket module documentation)  to directly manage the request from client everything works fine.

   Browser                      Register
Client JsSIP                   Websocket
  |                                |                              
  |                                | 
  | ----------Register-----------> |
  | <----------200 OK  ----------- |
  |                                |
  | ----------Subscribe----------> |
  | <----------200 OK  ----------- |
  |                                |
  | <----------NOTIFY  ----------- |
  |                                |



Scenario 2

Instead when we configuring the proxy edge with websocket (we have followed the edge_websocket.cfg example)  and the register without websocket we face the issue. As I wrote  in my previous mail into the log file of  both proxy and register server we find "Unresolvable destination (478/SL".

   Browser                    Proxy Edge                          Register
Client JsSIP                   Websocket                        no websocket
  |                                |                                |
  |                                |                                |
  | ----------Register-----------> | -----------Register----------> |
  | <----------200 OK  ----------- | <----------200 OK  ----------- |
  |                                |                                |
  | ----------Subscribe----------> | -----------Subscribe---------> |
  | <----------200 OK  ----------- | <----------200 OK  ----------- |
  |                                |                                |
  |                          X<--- | <----------NOTIFY  ----------- |
  |                                |                                |


Could you please give more details to solve this issue.

Thanks a lot for your time.

Regards


Ing. Giovanni Iamonte
Developments and technologies area
Quintetto Srl
Via Monte Navale, 1
10015 - Ivrea (TO)
 mobile: +39 393 9196310
 tel: +39 0165 1845290
 e-mail: giovanni.iamonte@quintetto.it
 web: www.quintetto.it

On 20/12/22 14:47, M S wrote:
In WebRTC (websocket) the contact header always has invalid URI, so, you MUST either use path module OR add contact alias for both REGISTER and SUBSCRIBE requests otherwise any subsequent incoming SIP requests such as INVITE and NOTIFY won't be routed to endpoint (SIP client).

See websocket module documentation which has an example configuration script for handling these requests.

Kind regards,

--
Muhammad Shahzad Shafi
Tel: +49 176 99 83 10 85


On Tue, Dec 20, 2022, 13:40 Giovanni Iamonte <iamonte@quintetto.it> wrote:

Dear List

We have configured kamailio to work as a proxy edge and register.

As a proxy edge cfg file we have used the example edge_websocket.cfg.

We are developing two different client the first one based on PJSIP and the other one based JsSIP.

Client PJSIP (no websockets)
everything work perfectly, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, MESSAGE, INVITE

Client JsSIP (with websockets)
The REGISTER, SUBSCRIBE works, the NOTIFY does not work.
In more in details we have:

   Browser                    Proxy Edge                        Register
Client JsSIP                   Websocket
  |                                |                                |
  |                                |                                |
  | ----------Register-----------> | -----------Register----------> |
  | <----------200 OK  ----------- | <----------200 OK  ----------- |
  |                                |                                |
  | ----------Subscribe----------> | -----------Subscribe---------> |
  | <----------200 OK  ----------- | <----------200 OK  ----------- |
  |                                |                                |
  |                          X<--- | <----------NOTIFY  ----------- |
  |                                |                                |


As you can see the NOTIFY start from Register and reach the proxy, beloe the Register log file and the sip messages.

Could somebody put me in the right direction.

Thanks

Bye


Log File

Dec 20 10:51:58 kr-server /usr/sbin/kamailio[87875]: DEBUG: <core> [core/tcp_read.c:1533]: tcp_read_req(): content-length=0
Dec 20 10:51:58 kr-server /usr/sbin/kamailio[87875]: DEBUG: <core> [core/parser/parse_fline.c:249]: parse_first_line(): first line type 2 (reply(status)) flags 1
Dec 20 10:51:58 kr-server /usr/sbin/kamailio[87875]: DEBUG: <core> [core/parser/msg_parser.c:689]: parse_msg(): SIP Reply  (status):
Dec 20 10:51:58 kr-server /usr/sbin/kamailio[87875]: DEBUG: <core> [core/parser/msg_parser.c:690]: parse_msg():  version: <SIP/2.0>
Dec 20 10:51:58 kr-server /usr/sbin/kamailio[87875]: DEBUG: <core> [core/parser/msg_parser.c:692]: parse_msg():  status:  <478>
Dec 20 10:51:58 kr-server /usr/sbin/kamailio[87875]: DEBUG: <core> [core/parser/msg_parser.c:694]: parse_msg():  reason:  <Unresolvable destination (478/SL)>
Dec 20 10:51:58 kr-server /usr/sbin/kamailio[87875]: DEBUG: <core> [core/parser/parse_hname2.c:301]: parse_sip_header_name(): parsed header name [Via] type 1

Sip Messages

REGISTER sip:sip-register.quintetto.it SIP/2.0
Via: SIP/2.0/WSS 13569868356.invalid;branch=z9hG4bK7825787
Max-Forwards: 69
To: <sip:quintetto00@sip-register.quintetto.it>
From: "quintetto00" <sip:quintetto00@sip-register.quintetto.it>;tag=2tnuk9btmp
Call-ID: unrnseei8924hf67khoi3g
CSeq: 2 REGISTER
Authorization: Digest algorithm=MD5, username="quintetto00", realm="sip-register.quintetto.it", nonce="Y6GUq2Ohk3//HTza7ZYMfd85XMdavgnc", uri="sip:sip-register.quintetto.it", response="c9cc56d2d5e36b0a68873c1d5258d062"
Contact: <sip:quintetto00@13569868356.invalid;transport=ws>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:64e71c57-fd55-4868-be2b-a4a3fa546ac8>";expires=3600
Expires: 3600
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY,SUBSCRIBE,PUBLISH
Supported: path,gruu,outbound
User-Agent: JsSIP 3.10.0
Content-Length: 0


SIP/2.0 200 OK
Via: SIP/2.0/WSS 13569868356.invalid;rport=37566;received=192.168.100.192;branch=z9hG4bK7825787
To: <sip:quintetto00@sip-register.quintetto.it>;tag=2b789d0fa67ad6c2da65f0cce35dd60b.71a84df9
From: "quintetto00" <sip:quintetto00@sip-register.quintetto.it>;tag=2tnuk9btmp
Call-ID: unrnseei8924hf67khoi3g
CSeq: 2 REGISTER
Contact: <sip:quintetto00@13569868356.invalid;transport=ws>;expires=3600;+sip.instance="<urn:uuid:64e71c57-fd55-4868-be2b-a4a3fa546ac8>";reg-id=1
Server: kamailio (5.6.2 (x86_64/linux))
Content-Length: 0



SUBSCRIBE sip:quintetto03@sip-register.quintetto.it SIP/2.0
Via: SIP/2.0/WSS 13569868356.invalid;branch=z9hG4bK3648599
Max-Forwards: 69
To: <sip:quintetto03@sip-register.quintetto.it>
From: "quintetto00" <sip:quintetto00@sip-register.quintetto.it>;tag=o261bh2uh7
Call-ID: 4beh90hur8hdhptnbjt8
CSeq: 5813 SUBSCRIBE
Proxy-Authorization: Digest algorithm=MD5, username="quintetto00", realm="sip-register.quintetto.it", nonce="Y6GU+mOhk86y3fnrMzoKgiVAdkaTvBId", uri="sip:quintetto03@sip-register.quintetto.it", response="04ca6d83661ac338810baa95ffaa568b"
Event: presence
Expires: 3600
Accept: application/pidf+xml, application/xpidf+xml
Contact: <sip:quintetto00@13569868356.invalid;transport=ws>
Content-Type: application/pidf+xml
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY,SUBSCRIBE,PUBLISH
Supported: outbound
User-Agent: JsSIP 3.10.0
Content-Length: 35



SIP/2.0 200 OK
Record-Route: <sip:192.168.100.24:15006;transport=tcp;r2=on;lr>
Record-Route: <sip:192.168.100.24:16005;transport=ws;r2=on;lr>
Via: SIP/2.0/WSS 13569868356.invalid;rport=37566;received=192.168.100.192;branch=z9hG4bK3648599
To: <sip:quintetto03@sip-register.quintetto.it>;tag=c906ce7d8b5c7cc84a3505ebe369640b-e45527ec
From: "quintetto00" <sip:quintetto00@sip-register.quintetto.it>;tag=o261bh2uh7
Call-ID: 4beh90hur8hdhptnbjt8
CSeq: 5813 SUBSCRIBE
Expires: 3600
Contact: <sip:192.168.100.23:15006;transport=tcp>
Server: kamailio (5.6.2 (x86_64/linux))
Content-Length: 0



NOTIFY.sip:quintetto00@13569868356.invalid;transport=ws.SIP/2.0
Via:.SIP/2.0/TCP.1 92.168.100.23:15 006;branch=z9hG4bK28ad.a5d3bdf6000000000000000000000000.0
To: <sip:quintetto00@sip-register.quintetto.it>;tag=o261bh2uh7
From: <sip:quintetto03@sip-register.quintetto.it>;tag=c906ce7d8b5c7cc84a3505ebe369640b-e45527ec
CSeq : 2 NOTIFY
Call-ID:.4beh90hur8h dhptnbjt8
Route : <sip:192.168.1 00.24:15006;transport=tcp;r2=on;lr>,.<sip:192.16 8.100.24:16005;transport=ws;r2=on;lr>
Content-Length:.0
User-Agent: kamailio.(5.6.2.(x86_64/li nux))
Max-Forwards:.70
Event: presence
Contact:.<sip:192.168.100.23:15006;transport=tcp>
Subscription-State: active;expires= 3600

SIP/2.0.478.Unresolvable.destination.(478/SL)
Via: SIP/2.0/TC P.192.168.100.23 :15006;branch=z9hG4bK28ad.a5d3bdf6000000000000000000000000.0;rport=38019
To:.<sip:quintetto00@s ip-register.quintetto.it>;tag=o261bh2uh7
From: <sip:quintetto03 @sip-register.quintetto.it>;tag=c906ce7d8b5c7cc84a3505ebe369640b-e45527ec
CSeq: 2 NOTIFY
Call-ID: 4beh90hur8hdhptnbjt8
Server :.kamailio.(5.6.2.(x86_64/linux))
Content-Length: 0

SIP/2.0.478.Unresolvable.destination.(478/TM)
Via: SIP/2.0/TC P.192.168.100.23:15006;branch=z9hG4bK28ad.a5d3bdf6000000000000000000000000.0;rport=38019
To: <sip:quintetto00@s ip-register.quintetto.it>;tag=o261bh2uh7
From: <sip:quintetto03 @sip-register.quintetto.it>;tag=c906ce7d8b5c7cc84a3505ebe369640b-e45527ec
CSeq: 2 NOTIFY
Call-ID: 4beh90hur8hdhptnbjt8
Server : kamailio.(5.6.2.(x86_64/linux))
Content-Length: 0









--

Ing. Giovanni Iamonte
Developments and technologies area
Quintetto Srl
Via Monte Navale, 1
10015 - Ivrea (TO)
 mobile: +39 393 9196310
 tel: +39 0165 1845290
 e-mail: giovanni.iamonte@quintetto.it
 web: www.quintetto.it

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe: