diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c index 704f6a4b23e5c4ee383986def171c7ef4478a511..91044a618a8ef65b244e0dab1b5ae5a42ca83b73 100644 --- a/channels/pjsip/dialplan_functions.c +++ b/channels/pjsip/dialplan_functions.c @@ -592,11 +592,16 @@ static int channel_read_pjsip(struct ast_channel *chan, const char *type, const 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); diff --git a/configure b/configure index eb407444201846d6d164cda49f2202cd748b8ca6..afe59dcd901a2893b52b520613e49ff554ffd6fa 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 425966 . +# From configure.ac Revision: 426235 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for asterisk trunk. # @@ -902,6 +902,10 @@ PBX_PORTAUDIO PORTAUDIO_DIR PORTAUDIO_INCLUDE PORTAUDIO_LIB +PBX_PJSIP_GET_DEST_INFO +PJSIP_GET_DEST_INFO_DIR +PJSIP_GET_DEST_INFO_INCLUDE +PJSIP_GET_DEST_INFO_LIB PBX_PJSIP_REPLACE_MEDIA_STREAM PJSIP_REPLACE_MEDIA_STREAM_DIR PJSIP_REPLACE_MEDIA_STREAM_INCLUDE @@ -10270,6 +10274,18 @@ PBX_PJSIP_REPLACE_MEDIA_STREAM=0 +PJSIP_GET_DEST_INFO_DESCRIP="pjsip_get_dest_info support" +PJSIP_GET_DEST_INFO_OPTION=pjsip +PJSIP_GET_DEST_INFO_DIR=${PJPROJECT_DIR} + +PBX_PJSIP_GET_DEST_INFO=0 + + + + + + + PORTAUDIO_DESCRIP="PortAudio" PORTAUDIO_OPTION="portaudio" PBX_PORTAUDIO=0 @@ -23985,6 +24001,111 @@ LIBS="${saved_libs}" CPPFLAGS="${saved_cppflags}" +if test "x${PBX_PJSIP_GET_DEST_INFO}" != "x1" -a "${USE_PJSIP_GET_DEST_INFO}" != "no"; then + pbxlibdir="" + # if --with-PJSIP_GET_DEST_INFO=DIR has been specified, use it. + if test "x${PJSIP_GET_DEST_INFO_DIR}" != "x"; then + if test -d ${PJSIP_GET_DEST_INFO_DIR}/lib; then + pbxlibdir="-L${PJSIP_GET_DEST_INFO_DIR}/lib" + else + pbxlibdir="-L${PJSIP_GET_DEST_INFO_DIR}" + fi + fi + pbxfuncname="pjsip_get_dest_info" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_PJSIP_GET_DEST_INFO_FOUND=yes + else + ast_ext_lib_check_save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS" + as_ac_Lib=`$as_echo "ac_cv_lib_pjsip_${pbxfuncname}" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpjsip" >&5 +$as_echo_n "checking for ${pbxfuncname} in -lpjsip... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ${pbxfuncname} (); +int +main () +{ +return ${pbxfuncname} (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + AST_PJSIP_GET_DEST_INFO_FOUND=yes +else + AST_PJSIP_GET_DEST_INFO_FOUND=no +fi + + CFLAGS="${ast_ext_lib_check_save_CFLAGS}" + fi + + # now check for the header. + if test "${AST_PJSIP_GET_DEST_INFO_FOUND}" = "yes"; then + PJSIP_GET_DEST_INFO_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS" + # if --with-PJSIP_GET_DEST_INFO=DIR has been specified, use it. + if test "x${PJSIP_GET_DEST_INFO_DIR}" != "x"; then + PJSIP_GET_DEST_INFO_INCLUDE="-I${PJSIP_GET_DEST_INFO_DIR}/include" + fi + PJSIP_GET_DEST_INFO_INCLUDE="${PJSIP_GET_DEST_INFO_INCLUDE} $PJPROJECT_CFLAGS" + if test "xpjsip.h" = "x" ; then # no header, assume found + PJSIP_GET_DEST_INFO_HEADER_FOUND="1" + else # check for the header + ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${PJSIP_GET_DEST_INFO_INCLUDE}" + ac_fn_c_check_header_mongrel "$LINENO" "pjsip.h" "ac_cv_header_pjsip_h" "$ac_includes_default" +if test "x$ac_cv_header_pjsip_h" = xyes; then : + PJSIP_GET_DEST_INFO_HEADER_FOUND=1 +else + PJSIP_GET_DEST_INFO_HEADER_FOUND=0 +fi + + + CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" + fi + if test "x${PJSIP_GET_DEST_INFO_HEADER_FOUND}" = "x0" ; then + PJSIP_GET_DEST_INFO_LIB="" + PJSIP_GET_DEST_INFO_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + PJSIP_GET_DEST_INFO_LIB="" + fi + PBX_PJSIP_GET_DEST_INFO=1 + cat >>confdefs.h <<_ACEOF +#define HAVE_PJSIP_GET_DEST_INFO 1 +_ACEOF + + fi + fi +fi + + + + if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then pbxlibdir="" # if --with-POPT=DIR has been specified, use it. diff --git a/configure.ac b/configure.ac index 0b45e454bd09de050627682f4ab1ff70f78af4b6..efbc84a84927e81b91d3b7b723b3ce98606e4b28 100644 --- a/configure.ac +++ b/configure.ac @@ -456,6 +456,7 @@ AST_EXT_LIB_SETUP([PJPROJECT], [PJPROJECT], [pjproject]) 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 @@ AST_C_COMPILE_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [pjmedia_mod_offer_flag flag = 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]) diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 275261371607e4637a3fefdf3ff120ee070e640e..f9046b475eb729e3124804e7499108e5504b48d3 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -578,6 +578,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