Author: bebuild
Date: Fri Dec 19 14:38:03 2014
New Revision: 429861

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=429861
Log:
Ensure the correct value is returned for CHANNEL(pjsip, secure)

Prior to this patch, we were using the PJSIP dialog's secure flag
to determine if a secure transport was being used. Unfortunately,
the dialog's secure flag was only set if a SIPS URI were in use,
as required by RFC 3261 sections 12.1.1 and 12.1.2. What we're interested
in is not dialog security, but transport security. This code change
switches to a model where we use the dialog's target URI to determine
what transport would be used to communicate, and then check if that
transport is secure.

AST-1450 #close
Reported by John Bigelow

Review: https://reviewboard.asterisk.org/r/4277
........

Merged revisions 429739 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    certified/branches/13.1/   (props changed)
    certified/branches/13.1/channels/pjsip/dialplan_functions.c

Propchange: certified/branches/13.1/
------------------------------------------------------------------------------
--- branch-13-merged (original)
+++ branch-13-merged Fri Dec 19 14:38:03 2014
@@ -1,1 +1,1 @@
-/branches/13:429540,429571,429829
+/branches/13:429540,429571,429739,429829

Modified: certified/branches/13.1/channels/pjsip/dialplan_functions.c
URL: 
http://svnview.digium.com/svn/asterisk/certified/branches/13.1/channels/pjsip/dialplan_functions.c?view=diff&rev=429861&r1=429860&r2=429861
==============================================================================
--- certified/branches/13.1/channels/pjsip/dialplan_functions.c (original)
+++ certified/branches/13.1/channels/pjsip/dialplan_functions.c Fri Dec 19 
14:38:03 2014
@@ -580,7 +580,11 @@
        dlg = channel->session->inv_session->dlg;
 
        if (!strcmp(type, "secure")) {
-               snprintf(buf, buflen, "%d", dlg->secure ? 1 : 0);
+               pjsip_host_info dest;
+               pj_pool_t *pool = 
pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(), "secure-check", 128, 128);
+               pjsip_get_dest_info(dlg->target, NULL, pool, &dest);
+               snprintf(buf, buflen, "%d", dest.flag & PJSIP_TRANSPORT_SECURE 
? 1 : 0);
+               pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
        } else if (!strcmp(type, "target_uri")) {
                pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->target, buf, buflen);
                buf_copy = ast_strdupa(buf);


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to