summaryrefslogtreecommitdiff
path: root/res/res_pjsip_nat.c
diff options
context:
space:
mode:
authorJørgen H <asterisk.org@hovland.cx>2017-02-16 10:22:47 +0000
committerJoshua Colp <jcolp@digium.com>2017-03-01 15:52:16 +0000
commite510595c868c58eea6213f727156ea7d05141428 (patch)
tree59073ccc8d1b11531faaa476c92d357faf2e87e7 /res/res_pjsip_nat.c
parent9d3ab062cccc5d545648dd65beb817c37f439c2f (diff)
res_pjsip WebRTC/websockets: Fix usage of WS vs WSS.
According to the RFC[1] WSS should only be used in the Via header for secure Websockets. * Use WSS in Via for secure transport. * Only register one transport with the WS name because it would be ambiguous. Outgoing requests may try to find the transport by name and pjproject only finds the first one registered. This may mess up unsecure websockets but the impact should be minimal. Firefox and Chrome do not support anything other than secure websockets anymore. * Added and updated some debug messages concerning websockets. * security_events.c: Relax case restriction when determining security transport type. * The res_pjsip_nat module has been updated to not touch the transport on Websocket originating messages. [1] https://tools.ietf.org/html/rfc7118 ASTERISK-26796 #close Change-Id: Ie3a0fb1a41101a4c1e49d875a8aa87b189e7ab12
Diffstat (limited to 'res/res_pjsip_nat.c')
-rw-r--r--res/res_pjsip_nat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c
index 59ef71c5c..7404ef5f0 100644
--- a/res/res_pjsip_nat.c
+++ b/res/res_pjsip_nat.c
@@ -35,7 +35,9 @@
static void rewrite_uri(pjsip_rx_data *rdata, pjsip_sip_uri *uri)
{
pj_cstr(&uri->host, rdata->pkt_info.src_name);
- if (strcasecmp("udp", rdata->tp_info.transport->type_name)) {
+ if (!strcasecmp("WSS", rdata->tp_info.transport->type_name)) {
+ /* WSS is special, we don't want to overwrite the URI at all as it needs to be ws */
+ } else if (strcasecmp("udp", rdata->tp_info.transport->type_name)) {
uri->transport_param = pj_str(rdata->tp_info.transport->type_name);
} else {
uri->transport_param.slen = 0;