-
Notifications
You must be signed in to change notification settings - Fork 203
Description
I am currently working with Sofia-SIP 1.13.17 and trying to establish a WebSocket (WS/WSS) client connection for SIP over WebSockets. However, I am unable to find where the WebSocket client initiates the HTTP GET handshake request (Upgrade: websocket).
Observations:
Server-Side WebSocket Handling Exists:
I found that ws_handshake() in ws.c handles the WebSocket handshake, but it appears to be for server-side requests, where it processes incoming WebSocket connections and sends a 101 Switching Protocols response.
Expected Client-Side WebSocket Handshake:
For a WebSocket client, I expect Sofia-SIP to send a GET request similar to:
http
GET /sip HTTP/1.1
Host: example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: BASE64_ENCODED_KEY
Sec-WebSocket-Version: 13
However, I do not find this request being generated anywhere in the Sofia-SIP client-side transport functions.
Tracing the Flow for WSS Client:
When attempting a WebSocket client connection, the flow reaches:
tport_base_connect() → tport_alloc_secondary() → tport_ws_init_secondary() → WS_INIT() → establish_logical_layer() → ws_handshake()
Since ws_handshake() mainly processes incoming WebSocket requests, I expected the HTTP GET request for the client-side handshake to be constructed earlier, but I don’t see where that happens.
Key Questions:
Does Sofia-SIP 1.13.17 fully support WebSocket client connections (ws:// and wss://)?
Where is the HTTP GET request for the WebSocket handshake constructed and sent in the client-side code?
Is there an alternative way to properly initiate a WebSocket client connection in Sofia-SIP?
If client-side WebSocket support is incomplete, what would be the best way to extend Sofia-SIP to include it?
Would appreciate any insights or guidance on this! Thanks in advance. 😊