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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@421931
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
*/
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;
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;