diff options
-rw-r--r-- | CHANGES | 7 | ||||
-rw-r--r-- | apps/app_voicemail.c | 1 | ||||
-rw-r--r-- | build_tools/menuselect-deps.in | 1 | ||||
-rw-r--r-- | channels/chan_alsa.c | 4 | ||||
-rw-r--r-- | configs/samples/codecs.conf.sample | 9 | ||||
-rwxr-xr-x | configure | 405 | ||||
-rw-r--r-- | configure.ac | 18 | ||||
-rwxr-xr-x | contrib/scripts/install_prereq | 14 | ||||
-rw-r--r-- | formats/format_ogg_vorbis.c | 1 | ||||
-rw-r--r-- | include/asterisk/autoconfig.h.in | 3 | ||||
-rw-r--r-- | include/asterisk/options.h | 3 | ||||
-rw-r--r-- | include/asterisk/stringfields.h | 44 | ||||
-rw-r--r-- | main/Makefile | 2 | ||||
-rw-r--r-- | main/asterisk.c | 54 | ||||
-rw-r--r-- | main/bridge.c | 102 | ||||
-rw-r--r-- | main/channel.c | 10 | ||||
-rw-r--r-- | main/config.c | 21 | ||||
-rw-r--r-- | main/config_options.c | 79 | ||||
-rw-r--r-- | main/manager.c | 46 | ||||
-rw-r--r-- | main/named_acl.c | 22 | ||||
-rw-r--r-- | main/plc.c | 9 | ||||
-rw-r--r-- | main/sounds.c | 32 | ||||
-rw-r--r-- | main/stringfields.c | 34 | ||||
-rw-r--r-- | main/taskprocessor.c | 17 | ||||
-rw-r--r-- | main/test.c | 68 | ||||
-rw-r--r-- | main/translate.c | 18 | ||||
-rw-r--r-- | res/res_odbc.c | 1 |
27 files changed, 547 insertions, 478 deletions
@@ -101,6 +101,13 @@ Core: --- Functionality changes from Asterisk 15.3.0 to Asterisk 15.4.0 ------------ ------------------------------------------------------------------------------ +Core +------------------ + * A new configuration option "genericplc_on_equal_codecs" was added to the + "plc" section of codecs.conf to allow generic packet loss concealment even + if no transcoding was originally needed. Transcoding via SLIN is forced + in this case. + res_pjproject ------------------ * Added the "cache_pools" option to pjproject.conf. Disabling the option diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 1ab1169d5..c4df4dcbb 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -63,7 +63,6 @@ </member> <member name="ODBC_STORAGE" displayname="Storage of Voicemail using ODBC"> <depend>generic_odbc</depend> - <depend>ltdl</depend> <conflict>IMAP_STORAGE</conflict> <conflict>FILE_STORAGE</conflict> <defaultenabled>no</defaultenabled> diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in index afea01f59..e62c183b7 100644 --- a/build_tools/menuselect-deps.in +++ b/build_tools/menuselect-deps.in @@ -34,7 +34,6 @@ LIBEDIT=@PBX_LIBEDIT@ LIBXML2=@PBX_LIBXML2@ XMLSTARLET=@PBX_XMLSTARLET@ BASH=@PBX_BASH@ -LTDL=@PBX_LTDL@ LUA=@PBX_LUA@ MISDN=@PBX_MISDN@ MYSQLCLIENT=@PBX_MYSQLCLIENT@ diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index ed7d5cfe3..a5dead1a2 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -39,6 +39,10 @@ #include "asterisk.h" +#include <errno.h> +#ifndef ESTRPIPE +#define ESTRPIPE EPIPE +#endif #include <fcntl.h> #include <sys/ioctl.h> #include <sys/time.h> diff --git a/configs/samples/codecs.conf.sample b/configs/samples/codecs.conf.sample index 8457fb5ac..8c9ce6631 100644 --- a/configs/samples/codecs.conf.sample +++ b/configs/samples/codecs.conf.sample @@ -64,8 +64,15 @@ experimental_rtcp_feedback => false [plc] ; for all codecs which do not support native PLC ; this determines whether to perform generic PLC -; there is a minor performance penalty for this +; there is a minor performance penalty for this. +; By default plc is applied only when the 2 codecs +; in a channel are different. genericplc => true +; Apply generic plc to channels even if the 2 codecs +; are the same. This forces transcoding via slin so +; the performance impact should be considered. +; Ignored if genericplc is not also enabled. +genericplc_on_equal_codecs => false ; Generate custom formats for formats requiring attributes. ; After defining the custom format, the name used in defining @@ -1046,10 +1046,6 @@ PBX_LUA LUA_DIR LUA_INCLUDE LUA_LIB -PBX_LTDL -LTDL_DIR -LTDL_INCLUDE -LTDL_LIB PBX_LIBXSLT_CLEANUP LIBXSLT_CLEANUP_DIR LIBXSLT_CLEANUP_INCLUDE @@ -1408,7 +1404,6 @@ with_libcurl with_libedit with_libxml2 with_libxslt -with_ltdl with_lua with_misdn with_mysqlclient @@ -2165,7 +2160,6 @@ Optional Packages: --with-libedit=PATH use NetBSD Editline library files in PATH --with-libxml2=PATH use LibXML2 files in PATH --with-libxslt=PATH use LibXSLT files in PATH - --with-ltdl=PATH use libtool files in PATH --with-lua=PATH use Lua files in PATH --with-misdn=PATH use mISDN user files in PATH --with-mysqlclient=PATH use MySQL client files in PATH @@ -6826,8 +6820,10 @@ $as_echo "no" >&6; } fi -# Extract the first word of "python", so it can be a program name with args. -set dummy python; ac_word=$2 +for ac_prog in python2 python2.7 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON+:} false; then : @@ -6853,7 +6849,6 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON=":" ;; esac fi @@ -6867,6 +6862,10 @@ $as_echo "no" >&6; } fi + test -n "$PYTHON" && break +done +test -n "$PYTHON" || PYTHON=":" + # Extract the first word of "find", so it can be a program name with args. set dummy find; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -10806,38 +10805,6 @@ PBX_LIBXSLT_CLEANUP=0 - LTDL_DESCRIP="libtool" - LTDL_OPTION="ltdl" - PBX_LTDL=0 - -# Check whether --with-ltdl was given. -if test "${with_ltdl+set}" = set; then : - withval=$with_ltdl; - case ${withval} in - n|no) - USE_LTDL=no - # -1 is a magic value used by menuselect to know that the package - # was disabled, other than 'not found' - PBX_LTDL=-1 - ;; - y|ye|yes) - ac_mandatory_list="${ac_mandatory_list} LTDL" - ;; - *) - LTDL_DIR="${withval}" - ac_mandatory_list="${ac_mandatory_list} LTDL" - ;; - esac - -fi - - - - - - - - LUA_DESCRIP="Lua" LUA_OPTION="lua" PBX_LUA=0 @@ -19641,13 +19608,13 @@ if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then ast_ext_lib_check_save_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} " - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_spcm_init in -lasound" >&5 -$as_echo_n "checking for snd_spcm_init in -lasound... " >&6; } -if ${ac_cv_lib_asound_snd_spcm_init+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_pcm_open in -lasound" >&5 +$as_echo_n "checking for snd_pcm_open in -lasound... " >&6; } +if ${ac_cv_lib_asound_snd_pcm_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lasound ${pbxlibdir} -lm -ldl $LIBS" +LIBS="-lasound ${pbxlibdir} $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19657,27 +19624,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char snd_spcm_init (); +char snd_pcm_open (); int main () { -return snd_spcm_init (); +return snd_pcm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_asound_snd_spcm_init=yes + ac_cv_lib_asound_snd_pcm_open=yes else - ac_cv_lib_asound_snd_spcm_init=no + ac_cv_lib_asound_snd_pcm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_spcm_init" >&5 -$as_echo "$ac_cv_lib_asound_snd_spcm_init" >&6; } -if test "x$ac_cv_lib_asound_snd_spcm_init" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_pcm_open" >&5 +$as_echo "$ac_cv_lib_asound_snd_pcm_open" >&6; } +if test "x$ac_cv_lib_asound_snd_pcm_open" = xyes; then : AST_ALSA_FOUND=yes else AST_ALSA_FOUND=no @@ -19688,7 +19655,7 @@ fi # now check for the header. if test "${AST_ALSA_FOUND}" = "yes"; then - ALSA_LIB="${pbxlibdir} -lasound -lm -ldl" + ALSA_LIB="${pbxlibdir} -lasound " # if --with-ALSA=DIR has been specified, use it. if test "x${ALSA_DIR}" != "x"; then ALSA_INCLUDE="-I${ALSA_DIR}/include" @@ -22478,104 +22445,6 @@ fi done -# Needed by unixodbc - -if test "x${PBX_LTDL}" != "x1" -a "${USE_LTDL}" != "no"; then - pbxlibdir="" - # if --with-LTDL=DIR has been specified, use it. - if test "x${LTDL_DIR}" != "x"; then - if test -d ${LTDL_DIR}/lib; then - pbxlibdir="-L${LTDL_DIR}/lib" - else - pbxlibdir="-L${LTDL_DIR}" - fi - fi - - ast_ext_lib_check_save_CFLAGS="${CFLAGS}" - CFLAGS="${CFLAGS} " - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lt_dlinit in -lltdl" >&5 -$as_echo_n "checking for lt_dlinit in -lltdl... " >&6; } -if ${ac_cv_lib_ltdl_lt_dlinit+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lltdl ${pbxlibdir} $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 lt_dlinit (); -int -main () -{ -return lt_dlinit (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ltdl_lt_dlinit=yes -else - ac_cv_lib_ltdl_lt_dlinit=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ltdl_lt_dlinit" >&5 -$as_echo "$ac_cv_lib_ltdl_lt_dlinit" >&6; } -if test "x$ac_cv_lib_ltdl_lt_dlinit" = xyes; then : - AST_LTDL_FOUND=yes -else - AST_LTDL_FOUND=no -fi - - CFLAGS="${ast_ext_lib_check_save_CFLAGS}" - - - # now check for the header. - if test "${AST_LTDL_FOUND}" = "yes"; then - LTDL_LIB="${pbxlibdir} -lltdl " - # if --with-LTDL=DIR has been specified, use it. - if test "x${LTDL_DIR}" != "x"; then - LTDL_INCLUDE="-I${LTDL_DIR}/include" - fi - LTDL_INCLUDE="${LTDL_INCLUDE} " - - # check for the header - ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" - CPPFLAGS="${CPPFLAGS} ${LTDL_INCLUDE}" - ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default" -if test "x$ac_cv_header_ltdl_h" = xyes; then : - LTDL_HEADER_FOUND=1 -else - LTDL_HEADER_FOUND=0 -fi - - - CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" - - if test "x${LTDL_HEADER_FOUND}" = "x0" ; then - LTDL_LIB="" - LTDL_INCLUDE="" - else - - PBX_LTDL=1 - cat >>confdefs.h <<_ACEOF -#define HAVE_LTDL 1 -_ACEOF - - fi - fi -fi - - - if test "x${PBX_LDAP}" != "x1" -a "${USE_LDAP}" != "no"; then pbxlibdir="" @@ -24055,9 +23924,9 @@ if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then ast_ext_lib_check_save_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} " - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ogg_sync_init in -logg" >&5 -$as_echo_n "checking for ogg_sync_init in -logg... " >&6; } -if ${ac_cv_lib_ogg_ogg_sync_init+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ogg_stream_init in -logg" >&5 +$as_echo_n "checking for ogg_stream_init in -logg... " >&6; } +if ${ac_cv_lib_ogg_ogg_stream_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -24071,27 +23940,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char ogg_sync_init (); +char ogg_stream_init (); int main () { -return ogg_sync_init (); +return ogg_stream_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ogg_ogg_sync_init=yes + ac_cv_lib_ogg_ogg_stream_init=yes else - ac_cv_lib_ogg_ogg_sync_init=no + ac_cv_lib_ogg_ogg_stream_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ogg_ogg_sync_init" >&5 -$as_echo "$ac_cv_lib_ogg_ogg_sync_init" >&6; } -if test "x$ac_cv_lib_ogg_ogg_sync_init" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ogg_ogg_stream_init" >&5 +$as_echo "$ac_cv_lib_ogg_ogg_stream_init" >&6; } +if test "x$ac_cv_lib_ogg_ogg_stream_init" = xyes; then : AST_OGG_FOUND=yes else AST_OGG_FOUND=no @@ -24109,8 +23978,18 @@ fi fi OGG_INCLUDE="${OGG_INCLUDE} " - # no header, assume found - OGG_HEADER_FOUND="1" + # check for the header + ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${OGG_INCLUDE}" + ac_fn_c_check_header_mongrel "$LINENO" "ogg/ogg.h" "ac_cv_header_ogg_ogg_h" "$ac_includes_default" +if test "x$ac_cv_header_ogg_ogg_h" = xyes; then : + OGG_HEADER_FOUND=1 +else + OGG_HEADER_FOUND=0 +fi + + + CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" if test "x${OGG_HEADER_FOUND}" = "x0" ; then OGG_LIB="" @@ -25167,7 +25046,7 @@ if ${ac_cv_lib_pjsip_pjsip_dlg_create_uas_and_inc_lock+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS" +LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25208,7 +25087,7 @@ fi # now check for the header. if test "${AST_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_FOUND}" = "yes"; then - PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS" + PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB" # if --with-PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=DIR has been specified, use it. if test "x${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}" != "x"; then PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE="-I${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}/include" @@ -25599,7 +25478,7 @@ if ${ac_cv_lib_pjsip_pjsip_endpt_set_ext_resolver+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS" +LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -25640,7 +25519,7 @@ fi # now check for the header. if test "${AST_PJSIP_EXTERNAL_RESOLVER_FOUND}" = "yes"; then - PJSIP_EXTERNAL_RESOLVER_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS" + PJSIP_EXTERNAL_RESOLVER_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB" # if --with-PJSIP_EXTERNAL_RESOLVER=DIR has been specified, use it. if test "x${PJSIP_EXTERNAL_RESOLVER_DIR}" != "x"; then PJSIP_EXTERNAL_RESOLVER_INCLUDE="-I${PJSIP_EXTERNAL_RESOLVER_DIR}/include" @@ -26219,12 +26098,188 @@ if test -n "$PYTHONDEV_CFLAGS"; then pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 - ($PKG_CONFIG --exists --print-errors "python") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python >= 3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python >= 3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python >= 3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHONDEV_LIBS"; then + pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python >= 3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python >= 3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python >= 3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python >= 3" 2>&1` + else + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python >= 3" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHONDEV_PKG_ERRORS" >&5 + + + PBX_PYTHONDEV=0 + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + PBX_PYTHONDEV=0 + + +else + PYTHONDEV_CFLAGS=$pkg_cv_PYTHONDEV_CFLAGS + PYTHONDEV_LIBS=$pkg_cv_PYTHONDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + PBX_PYTHONDEV=1 + PYTHONDEV_INCLUDE="$PYTHONDEV_CFLAGS" + PYTHONDEV_LIB="$PYTHONDEV_LIBS" + +$as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h + + +fi + fi + + + if test "x${PBX_PYTHONDEV}" != "x1" -a "${USE_PYTHONDEV}" != "no"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHONDEV" >&5 +$as_echo_n "checking for PYTHONDEV... " >&6; } + +if test -n "$PYTHONDEV_CFLAGS"; then + pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHONDEV_LIBS"; then + pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python3") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python3" 2>&1` + else + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python3" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHONDEV_PKG_ERRORS" >&5 + + + PBX_PYTHONDEV=0 + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + PBX_PYTHONDEV=0 + + +else + PYTHONDEV_CFLAGS=$pkg_cv_PYTHONDEV_CFLAGS + PYTHONDEV_LIBS=$pkg_cv_PYTHONDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + PBX_PYTHONDEV=1 + PYTHONDEV_INCLUDE="$PYTHONDEV_CFLAGS" + PYTHONDEV_LIB="$PYTHONDEV_LIBS" + +$as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h + + +fi + fi + + + if test "x${PBX_PYTHONDEV}" != "x1" -a "${USE_PYTHONDEV}" != "no"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHONDEV" >&5 +$as_echo_n "checking for PYTHONDEV... " >&6; } + +if test -n "$PYTHONDEV_CFLAGS"; then + pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-3.6\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-3.6") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python" 2>/dev/null` + pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python-3.6" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26236,12 +26291,12 @@ if test -n "$PYTHONDEV_LIBS"; then pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python\""; } >&5 - ($PKG_CONFIG --exists --print-errors "python") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-3.6\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-3.6") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python" 2>/dev/null` + pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python-3.6" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26262,9 +26317,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python" 2>&1` + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-3.6" 2>&1` else - PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python" 2>&1` + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-3.6" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PYTHONDEV_PKG_ERRORS" >&5 diff --git a/configure.ac b/configure.ac index 3151f8995..7dc3b76a3 100644 --- a/configure.ac +++ b/configure.ac @@ -261,7 +261,7 @@ AC_PATH_PROG([CAT], [cat], :) AC_PATH_PROG([CUT], [cut], :) AC_PATH_PROG([FLEX], [flex], :) AC_PATH_PROG([GREP], [grep], :) -AC_PATH_PROG([PYTHON], [python], :) +AC_PATH_PROGS([PYTHON], [python2 python2.7], :) AC_PATH_PROG([FIND], [find], :) AC_PATH_PROG([COMPRESS], [compress], :) AC_PATH_PROG([BASENAME], [basename], :) @@ -488,7 +488,6 @@ AST_EXT_LIB_SETUP_OPTIONAL([LIBEDIT_IS_UNICODE], [Libedit compiled for unicode], AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2]) AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt]) AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt]) -AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl]) AST_EXT_LIB_SETUP([LUA], [Lua], [lua]) AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn]) AST_EXT_LIB_SETUP([MYSQLCLIENT], [MySQL client], [mysqlclient]) @@ -1487,7 +1486,7 @@ PKG_PROG_PKG_CONFIG() # do the package library checks now -AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl]) +AST_EXT_LIB_CHECK([ALSA], [asound], [snd_pcm_open], [alsa/asoundlib.h]) AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_openr], [bfd.h]) # Fedora/RedHat/CentOS require extra libraries @@ -2154,9 +2153,6 @@ AST_EXT_LIB_CHECK([KQUEUE], [c], [kqueue], [sys/event.h]) # 64-bit version of kevent (from kqueue) on OS X AC_CHECK_FUNCS([kevent64]) -# Needed by unixodbc -AST_EXT_LIB_CHECK([LTDL], [ltdl], [lt_dlinit], [ltdl.h], []) - AST_EXT_LIB_CHECK([LDAP], [ldap], [ldap_initialize], [ldap.h]) AST_EXT_LIB_CHECK([MISDN], [mISDN], [mISDN_open], [mISDNuser/mISDNlib.h]) @@ -2202,7 +2198,7 @@ AST_C_DECLARE_CHECK([UNBOUND_CONST_PARAMS], [UNBOUND_VERSION_MAJOR], [unbound.h] AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], []) -AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], []) +AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_stream_init], [ogg/ogg.h]) # Non-glibc platforms require libexecinfo for backtrace support AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h]) @@ -2281,7 +2277,7 @@ if test "$USE_PJPROJECT" != "no" ; then if test "$PJPROJECT_BUNDLED" = "no" ; then AST_PKG_CONFIG_CHECK([PJPROJECT], [libpjproject]) - AST_EXT_LIB_CHECK([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [pjsip], [pjsip_dlg_create_uas_and_inc_lock], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS]) + AST_EXT_LIB_CHECK([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [pjsip], [pjsip_dlg_create_uas_and_inc_lock], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS]) AST_EXT_LIB_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip], [pjsip_tsx_create_uac2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS]) saved_cppflags="${CPPFLAGS}" @@ -2294,7 +2290,7 @@ if test "$USE_PJPROJECT" != "no" ; then AST_EXT_LIB_CHECK([PJSIP_GET_DEST_INFO], [pjsip], [pjsip_get_dest_info], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS]) AST_EXT_LIB_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj], [pj_ssl_cert_load_from_files2], [pjlib.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS]) - AST_EXT_LIB_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip], [pjsip_endpt_set_ext_resolver], [pjsip.h], [$PJPROJECT_LIBS], [$PJPROJECT_CFLAGS]) + AST_EXT_LIB_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip], [pjsip_endpt_set_ext_resolver], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS]) saved_cppflags="${CPPFLAGS}" saved_libs="${LIBS}" @@ -2314,7 +2310,9 @@ fi AC_SUBST([PYTHONDEV_LIB]) AC_SUBST([PYTHONDEV_INCLUDE]) -AST_PKG_CONFIG_CHECK([PYTHONDEV], [python]) +AST_PKG_CONFIG_CHECK([PYTHONDEV], [python >= 3]) +AST_PKG_CONFIG_CHECK([PYTHONDEV], [python3]) +AST_PKG_CONFIG_CHECK([PYTHONDEV], [python-3.6]) AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h]) diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq index e588d5cd1..887c5e21d 100755 --- a/contrib/scripts/install_prereq +++ b/contrib/scripts/install_prereq @@ -24,7 +24,7 @@ PACKAGES_DEBIAN="build-essential pkg-config" PACKAGES_DEBIAN="$PACKAGES_DEBIAN libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev" # Asterisk: for addons: PACKAGES_DEBIAN="$PACKAGES_DEBIAN libspeex-dev libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev portaudio19-dev libcurl4-openssl-dev xmlstarlet bison flex" -PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libltdl-dev libneon27-dev libgmime-2.6-dev liblua5.2-dev liburiparser-dev libxslt1-dev libssl-dev" +PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libneon27-dev libgmime-2.6-dev liblua5.2-dev liburiparser-dev libxslt1-dev libssl-dev" PACKAGES_DEBIAN="$PACKAGES_DEBIAN libvpb-dev libmysqlclient-dev libbluetooth-dev libradcli-dev freetds-dev libosptk-dev libjack-jackd2-dev bash" PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libcorosync-common-dev libcpg-dev libcfg-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev" PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample1-dev libc-client2007e-dev binutils-dev libsrtp0-dev libsrtp2-dev libgsm1-dev doxygen graphviz zlib1g-dev libldap2-dev" @@ -40,7 +40,7 @@ PACKAGES_RH="make gcc gcc-c++ pkgconfig" PACKAGES_RH="$PACKAGES_RH libedit-devel jansson-devel libuuid-devel sqlite-devel libxml2-devel" # Asterisk: for addons: PACKAGES_RH="$PACKAGES_RH speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-lib-devel portaudio-devel libcurl-devel xmlstarlet bison flex" -PACKAGES_RH="$PACKAGES_RH postgresql-devel unixODBC-devel libtool-ltdl-devel neon-devel gmime-devel lua-devel uriparser-devel libxslt-devel openssl-devel" +PACKAGES_RH="$PACKAGES_RH postgresql-devel unixODBC-devel neon-devel gmime-devel lua-devel uriparser-devel libxslt-devel openssl-devel" PACKAGES_RH="$PACKAGES_RH mysql-devel bluez-libs-devel radcli-devel freetds-devel jack-audio-connection-kit-devel bash" PACKAGES_RH="$PACKAGES_RH net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libical-devel spandsp-devel" PACKAGES_RH="$PACKAGES_RH libresample-devel uw-imap-devel binutils-devel libsrtp-devel gsm-devel doxygen graphviz zlib-devel openldap-devel hoard" @@ -56,7 +56,7 @@ PACKAGES_SUSE="make gcc gcc-c++ pkg-config" PACKAGES_SUSE="$PACKAGES_SUSE libedit-devel libjansson-devel libuuid-devel sqlite3-devel libxml2-devel" # Asterisk: for addons: PACKAGES_SUSE="$PACKAGES_SUSE speex-devel speexdsp-devel libogg-devel libvorbis-devel alsa-devel portaudio-devel libcurl-devel xmlstarlet bison flex" -PACKAGES_SUSE="$PACKAGES_SUSE postgresql-devel unixODBC-devel libtool libneon-devel gmime-devel lua-devel liburiparser-devel libxslt-devel libopenssl-devel" +PACKAGES_SUSE="$PACKAGES_SUSE postgresql-devel unixODBC-devel libneon-devel gmime-devel lua-devel liburiparser-devel libxslt-devel libopenssl-devel" PACKAGES_SUSE="$PACKAGES_SUSE libmysqlclient-devel bluez-devel freeradius-client-devel freetds-devel bash" PACKAGES_SUSE="$PACKAGES_SUSE net-snmp-devel iksemel-devel libcorosync-devel newt-devel popt-devel libical-devel spandsp-devel" PACKAGES_SUSE="$PACKAGES_SUSE imap-devel libsrtp2-devel libgsm-devel doxygen graphviz zlib-devel openldap2-devel" @@ -72,7 +72,7 @@ PACKAGES_ARCH="make gcc pkg-config" PACKAGES_ARCH="$PACKAGES_ARCH libedit jansson libutil-linux libxml2 sqlite" # Asterisk: for addons: PACKAGES_ARCH="$PACKAGES_ARCH speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex" -PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc libtool neon gmime lua uriparser libxslt openssl" +PACKAGES_ARCH="$PACKAGES_ARCH postgresql-libs unixodbc neon gmime lua uriparser libxslt openssl" PACKAGES_ARCH="$PACKAGES_ARCH libmariadbclient bluez-libs radcli freetds bash" PACKAGES_ARCH="$PACKAGES_ARCH net-snmp libnewt popt libical spandsp" PACKAGES_ARCH="$PACKAGES_ARCH c-client binutils libsrtp gsm doxygen graphviz zlib libldap" @@ -88,7 +88,7 @@ PACKAGES_NBSD="gmake pkg-config" PACKAGES_NBSD="$PACKAGES_NBSD editline jansson sqlite3 libuuid libxml2" # Asterisk: for addons: PACKAGES_NBSD="$PACKAGES_NBSD speex speexdsp libogg libvorbis alsa-lib portaudio-devel curl bison flex" -PACKAGES_NBSD="$PACKAGES_NBSD postgresql10-client unixodbc libltdl neon gmime lua52 uriparser libxslt openssl" +PACKAGES_NBSD="$PACKAGES_NBSD postgresql10-client unixodbc neon gmime lua52 uriparser libxslt openssl" PACKAGES_NBSD="$PACKAGES_NBSD mysql-client radiusclient-ng freetds bash" PACKAGES_NBSD="$PACKAGES_NBSD net-snmp iksemel popt libical spandsp" PACKAGES_NBSD="$PACKAGES_NBSD imap-uw srtp gsm doxygen graphviz libzip openldap-client" @@ -104,7 +104,7 @@ PACKAGES_OBSD="gmake" PACKAGES_OBSD="$PACKAGES_OBSD libxml sqlite3 e2fsprogs jansson" # Asterisk: for addons: PACKAGES_OBSD="$PACKAGES_OBSD speex speexdsp libogg libvorbis portaudio-svn curl xmlstarlet bison" -PACKAGES_OBSD="$PACKAGES_OBSD postgresql-client iodbc libltdl neon gmime lua%5.2 uriparser libxslt" +PACKAGES_OBSD="$PACKAGES_OBSD postgresql-client iodbc neon gmime lua%5.2 uriparser libxslt" PACKAGES_OBSD="$PACKAGES_OBSD mariadb-client radcli freetds" PACKAGES_OBSD="$PACKAGES_OBSD net-snmp iksemel popt libical spandsp" PACKAGES_OBSD="$PACKAGES_OBSD c-client libsrtp gsm doxygen graphviz" @@ -120,7 +120,7 @@ PACKAGES_FBSD="gmake pkgconf" PACKAGES_FBSD="$PACKAGES_FBSD libedit jansson e2fsprogs-libuuid sqlite3 libxml2" # Asterisk: for addons: PACKAGES_FBSD="$PACKAGES_FBSD speex speexdsp libogg libvorbis alsa-lib portaudio curl xmlstarlet bison flex" -PACKAGES_FBSD="$PACKAGES_FBSD postgresql10-client unixODBC libltdl neon gmime26 lua52 uriparser libxslt openssl" +PACKAGES_FBSD="$PACKAGES_FBSD postgresql10-client unixODBC neon gmime26 lua52 uriparser libxslt openssl" PACKAGES_FBSD="$PACKAGES_FBSD mysql57-client radcli freetds" PACKAGES_FBSD="$PACKAGES_FBSD net-snmp iksemel corosync newt popt libical spandsp" PACKAGES_FBSD="$PACKAGES_FBSD cclient libbfd libsrtp gsm libilbc doxygen graphviz libzip openldap-client libhoard" diff --git a/formats/format_ogg_vorbis.c b/formats/format_ogg_vorbis.c index be5bb2bf9..ba86842f7 100644 --- a/formats/format_ogg_vorbis.c +++ b/formats/format_ogg_vorbis.c @@ -33,6 +33,7 @@ #include "asterisk.h" +#include <ogg/ogg.h> #include <vorbis/codec.h> #include <vorbis/vorbisenc.h> #include <vorbis/vorbisfile.h> diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 6d747ae5a..5e9ba6011 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -483,9 +483,6 @@ than `double'. */ #undef HAVE_LONG_DOUBLE_WIDER -/* Define to 1 if you have the libtool library. */ -#undef HAVE_LTDL - /* Define to 1 if you have the Lua library. */ #undef HAVE_LUA diff --git a/include/asterisk/options.h b/include/asterisk/options.h index 74103e78b..6c4e55295 100644 --- a/include/asterisk/options.h +++ b/include/asterisk/options.h @@ -92,6 +92,8 @@ enum ast_option_flags { AST_OPT_FLAG_LOCK_CONFIG_DIR = (1 << 29), /*! Generic PLC */ AST_OPT_FLAG_GENERIC_PLC = (1 << 30), + /*! Generic PLC onm equal codecs */ + AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS = (1 << 31), }; /*! These are the options that set by default when Asterisk starts */ @@ -126,6 +128,7 @@ enum ast_option_flags { #define ast_opt_lock_confdir ast_test_flag(&ast_options, AST_OPT_FLAG_LOCK_CONFIG_DIR) #define ast_opt_generic_plc ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) #define ast_opt_ref_debug ast_test_flag(&ast_options, AST_OPT_FLAG_REF_DEBUG) +#define ast_opt_generic_plc_on_equal_codecs ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS) /*! Maximum log level defined by PJPROJECT. */ #define MAX_PJ_LOG_MAX_LEVEL 6 diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h index e1ff2fc1d..ce978901b 100644 --- a/include/asterisk/stringfields.h +++ b/include/asterisk/stringfields.h @@ -228,11 +228,6 @@ struct ast_string_field_mgr { ast_string_field last_alloc; /*!< the last field allocated */ struct ast_string_field_pool *embedded_pool; /*!< pointer to the embedded pool, if any */ struct ast_string_field_vector string_fields; /*!< field vector for compare and copy */ - /* v-- MALLOC_DEBUG information */ - const char *owner_file; /*!< filename of owner */ - const char *owner_func; /*!< function name of owner */ - int owner_line; /*!< line number of owner */ - /* ^-- MALLOC_DEBUG information */ }; /*! @@ -266,7 +261,8 @@ int __ast_string_field_ptr_grow(struct ast_string_field_mgr *mgr, an additional pool will be allocated. */ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr, - struct ast_string_field_pool **pool_head, size_t needed); + struct ast_string_field_pool **pool_head, size_t needed, + const char *file, int lineno, const char *func); /*! \internal @@ -277,9 +273,9 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr \param format printf-style format string \return nothing */ -void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr, - struct ast_string_field_pool **pool_head, - ast_string_field *ptr, const char *format, ...) __attribute__((format(printf, 4, 5))); +void __ast_string_field_ptr_build(const char *file, int lineno, const char *func, + struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, + ast_string_field *ptr, const char *format, ...) __attribute__((format(printf, 7, 8))); /*! \internal @@ -292,8 +288,9 @@ void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr, \return nothing */ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, - struct ast_string_field_pool **pool_head, - ast_string_field *ptr, const char *format, va_list ap) __attribute__((format(printf, 4, 0))); + struct ast_string_field_pool **pool_head, + ast_string_field *ptr, const char *format, va_list ap, + const char *file, int lineno, const char *func) __attribute__((format(printf, 4, 0))); /*! \brief Declare a string field @@ -479,7 +476,7 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, __res__; \ }) -#define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \ +#define __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, file, lineno, func) \ ({ \ int __res__ = 0; \ const char *__d__ = (data); \ @@ -491,7 +488,7 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, *__p__ = __ast_string_field_empty; \ } else if ((__dlen__ <= AST_STRING_FIELD_ALLOCATION(*__p__)) || \ (!__ast_string_field_ptr_grow(&field_mgr, &field_mgr_pool, __dlen__, __p__)) || \ - (target = __ast_string_field_alloc_space(&field_mgr, &field_mgr_pool, __dlen__))) { \ + (target = __ast_string_field_alloc_space(&field_mgr, &field_mgr_pool, __dlen__, file, lineno, func))) { \ if (target != *__p__) { \ __ast_string_field_release_active(field_mgr_pool, *__p__); \ *__p__ = target; \ @@ -503,6 +500,9 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, __res__; \ }) +#define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \ + __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, __FILE__, __LINE__, __PRETTY_FUNCTION__) + /*! \brief Set a field to a simple string value \param x Pointer to a structure containing fields @@ -532,7 +532,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, ({ \ int __res__ = -1; \ if (((void *)(x)) != NULL) { \ - __ast_string_field_ptr_build(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \ + __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ + &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \ __res__ = 0; \ } \ __res__; \ @@ -550,7 +551,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, ({ \ int __res__ = -1; \ if (((void *)(x)) != NULL) { \ - __ast_string_field_ptr_build(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \ + __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ + &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \ __res__ = 0; \ } \ __res__; \ @@ -568,7 +570,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, ({ \ int __res__ = -1; \ if (((void *)(x)) != NULL) { \ - __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \ + __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args, \ + __FILE__, __LINE__, __PRETTY_FUNCTION__); \ __res__ = 0; \ } \ __res__; \ @@ -586,7 +589,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, ({ \ int __res__ = -1; \ if (((void *)(x)) != NULL) { \ - __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \ + __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args, \ + __FILE__, __LINE__, __PRETTY_FUNCTION__); \ __res__ = 0; \ } \ __res__; \ @@ -626,12 +630,14 @@ int __ast_string_fields_cmp(struct ast_string_field_vector *left, struct ast_str if (((void *)(copy)) != NULL && ((void *)(orig)) != NULL) { \ __res__ = __ast_string_fields_copy(((copy)->__field_mgr_pool), \ (struct ast_string_field_mgr *)&((copy)->__field_mgr), \ - (struct ast_string_field_mgr *)&((orig)->__field_mgr)); \ + (struct ast_string_field_mgr *)&((orig)->__field_mgr), \ + __FILE__, __LINE__, __PRETTY_FUNCTION__); \ } \ __res__; \ }) int __ast_string_fields_copy(struct ast_string_field_pool *copy_pool, - struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr); + struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr, + const char *file, int lineno, const char *func); #endif /* _ASTERISK_STRINGFIELDS_H */ diff --git a/main/Makefile b/main/Makefile index cd5c08c02..fb985b9b8 100644 --- a/main/Makefile +++ b/main/Makefile @@ -294,7 +294,7 @@ ASTPJ_LIB:=libasteriskpj.dylib # /lib or /usr/lib $(ASTPJ_LIB): _ASTLDFLAGS+=-dynamiclib -install_name $(ASTLIBDIR)/$(ASTPJ_LIB) $(PJ_LDFLAGS) $(ASTPJ_LIB): _ASTCFLAGS+=-fPIC -DAST_MODULE=\"asteriskpj\" $(PJ_CFLAGS) -DAST_NOT_MODULE -$(ASTPJ_LIB): LIBS+=$(PJPROJECT_LIBS) $(OPENSSL_LIB) $(UUID_LIB) -lm -lpthread $(RT_LIB) +$(ASTPJ_LIB): LIBS+=$(PJPROJECT_LIB) $(OPENSSL_LIB) $(UUID_LIB) -lm -lpthread $(RT_LIB) $(ASTPJ_LIB): SOLINK=$(DYLINK) # Special rules for building a shared library (not a dynamically loadable module) diff --git a/main/asterisk.c b/main/asterisk.c index 2a7e30166..36b1b54a1 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -599,6 +599,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c ast_cli(a->fd, " Transcode via SLIN: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN) ? "Enabled" : "Disabled"); ast_cli(a->fd, " Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled"); ast_cli(a->fd, " Generic PLC: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled"); + ast_cli(a->fd, " Generic PLC on equal codecs: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS) ? "Enabled" : "Disabled"); ast_cli(a->fd, " Min DTMF duration:: %u\n", option_dtmfminduration); #if !defined(LOW_MEMORY) ast_cli(a->fd, " Cache media frames: %s\n", ast_opt_cache_media_frames ? "Enabled" : "Disabled"); @@ -2725,10 +2726,14 @@ static void send_rasterisk_connect_commands(void) } #ifdef HAVE_LIBEDIT_IS_UNICODE -static int ast_el_read_char(EditLine *editline, wchar_t *cp) +#define CHAR_T_LIBEDIT wchar_t +#define CHAR_TO_LIBEDIT(c) btowc(c) #else -static int ast_el_read_char(EditLine *editline, char *cp) +#define CHAR_T_LIBEDIT char +#define CHAR_TO_LIBEDIT(c) c #endif + +static int ast_el_read_char(EditLine *editline, CHAR_T_LIBEDIT *cp) { int num_read = 0; int lastpos = 0; @@ -2749,28 +2754,29 @@ static int ast_el_read_char(EditLine *editline, char *cp) } res = ast_poll(fds, max, -1); if (res < 0) { - if (sig_flags.need_quit || sig_flags.need_quit_handler) + if (sig_flags.need_quit || sig_flags.need_quit_handler) { break; - if (errno == EINTR) + } + if (errno == EINTR) { continue; + } fprintf(stderr, "poll failed: %s\n", strerror(errno)); break; } if (!ast_opt_exec && fds[1].revents) { char c = '\0'; + num_read = read(STDIN_FILENO, &c, 1); if (num_read < 1) { break; - } else { -#ifdef HAVE_LIBEDIT_IS_UNICODE - *cp = btowc(c); -#else - *cp = c; -#endif - return (num_read); } + + *cp = CHAR_TO_LIBEDIT(c); + + return num_read; } + if (fds[0].revents) { res = read(ast_consock, buf, sizeof(buf) - 1); /* if the remote side disappears exit */ @@ -2781,6 +2787,7 @@ static int ast_el_read_char(EditLine *editline, char *cp) } else { int tries; int reconnects_per_second = 20; + fprintf(stderr, "Attempting to reconnect for 30 seconds\n"); for (tries = 0; tries < 30 * reconnects_per_second; tries++) { if (ast_tryconnect()) { @@ -2789,8 +2796,9 @@ static int ast_el_read_char(EditLine *editline, char *cp) WELCOME_MESSAGE; send_rasterisk_connect_commands(); break; - } else - usleep(1000000 / reconnects_per_second); + } + + usleep(1000000 / reconnects_per_second); } if (tries >= 30 * reconnects_per_second) { fprintf(stderr, "Failed to reconnect for 30 seconds. Quitting.\n"); @@ -2811,25 +2819,17 @@ static int ast_el_read_char(EditLine *editline, char *cp) console_print(buf); if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (res >= 2 && buf[res-2] == '\n'))) { -#ifdef HAVE_LIBEDIT_IS_UNICODE - *cp = btowc(CC_REFRESH); -#else - *cp = CC_REFRESH; -#endif - return(1); - } else { - lastpos = 1; + *cp = CHAR_TO_LIBEDIT(CC_REFRESH); + + return 1; } + lastpos = 1; } } -#ifdef HAVE_LIBEDIT_IS_UNICODE - *cp = btowc('\0'); -#else - *cp = '\0'; -#endif + *cp = CHAR_TO_LIBEDIT('\0'); - return (0); + return 0; } static struct ast_str *prompt = NULL; diff --git a/main/bridge.c b/main/bridge.c index 4f79852cb..1109c4b76 100644 --- a/main/bridge.c +++ b/main/bridge.c @@ -5027,46 +5027,29 @@ struct ast_bridge *ast_bridge_find_by_id(const char *bridge_id) return ao2_find(bridges, bridge_id, OBJ_SEARCH_KEY); } -struct bridge_complete { - /*! Nth match to return. */ - int state; - /*! Which match currently on. */ - int which; -}; - -static int complete_bridge_live_search(void *obj, void *arg, void *data, int flags) +static int complete_bridge_live_search(void *obj, void *arg, int flags) { - struct bridge_complete *search = data; + struct ast_bridge *bridge = obj; - if (++search->which > search->state) { - return CMP_MATCH; + if (ast_cli_completion_add(ast_strdup(bridge->uniqueid))) { + return CMP_STOP; } + return 0; } -static char *complete_bridge_live(const char *word, int state) +static char *complete_bridge_live(const char *word) { - char *ret; - struct ast_bridge *bridge; - struct bridge_complete search = { - .state = state, - }; + ao2_callback(bridges, ast_strlen_zero(word) ? 0 : OBJ_PARTIAL_KEY, + complete_bridge_live_search, (char *) word); - bridge = ao2_callback_data(bridges, ast_strlen_zero(word) ? 0 : OBJ_PARTIAL_KEY, - complete_bridge_live_search, (char *) word, &search); - if (!bridge) { - return NULL; - } - ret = ast_strdup(bridge->uniqueid); - ao2_ref(bridge, -1); - return ret; + return NULL; } -static char *complete_bridge_stasis(const char *word, int state) +static char *complete_bridge_stasis(const char *word) { - char *ret = NULL; - int wordlen = strlen(word), which = 0; - RAII_VAR(struct ao2_container *, cached_bridges, NULL, ao2_cleanup); + int wordlen = strlen(word); + struct ao2_container *cached_bridges; struct ao2_iterator iter; struct stasis_message *msg; @@ -5079,15 +5062,17 @@ static char *complete_bridge_stasis(const char *word, int state) for (; (msg = ao2_iterator_next(&iter)); ao2_ref(msg, -1)) { struct ast_bridge_snapshot *snapshot = stasis_message_data(msg); - if (!strncasecmp(word, snapshot->uniqueid, wordlen) && (++which > state)) { - ret = ast_strdup(snapshot->uniqueid); - ao2_ref(msg, -1); - break; + if (!strncasecmp(word, snapshot->uniqueid, wordlen)) { + if (ast_cli_completion_add(ast_strdup(snapshot->uniqueid))) { + ao2_ref(msg, -1); + break; + } } } ao2_iterator_destroy(&iter); + ao2_ref(cached_bridges, -1); - return ret; + return NULL; } static char *handle_bridge_show_all(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) @@ -5168,7 +5153,7 @@ static char *handle_bridge_show_specific(struct ast_cli_entry *e, int cmd, struc return NULL; case CLI_GENERATE: if (a->pos == 2) { - return complete_bridge_stasis(a->word, a->n); + return complete_bridge_stasis(a->word); } return NULL; } @@ -5207,7 +5192,7 @@ static char *handle_bridge_destroy_specific(struct ast_cli_entry *e, int cmd, st return NULL; case CLI_GENERATE: if (a->pos == 2) { - return complete_bridge_live(a->word, a->n); + return complete_bridge_live(a->word); } return NULL; } @@ -5229,11 +5214,10 @@ static char *handle_bridge_destroy_specific(struct ast_cli_entry *e, int cmd, st } #endif -static char *complete_bridge_participant(const char *bridge_name, const char *line, const char *word, int pos, int state) +static char *complete_bridge_participant(const char *bridge_name, const char *word) { struct ast_bridge *bridge; struct ast_bridge_channel *bridge_channel; - int which; int wordlen; bridge = ast_bridge_find_by_id(bridge_name); @@ -5241,19 +5225,17 @@ static char *complete_bridge_participant(const char *bridge_name, const char *li return NULL; } - { - SCOPED_LOCK(bridge_lock, bridge, ast_bridge_lock, ast_bridge_unlock); + wordlen = strlen(word); - which = 0; - wordlen = strlen(word); - AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) { - if (!strncasecmp(ast_channel_name(bridge_channel->chan), word, wordlen) - && ++which > state) { - ao2_ref(bridge, -1); - return ast_strdup(ast_channel_name(bridge_channel->chan)); + ast_bridge_lock(bridge); + AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) { + if (!strncasecmp(ast_channel_name(bridge_channel->chan), word, wordlen)) { + if (ast_cli_completion_add(ast_strdup(ast_channel_name(bridge_channel->chan)))) { + break; } } } + ast_bridge_unlock(bridge); ao2_ref(bridge, -1); @@ -5263,7 +5245,6 @@ static char *complete_bridge_participant(const char *bridge_name, const char *li static char *handle_bridge_kick_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { static const char * const completions[] = { "all", NULL }; - char *complete; struct ast_bridge *bridge; switch (cmd) { @@ -5277,14 +5258,11 @@ static char *handle_bridge_kick_channel(struct ast_cli_entry *e, int cmd, struct return NULL; case CLI_GENERATE: if (a->pos == 2) { - return complete_bridge_live(a->word, a->n); + return complete_bridge_live(a->word); } if (a->pos == 3) { - complete = ast_cli_complete(a->word, completions, a->n); - if (!complete) { - complete = complete_bridge_participant(a->argv[2], a->line, a->word, a->pos, a->n - 1); - } - return complete; + ast_cli_complete(a->word, completions, -1); + return complete_bridge_participant(a->argv[2], a->word); } return NULL; } @@ -5385,24 +5363,22 @@ static char *handle_bridge_technology_show(struct ast_cli_entry *e, int cmd, str #undef FORMAT } -static char *complete_bridge_technology(const char *word, int state) +static char *complete_bridge_technology(const char *word) { struct ast_bridge_technology *cur; - char *res; - int which; int wordlen; - which = 0; wordlen = strlen(word); AST_RWLIST_RDLOCK(&bridge_technologies); AST_RWLIST_TRAVERSE(&bridge_technologies, cur, entry) { - if (!strncasecmp(cur->name, word, wordlen) && ++which > state) { - res = ast_strdup(cur->name); - AST_RWLIST_UNLOCK(&bridge_technologies); - return res; + if (!strncasecmp(cur->name, word, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + break; + } } } AST_RWLIST_UNLOCK(&bridge_technologies); + return NULL; } @@ -5421,7 +5397,7 @@ static char *handle_bridge_technology_suspend(struct ast_cli_entry *e, int cmd, return NULL; case CLI_GENERATE: if (a->pos == 3) { - return complete_bridge_technology(a->word, a->n); + return complete_bridge_technology(a->word); } return NULL; } diff --git a/main/channel.c b/main/channel.c index 34991ff2b..869b29f5e 100644 --- a/main/channel.c +++ b/main/channel.c @@ -6463,11 +6463,15 @@ static int ast_channel_make_compatible_helper(struct ast_channel *from, struct a * to use SLINEAR between channels, but only if there is * no direct conversion available. If generic PLC is * desired, then transcoding via SLINEAR is a requirement + * even if the formats are the same. */ - if (ast_format_cmp(best_dst_fmt, best_src_fmt) == AST_FORMAT_CMP_NOT_EQUAL - && (ast_opt_generic_plc || ast_opt_transcode_via_slin)) { + if (ast_opt_generic_plc_on_equal_codecs + || (ast_format_cmp(best_dst_fmt, best_src_fmt) == AST_FORMAT_CMP_NOT_EQUAL + && (ast_opt_generic_plc || ast_opt_transcode_via_slin))) { + int use_slin = (ast_format_cache_is_slinear(best_src_fmt) - || ast_format_cache_is_slinear(best_dst_fmt)) ? 1 : 0; + || ast_format_cache_is_slinear(best_dst_fmt)) + ? 1 : ast_opt_generic_plc_on_equal_codecs; if (use_slin || ast_translate_path_steps(best_dst_fmt, best_src_fmt) != 1) { int best_sample_rate = (ast_format_get_sample_rate(best_src_fmt) > ast_format_get_sample_rate(best_dst_fmt)) ? diff --git a/main/config.c b/main/config.c index f2c336049..f7f0d7be1 100644 --- a/main/config.c +++ b/main/config.c @@ -3925,8 +3925,8 @@ static char *handle_cli_core_show_config_mappings(struct ast_cli_entry *e, int c static char *handle_cli_config_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct cache_file_mtime *cfmtime; - char *prev = "", *completion_value = NULL; - int wordlen, which = 0; + char *prev = ""; + int wordlen; switch (cmd) { case CLI_INIT: @@ -3944,19 +3944,20 @@ static char *handle_cli_config_reload(struct ast_cli_entry *e, int cmd, struct a AST_LIST_LOCK(&cfmtime_head); AST_LIST_TRAVERSE(&cfmtime_head, cfmtime, list) { - /* Skip duplicates - this only works because the list is sorted by filename */ - if (strcmp(cfmtime->filename, prev) == 0) { + /* Core configs cannot be reloaded */ + if (ast_strlen_zero(cfmtime->who_asked)) { continue; } - /* Core configs cannot be reloaded */ - if (ast_strlen_zero(cfmtime->who_asked)) { + /* Skip duplicates - this only works because the list is sorted by filename */ + if (!strcmp(cfmtime->filename, prev)) { continue; } - if (++which > a->n && strncmp(cfmtime->filename, a->word, wordlen) == 0) { - completion_value = ast_strdup(cfmtime->filename); - break; + if (!strncmp(cfmtime->filename, a->word, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cfmtime->filename))) { + break; + } } /* Otherwise save that we've seen this filename */ @@ -3964,7 +3965,7 @@ static char *handle_cli_config_reload(struct ast_cli_entry *e, int cmd, struct a } AST_LIST_UNLOCK(&cfmtime_head); - return completion_value; + return NULL; } if (a->argc != 3) { diff --git a/main/config_options.c b/main/config_options.c index 3aa00f921..41c8b222c 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -958,88 +958,79 @@ int aco_set_defaults(struct aco_type *type, const char *category, void *obj) /*! \internal * \brief Complete the name of the module the user is looking for */ -static char *complete_config_module(const char *word, int pos, int state) +static char *complete_config_module(const char *word) { - char *c = NULL; size_t wordlen = strlen(word); - int which = 0; struct ao2_iterator i; struct ast_xml_doc_item *cur; - if (pos != 3) { - return NULL; - } - i = ao2_iterator_init(xmldocs, 0); while ((cur = ao2_iterator_next(&i))) { - if (!strncasecmp(word, cur->name, wordlen) && ++which > state) { - c = ast_strdup(cur->name); - ao2_ref(cur, -1); - break; + if (!strncasecmp(word, cur->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + ao2_ref(cur, -1); + break; + } } ao2_ref(cur, -1); } ao2_iterator_destroy(&i); - return c; + return NULL; } /*! \internal * \brief Complete the name of the configuration type the user is looking for */ -static char *complete_config_type(const char *module, const char *word, int pos, int state) +static char *complete_config_type(const char *module, const char *word) { - char *c = NULL; size_t wordlen = strlen(word); - int which = 0; - RAII_VAR(struct ast_xml_doc_item *, info, NULL, ao2_cleanup); + struct ast_xml_doc_item *info; struct ast_xml_doc_item *cur; - if (pos != 4) { - return NULL; - } - - if (!(info = ao2_find(xmldocs, module, OBJ_KEY))) { + info = ao2_find(xmldocs, module, OBJ_KEY); + if (!info) { return NULL; } cur = info; while ((cur = AST_LIST_NEXT(cur, next))) { - if (!strcasecmp(cur->type, "configObject") && !strncasecmp(word, cur->name, wordlen) && ++which > state) { - c = ast_strdup(cur->name); - break; + if (!strcasecmp(cur->type, "configObject") && !strncasecmp(word, cur->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + break; + } } } - return c; + ao2_ref(info, -1); + + return NULL; } /*! \internal * \brief Complete the name of the configuration option the user is looking for */ -static char *complete_config_option(const char *module, const char *option, const char *word, int pos, int state) +static char *complete_config_option(const char *module, const char *option, const char *word) { - char *c = NULL; size_t wordlen = strlen(word); - int which = 0; - RAII_VAR(struct ast_xml_doc_item *, info, NULL, ao2_cleanup); + struct ast_xml_doc_item *info; struct ast_xml_doc_item *cur; - if (pos != 5) { - return NULL; - } - - if (!(info = ao2_find(xmldocs, module, OBJ_KEY))) { + info = ao2_find(xmldocs, module, OBJ_KEY); + if (!info) { return NULL; } cur = info; while ((cur = AST_LIST_NEXT(cur, next))) { - if (!strcasecmp(cur->type, "configOption") && !strcasecmp(cur->ref, option) && !strncasecmp(word, cur->name, wordlen) && ++which > state) { - c = ast_strdup(cur->name); - break; + if (!strcasecmp(cur->type, "configOption") && !strcasecmp(cur->ref, option) && !strncasecmp(word, cur->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(cur->name))) { + break; + } } } - return c; + ao2_ref(info, -1); + + return NULL; } /* Define as 0 if we want to allow configurations to be registered without @@ -1340,10 +1331,14 @@ static char *cli_show_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args return NULL; case CLI_GENERATE: switch(a->pos) { - case 3: return complete_config_module(a->word, a->pos, a->n); - case 4: return complete_config_type(a->argv[3], a->word, a->pos, a->n); - case 5: return complete_config_option(a->argv[3], a->argv[4], a->word, a->pos, a->n); - default: return NULL; + case 3: + return complete_config_module(a->word); + case 4: + return complete_config_type(a->argv[3], a->word); + case 5: + return complete_config_option(a->argv[3], a->argv[4], a->word); + default: + return NULL; } } diff --git a/main/manager.c b/main/manager.c index 64b07d319..577c7f928 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2325,9 +2325,9 @@ static char *handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ { struct manager_action *cur; struct ast_str *authority; - int num, l, which; + int num; + int l; const char *auth_str; - char *ret = NULL; #ifdef AST_XML_DOCS char syntax_title[64], description_title[64], synopsis_title[64], seealso_title[64]; char arguments_title[64], privilege_title[64], final_response_title[64], list_responses_title[64]; @@ -2342,16 +2342,16 @@ static char *handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ return NULL; case CLI_GENERATE: l = strlen(a->word); - which = 0; AST_RWLIST_RDLOCK(&actions); AST_RWLIST_TRAVERSE(&actions, cur, list) { - if (!strncasecmp(a->word, cur->action, l) && ++which > a->n) { - ret = ast_strdup(cur->action); - break; /* make sure we exit even if ast_strdup() returns NULL */ + if (!strncasecmp(a->word, cur->action, l)) { + if (ast_cli_completion_add(ast_strdup(cur->action))) { + break; + } } } AST_RWLIST_UNLOCK(&actions); - return ret; + return NULL; } if (a->argc < 4) { return CLI_SHOWUSAGE; @@ -2481,8 +2481,7 @@ static char *handle_mandebug(struct ast_cli_entry *e, int cmd, struct ast_cli_ar static char *handle_showmanager(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct ast_manager_user *user = NULL; - int l, which; - char *ret = NULL; + int l; struct ast_str *rauthority = ast_str_alloca(MAX_AUTH_PERM_STRING); struct ast_str *wauthority = ast_str_alloca(MAX_AUTH_PERM_STRING); struct ast_variable *v; @@ -2496,19 +2495,19 @@ static char *handle_showmanager(struct ast_cli_entry *e, int cmd, struct ast_cli return NULL; case CLI_GENERATE: l = strlen(a->word); - which = 0; if (a->pos != 3) { return NULL; } AST_RWLIST_RDLOCK(&users); AST_RWLIST_TRAVERSE(&users, user, list) { - if ( !strncasecmp(a->word, user->username, l) && ++which > a->n ) { - ret = ast_strdup(user->username); - break; + if (!strncasecmp(a->word, user->username, l)) { + if (ast_cli_completion_add(ast_strdup(user->username))) { + break; + } } } AST_RWLIST_UNLOCK(&users); - return ret; + return NULL; } if (a->argc != 4) { @@ -8645,8 +8644,6 @@ static char *handle_manager_show_event(struct ast_cli_entry *e, int cmd, struct struct ao2_iterator it_events; struct ast_xml_doc_item *item, *temp; int length; - int which; - char *match = NULL; if (cmd == CLI_INIT) { e->command = "manager show event"; @@ -8663,19 +8660,24 @@ static char *handle_manager_show_event(struct ast_cli_entry *e, int cmd, struct } if (cmd == CLI_GENERATE) { + if (a->pos != 3) { + return NULL; + } + length = strlen(a->word); - which = 0; it_events = ao2_iterator_init(events, 0); while ((item = ao2_iterator_next(&it_events))) { - if (!strncasecmp(a->word, item->name, length) && ++which > a->n) { - match = ast_strdup(item->name); - ao2_ref(item, -1); - break; + if (!strncasecmp(a->word, item->name, length)) { + if (ast_cli_completion_add(ast_strdup(item->name))) { + ao2_ref(item, -1); + break; + } } ao2_ref(item, -1); } ao2_iterator_destroy(&it_events); - return match; + + return NULL; } if (a->argc != 4) { diff --git a/main/named_acl.c b/main/named_acl.c index 4f2069a75..c4628216f 100644 --- a/main/named_acl.c +++ b/main/named_acl.c @@ -475,12 +475,10 @@ static void cli_display_named_acl_list(int fd) /* \brief ACL command show <name> */ static char *handle_show_named_acl_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - RAII_VAR(struct named_acl_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup); + struct named_acl_config *cfg; int length; - int which; struct ao2_iterator i; struct named_acl *named_acl; - char *match = NULL; switch (cmd) { case CLI_INIT: @@ -490,23 +488,29 @@ static char *handle_show_named_acl_cmd(struct ast_cli_entry *e, int cmd, struct " Shows a list of named ACLs or lists all entries in a given named ACL.\n"; return NULL; case CLI_GENERATE: + if (a->pos != 2) { + return NULL; + } + + cfg = ao2_global_obj_ref(globals); if (!cfg) { return NULL; } length = strlen(a->word); - which = 0; i = ao2_iterator_init(cfg->named_acl_list, 0); while ((named_acl = ao2_iterator_next(&i))) { - if (!strncasecmp(a->word, named_acl->name, length) && ++which > a->n) { - match = ast_strdup(named_acl->name); - ao2_ref(named_acl, -1); - break; + if (!strncasecmp(a->word, named_acl->name, length)) { + if (ast_cli_completion_add(ast_strdup(named_acl->name))) { + ao2_ref(named_acl, -1); + break; + } } ao2_ref(named_acl, -1); } ao2_iterator_destroy(&i); - return match; + ao2_ref(cfg, -1); + return NULL; } if (a->argc == 2) { diff --git a/main/plc.c b/main/plc.c index 847ce65b0..369d285a5 100644 --- a/main/plc.c +++ b/main/plc.c @@ -262,10 +262,19 @@ static int reload_module(void) for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) { if (!strcasecmp(var->name, "genericplc")) { ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC); + } else if (!strcasecmp(var->name, "genericplc_on_equal_codecs")) { + ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS); } } ast_config_destroy(cfg); + /* + * Force on_equal_codecs to false if generic_plc is false. + */ + if (!ast_opt_generic_plc) { + ast_set2_flag(&ast_options, 0, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS); + } + return 0; } diff --git a/main/sounds.c b/main/sounds.c index 08e29275e..745b62805 100644 --- a/main/sounds.c +++ b/main/sounds.c @@ -219,6 +219,11 @@ static char *handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast /*! \brief Show details about a sound available in the system */ static char *handle_cli_sound_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { + int length; + struct ao2_iterator it_sounds; + char *filename; + struct ao2_container *sound_files; + switch (cmd) { case CLI_INIT: e->command = "core show sound"; @@ -227,29 +232,30 @@ static char *handle_cli_sound_show(struct ast_cli_entry *e, int cmd, struct ast_ " Shows information about the specified sound.\n"; return NULL; case CLI_GENERATE: - { - int length = strlen(a->word); - int which = 0; - struct ao2_iterator it_sounds; - char *match = NULL; - char *filename; - RAII_VAR(struct ao2_container *, sound_files, ast_media_get_media(sounds_index), ao2_cleanup); + if (a->pos != 3) { + return NULL; + } + + sound_files = ast_media_get_media(sounds_index); if (!sound_files) { return NULL; } + length = strlen(a->word); it_sounds = ao2_iterator_init(sound_files, 0); while ((filename = ao2_iterator_next(&it_sounds))) { - if (!strncasecmp(a->word, filename, length) && ++which > a->n) { - match = ast_strdup(filename); - ao2_ref(filename, -1); - break; + if (!strncasecmp(a->word, filename, length)) { + if (ast_cli_completion_add(ast_strdup(filename))) { + ao2_ref(filename, -1); + break; + } } ao2_ref(filename, -1); } ao2_iterator_destroy(&it_sounds); - return match; - } + ao2_ref(sound_files, -1); + + return NULL; } if (a->argc == 4) { diff --git a/main/stringfields.c b/main/stringfields.c index 30aa8cddd..0a9e59903 100644 --- a/main/stringfields.c +++ b/main/stringfields.c @@ -179,11 +179,6 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_ } mgr->last_alloc = NULL; - /* v-- MALLOC_DEBUG information */ - mgr->owner_file = file; - mgr->owner_func = func; - mgr->owner_line = lineno; - /* ^-- MALLOC_DEBUG information */ if (AST_VECTOR_INIT(&mgr->string_fields, initial_vector_size)) { return -1; @@ -205,7 +200,8 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_ } ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr, - struct ast_string_field_pool **pool_head, size_t needed) + struct ast_string_field_pool **pool_head, size_t needed, + const char *file, int lineno, const char *func) { char *result = NULL; size_t space = (*pool_head)->size - (*pool_head)->used; @@ -222,8 +218,7 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr new_size *= 2; } - if (add_string_pool(mgr, pool_head, new_size, - mgr->owner_file, mgr->owner_line, mgr->owner_func)) { + if (add_string_pool(mgr, pool_head, new_size, file, lineno, func)) { return NULL; } } @@ -290,7 +285,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head, void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, - const char *format, va_list ap) + const char *format, va_list ap, + const char *file, int lineno, const char *func) { size_t needed; size_t available; @@ -342,7 +338,8 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, (if it has one), or the space available in the pool (if it does not). allocate space for it, adding a new string pool if necessary. */ - if (!(target = (char *) __ast_string_field_alloc_space(mgr, pool_head, needed))) { + target = (char *) __ast_string_field_alloc_space(mgr, pool_head, needed, file, lineno, func); + if (!target) { return; } vsprintf(target, format, ap); @@ -369,13 +366,14 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr, } } -void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr, +void __ast_string_field_ptr_build(const char *file, int lineno, const char *func, + struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head, ast_string_field *ptr, const char *format, ...) { va_list ap; va_start(ap, format); - __ast_string_field_ptr_build_va(mgr, pool_head, ptr, format, ap); + __ast_string_field_ptr_build_va(mgr, pool_head, ptr, format, ap, file, lineno, func); va_end(ap); } @@ -419,11 +417,6 @@ void *__ast_calloc_with_stringfields(unsigned int num_structs, size_t struct_siz mgr->embedded_pool = pool; *pool_head = pool; pool->size = size_to_alloc - struct_size - sizeof(*pool); - /* v-- MALLOC_DEBUG information */ - mgr->owner_file = file; - mgr->owner_func = func; - mgr->owner_line = lineno; - /* ^-- MALLOC_DEBUG information */ return allocation; } @@ -446,7 +439,8 @@ int __ast_string_fields_cmp(struct ast_string_field_vector *left, } int __ast_string_fields_copy(struct ast_string_field_pool *copy_pool, - struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr) + struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr, + const char *file, int lineno, const char *func) { int i; struct ast_string_field_vector *dest = &(copy_mgr->string_fields); @@ -460,8 +454,8 @@ int __ast_string_fields_copy(struct ast_string_field_pool *copy_pool, } for (i = 0; i < AST_VECTOR_SIZE(dest); i++) { - if (ast_string_field_ptr_set_by_fields(copy_pool, *copy_mgr, AST_VECTOR_GET(dest, i), - *AST_VECTOR_GET(src, i))) { + if (__ast_string_field_ptr_set_by_fields(copy_pool, *copy_mgr, AST_VECTOR_GET(dest, i), + *AST_VECTOR_GET(src, i), file, lineno, func)) { return -1; } } diff --git a/main/taskprocessor.c b/main/taskprocessor.c index cf82efff2..91eb7d993 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -341,26 +341,27 @@ static void *tps_task_free(struct tps_task *task) static char *tps_taskprocessor_tab_complete(struct ast_cli_args *a) { int tklen; - int wordnum = 0; struct ast_taskprocessor *p; - char *name = NULL; struct ao2_iterator i; - if (a->pos != 3) + if (a->pos != 3) { return NULL; + } tklen = strlen(a->word); i = ao2_iterator_init(tps_singletons, 0); while ((p = ao2_iterator_next(&i))) { - if (!strncasecmp(a->word, p->name, tklen) && ++wordnum > a->n) { - name = ast_strdup(p->name); - ast_taskprocessor_unreference(p); - break; + if (!strncasecmp(a->word, p->name, tklen)) { + if (ast_cli_completion_add(ast_strdup(p->name))) { + ast_taskprocessor_unreference(p); + break; + } } ast_taskprocessor_unreference(p); } ao2_iterator_destroy(&i); - return name; + + return NULL; } /* ping task handling function */ diff --git a/main/test.c b/main/test.c index f45ad9b62..b117c0814 100644 --- a/main/test.c +++ b/main/test.c @@ -691,40 +691,40 @@ static struct ast_test *test_alloc(ast_test_cb_t *cb) return test; } -static char *complete_test_category(const char *line, const char *word, int pos, int state) +static char *complete_test_category(const char *word) { - int which = 0; int wordlen = strlen(word); - char *ret = NULL; struct ast_test *test; AST_LIST_LOCK(&tests); AST_LIST_TRAVERSE(&tests, test, entry) { - if (!strncasecmp(word, test->info.category, wordlen) && ++which > state) { - ret = ast_strdup(test->info.category); - break; + if (!strncasecmp(word, test->info.category, wordlen)) { + if (ast_cli_completion_add(ast_strdup(test->info.category))) { + break; + } } } AST_LIST_UNLOCK(&tests); - return ret; + + return NULL; } -static char *complete_test_name(const char *line, const char *word, int pos, int state, const char *category) +static char *complete_test_name(const char *word, const char *category) { - int which = 0; int wordlen = strlen(word); - char *ret = NULL; struct ast_test *test; AST_LIST_LOCK(&tests); AST_LIST_TRAVERSE(&tests, test, entry) { - if (!test_cat_cmp(test->info.category, category) && (!strncasecmp(word, test->info.name, wordlen) && ++which > state)) { - ret = ast_strdup(test->info.name); - break; + if (!test_cat_cmp(test->info.category, category) && !strncasecmp(word, test->info.name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(test->info.name))) { + break; + } } } AST_LIST_UNLOCK(&tests); - return ret; + + return NULL; } /* CLI commands */ @@ -749,22 +749,22 @@ static char *test_cli_show_registered(struct ast_cli_entry *e, int cmd, struct a return NULL; case CLI_GENERATE: if (a->pos == 3) { - return ast_cli_complete(a->word, option1, a->n); + return ast_cli_complete(a->word, option1, -1); } - if (a->pos == 4) { - return complete_test_category(a->line, a->word, a->pos, a->n); + if (a->pos == 4 && !strcasecmp(a->argv[3], "category")) { + return complete_test_category(a->word); } if (a->pos == 5) { - return ast_cli_complete(a->word, option2, a->n); + return ast_cli_complete(a->word, option2, -1); } if (a->pos == 6) { - return complete_test_name(a->line, a->word, a->pos, a->n, a->argv[3]); + return complete_test_name(a->word, a->argv[4]); } return NULL; case CLI_HANDLER: if ((a->argc < 4) || (a->argc == 6) || (a->argc > 7) || - ((a->argc == 4) && strcmp(a->argv[3], "all")) || - ((a->argc == 7) && strcmp(a->argv[5], "name"))) { + ((a->argc == 4) && strcasecmp(a->argv[3], "all")) || + ((a->argc == 7) && strcasecmp(a->argv[5], "name"))) { return CLI_SHOWUSAGE; } ast_cli(a->fd, FORMAT, "Category", "Name", "Summary", "Test Result"); @@ -808,16 +808,16 @@ static char *test_cli_execute_registered(struct ast_cli_entry *e, int cmd, struc return NULL; case CLI_GENERATE: if (a->pos == 2) { - return ast_cli_complete(a->word, option1, a->n); + return ast_cli_complete(a->word, option1, -1); } - if (a->pos == 3) { - return complete_test_category(a->line, a->word, a->pos, a->n); + if (a->pos == 3 && !strcasecmp(a->argv[2], "category")) { + return complete_test_category(a->word); } if (a->pos == 4) { - return ast_cli_complete(a->word, option2, a->n); + return ast_cli_complete(a->word, option2, -1); } if (a->pos == 5) { - return complete_test_name(a->line, a->word, a->pos, a->n, a->argv[3]); + return complete_test_name(a->word, a->argv[3]); } return NULL; case CLI_HANDLER: @@ -826,7 +826,7 @@ static char *test_cli_execute_registered(struct ast_cli_entry *e, int cmd, struc return CLI_SHOWUSAGE; } - if ((a->argc == 3) && !strcmp(a->argv[2], "all")) { /* run all registered tests */ + if ((a->argc == 3) && !strcasecmp(a->argv[2], "all")) { /* run all registered tests */ ast_cli(a->fd, "Running all available tests...\n\n"); test_execute_multiple(NULL, NULL, a); } else if (a->argc == 4) { /* run only tests within a category */ @@ -877,7 +877,7 @@ static char *test_cli_show_results(struct ast_cli_entry *e, int cmd, struct ast_ return NULL; case CLI_GENERATE: if (a->pos == 3) { - return ast_cli_complete(a->word, option1, a->n); + return ast_cli_complete(a->word, option1, -1); } return NULL; case CLI_HANDLER: @@ -885,11 +885,11 @@ static char *test_cli_show_results(struct ast_cli_entry *e, int cmd, struct ast_ /* verify input */ if (a->argc != 4) { return CLI_SHOWUSAGE; - } else if (!strcmp(a->argv[3], "passed")) { + } else if (!strcasecmp(a->argv[3], "passed")) { mode = 2; - } else if (!strcmp(a->argv[3], "failed")) { + } else if (!strcasecmp(a->argv[3], "failed")) { mode = 1; - } else if (!strcmp(a->argv[3], "all")) { + } else if (!strcasecmp(a->argv[3], "all")) { mode = 0; } else { return CLI_SHOWUSAGE; @@ -950,7 +950,7 @@ static char *test_cli_generate_results(struct ast_cli_entry *e, int cmd, struct return NULL; case CLI_GENERATE: if (a->pos == 3) { - return ast_cli_complete(a->word, option, a->n); + return ast_cli_complete(a->word, option, -1); } return NULL; case CLI_HANDLER: @@ -958,10 +958,10 @@ static char *test_cli_generate_results(struct ast_cli_entry *e, int cmd, struct /* verify input */ if (a->argc < 4 || a->argc > 5) { return CLI_SHOWUSAGE; - } else if (!strcmp(a->argv[3], "xml")) { + } else if (!strcasecmp(a->argv[3], "xml")) { type = "xml"; isxml = 1; - } else if (!strcmp(a->argv[3], "txt")) { + } else if (!strcasecmp(a->argv[3], "txt")) { type = "txt"; } else { return CLI_SHOWUSAGE; diff --git a/main/translate.c b/main/translate.c index 226d0985d..396c5522e 100644 --- a/main/translate.c +++ b/main/translate.c @@ -900,9 +900,9 @@ const char *ast_translate_path_to_str(struct ast_trans_pvt *p, struct ast_str ** return ast_str_buffer(*str); } -static char *complete_trans_path_choice(const char *line, const char *word, int pos, int state) +static char *complete_trans_path_choice(const char *word) { - int i = 1, which = 0; + int i = 1; int wordlen = strlen(word); struct ast_codec *codec; @@ -912,13 +912,15 @@ static char *complete_trans_path_choice(const char *line, const char *word, int ao2_ref(codec, -1); continue; } - if (!strncasecmp(word, codec->name, wordlen) && ++which > state) { - char *res = ast_strdup(codec->name); - ao2_ref(codec, -1); - return res; + if (!strncasecmp(word, codec->name, wordlen)) { + if (ast_cli_completion_add(ast_strdup(codec->name))) { + ao2_ref(codec, -1); + break; + } } ao2_ref(codec, -1); } + return NULL; } @@ -1138,10 +1140,10 @@ static char *handle_cli_core_show_translation(struct ast_cli_entry *e, int cmd, return NULL; case CLI_GENERATE: if (a->pos == 3) { - return ast_cli_complete(a->word, option, a->n); + return ast_cli_complete(a->word, option, -1); } if (a->pos == 4 && !strcasecmp(a->argv[3], option[1])) { - return complete_trans_path_choice(a->line, a->word, a->pos, a->n); + return complete_trans_path_choice(a->word); } /* BUGBUG - add tab completion for sample rates */ return NULL; diff --git a/res/res_odbc.c b/res/res_odbc.c index 4a5411e7e..3ee8cba74 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -42,7 +42,6 @@ /*** MODULEINFO <depend>generic_odbc</depend> <depend>res_odbc_transaction</depend> - <depend>ltdl</depend> <support_level>core</support_level> ***/ |