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. ........ Merged revisions 421931 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 421932 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
cee660dadf
commit
2c0cbf8e64
|
@ -300,6 +300,8 @@ static void websocket_cb(struct ast_websocket *session, struct ast_variable *par
|
||||||
*/
|
*/
|
||||||
static pj_bool_t websocket_on_rx_msg(pjsip_rx_data *rdata)
|
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;
|
pjsip_contact_hdr *contact;
|
||||||
|
|
||||||
long type = rdata->tp_info.transport->key.type;
|
long type = rdata->tp_info.transport->key.type;
|
||||||
|
@ -314,6 +316,7 @@ static pj_bool_t websocket_on_rx_msg(pjsip_rx_data *rdata)
|
||||||
|
|
||||||
pj_cstr(&uri->host, rdata->pkt_info.src_name);
|
pj_cstr(&uri->host, rdata->pkt_info.src_name);
|
||||||
uri->port = rdata->pkt_info.src_port;
|
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;
|
rdata->msg_info.via->rport_param = 0;
|
||||||
|
|
Loading…
Reference in New Issue