]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip/chan_sip: Advertise 'ws' in the SIP URI transport parameter 09/4509/1
authorMatt Jordan <mjordan@digium.com>
Tue, 22 Nov 2016 16:27:46 +0000 (10:27 -0600)
committerMatt Jordan <mjordan@digium.com>
Mon, 28 Nov 2016 19:36:17 +0000 (13:36 -0600)
commit09c36a65356093e2a40cd2b23ff9f945e1028589
treed222a8711104d32c7c85fba271c0020c856fd0e0
parenta1fa9090337aeb14cc5e86cd7d212d35cc95b37a
res_pjsip/chan_sip: Advertise 'ws' in the SIP URI transport parameter

Per RFC 7118 5.2, the SIP URI 'transport' parameter should advertise
'ws' when WebSockets are to be used as the transport. This applies to
both secure and insecure WebSockets.

There were two bugs in Asterisk with respect to this:

(1) The most egregious occurs in res_pjsip. There, we advertise 'ws' for
    insecure websockets and 'wss' for secure websockets. While this
    would seem to make sense - since 'WS' and 'WSS' are used for the Via
    Transport parameter - this is not the case for the SIP URI. This
    patch corrects that by registering the secure websockets with
    pjproject using the shorthand 'WS', and by returning 'ws' when asked
    for the transport parameter. Note that in pjproject, it is perfectly
    valid to have multiple transports use the same shorthand.

(2) In chan_sip, we return an upper-case version of the transport 'WS'
    instead of 'ws'. Since we should be strict in what we send and
    liberal in what we accept (within reason), this patch lower-cases
    the transport before appending it to the parameter.

ASTERISK-24330 #close
Reported by: cervajs, Inaki Baz Castillo

Change-Id: Iff77b645f8cc3b7cd35168a6676c26b147f22f42
channels/chan_sip.c
res/res_pjsip_transport_websocket.c