[asterisk-commits] file: branch 12 r421931 - /branches/12/res/res_pjsip_transport_websocket.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Aug 24 13:52:12 CDT 2014


Author: file
Date: Sun Aug 24 13:52:09 2014
New Revision: 421931

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=421931
Log:
res_pjsip_transport_websocket: Ensure secure Websocket clients can be called.

This change enforces the transport in the Contact header for Websocket clients.
Previously a client may provide a transport of 'ws' when it is actually using
a transport of 'wss'. This would cause outgoing calls to fail as the existing
connection could not be found.

Modified:
    branches/12/res/res_pjsip_transport_websocket.c

Modified: branches/12/res/res_pjsip_transport_websocket.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_transport_websocket.c?view=diff&rev=421931&r1=421930&r2=421931
==============================================================================
--- branches/12/res/res_pjsip_transport_websocket.c (original)
+++ branches/12/res/res_pjsip_transport_websocket.c Sun Aug 24 13:52:09 2014
@@ -300,6 +300,8 @@
  */
 static pj_bool_t websocket_on_rx_msg(pjsip_rx_data *rdata)
 {
+	static const pj_str_t STR_WS = { "ws", 2 };
+	static const pj_str_t STR_WSS = { "wss", 3 };
 	pjsip_contact_hdr *contact;
 
 	long type = rdata->tp_info.transport->key.type;
@@ -314,6 +316,7 @@
 
 		pj_cstr(&uri->host, rdata->pkt_info.src_name);
 		uri->port = rdata->pkt_info.src_port;
+		pj_strdup(rdata->tp_info.pool, &uri->transport_param, (type == (long)transport_type_ws) ? &STR_WS : &STR_WSS);
 	}
 
 	rdata->msg_info.via->rport_param = 0;




More information about the asterisk-commits mailing list