From f200f7a6b58030a239b1d005de85204a297c0d16 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 20 Oct 2011 04:01:26 +0000 Subject: Fixed #1319: When sips scheme is used, TLS must be used even when transport=tcp is specified in the URI (thanks IƱaki Baz Castillo for the report) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3832 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip/sip_util.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pjsip/src/pjsip/sip_util.c b/pjsip/src/pjsip/sip_util.c index f5d360c3..4f82a1a6 100644 --- a/pjsip/src/pjsip/sip_util.c +++ b/pjsip/src/pjsip/sip_util.c @@ -813,6 +813,8 @@ static pj_status_t get_dest_info(const pjsip_uri *target_uri, if (PJSIP_URI_SCHEME_IS_SIPS(target_uri)) { pjsip_uri *uri = (pjsip_uri*) target_uri; const pjsip_sip_uri *url=(const pjsip_sip_uri*)pjsip_uri_get_uri(uri); + unsigned flag; + dest_info->flag |= (PJSIP_TRANSPORT_SECURE | PJSIP_TRANSPORT_RELIABLE); if (url->maddr_param.slen) pj_strdup(pool, &dest_info->addr.host, &url->maddr_param); @@ -821,6 +823,18 @@ static pj_status_t get_dest_info(const pjsip_uri *target_uri, dest_info->addr.port = url->port; dest_info->type = pjsip_transport_get_type_from_name(&url->transport_param); + /* Double-check that the transport parameter match. + * Sample case: sips:host;transport=tcp + * See https://trac.pjsip.org/repos/ticket/1319 + */ + flag = pjsip_transport_get_flag_from_type(dest_info->type); + if ((flag & dest_info->flag) != dest_info->flag) { + pjsip_transport_type_e t; + + t = pjsip_transport_get_type_from_flag(dest_info->flag); + if (t != PJSIP_TRANSPORT_UNSPECIFIED) + dest_info->type = t; + } } else if (PJSIP_URI_SCHEME_IS_SIP(target_uri)) { pjsip_uri *uri = (pjsip_uri*) target_uri; -- cgit v1.2.3