SIP.js icon indicating copy to clipboard operation
SIP.js copied to clipboard

Support customizing the transport protocol used for Via headers

Open radioprotector opened this issue 3 years ago • 1 comments

This allows for transport protocols that are not based solely on Transport.server's URL scheme.

This provides a path for eliminating the deprecated UserAgentOptions.hackViaTcp configuration option, as the transport options can now have { headerProtocol: "TCP" } in its place.

This change is also useful when working with SIP endpoints that are behind a load balancer with SSL termination at the balancer. In that case, the transport protocol between the browser and the load balancer would use the SIPS/WSS/TLS protocol, but I believe the transport protocol indicated in the Via header would need to be SIP/WS/TCP when it reaches the SIP endpoints.

Potential Alternative

Instead of impacting Transport.protocol, I considered adding an alternate Transport.headerProtocol property that would be referenced in setViaHeader calls.

However, the core Transport.protocol property states that it is formatted "as defined for the Via header sent-protocol transport", and Transport.protocol is currently only referenced for the purposes of setViaHeader calls, so I felt this would be redundant.

radioprotector avatar Feb 07 '23 17:02 radioprotector

As an hack, you can do: simpleUser.sessionManager.userAgent._transport._protocol = "WS";

tal952 avatar Jul 07 '23 08:07 tal952