Author: file
Date: Tue Jan 13 06:06:50 2015
New Revision: 430546

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430546
Log:
chan_pjsip: Add configure check for 'pjsip_get_dest_info' function.

The 'pjsip_get_dest_info' function is used to determine if the signaling 
transport
of the dialog is secure or not. This function was added in PJSIP 2.3 and does 
not
exist in earlier versions.

This configure check allows Asterisk to build and run with older versions at the
loss of the 'secure' argument for the PJSIP CHANNEL dialplan function. Usage of
this argument will require upgrading to PJSIP 2.3.

ASTERISK-24665 #close
Reported by: Mark Michelson

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

Modified:
    branches/13/channels/pjsip/dialplan_functions.c
    branches/13/configure
    branches/13/configure.ac
    branches/13/include/asterisk/autoconfig.h.in

Modified: branches/13/channels/pjsip/dialplan_functions.c
URL: 
http://svnview.digium.com/svn/asterisk/branches/13/channels/pjsip/dialplan_functions.c?view=diff&rev=430546&r1=430545&r2=430546
==============================================================================
--- branches/13/channels/pjsip/dialplan_functions.c (original)
+++ branches/13/channels/pjsip/dialplan_functions.c Tue Jan 13 06:06:50 2015
@@ -592,11 +592,16 @@
        dlg = channel->session->inv_session->dlg;
 
        if (!strcmp(type, "secure")) {
+#ifdef HAVE_PJSIP_GET_DEST_INFO
                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
+               ast_log(LOG_WARNING, "Asterisk has been built against a version 
of pjproject which does not have the required functionality to support the 
'secure' argument. Please upgrade to version 2.3 or later.\n");
+               return -1;
+#endif
        } else if (!strcmp(type, "target_uri")) {
                pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->target, buf, buflen);
                buf_copy = ast_strdupa(buf);

Modified: branches/13/configure.ac
URL: 
http://svnview.digium.com/svn/asterisk/branches/13/configure.ac?view=diff&rev=430546&r1=430545&r2=430546
==============================================================================
--- branches/13/configure.ac (original)
+++ branches/13/configure.ac Tue Jan 13 06:06:50 2015
@@ -456,6 +456,7 @@
 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
 AST_EXT_LIB_SETUP_OPTIONAL([PJ_TRANSACTION_GRP_LOCK], [PJSIP Transaction Group 
Lock Support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_REPLACE_MEDIA_STREAM], [PJSIP Media Stream 
Replacement Support], [PJPROJECT], [pjsip])
+AST_EXT_LIB_SETUP_OPTIONAL([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info 
support], [PJPROJECT], [pjsip])
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
 AST_EXT_LIB_SETUP_OPTIONAL([PRI_SETUP_ACK_INBAND], [ISDN PRI progress inband 
ie in SETUP ACK], [PRI], [pri])
@@ -2071,6 +2072,8 @@
 LIBS="${saved_libs}"
 CPPFLAGS="${saved_cppflags}"
 
+AST_EXT_LIB_CHECK([PJSIP_GET_DEST_INFO], [pjsip], [pjsip_get_dest_info], 
[pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS])
+
 AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
 
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])

Modified: branches/13/include/asterisk/autoconfig.h.in
URL: 
http://svnview.digium.com/svn/asterisk/branches/13/include/asterisk/autoconfig.h.in?view=diff&rev=430546&r1=430545&r2=430546
==============================================================================
--- branches/13/include/asterisk/autoconfig.h.in (original)
+++ branches/13/include/asterisk/autoconfig.h.in Tue Jan 13 06:06:50 2015
@@ -577,6 +577,9 @@
 
 /* Define if your system has the PJPROJECT libraries. */
 #undef HAVE_PJPROJECT
+
+/* Define to 1 if PJPROJECT has the pjsip_get_dest_info support feature. */
+#undef HAVE_PJSIP_GET_DEST_INFO
 
 /* Define if your system has the PJSIP_REPLACE_MEDIA_STREAM headers. */
 #undef HAVE_PJSIP_REPLACE_MEDIA_STREAM


-- 
_____________________________________________________________________
-- 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