Description

For secure websocket connections (wss), Kamailio seems to forget that the connection is secure, later trying to use a regular TCP listen option to send out messags.

I'd be happy to propose a patch, but I'm not sure what the expected behavior of Kamailio would be here.

Setup:

We have traced the issue:

Troubleshooting

Reproduction

Reproducing from scratch requires quite some setup, hopefully the above information will be enough to diagnose.

Debugging Data

See above.

Log Messages

See above.

SIP Traffic

See above, can provide exact SIP traces if required.

Possible Solutions

We have been able to work around the issue like this:

if (pcre_match("$(hdr(Route)[0]{nameaddr.uri}{uri.param,received})", "%3Btransport%3Dws")) {
    # Kamailio bug?
    # in the received parameter of the route header, there is ';transport=ws'
    # so kamailio starts looking for a *tcp* connection, while it should be looking for a *tls*
    # connection.
    xlog("L_NOTICE", "Websocket detected; forcing wss transport");
    set_send_socket("tls:WEBSOCKET_IP:WEBSOCKET_PORT");
}

Additional Information

Tested with 5.4.4, but code doesn't seem to be changed in master.

Ubuntu Focal.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3340@github.com>