From b8025e789de01ffa20214499e57b017db1f91f03 Mon Sep 17 00:00:00 2001 From: Joshua Colp <jcolp@digium.com> Date: Tue, 3 Dec 2013 18:01:36 +0000 Subject: [PATCH] res_pjsip_session: Add support for PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE flag. Newer versions of PJSIP have changed to using a flag for the PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE instead of a define. This adds a configure check to detect the presence of the flag and use it if found. ........ Merged revisions 403329 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403330 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- configure | 64 +++++++++++++++++++++++++++++++- configure.ac | 3 ++ include/asterisk/autoconfig.h.in | 3 ++ res/res_pjsip_session.c | 5 ++- 4 files changed, 72 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 30ec6b586c..a185656459 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 402865 . +# From configure.ac Revision: 403161 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for asterisk trunk. # @@ -899,6 +899,10 @@ PBX_PORTAUDIO PORTAUDIO_DIR PORTAUDIO_INCLUDE PORTAUDIO_LIB +PBX_PJSIP_REPLACE_MEDIA_STREAM +PJSIP_REPLACE_MEDIA_STREAM_DIR +PJSIP_REPLACE_MEDIA_STREAM_INCLUDE +PJSIP_REPLACE_MEDIA_STREAM_LIB PBX_PJ_TRANSACTION_GRP_LOCK PJ_TRANSACTION_GRP_LOCK_DIR PJ_TRANSACTION_GRP_LOCK_INCLUDE @@ -10167,6 +10171,18 @@ PBX_PJ_TRANSACTION_GRP_LOCK=0 +PJSIP_REPLACE_MEDIA_STREAM_DESCRIP="PJSIP Media Stream Replacement Support" +PJSIP_REPLACE_MEDIA_STREAM_OPTION=pjsip +PJSIP_REPLACE_MEDIA_STREAM_DIR=${PJPROJECT_DIR} + +PBX_PJSIP_REPLACE_MEDIA_STREAM=0 + + + + + + + PORTAUDIO_DESCRIP="PortAudio" PORTAUDIO_OPTION="portaudio" PBX_PORTAUDIO=0 @@ -23738,6 +23754,52 @@ fi + if test "x${PBX_PJSIP_REPLACE_MEDIA_STREAM}" != "x1" -a "${USE_PJSIP_REPLACE_MEDIA_STREAM}" != "no"; then + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for " >&5 +$as_echo_n "checking for ... " >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE\" compiles using pjmedia.h" >&5 +$as_echo_n "checking if \"pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE\" compiles using pjmedia.h... " >&6; } + fi + saved_cppflags="${CPPFLAGS}" + if test "x${PJSIP_REPLACE_MEDIA_STREAM_DIR}" != "x"; then + PJSIP_REPLACE_MEDIA_STREAM_INCLUDE="-I${PJSIP_REPLACE_MEDIA_STREAM_DIR}/include" + fi + CPPFLAGS="${CPPFLAGS} ${PJSIP_REPLACE_MEDIA_STREAM_INCLUDE}" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include <pjmedia.h> +int +main () +{ + pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJSIP_REPLACE_MEDIA_STREAM=1 + +$as_echo "#define HAVE_PJSIP_REPLACE_MEDIA_STREAM 1" >>confdefs.h + + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="${saved_cppflags}" + 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 918c7970bc..ae5ddea092 100644 --- a/configure.ac +++ b/configure.ac @@ -434,6 +434,7 @@ AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres]) 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([PORTAUDIO], [PortAudio], [portaudio]) AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri]) AST_EXT_LIB_SETUP_OPTIONAL([PRI_L2_PERSISTENCE], [ISDN Layer 2 persistence option], [PRI], [pri]) @@ -2018,6 +2019,8 @@ AST_PKG_CONFIG_CHECK([PJPROJECT], [libpjproject]) AST_EXT_LIB_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip], [pjsip_tsx_create_uac2], [pjsip.h]) +AST_C_COMPILE_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [pjmedia_mod_offer_flag flag = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE], [pjmedia.h]) + 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 3f9eb55dc9..71f213518a 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -569,6 +569,9 @@ /* Define if your system has the PJPROJECT libraries. */ #undef HAVE_PJPROJECT +/* Define if your system has the PJSIP_REPLACE_MEDIA_STREAM headers. */ +#undef HAVE_PJSIP_REPLACE_MEDIA_STREAM + /* Define to 1 if PJPROJECT has the PJSIP Transaction Group Lock Support feature. */ #undef HAVE_PJ_TRANSACTION_GRP_LOCK diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 7ffc88961e..cc387d1245 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -1222,7 +1222,7 @@ struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint pjsip_dlg_terminate(dlg); return NULL; } -#ifdef PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE +#if defined(HAVE_PJSIP_REPLACE_MEDIA_STREAM) || defined(PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE) inv_session->sdp_neg_flags = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE; #endif @@ -1371,7 +1371,8 @@ static pjsip_inv_session *pre_session_setup(pjsip_rx_data *rdata, const struct a pjsip_dlg_terminate(dlg); return NULL; } -#ifdef PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE + +#if defined(HAVE_PJSIP_REPLACE_MEDIA_STREAM) || defined(PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE) inv_session->sdp_neg_flags = PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE; #endif if (pjsip_dlg_add_usage(dlg, &session_module, NULL) != PJ_SUCCESS) { -- GitLab