bridge_softmix: Use removed stream spots when renegotiating.
[asterisk/asterisk.git] / configure
index c382032..1808633 100755 (executable)
--- a/configure
+++ b/configure
@@ -639,6 +639,11 @@ PBX_SYSLOG_FACILITY_LOG_DAEMON
 PBX_SYSLOG_FACILITY_LOG_CRON
 PBX_SYSLOG_FACILITY_LOG_AUTHPRIV
 PBX_SYSLOG_FACILITY_LOG_AUTH
+SYSTEMD_LIBS
+SYSTEMD_CFLAGS
+SYSTEMD_INCLUDE
+SYSTEMD_LIB
+PBX_SYSTEMD
 PBX_GENERIC_ODBC
 GENERIC_ODBC_INCLUDE
 GENERIC_ODBC_LIB
@@ -663,6 +668,10 @@ PWLIB_LIBDIR
 PWLIB_INCDIR
 PWLIBDIR
 PTLIB_CONFIG
+PYTHONDEV_LIBS
+PYTHONDEV_CFLAGS
+PYTHONDEV_INCLUDE
+PYTHONDEV_LIB
 PJPROJECT_LIBS
 PJPROJECT_CFLAGS
 PG_CONFIG
@@ -688,6 +697,7 @@ PBX_IP_MTU_DISCOVER
 PBX_RTLD_NOLOAD
 PBX_GLOB_BRACE
 PBX_GLOB_NOMAGIC
+BIND8_CFLAGS
 AST_RPATH
 AST_NATIVE_ARCH
 AST_SHADOW_WARNINGS
@@ -695,8 +705,10 @@ AST_NO_STRICT_OVERFLOW
 AST_FORTIFY_SOURCE
 AST_TRAMPOLINES
 AST_DECLARATION_AFTER_STATEMENT
-GC_LDFLAGS
-GC_CFLAGS
+AST_UNDEFINED_SANITIZER
+AST_LEAK_SANITIZER
+AST_THREAD_SANITIZER
+AST_ADDRESS_SANITIZER
 PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 PBX_PTHREAD_RWLOCK_INITIALIZER
 AST_ASTERISKSSL
@@ -770,6 +782,18 @@ PBX_SRTP_SHUTDOWN
 SRTP_SHUTDOWN_DIR
 SRTP_SHUTDOWN_INCLUDE
 SRTP_SHUTDOWN_LIB
+PBX_SRTP_GCM
+SRTP_GCM_DIR
+SRTP_GCM_INCLUDE
+SRTP_GCM_LIB
+PBX_SRTP_192
+SRTP_192_DIR
+SRTP_192_INCLUDE
+SRTP_192_LIB
+PBX_SRTP_256
+SRTP_256_DIR
+SRTP_256_INCLUDE
+SRTP_256_LIB
 PBX_SRTP
 SRTP_DIR
 SRTP_INCLUDE
@@ -802,7 +826,6 @@ PBX_SPANDSP
 SPANDSP_DIR
 SPANDSP_INCLUDE
 SPANDSP_LIB
-SOUNDS_CACHE_DIR
 PBX_SDL_IMAGE
 SDL_IMAGE_DIR
 SDL_IMAGE_INCLUDE
@@ -811,10 +834,18 @@ PBX_SDL
 SDL_DIR
 SDL_INCLUDE
 SDL_LIB
+PBX_SNDFILE
+SNDFILE_DIR
+SNDFILE_INCLUDE
+SNDFILE_LIB
 PBX_RESAMPLE
 RESAMPLE_DIR
 RESAMPLE_INCLUDE
 RESAMPLE_LIB
+PBX_FFTW3
+FFTW3_DIR
+FFTW3_INCLUDE
+FFTW3_LIB
 PBX_RADIUS
 RADIUS_DIR
 RADIUS_INCLUDE
@@ -911,6 +942,34 @@ PBX_PORTAUDIO
 PORTAUDIO_DIR
 PORTAUDIO_INCLUDE
 PORTAUDIO_LIB
+PBX_POPT
+POPT_DIR
+POPT_INCLUDE
+POPT_LIB
+PBX_PJSIP_TSX_LAYER_FIND_TSX2
+PJSIP_TSX_LAYER_FIND_TSX2_DIR
+PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE
+PJSIP_TSX_LAYER_FIND_TSX2_LIB
+PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT
+PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR
+PJSIP_EVSUB_SET_UAS_TIMEOUT_INCLUDE
+PJSIP_EVSUB_SET_UAS_TIMEOUT_LIB
+PBX_PJSIP_AUTH_CLT_DEINIT
+PJSIP_AUTH_CLT_DEINIT_DIR
+PJSIP_AUTH_CLT_DEINIT_INCLUDE
+PJSIP_AUTH_CLT_DEINIT_LIB
+PBX_PJSIP_INV_SESSION_REF
+PJSIP_INV_SESSION_REF_DIR
+PJSIP_INV_SESSION_REF_INCLUDE
+PJSIP_INV_SESSION_REF_LIB
+PBX_PJSIP_EVSUB_GRP_LOCK
+PJSIP_EVSUB_GRP_LOCK_DIR
+PJSIP_EVSUB_GRP_LOCK_INCLUDE
+PJSIP_EVSUB_GRP_LOCK_LIB
+PBX_PJSIP_TLS_TRANSPORT_PROTO
+PJSIP_TLS_TRANSPORT_PROTO_DIR
+PJSIP_TLS_TRANSPORT_PROTO_INCLUDE
+PJSIP_TLS_TRANSPORT_PROTO_LIB
 PBX_PJSIP_EXTERNAL_RESOLVER
 PJSIP_EXTERNAL_RESOLVER_DIR
 PJSIP_EXTERNAL_RESOLVER_INCLUDE
@@ -931,14 +990,10 @@ PBX_PJ_TRANSACTION_GRP_LOCK
 PJ_TRANSACTION_GRP_LOCK_DIR
 PJ_TRANSACTION_GRP_LOCK_INCLUDE
 PJ_TRANSACTION_GRP_LOCK_LIB
-PBX_POPT
-POPT_DIR
-POPT_INCLUDE
-POPT_LIB
-PBX_PJPROJECT
-PJPROJECT_DIR
-PJPROJECT_INCLUDE
-PJPROJECT_LIB
+PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB
 PBX_PGSQL
 PGSQL_DIR
 PGSQL_INCLUDE
@@ -1015,6 +1070,10 @@ PBX_LIBXML2
 LIBXML2_DIR
 LIBXML2_INCLUDE
 LIBXML2_LIB
+PBX_LIBEDIT_IS_UNICODE
+LIBEDIT_IS_UNICODE_DIR
+LIBEDIT_IS_UNICODE_INCLUDE
+LIBEDIT_IS_UNICODE_LIB
 PBX_LIBEDIT
 LIBEDIT_DIR
 LIBEDIT_INCLUDE
@@ -1103,10 +1162,6 @@ PBX_DAHDI
 DAHDI_DIR
 DAHDI_INCLUDE
 DAHDI_LIB
-PBX_OPENSSL_ECDH_AUTO
-OPENSSL_ECDH_AUTO_DIR
-OPENSSL_ECDH_AUTO_INCLUDE
-OPENSSL_ECDH_AUTO_LIB
 PBX_OPENSSL_EC
 OPENSSL_EC_DIR
 OPENSSL_EC_INCLUDE
@@ -1135,6 +1190,10 @@ PBX_COROSYNC
 COROSYNC_DIR
 COROSYNC_INCLUDE
 COROSYNC_LIB
+PBX_CODEC2
+CODEC2_DIR
+CODEC2_INCLUDE
+CODEC2_LIB
 PBX_CAP
 CAP_DIR
 CAP_INCLUDE
@@ -1155,29 +1214,46 @@ PBX_ALSA
 ALSA_DIR
 ALSA_INCLUDE
 ALSA_LIB
+PJPROJECT_INCLUDE
+PJPROJECT_LIB
+PBX_PJPROJECT
+PJPROJECT_DIR
+PJPROJECT_BUNDLED
+PJPROJECT_CONFIGURE_OPTS
 AST_C_COMPILER_FAMILY
 AST_CLANG_BLOCKS
 AST_CLANG_BLOCKS_LIBS
 AST_NESTED_FUNCTIONS
 AST_CODE_COVERAGE
+EXTERNALS_CACHE_DIR
+SOUNDS_CACHE_DIR
 AST_DEVMODE_STRICT
 AST_DEVMODE
 NOISY_BUILD
 PTHREAD_CFLAGS
 PTHREAD_LIBS
 PTHREAD_CC
-acx_pthread_config
+ax_pthread_config
 MD5
 SOXMIX
+PBX_BASH
+PBX_XMLSTARLET
 PBX_FLEX
 PBX_BISON
 OPENSSL
 SHA1SUM
 LDCONFIG
+DOWNLOAD_TIMEOUT
+DOWNLOAD_TO_STDOUT
 DOWNLOAD
 FETCH
+NM
+PATCH
+TAR
+BZIP2
 ALEMBIC
 GIT
+BASH
 XMLSTARLET
 XMLLINT
 KPATHSEA
@@ -1194,6 +1270,7 @@ COMPRESS
 FIND
 PYTHON
 FLEX
+CAT
 CMP
 BISON
 GNU_LD
@@ -1303,12 +1380,16 @@ ac_user_opts='
 enable_option_checking
 with_gnu_ld
 enable_dev_mode
+with_sounds_cache
+with_externals_cache
 enable_coverage
+with_pjproject_bundled
 with_asound
 with_bfd
 with_execinfo
 with_bluetooth
 with_cap
+with_codec2
 with_cpg
 with_curses
 with_crypt
@@ -1359,10 +1440,11 @@ with_portaudio
 with_pri
 with_pwlib
 with_radius
+with_fftw3
 with_resample
+with_sndfile
 with_sdl
 with_SDL_image
-with_sounds_cache
 with_spandsp
 with_ss7
 with_speex
@@ -1402,6 +1484,7 @@ CXX
 CXXFLAGS
 CCC
 CXXCPP
+PJPROJECT_CONFIGURE_OPTS
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
@@ -1411,10 +1494,14 @@ LIBEDIT_CFLAGS
 LIBEDIT_LIBS
 PJPROJECT_CFLAGS
 PJPROJECT_LIBS
+PYTHONDEV_CFLAGS
+PYTHONDEV_LIBS
 GMIME_CFLAGS
 GMIME_LIBS
 GTK2_CFLAGS
-GTK2_LIBS'
+GTK2_LIBS
+SYSTEMD_CFLAGS
+SYSTEMD_LIBS'
 
 
 # Initialize some variables set by options.
@@ -2040,11 +2127,18 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sounds-cache=PATH
+                          use cached sound tarfiles in PATH
+  --with-externals-cache=PATH
+                          use cached external module tarfiles in PATH
+  --with-pjproject-bundled
+                          Use bundled pjproject libraries
   --with-asound=PATH      use Advanced Linux Sound Architecture files in PATH
   --with-bfd=PATH         use Debug symbol decoding files in PATH
   --with-execinfo=PATH    use Stack Backtrace files in PATH
   --with-bluetooth=PATH   use Bluetooth files in PATH
   --with-cap=PATH         use POSIX 1.e capabilities files in PATH
+  --with-codec2=PATH      use Codec 2 Audio Decoder/Encoder files in PATH
   --with-cpg=PATH         use Corosync files in PATH
   --with-curses=PATH      use curses files in PATH
   --with-crypt=PATH       use password and data encryption files in PATH
@@ -2071,7 +2165,8 @@ Optional Packages:
   --with-uriparser=PATH   use uriparser library files in PATH
   --with-kqueue=PATH      use kqueue support files in PATH
   --with-ldap=PATH        use OpenLDAP files in PATH
-  --with-libcurl=DIR      look for the curl library in DIR
+  --with-libcurl=PREFIX   look for the curl library in PREFIX/lib and headers
+                          in PREFIX/include
   --with-libedit=PATH     use NetBSD Editline library files in PATH, use
                           'internal' Editline otherwise
   --with-libxml2=PATH     use LibXML2 files in PATH
@@ -2098,11 +2193,11 @@ Optional Packages:
   --with-pri=PATH         use ISDN PRI files in PATH
   --with-pwlib=PATH       use PWlib files in PATH
   --with-radius=PATH      use Radius Client files in PATH
+  --with-fftw3=PATH       use LIBFFTW3 files in PATH
   --with-resample=PATH    use LIBRESAMPLE files in PATH
+  --with-sndfile=PATH     use libsndfile files in PATH
   --with-sdl=PATH         use Sdl files in PATH
   --with-SDL_image=PATH   use Sdl Image files in PATH
-  --with-sounds-cache=PATH
-                          use cached sound tarfiles in PATH
   --with-spandsp=PATH     use SPANDSP files in PATH
   --with-ss7=PATH         use ISDN SS7 files in PATH
   --with-speex=PATH       use Speex files in PATH
@@ -2137,6 +2232,8 @@ Some influential environment variables:
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   CXXCPP      C++ preprocessor
+  PJPROJECT_CONFIGURE_OPTS
+              Additional configure options to pass to bundled pjproject
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
               directories to add to pkg-config's search path
@@ -2152,11 +2249,19 @@ Some influential environment variables:
               C compiler flags for PJPROJECT, overriding pkg-config
   PJPROJECT_LIBS
               linker flags for PJPROJECT, overriding pkg-config
+  PYTHONDEV_CFLAGS
+              C compiler flags for PYTHONDEV, overriding pkg-config
+  PYTHONDEV_LIBS
+              linker flags for PYTHONDEV, overriding pkg-config
   GMIME_CFLAGS
               C compiler flags for GMIME, overriding pkg-config
   GMIME_LIBS  linker flags for GMIME, overriding pkg-config
   GTK2_CFLAGS C compiler flags for GTK2, overriding pkg-config
   GTK2_LIBS   linker flags for GTK2, overriding pkg-config
+  SYSTEMD_CFLAGS
+              C compiler flags for SYSTEMD, overriding pkg-config
+  SYSTEMD_LIBS
+              linker flags for SYSTEMD, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -4837,9 +4942,12 @@ case "${host_os}" in
      OSARCH=cygwin
      PBX_WINARCH=1
      ;;
-     linux-gnueabi* |  linux-gnuspe)
+     linux-gnu*)
      OSARCH=linux-gnu
      ;;
+     linux-musl*)
+     OSARCH=linux-musl
+     ;;
      kfreebsd*-gnu)
      OSARCH=kfreebsd-gnu
      ;;
@@ -6703,6 +6811,47 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "cat", so it can be a program name with args.
+set dummy cat; 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_CAT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $CAT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CAT="$CAT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_CAT" && ac_cv_path_CAT=":"
+  ;;
+esac
+fi
+CAT=$ac_cv_path_CAT
+if test -n "$CAT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5
+$as_echo "$CAT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7441,6 +7590,47 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "bash", so it can be a program name with args.
+set dummy bash; 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_BASH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BASH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BASH" && ac_cv_path_BASH=":"
+  ;;
+esac
+fi
+BASH=$ac_cv_path_BASH
+if test -n "$BASH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH" >&5
+$as_echo "$BASH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "git", so it can be a program name with args.
 set dummy git; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7523,10 +7713,220 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "bzip2", so it can be a program name with args.
+set dummy bzip2; 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_BZIP2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BZIP2 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BZIP2="$BZIP2" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BZIP2="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BZIP2" && ac_cv_path_BZIP2=":"
+  ;;
+esac
+fi
+BZIP2=$ac_cv_path_BZIP2
+if test -n "$BZIP2"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
+$as_echo "$BZIP2" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "tar", so it can be a program name with args.
+set dummy tar; 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_TAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $TAR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TAR="$TAR" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_TAR" && ac_cv_path_TAR=":"
+  ;;
+esac
+fi
+TAR=$ac_cv_path_TAR
+if test -n "$TAR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
+$as_echo "$TAR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "patch", so it can be a program name with args.
+set dummy patch; 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_PATCH+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PATCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PATCH="$PATCH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PATCH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PATCH" && ac_cv_path_PATCH=":"
+  ;;
+esac
+fi
+PATCH=$ac_cv_path_PATCH
+if test -n "$PATCH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCH" >&5
+$as_echo "$PATCH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; 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_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $SED in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SED="$SED" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_SED" && ac_cv_path_SED=":"
+  ;;
+esac
+fi
+SED=$ac_cv_path_SED
+if test -n "$SED"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
+$as_echo "$SED" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "nm", so it can be a program name with args.
+set dummy nm; 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_NM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $NM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NM="$NM" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_NM="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_NM" && ac_cv_path_NM=":"
+  ;;
+esac
+fi
+NM=$ac_cv_path_NM
+if test -n "$NM"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5
+$as_echo "$NM" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
 if test "${WGET}" != ":" ; then
   DOWNLOAD=${WGET}
+  DOWNLOAD_TO_STDOUT="${WGET} -q -O-"
+  DOWNLOAD_TIMEOUT='--timeout=$1'
 else if test "${CURL}" != ":" ; then
   DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
+  DOWNLOAD_TO_STDOUT="${CURL} -Ls"
+  DOWNLOAD_TIMEOUT='--max-time $(or $2,$1)'
 else
   # Extract the first word of "fetch", so it can be a program name with args.
 set dummy fetch; ac_word=$2
@@ -7570,9 +7970,15 @@ fi
 
 
   DOWNLOAD=${FETCH}
+  DOWNLOAD_TO_STDOUT="${FETCH} -o-"
+  DOWNLOAD_TIMEOUT='--timeout=$(or $2,$1)'
 fi
 fi
 
+
+
+
+
 # Extract the first word of "ldconfig", so it can be a program name with args.
 set dummy ldconfig; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7748,6 +8154,20 @@ else
 fi
 
 
+if test "x${XMLSTARLET}" = "x:" ; then
+       PBX_XMLSTARLET=0
+else
+       PBX_XMLSTARLET=1
+fi
+
+
+if test "x${BASH}" = "x:" ; then
+       PBX_BASH=0
+else
+       PBX_BASH=1
+fi
+
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}soxmix", so it can be a program name with args.
 set dummy ${ac_tool_prefix}soxmix; ac_word=$2
@@ -7893,6 +8313,76 @@ if test "${MD5}" = "digest" ; then
    MD5="${MD5} -a md5"
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+
 
 
 
@@ -7902,22 +8392,26 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-acx_pthread_ok=no
+ax_pthread_ok=no
 
 # We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
+# requires special compiler flags (e.g. on Tru64 or Sequent).
 # It gets checked for in the link test anyway.
 
 # First of all, check if the user has set any of the PTHREAD_LIBS,
 # etcetera environment variables, and if threads linking works using
 # them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
-        save_CFLAGS="$CFLAGS"
+if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
+        ax_pthread_save_CC="$CC"
+        ax_pthread_save_CFLAGS="$CFLAGS"
+        ax_pthread_save_LIBS="$LIBS"
+        if test "x$PTHREAD_CC" != "x"; then :
+  CC="$PTHREAD_CC"
+fi
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-        save_LIBS="$LIBS"
         LIBS="$PTHREAD_LIBS $LIBS"
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
-$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5
+$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; }
         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -7937,18 +8431,19 @@ return pthread_join ();
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  acx_pthread_ok=yes
+  ax_pthread_ok=yes
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
-$as_echo "$acx_pthread_ok" >&6; }
-        if test x"$acx_pthread_ok" = xno; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+$as_echo "$ax_pthread_ok" >&6; }
+        if test "x$ax_pthread_ok" = "xno"; then
                 PTHREAD_LIBS=""
                 PTHREAD_CFLAGS=""
         fi
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
+        CC="$ax_pthread_save_CC"
+        CFLAGS="$ax_pthread_save_CFLAGS"
+        LIBS="$ax_pthread_save_LIBS"
 fi
 
 # We must check for the threads library under a number of different
@@ -7961,7 +8456,7 @@ fi
 # which indicates that we try without any flags at all, and "pthread-config"
 # which is a program returning the flags for the Pth emulation library.
 
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
 
 # The ordering *is* (sometimes) important.  Some notes on the
 # individual items follow:
@@ -7970,59 +8465,269 @@ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -m
 # none: in case threads are in libc; should be tried before -Kthread and
 #       other compiler flags to prevent continual compiler warnings
 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
+#           (Note: HP C rejects this with "bad form for `-t' option")
+# -pthreads: Solaris/gcc (Note: HP C also rejects)
 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-#      doesn't hurt to check since this sometimes defines pthreads too;
-#      also defines -D_REENTRANT)
-#      ... -mt is also the pthreads flag for HP/aCC
+#      doesn't hurt to check since this sometimes defines pthreads and
+#      -D_REENTRANT too), HP C (must be checked before -lpthread, which
+#      is present but should not be used directly; and before -mthreads,
+#      because the compiler interprets this as "-mt" + "-hreads")
+# -mthreads: Mingw32/gcc, Lynx/gcc
 # pthread: Linux, etcetera
 # --thread-safe: KAI C++
 # pthread-config: use pthread-config program (for GNU Pth library)
 
-case "${host_cpu}-${host_os}" in
-        *solaris*)
+case $host_os in
+
+        freebsd*)
+
+        # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+        # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+
+        ax_pthread_flags="-kthread lthread $ax_pthread_flags"
+        ;;
+
+        hpux*)
+
+        # From the cc(1) man page: "[-mt] Sets various -D flags to enable
+        # multi-threading and also sets -lpthread."
+
+        ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
+        ;;
+
+        openedition*)
+
+        # IBM z/OS requires a feature-test macro to be defined in order to
+        # enable POSIX threads at all, so give the user a hint if this is
+        # not set. (We don't define these ourselves, as they can affect
+        # other portions of the system API in unpredictable ways.)
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#            if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
+             AX_PTHREAD_ZOS_MISSING
+#            endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5
+$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;}
+fi
+rm -f conftest*
+
+        ;;
+
+        solaris*)
 
         # On Solaris (at least, for some versions), libc contains stubbed
         # (non-functional) versions of the pthreads routines, so link-based
-        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
-        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
-        # a function called by this macro, so we could check for that, but
-        # who knows whether they'll stub that too in a future libc.)  So,
-        # we'll just look for -pthreads and -lpthread first:
+        # tests will erroneously succeed. (N.B.: The stubs are missing
+        # pthread_cleanup_push, or rather a function called by this macro,
+        # so we could check for that, but who knows whether they'll stub
+        # that too in a future libc.)  So we'll check first for the
+        # standard Solaris way of linking pthreads (-mt -lpthread).
 
-        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+        ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
         ;;
 esac
 
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
+# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
+
+if test "x$GCC" = "xyes"; then :
+  ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"
+fi
+
+# The presence of a feature test macro requesting re-entrant function
+# definitions is, on some systems, a strong hint that pthreads support is
+# correctly enabled
+
+case $host_os in
+        darwin* | hpux* | linux* | osf* | solaris*)
+        ax_pthread_check_macro="_REENTRANT"
+        ;;
 
-        case $flag in
+        aix*)
+        ax_pthread_check_macro="_THREAD_SAFE"
+        ;;
+
+        *)
+        ax_pthread_check_macro="--"
+        ;;
+esac
+if test "x$ax_pthread_check_macro" = "x--"; then :
+  ax_pthread_check_cond=0
+else
+  ax_pthread_check_cond="!defined($ax_pthread_check_macro)"
+fi
+
+# Are we compiling with Clang?
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5
+$as_echo_n "checking whether $CC is Clang... " >&6; }
+if ${ax_cv_PTHREAD_CLANG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_CLANG=no
+     # Note that Autoconf sets GCC=yes for Clang as well as GCC
+     if test "x$GCC" = "xyes"; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
+#            if defined(__clang__) && defined(__llvm__)
+             AX_PTHREAD_CC_IS_CLANG
+#            endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then :
+  ax_cv_PTHREAD_CLANG=yes
+fi
+rm -f conftest*
+
+     fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5
+$as_echo "$ax_cv_PTHREAD_CLANG" >&6; }
+ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
+
+ax_pthread_clang_warning=no
+
+# Clang needs special handling, because older versions handle the -pthread
+# option in a rather... idiosyncratic way
+
+if test "x$ax_pthread_clang" = "xyes"; then
+
+        # Clang takes -pthread; it has never supported any other flag
+
+        # (Note 1: This will need to be revisited if a system that Clang
+        # supports has POSIX threads in a separate library.  This tends not
+        # to be the way of modern systems, but it's conceivable.)
+
+        # (Note 2: On some systems, notably Darwin, -pthread is not needed
+        # to get POSIX threads support; the API is always present and
+        # active.  We could reasonably leave PTHREAD_CFLAGS empty.  But
+        # -pthread does define _REENTRANT, and while the Darwin headers
+        # ignore this macro, third-party headers might not.)
+
+        PTHREAD_CFLAGS="-pthread"
+        PTHREAD_LIBS=
+
+        ax_pthread_ok=yes
+
+        # However, older versions of Clang make a point of warning the user
+        # that, in an invocation where only linking and no compilation is
+        # taking place, the -pthread option has no effect ("argument unused
+        # during compilation").  They expect -pthread to be passed in only
+        # when source code is being compiled.
+        #
+        # Problem is, this is at odds with the way Automake and most other
+        # C build frameworks function, which is that the same flags used in
+        # compilation (CFLAGS) are also used in linking.  Many systems
+        # supported by AX_PTHREAD require exactly this for POSIX threads
+        # support, and in fact it is often not straightforward to specify a
+        # flag that is used only in the compilation phase and not in
+        # linking.  Such a scenario is extremely rare in practice.
+        #
+        # Even though use of the -pthread flag in linking would only print
+        # a warning, this can be a nuisance for well-run software projects
+        # that build with -Werror.  So if the active version of Clang has
+        # this misfeature, we search for an option to squash it.
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5
+$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; }
+if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
+             # Create an alternate version of $ac_link that compiles and
+             # links in two steps (.c -> .o, .o -> exe) instead of one
+             # (.c -> exe), because the warning occurs only in the second
+             # step
+             ax_pthread_save_ac_link="$ac_link"
+             ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
+             ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
+             ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
+             ax_pthread_save_CFLAGS="$CFLAGS"
+             for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
+                if test "x$ax_pthread_try" = "xunknown"; then :
+  break
+fi
+                CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
+                ac_link="$ax_pthread_save_ac_link"
+                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_link="$ax_pthread_2step_ac_link"
+                     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+             done
+             ac_link="$ax_pthread_save_ac_link"
+             CFLAGS="$ax_pthread_save_CFLAGS"
+             if test "x$ax_pthread_try" = "x"; then :
+  ax_pthread_try=no
+fi
+             ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5
+$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; }
+
+        case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
+                no | unknown) ;;
+                *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
+        esac
+
+fi # $ax_pthread_clang = yes
+
+if test "x$ax_pthread_ok" = "xno"; then
+for ax_pthread_try_flag in $ax_pthread_flags; do
+
+        case $ax_pthread_try_flag in
                 none)
                 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
 $as_echo_n "checking whether pthreads work without any flags... " >&6; }
                 ;;
 
+                -mt,pthread)
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5
+$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; }
+                PTHREAD_CFLAGS="-mt"
+                PTHREAD_LIBS="-lpthread"
+                ;;
+
                 -*)
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5
-$as_echo_n "checking whether pthreads work with $flag... " >&6; }
-                PTHREAD_CFLAGS="$flag"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5
+$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; }
+                PTHREAD_CFLAGS="$ax_pthread_try_flag"
                 ;;
 
-               pthread-config)
-               # Extract the first word of "pthread-config", so it can be a program name with args.
+                pthread-config)
+                # Extract the first word of "pthread-config", so it can be a program name with args.
 set dummy pthread-config; 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_prog_acx_pthread_config+:} false; then :
+if ${ac_cv_prog_ax_pthread_config+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$acx_pthread_config"; then
-  ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test.
+  if test -n "$ax_pthread_config"; then
+  ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -8031,7 +8736,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_acx_pthread_config="yes"
+    ac_cv_prog_ax_pthread_config="yes"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -8039,35 +8744,37 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
+  test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no"
 fi
 fi
-acx_pthread_config=$ac_cv_prog_acx_pthread_config
-if test -n "$acx_pthread_config"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5
-$as_echo "$acx_pthread_config" >&6; }
+ax_pthread_config=$ac_cv_prog_ax_pthread_config
+if test -n "$ax_pthread_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5
+$as_echo "$ax_pthread_config" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-               if test x"$acx_pthread_config" = xno; then continue; fi
-               PTHREAD_CFLAGS="`pthread-config --cflags`"
-               PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
-               ;;
+                if test "x$ax_pthread_config" = "xno"; then :
+  continue
+fi
+                PTHREAD_CFLAGS="`pthread-config --cflags`"
+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
 
                 *)
-                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5
-$as_echo_n "checking for the pthreads library -l$flag... " >&6; }
-                PTHREAD_LIBS="-l$flag"
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5
+$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; }
+                PTHREAD_LIBS="-l$ax_pthread_try_flag"
                 ;;
         esac
 
-        save_LIBS="$LIBS"
-        save_CFLAGS="$CFLAGS"
-        LIBS="$PTHREAD_LIBS $LIBS"
+        ax_pthread_save_CFLAGS="$CFLAGS"
+        ax_pthread_save_LIBS="$LIBS"
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
 
         # Check for various functions.  We must include pthread.h,
         # since some functions may be macros.  (On the Sequent, we
@@ -8078,33 +8785,42 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; }
         # pthread_cleanup_push because it is one of the few pthread
         # functions on Solaris that doesn't have a non-functional libc stub.
         # We try pthread_create on general principles.
+
         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
+#                       if $ax_pthread_check_cond
+#                        error "$ax_pthread_check_macro must be defined"
+#                       endif
+                        static void routine(void *a) { a = 0; }
+                        static void *start_routine(void *a) { return a; }
 int
 main ()
 {
-pthread_t th; pthread_join(th, 0);
-                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
-                     pthread_create(0,0,0,0); pthread_cleanup_pop(0);
+pthread_t th; pthread_attr_t attr;
+                        pthread_create(&th, 0, start_routine, 0);
+                        pthread_join(th, 0);
+                        pthread_attr_init(&attr);
+                        pthread_cleanup_push(routine, 0);
+                        pthread_cleanup_pop(0) /* ; */
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  acx_pthread_ok=yes
+  ax_pthread_ok=yes
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
+        CFLAGS="$ax_pthread_save_CFLAGS"
+        LIBS="$ax_pthread_save_LIBS"
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
-$as_echo "$acx_pthread_ok" >&6; }
-        if test "x$acx_pthread_ok" = xyes; then
-                break;
-        fi
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+$as_echo "$ax_pthread_ok" >&6; }
+        if test "x$ax_pthread_ok" = "xyes"; then :
+  break
+fi
 
         PTHREAD_LIBS=""
         PTHREAD_CFLAGS=""
@@ -8112,63 +8828,127 @@ done
 fi
 
 # Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
-        save_LIBS="$LIBS"
-        LIBS="$PTHREAD_LIBS $LIBS"
-        save_CFLAGS="$CFLAGS"
+if test "x$ax_pthread_ok" = "xyes"; then
+        ax_pthread_save_CFLAGS="$CFLAGS"
+        ax_pthread_save_LIBS="$LIBS"
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
 
         # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
 $as_echo_n "checking for joinable pthread attribute... " >&6; }
-       attr_name=unknown
-       for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
-           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_JOINABLE_ATTR=unknown
+             for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+                 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
 int
 main ()
 {
-int attr=$attr; return attr;
+int attr = $ax_pthread_attr; return attr /* ; */
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  attr_name=$attr; break
+  ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-       done
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5
-$as_echo "$attr_name" >&6; }
-        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+             done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5
+$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; }
+        if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
+               test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
+               test "x$ax_pthread_joinable_attr_defined" != "xyes"; then :
 
 cat >>confdefs.h <<_ACEOF
-#define PTHREAD_CREATE_JOINABLE $attr_name
+#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR
 _ACEOF
 
-        fi
+               ax_pthread_joinable_attr_defined=yes
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
-$as_echo_n "checking if more special flags are required for pthreads... " >&6; }
-        flag=no
-        case "${host_cpu}-${host_os}" in
-            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
-            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
-        esac
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5
-$as_echo "${flag}" >&6; }
-        if test "x$flag" != xno; then
-            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
-        fi
+fi
 
-        LIBS="$save_LIBS"
-        CFLAGS="$save_CFLAGS"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5
+$as_echo_n "checking whether more special flags are required for pthreads... " >&6; }
+if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ax_cv_PTHREAD_SPECIAL_FLAGS=no
+             case $host_os in
+             solaris*)
+             ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
+             ;;
+             esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5
+$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; }
+        if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
+               test "x$ax_pthread_special_flags_added" != "xyes"; then :
+  PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
+               ax_pthread_special_flags_added=yes
+fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5
+$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; }
+if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+int i = PTHREAD_PRIO_INHERIT;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ax_cv_PTHREAD_PRIO_INHERIT=yes
+else
+  ax_cv_PTHREAD_PRIO_INHERIT=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5
+$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; }
+        if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
+               test "x$ax_pthread_prio_inherit_defined" != "xyes"; then :
+
+$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h
+
+               ax_pthread_prio_inherit_defined=yes
+
+fi
+
+        CFLAGS="$ax_pthread_save_CFLAGS"
+        LIBS="$ax_pthread_save_LIBS"
 
-        # More AIX lossage: must compile with xlc_r or cc_r
-       if test x"$GCC" != xyes; then
-          for ac_prog in xlc_r cc_r
+        # More AIX lossage: compile with *_r variant
+        if test "x$GCC" != "xyes"; then
+            case $host_os in
+                aix*)
+                case "x/$CC" in #(
+  x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) :
+    #handle absolute path differently from PATH based program lookup
+                     case "x$CC" in #(
+  x/*) :
+    if as_fn_executable_p ${CC}_r; then :
+  PTHREAD_CC="${CC}_r"
+fi ;; #(
+  *) :
+    for ac_prog in ${CC}_r
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -8209,27 +8989,31 @@ fi
 
   test -n "$PTHREAD_CC" && break
 done
-test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
-
-        else
-          PTHREAD_CC=$CC
-       fi
-else
-        PTHREAD_CC="$CC"
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+ ;;
+esac ;; #(
+  *) :
+     ;;
+esac
+                ;;
+            esac
+        fi
 fi
 
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+
 
 
 
 
 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
+if test "x$ax_pthread_ok" = "xyes"; then
 
 $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
 
         :
 else
-        acx_pthread_ok=no
+        ax_pthread_ok=no
 
 fi
 ac_ext=c
@@ -8268,6 +9052,55 @@ fi
 
 
 
+
+
+# Check whether --with-sounds-cache was given.
+if test "${with_sounds_cache+set}" = set; then :
+  withval=$with_sounds_cache;
+       case ${withval} in
+       n|no)
+               unset SOUNDS_CACHE_DIR
+               ;;
+       *)
+               if test "x${withval}" = "x"; then
+                       :
+               else
+                       SOUNDS_CACHE_DIR="${withval}"
+               fi
+               ;;
+       esac
+
+else
+  :
+fi
+
+
+
+
+
+# Check whether --with-externals-cache was given.
+if test "${with_externals_cache+set}" = set; then :
+  withval=$with_externals_cache;
+       case ${withval} in
+       n|no)
+               unset EXTERNALS_CACHE_DIR
+               ;;
+       *)
+               if test "x${withval}" = "x"; then
+                       :
+               else
+                       EXTERNALS_CACHE_DIR="${withval}"
+               fi
+               ;;
+       esac
+
+else
+  :
+fi
+
+
+
+
 AST_CODE_COVERAGE=no
 # Check whether --enable-coverage was given.
 if test "${enable_coverage+set}" = set; then :
@@ -8420,6 +9253,146 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CFLAGS="$save_CFLAGS"
 
 
+PJPROJECT_BUNDLED=no
+
+
+
+# Check whether --with-pjproject-bundled was given.
+if test "${with_pjproject_bundled+set}" = set; then :
+  withval=$with_pjproject_bundled; case "${withval}" in
+             n|no) PJPROJECT_BUNDLED=no ;;
+             *) PJPROJECT_BUNDLED=yes ;;
+       esac
+fi
+
+
+
+
+       if test "$PJPROJECT_BUNDLED" = "yes" ; then
+
+       if test "${ac_mandatory_list#*PJPROJECT*}" != "$ac_mandatory_list" ; then
+               as_fn_error $? "--with-pjproject and --with-pjproject-bundled can't both be specified" "$LINENO" 5
+       fi
+
+       ac_mandatory_list="$ac_mandatory_list PJPROJECT"
+       PJPROJECT_DIR="${ac_top_build_prefix}third-party/pjproject"
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for embedded pjproject (may have to download)" >&5
+$as_echo_n "checking for embedded pjproject (may have to download)... " >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: configuring" >&5
+$as_echo "configuring" >&6; }
+
+       if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then
+               as_fn_error $? "A download utility (wget, curl or fetch) is required to download bundled pjproject" "$LINENO" 5
+       fi
+       if test "${BZIP2}" = ":" ; then
+               as_fn_error $? "bzip2 is required to extract the pjproject tar file" "$LINENO" 5
+       fi
+       if test "${TAR}" = ":" ; then
+               as_fn_error $? "tar is required to extract the pjproject tar file" "$LINENO" 5
+       fi
+       if test "${PATCH}" = ":" ; then
+               as_fn_error $? "patch is required to configure bundled pjproject" "$LINENO" 5
+       fi
+       if test "${SED}" = ":" ; then
+               as_fn_error $? "sed is required to configure bundled pjproject" "$LINENO" 5
+       fi
+       if test "${NM}" = ":" ; then
+               as_fn_error $? "nm is required to build bundled pjproject" "$LINENO" 5
+       fi
+       if test "${MD5}" = ":" ; then
+               as_fn_error $? "md5sum is required to build bundled pjproject" "$LINENO" 5
+       fi
+       if test "${CAT}" = ":" ; then
+               as_fn_error $? "cat is required to build bundled pjproject" "$LINENO" 5
+       fi
+
+
+       this_host=$(./config.sub $(./config.guess))
+       if test "$build" != "$this_host" ; then
+               PJPROJECT_CONFIGURE_OPTS+=" --build=$build"
+       fi
+       if test "$host" != "$this_host" ; then
+               PJPROJECT_CONFIGURE_OPTS+=" --host=$host"
+       fi
+
+       export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
+       export NOISY_BUILD
+       ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
+               PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
+               EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" \
+               configure
+       if test $? -ne 0 ; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+               { $as_echo "$as_me:${as_lineno-$LINENO}: Unable to configure ${PJPROJECT_DIR}" >&5
+$as_echo "$as_me: Unable to configure ${PJPROJECT_DIR}" >&6;}
+               as_fn_error $? "Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details." "$LINENO" 5
+       fi
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled pjproject" >&5
+$as_echo_n "checking for bundled pjproject... " >&6; }
+
+       PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" echo_cflags)
+       PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
+       PBX_PJPROJECT=1
+
+
+$as_echo "#define HAVE_PJPROJECT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJPROJECT_BUNDLED 1" >>confdefs.h
+
+
+
+$as_echo "#define HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJ_TRANSACTION_GRP_LOCK 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_REPLACE_MEDIA_STREAM 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_GET_DEST_INFO 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_EXTERNAL_RESOLVER 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_TLS_TRANSPORT_PROTO 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_EVSUB_GRP_LOCK 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_INV_SESSION_REF 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_AUTH_CLT_DEINIT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_PJSIP_TSX_LAYER_FIND_TSX2 1" >>confdefs.h
+
+
+
+
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+       fi
+
+
+
 # AST_EXT_LIB_SETUP is used to tell configure to handle variables for
 # various packages.
 # $1 is the prefix for the variables in makeopts and autoconfig.h
@@ -8594,6 +9567,38 @@ fi
 
 
 
+    CODEC2_DESCRIP="Codec 2 Audio Decoder/Encoder"
+    CODEC2_OPTION="codec2"
+    PBX_CODEC2=0
+
+# Check whether --with-codec2 was given.
+if test "${with_codec2+set}" = set; then :
+  withval=$with_codec2;
+       case ${withval} in
+       n|no)
+       USE_CODEC2=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_CODEC2=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} CODEC2"
+       ;;
+       *)
+       CODEC2_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} CODEC2"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     COROSYNC_DESCRIP="Corosync"
     COROSYNC_OPTION="cpg"
     PBX_COROSYNC=0
@@ -8758,18 +9763,6 @@ PBX_OPENSSL_EC=0
 
 
 
-OPENSSL_ECDH_AUTO_DESCRIP="OpenSSL Auto ECDH Support"
-OPENSSL_ECDH_AUTO_OPTION=crypto
-OPENSSL_ECDH_AUTO_DIR=${CRYPTO_DIR}
-
-PBX_OPENSSL_ECDH_AUTO=0
-
-
-
-
-
-
-
     DAHDI_DESCRIP="DAHDI"
     DAHDI_OPTION="dahdi"
     PBX_DAHDI=0
@@ -9431,6 +10424,10 @@ fi
 
 
 
+
+
+
+
 # Check whether --with-libcurl was given.
 if test "${with_libcurl+set}" = set; then :
   withval=$with_libcurl; _libcurl_with=$withval
@@ -9518,7 +10515,6 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path__libcurl_config" && ac_cv_path__libcurl_config=""$withval/bin""
   ;;
 esac
 fi
@@ -9668,10 +10664,11 @@ int x;
 curl_easy_setopt(NULL,CURLOPT_URL,NULL);
 x=CURL_ERROR_SIZE;
 x=CURLOPT_WRITEFUNCTION;
-x=CURLOPT_FILE;
+x=CURLOPT_WRITEDATA;
 x=CURLOPT_ERRORBUFFER;
 x=CURLOPT_STDERR;
 x=CURLOPT_VERBOSE;
+if (x) {;}
 
   ;
   return 0;
@@ -9738,17 +10735,23 @@ _ACEOF
 
               # We don't have --protocols, so just assume that all
               # protocols are available
-              _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT"
+              _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP"
 
               if test x$libcurl_feature_SSL = xyes ; then
                  _libcurl_protocols="$_libcurl_protocols HTTPS"
 
                  # FTPS wasn't standards-compliant until version
-                 # 7.11.0
+                 # 7.11.0 (0x070b00 == 461568)
                  if test $_libcurl_version -ge 461568; then
                     _libcurl_protocols="$_libcurl_protocols FTPS"
                  fi
               fi
+
+              # RTSP, IMAP, POP3 and SMTP were added in
+              # 7.20.0 (0x071400 == 463872)
+              if test $_libcurl_version -ge 463872; then
+                 _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP"
+              fi
            fi
 
            for _libcurl_protocol in $_libcurl_protocols ; do
@@ -9819,6 +10822,18 @@ fi
 
 
 
+LIBEDIT_IS_UNICODE_DESCRIP="Libedit compiled for unicode"
+LIBEDIT_IS_UNICODE_OPTION=libedit
+LIBEDIT_IS_UNICODE_DIR=${LIBEDIT_DIR}
+
+PBX_LIBEDIT_IS_UNICODE=0
+
+
+
+
+
+
+
     LIBXML2_DESCRIP="LibXML2"
     LIBXML2_OPTION="libxml2"
     PBX_LIBXML2=0
@@ -10407,6 +11422,8 @@ fi
 
 
 
+if test "x${PBX_PJPROJECT}" != "x1" ; then
+
     PJPROJECT_DESCRIP="PJPROJECT"
     PJPROJECT_OPTION="pjproject"
     PBX_PJPROJECT=0
 
 
 
-    POPT_DESCRIP="popt"
-    POPT_OPTION="popt"
-    PBX_POPT=0
-
-# Check whether --with-popt was given.
-if test "${with_popt+set}" = set; then :
-  withval=$with_popt;
-       case ${withval} in
-       n|no)
-       USE_POPT=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_POPT=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} POPT"
-       ;;
-       *)
-       POPT_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} POPT"
-       ;;
-       esac
-
-fi
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DESCRIP="PJSIP Dialog Create UAS with Incremented Lock"
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_OPTION=pjsip
+PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR=${PJPROJECT_DIR}
 
+PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=0
 
 
 
@@ -10531,6 +11528,112 @@ PBX_PJSIP_EXTERNAL_RESOLVER=0
 
 
 
+PJSIP_TLS_TRANSPORT_PROTO_DESCRIP="PJSIP TLS Transport proto field support"
+PJSIP_TLS_TRANSPORT_PROTO_OPTION=pjsip
+PJSIP_TLS_TRANSPORT_PROTO_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_TLS_TRANSPORT_PROTO=0
+
+
+
+
+
+
+
+PJSIP_EVSUB_GRP_LOCK_DESCRIP="PJSIP EVSUB Group Lock support"
+PJSIP_EVSUB_GRP_LOCK_OPTION=pjsip
+PJSIP_EVSUB_GRP_LOCK_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_EVSUB_GRP_LOCK=0
+
+
+
+
+
+
+
+PJSIP_INV_SESSION_REF_DESCRIP="PJSIP INVITE Session Reference Count support"
+PJSIP_INV_SESSION_REF_OPTION=pjsip
+PJSIP_INV_SESSION_REF_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_INV_SESSION_REF=0
+
+
+
+
+
+
+
+PJSIP_AUTH_CLT_DEINIT_DESCRIP="pjsip_auth_clt_deinit support"
+PJSIP_AUTH_CLT_DEINIT_OPTION=pjsip
+PJSIP_AUTH_CLT_DEINIT_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_AUTH_CLT_DEINIT=0
+
+
+
+
+
+
+
+PJSIP_EVSUB_SET_UAS_TIMEOUT_DESCRIP="PJSIP EVSUB Set UAS Timeout support"
+PJSIP_EVSUB_SET_UAS_TIMEOUT_OPTION=pjsip
+PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT=0
+
+
+
+
+
+
+
+PJSIP_TSX_LAYER_FIND_TSX2_DESCRIP="pjsip_tsx_layer_find_tsx2 support"
+PJSIP_TSX_LAYER_FIND_TSX2_OPTION=pjsip
+PJSIP_TSX_LAYER_FIND_TSX2_DIR=${PJPROJECT_DIR}
+
+PBX_PJSIP_TSX_LAYER_FIND_TSX2=0
+
+
+
+
+
+
+fi
+
+
+    POPT_DESCRIP="popt"
+    POPT_OPTION="popt"
+    PBX_POPT=0
+
+# Check whether --with-popt was given.
+if test "${with_popt+set}" = set; then :
+  withval=$with_popt;
+       case ${withval} in
+       n|no)
+       USE_POPT=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_POPT=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} POPT"
+       ;;
+       *)
+       POPT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} POPT"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     PORTAUDIO_DESCRIP="PortAudio"
     PORTAUDIO_OPTION="portaudio"
     PBX_PORTAUDIO=0
 
 
 
+    FFTW3_DESCRIP="LIBFFTW3"
+    FFTW3_OPTION="fftw3"
+    PBX_FFTW3=0
+
+# Check whether --with-fftw3 was given.
+if test "${with_fftw3+set}" = set; then :
+  withval=$with_fftw3;
+       case ${withval} in
+       n|no)
+       USE_FFTW3=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_FFTW3=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} FFTW3"
+       ;;
+       *)
+       FFTW3_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} FFTW3"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     RESAMPLE_DESCRIP="LIBRESAMPLE"
     RESAMPLE_OPTION="resample"
     PBX_RESAMPLE=0
 
 
 
+    SNDFILE_DESCRIP="libsndfile"
+    SNDFILE_OPTION="sndfile"
+    PBX_SNDFILE=0
+
+# Check whether --with-sndfile was given.
+if test "${with_sndfile+set}" = set; then :
+  withval=$with_sndfile;
+       case ${withval} in
+       n|no)
+       USE_SNDFILE=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_SNDFILE=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} SNDFILE"
+       ;;
+       *)
+       SNDFILE_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SNDFILE"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     SDL_DESCRIP="Sdl"
     SDL_OPTION="sdl"
     PBX_SDL=0
 
 
 
-
-# Check whether --with-sounds-cache was given.
-if test "${with_sounds_cache+set}" = set; then :
-  withval=$with_sounds_cache;
-       case ${withval} in
-       n|no)
-               unset SOUNDS_CACHE_DIR
-               ;;
-       *)
-               if test "x${withval}" = "x"; then
-                       :
-               else
-                       SOUNDS_CACHE_DIR="${withval}"
-               fi
-               ;;
-       esac
-
-else
-  :
-fi
-
-
-
-
     SPANDSP_DESCRIP="SPANDSP"
     SPANDSP_OPTION="spandsp"
     PBX_SPANDSP=0
 
 
 
+SRTP_256_DESCRIP="SRTP Library AES-256 (ICM)"
+SRTP_256_OPTION=srtp
+SRTP_256_DIR=${SRTP_DIR}
+
+PBX_SRTP_256=0
+
+
+
+
+
+
+
+SRTP_192_DESCRIP="SRTP Library AES-192 (ICM)"
+SRTP_192_OPTION=srtp
+SRTP_192_DIR=${SRTP_DIR}
+
+PBX_SRTP_192=0
+
+
+
+
+
+
+
+SRTP_GCM_DESCRIP="SRTP Library AES-128 (GCM) and AES-256 (GCM)"
+SRTP_GCM_OPTION=srtp
+SRTP_GCM_DIR=${SRTP_DIR}
+
+PBX_SRTP_GCM=0
+
+
+
+
+
+
+
 SRTP_SHUTDOWN_DESCRIP="SRTP Library Shutdown Function"
 SRTP_SHUTDOWN_OPTION=srtp
 SRTP_SHUTDOWN_DIR=${SRTP_DIR}
 
 fi
 
+if test -z $ac_header_dirent -o "$ac_header_dirent" = "no"; then
+  as_fn_error $? "*** Could not find dirent header that defines 'DIR'." "$LINENO" 5
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
 if ${ac_cv_header_stdc+:} false; then :
@@ -12200,6 +13383,10 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
+if test "$ac_cv_header_stdc" != "yes"; then
+  as_fn_error $? "*** ANSI C header files not found." "$LINENO" 5
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
 if ${ac_cv_header_sys_wait_h+:} false; then :
@@ -12241,7 +13428,38 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
 fi
 
-for ac_header in arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/event.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h
+if test "$ac_cv_header_sys_wait_h" != "yes"; then
+  as_fn_error $? "*** POSIX.1 compatible sys/wait.h is required." "$LINENO" 5
+fi
+
+# Check for headers that are unconditionally required on all platforms.  Do not use
+# this to check for headers that are only needed by modules.
+for ac_header in  \
+  arpa/nameser.h assert.h ctype.h dlfcn.h errno.h fcntl.h float.h grp.h \
+  inttypes.h limits.h locale.h math.h pwd.h netinet/in.h regex.h resolv.h \
+  sched.h stdarg.h stdint.h stdio.h stdlib.h string.h syslog.h \
+  sys/file.h sys/ioctl.h sys/param.h sys/resource.h sys/socket.h sys/stat.h \
+  sys/time.h sys/types.h sys/un.h \
+  termios.h time.h unistd.h \
+
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+
+  as_fn_error $? "*** A required header was not found." "$LINENO" 5
+
+fi
+
+done
+
+
+for ac_header in arpa/inet.h libintl.h malloc.h netdb.h stddef.h strings.h sys/event.h utime.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -13697,7 +14915,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -13743,7 +14961,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -13767,7 +14985,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -13812,7 +15030,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -13836,7 +15054,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -15233,46 +16451,6 @@ _ACEOF
 
 rm -f conftest*
 
-if ${ac_cv_func_setvbuf_reversed+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_func_setvbuf_reversed=no
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if ${ac_cv_type_signal+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_type_signal=int
-else
-  ac_cv_type_signal=void
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
 if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
 
 
 
-# https support (in main/http.c) uses funopen on BSD systems,
-# fopencookie on linux
-for ac_func in funopen fopencookie
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
 for ac_func in inet_aton
 do :
   ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton"
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have usable eventfd support" >&5
+$as_echo_n "checking if we have usable eventfd support... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compile" >&5
+$as_echo "cross-compile" >&6; }
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/eventfd.h>
+int
+main ()
+{
+return eventfd(0, EFD_NONBLOCK | EFD_SEMAPHORE) == -1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_EVENTFD 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute pure' support" >&5
 $as_echo_n "checking for compiler 'attribute pure' support... " >&6; }
@@ -17613,10 +18809,80 @@ CFLAGS="$saved_CFLAGS"
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ffunction-sections support" >&5
-$as_echo_n "checking for -ffunction-sections support... " >&6; }
-saved_CFLAGS="${CFLAGS}"
-CFLAGS="${CFLAGS} -ffunction-sections"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute noreturn' support" >&5
+$as_echo_n "checking for compiler 'attribute noreturn' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+
+if test "xnoreturn" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((noreturn)) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
+
+  ;
+  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; }
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_noreturn 1
+_ACEOF
+
+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
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((noreturn)) *test(void *muffin, ...) ;
+int
+main ()
+{
+
+  ;
+  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; }
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_noreturn 1
+_ACEOF
+
+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
+fi
+
+
+CFLAGS="$saved_CFLAGS"
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=address support" >&5
+$as_echo_n "checking for -fsanitize=address support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
+LDFLAGS="-fsanitize=address"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -17631,11 +18897,25 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-       saved_LDFLAGS="${LDFLAGS}"
-       LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --gc-sections support" >&5
-$as_echo_n "checking for --gc-sections support... " >&6; }
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+       AST_ADDRESS_SANITIZER=1
+else
+  AST_ADDRESS_SANITIZER=0
+       { $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
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=thread support" >&5
+$as_echo_n "checking for -fsanitize=thread support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -pie -fPIE -fsanitize=thread"
+LDFLAGS="-fsanitize=thread -pie -fPIE"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -17646,27 +18926,83 @@ int x = 1;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-               GC_CFLAGS="-ffunction-sections"
-               GC_LDFLAGS="-Wl,--gc-sections"
+       AST_THREAD_SANITIZER=1
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  AST_THREAD_SANITIZER=0
+       { $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_exeext conftest.$ac_ext
-       LDFLAGS="${saved_LDFLAGS}"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=leak support" >&5
+$as_echo_n "checking for -fsanitize=leak support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=leak"
+LDFLAGS="-fsanitize=leak"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int x = 1;
+  ;
+  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; }
+       AST_LEAK_SANITIZER=1
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  AST_LEAK_SANITIZER=0
+       { $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
-CFLAGS="${saved_CFLAGS}"
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=undefined support" >&5
+$as_echo_n "checking for -fsanitize=undefined support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=undefined"
+LDFLAGS="-fsanitize=undefined"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int x = 1;
+  ;
+  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; }
+       AST_UNDEFINED_SANITIZER=1
+else
+  AST_UNDEFINED_SANITIZER=0
+       { $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
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wdeclaration-after-statement support" >&5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -march=native support" >&5
 $as_echo_n "checking for -march=native support... " >&6; }
 if $(${CC} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       if test "${CONFIG_CFLAGS}" = ""; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-               AST_NATIVE_ARCH=1
-       else
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: user CFLAGS present" >&5
-$as_echo "user CFLAGS present" >&6; }
-               AST_NATIVE_ARCH=
-       fi
+       AST_NATIVE_ARCH=1
 else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-       AST_NATIVE_ARCH=
+       AST_NATIVE_ARCH=0
 fi
 
 
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BIND_8_COMPAT required" >&5
+$as_echo_n "checking for BIND_8_COMPAT required... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#undef BIND_8_COMPAT
+#include <arpa/nameser.h>
+
+int
+main ()
+{
+int x = NXDOMAIN
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+BIND8_CFLAGS=-DBIND_8_COMPAT
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
 
     if test "x${PBX_GLOB_NOMAGIC}" != "x1"; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_NOMAGIC in glob.h" >&5
@@ -19125,7 +20482,8 @@ fi
 
 fi
 
-if test "x${OSARCH}" = "xlinux-gnu" ; then
+case "${OSARCH}" in
+linux*)
 
 if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
    pbxlibdir=""
@@ -19230,7 +20588,8 @@ _ACEOF
 fi
 
 
-fi
+  ;;
+esac
 
 
     if test "x${PBX_DAHDI}" != "x1"; then
    fi
 
       if test "$PBX_LIBEDIT" = "1"; then
-        LIBEDIT_INTERNAL="no"
+      LIBEDIT_INTERNAL="no"
       fi
    fi
    if test "${LIBEDIT_INTERNAL}" = "yes"; then
       PBX_LIBEDIT=1
+      LIBEDIT_IS_UNICODE=no
+   else
+
+    if test "x${PBX_LIBEDIT_IS_UNICODE}" != "x1" -a "${USE_LIBEDIT_IS_UNICODE}" != "no"; then
+        if test "xTesting for libedit unicode support" != "x"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Testing for libedit unicode support" >&5
+$as_echo_n "checking for Testing for libedit unicode support... " >&6; }
+       else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"el_rfunc_t *callback;\" compiles using histedit.h" >&5
+$as_echo_n "checking if \"el_rfunc_t *callback;\" compiles using histedit.h... " >&6; }
+       fi
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${LIBEDIT_IS_UNICODE_DIR}" != "x"; then
+           LIBEDIT_IS_UNICODE_INCLUDE="-I${LIBEDIT_IS_UNICODE_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${LIBEDIT_IS_UNICODE_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <histedit.h>
+int
+main ()
+{
+ el_rfunc_t *callback;;
+
+  ;
+  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_LIBEDIT_IS_UNICODE=1
+
+$as_echo "#define HAVE_LIBEDIT_IS_UNICODE 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
+
    fi
 fi
 
@@ -23030,7 +24436,7 @@ if test "x${PBX_UNBOUND}" != "x1" -a "${USE_UNBOUND}" != "no"; then
          pbxlibdir="-L${UNBOUND_DIR}"
       fi
    fi
-   pbxfuncname="ub_ctx_add_ta_autr"
+   pbxfuncname="ub_ctx_delete"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
       AST_UNBOUND_FOUND=yes
    else
 
 
 
+    if test "x${PBX_UNBOUND_CONST_PARAMS}" != "x1" -a "${USE_UNBOUND_CONST_PARAMS}" != "no"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UNBOUND_VERSION_MAJOR declared in unbound.h" >&5
+$as_echo_n "checking for UNBOUND_VERSION_MAJOR declared in unbound.h... " >&6; }
+        saved_cppflags="${CPPFLAGS}"
+        if test "x${UNBOUND_CONST_PARAMS_DIR}" != "x"; then
+            UNBOUND_CONST_PARAMS_INCLUDE="-I${UNBOUND_CONST_PARAMS_DIR}/include"
+        fi
+        CPPFLAGS="${CPPFLAGS} ${UNBOUND_CONST_PARAMS_INCLUDE}"
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <unbound.h>
+int
+main ()
+{
+#if !defined(UNBOUND_VERSION_MAJOR)
+                                    (void) UNBOUND_VERSION_MAJOR;
+                                #endif
+
+  ;
+  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_UNBOUND_CONST_PARAMS=1
+
+$as_echo "#define HAVE_UNBOUND_CONST_PARAMS 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_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
    pbxlibdir=""
@@ -24293,6 +25742,8 @@ $as_echo "$as_me: *** including --without-postgres" >&6;}
    fi
 fi
 
+if test "$USE_PJPROJECT" != "no" ; then
+   if test "$PJPROJECT_BUNDLED" = "no" ; then
 
    if test "x${PBX_PJPROJECT}" != "x1" -a "${USE_PJPROJECT}" != "no"; then
 
 
 
 
+if test "x${PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK}" != "x1" -a "${USE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK}" != "no"; then
+   pbxlibdir=""
+   # 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
+      if test -d ${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}/lib"
+      else
+         pbxlibdir="-L${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR}"
+      fi
+   fi
+   pbxfuncname="pjsip_dlg_create_uas_and_inc_lock"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_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_DLG_CREATE_UAS_AND_INC_LOCK_FOUND=yes
+else
+  AST_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   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"
+      # 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"
+      fi
+      PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE="${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then  # no header, assume found
+         PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_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_DLG_CREATE_UAS_AND_INC_LOCK_HEADER_FOUND=1
+else
+  PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_HEADER_FOUND}" = "x0" ; then
+         PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB=""
+         PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB=""
+         fi
+         PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
 if test "x${PBX_PJ_TRANSACTION_GRP_LOCK}" != "x1" -a "${USE_PJ_TRANSACTION_GRP_LOCK}" != "no"; then
    pbxlibdir=""
    # if --with-PJ_TRANSACTION_GRP_LOCK=DIR has been specified, use it.
@@ -24406,7 +25961,7 @@ 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"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24448,7 +26003,7 @@ fi
 
    # now check for the header.
    if test "${AST_PJ_TRANSACTION_GRP_LOCK_FOUND}" = "yes"; then
-      PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS"
+      PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
       # if --with-PJ_TRANSACTION_GRP_LOCK=DIR has been specified, use it.
       if test "x${PJ_TRANSACTION_GRP_LOCK_DIR}" != "x"; then
          PJ_TRANSACTION_GRP_LOCK_INCLUDE="-I${PJ_TRANSACTION_GRP_LOCK_DIR}/include"
 
 
 
-saved_cppflags="${CPPFLAGS}"
-saved_libs="${LIBS}"
-CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
-LIBS="${LIBS} ${PJPROJECT_LIBS}"
+      saved_cppflags="${CPPFLAGS}"
+      saved_libs="${LIBS}"
+      CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
+      LIBS="${LIBS} ${PJPROJECT_LIB}"
 
     if test "x${PBX_PJSIP_REPLACE_MEDIA_STREAM}" != "x1" -a "${USE_PJSIP_REPLACE_MEDIA_STREAM}" != "no"; then
         if test "x" != "x"; then
@@ -24536,8 +26091,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
 
-LIBS="${saved_libs}"
-CPPFLAGS="${saved_cppflags}"
+      LIBS="${saved_libs}"
+      CPPFLAGS="${saved_cppflags}"
 
 
 if test "x${PBX_PJSIP_GET_DEST_INFO}" != "x1" -a "${USE_PJSIP_GET_DEST_INFO}" != "no"; then
@@ -24563,7 +26118,7 @@ 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"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24605,7 +26160,7 @@ 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"
+      PJSIP_GET_DEST_INFO_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
       # 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"
@@ -24667,7 +26222,7 @@ if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpj ${pbxlibdir} $PJPROJECT_LIBS $LIBS"
+LIBS="-lpj ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24709,7 +26264,7 @@ fi
 
    # now check for the header.
    if test "${AST_PJ_SSL_CERT_LOAD_FROM_FILES2_FOUND}" = "yes"; then
-      PJ_SSL_CERT_LOAD_FROM_FILES2_LIB="${pbxlibdir} -lpj $PJPROJECT_LIBS"
+      PJ_SSL_CERT_LOAD_FROM_FILES2_LIB="${pbxlibdir} -lpj $PJPROJECT_LIB"
       # if --with-PJ_SSL_CERT_LOAD_FROM_FILES2=DIR has been specified, use it.
       if test "x${PJ_SSL_CERT_LOAD_FROM_FILES2_DIR}" != "x"; then
          PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE="-I${PJ_SSL_CERT_LOAD_FROM_FILES2_DIR}/include"
 
 
 
+      saved_cppflags="${CPPFLAGS}"
+      saved_libs="${LIBS}"
+      CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}"
+      LIBS="${LIBS} ${PJPROJECT_LIB}"
 
-if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
+    if test "x${PBX_PJSIP_TLS_TRANSPORT_PROTO}" != "x1" -a "${USE_PJSIP_TLS_TRANSPORT_PROTO}" != "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 \"struct pjsip_tls_setting setting; int proto; proto = setting.proto;\" compiles using pjsip.h" >&5
+$as_echo_n "checking if \"struct pjsip_tls_setting setting; int proto; proto = setting.proto;\" compiles using pjsip.h... " >&6; }
+       fi
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${PJSIP_TLS_TRANSPORT_PROTO_DIR}" != "x"; then
+           PJSIP_TLS_TRANSPORT_PROTO_INCLUDE="-I${PJSIP_TLS_TRANSPORT_PROTO_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${PJSIP_TLS_TRANSPORT_PROTO_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <pjsip.h>
+int
+main ()
+{
+ struct pjsip_tls_setting setting; int proto; proto = setting.proto;;
+
+  ;
+  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_TLS_TRANSPORT_PROTO=1
+
+$as_echo "#define HAVE_PJSIP_TLS_TRANSPORT_PROTO 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
+
+      LIBS="${saved_libs}"
+      CPPFLAGS="${saved_cppflags}"
+
+
+if test "x${PBX_PJSIP_EVSUB_GRP_LOCK}" != "x1" -a "${USE_PJSIP_EVSUB_GRP_LOCK}" != "no"; then
    pbxlibdir=""
-   # if --with-POPT=DIR has been specified, use it.
-   if test "x${POPT_DIR}" != "x"; then
-      if test -d ${POPT_DIR}/lib; then
-         pbxlibdir="-L${POPT_DIR}/lib"
+   # if --with-PJSIP_EVSUB_GRP_LOCK=DIR has been specified, use it.
+   if test "x${PJSIP_EVSUB_GRP_LOCK_DIR}" != "x"; then
+      if test -d ${PJSIP_EVSUB_GRP_LOCK_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_EVSUB_GRP_LOCK_DIR}/lib"
       else
-         pbxlibdir="-L${POPT_DIR}"
+         pbxlibdir="-L${PJSIP_EVSUB_GRP_LOCK_DIR}"
       fi
    fi
-   pbxfuncname="poptStrerror"
+   pbxfuncname="pjsip_evsub_add_ref"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_POPT_FOUND=yes
+      AST_PJSIP_EVSUB_GRP_LOCK_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_popt_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpopt" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lpopt... " >&6; }
+      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="-lpopt ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24908,47 +26515,47 @@ 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_POPT_FOUND=yes
+  AST_PJSIP_EVSUB_GRP_LOCK_FOUND=yes
 else
-  AST_POPT_FOUND=no
+  AST_PJSIP_EVSUB_GRP_LOCK_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_POPT_FOUND}" = "yes"; then
-      POPT_LIB="${pbxlibdir} -lpopt "
-      # if --with-POPT=DIR has been specified, use it.
-      if test "x${POPT_DIR}" != "x"; then
-         POPT_INCLUDE="-I${POPT_DIR}/include"
+   if test "${AST_PJSIP_EVSUB_GRP_LOCK_FOUND}" = "yes"; then
+      PJSIP_EVSUB_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # if --with-PJSIP_EVSUB_GRP_LOCK=DIR has been specified, use it.
+      if test "x${PJSIP_EVSUB_GRP_LOCK_DIR}" != "x"; then
+         PJSIP_EVSUB_GRP_LOCK_INCLUDE="-I${PJSIP_EVSUB_GRP_LOCK_DIR}/include"
       fi
-      POPT_INCLUDE="${POPT_INCLUDE} "
-      if test "xpopt.h" = "x" ; then   # no header, assume found
-         POPT_HEADER_FOUND="1"
+      PJSIP_EVSUB_GRP_LOCK_INCLUDE="${PJSIP_EVSUB_GRP_LOCK_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then  # no header, assume found
+         PJSIP_EVSUB_GRP_LOCK_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${POPT_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "popt.h" "ac_cv_header_popt_h" "$ac_includes_default"
-if test "x$ac_cv_header_popt_h" = xyes; then :
-  POPT_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_EVSUB_GRP_LOCK_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_EVSUB_GRP_LOCK_HEADER_FOUND=1
 else
-  POPT_HEADER_FOUND=0
+  PJSIP_EVSUB_GRP_LOCK_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${POPT_HEADER_FOUND}" = "x0" ; then
-         POPT_LIB=""
-         POPT_INCLUDE=""
+      if test "x${PJSIP_EVSUB_GRP_LOCK_HEADER_FOUND}" = "x0" ; then
+         PJSIP_EVSUB_GRP_LOCK_LIB=""
+         PJSIP_EVSUB_GRP_LOCK_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            POPT_LIB=""
+            PJSIP_EVSUB_GRP_LOCK_LIB=""
          fi
-         PBX_POPT=1
+         PBX_PJSIP_EVSUB_GRP_LOCK=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_POPT 1
+#define HAVE_PJSIP_EVSUB_GRP_LOCK 1
 _ACEOF
 
       fi
 
 
 
-
-if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
+if test "x${PBX_PJSIP_INV_SESSION_REF}" != "x1" -a "${USE_PJSIP_INV_SESSION_REF}" != "no"; then
    pbxlibdir=""
-   # if --with-PORTAUDIO=DIR has been specified, use it.
-   if test "x${PORTAUDIO_DIR}" != "x"; then
-      if test -d ${PORTAUDIO_DIR}/lib; then
-         pbxlibdir="-L${PORTAUDIO_DIR}/lib"
+   # if --with-PJSIP_INV_SESSION_REF=DIR has been specified, use it.
+   if test "x${PJSIP_INV_SESSION_REF_DIR}" != "x"; then
+      if test -d ${PJSIP_INV_SESSION_REF_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_INV_SESSION_REF_DIR}/lib"
       else
-         pbxlibdir="-L${PORTAUDIO_DIR}"
+         pbxlibdir="-L${PJSIP_INV_SESSION_REF_DIR}"
       fi
    fi
-   pbxfuncname="Pa_GetDeviceCount"
+   pbxfuncname="pjsip_inv_add_ref"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PORTAUDIO_FOUND=yes
+      AST_PJSIP_INV_SESSION_REF_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_portaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lportaudio" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lportaudio... " >&6; }
+      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="-lportaudio ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25013,47 +26619,47 @@ 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_PORTAUDIO_FOUND=yes
+  AST_PJSIP_INV_SESSION_REF_FOUND=yes
 else
-  AST_PORTAUDIO_FOUND=no
+  AST_PJSIP_INV_SESSION_REF_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PORTAUDIO_FOUND}" = "yes"; then
-      PORTAUDIO_LIB="${pbxlibdir} -lportaudio "
-      # if --with-PORTAUDIO=DIR has been specified, use it.
-      if test "x${PORTAUDIO_DIR}" != "x"; then
-         PORTAUDIO_INCLUDE="-I${PORTAUDIO_DIR}/include"
+   if test "${AST_PJSIP_INV_SESSION_REF_FOUND}" = "yes"; then
+      PJSIP_INV_SESSION_REF_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # if --with-PJSIP_INV_SESSION_REF=DIR has been specified, use it.
+      if test "x${PJSIP_INV_SESSION_REF_DIR}" != "x"; then
+         PJSIP_INV_SESSION_REF_INCLUDE="-I${PJSIP_INV_SESSION_REF_DIR}/include"
       fi
-      PORTAUDIO_INCLUDE="${PORTAUDIO_INCLUDE} "
-      if test "xportaudio.h" = "x" ; then      # no header, assume found
-         PORTAUDIO_HEADER_FOUND="1"
+      PJSIP_INV_SESSION_REF_INCLUDE="${PJSIP_INV_SESSION_REF_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then  # no header, assume found
+         PJSIP_INV_SESSION_REF_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PORTAUDIO_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "portaudio.h" "ac_cv_header_portaudio_h" "$ac_includes_default"
-if test "x$ac_cv_header_portaudio_h" = xyes; then :
-  PORTAUDIO_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_INV_SESSION_REF_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_INV_SESSION_REF_HEADER_FOUND=1
 else
-  PORTAUDIO_HEADER_FOUND=0
+  PJSIP_INV_SESSION_REF_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PORTAUDIO_HEADER_FOUND}" = "x0" ; then
-         PORTAUDIO_LIB=""
-         PORTAUDIO_INCLUDE=""
+      if test "x${PJSIP_INV_SESSION_REF_HEADER_FOUND}" = "x0" ; then
+         PJSIP_INV_SESSION_REF_LIB=""
+         PJSIP_INV_SESSION_REF_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PORTAUDIO_LIB=""
+            PJSIP_INV_SESSION_REF_LIB=""
          fi
-         PBX_PORTAUDIO=1
+         PBX_PJSIP_INV_SESSION_REF=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PORTAUDIO 1
+#define HAVE_PJSIP_INV_SESSION_REF 1
 _ACEOF
 
       fi
 
 
 
-
-if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
+if test "x${PBX_PJSIP_AUTH_CLT_DEINIT}" != "x1" -a "${USE_PJSIP_AUTH_CLT_DEINIT}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI=DIR has been specified, use it.
-   if test "x${PRI_DIR}" != "x"; then
-      if test -d ${PRI_DIR}/lib; then
-         pbxlibdir="-L${PRI_DIR}/lib"
+   # if --with-PJSIP_AUTH_CLT_DEINIT=DIR has been specified, use it.
+   if test "x${PJSIP_AUTH_CLT_DEINIT_DIR}" != "x"; then
+      if test -d ${PJSIP_AUTH_CLT_DEINIT_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_AUTH_CLT_DEINIT_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_DIR}"
+         pbxlibdir="-L${PJSIP_AUTH_CLT_DEINIT_DIR}"
       fi
    fi
-   pbxfuncname="pri_connected_line_update"
+   pbxfuncname="pjsip_auth_clt_deinit"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_FOUND=yes
+      AST_PJSIP_AUTH_CLT_DEINIT_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
+      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="-lpri ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25118,47 +26723,47 @@ 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_PRI_FOUND=yes
+  AST_PJSIP_AUTH_CLT_DEINIT_FOUND=yes
 else
-  AST_PRI_FOUND=no
+  AST_PJSIP_AUTH_CLT_DEINIT_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_FOUND}" = "yes"; then
-      PRI_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI=DIR has been specified, use it.
-      if test "x${PRI_DIR}" != "x"; then
-         PRI_INCLUDE="-I${PRI_DIR}/include"
+   if test "${AST_PJSIP_AUTH_CLT_DEINIT_FOUND}" = "yes"; then
+      PJSIP_AUTH_CLT_DEINIT_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # if --with-PJSIP_AUTH_CLT_DEINIT=DIR has been specified, use it.
+      if test "x${PJSIP_AUTH_CLT_DEINIT_DIR}" != "x"; then
+         PJSIP_AUTH_CLT_DEINIT_INCLUDE="-I${PJSIP_AUTH_CLT_DEINIT_DIR}/include"
       fi
-      PRI_INCLUDE="${PRI_INCLUDE} "
-      if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_HEADER_FOUND="1"
+      PJSIP_AUTH_CLT_DEINIT_INCLUDE="${PJSIP_AUTH_CLT_DEINIT_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then  # no header, assume found
+         PJSIP_AUTH_CLT_DEINIT_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_AUTH_CLT_DEINIT_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_AUTH_CLT_DEINIT_HEADER_FOUND=1
 else
-  PRI_HEADER_FOUND=0
+  PJSIP_AUTH_CLT_DEINIT_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_HEADER_FOUND}" = "x0" ; then
-         PRI_LIB=""
-         PRI_INCLUDE=""
+      if test "x${PJSIP_AUTH_CLT_DEINIT_HEADER_FOUND}" = "x0" ; then
+         PJSIP_AUTH_CLT_DEINIT_LIB=""
+         PJSIP_AUTH_CLT_DEINIT_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_LIB=""
+            PJSIP_AUTH_CLT_DEINIT_LIB=""
          fi
-         PBX_PRI=1
+         PBX_PJSIP_AUTH_CLT_DEINIT=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI 1
+#define HAVE_PJSIP_AUTH_CLT_DEINIT 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_SETUP_ACK_INBAND}" != "x1" -a "${USE_PRI_SETUP_ACK_INBAND}" != "no"; then
+if test "x${PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT}" != "x1" -a "${USE_PJSIP_EVSUB_SET_UAS_TIMEOUT}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_SETUP_ACK_INBAND=DIR has been specified, use it.
-   if test "x${PRI_SETUP_ACK_INBAND_DIR}" != "x"; then
-      if test -d ${PRI_SETUP_ACK_INBAND_DIR}/lib; then
-         pbxlibdir="-L${PRI_SETUP_ACK_INBAND_DIR}/lib"
+   # if --with-PJSIP_EVSUB_SET_UAS_TIMEOUT=DIR has been specified, use it.
+   if test "x${PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR}" != "x"; then
+      if test -d ${PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_SETUP_ACK_INBAND_DIR}"
+         pbxlibdir="-L${PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR}"
       fi
    fi
-   pbxfuncname="pri_setup_ack"
+   pbxfuncname="pjsip_evsub_set_uas_timeout"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_SETUP_ACK_INBAND_FOUND=yes
+      AST_PJSIP_EVSUB_SET_UAS_TIMEOUT_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
+      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="-lpri ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25222,47 +26827,47 @@ 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_PRI_SETUP_ACK_INBAND_FOUND=yes
+  AST_PJSIP_EVSUB_SET_UAS_TIMEOUT_FOUND=yes
 else
-  AST_PRI_SETUP_ACK_INBAND_FOUND=no
+  AST_PJSIP_EVSUB_SET_UAS_TIMEOUT_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_SETUP_ACK_INBAND_FOUND}" = "yes"; then
-      PRI_SETUP_ACK_INBAND_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_SETUP_ACK_INBAND=DIR has been specified, use it.
-      if test "x${PRI_SETUP_ACK_INBAND_DIR}" != "x"; then
-         PRI_SETUP_ACK_INBAND_INCLUDE="-I${PRI_SETUP_ACK_INBAND_DIR}/include"
+   if test "${AST_PJSIP_EVSUB_SET_UAS_TIMEOUT_FOUND}" = "yes"; then
+      PJSIP_EVSUB_SET_UAS_TIMEOUT_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # if --with-PJSIP_EVSUB_SET_UAS_TIMEOUT=DIR has been specified, use it.
+      if test "x${PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR}" != "x"; then
+         PJSIP_EVSUB_SET_UAS_TIMEOUT_INCLUDE="-I${PJSIP_EVSUB_SET_UAS_TIMEOUT_DIR}/include"
       fi
-      PRI_SETUP_ACK_INBAND_INCLUDE="${PRI_SETUP_ACK_INBAND_INCLUDE} "
-      if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_SETUP_ACK_INBAND_HEADER_FOUND="1"
+      PJSIP_EVSUB_SET_UAS_TIMEOUT_INCLUDE="${PJSIP_EVSUB_SET_UAS_TIMEOUT_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then  # no header, assume found
+         PJSIP_EVSUB_SET_UAS_TIMEOUT_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_SETUP_ACK_INBAND_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_SETUP_ACK_INBAND_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_EVSUB_SET_UAS_TIMEOUT_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_EVSUB_SET_UAS_TIMEOUT_HEADER_FOUND=1
 else
-  PRI_SETUP_ACK_INBAND_HEADER_FOUND=0
+  PJSIP_EVSUB_SET_UAS_TIMEOUT_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_SETUP_ACK_INBAND_HEADER_FOUND}" = "x0" ; then
-         PRI_SETUP_ACK_INBAND_LIB=""
-         PRI_SETUP_ACK_INBAND_INCLUDE=""
+      if test "x${PJSIP_EVSUB_SET_UAS_TIMEOUT_HEADER_FOUND}" = "x0" ; then
+         PJSIP_EVSUB_SET_UAS_TIMEOUT_LIB=""
+         PJSIP_EVSUB_SET_UAS_TIMEOUT_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_SETUP_ACK_INBAND_LIB=""
+            PJSIP_EVSUB_SET_UAS_TIMEOUT_LIB=""
          fi
-         PBX_PRI_SETUP_ACK_INBAND=1
+         PBX_PJSIP_EVSUB_SET_UAS_TIMEOUT=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_SETUP_ACK_INBAND 1
+#define HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_L2_PERSISTENCE}" != "x1" -a "${USE_PRI_L2_PERSISTENCE}" != "no"; then
+if test "x${PBX_PJSIP_TSX_LAYER_FIND_TSX2}" != "x1" -a "${USE_PJSIP_TSX_LAYER_FIND_TSX2}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_L2_PERSISTENCE=DIR has been specified, use it.
-   if test "x${PRI_L2_PERSISTENCE_DIR}" != "x"; then
-      if test -d ${PRI_L2_PERSISTENCE_DIR}/lib; then
-         pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}/lib"
+   # if --with-PJSIP_TSX_LAYER_FIND_TSX2=DIR has been specified, use it.
+   if test "x${PJSIP_TSX_LAYER_FIND_TSX2_DIR}" != "x"; then
+      if test -d ${PJSIP_TSX_LAYER_FIND_TSX2_DIR}/lib; then
+         pbxlibdir="-L${PJSIP_TSX_LAYER_FIND_TSX2_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}"
+         pbxlibdir="-L${PJSIP_TSX_LAYER_FIND_TSX2_DIR}"
       fi
    fi
-   pbxfuncname="pri_persistent_layer2_option"
+   pbxfuncname="pjsip_tsx_layer_find_tsx2"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_L2_PERSISTENCE_FOUND=yes
+      AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
+      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="-lpri ${pbxlibdir}  $LIBS"
+LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25326,47 +26931,47 @@ 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_PRI_L2_PERSISTENCE_FOUND=yes
+  AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND=yes
 else
-  AST_PRI_L2_PERSISTENCE_FOUND=no
+  AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_L2_PERSISTENCE_FOUND}" = "yes"; then
-      PRI_L2_PERSISTENCE_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_L2_PERSISTENCE=DIR has been specified, use it.
-      if test "x${PRI_L2_PERSISTENCE_DIR}" != "x"; then
-         PRI_L2_PERSISTENCE_INCLUDE="-I${PRI_L2_PERSISTENCE_DIR}/include"
+   if test "${AST_PJSIP_TSX_LAYER_FIND_TSX2_FOUND}" = "yes"; then
+      PJSIP_TSX_LAYER_FIND_TSX2_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB"
+      # if --with-PJSIP_TSX_LAYER_FIND_TSX2=DIR has been specified, use it.
+      if test "x${PJSIP_TSX_LAYER_FIND_TSX2_DIR}" != "x"; then
+         PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE="-I${PJSIP_TSX_LAYER_FIND_TSX2_DIR}/include"
       fi
-      PRI_L2_PERSISTENCE_INCLUDE="${PRI_L2_PERSISTENCE_INCLUDE} "
-      if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_L2_PERSISTENCE_HEADER_FOUND="1"
+      PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE="${PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE} $PJPROJECT_CFLAGS"
+      if test "xpjsip.h" = "x" ; then  # no header, assume found
+         PJSIP_TSX_LAYER_FIND_TSX2_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_L2_PERSISTENCE_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_L2_PERSISTENCE_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PJSIP_TSX_LAYER_FIND_TSX2_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_TSX_LAYER_FIND_TSX2_HEADER_FOUND=1
 else
-  PRI_L2_PERSISTENCE_HEADER_FOUND=0
+  PJSIP_TSX_LAYER_FIND_TSX2_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_L2_PERSISTENCE_HEADER_FOUND}" = "x0" ; then
-         PRI_L2_PERSISTENCE_LIB=""
-         PRI_L2_PERSISTENCE_INCLUDE=""
+      if test "x${PJSIP_TSX_LAYER_FIND_TSX2_HEADER_FOUND}" = "x0" ; then
+         PJSIP_TSX_LAYER_FIND_TSX2_LIB=""
+         PJSIP_TSX_LAYER_FIND_TSX2_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_L2_PERSISTENCE_LIB=""
+            PJSIP_TSX_LAYER_FIND_TSX2_LIB=""
          fi
-         PBX_PRI_L2_PERSISTENCE=1
+         PBX_PJSIP_TSX_LAYER_FIND_TSX2=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_L2_PERSISTENCE 1
+#define HAVE_PJSIP_TSX_LAYER_FIND_TSX2 1
 _ACEOF
 
       fi
@@ -25374,31 +26979,125 @@ _ACEOF
 fi
 
 
+   fi
+fi
 
-if test "x${PBX_PRI_DATETIME_SEND}" != "x1" -a "${USE_PRI_DATETIME_SEND}" != "no"; then
+
+
+
+   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\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "python") 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`
+                     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\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "python") 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`
+                     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" 2>&1`
+        else
+               PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python" 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_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_DATETIME_SEND=DIR has been specified, use it.
-   if test "x${PRI_DATETIME_SEND_DIR}" != "x"; then
-      if test -d ${PRI_DATETIME_SEND_DIR}/lib; then
-         pbxlibdir="-L${PRI_DATETIME_SEND_DIR}/lib"
+   # if --with-POPT=DIR has been specified, use it.
+   if test "x${POPT_DIR}" != "x"; then
+      if test -d ${POPT_DIR}/lib; then
+         pbxlibdir="-L${POPT_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_DATETIME_SEND_DIR}"
+         pbxlibdir="-L${POPT_DIR}"
       fi
    fi
-   pbxfuncname="pri_date_time_send_option"
+   pbxfuncname="poptStrerror"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_DATETIME_SEND_FOUND=yes
+      AST_POPT_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_popt_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpopt" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpopt... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpri ${pbxlibdir}  $LIBS"
+LIBS="-lpopt ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25430,47 +27129,47 @@ 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_PRI_DATETIME_SEND_FOUND=yes
+  AST_POPT_FOUND=yes
 else
-  AST_PRI_DATETIME_SEND_FOUND=no
+  AST_POPT_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_DATETIME_SEND_FOUND}" = "yes"; then
-      PRI_DATETIME_SEND_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_DATETIME_SEND=DIR has been specified, use it.
-      if test "x${PRI_DATETIME_SEND_DIR}" != "x"; then
-         PRI_DATETIME_SEND_INCLUDE="-I${PRI_DATETIME_SEND_DIR}/include"
+   if test "${AST_POPT_FOUND}" = "yes"; then
+      POPT_LIB="${pbxlibdir} -lpopt "
+      # if --with-POPT=DIR has been specified, use it.
+      if test "x${POPT_DIR}" != "x"; then
+         POPT_INCLUDE="-I${POPT_DIR}/include"
       fi
-      PRI_DATETIME_SEND_INCLUDE="${PRI_DATETIME_SEND_INCLUDE} "
-      if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_DATETIME_SEND_HEADER_FOUND="1"
+      POPT_INCLUDE="${POPT_INCLUDE} "
+      if test "xpopt.h" = "x" ; then   # no header, assume found
+         POPT_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_DATETIME_SEND_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_DATETIME_SEND_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${POPT_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "popt.h" "ac_cv_header_popt_h" "$ac_includes_default"
+if test "x$ac_cv_header_popt_h" = xyes; then :
+  POPT_HEADER_FOUND=1
 else
-  PRI_DATETIME_SEND_HEADER_FOUND=0
+  POPT_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_DATETIME_SEND_HEADER_FOUND}" = "x0" ; then
-         PRI_DATETIME_SEND_LIB=""
-         PRI_DATETIME_SEND_INCLUDE=""
+      if test "x${POPT_HEADER_FOUND}" = "x0" ; then
+         POPT_LIB=""
+         POPT_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_DATETIME_SEND_LIB=""
+            POPT_LIB=""
          fi
-         PBX_PRI_DATETIME_SEND=1
+         PBX_POPT=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_DATETIME_SEND 1
+#define HAVE_POPT 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_MWI_V2}" != "x1" -a "${USE_PRI_MWI_V2}" != "no"; then
+
+if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_MWI_V2=DIR has been specified, use it.
-   if test "x${PRI_MWI_V2_DIR}" != "x"; then
-      if test -d ${PRI_MWI_V2_DIR}/lib; then
-         pbxlibdir="-L${PRI_MWI_V2_DIR}/lib"
+   # if --with-PORTAUDIO=DIR has been specified, use it.
+   if test "x${PORTAUDIO_DIR}" != "x"; then
+      if test -d ${PORTAUDIO_DIR}/lib; then
+         pbxlibdir="-L${PORTAUDIO_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_MWI_V2_DIR}"
+         pbxlibdir="-L${PORTAUDIO_DIR}"
       fi
    fi
-   pbxfuncname="pri_mwi_indicate_v2"
+   pbxfuncname="Pa_GetDeviceCount"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_MWI_V2_FOUND=yes
+      AST_PORTAUDIO_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_portaudio_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lportaudio" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lportaudio... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpri ${pbxlibdir}  $LIBS"
+LIBS="-lportaudio ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25534,47 +27234,47 @@ 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_PRI_MWI_V2_FOUND=yes
+  AST_PORTAUDIO_FOUND=yes
 else
-  AST_PRI_MWI_V2_FOUND=no
+  AST_PORTAUDIO_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_MWI_V2_FOUND}" = "yes"; then
-      PRI_MWI_V2_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_MWI_V2=DIR has been specified, use it.
-      if test "x${PRI_MWI_V2_DIR}" != "x"; then
-         PRI_MWI_V2_INCLUDE="-I${PRI_MWI_V2_DIR}/include"
+   if test "${AST_PORTAUDIO_FOUND}" = "yes"; then
+      PORTAUDIO_LIB="${pbxlibdir} -lportaudio "
+      # if --with-PORTAUDIO=DIR has been specified, use it.
+      if test "x${PORTAUDIO_DIR}" != "x"; then
+         PORTAUDIO_INCLUDE="-I${PORTAUDIO_DIR}/include"
       fi
-      PRI_MWI_V2_INCLUDE="${PRI_MWI_V2_INCLUDE} "
-      if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_MWI_V2_HEADER_FOUND="1"
+      PORTAUDIO_INCLUDE="${PORTAUDIO_INCLUDE} "
+      if test "xportaudio.h" = "x" ; then      # no header, assume found
+         PORTAUDIO_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_MWI_V2_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_MWI_V2_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PORTAUDIO_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "portaudio.h" "ac_cv_header_portaudio_h" "$ac_includes_default"
+if test "x$ac_cv_header_portaudio_h" = xyes; then :
+  PORTAUDIO_HEADER_FOUND=1
 else
-  PRI_MWI_V2_HEADER_FOUND=0
+  PORTAUDIO_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_MWI_V2_HEADER_FOUND}" = "x0" ; then
-         PRI_MWI_V2_LIB=""
-         PRI_MWI_V2_INCLUDE=""
+      if test "x${PORTAUDIO_HEADER_FOUND}" = "x0" ; then
+         PORTAUDIO_LIB=""
+         PORTAUDIO_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_MWI_V2_LIB=""
+            PORTAUDIO_LIB=""
          fi
-         PBX_PRI_MWI_V2=1
+         PBX_PORTAUDIO=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_MWI_V2 1
+#define HAVE_PORTAUDIO 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_DISPLAY_TEXT}" != "x1" -a "${USE_PRI_DISPLAY_TEXT}" != "no"; then
+
+if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_DISPLAY_TEXT=DIR has been specified, use it.
-   if test "x${PRI_DISPLAY_TEXT_DIR}" != "x"; then
-      if test -d ${PRI_DISPLAY_TEXT_DIR}/lib; then
-         pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}/lib"
+   # if --with-PRI=DIR has been specified, use it.
+   if test "x${PRI_DIR}" != "x"; then
+      if test -d ${PRI_DIR}/lib; then
+         pbxlibdir="-L${PRI_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}"
+         pbxlibdir="-L${PRI_DIR}"
       fi
    fi
-   pbxfuncname="pri_display_text"
+   pbxfuncname="pri_connected_line_update"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_DISPLAY_TEXT_FOUND=yes
+      AST_PRI_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -25638,47 +27339,47 @@ 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_PRI_DISPLAY_TEXT_FOUND=yes
+  AST_PRI_FOUND=yes
 else
-  AST_PRI_DISPLAY_TEXT_FOUND=no
+  AST_PRI_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_DISPLAY_TEXT_FOUND}" = "yes"; then
-      PRI_DISPLAY_TEXT_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_DISPLAY_TEXT=DIR has been specified, use it.
-      if test "x${PRI_DISPLAY_TEXT_DIR}" != "x"; then
-         PRI_DISPLAY_TEXT_INCLUDE="-I${PRI_DISPLAY_TEXT_DIR}/include"
+   if test "${AST_PRI_FOUND}" = "yes"; then
+      PRI_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI=DIR has been specified, use it.
+      if test "x${PRI_DIR}" != "x"; then
+         PRI_INCLUDE="-I${PRI_DIR}/include"
       fi
-      PRI_DISPLAY_TEXT_INCLUDE="${PRI_DISPLAY_TEXT_INCLUDE} "
+      PRI_INCLUDE="${PRI_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_DISPLAY_TEXT_HEADER_FOUND="1"
+         PRI_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_DISPLAY_TEXT_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_DISPLAY_TEXT_HEADER_FOUND=1
+  PRI_HEADER_FOUND=1
 else
-  PRI_DISPLAY_TEXT_HEADER_FOUND=0
+  PRI_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_DISPLAY_TEXT_HEADER_FOUND}" = "x0" ; then
-         PRI_DISPLAY_TEXT_LIB=""
-         PRI_DISPLAY_TEXT_INCLUDE=""
+      if test "x${PRI_HEADER_FOUND}" = "x0" ; then
+         PRI_LIB=""
+         PRI_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_DISPLAY_TEXT_LIB=""
+            PRI_LIB=""
          fi
-         PBX_PRI_DISPLAY_TEXT=1
+         PBX_PRI=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_DISPLAY_TEXT 1
+#define HAVE_PRI 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_MWI}" != "x1" -a "${USE_PRI_MWI}" != "no"; then
+if test "x${PBX_PRI_SETUP_ACK_INBAND}" != "x1" -a "${USE_PRI_SETUP_ACK_INBAND}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_MWI=DIR has been specified, use it.
-   if test "x${PRI_MWI_DIR}" != "x"; then
-      if test -d ${PRI_MWI_DIR}/lib; then
-         pbxlibdir="-L${PRI_MWI_DIR}/lib"
+   # if --with-PRI_SETUP_ACK_INBAND=DIR has been specified, use it.
+   if test "x${PRI_SETUP_ACK_INBAND_DIR}" != "x"; then
+      if test -d ${PRI_SETUP_ACK_INBAND_DIR}/lib; then
+         pbxlibdir="-L${PRI_SETUP_ACK_INBAND_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_MWI_DIR}"
+         pbxlibdir="-L${PRI_SETUP_ACK_INBAND_DIR}"
       fi
    fi
-   pbxfuncname="pri_mwi_indicate"
+   pbxfuncname="pri_setup_ack"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_MWI_FOUND=yes
+      AST_PRI_SETUP_ACK_INBAND_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -25742,47 +27443,47 @@ 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_PRI_MWI_FOUND=yes
+  AST_PRI_SETUP_ACK_INBAND_FOUND=yes
 else
-  AST_PRI_MWI_FOUND=no
+  AST_PRI_SETUP_ACK_INBAND_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_MWI_FOUND}" = "yes"; then
-      PRI_MWI_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_MWI=DIR has been specified, use it.
-      if test "x${PRI_MWI_DIR}" != "x"; then
-         PRI_MWI_INCLUDE="-I${PRI_MWI_DIR}/include"
+   if test "${AST_PRI_SETUP_ACK_INBAND_FOUND}" = "yes"; then
+      PRI_SETUP_ACK_INBAND_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_SETUP_ACK_INBAND=DIR has been specified, use it.
+      if test "x${PRI_SETUP_ACK_INBAND_DIR}" != "x"; then
+         PRI_SETUP_ACK_INBAND_INCLUDE="-I${PRI_SETUP_ACK_INBAND_DIR}/include"
       fi
-      PRI_MWI_INCLUDE="${PRI_MWI_INCLUDE} "
+      PRI_SETUP_ACK_INBAND_INCLUDE="${PRI_SETUP_ACK_INBAND_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_MWI_HEADER_FOUND="1"
+         PRI_SETUP_ACK_INBAND_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_MWI_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_SETUP_ACK_INBAND_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_MWI_HEADER_FOUND=1
+  PRI_SETUP_ACK_INBAND_HEADER_FOUND=1
 else
-  PRI_MWI_HEADER_FOUND=0
+  PRI_SETUP_ACK_INBAND_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_MWI_HEADER_FOUND}" = "x0" ; then
-         PRI_MWI_LIB=""
-         PRI_MWI_INCLUDE=""
+      if test "x${PRI_SETUP_ACK_INBAND_HEADER_FOUND}" = "x0" ; then
+         PRI_SETUP_ACK_INBAND_LIB=""
+         PRI_SETUP_ACK_INBAND_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_MWI_LIB=""
+            PRI_SETUP_ACK_INBAND_LIB=""
          fi
-         PBX_PRI_MWI=1
+         PBX_PRI_SETUP_ACK_INBAND=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_MWI 1
+#define HAVE_PRI_SETUP_ACK_INBAND 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_MCID}" != "x1" -a "${USE_PRI_MCID}" != "no"; then
+if test "x${PBX_PRI_L2_PERSISTENCE}" != "x1" -a "${USE_PRI_L2_PERSISTENCE}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_MCID=DIR has been specified, use it.
-   if test "x${PRI_MCID_DIR}" != "x"; then
-      if test -d ${PRI_MCID_DIR}/lib; then
-         pbxlibdir="-L${PRI_MCID_DIR}/lib"
+   # if --with-PRI_L2_PERSISTENCE=DIR has been specified, use it.
+   if test "x${PRI_L2_PERSISTENCE_DIR}" != "x"; then
+      if test -d ${PRI_L2_PERSISTENCE_DIR}/lib; then
+         pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_MCID_DIR}"
+         pbxlibdir="-L${PRI_L2_PERSISTENCE_DIR}"
       fi
    fi
-   pbxfuncname="pri_mcid_enable"
+   pbxfuncname="pri_persistent_layer2_option"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_MCID_FOUND=yes
+      AST_PRI_L2_PERSISTENCE_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -25846,47 +27547,47 @@ 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_PRI_MCID_FOUND=yes
+  AST_PRI_L2_PERSISTENCE_FOUND=yes
 else
-  AST_PRI_MCID_FOUND=no
+  AST_PRI_L2_PERSISTENCE_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_MCID_FOUND}" = "yes"; then
-      PRI_MCID_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_MCID=DIR has been specified, use it.
-      if test "x${PRI_MCID_DIR}" != "x"; then
-         PRI_MCID_INCLUDE="-I${PRI_MCID_DIR}/include"
+   if test "${AST_PRI_L2_PERSISTENCE_FOUND}" = "yes"; then
+      PRI_L2_PERSISTENCE_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_L2_PERSISTENCE=DIR has been specified, use it.
+      if test "x${PRI_L2_PERSISTENCE_DIR}" != "x"; then
+         PRI_L2_PERSISTENCE_INCLUDE="-I${PRI_L2_PERSISTENCE_DIR}/include"
       fi
-      PRI_MCID_INCLUDE="${PRI_MCID_INCLUDE} "
+      PRI_L2_PERSISTENCE_INCLUDE="${PRI_L2_PERSISTENCE_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_MCID_HEADER_FOUND="1"
+         PRI_L2_PERSISTENCE_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_MCID_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_L2_PERSISTENCE_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_MCID_HEADER_FOUND=1
+  PRI_L2_PERSISTENCE_HEADER_FOUND=1
 else
-  PRI_MCID_HEADER_FOUND=0
+  PRI_L2_PERSISTENCE_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_MCID_HEADER_FOUND}" = "x0" ; then
-         PRI_MCID_LIB=""
-         PRI_MCID_INCLUDE=""
+      if test "x${PRI_L2_PERSISTENCE_HEADER_FOUND}" = "x0" ; then
+         PRI_L2_PERSISTENCE_LIB=""
+         PRI_L2_PERSISTENCE_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_MCID_LIB=""
+            PRI_L2_PERSISTENCE_LIB=""
          fi
-         PBX_PRI_MCID=1
+         PBX_PRI_L2_PERSISTENCE=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_MCID 1
+#define HAVE_PRI_L2_PERSISTENCE 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_CALL_WAITING}" != "x1" -a "${USE_PRI_CALL_WAITING}" != "no"; then
+if test "x${PBX_PRI_DATETIME_SEND}" != "x1" -a "${USE_PRI_DATETIME_SEND}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_CALL_WAITING=DIR has been specified, use it.
-   if test "x${PRI_CALL_WAITING_DIR}" != "x"; then
-      if test -d ${PRI_CALL_WAITING_DIR}/lib; then
-         pbxlibdir="-L${PRI_CALL_WAITING_DIR}/lib"
+   # if --with-PRI_DATETIME_SEND=DIR has been specified, use it.
+   if test "x${PRI_DATETIME_SEND_DIR}" != "x"; then
+      if test -d ${PRI_DATETIME_SEND_DIR}/lib; then
+         pbxlibdir="-L${PRI_DATETIME_SEND_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_CALL_WAITING_DIR}"
+         pbxlibdir="-L${PRI_DATETIME_SEND_DIR}"
       fi
    fi
-   pbxfuncname="pri_connect_ack_enable"
+   pbxfuncname="pri_date_time_send_option"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_CALL_WAITING_FOUND=yes
+      AST_PRI_DATETIME_SEND_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -25950,47 +27651,47 @@ 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_PRI_CALL_WAITING_FOUND=yes
+  AST_PRI_DATETIME_SEND_FOUND=yes
 else
-  AST_PRI_CALL_WAITING_FOUND=no
+  AST_PRI_DATETIME_SEND_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_CALL_WAITING_FOUND}" = "yes"; then
-      PRI_CALL_WAITING_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_CALL_WAITING=DIR has been specified, use it.
-      if test "x${PRI_CALL_WAITING_DIR}" != "x"; then
-         PRI_CALL_WAITING_INCLUDE="-I${PRI_CALL_WAITING_DIR}/include"
+   if test "${AST_PRI_DATETIME_SEND_FOUND}" = "yes"; then
+      PRI_DATETIME_SEND_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_DATETIME_SEND=DIR has been specified, use it.
+      if test "x${PRI_DATETIME_SEND_DIR}" != "x"; then
+         PRI_DATETIME_SEND_INCLUDE="-I${PRI_DATETIME_SEND_DIR}/include"
       fi
-      PRI_CALL_WAITING_INCLUDE="${PRI_CALL_WAITING_INCLUDE} "
+      PRI_DATETIME_SEND_INCLUDE="${PRI_DATETIME_SEND_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_CALL_WAITING_HEADER_FOUND="1"
+         PRI_DATETIME_SEND_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_CALL_WAITING_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_DATETIME_SEND_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_CALL_WAITING_HEADER_FOUND=1
+  PRI_DATETIME_SEND_HEADER_FOUND=1
 else
-  PRI_CALL_WAITING_HEADER_FOUND=0
+  PRI_DATETIME_SEND_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_CALL_WAITING_HEADER_FOUND}" = "x0" ; then
-         PRI_CALL_WAITING_LIB=""
-         PRI_CALL_WAITING_INCLUDE=""
+      if test "x${PRI_DATETIME_SEND_HEADER_FOUND}" = "x0" ; then
+         PRI_DATETIME_SEND_LIB=""
+         PRI_DATETIME_SEND_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_CALL_WAITING_LIB=""
+            PRI_DATETIME_SEND_LIB=""
          fi
-         PBX_PRI_CALL_WAITING=1
+         PBX_PRI_DATETIME_SEND=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_CALL_WAITING 1
+#define HAVE_PRI_DATETIME_SEND 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_AOC_EVENTS}" != "x1" -a "${USE_PRI_AOC_EVENTS}" != "no"; then
+if test "x${PBX_PRI_MWI_V2}" != "x1" -a "${USE_PRI_MWI_V2}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_AOC_EVENTS=DIR has been specified, use it.
-   if test "x${PRI_AOC_EVENTS_DIR}" != "x"; then
-      if test -d ${PRI_AOC_EVENTS_DIR}/lib; then
-         pbxlibdir="-L${PRI_AOC_EVENTS_DIR}/lib"
+   # if --with-PRI_MWI_V2=DIR has been specified, use it.
+   if test "x${PRI_MWI_V2_DIR}" != "x"; then
+      if test -d ${PRI_MWI_V2_DIR}/lib; then
+         pbxlibdir="-L${PRI_MWI_V2_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_AOC_EVENTS_DIR}"
+         pbxlibdir="-L${PRI_MWI_V2_DIR}"
       fi
    fi
-   pbxfuncname="pri_aoc_events_enable"
+   pbxfuncname="pri_mwi_indicate_v2"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_AOC_EVENTS_FOUND=yes
+      AST_PRI_MWI_V2_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26054,47 +27755,47 @@ 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_PRI_AOC_EVENTS_FOUND=yes
+  AST_PRI_MWI_V2_FOUND=yes
 else
-  AST_PRI_AOC_EVENTS_FOUND=no
+  AST_PRI_MWI_V2_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_AOC_EVENTS_FOUND}" = "yes"; then
-      PRI_AOC_EVENTS_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_AOC_EVENTS=DIR has been specified, use it.
-      if test "x${PRI_AOC_EVENTS_DIR}" != "x"; then
-         PRI_AOC_EVENTS_INCLUDE="-I${PRI_AOC_EVENTS_DIR}/include"
+   if test "${AST_PRI_MWI_V2_FOUND}" = "yes"; then
+      PRI_MWI_V2_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_MWI_V2=DIR has been specified, use it.
+      if test "x${PRI_MWI_V2_DIR}" != "x"; then
+         PRI_MWI_V2_INCLUDE="-I${PRI_MWI_V2_DIR}/include"
       fi
-      PRI_AOC_EVENTS_INCLUDE="${PRI_AOC_EVENTS_INCLUDE} "
+      PRI_MWI_V2_INCLUDE="${PRI_MWI_V2_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_AOC_EVENTS_HEADER_FOUND="1"
+         PRI_MWI_V2_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_AOC_EVENTS_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_MWI_V2_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_AOC_EVENTS_HEADER_FOUND=1
+  PRI_MWI_V2_HEADER_FOUND=1
 else
-  PRI_AOC_EVENTS_HEADER_FOUND=0
+  PRI_MWI_V2_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_AOC_EVENTS_HEADER_FOUND}" = "x0" ; then
-         PRI_AOC_EVENTS_LIB=""
-         PRI_AOC_EVENTS_INCLUDE=""
+      if test "x${PRI_MWI_V2_HEADER_FOUND}" = "x0" ; then
+         PRI_MWI_V2_LIB=""
+         PRI_MWI_V2_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_AOC_EVENTS_LIB=""
+            PRI_MWI_V2_LIB=""
          fi
-         PBX_PRI_AOC_EVENTS=1
+         PBX_PRI_MWI_V2=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_AOC_EVENTS 1
+#define HAVE_PRI_MWI_V2 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_TRANSFER}" != "x1" -a "${USE_PRI_TRANSFER}" != "no"; then
+if test "x${PBX_PRI_DISPLAY_TEXT}" != "x1" -a "${USE_PRI_DISPLAY_TEXT}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_TRANSFER=DIR has been specified, use it.
-   if test "x${PRI_TRANSFER_DIR}" != "x"; then
-      if test -d ${PRI_TRANSFER_DIR}/lib; then
-         pbxlibdir="-L${PRI_TRANSFER_DIR}/lib"
+   # if --with-PRI_DISPLAY_TEXT=DIR has been specified, use it.
+   if test "x${PRI_DISPLAY_TEXT_DIR}" != "x"; then
+      if test -d ${PRI_DISPLAY_TEXT_DIR}/lib; then
+         pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_TRANSFER_DIR}"
+         pbxlibdir="-L${PRI_DISPLAY_TEXT_DIR}"
       fi
    fi
-   pbxfuncname="pri_transfer_enable"
+   pbxfuncname="pri_display_text"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_TRANSFER_FOUND=yes
+      AST_PRI_DISPLAY_TEXT_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26158,47 +27859,47 @@ 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_PRI_TRANSFER_FOUND=yes
+  AST_PRI_DISPLAY_TEXT_FOUND=yes
 else
-  AST_PRI_TRANSFER_FOUND=no
+  AST_PRI_DISPLAY_TEXT_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_TRANSFER_FOUND}" = "yes"; then
-      PRI_TRANSFER_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_TRANSFER=DIR has been specified, use it.
-      if test "x${PRI_TRANSFER_DIR}" != "x"; then
-         PRI_TRANSFER_INCLUDE="-I${PRI_TRANSFER_DIR}/include"
+   if test "${AST_PRI_DISPLAY_TEXT_FOUND}" = "yes"; then
+      PRI_DISPLAY_TEXT_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_DISPLAY_TEXT=DIR has been specified, use it.
+      if test "x${PRI_DISPLAY_TEXT_DIR}" != "x"; then
+         PRI_DISPLAY_TEXT_INCLUDE="-I${PRI_DISPLAY_TEXT_DIR}/include"
       fi
-      PRI_TRANSFER_INCLUDE="${PRI_TRANSFER_INCLUDE} "
+      PRI_DISPLAY_TEXT_INCLUDE="${PRI_DISPLAY_TEXT_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_TRANSFER_HEADER_FOUND="1"
+         PRI_DISPLAY_TEXT_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_TRANSFER_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_DISPLAY_TEXT_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_TRANSFER_HEADER_FOUND=1
+  PRI_DISPLAY_TEXT_HEADER_FOUND=1
 else
-  PRI_TRANSFER_HEADER_FOUND=0
+  PRI_DISPLAY_TEXT_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_TRANSFER_HEADER_FOUND}" = "x0" ; then
-         PRI_TRANSFER_LIB=""
-         PRI_TRANSFER_INCLUDE=""
+      if test "x${PRI_DISPLAY_TEXT_HEADER_FOUND}" = "x0" ; then
+         PRI_DISPLAY_TEXT_LIB=""
+         PRI_DISPLAY_TEXT_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_TRANSFER_LIB=""
+            PRI_DISPLAY_TEXT_LIB=""
          fi
-         PBX_PRI_TRANSFER=1
+         PBX_PRI_DISPLAY_TEXT=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_TRANSFER 1
+#define HAVE_PRI_DISPLAY_TEXT 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_CCSS}" != "x1" -a "${USE_PRI_CCSS}" != "no"; then
+if test "x${PBX_PRI_MWI}" != "x1" -a "${USE_PRI_MWI}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_CCSS=DIR has been specified, use it.
-   if test "x${PRI_CCSS_DIR}" != "x"; then
-      if test -d ${PRI_CCSS_DIR}/lib; then
-         pbxlibdir="-L${PRI_CCSS_DIR}/lib"
+   # if --with-PRI_MWI=DIR has been specified, use it.
+   if test "x${PRI_MWI_DIR}" != "x"; then
+      if test -d ${PRI_MWI_DIR}/lib; then
+         pbxlibdir="-L${PRI_MWI_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_CCSS_DIR}"
+         pbxlibdir="-L${PRI_MWI_DIR}"
       fi
    fi
-   pbxfuncname="pri_cc_enable"
+   pbxfuncname="pri_mwi_indicate"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_CCSS_FOUND=yes
+      AST_PRI_MWI_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26262,47 +27963,47 @@ 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_PRI_CCSS_FOUND=yes
+  AST_PRI_MWI_FOUND=yes
 else
-  AST_PRI_CCSS_FOUND=no
+  AST_PRI_MWI_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_CCSS_FOUND}" = "yes"; then
-      PRI_CCSS_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_CCSS=DIR has been specified, use it.
-      if test "x${PRI_CCSS_DIR}" != "x"; then
-         PRI_CCSS_INCLUDE="-I${PRI_CCSS_DIR}/include"
+   if test "${AST_PRI_MWI_FOUND}" = "yes"; then
+      PRI_MWI_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_MWI=DIR has been specified, use it.
+      if test "x${PRI_MWI_DIR}" != "x"; then
+         PRI_MWI_INCLUDE="-I${PRI_MWI_DIR}/include"
       fi
-      PRI_CCSS_INCLUDE="${PRI_CCSS_INCLUDE} "
+      PRI_MWI_INCLUDE="${PRI_MWI_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_CCSS_HEADER_FOUND="1"
+         PRI_MWI_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_CCSS_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_MWI_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_CCSS_HEADER_FOUND=1
+  PRI_MWI_HEADER_FOUND=1
 else
-  PRI_CCSS_HEADER_FOUND=0
+  PRI_MWI_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_CCSS_HEADER_FOUND}" = "x0" ; then
-         PRI_CCSS_LIB=""
-         PRI_CCSS_INCLUDE=""
+      if test "x${PRI_MWI_HEADER_FOUND}" = "x0" ; then
+         PRI_MWI_LIB=""
+         PRI_MWI_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_CCSS_LIB=""
+            PRI_MWI_LIB=""
          fi
-         PBX_PRI_CCSS=1
+         PBX_PRI_MWI=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_CCSS 1
+#define HAVE_PRI_MWI 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_HANGUP_FIX}" != "x1" -a "${USE_PRI_HANGUP_FIX}" != "no"; then
+if test "x${PBX_PRI_MCID}" != "x1" -a "${USE_PRI_MCID}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_HANGUP_FIX=DIR has been specified, use it.
-   if test "x${PRI_HANGUP_FIX_DIR}" != "x"; then
-      if test -d ${PRI_HANGUP_FIX_DIR}/lib; then
-         pbxlibdir="-L${PRI_HANGUP_FIX_DIR}/lib"
+   # if --with-PRI_MCID=DIR has been specified, use it.
+   if test "x${PRI_MCID_DIR}" != "x"; then
+      if test -d ${PRI_MCID_DIR}/lib; then
+         pbxlibdir="-L${PRI_MCID_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_HANGUP_FIX_DIR}"
+         pbxlibdir="-L${PRI_MCID_DIR}"
       fi
    fi
-   pbxfuncname="pri_hangup_fix_enable"
+   pbxfuncname="pri_mcid_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_HANGUP_FIX_FOUND=yes
+      AST_PRI_MCID_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26366,47 +28067,47 @@ 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_PRI_HANGUP_FIX_FOUND=yes
+  AST_PRI_MCID_FOUND=yes
 else
-  AST_PRI_HANGUP_FIX_FOUND=no
+  AST_PRI_MCID_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_HANGUP_FIX_FOUND}" = "yes"; then
-      PRI_HANGUP_FIX_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_HANGUP_FIX=DIR has been specified, use it.
-      if test "x${PRI_HANGUP_FIX_DIR}" != "x"; then
-         PRI_HANGUP_FIX_INCLUDE="-I${PRI_HANGUP_FIX_DIR}/include"
+   if test "${AST_PRI_MCID_FOUND}" = "yes"; then
+      PRI_MCID_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_MCID=DIR has been specified, use it.
+      if test "x${PRI_MCID_DIR}" != "x"; then
+         PRI_MCID_INCLUDE="-I${PRI_MCID_DIR}/include"
       fi
-      PRI_HANGUP_FIX_INCLUDE="${PRI_HANGUP_FIX_INCLUDE} "
+      PRI_MCID_INCLUDE="${PRI_MCID_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_HANGUP_FIX_HEADER_FOUND="1"
+         PRI_MCID_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_HANGUP_FIX_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_MCID_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_HANGUP_FIX_HEADER_FOUND=1
+  PRI_MCID_HEADER_FOUND=1
 else
-  PRI_HANGUP_FIX_HEADER_FOUND=0
+  PRI_MCID_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_HANGUP_FIX_HEADER_FOUND}" = "x0" ; then
-         PRI_HANGUP_FIX_LIB=""
-         PRI_HANGUP_FIX_INCLUDE=""
+      if test "x${PRI_MCID_HEADER_FOUND}" = "x0" ; then
+         PRI_MCID_LIB=""
+         PRI_MCID_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_HANGUP_FIX_LIB=""
+            PRI_MCID_LIB=""
          fi
-         PBX_PRI_HANGUP_FIX=1
+         PBX_PRI_MCID=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_HANGUP_FIX 1
+#define HAVE_PRI_MCID 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_SUBADDR}" != "x1" -a "${USE_PRI_SUBADDR}" != "no"; then
+if test "x${PBX_PRI_CALL_WAITING}" != "x1" -a "${USE_PRI_CALL_WAITING}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_SUBADDR=DIR has been specified, use it.
-   if test "x${PRI_SUBADDR_DIR}" != "x"; then
-      if test -d ${PRI_SUBADDR_DIR}/lib; then
-         pbxlibdir="-L${PRI_SUBADDR_DIR}/lib"
+   # if --with-PRI_CALL_WAITING=DIR has been specified, use it.
+   if test "x${PRI_CALL_WAITING_DIR}" != "x"; then
+      if test -d ${PRI_CALL_WAITING_DIR}/lib; then
+         pbxlibdir="-L${PRI_CALL_WAITING_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_SUBADDR_DIR}"
+         pbxlibdir="-L${PRI_CALL_WAITING_DIR}"
       fi
    fi
-   pbxfuncname="pri_sr_set_called_subaddress"
+   pbxfuncname="pri_connect_ack_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_SUBADDR_FOUND=yes
+      AST_PRI_CALL_WAITING_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26470,47 +28171,47 @@ 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_PRI_SUBADDR_FOUND=yes
+  AST_PRI_CALL_WAITING_FOUND=yes
 else
-  AST_PRI_SUBADDR_FOUND=no
+  AST_PRI_CALL_WAITING_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_SUBADDR_FOUND}" = "yes"; then
-      PRI_SUBADDR_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_SUBADDR=DIR has been specified, use it.
-      if test "x${PRI_SUBADDR_DIR}" != "x"; then
-         PRI_SUBADDR_INCLUDE="-I${PRI_SUBADDR_DIR}/include"
+   if test "${AST_PRI_CALL_WAITING_FOUND}" = "yes"; then
+      PRI_CALL_WAITING_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_CALL_WAITING=DIR has been specified, use it.
+      if test "x${PRI_CALL_WAITING_DIR}" != "x"; then
+         PRI_CALL_WAITING_INCLUDE="-I${PRI_CALL_WAITING_DIR}/include"
       fi
-      PRI_SUBADDR_INCLUDE="${PRI_SUBADDR_INCLUDE} "
+      PRI_CALL_WAITING_INCLUDE="${PRI_CALL_WAITING_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_SUBADDR_HEADER_FOUND="1"
+         PRI_CALL_WAITING_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_SUBADDR_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_CALL_WAITING_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_SUBADDR_HEADER_FOUND=1
+  PRI_CALL_WAITING_HEADER_FOUND=1
 else
-  PRI_SUBADDR_HEADER_FOUND=0
+  PRI_CALL_WAITING_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_SUBADDR_HEADER_FOUND}" = "x0" ; then
-         PRI_SUBADDR_LIB=""
-         PRI_SUBADDR_INCLUDE=""
+      if test "x${PRI_CALL_WAITING_HEADER_FOUND}" = "x0" ; then
+         PRI_CALL_WAITING_LIB=""
+         PRI_CALL_WAITING_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_SUBADDR_LIB=""
+            PRI_CALL_WAITING_LIB=""
          fi
-         PBX_PRI_SUBADDR=1
+         PBX_PRI_CALL_WAITING=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_SUBADDR 1
+#define HAVE_PRI_CALL_WAITING 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_CALL_HOLD}" != "x1" -a "${USE_PRI_CALL_HOLD}" != "no"; then
+if test "x${PBX_PRI_AOC_EVENTS}" != "x1" -a "${USE_PRI_AOC_EVENTS}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_CALL_HOLD=DIR has been specified, use it.
-   if test "x${PRI_CALL_HOLD_DIR}" != "x"; then
-      if test -d ${PRI_CALL_HOLD_DIR}/lib; then
-         pbxlibdir="-L${PRI_CALL_HOLD_DIR}/lib"
+   # if --with-PRI_AOC_EVENTS=DIR has been specified, use it.
+   if test "x${PRI_AOC_EVENTS_DIR}" != "x"; then
+      if test -d ${PRI_AOC_EVENTS_DIR}/lib; then
+         pbxlibdir="-L${PRI_AOC_EVENTS_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_CALL_HOLD_DIR}"
+         pbxlibdir="-L${PRI_AOC_EVENTS_DIR}"
       fi
    fi
-   pbxfuncname="pri_hold_enable"
+   pbxfuncname="pri_aoc_events_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_CALL_HOLD_FOUND=yes
+      AST_PRI_AOC_EVENTS_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26574,47 +28275,47 @@ 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_PRI_CALL_HOLD_FOUND=yes
+  AST_PRI_AOC_EVENTS_FOUND=yes
 else
-  AST_PRI_CALL_HOLD_FOUND=no
+  AST_PRI_AOC_EVENTS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_CALL_HOLD_FOUND}" = "yes"; then
-      PRI_CALL_HOLD_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_CALL_HOLD=DIR has been specified, use it.
-      if test "x${PRI_CALL_HOLD_DIR}" != "x"; then
-         PRI_CALL_HOLD_INCLUDE="-I${PRI_CALL_HOLD_DIR}/include"
+   if test "${AST_PRI_AOC_EVENTS_FOUND}" = "yes"; then
+      PRI_AOC_EVENTS_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_AOC_EVENTS=DIR has been specified, use it.
+      if test "x${PRI_AOC_EVENTS_DIR}" != "x"; then
+         PRI_AOC_EVENTS_INCLUDE="-I${PRI_AOC_EVENTS_DIR}/include"
       fi
-      PRI_CALL_HOLD_INCLUDE="${PRI_CALL_HOLD_INCLUDE} "
+      PRI_AOC_EVENTS_INCLUDE="${PRI_AOC_EVENTS_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_CALL_HOLD_HEADER_FOUND="1"
+         PRI_AOC_EVENTS_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_CALL_HOLD_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_AOC_EVENTS_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_CALL_HOLD_HEADER_FOUND=1
+  PRI_AOC_EVENTS_HEADER_FOUND=1
 else
-  PRI_CALL_HOLD_HEADER_FOUND=0
+  PRI_AOC_EVENTS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_CALL_HOLD_HEADER_FOUND}" = "x0" ; then
-         PRI_CALL_HOLD_LIB=""
-         PRI_CALL_HOLD_INCLUDE=""
+      if test "x${PRI_AOC_EVENTS_HEADER_FOUND}" = "x0" ; then
+         PRI_AOC_EVENTS_LIB=""
+         PRI_AOC_EVENTS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_CALL_HOLD_LIB=""
+            PRI_AOC_EVENTS_LIB=""
          fi
-         PBX_PRI_CALL_HOLD=1
+         PBX_PRI_AOC_EVENTS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_CALL_HOLD 1
+#define HAVE_PRI_AOC_EVENTS 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_CALL_REROUTING}" != "x1" -a "${USE_PRI_CALL_REROUTING}" != "no"; then
+if test "x${PBX_PRI_TRANSFER}" != "x1" -a "${USE_PRI_TRANSFER}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_CALL_REROUTING=DIR has been specified, use it.
-   if test "x${PRI_CALL_REROUTING_DIR}" != "x"; then
-      if test -d ${PRI_CALL_REROUTING_DIR}/lib; then
-         pbxlibdir="-L${PRI_CALL_REROUTING_DIR}/lib"
+   # if --with-PRI_TRANSFER=DIR has been specified, use it.
+   if test "x${PRI_TRANSFER_DIR}" != "x"; then
+      if test -d ${PRI_TRANSFER_DIR}/lib; then
+         pbxlibdir="-L${PRI_TRANSFER_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_CALL_REROUTING_DIR}"
+         pbxlibdir="-L${PRI_TRANSFER_DIR}"
       fi
    fi
-   pbxfuncname="pri_reroute_enable"
+   pbxfuncname="pri_transfer_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_CALL_REROUTING_FOUND=yes
+      AST_PRI_TRANSFER_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26678,47 +28379,47 @@ 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_PRI_CALL_REROUTING_FOUND=yes
+  AST_PRI_TRANSFER_FOUND=yes
 else
-  AST_PRI_CALL_REROUTING_FOUND=no
+  AST_PRI_TRANSFER_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_CALL_REROUTING_FOUND}" = "yes"; then
-      PRI_CALL_REROUTING_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_CALL_REROUTING=DIR has been specified, use it.
-      if test "x${PRI_CALL_REROUTING_DIR}" != "x"; then
-         PRI_CALL_REROUTING_INCLUDE="-I${PRI_CALL_REROUTING_DIR}/include"
+   if test "${AST_PRI_TRANSFER_FOUND}" = "yes"; then
+      PRI_TRANSFER_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_TRANSFER=DIR has been specified, use it.
+      if test "x${PRI_TRANSFER_DIR}" != "x"; then
+         PRI_TRANSFER_INCLUDE="-I${PRI_TRANSFER_DIR}/include"
       fi
-      PRI_CALL_REROUTING_INCLUDE="${PRI_CALL_REROUTING_INCLUDE} "
+      PRI_TRANSFER_INCLUDE="${PRI_TRANSFER_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_CALL_REROUTING_HEADER_FOUND="1"
+         PRI_TRANSFER_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_CALL_REROUTING_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_TRANSFER_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_CALL_REROUTING_HEADER_FOUND=1
+  PRI_TRANSFER_HEADER_FOUND=1
 else
-  PRI_CALL_REROUTING_HEADER_FOUND=0
+  PRI_TRANSFER_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_CALL_REROUTING_HEADER_FOUND}" = "x0" ; then
-         PRI_CALL_REROUTING_LIB=""
-         PRI_CALL_REROUTING_INCLUDE=""
+      if test "x${PRI_TRANSFER_HEADER_FOUND}" = "x0" ; then
+         PRI_TRANSFER_LIB=""
+         PRI_TRANSFER_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_CALL_REROUTING_LIB=""
+            PRI_TRANSFER_LIB=""
          fi
-         PBX_PRI_CALL_REROUTING=1
+         PBX_PRI_TRANSFER=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_CALL_REROUTING 1
+#define HAVE_PRI_TRANSFER 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_SETUP_KEYPAD}" != "x1" -a "${USE_PRI_SETUP_KEYPAD}" != "no"; then
+if test "x${PBX_PRI_CCSS}" != "x1" -a "${USE_PRI_CCSS}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_SETUP_KEYPAD=DIR has been specified, use it.
-   if test "x${PRI_SETUP_KEYPAD_DIR}" != "x"; then
-      if test -d ${PRI_SETUP_KEYPAD_DIR}/lib; then
-         pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}/lib"
+   # if --with-PRI_CCSS=DIR has been specified, use it.
+   if test "x${PRI_CCSS_DIR}" != "x"; then
+      if test -d ${PRI_CCSS_DIR}/lib; then
+         pbxlibdir="-L${PRI_CCSS_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}"
+         pbxlibdir="-L${PRI_CCSS_DIR}"
       fi
    fi
-   pbxfuncname="pri_sr_set_keypad_digits"
+   pbxfuncname="pri_cc_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_SETUP_KEYPAD_FOUND=yes
+      AST_PRI_CCSS_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26782,47 +28483,47 @@ 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_PRI_SETUP_KEYPAD_FOUND=yes
+  AST_PRI_CCSS_FOUND=yes
 else
-  AST_PRI_SETUP_KEYPAD_FOUND=no
+  AST_PRI_CCSS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_SETUP_KEYPAD_FOUND}" = "yes"; then
-      PRI_SETUP_KEYPAD_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_SETUP_KEYPAD=DIR has been specified, use it.
-      if test "x${PRI_SETUP_KEYPAD_DIR}" != "x"; then
-         PRI_SETUP_KEYPAD_INCLUDE="-I${PRI_SETUP_KEYPAD_DIR}/include"
+   if test "${AST_PRI_CCSS_FOUND}" = "yes"; then
+      PRI_CCSS_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_CCSS=DIR has been specified, use it.
+      if test "x${PRI_CCSS_DIR}" != "x"; then
+         PRI_CCSS_INCLUDE="-I${PRI_CCSS_DIR}/include"
       fi
-      PRI_SETUP_KEYPAD_INCLUDE="${PRI_SETUP_KEYPAD_INCLUDE} "
+      PRI_CCSS_INCLUDE="${PRI_CCSS_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_SETUP_KEYPAD_HEADER_FOUND="1"
+         PRI_CCSS_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_SETUP_KEYPAD_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_CCSS_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_SETUP_KEYPAD_HEADER_FOUND=1
+  PRI_CCSS_HEADER_FOUND=1
 else
-  PRI_SETUP_KEYPAD_HEADER_FOUND=0
+  PRI_CCSS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_SETUP_KEYPAD_HEADER_FOUND}" = "x0" ; then
-         PRI_SETUP_KEYPAD_LIB=""
-         PRI_SETUP_KEYPAD_INCLUDE=""
+      if test "x${PRI_CCSS_HEADER_FOUND}" = "x0" ; then
+         PRI_CCSS_LIB=""
+         PRI_CCSS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_SETUP_KEYPAD_LIB=""
+            PRI_CCSS_LIB=""
          fi
-         PBX_PRI_SETUP_KEYPAD=1
+         PBX_PRI_CCSS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_SETUP_KEYPAD 1
+#define HAVE_PRI_CCSS 1
 _ACEOF
 
       fi
 
 
 
-# ------------------------------------v
-# TODO: The code can be changed to always include these features now.
-# These features will always be present if pri_connected_line_update is available.
-
-if test "x${PBX_PRI_PROG_W_CAUSE}" != "x1" -a "${USE_PRI_PROG_W_CAUSE}" != "no"; then
+if test "x${PBX_PRI_HANGUP_FIX}" != "x1" -a "${USE_PRI_HANGUP_FIX}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_PROG_W_CAUSE=DIR has been specified, use it.
-   if test "x${PRI_PROG_W_CAUSE_DIR}" != "x"; then
-      if test -d ${PRI_PROG_W_CAUSE_DIR}/lib; then
-         pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}/lib"
+   # if --with-PRI_HANGUP_FIX=DIR has been specified, use it.
+   if test "x${PRI_HANGUP_FIX_DIR}" != "x"; then
+      if test -d ${PRI_HANGUP_FIX_DIR}/lib; then
+         pbxlibdir="-L${PRI_HANGUP_FIX_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}"
+         pbxlibdir="-L${PRI_HANGUP_FIX_DIR}"
       fi
    fi
-   pbxfuncname="pri_progress_with_cause"
+   pbxfuncname="pri_hangup_fix_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_PROG_W_CAUSE_FOUND=yes
+      AST_PRI_HANGUP_FIX_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26890,47 +28587,47 @@ 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_PRI_PROG_W_CAUSE_FOUND=yes
+  AST_PRI_HANGUP_FIX_FOUND=yes
 else
-  AST_PRI_PROG_W_CAUSE_FOUND=no
+  AST_PRI_HANGUP_FIX_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_PROG_W_CAUSE_FOUND}" = "yes"; then
-      PRI_PROG_W_CAUSE_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_PROG_W_CAUSE=DIR has been specified, use it.
-      if test "x${PRI_PROG_W_CAUSE_DIR}" != "x"; then
-         PRI_PROG_W_CAUSE_INCLUDE="-I${PRI_PROG_W_CAUSE_DIR}/include"
+   if test "${AST_PRI_HANGUP_FIX_FOUND}" = "yes"; then
+      PRI_HANGUP_FIX_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_HANGUP_FIX=DIR has been specified, use it.
+      if test "x${PRI_HANGUP_FIX_DIR}" != "x"; then
+         PRI_HANGUP_FIX_INCLUDE="-I${PRI_HANGUP_FIX_DIR}/include"
       fi
-      PRI_PROG_W_CAUSE_INCLUDE="${PRI_PROG_W_CAUSE_INCLUDE} "
+      PRI_HANGUP_FIX_INCLUDE="${PRI_HANGUP_FIX_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_PROG_W_CAUSE_HEADER_FOUND="1"
+         PRI_HANGUP_FIX_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_PROG_W_CAUSE_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_HANGUP_FIX_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_PROG_W_CAUSE_HEADER_FOUND=1
+  PRI_HANGUP_FIX_HEADER_FOUND=1
 else
-  PRI_PROG_W_CAUSE_HEADER_FOUND=0
+  PRI_HANGUP_FIX_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_PROG_W_CAUSE_HEADER_FOUND}" = "x0" ; then
-         PRI_PROG_W_CAUSE_LIB=""
-         PRI_PROG_W_CAUSE_INCLUDE=""
+      if test "x${PRI_HANGUP_FIX_HEADER_FOUND}" = "x0" ; then
+         PRI_HANGUP_FIX_LIB=""
+         PRI_HANGUP_FIX_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_PROG_W_CAUSE_LIB=""
+            PRI_HANGUP_FIX_LIB=""
          fi
-         PBX_PRI_PROG_W_CAUSE=1
+         PBX_PRI_HANGUP_FIX=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_PROG_W_CAUSE 1
+#define HAVE_PRI_HANGUP_FIX 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_INBANDDISCONNECT}" != "x1" -a "${USE_PRI_INBANDDISCONNECT}" != "no"; then
+if test "x${PBX_PRI_SUBADDR}" != "x1" -a "${USE_PRI_SUBADDR}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_INBANDDISCONNECT=DIR has been specified, use it.
-   if test "x${PRI_INBANDDISCONNECT_DIR}" != "x"; then
-      if test -d ${PRI_INBANDDISCONNECT_DIR}/lib; then
-         pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}/lib"
+   # if --with-PRI_SUBADDR=DIR has been specified, use it.
+   if test "x${PRI_SUBADDR_DIR}" != "x"; then
+      if test -d ${PRI_SUBADDR_DIR}/lib; then
+         pbxlibdir="-L${PRI_SUBADDR_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}"
+         pbxlibdir="-L${PRI_SUBADDR_DIR}"
       fi
    fi
-   pbxfuncname="pri_set_inbanddisconnect"
+   pbxfuncname="pri_sr_set_called_subaddress"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_INBANDDISCONNECT_FOUND=yes
+      AST_PRI_SUBADDR_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -26994,47 +28691,47 @@ 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_PRI_INBANDDISCONNECT_FOUND=yes
+  AST_PRI_SUBADDR_FOUND=yes
 else
-  AST_PRI_INBANDDISCONNECT_FOUND=no
+  AST_PRI_SUBADDR_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_INBANDDISCONNECT_FOUND}" = "yes"; then
-      PRI_INBANDDISCONNECT_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_INBANDDISCONNECT=DIR has been specified, use it.
-      if test "x${PRI_INBANDDISCONNECT_DIR}" != "x"; then
-         PRI_INBANDDISCONNECT_INCLUDE="-I${PRI_INBANDDISCONNECT_DIR}/include"
+   if test "${AST_PRI_SUBADDR_FOUND}" = "yes"; then
+      PRI_SUBADDR_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_SUBADDR=DIR has been specified, use it.
+      if test "x${PRI_SUBADDR_DIR}" != "x"; then
+         PRI_SUBADDR_INCLUDE="-I${PRI_SUBADDR_DIR}/include"
       fi
-      PRI_INBANDDISCONNECT_INCLUDE="${PRI_INBANDDISCONNECT_INCLUDE} "
+      PRI_SUBADDR_INCLUDE="${PRI_SUBADDR_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_INBANDDISCONNECT_HEADER_FOUND="1"
+         PRI_SUBADDR_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_INBANDDISCONNECT_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_SUBADDR_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_INBANDDISCONNECT_HEADER_FOUND=1
+  PRI_SUBADDR_HEADER_FOUND=1
 else
-  PRI_INBANDDISCONNECT_HEADER_FOUND=0
+  PRI_SUBADDR_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_INBANDDISCONNECT_HEADER_FOUND}" = "x0" ; then
-         PRI_INBANDDISCONNECT_LIB=""
-         PRI_INBANDDISCONNECT_INCLUDE=""
+      if test "x${PRI_SUBADDR_HEADER_FOUND}" = "x0" ; then
+         PRI_SUBADDR_LIB=""
+         PRI_SUBADDR_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_INBANDDISCONNECT_LIB=""
+            PRI_SUBADDR_LIB=""
          fi
-         PBX_PRI_INBANDDISCONNECT=1
+         PBX_PRI_SUBADDR=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_INBANDDISCONNECT 1
+#define HAVE_PRI_SUBADDR 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_SERVICE_MESSAGES}" != "x1" -a "${USE_PRI_SERVICE_MESSAGES}" != "no"; then
+if test "x${PBX_PRI_CALL_HOLD}" != "x1" -a "${USE_PRI_CALL_HOLD}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_SERVICE_MESSAGES=DIR has been specified, use it.
-   if test "x${PRI_SERVICE_MESSAGES_DIR}" != "x"; then
-      if test -d ${PRI_SERVICE_MESSAGES_DIR}/lib; then
-         pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}/lib"
+   # if --with-PRI_CALL_HOLD=DIR has been specified, use it.
+   if test "x${PRI_CALL_HOLD_DIR}" != "x"; then
+      if test -d ${PRI_CALL_HOLD_DIR}/lib; then
+         pbxlibdir="-L${PRI_CALL_HOLD_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}"
+         pbxlibdir="-L${PRI_CALL_HOLD_DIR}"
       fi
    fi
-   pbxfuncname="pri_maintenance_service"
+   pbxfuncname="pri_hold_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_SERVICE_MESSAGES_FOUND=yes
+      AST_PRI_CALL_HOLD_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -27098,47 +28795,47 @@ 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_PRI_SERVICE_MESSAGES_FOUND=yes
+  AST_PRI_CALL_HOLD_FOUND=yes
 else
-  AST_PRI_SERVICE_MESSAGES_FOUND=no
+  AST_PRI_CALL_HOLD_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_SERVICE_MESSAGES_FOUND}" = "yes"; then
-      PRI_SERVICE_MESSAGES_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_SERVICE_MESSAGES=DIR has been specified, use it.
-      if test "x${PRI_SERVICE_MESSAGES_DIR}" != "x"; then
-         PRI_SERVICE_MESSAGES_INCLUDE="-I${PRI_SERVICE_MESSAGES_DIR}/include"
+   if test "${AST_PRI_CALL_HOLD_FOUND}" = "yes"; then
+      PRI_CALL_HOLD_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_CALL_HOLD=DIR has been specified, use it.
+      if test "x${PRI_CALL_HOLD_DIR}" != "x"; then
+         PRI_CALL_HOLD_INCLUDE="-I${PRI_CALL_HOLD_DIR}/include"
       fi
-      PRI_SERVICE_MESSAGES_INCLUDE="${PRI_SERVICE_MESSAGES_INCLUDE} "
+      PRI_CALL_HOLD_INCLUDE="${PRI_CALL_HOLD_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_SERVICE_MESSAGES_HEADER_FOUND="1"
+         PRI_CALL_HOLD_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_SERVICE_MESSAGES_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_CALL_HOLD_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_SERVICE_MESSAGES_HEADER_FOUND=1
+  PRI_CALL_HOLD_HEADER_FOUND=1
 else
-  PRI_SERVICE_MESSAGES_HEADER_FOUND=0
+  PRI_CALL_HOLD_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_SERVICE_MESSAGES_HEADER_FOUND}" = "x0" ; then
-         PRI_SERVICE_MESSAGES_LIB=""
-         PRI_SERVICE_MESSAGES_INCLUDE=""
+      if test "x${PRI_CALL_HOLD_HEADER_FOUND}" = "x0" ; then
+         PRI_CALL_HOLD_LIB=""
+         PRI_CALL_HOLD_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_SERVICE_MESSAGES_LIB=""
+            PRI_CALL_HOLD_LIB=""
          fi
-         PBX_PRI_SERVICE_MESSAGES=1
+         PBX_PRI_CALL_HOLD=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_SERVICE_MESSAGES 1
+#define HAVE_PRI_CALL_HOLD 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_PRI_REVERSE_CHARGE}" != "x1" -a "${USE_PRI_REVERSE_CHARGE}" != "no"; then
+if test "x${PBX_PRI_CALL_REROUTING}" != "x1" -a "${USE_PRI_CALL_REROUTING}" != "no"; then
    pbxlibdir=""
-   # if --with-PRI_REVERSE_CHARGE=DIR has been specified, use it.
-   if test "x${PRI_REVERSE_CHARGE_DIR}" != "x"; then
-      if test -d ${PRI_REVERSE_CHARGE_DIR}/lib; then
-         pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}/lib"
+   # if --with-PRI_CALL_REROUTING=DIR has been specified, use it.
+   if test "x${PRI_CALL_REROUTING_DIR}" != "x"; then
+      if test -d ${PRI_CALL_REROUTING_DIR}/lib; then
+         pbxlibdir="-L${PRI_CALL_REROUTING_DIR}/lib"
       else
-         pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}"
+         pbxlibdir="-L${PRI_CALL_REROUTING_DIR}"
       fi
    fi
-   pbxfuncname="pri_sr_set_reversecharge"
+   pbxfuncname="pri_reroute_enable"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_PRI_REVERSE_CHARGE_FOUND=yes
+      AST_PRI_CALL_REROUTING_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
@@ -27202,47 +28899,47 @@ 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_PRI_REVERSE_CHARGE_FOUND=yes
+  AST_PRI_CALL_REROUTING_FOUND=yes
 else
-  AST_PRI_REVERSE_CHARGE_FOUND=no
+  AST_PRI_CALL_REROUTING_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_PRI_REVERSE_CHARGE_FOUND}" = "yes"; then
-      PRI_REVERSE_CHARGE_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_REVERSE_CHARGE=DIR has been specified, use it.
-      if test "x${PRI_REVERSE_CHARGE_DIR}" != "x"; then
-         PRI_REVERSE_CHARGE_INCLUDE="-I${PRI_REVERSE_CHARGE_DIR}/include"
+   if test "${AST_PRI_CALL_REROUTING_FOUND}" = "yes"; then
+      PRI_CALL_REROUTING_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_CALL_REROUTING=DIR has been specified, use it.
+      if test "x${PRI_CALL_REROUTING_DIR}" != "x"; then
+         PRI_CALL_REROUTING_INCLUDE="-I${PRI_CALL_REROUTING_DIR}/include"
       fi
-      PRI_REVERSE_CHARGE_INCLUDE="${PRI_REVERSE_CHARGE_INCLUDE} "
+      PRI_CALL_REROUTING_INCLUDE="${PRI_CALL_REROUTING_INCLUDE} "
       if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_REVERSE_CHARGE_HEADER_FOUND="1"
+         PRI_CALL_REROUTING_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_REVERSE_CHARGE_INCLUDE}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_CALL_REROUTING_INCLUDE}"
          ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
 if test "x$ac_cv_header_libpri_h" = xyes; then :
-  PRI_REVERSE_CHARGE_HEADER_FOUND=1
+  PRI_CALL_REROUTING_HEADER_FOUND=1
 else
-  PRI_REVERSE_CHARGE_HEADER_FOUND=0
+  PRI_CALL_REROUTING_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${PRI_REVERSE_CHARGE_HEADER_FOUND}" = "x0" ; then
-         PRI_REVERSE_CHARGE_LIB=""
-         PRI_REVERSE_CHARGE_INCLUDE=""
+      if test "x${PRI_CALL_REROUTING_HEADER_FOUND}" = "x0" ; then
+         PRI_CALL_REROUTING_LIB=""
+         PRI_CALL_REROUTING_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            PRI_REVERSE_CHARGE_LIB=""
+            PRI_CALL_REROUTING_LIB=""
          fi
-         PBX_PRI_REVERSE_CHARGE=1
+         PBX_PRI_CALL_REROUTING=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_PRI_REVERSE_CHARGE 1
+#define HAVE_PRI_CALL_REROUTING 1
 _ACEOF
 
       fi
@@ -27250,33 +28947,31 @@ _ACEOF
 fi
 
 
-# ------------------------------------^
-
 
-if test "x${PBX_RESAMPLE}" != "x1" -a "${USE_RESAMPLE}" != "no"; then
+if test "x${PBX_PRI_SETUP_KEYPAD}" != "x1" -a "${USE_PRI_SETUP_KEYPAD}" != "no"; then
    pbxlibdir=""
-   # if --with-RESAMPLE=DIR has been specified, use it.
-   if test "x${RESAMPLE_DIR}" != "x"; then
-      if test -d ${RESAMPLE_DIR}/lib; then
-         pbxlibdir="-L${RESAMPLE_DIR}/lib"
+   # if --with-PRI_SETUP_KEYPAD=DIR has been specified, use it.
+   if test "x${PRI_SETUP_KEYPAD_DIR}" != "x"; then
+      if test -d ${PRI_SETUP_KEYPAD_DIR}/lib; then
+         pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}/lib"
       else
-         pbxlibdir="-L${RESAMPLE_DIR}"
+         pbxlibdir="-L${PRI_SETUP_KEYPAD_DIR}"
       fi
    fi
-   pbxfuncname="resample_open"
+   pbxfuncname="pri_sr_set_keypad_digits"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_RESAMPLE_FOUND=yes
+      AST_PRI_SETUP_KEYPAD_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_resample_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lresample" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lresample... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresample ${pbxlibdir} -lm $LIBS"
+LIBS="-lpri ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -27308,47 +29003,47 @@ 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_RESAMPLE_FOUND=yes
+  AST_PRI_SETUP_KEYPAD_FOUND=yes
 else
-  AST_RESAMPLE_FOUND=no
+  AST_PRI_SETUP_KEYPAD_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_RESAMPLE_FOUND}" = "yes"; then
-      RESAMPLE_LIB="${pbxlibdir} -lresample -lm"
-      # if --with-RESAMPLE=DIR has been specified, use it.
-      if test "x${RESAMPLE_DIR}" != "x"; then
-         RESAMPLE_INCLUDE="-I${RESAMPLE_DIR}/include"
+   if test "${AST_PRI_SETUP_KEYPAD_FOUND}" = "yes"; then
+      PRI_SETUP_KEYPAD_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_SETUP_KEYPAD=DIR has been specified, use it.
+      if test "x${PRI_SETUP_KEYPAD_DIR}" != "x"; then
+         PRI_SETUP_KEYPAD_INCLUDE="-I${PRI_SETUP_KEYPAD_DIR}/include"
       fi
-      RESAMPLE_INCLUDE="${RESAMPLE_INCLUDE} "
-      if test "xlibresample.h" = "x" ; then    # no header, assume found
-         RESAMPLE_HEADER_FOUND="1"
+      PRI_SETUP_KEYPAD_INCLUDE="${PRI_SETUP_KEYPAD_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_SETUP_KEYPAD_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${RESAMPLE_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "libresample.h" "ac_cv_header_libresample_h" "$ac_includes_default"
-if test "x$ac_cv_header_libresample_h" = xyes; then :
-  RESAMPLE_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PRI_SETUP_KEYPAD_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
+  PRI_SETUP_KEYPAD_HEADER_FOUND=1
 else
-  RESAMPLE_HEADER_FOUND=0
+  PRI_SETUP_KEYPAD_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${RESAMPLE_HEADER_FOUND}" = "x0" ; then
-         RESAMPLE_LIB=""
-         RESAMPLE_INCLUDE=""
+      if test "x${PRI_SETUP_KEYPAD_HEADER_FOUND}" = "x0" ; then
+         PRI_SETUP_KEYPAD_LIB=""
+         PRI_SETUP_KEYPAD_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            RESAMPLE_LIB=""
+            PRI_SETUP_KEYPAD_LIB=""
          fi
-         PBX_RESAMPLE=1
+         PBX_PRI_SETUP_KEYPAD=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_RESAMPLE 1
+#define HAVE_PRI_SETUP_KEYPAD 1
 _ACEOF
 
       fi
 
 
 
+# ------------------------------------v
+# TODO: The code can be changed to always include these features now.
+# These features will always be present if pri_connected_line_update is available.
 
-    if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
-        if test "xminimum version of SpanDSP" != "x"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for minimum version of SpanDSP" >&5
-$as_echo_n "checking for minimum version of SpanDSP... " >&6; }
-       else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"
-               #if SPANDSP_RELEASE_DATE < 20080516
-               #error \"spandsp 0.0.5 or greater is required\"
-               #endif
-       \" compiles using spandsp/version.h" >&5
-$as_echo_n "checking if \"
-               #if SPANDSP_RELEASE_DATE < 20080516
-               #error \"spandsp 0.0.5 or greater is required\"
-               #endif
-       \" compiles using spandsp/version.h... " >&6; }
-       fi
-       saved_cppflags="${CPPFLAGS}"
-       if test "x${SPANDSP_DIR}" != "x"; then
-           SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
-       fi
-       CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
-
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- #include <spandsp/version.h>
-int
-main ()
-{
-
-               #if SPANDSP_RELEASE_DATE < 20080516
-               #error "spandsp 0.0.5 or greater is required"
-               #endif
-       ;
-
-  ;
-  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_SPANDSP=1
-
-$as_echo "#define HAVE_SPANDSP 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_SPANDSP}" = "x1" ; then
-       # We found the correct version in the header, now let's make sure it links
-       # properly, and that libtiff is available
-       PBX_SPANDSP=0
-
-if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
+if test "x${PBX_PRI_PROG_W_CAUSE}" != "x1" -a "${USE_PRI_PROG_W_CAUSE}" != "no"; then
    pbxlibdir=""
-   # if --with-SPANDSP=DIR has been specified, use it.
-   if test "x${SPANDSP_DIR}" != "x"; then
-      if test -d ${SPANDSP_DIR}/lib; then
-         pbxlibdir="-L${SPANDSP_DIR}/lib"
+   # if --with-PRI_PROG_W_CAUSE=DIR has been specified, use it.
+   if test "x${PRI_PROG_W_CAUSE_DIR}" != "x"; then
+      if test -d ${PRI_PROG_W_CAUSE_DIR}/lib; then
+         pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}/lib"
       else
-         pbxlibdir="-L${SPANDSP_DIR}"
+         pbxlibdir="-L${PRI_PROG_W_CAUSE_DIR}"
       fi
    fi
-   pbxfuncname="span_set_message_handler"
+   pbxfuncname="pri_progress_with_cause"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SPANDSP_FOUND=yes
+      AST_PRI_PROG_W_CAUSE_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspandsp ${pbxlibdir} -ltiff $LIBS"
+LIBS="-lpri ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -27475,47 +29111,47 @@ 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_SPANDSP_FOUND=yes
+  AST_PRI_PROG_W_CAUSE_FOUND=yes
 else
-  AST_SPANDSP_FOUND=no
+  AST_PRI_PROG_W_CAUSE_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_SPANDSP_FOUND}" = "yes"; then
-      SPANDSP_LIB="${pbxlibdir} -lspandsp -ltiff"
-      # if --with-SPANDSP=DIR has been specified, use it.
-      if test "x${SPANDSP_DIR}" != "x"; then
-         SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
+   if test "${AST_PRI_PROG_W_CAUSE_FOUND}" = "yes"; then
+      PRI_PROG_W_CAUSE_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_PROG_W_CAUSE=DIR has been specified, use it.
+      if test "x${PRI_PROG_W_CAUSE_DIR}" != "x"; then
+         PRI_PROG_W_CAUSE_INCLUDE="-I${PRI_PROG_W_CAUSE_DIR}/include"
       fi
-      SPANDSP_INCLUDE="${SPANDSP_INCLUDE} "
-      if test "xspandsp.h" = "x" ; then        # no header, assume found
-         SPANDSP_HEADER_FOUND="1"
+      PRI_PROG_W_CAUSE_INCLUDE="${PRI_PROG_W_CAUSE_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_PROG_W_CAUSE_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
-if test "x$ac_cv_header_spandsp_h" = xyes; then :
-  SPANDSP_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PRI_PROG_W_CAUSE_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
+  PRI_PROG_W_CAUSE_HEADER_FOUND=1
 else
-  SPANDSP_HEADER_FOUND=0
+  PRI_PROG_W_CAUSE_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${SPANDSP_HEADER_FOUND}" = "x0" ; then
-         SPANDSP_LIB=""
-         SPANDSP_INCLUDE=""
+      if test "x${PRI_PROG_W_CAUSE_HEADER_FOUND}" = "x0" ; then
+         PRI_PROG_W_CAUSE_LIB=""
+         PRI_PROG_W_CAUSE_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SPANDSP_LIB=""
+            PRI_PROG_W_CAUSE_LIB=""
          fi
-         PBX_SPANDSP=1
+         PBX_PRI_PROG_W_CAUSE=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_SPANDSP 1
+#define HAVE_PRI_PROG_W_CAUSE 1
 _ACEOF
 
       fi
@@ -27523,36 +29159,31 @@ _ACEOF
 fi
 
 
-fi
-
-if test "x${PBX_SPANDSP}" = "x1" ; then
-       # We also need t38_terminal_init()
-       PBX_SPANDSP=0
 
-if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
+if test "x${PBX_PRI_INBANDDISCONNECT}" != "x1" -a "${USE_PRI_INBANDDISCONNECT}" != "no"; then
    pbxlibdir=""
-   # if --with-SPANDSP=DIR has been specified, use it.
-   if test "x${SPANDSP_DIR}" != "x"; then
-      if test -d ${SPANDSP_DIR}/lib; then
-         pbxlibdir="-L${SPANDSP_DIR}/lib"
-      else
-         pbxlibdir="-L${SPANDSP_DIR}"
+   # if --with-PRI_INBANDDISCONNECT=DIR has been specified, use it.
+   if test "x${PRI_INBANDDISCONNECT_DIR}" != "x"; then
+      if test -d ${PRI_INBANDDISCONNECT_DIR}/lib; then
+         pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}/lib"
+      else
+         pbxlibdir="-L${PRI_INBANDDISCONNECT_DIR}"
       fi
    fi
-   pbxfuncname="t38_terminal_init"
+   pbxfuncname="pri_set_inbanddisconnect"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SPANDSP_FOUND=yes
+      AST_PRI_INBANDDISCONNECT_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspandsp ${pbxlibdir} -ltiff $LIBS"
+LIBS="-lpri ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -27584,47 +29215,47 @@ 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_SPANDSP_FOUND=yes
+  AST_PRI_INBANDDISCONNECT_FOUND=yes
 else
-  AST_SPANDSP_FOUND=no
+  AST_PRI_INBANDDISCONNECT_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_SPANDSP_FOUND}" = "yes"; then
-      SPANDSP_LIB="${pbxlibdir} -lspandsp -ltiff"
-      # if --with-SPANDSP=DIR has been specified, use it.
-      if test "x${SPANDSP_DIR}" != "x"; then
-         SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
+   if test "${AST_PRI_INBANDDISCONNECT_FOUND}" = "yes"; then
+      PRI_INBANDDISCONNECT_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_INBANDDISCONNECT=DIR has been specified, use it.
+      if test "x${PRI_INBANDDISCONNECT_DIR}" != "x"; then
+         PRI_INBANDDISCONNECT_INCLUDE="-I${PRI_INBANDDISCONNECT_DIR}/include"
       fi
-      SPANDSP_INCLUDE="${SPANDSP_INCLUDE} "
-      if test "xspandsp.h" = "x" ; then        # no header, assume found
-         SPANDSP_HEADER_FOUND="1"
+      PRI_INBANDDISCONNECT_INCLUDE="${PRI_INBANDDISCONNECT_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_INBANDDISCONNECT_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
-if test "x$ac_cv_header_spandsp_h" = xyes; then :
-  SPANDSP_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PRI_INBANDDISCONNECT_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
+  PRI_INBANDDISCONNECT_HEADER_FOUND=1
 else
-  SPANDSP_HEADER_FOUND=0
+  PRI_INBANDDISCONNECT_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${SPANDSP_HEADER_FOUND}" = "x0" ; then
-         SPANDSP_LIB=""
-         SPANDSP_INCLUDE=""
+      if test "x${PRI_INBANDDISCONNECT_HEADER_FOUND}" = "x0" ; then
+         PRI_INBANDDISCONNECT_LIB=""
+         PRI_INBANDDISCONNECT_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SPANDSP_LIB=""
+            PRI_INBANDDISCONNECT_LIB=""
          fi
-         PBX_SPANDSP=1
+         PBX_PRI_INBANDDISCONNECT=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_SPANDSP 1
+#define HAVE_PRI_INBANDDISCONNECT 1
 _ACEOF
 
       fi
@@ -27632,34 +29263,31 @@ _ACEOF
 fi
 
 
-fi
-
-# Check for libss7 v2.0 branch compatible version.
 
-if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
+if test "x${PBX_PRI_SERVICE_MESSAGES}" != "x1" -a "${USE_PRI_SERVICE_MESSAGES}" != "no"; then
    pbxlibdir=""
-   # if --with-SS7=DIR has been specified, use it.
-   if test "x${SS7_DIR}" != "x"; then
-      if test -d ${SS7_DIR}/lib; then
-         pbxlibdir="-L${SS7_DIR}/lib"
+   # if --with-PRI_SERVICE_MESSAGES=DIR has been specified, use it.
+   if test "x${PRI_SERVICE_MESSAGES_DIR}" != "x"; then
+      if test -d ${PRI_SERVICE_MESSAGES_DIR}/lib; then
+         pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}/lib"
       else
-         pbxlibdir="-L${SS7_DIR}"
+         pbxlibdir="-L${PRI_SERVICE_MESSAGES_DIR}"
       fi
    fi
-   pbxfuncname="ss7_set_isup_timer"
+   pbxfuncname="pri_maintenance_service"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SS7_FOUND=yes
+      AST_PRI_SERVICE_MESSAGES_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ss7_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lss7" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lss7... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lss7 ${pbxlibdir}  $LIBS"
+LIBS="-lpri ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -27691,47 +29319,47 @@ 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_SS7_FOUND=yes
+  AST_PRI_SERVICE_MESSAGES_FOUND=yes
 else
-  AST_SS7_FOUND=no
+  AST_PRI_SERVICE_MESSAGES_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_SS7_FOUND}" = "yes"; then
-      SS7_LIB="${pbxlibdir} -lss7 "
-      # if --with-SS7=DIR has been specified, use it.
-      if test "x${SS7_DIR}" != "x"; then
-         SS7_INCLUDE="-I${SS7_DIR}/include"
+   if test "${AST_PRI_SERVICE_MESSAGES_FOUND}" = "yes"; then
+      PRI_SERVICE_MESSAGES_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_SERVICE_MESSAGES=DIR has been specified, use it.
+      if test "x${PRI_SERVICE_MESSAGES_DIR}" != "x"; then
+         PRI_SERVICE_MESSAGES_INCLUDE="-I${PRI_SERVICE_MESSAGES_DIR}/include"
       fi
-      SS7_INCLUDE="${SS7_INCLUDE} "
-      if test "xlibss7.h" = "x" ; then # no header, assume found
-         SS7_HEADER_FOUND="1"
+      PRI_SERVICE_MESSAGES_INCLUDE="${PRI_SERVICE_MESSAGES_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_SERVICE_MESSAGES_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${SS7_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "libss7.h" "ac_cv_header_libss7_h" "$ac_includes_default"
-if test "x$ac_cv_header_libss7_h" = xyes; then :
-  SS7_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PRI_SERVICE_MESSAGES_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
+  PRI_SERVICE_MESSAGES_HEADER_FOUND=1
 else
-  SS7_HEADER_FOUND=0
+  PRI_SERVICE_MESSAGES_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${SS7_HEADER_FOUND}" = "x0" ; then
-         SS7_LIB=""
-         SS7_INCLUDE=""
+      if test "x${PRI_SERVICE_MESSAGES_HEADER_FOUND}" = "x0" ; then
+         PRI_SERVICE_MESSAGES_LIB=""
+         PRI_SERVICE_MESSAGES_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SS7_LIB=""
+            PRI_SERVICE_MESSAGES_LIB=""
          fi
-         PBX_SS7=1
+         PBX_PRI_SERVICE_MESSAGES=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_SS7 1
+#define HAVE_PRI_SERVICE_MESSAGES 1
 _ACEOF
 
       fi
 
 
 
-
-if test "x${PBX_OPENR2}" != "x1" -a "${USE_OPENR2}" != "no"; then
+if test "x${PBX_PRI_REVERSE_CHARGE}" != "x1" -a "${USE_PRI_REVERSE_CHARGE}" != "no"; then
    pbxlibdir=""
-   # if --with-OPENR2=DIR has been specified, use it.
-   if test "x${OPENR2_DIR}" != "x"; then
-      if test -d ${OPENR2_DIR}/lib; then
-         pbxlibdir="-L${OPENR2_DIR}/lib"
+   # if --with-PRI_REVERSE_CHARGE=DIR has been specified, use it.
+   if test "x${PRI_REVERSE_CHARGE_DIR}" != "x"; then
+      if test -d ${PRI_REVERSE_CHARGE_DIR}/lib; then
+         pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}/lib"
       else
-         pbxlibdir="-L${OPENR2_DIR}"
+         pbxlibdir="-L${PRI_REVERSE_CHARGE_DIR}"
       fi
    fi
-   pbxfuncname="openr2_chan_new"
+   pbxfuncname="pri_sr_set_reversecharge"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OPENR2_FOUND=yes
+      AST_PRI_REVERSE_CHARGE_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_openr2_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopenr2" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lopenr2... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lopenr2 ${pbxlibdir}  $LIBS"
+LIBS="-lpri ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -27796,47 +29423,47 @@ 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_OPENR2_FOUND=yes
+  AST_PRI_REVERSE_CHARGE_FOUND=yes
 else
-  AST_OPENR2_FOUND=no
+  AST_PRI_REVERSE_CHARGE_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_OPENR2_FOUND}" = "yes"; then
-      OPENR2_LIB="${pbxlibdir} -lopenr2 "
-      # if --with-OPENR2=DIR has been specified, use it.
-      if test "x${OPENR2_DIR}" != "x"; then
-         OPENR2_INCLUDE="-I${OPENR2_DIR}/include"
+   if test "${AST_PRI_REVERSE_CHARGE_FOUND}" = "yes"; then
+      PRI_REVERSE_CHARGE_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_REVERSE_CHARGE=DIR has been specified, use it.
+      if test "x${PRI_REVERSE_CHARGE_DIR}" != "x"; then
+         PRI_REVERSE_CHARGE_INCLUDE="-I${PRI_REVERSE_CHARGE_DIR}/include"
       fi
-      OPENR2_INCLUDE="${OPENR2_INCLUDE} "
-      if test "xopenr2.h" = "x" ; then # no header, assume found
-         OPENR2_HEADER_FOUND="1"
+      PRI_REVERSE_CHARGE_INCLUDE="${PRI_REVERSE_CHARGE_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_REVERSE_CHARGE_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${OPENR2_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "openr2.h" "ac_cv_header_openr2_h" "$ac_includes_default"
-if test "x$ac_cv_header_openr2_h" = xyes; then :
-  OPENR2_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${PRI_REVERSE_CHARGE_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
+  PRI_REVERSE_CHARGE_HEADER_FOUND=1
 else
-  OPENR2_HEADER_FOUND=0
+  PRI_REVERSE_CHARGE_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${OPENR2_HEADER_FOUND}" = "x0" ; then
-         OPENR2_LIB=""
-         OPENR2_INCLUDE=""
+      if test "x${PRI_REVERSE_CHARGE_HEADER_FOUND}" = "x0" ; then
+         PRI_REVERSE_CHARGE_LIB=""
+         PRI_REVERSE_CHARGE_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            OPENR2_LIB=""
+            PRI_REVERSE_CHARGE_LIB=""
          fi
-         PBX_OPENR2=1
+         PBX_PRI_REVERSE_CHARGE=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENR2 1
+#define HAVE_PRI_REVERSE_CHARGE 1
 _ACEOF
 
       fi
@@ -27844,32 +29471,33 @@ _ACEOF
 fi
 
 
+# ------------------------------------^
 
 
-if test "x${PBX_OPUS}" != "x1" -a "${USE_OPUS}" != "no"; then
+if test "x${PBX_RESAMPLE}" != "x1" -a "${USE_RESAMPLE}" != "no"; then
    pbxlibdir=""
-   # if --with-OPUS=DIR has been specified, use it.
-   if test "x${OPUS_DIR}" != "x"; then
-      if test -d ${OPUS_DIR}/lib; then
-         pbxlibdir="-L${OPUS_DIR}/lib"
+   # if --with-RESAMPLE=DIR has been specified, use it.
+   if test "x${RESAMPLE_DIR}" != "x"; then
+      if test -d ${RESAMPLE_DIR}/lib; then
+         pbxlibdir="-L${RESAMPLE_DIR}/lib"
       else
-         pbxlibdir="-L${OPUS_DIR}"
+         pbxlibdir="-L${RESAMPLE_DIR}"
       fi
    fi
-   pbxfuncname="opus_encoder_create"
+   pbxfuncname="resample_open"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OPUS_FOUND=yes
+      AST_RESAMPLE_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_opus_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopus" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lopus... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_resample_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lresample" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lresample... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lopus ${pbxlibdir}  $LIBS"
+LIBS="-lresample ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -27901,47 +29529,47 @@ 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_OPUS_FOUND=yes
+  AST_RESAMPLE_FOUND=yes
 else
-  AST_OPUS_FOUND=no
+  AST_RESAMPLE_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_OPUS_FOUND}" = "yes"; then
-      OPUS_LIB="${pbxlibdir} -lopus "
-      # if --with-OPUS=DIR has been specified, use it.
-      if test "x${OPUS_DIR}" != "x"; then
-         OPUS_INCLUDE="-I${OPUS_DIR}/include"
+   if test "${AST_RESAMPLE_FOUND}" = "yes"; then
+      RESAMPLE_LIB="${pbxlibdir} -lresample -lm"
+      # if --with-RESAMPLE=DIR has been specified, use it.
+      if test "x${RESAMPLE_DIR}" != "x"; then
+         RESAMPLE_INCLUDE="-I${RESAMPLE_DIR}/include"
       fi
-      OPUS_INCLUDE="${OPUS_INCLUDE} "
-      if test "xopus/opus.h" = "x" ; then      # no header, assume found
-         OPUS_HEADER_FOUND="1"
+      RESAMPLE_INCLUDE="${RESAMPLE_INCLUDE} "
+      if test "xlibresample.h" = "x" ; then    # no header, assume found
+         RESAMPLE_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${OPUS_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "opus/opus.h" "ac_cv_header_opus_opus_h" "$ac_includes_default"
-if test "x$ac_cv_header_opus_opus_h" = xyes; then :
-  OPUS_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${RESAMPLE_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libresample.h" "ac_cv_header_libresample_h" "$ac_includes_default"
+if test "x$ac_cv_header_libresample_h" = xyes; then :
+  RESAMPLE_HEADER_FOUND=1
 else
-  OPUS_HEADER_FOUND=0
+  RESAMPLE_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${OPUS_HEADER_FOUND}" = "x0" ; then
-         OPUS_LIB=""
-         OPUS_INCLUDE=""
+      if test "x${RESAMPLE_HEADER_FOUND}" = "x0" ; then
+         RESAMPLE_LIB=""
+         RESAMPLE_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            OPUS_LIB=""
+            RESAMPLE_LIB=""
          fi
-         PBX_OPUS=1
+         PBX_RESAMPLE=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_OPUS 1
+#define HAVE_RESAMPLE 1
 _ACEOF
 
       fi
 
 
 
-if test "${USE_PWLIB}" != "no"; then
-       if test -n "${PWLIB_DIR}"; then
-               PWLIBDIR="${PWLIB_DIR}"
-       fi
-
-
-
-PWLIB_INCDIR=
-PWLIB_LIBDIR=
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test "x${PBX_FFTW3}" != "x1" -a "${USE_FFTW3}" != "no"; then
+   pbxlibdir=""
+   # if --with-FFTW3=DIR has been specified, use it.
+   if test "x${FFTW3_DIR}" != "x"; then
+      if test -d ${FFTW3_DIR}/lib; then
+         pbxlibdir="-L${FFTW3_DIR}/lib"
+      else
+         pbxlibdir="-L${FFTW3_DIR}"
+      fi
+   fi
+   pbxfuncname="fftw_alloc_real"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_FFTW3_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_fftw3_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lfftw3" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lfftw3... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfftw3 ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-if test "${PWLIBDIR:-unset}" != "unset" ; then
-  as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/version.h" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/version.h" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAS_PWLIB=1
+/* 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
-if test "${HAS_PWLIB:-unset}" = "unset" ; then
-  if test "${OPENH323DIR:-unset}" != "unset"; then
-    as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/../pwlib/version.h" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/../pwlib/version.h" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAS_PWLIB=1
+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_FFTW3_FOUND=yes
+else
+  AST_FFTW3_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-  fi
-  if test "${HAS_PWLIB:-unset}" != "unset" ; then
-    PWLIBDIR="${OPENH323DIR}/../pwlib"
-  else
-    as_ac_Header=`$as_echo "ac_cv_header_${HOME}/pwlib/include/ptlib.h" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "${HOME}/pwlib/include/ptlib.h" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAS_PWLIB=1
+   # now check for the header.
+   if test "${AST_FFTW3_FOUND}" = "yes"; then
+      FFTW3_LIB="${pbxlibdir} -lfftw3 "
+      # if --with-FFTW3=DIR has been specified, use it.
+      if test "x${FFTW3_DIR}" != "x"; then
+         FFTW3_INCLUDE="-I${FFTW3_DIR}/include"
+      fi
+      FFTW3_INCLUDE="${FFTW3_INCLUDE} "
+      if test "xfftw3.h" = "x" ; then  # no header, assume found
+         FFTW3_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FFTW3_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default"
+if test "x$ac_cv_header_fftw3_h" = xyes; then :
+  FFTW3_HEADER_FOUND=1
+else
+  FFTW3_HEADER_FOUND=0
 fi
 
 
-    if test "${HAS_PWLIB:-unset}" != "unset" ; then
-      PWLIBDIR="${HOME}/pwlib"
-    else
-      ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/local/include/ptlib.h" "ac_cv_header__usr_local_include_ptlib_h" "$ac_includes_default"
-if test "x$ac_cv_header__usr_local_include_ptlib_h" = xyes; then :
-  HAS_PWLIB=1
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${FFTW3_HEADER_FOUND}" = "x0" ; then
+         FFTW3_LIB=""
+         FFTW3_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            FFTW3_LIB=""
+         fi
+         PBX_FFTW3=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_FFTW3 1
+_ACEOF
+
+      fi
+   fi
 fi
 
 
-      if test "${HAS_PWLIB:-unset}" != "unset" ; then
-        # Extract the first word of "ptlib-config", so it can be a program name with args.
-set dummy ptlib-config; 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_PTLIB_CONFIG+:} false; then :
+
+if test "x${PBX_SNDFILE}" != "x1" -a "${USE_SNDFILE}" != "no"; then
+   pbxlibdir=""
+   # if --with-SNDFILE=DIR has been specified, use it.
+   if test "x${SNDFILE_DIR}" != "x"; then
+      if test -d ${SNDFILE_DIR}/lib; then
+         pbxlibdir="-L${SNDFILE_DIR}/lib"
+      else
+         pbxlibdir="-L${SNDFILE_DIR}"
+      fi
+   fi
+   pbxfuncname="sf_open"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SNDFILE_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_sndfile_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsndfile" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lsndfile... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $PTLIB_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PTLIB_CONFIG="$PTLIB_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /usr/local/bin$PATH_SEPARATOR/usr/local/share/pwlib/make
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PTLIB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsndfile ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-  ;;
-esac
+/* 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
-PTLIB_CONFIG=$ac_cv_path_PTLIB_CONFIG
-if test -n "$PTLIB_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTLIB_CONFIG" >&5
-$as_echo "$PTLIB_CONFIG" >&6; }
+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_SNDFILE_FOUND=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  AST_SNDFILE_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-        PWLIB_INCDIR="/usr/local/include"
-        PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir 2>/dev/null`
-        if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
-          PWLIB_LIBDIR=`${PTLIB_CONFIG} --ptlibdir 2>/dev/null`
-        fi
-        if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
-          if test "x$LIB64" != "x"; then
-            PWLIB_LIBDIR="/usr/local/lib64"
-          else
-            PWLIB_LIBDIR="/usr/local/lib"
-          fi
-        fi
-        PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs`
-        PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`"
-      else
-        ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/include/ptlib.h" "ac_cv_header__usr_include_ptlib_h" "$ac_includes_default"
-if test "x$ac_cv_header__usr_include_ptlib_h" = xyes; then :
-  HAS_PWLIB=1
+   # now check for the header.
+   if test "${AST_SNDFILE_FOUND}" = "yes"; then
+      SNDFILE_LIB="${pbxlibdir} -lsndfile "
+      # if --with-SNDFILE=DIR has been specified, use it.
+      if test "x${SNDFILE_DIR}" != "x"; then
+         SNDFILE_INCLUDE="-I${SNDFILE_DIR}/include"
+      fi
+      SNDFILE_INCLUDE="${SNDFILE_INCLUDE} "
+      if test "xsndfile.h" = "x" ; then        # no header, assume found
+         SNDFILE_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SNDFILE_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "sndfile.h" "ac_cv_header_sndfile_h" "$ac_includes_default"
+if test "x$ac_cv_header_sndfile_h" = xyes; then :
+  SNDFILE_HEADER_FOUND=1
+else
+  SNDFILE_HEADER_FOUND=0
 fi
 
 
-        if test "${HAS_PWLIB:-unset}" != "unset" ; then
-          # Extract the first word of "ptlib-config", so it can be a program name with args.
-set dummy ptlib-config; 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_PTLIB_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PTLIB_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PTLIB_CONFIG="$PTLIB_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /usr/bin$PATH_SEPARATOR/usr/share/pwlib/make
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PTLIB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${SNDFILE_HEADER_FOUND}" = "x0" ; then
+         SNDFILE_LIB=""
+         SNDFILE_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            SNDFILE_LIB=""
+         fi
+         PBX_SNDFILE=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SNDFILE 1
+_ACEOF
 
-  ;;
-esac
-fi
-PTLIB_CONFIG=$ac_cv_path_PTLIB_CONFIG
-if test -n "$PTLIB_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTLIB_CONFIG" >&5
-$as_echo "$PTLIB_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+      fi
+   fi
 fi
 
 
-          PWLIB_INCDIR="/usr/include"
-          PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir 2>/dev/null`
-          if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
-            PWLIB_LIBDIR=`${PTLIB_CONFIG} --ptlibdir 2>/dev/null`
-          fi
-          if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
-            if test "x$LIB64" != "x"; then
-              PWLIB_LIBDIR="/usr/lib64"
+
+
+    if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
+        if test "xminimum version of SpanDSP" != "x"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for minimum version of SpanDSP" >&5
+$as_echo_n "checking for minimum version of SpanDSP... " >&6; }
+       else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"
+               #if SPANDSP_RELEASE_DATE < 20080516
+               #error \"spandsp 0.0.5 or greater is required\"
+               #endif
+       \" compiles using spandsp/version.h" >&5
+$as_echo_n "checking if \"
+               #if SPANDSP_RELEASE_DATE < 20080516
+               #error \"spandsp 0.0.5 or greater is required\"
+               #endif
+       \" compiles using spandsp/version.h... " >&6; }
+       fi
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${SPANDSP_DIR}" != "x"; then
+           SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <spandsp/version.h>
+int
+main ()
+{
+
+               #if SPANDSP_RELEASE_DATE < 20080516
+               #error "spandsp 0.0.5 or greater is required"
+               #endif
+       ;
+
+  ;
+  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_SPANDSP=1
+
+$as_echo "#define HAVE_SPANDSP 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_SPANDSP}" = "x1" ; then
+       # We found the correct version in the header, now let's make sure it links
+       # properly, and that libtiff is available
+       PBX_SPANDSP=0
+
+if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
+   pbxlibdir=""
+   # if --with-SPANDSP=DIR has been specified, use it.
+   if test "x${SPANDSP_DIR}" != "x"; then
+      if test -d ${SPANDSP_DIR}/lib; then
+         pbxlibdir="-L${SPANDSP_DIR}/lib"
+      else
+         pbxlibdir="-L${SPANDSP_DIR}"
+      fi
+   fi
+   pbxfuncname="span_set_message_handler"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SPANDSP_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lspandsp ${pbxlibdir} -ltiff $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_SPANDSP_FOUND=yes
+else
+  AST_SPANDSP_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_SPANDSP_FOUND}" = "yes"; then
+      SPANDSP_LIB="${pbxlibdir} -lspandsp -ltiff"
+      # if --with-SPANDSP=DIR has been specified, use it.
+      if test "x${SPANDSP_DIR}" != "x"; then
+         SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
+      fi
+      SPANDSP_INCLUDE="${SPANDSP_INCLUDE} "
+      if test "xspandsp.h" = "x" ; then        # no header, assume found
+         SPANDSP_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
+if test "x$ac_cv_header_spandsp_h" = xyes; then :
+  SPANDSP_HEADER_FOUND=1
+else
+  SPANDSP_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${SPANDSP_HEADER_FOUND}" = "x0" ; then
+         SPANDSP_LIB=""
+         SPANDSP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            SPANDSP_LIB=""
+         fi
+         PBX_SPANDSP=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SPANDSP 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+fi
+
+if test "x${PBX_SPANDSP}" = "x1" ; then
+       # We also need t38_terminal_init()
+       PBX_SPANDSP=0
+
+if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
+   pbxlibdir=""
+   # if --with-SPANDSP=DIR has been specified, use it.
+   if test "x${SPANDSP_DIR}" != "x"; then
+      if test -d ${SPANDSP_DIR}/lib; then
+         pbxlibdir="-L${SPANDSP_DIR}/lib"
+      else
+         pbxlibdir="-L${SPANDSP_DIR}"
+      fi
+   fi
+   pbxfuncname="t38_terminal_init"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SPANDSP_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lspandsp ${pbxlibdir} -ltiff $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_SPANDSP_FOUND=yes
+else
+  AST_SPANDSP_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_SPANDSP_FOUND}" = "yes"; then
+      SPANDSP_LIB="${pbxlibdir} -lspandsp -ltiff"
+      # if --with-SPANDSP=DIR has been specified, use it.
+      if test "x${SPANDSP_DIR}" != "x"; then
+         SPANDSP_INCLUDE="-I${SPANDSP_DIR}/include"
+      fi
+      SPANDSP_INCLUDE="${SPANDSP_INCLUDE} "
+      if test "xspandsp.h" = "x" ; then        # no header, assume found
+         SPANDSP_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
+if test "x$ac_cv_header_spandsp_h" = xyes; then :
+  SPANDSP_HEADER_FOUND=1
+else
+  SPANDSP_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${SPANDSP_HEADER_FOUND}" = "x0" ; then
+         SPANDSP_LIB=""
+         SPANDSP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            SPANDSP_LIB=""
+         fi
+         PBX_SPANDSP=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SPANDSP 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+fi
+
+# Check for libss7 v2.0 branch compatible version.
+
+if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
+   pbxlibdir=""
+   # if --with-SS7=DIR has been specified, use it.
+   if test "x${SS7_DIR}" != "x"; then
+      if test -d ${SS7_DIR}/lib; then
+         pbxlibdir="-L${SS7_DIR}/lib"
+      else
+         pbxlibdir="-L${SS7_DIR}"
+      fi
+   fi
+   pbxfuncname="ss7_set_isup_timer"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SS7_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_ss7_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lss7" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lss7... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lss7 ${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 ${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_SS7_FOUND=yes
+else
+  AST_SS7_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_SS7_FOUND}" = "yes"; then
+      SS7_LIB="${pbxlibdir} -lss7 "
+      # if --with-SS7=DIR has been specified, use it.
+      if test "x${SS7_DIR}" != "x"; then
+         SS7_INCLUDE="-I${SS7_DIR}/include"
+      fi
+      SS7_INCLUDE="${SS7_INCLUDE} "
+      if test "xlibss7.h" = "x" ; then # no header, assume found
+         SS7_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${SS7_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libss7.h" "ac_cv_header_libss7_h" "$ac_includes_default"
+if test "x$ac_cv_header_libss7_h" = xyes; then :
+  SS7_HEADER_FOUND=1
+else
+  SS7_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${SS7_HEADER_FOUND}" = "x0" ; then
+         SS7_LIB=""
+         SS7_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            SS7_LIB=""
+         fi
+         PBX_SS7=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SS7 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+
+if test "x${PBX_OPENR2}" != "x1" -a "${USE_OPENR2}" != "no"; then
+   pbxlibdir=""
+   # if --with-OPENR2=DIR has been specified, use it.
+   if test "x${OPENR2_DIR}" != "x"; then
+      if test -d ${OPENR2_DIR}/lib; then
+         pbxlibdir="-L${OPENR2_DIR}/lib"
+      else
+         pbxlibdir="-L${OPENR2_DIR}"
+      fi
+   fi
+   pbxfuncname="openr2_chan_new"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_OPENR2_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_openr2_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopenr2" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lopenr2... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lopenr2 ${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 ${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_OPENR2_FOUND=yes
+else
+  AST_OPENR2_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_OPENR2_FOUND}" = "yes"; then
+      OPENR2_LIB="${pbxlibdir} -lopenr2 "
+      # if --with-OPENR2=DIR has been specified, use it.
+      if test "x${OPENR2_DIR}" != "x"; then
+         OPENR2_INCLUDE="-I${OPENR2_DIR}/include"
+      fi
+      OPENR2_INCLUDE="${OPENR2_INCLUDE} "
+      if test "xopenr2.h" = "x" ; then # no header, assume found
+         OPENR2_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OPENR2_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openr2.h" "ac_cv_header_openr2_h" "$ac_includes_default"
+if test "x$ac_cv_header_openr2_h" = xyes; then :
+  OPENR2_HEADER_FOUND=1
+else
+  OPENR2_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${OPENR2_HEADER_FOUND}" = "x0" ; then
+         OPENR2_LIB=""
+         OPENR2_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            OPENR2_LIB=""
+         fi
+         PBX_OPENR2=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_OPENR2 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+
+if test "x${PBX_OPUS}" != "x1" -a "${USE_OPUS}" != "no"; then
+   pbxlibdir=""
+   # if --with-OPUS=DIR has been specified, use it.
+   if test "x${OPUS_DIR}" != "x"; then
+      if test -d ${OPUS_DIR}/lib; then
+         pbxlibdir="-L${OPUS_DIR}/lib"
+      else
+         pbxlibdir="-L${OPUS_DIR}"
+      fi
+   fi
+   pbxfuncname="opus_encoder_create"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_OPUS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_opus_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopus" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lopus... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lopus ${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 ${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_OPUS_FOUND=yes
+else
+  AST_OPUS_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_OPUS_FOUND}" = "yes"; then
+      OPUS_LIB="${pbxlibdir} -lopus "
+      # if --with-OPUS=DIR has been specified, use it.
+      if test "x${OPUS_DIR}" != "x"; then
+         OPUS_INCLUDE="-I${OPUS_DIR}/include"
+      fi
+      OPUS_INCLUDE="${OPUS_INCLUDE} "
+      if test "xopus/opus.h" = "x" ; then      # no header, assume found
+         OPUS_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OPUS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "opus/opus.h" "ac_cv_header_opus_opus_h" "$ac_includes_default"
+if test "x$ac_cv_header_opus_opus_h" = xyes; then :
+  OPUS_HEADER_FOUND=1
+else
+  OPUS_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${OPUS_HEADER_FOUND}" = "x0" ; then
+         OPUS_LIB=""
+         OPUS_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            OPUS_LIB=""
+         fi
+         PBX_OPUS=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_OPUS 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
+if test "${USE_PWLIB}" != "no"; then
+       if test -n "${PWLIB_DIR}"; then
+               PWLIBDIR="${PWLIB_DIR}"
+       fi
+
+
+
+PWLIB_INCDIR=
+PWLIB_LIBDIR=
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+if test "${PWLIBDIR:-unset}" != "unset" ; then
+  as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/version.h" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  HAS_PWLIB=1
+fi
+
+
+fi
+if test "${HAS_PWLIB:-unset}" = "unset" ; then
+  if test "${OPENH323DIR:-unset}" != "unset"; then
+    as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/../pwlib/version.h" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/../pwlib/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  HAS_PWLIB=1
+fi
+
+
+  fi
+  if test "${HAS_PWLIB:-unset}" != "unset" ; then
+    PWLIBDIR="${OPENH323DIR}/../pwlib"
+  else
+    as_ac_Header=`$as_echo "ac_cv_header_${HOME}/pwlib/include/ptlib.h" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "${HOME}/pwlib/include/ptlib.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  HAS_PWLIB=1
+fi
+
+
+    if test "${HAS_PWLIB:-unset}" != "unset" ; then
+      PWLIBDIR="${HOME}/pwlib"
+    else
+      ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/local/include/ptlib.h" "ac_cv_header__usr_local_include_ptlib_h" "$ac_includes_default"
+if test "x$ac_cv_header__usr_local_include_ptlib_h" = xyes; then :
+  HAS_PWLIB=1
+fi
+
+
+      if test "${HAS_PWLIB:-unset}" != "unset" ; then
+        # Extract the first word of "ptlib-config", so it can be a program name with args.
+set dummy ptlib-config; 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_PTLIB_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PTLIB_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PTLIB_CONFIG="$PTLIB_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /usr/local/bin$PATH_SEPARATOR/usr/local/share/pwlib/make
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PTLIB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PTLIB_CONFIG=$ac_cv_path_PTLIB_CONFIG
+if test -n "$PTLIB_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTLIB_CONFIG" >&5
+$as_echo "$PTLIB_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+        PWLIB_INCDIR="/usr/local/include"
+        PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir 2>/dev/null`
+        if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
+          PWLIB_LIBDIR=`${PTLIB_CONFIG} --ptlibdir 2>/dev/null`
+        fi
+        if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
+          if test "x$LIB64" != "x"; then
+            PWLIB_LIBDIR="/usr/local/lib64"
+          else
+            PWLIB_LIBDIR="/usr/local/lib"
+          fi
+        fi
+        PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs`
+        PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`"
+      else
+        ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/include/ptlib.h" "ac_cv_header__usr_include_ptlib_h" "$ac_includes_default"
+if test "x$ac_cv_header__usr_include_ptlib_h" = xyes; then :
+  HAS_PWLIB=1
+fi
+
+
+        if test "${HAS_PWLIB:-unset}" != "unset" ; then
+          # Extract the first word of "ptlib-config", so it can be a program name with args.
+set dummy ptlib-config; 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_PTLIB_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PTLIB_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PTLIB_CONFIG="$PTLIB_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /usr/bin$PATH_SEPARATOR/usr/share/pwlib/make
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PTLIB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PTLIB_CONFIG=$ac_cv_path_PTLIB_CONFIG
+if test -n "$PTLIB_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTLIB_CONFIG" >&5
+$as_echo "$PTLIB_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+          PWLIB_INCDIR="/usr/include"
+          PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir 2>/dev/null`
+          if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
+            PWLIB_LIBDIR=`${PTLIB_CONFIG} --ptlibdir 2>/dev/null`
+          fi
+          if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
+            if test "x$LIB64" != "x"; then
+              PWLIB_LIBDIR="/usr/lib64"
             else
               PWLIB_LIBDIR="/usr/lib"
             fi
@@ -28179,36 +30608,369 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-       if test "xP[WT]LIB_VERSION" != "x"; then
-               VNAME="P[WT]LIB_VERSION"
+       if test "xP[WT]LIB_VERSION" != "x"; then
+               VNAME="P[WT]LIB_VERSION"
+               else
+               VNAME="PWLIB_VERSION"
+       fi
+
+       if test "${HAS_PWLIB:-unset}" != "unset"; then
+               PWLIB_VERSION=`grep "$VNAME \"" ${PWLIB_INCDIR}/ptbuildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
+               PWLIB_MAJOR_VERSION=`echo ${PWLIB_VERSION} | cut -f1 -d.`
+               PWLIB_MINOR_VERSION=`echo ${PWLIB_VERSION} | cut -f2 -d.`
+               PWLIB_BUILD_NUMBER=`echo ${PWLIB_VERSION} | cut -f3 -d.`
+               PWLIB_VER=$((${PWLIB_MAJOR_VERSION}*10000+${PWLIB_MINOR_VERSION}*100+${PWLIB_BUILD_NUMBER}))
+               PWLIB_REQ=$((1*10000+9*100+2))
+               if test "x" = "x"; then
+                       PWLIB_MAX=9999999
+               else
+                       PWLIB_MAX=$((*10000+*100+))
+               fi
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PWLib version ${PWLIB_VERSION} is compatible with chan_h323" >&5
+$as_echo_n "checking if PWLib version ${PWLIB_VERSION} is compatible with chan_h323... " >&6; }
+               if test ${PWLIB_VER} -lt ${PWLIB_REQ}; then
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                       unset HAS_PWLIB
+               else
+                       if test ${PWLIB_VER} -gt ${PWLIB_MAX}; then
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                               unset HAS_PWLIB
+                       else
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                       fi
+               fi
+       fi
+
+
+       if test "${HAS_PWLIB:-unset}" != "unset"; then
+
+PWLIB_OSTYPE=
+case "$host_os" in
+  linux*)          PWLIB_OSTYPE=linux ;
+               ;;
+  freebsd* )       PWLIB_OSTYPE=FreeBSD ;
+               ;;
+  openbsd* )       PWLIB_OSTYPE=OpenBSD ;
+                                  ENDLDLIBS="-lossaudio" ;
+               ;;
+  netbsd* )        PWLIB_OSTYPE=NetBSD ;
+                                  ENDLDLIBS="-lossaudio" ;
+               ;;
+  solaris* | sunos* ) PWLIB_OSTYPE=solaris ;
+               ;;
+  darwin* )           PWLIB_OSTYPE=Darwin ;
+               ;;
+  beos*)           PWLIB_OSTYPE=beos ;
+                   STDCCFLAGS="$STDCCFLAGS -D__BEOS__"
+               ;;
+  cygwin*)         PWLIB_OSTYPE=cygwin ;
+               ;;
+  mingw*)             PWLIB_OSTYPE=mingw ;
+                          STDCCFLAGS="$STDCCFLAGS -mms-bitfields" ;
+                          ENDLDLIBS="-lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32" ;
+               ;;
+  * )                 PWLIB_OSTYPE="$host_os" ;
+                          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"OS $PWLIB_OSTYPE not recognized - proceed with caution!\"" >&5
+$as_echo "$as_me: WARNING: \"OS $PWLIB_OSTYPE not recognized - proceed with caution!\"" >&2;} ;
+               ;;
+esac
+
+PWLIB_MACHTYPE=
+case "$host_cpu" in
+   x86 | i686 | i586 | i486 | i386 ) PWLIB_MACHTYPE=x86
+                   ;;
+
+   x86_64)        PWLIB_MACHTYPE=x86_64 ;
+                  P_64BIT=1 ;
+                   LIB64=1 ;
+                  ;;
+
+   alpha | alphaev56 | alphaev6 | alphaev67 | alphaev7) PWLIB_MACHTYPE=alpha ;
+                  P_64BIT=1 ;
+                  ;;
+
+   sparc )         PWLIB_MACHTYPE=sparc ;
+                  ;;
+
+   powerpc )       PWLIB_MACHTYPE=ppc ;
+                  ;;
+
+   ppc )           PWLIB_MACHTYPE=ppc ;
+                  ;;
+
+   powerpc64 )     PWLIB_MACHTYPE=ppc64 ;
+                  P_64BIT=1 ;
+                   LIB64=1 ;
+                  ;;
+
+   ppc64 )         PWLIB_MACHTYPE=ppc64 ;
+                  P_64BIT=1 ;
+                   LIB64=1 ;
+                  ;;
+
+   ia64)          PWLIB_MACHTYPE=ia64 ;
+                  P_64BIT=1 ;
+                  ;;
+
+   s390x)         PWLIB_MACHTYPE=s390x ;
+                  P_64BIT=1 ;
+                   LIB64=1 ;
+                  ;;
+
+   s390)          PWLIB_MACHTYPE=s390 ;
+                  ;;
+
+   * )            PWLIB_MACHTYPE="$host_cpu";
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"CPU $PWLIB_MACHTYPE not recognized - proceed with caution!\"" >&5
+$as_echo "$as_me: WARNING: \"CPU $PWLIB_MACHTYPE not recognized - proceed with caution!\"" >&2;} ;;
+esac
+
+PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}"
+
+
+
+
+               PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
+
+
+       if test "${HAS_PWLIB:-unset}" != "unset"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking PWLib installation validity" >&5
+$as_echo_n "checking PWLib installation validity... " >&6; }
+
+          saved_cppflags="${CPPFLAGS}"
+          saved_libs="${LIBS}"
+          if test "${PWLIB_LIB:-unset}" != "unset"; then
+             LIBS="${LIBS} ${PWLIB_LIB} "
+          else
+             LIBS="${LIBS} -L${PWLIB_LIBDIR} -l${PLATFORM_PWLIB} "
+          fi
+          CPPFLAGS="${CPPFLAGS} -I${PWLIB_INCDIR} "
+
+          ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "ptlib.h"
+int
+main ()
+{
+int q = (int) PTime::IsDaylightSavings();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                       ac_cv_lib_PWLIB="yes"
+
+else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                       ac_cv_lib_PWLIB="no"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+          ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+          LIBS="${saved_libs}"
+          CPPFLAGS="${saved_cppflags}"
+
+          if test "${ac_cv_lib_PWLIB}" = "yes"; then
+             if test "${PWLIB_LIB:-undef}" = "undef"; then
+                if test "${PWLIB_LIBDIR}" != "" -a "${PWLIB_LIBDIR}" != "/usr/lib"; then
+                   PWLIB_LIB="-L${PWLIB_LIBDIR} -l${PLATFORM_PWLIB}"
+                else
+                   PWLIB_LIB="-l${PLATFORM_PWLIB}"
+                fi
+             fi
+             if test "${PWLIB_INCDIR}" != "" -a "${PWLIB_INCDIR}" != "/usr/include"; then
+                PWLIB_INCLUDE="-I${PWLIB_INCDIR}"
+             fi
+                 PBX_PWLIB=1
+
+$as_echo "#define HAVE_PWLIB 1" >>confdefs.h
+
+          fi
+       fi
+
+       fi
+fi
+
+if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
+       if test -n "${OPENH323_DIR}"; then
+               OPENH323DIR="${OPENH323_DIR}"
+       fi
+
+OPENH323_INCDIR=
+OPENH323_LIBDIR=
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+if test "${OPENH323DIR:-unset}" != "unset" ; then
+  as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/version.h" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  HAS_OPENH323=1
+fi
+
+
+fi
+if test "${HAS_OPENH323:-unset}" = "unset" ; then
+  as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/../openh323/version.h" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/../openh323/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1
+fi
+
+
+  if test "${HAS_OPENH323:-unset}" != "unset" ; then
+    OPENH323DIR="${PWLIBDIR}/../openh323"
+    saved_cppflags="${CPPFLAGS}"
+    CPPFLAGS="${CPPFLAGS} -I${PWLIB_INCDIR}/openh323 -I${PWLIB_INCDIR}"
+    as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/include/h323.h" | $as_tr_sh`
+ac_fn_cxx_check_header_compile "$LINENO" "${OPENH323DIR}/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+
+else
+  OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}"
+fi
+
+
+    CPPFLAGS="${saved_cppflags}"
+  else
+    saved_cppflags="${CPPFLAGS}"
+    CPPFLAGS="${CPPFLAGS} -I${HOME}/openh323/include -I${PWLIB_INCDIR}"
+    as_ac_Header=`$as_echo "ac_cv_header_${HOME}/openh323/include/h323.h" | $as_tr_sh`
+ac_fn_cxx_check_header_compile "$LINENO" "${HOME}/openh323/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  HAS_OPENH323=1
+fi
+
+
+    CPPFLAGS="${saved_cppflags}"
+    if test "${HAS_OPENH323:-unset}" != "unset" ; then
+      OPENH323DIR="${HOME}/openh323"
+    else
+      saved_cppflags="${CPPFLAGS}"
+      CPPFLAGS="${CPPFLAGS} -I/usr/local/include/openh323 -I${PWLIB_INCDIR}"
+      ac_fn_cxx_check_header_compile "$LINENO" "/usr/local/include/openh323/h323.h" "ac_cv_header__usr_local_include_openh323_h323_h" "#include <ptlib.h>
+"
+if test "x$ac_cv_header__usr_local_include_openh323_h323_h" = xyes; then :
+  HAS_OPENH323=1
+fi
+
+
+      CPPFLAGS="${saved_cppflags}"
+      if test "${HAS_OPENH323:-unset}" != "unset" ; then
+        OPENH323DIR="/usr/local/share/openh323"
+        OPENH323_INCDIR="/usr/local/include/openh323"
+        if test "x$LIB64" != "x" && test -d "/usr/local/lib64"; then
+          OPENH323_LIBDIR="/usr/local/lib64"
+        else
+          OPENH323_LIBDIR="/usr/local/lib"
+        fi
+      else
+        saved_cppflags="${CPPFLAGS}"
+        CPPFLAGS="${CPPFLAGS} -I/usr/include/openh323 -I${PWLIB_INCDIR}"
+        ac_fn_cxx_check_header_compile "$LINENO" "/usr/include/openh323/h323.h" "ac_cv_header__usr_include_openh323_h323_h" "#include <ptlib.h>
+"
+if test "x$ac_cv_header__usr_include_openh323_h323_h" = xyes; then :
+  HAS_OPENH323=1
+fi
+
+
+        CPPFLAGS="${saved_cppflags}"
+        if test "${HAS_OPENH323:-unset}" != "unset" ; then
+          OPENH323DIR="/usr/share/openh323"
+          OPENH323_INCDIR="/usr/include/openh323"
+          if test "x$LIB64" != "x" && test -d "/usr/local/lib64"; then
+            OPENH323_LIBDIR="/usr/lib64"
+          else
+            OPENH323_LIBDIR="/usr/lib"
+          fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+if test "${HAS_OPENH323:-unset}" != "unset" ; then
+  if test "${OPENH323_INCDIR:-unset}" = "unset"; then
+    OPENH323_INCDIR="${OPENH323DIR}/include"
+  fi
+  if test "${OPENH323_LIBDIR:-unset}" = "unset"; then
+    OPENH323_LIBDIR="${OPENH323DIR}/lib"
+  fi
+
+  OPENH323_LIBDIR="`cd ${OPENH323_LIBDIR}; pwd`"
+  OPENH323_INCDIR="`cd ${OPENH323_INCDIR}; pwd`"
+  OPENH323DIR="`cd ${OPENH323DIR}; pwd`"
+
+
+
+
+fi
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+       if test "x" != "x"; then
+               VNAME=""
                else
-               VNAME="PWLIB_VERSION"
+               VNAME="OPENH323_VERSION"
        fi
 
-       if test "${HAS_PWLIB:-unset}" != "unset"; then
-               PWLIB_VERSION=`grep "$VNAME \"" ${PWLIB_INCDIR}/ptbuildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
-               PWLIB_MAJOR_VERSION=`echo ${PWLIB_VERSION} | cut -f1 -d.`
-               PWLIB_MINOR_VERSION=`echo ${PWLIB_VERSION} | cut -f2 -d.`
-               PWLIB_BUILD_NUMBER=`echo ${PWLIB_VERSION} | cut -f3 -d.`
-               PWLIB_VER=$((${PWLIB_MAJOR_VERSION}*10000+${PWLIB_MINOR_VERSION}*100+${PWLIB_BUILD_NUMBER}))
-               PWLIB_REQ=$((1*10000+9*100+2))
-               if test "x" = "x"; then
-                       PWLIB_MAX=9999999
+       if test "${HAS_OPENH323:-unset}" != "unset"; then
+               OPENH323_VERSION=`grep "$VNAME \"" ${OPENH323_INCDIR}/openh323buildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
+               OPENH323_MAJOR_VERSION=`echo ${OPENH323_VERSION} | cut -f1 -d.`
+               OPENH323_MINOR_VERSION=`echo ${OPENH323_VERSION} | cut -f2 -d.`
+               OPENH323_BUILD_NUMBER=`echo ${OPENH323_VERSION} | cut -f3 -d.`
+               OPENH323_VER=$((${OPENH323_MAJOR_VERSION}*10000+${OPENH323_MINOR_VERSION}*100+${OPENH323_BUILD_NUMBER}))
+               OPENH323_REQ=$((1*10000+17*100+3))
+               if test "x0" = "x"; then
+                       OPENH323_MAX=9999999
                else
-                       PWLIB_MAX=$((*10000+*100+))
+                       OPENH323_MAX=$((1*10000+19*100+0))
                fi
 
-               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PWLib version ${PWLIB_VERSION} is compatible with chan_h323" >&5
-$as_echo_n "checking if PWLib version ${PWLIB_VERSION} is compatible with chan_h323... " >&6; }
-               if test ${PWLIB_VER} -lt ${PWLIB_REQ}; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OpenH323 version ${OPENH323_VERSION} is compatible with chan_h323" >&5
+$as_echo_n "checking if OpenH323 version ${OPENH323_VERSION} is compatible with chan_h323... " >&6; }
+               if test ${OPENH323_VER} -lt ${OPENH323_REQ}; then
                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-                       unset HAS_PWLIB
+                       unset HAS_OPENH323
                else
-                       if test ${PWLIB_VER} -gt ${PWLIB_MAX}; then
+                       if test ${OPENH323_VER} -gt ${OPENH323_MAX}; then
                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-                               unset HAS_PWLIB
+                               unset HAS_OPENH323
                        else
                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -28217,504 +30979,1147 @@ $as_echo "yes" >&6; }
        fi
 
 
-       if test "${HAS_PWLIB:-unset}" != "unset"; then
+       if test "${HAS_OPENH323:-unset}" != "unset"; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenH323 build option" >&5
+$as_echo_n "checking OpenH323 build option... " >&6; }
+               OPENH323_SUFFIX=
+               prefixes="h323_${PWLIB_PLATFORM}_ h323_ openh323"
+               for pfx in $prefixes; do
+                       #files=`ls -l /usr/local/lib/lib${pfx}*.so* 2>/dev/null`
+                       files=`ls -l ${OPENH323_LIBDIR}/lib${pfx}*.so* 2>/dev/null`
+                       if test -z "$files"; then
+                               # check the default location
+                               files=`ls -l /usr/local/lib/lib${pfx}*.so* 2>/dev/null`
+                       fi
+                       libfile=
+                       if test -n "$files"; then
+                               for f in $files; do
+                                       if test -f $f -a ! -L $f; then
+                                               libfile=`basename $f`
+                                               break;
+                                       fi
+                               done
+                       fi
+                       if test -n "$libfile"; then
+                               OPENH323_PREFIX=$pfx
+                               break;
+                       fi
+               done
+               if test "${libfile:-unset}" != "unset"; then
+                       OPENH323_SUFFIX=`eval "echo ${libfile} | sed -e 's/lib${OPENH323_PREFIX}\([^.]*\)\..*/\1/'"`
+               fi
+               case "${OPENH323_SUFFIX}" in
+                       n)
+                               OPENH323_BUILD="notrace";;
+                       r)
+                               OPENH323_BUILD="opt";;
+                       d)
+                               OPENH323_BUILD="debug";;
+                       *)
+                               if test "${OPENH323_PREFIX:-undef}" = "openh323"; then
+                                       notrace=`eval "grep NOTRACE ${OPENH323DIR}/openh323u.mak | grep = | sed -e 's/[A-Z0-9_]*[       ]*=[    ]*//'"`
+                                       if test "x$notrace" = "x"; then
+                                               notrace="0"
+                                       fi
+                                       if test "$notrace" -ne 0; then
+                                               OPENH323_BUILD="notrace"
+                                       else
+                                               OPENH323_BUILD="opt"
+                                       fi
+                                       OPENH323_LIB="-l${OPENH323_PREFIX}"
+                               else
+                                       OPENH323_BUILD="notrace"
+                               fi
+                               ;;
+               esac
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENH323_BUILD}" >&5
+$as_echo "${OPENH323_BUILD}" >&6; }
 
-PWLIB_OSTYPE=
-case "$host_os" in
-  linux*)          PWLIB_OSTYPE=linux ;
-               ;;
-  freebsd* )       PWLIB_OSTYPE=FreeBSD ;
-               ;;
-  openbsd* )       PWLIB_OSTYPE=OpenBSD ;
-                                  ENDLDLIBS="-lossaudio" ;
-               ;;
-  netbsd* )        PWLIB_OSTYPE=NetBSD ;
-                                  ENDLDLIBS="-lossaudio" ;
-               ;;
-  solaris* | sunos* ) PWLIB_OSTYPE=solaris ;
-               ;;
-  darwin* )           PWLIB_OSTYPE=Darwin ;
-               ;;
-  beos*)           PWLIB_OSTYPE=beos ;
-                   STDCCFLAGS="$STDCCFLAGS -D__BEOS__"
-               ;;
-  cygwin*)         PWLIB_OSTYPE=cygwin ;
-               ;;
-  mingw*)             PWLIB_OSTYPE=mingw ;
-                          STDCCFLAGS="$STDCCFLAGS -mms-bitfields" ;
-                          ENDLDLIBS="-lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32" ;
-               ;;
-  * )                 PWLIB_OSTYPE="$host_os" ;
-                          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"OS $PWLIB_OSTYPE not recognized - proceed with caution!\"" >&5
-$as_echo "$as_me: WARNING: \"OS $PWLIB_OSTYPE not recognized - proceed with caution!\"" >&2;} ;
-               ;;
-esac
 
-PWLIB_MACHTYPE=
-case "$host_cpu" in
-   x86 | i686 | i586 | i486 | i386 ) PWLIB_MACHTYPE=x86
-                   ;;
 
-   x86_64)        PWLIB_MACHTYPE=x86_64 ;
-                  P_64BIT=1 ;
-                   LIB64=1 ;
-                  ;;
+       fi
 
-   alpha | alphaev56 | alphaev6 | alphaev67 | alphaev7) PWLIB_MACHTYPE=alpha ;
-                  P_64BIT=1 ;
-                  ;;
+       PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
 
-   sparc )         PWLIB_MACHTYPE=sparc ;
-                  ;;
+       if test "${HAS_OPENH323:-unset}" != "unset"; then
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenH323 installation validity" >&5
+$as_echo_n "checking OpenH323 installation validity... " >&6; }
 
-   powerpc )       PWLIB_MACHTYPE=ppc ;
-                  ;;
+          saved_cppflags="${CPPFLAGS}"
+          saved_libs="${LIBS}"
+          if test "${OPENH323_LIB:-unset}" != "unset"; then
+             LIBS="${LIBS} ${OPENH323_LIB} ${PWLIB_LIB}"
+          else
+             LIBS="${LIBS} -L${OPENH323_LIBDIR} -l${PLATFORM_OPENH323} ${PWLIB_LIB}"
+          fi
+          CPPFLAGS="${CPPFLAGS} -I${OPENH323_INCDIR} ${PWLIB_INCLUDE}"
+
+          ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "ptlib.h"
+               #include "h323.h"
+               #include "h323ep.h"
+int
+main ()
+{
+H323EndPoint ep = H323EndPoint();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                       ac_cv_lib_OPENH323="yes"
+
+else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                       ac_cv_lib_OPENH323="no"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+          ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+          LIBS="${saved_libs}"
+          CPPFLAGS="${saved_cppflags}"
+
+          if test "${ac_cv_lib_OPENH323}" = "yes"; then
+             if test "${OPENH323_LIB:-undef}" = "undef"; then
+                if test "${OPENH323_LIBDIR}" != "" -a "${OPENH323_LIBDIR}" != "/usr/lib"; then
+                   OPENH323_LIB="-L${OPENH323_LIBDIR} -l${PLATFORM_OPENH323}"
+                else
+                   OPENH323_LIB="-l${PLATFORM_OPENH323}"
+                fi
+             fi
+             if test "${OPENH323_INCDIR}" != "" -a "${OPENH323_INCDIR}" != "/usr/include"; then
+                OPENH323_INCLUDE="-I${OPENH323_INCDIR}"
+             fi
+                 PBX_OPENH323=1
+
+$as_echo "#define HAVE_OPENH323 1" >>confdefs.h
+
+          fi
+       fi
+
+fi
+
+
+if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
+   pbxlibdir=""
+   # if --with-LUA=DIR has been specified, use it.
+   if test "x${LUA_DIR}" != "x"; then
+      if test -d ${LUA_DIR}/lib; then
+         pbxlibdir="-L${LUA_DIR}/lib"
+      else
+         pbxlibdir="-L${LUA_DIR}"
+      fi
+   fi
+   pbxfuncname="luaL_newstate"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LUA_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_lua5.2_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.2" >&5
+$as_echo_n "checking for ${pbxfuncname} in -llua5.2... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llua5.2 ${pbxlibdir} -lm $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_LUA_FOUND=yes
+else
+  AST_LUA_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LUA_FOUND}" = "yes"; then
+      LUA_LIB="${pbxlibdir} -llua5.2 -lm"
+      # if --with-LUA=DIR has been specified, use it.
+      if test "x${LUA_DIR}" != "x"; then
+         LUA_INCLUDE="-I${LUA_DIR}/include"
+      fi
+      LUA_INCLUDE="${LUA_INCLUDE} "
+      if test "xlua5.2/lua.h" = "x" ; then     # no header, assume found
+         LUA_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "lua5.2/lua.h" "ac_cv_header_lua5_2_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua5_2_lua_h" = xyes; then :
+  LUA_HEADER_FOUND=1
+else
+  LUA_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
+         LUA_LIB=""
+         LUA_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LUA_LIB=""
+         fi
+         PBX_LUA=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LUA 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+if test "x${PBX_LUA}" = "x1" ; then
+       if test x"${LUA_DIR}" = x; then
+               LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.2"
+       else
+               LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.2"
+       fi
+fi
+
+
+if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
+   pbxlibdir=""
+   # if --with-LUA=DIR has been specified, use it.
+   if test "x${LUA_DIR}" != "x"; then
+      if test -d ${LUA_DIR}/lib; then
+         pbxlibdir="-L${LUA_DIR}/lib"
+      else
+         pbxlibdir="-L${LUA_DIR}"
+      fi
+   fi
+   pbxfuncname="luaL_newstate"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LUA_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.1" >&5
+$as_echo_n "checking for ${pbxfuncname} in -llua5.1... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llua5.1 ${pbxlibdir} -lm $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_LUA_FOUND=yes
+else
+  AST_LUA_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LUA_FOUND}" = "yes"; then
+      LUA_LIB="${pbxlibdir} -llua5.1 -lm"
+      # if --with-LUA=DIR has been specified, use it.
+      if test "x${LUA_DIR}" != "x"; then
+         LUA_INCLUDE="-I${LUA_DIR}/include"
+      fi
+      LUA_INCLUDE="${LUA_INCLUDE} "
+      if test "xlua5.1/lua.h" = "x" ; then     # no header, assume found
+         LUA_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "lua5.1/lua.h" "ac_cv_header_lua5_1_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua5_1_lua_h" = xyes; then :
+  LUA_HEADER_FOUND=1
+else
+  LUA_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
+         LUA_LIB=""
+         LUA_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LUA_LIB=""
+         fi
+         PBX_LUA=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LUA 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+if test "x${PBX_LUA}" = "x1" ; then
+       if test x"${LUA_DIR}" = x; then
+               LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
+       else
+               LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
+       fi
+fi
+
+# Some distributions (like SuSE) remove the 5.1 suffix.
+
+if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
+   pbxlibdir=""
+   # if --with-LUA=DIR has been specified, use it.
+   if test "x${LUA_DIR}" != "x"; then
+      if test -d ${LUA_DIR}/lib; then
+         pbxlibdir="-L${LUA_DIR}/lib"
+      else
+         pbxlibdir="-L${LUA_DIR}"
+      fi
+   fi
+   pbxfuncname="luaL_openlib"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_LUA_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_lua_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua" >&5
+$as_echo_n "checking for ${pbxfuncname} in -llua... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llua ${pbxlibdir} -lm $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_LUA_FOUND=yes
+else
+  AST_LUA_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LUA_FOUND}" = "yes"; then
+      LUA_LIB="${pbxlibdir} -llua -lm"
+      # if --with-LUA=DIR has been specified, use it.
+      if test "x${LUA_DIR}" != "x"; then
+         LUA_INCLUDE="-I${LUA_DIR}/include"
+      fi
+      LUA_INCLUDE="${LUA_INCLUDE} "
+      if test "xlua.h" = "x" ; then    # no header, assume found
+         LUA_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua_h" = xyes; then :
+  LUA_HEADER_FOUND=1
+else
+  LUA_HEADER_FOUND=0
+fi
 
-   ppc )           PWLIB_MACHTYPE=ppc ;
-                  ;;
 
-   powerpc64 )     PWLIB_MACHTYPE=ppc64 ;
-                  P_64BIT=1 ;
-                   LIB64=1 ;
-                  ;;
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
+         LUA_LIB=""
+         LUA_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            LUA_LIB=""
+         fi
+         PBX_LUA=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_LUA 1
+_ACEOF
 
-   ppc64 )         PWLIB_MACHTYPE=ppc64 ;
-                  P_64BIT=1 ;
-                   LIB64=1 ;
-                  ;;
+      fi
+   fi
+fi
 
-   ia64)          PWLIB_MACHTYPE=ia64 ;
-                  P_64BIT=1 ;
-                  ;;
 
-   s390x)         PWLIB_MACHTYPE=s390x ;
-                  P_64BIT=1 ;
-                   LIB64=1 ;
-                  ;;
 
-   s390)          PWLIB_MACHTYPE=s390 ;
-                  ;;
+# Accept either RADIUS client library, their APIs are fully compatible,
+# just different header filenames and different SONAMEs
 
-   * )            PWLIB_MACHTYPE="$host_cpu";
-                  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"CPU $PWLIB_MACHTYPE not recognized - proceed with caution!\"" >&5
-$as_echo "$as_me: WARNING: \"CPU $PWLIB_MACHTYPE not recognized - proceed with caution!\"" >&2;} ;;
-esac
+if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
+   pbxlibdir=""
+   # if --with-RADIUS=DIR has been specified, use it.
+   if test "x${RADIUS_DIR}" != "x"; then
+      if test -d ${RADIUS_DIR}/lib; then
+         pbxlibdir="-L${RADIUS_DIR}/lib"
+      else
+         pbxlibdir="-L${RADIUS_DIR}"
+      fi
+   fi
+   pbxfuncname="rc_read_config"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_RADIUS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_freeradius-client_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lfreeradius-client" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lfreeradius-client... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfreeradius-client ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}"
+/* 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_RADIUS_FOUND=yes
+else
+  AST_RADIUS_FOUND=no
+fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
+   # now check for the header.
+   if test "${AST_RADIUS_FOUND}" = "yes"; then
+      RADIUS_LIB="${pbxlibdir} -lfreeradius-client "
+      # if --with-RADIUS=DIR has been specified, use it.
+      if test "x${RADIUS_DIR}" != "x"; then
+         RADIUS_INCLUDE="-I${RADIUS_DIR}/include"
+      fi
+      RADIUS_INCLUDE="${RADIUS_INCLUDE} "
+      if test "xfreeradius-client.h" = "x" ; then      # no header, assume found
+         RADIUS_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "freeradius-client.h" "ac_cv_header_freeradius_client_h" "$ac_includes_default"
+if test "x$ac_cv_header_freeradius_client_h" = xyes; then :
+  RADIUS_HEADER_FOUND=1
+else
+  RADIUS_HEADER_FOUND=0
+fi
 
 
-               PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then
+         RADIUS_LIB=""
+         RADIUS_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            RADIUS_LIB=""
+         fi
+         PBX_RADIUS=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_RADIUS 1
+_ACEOF
 
+      fi
+   fi
+fi
 
-       if test "${HAS_PWLIB:-unset}" != "unset"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: checking PWLib installation validity" >&5
-$as_echo_n "checking PWLib installation validity... " >&6; }
 
-          saved_cppflags="${CPPFLAGS}"
-          saved_libs="${LIBS}"
-          if test "${PWLIB_LIB:-unset}" != "unset"; then
-             LIBS="${LIBS} ${PWLIB_LIB} "
-          else
-             LIBS="${LIBS} -L${PWLIB_LIBDIR} -l${PLATFORM_PWLIB} "
-          fi
-          CPPFLAGS="${CPPFLAGS} -I${PWLIB_INCDIR} "
+if test "x${PBX_RADIUS}" = "x1"; then
 
-          ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+$as_echo "#define RADIUS_HEADER_STR <freeradius-client.h>" >>confdefs.h
 
+else
 
-          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
+   pbxlibdir=""
+   # if --with-RADIUS=DIR has been specified, use it.
+   if test "x${RADIUS_DIR}" != "x"; then
+      if test -d ${RADIUS_DIR}/lib; then
+         pbxlibdir="-L${RADIUS_DIR}/lib"
+      else
+         pbxlibdir="-L${RADIUS_DIR}"
+      fi
+   fi
+   pbxfuncname="rc_read_config"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_RADIUS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_radiusclient-ng_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lradiusclient-ng" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lradiusclient-ng... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lradiusclient-ng ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include "ptlib.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 ()
 {
-int q = (int) PTime::IsDaylightSavings();
+return ${pbxfuncname} ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-                       ac_cv_lib_PWLIB="yes"
-
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                       ac_cv_lib_PWLIB="no"
-
-
+  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_RADIUS_FOUND=yes
+else
+  AST_RADIUS_FOUND=no
+fi
 
-          ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-          LIBS="${saved_libs}"
-          CPPFLAGS="${saved_cppflags}"
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-          if test "${ac_cv_lib_PWLIB}" = "yes"; then
-             if test "${PWLIB_LIB:-undef}" = "undef"; then
-                if test "${PWLIB_LIBDIR}" != "" -a "${PWLIB_LIBDIR}" != "/usr/lib"; then
-                   PWLIB_LIB="-L${PWLIB_LIBDIR} -l${PLATFORM_PWLIB}"
-                else
-                   PWLIB_LIB="-l${PLATFORM_PWLIB}"
-                fi
-             fi
-             if test "${PWLIB_INCDIR}" != "" -a "${PWLIB_INCDIR}" != "/usr/include"; then
-                PWLIB_INCLUDE="-I${PWLIB_INCDIR}"
-             fi
-                 PBX_PWLIB=1
+   # now check for the header.
+   if test "${AST_RADIUS_FOUND}" = "yes"; then
+      RADIUS_LIB="${pbxlibdir} -lradiusclient-ng "
+      # if --with-RADIUS=DIR has been specified, use it.
+      if test "x${RADIUS_DIR}" != "x"; then
+         RADIUS_INCLUDE="-I${RADIUS_DIR}/include"
+      fi
+      RADIUS_INCLUDE="${RADIUS_INCLUDE} "
+      if test "xradiusclient-ng.h" = "x" ; then        # no header, assume found
+         RADIUS_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "radiusclient-ng.h" "ac_cv_header_radiusclient_ng_h" "$ac_includes_default"
+if test "x$ac_cv_header_radiusclient_ng_h" = xyes; then :
+  RADIUS_HEADER_FOUND=1
+else
+  RADIUS_HEADER_FOUND=0
+fi
 
-$as_echo "#define HAVE_PWLIB 1" >>confdefs.h
 
-          fi
-       fi
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then
+         RADIUS_LIB=""
+         RADIUS_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            RADIUS_LIB=""
+         fi
+         PBX_RADIUS=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_RADIUS 1
+_ACEOF
 
-       fi
+      fi
+   fi
 fi
 
-if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
-       if test -n "${OPENH323_DIR}"; then
-               OPENH323DIR="${OPENH323_DIR}"
-       fi
 
-OPENH323_INCDIR=
-OPENH323_LIBDIR=
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+       if test "x${PBX_RADIUS}" = "x1"; then
 
-if test "${OPENH323DIR:-unset}" != "unset" ; then
-  as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/version.h" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/version.h" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAS_OPENH323=1
-fi
+$as_echo "#define RADIUS_HEADER_STR <radiusclient-ng.h>" >>confdefs.h
 
+       else
+
+if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
+   pbxlibdir=""
+   # if --with-RADIUS=DIR has been specified, use it.
+   if test "x${RADIUS_DIR}" != "x"; then
+      if test -d ${RADIUS_DIR}/lib; then
+         pbxlibdir="-L${RADIUS_DIR}/lib"
+      else
+         pbxlibdir="-L${RADIUS_DIR}"
+      fi
+   fi
+   pbxfuncname="rc_read_config"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_RADIUS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_radcli_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lradcli" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lradcli... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lradcli ${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 ${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
-if test "${HAS_OPENH323:-unset}" = "unset" ; then
-  as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/../openh323/version.h" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/../openh323/version.h" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-
-  if test "${HAS_OPENH323:-unset}" != "unset" ; then
-    OPENH323DIR="${PWLIBDIR}/../openh323"
-    saved_cppflags="${CPPFLAGS}"
-    CPPFLAGS="${CPPFLAGS} -I${PWLIB_INCDIR}/openh323 -I${PWLIB_INCDIR}"
-    as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/include/h323.h" | $as_tr_sh`
-ac_fn_cxx_check_header_compile "$LINENO" "${OPENH323DIR}/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-
+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_RADIUS_FOUND=yes
 else
-  OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}"
+  AST_RADIUS_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-    CPPFLAGS="${saved_cppflags}"
-  else
-    saved_cppflags="${CPPFLAGS}"
-    CPPFLAGS="${CPPFLAGS} -I${HOME}/openh323/include -I${PWLIB_INCDIR}"
-    as_ac_Header=`$as_echo "ac_cv_header_${HOME}/openh323/include/h323.h" | $as_tr_sh`
-ac_fn_cxx_check_header_compile "$LINENO" "${HOME}/openh323/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAS_OPENH323=1
+   # now check for the header.
+   if test "${AST_RADIUS_FOUND}" = "yes"; then
+      RADIUS_LIB="${pbxlibdir} -lradcli "
+      # if --with-RADIUS=DIR has been specified, use it.
+      if test "x${RADIUS_DIR}" != "x"; then
+         RADIUS_INCLUDE="-I${RADIUS_DIR}/include"
+      fi
+      RADIUS_INCLUDE="${RADIUS_INCLUDE} "
+      if test "xradcli/radcli.h" = "x" ; then  # no header, assume found
+         RADIUS_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "radcli/radcli.h" "ac_cv_header_radcli_radcli_h" "$ac_includes_default"
+if test "x$ac_cv_header_radcli_radcli_h" = xyes; then :
+  RADIUS_HEADER_FOUND=1
+else
+  RADIUS_HEADER_FOUND=0
 fi
 
 
-    CPPFLAGS="${saved_cppflags}"
-    if test "${HAS_OPENH323:-unset}" != "unset" ; then
-      OPENH323DIR="${HOME}/openh323"
-    else
-      saved_cppflags="${CPPFLAGS}"
-      CPPFLAGS="${CPPFLAGS} -I/usr/local/include/openh323 -I${PWLIB_INCDIR}"
-      ac_fn_cxx_check_header_compile "$LINENO" "/usr/local/include/openh323/h323.h" "ac_cv_header__usr_local_include_openh323_h323_h" "#include <ptlib.h>
-"
-if test "x$ac_cv_header__usr_local_include_openh323_h323_h" = xyes; then :
-  HAS_OPENH323=1
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then
+         RADIUS_LIB=""
+         RADIUS_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            RADIUS_LIB=""
+         fi
+         PBX_RADIUS=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_RADIUS 1
+_ACEOF
+
+      fi
+   fi
 fi
 
 
-      CPPFLAGS="${saved_cppflags}"
-      if test "${HAS_OPENH323:-unset}" != "unset" ; then
-        OPENH323DIR="/usr/local/share/openh323"
-        OPENH323_INCDIR="/usr/local/include/openh323"
-        if test "x$LIB64" != "x" && test -d "/usr/local/lib64"; then
-          OPENH323_LIBDIR="/usr/local/lib64"
-        else
-          OPENH323_LIBDIR="/usr/local/lib"
-        fi
-      else
-        saved_cppflags="${CPPFLAGS}"
-        CPPFLAGS="${CPPFLAGS} -I/usr/include/openh323 -I${PWLIB_INCDIR}"
-        ac_fn_cxx_check_header_compile "$LINENO" "/usr/include/openh323/h323.h" "ac_cv_header__usr_include_openh323_h323_h" "#include <ptlib.h>
-"
-if test "x$ac_cv_header__usr_include_openh323_h323_h" = xyes; then :
-  HAS_OPENH323=1
-fi
+               if test "x${PBX_RADIUS}" = "x1"; then
 
+$as_echo "#define RADIUS_HEADER_STR <radcli/radcli.h>" >>confdefs.h
 
-        CPPFLAGS="${saved_cppflags}"
-        if test "${HAS_OPENH323:-unset}" != "unset" ; then
-          OPENH323DIR="/usr/share/openh323"
-          OPENH323_INCDIR="/usr/include/openh323"
-          if test "x$LIB64" != "x" && test -d "/usr/local/lib64"; then
-            OPENH323_LIBDIR="/usr/lib64"
-          else
-            OPENH323_LIBDIR="/usr/lib"
-          fi
-        fi
-      fi
-    fi
-  fi
+               fi
+       fi
 fi
 
-if test "${HAS_OPENH323:-unset}" != "unset" ; then
-  if test "${OPENH323_INCDIR:-unset}" = "unset"; then
-    OPENH323_INCDIR="${OPENH323DIR}/include"
-  fi
-  if test "${OPENH323_LIBDIR:-unset}" = "unset"; then
-    OPENH323_LIBDIR="${OPENH323DIR}/lib"
-  fi
-
-  OPENH323_LIBDIR="`cd ${OPENH323_LIBDIR}; pwd`"
-  OPENH323_INCDIR="`cd ${OPENH323_INCDIR}; pwd`"
-  OPENH323DIR="`cd ${OPENH323DIR}; pwd`"
 
+if test "x${PBX_CODEC2}" != "x1" -a "${USE_CODEC2}" != "no"; then
+   pbxlibdir=""
+   # if --with-CODEC2=DIR has been specified, use it.
+   if test "x${CODEC2_DIR}" != "x"; then
+      if test -d ${CODEC2_DIR}/lib; then
+         pbxlibdir="-L${CODEC2_DIR}/lib"
+      else
+         pbxlibdir="-L${CODEC2_DIR}"
+      fi
+   fi
+   pbxfuncname="codec2_create"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_CODEC2_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_codec2_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcodec2" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcodec2... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcodec2 ${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 ${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_CODEC2_FOUND=yes
+else
+  AST_CODEC2_FOUND=no
+fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
+   # now check for the header.
+   if test "${AST_CODEC2_FOUND}" = "yes"; then
+      CODEC2_LIB="${pbxlibdir} -lcodec2 "
+      # if --with-CODEC2=DIR has been specified, use it.
+      if test "x${CODEC2_DIR}" != "x"; then
+         CODEC2_INCLUDE="-I${CODEC2_DIR}/include"
+      fi
+      CODEC2_INCLUDE="${CODEC2_INCLUDE} "
+      if test "xcodec2/codec2.h" = "x" ; then  # no header, assume found
+         CODEC2_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${CODEC2_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "codec2/codec2.h" "ac_cv_header_codec2_codec2_h" "$ac_includes_default"
+if test "x$ac_cv_header_codec2_codec2_h" = xyes; then :
+  CODEC2_HEADER_FOUND=1
+else
+  CODEC2_HEADER_FOUND=0
 fi
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${CODEC2_HEADER_FOUND}" = "x0" ; then
+         CODEC2_LIB=""
+         CODEC2_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            CODEC2_LIB=""
+         fi
+         PBX_CODEC2=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_CODEC2 1
+_ACEOF
 
-       if test "x" != "x"; then
-               VNAME=""
-               else
-               VNAME="OPENH323_VERSION"
-       fi
+      fi
+   fi
+fi
 
-       if test "${HAS_OPENH323:-unset}" != "unset"; then
-               OPENH323_VERSION=`grep "$VNAME \"" ${OPENH323_INCDIR}/openh323buildopts.h | sed -e 's/[[:space:]]\{1,\}/ /g' | cut -f3 -d ' ' | sed -e 's/"//g'`
-               OPENH323_MAJOR_VERSION=`echo ${OPENH323_VERSION} | cut -f1 -d.`
-               OPENH323_MINOR_VERSION=`echo ${OPENH323_VERSION} | cut -f2 -d.`
-               OPENH323_BUILD_NUMBER=`echo ${OPENH323_VERSION} | cut -f3 -d.`
-               OPENH323_VER=$((${OPENH323_MAJOR_VERSION}*10000+${OPENH323_MINOR_VERSION}*100+${OPENH323_BUILD_NUMBER}))
-               OPENH323_REQ=$((1*10000+17*100+3))
-               if test "x0" = "x"; then
-                       OPENH323_MAX=9999999
-               else
-                       OPENH323_MAX=$((1*10000+19*100+0))
-               fi
 
-               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OpenH323 version ${OPENH323_VERSION} is compatible with chan_h323" >&5
-$as_echo_n "checking if OpenH323 version ${OPENH323_VERSION} is compatible with chan_h323... " >&6; }
-               if test ${OPENH323_VER} -lt ${OPENH323_REQ}; then
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                       unset HAS_OPENH323
-               else
-                       if test ${OPENH323_VER} -gt ${OPENH323_MAX}; then
-                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                               unset HAS_OPENH323
-                       else
-                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-                       fi
-               fi
-       fi
 
 
-       if test "${HAS_OPENH323:-unset}" != "unset"; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenH323 build option" >&5
-$as_echo_n "checking OpenH323 build option... " >&6; }
-               OPENH323_SUFFIX=
-               prefixes="h323_${PWLIB_PLATFORM}_ h323_ openh323"
-               for pfx in $prefixes; do
-                       #files=`ls -l /usr/local/lib/lib${pfx}*.so* 2>/dev/null`
-                       files=`ls -l ${OPENH323_LIBDIR}/lib${pfx}*.so* 2>/dev/null`
-                       if test -z "$files"; then
-                               # check the default location
-                               files=`ls -l /usr/local/lib/lib${pfx}*.so* 2>/dev/null`
-                       fi
-                       libfile=
-                       if test -n "$files"; then
-                               for f in $files; do
-                                       if test -f $f -a ! -L $f; then
-                                               libfile=`basename $f`
-                                               break;
-                                       fi
-                               done
-                       fi
-                       if test -n "$libfile"; then
-                               OPENH323_PREFIX=$pfx
-                               break;
-                       fi
-               done
-               if test "${libfile:-unset}" != "unset"; then
-                       OPENH323_SUFFIX=`eval "echo ${libfile} | sed -e 's/lib${OPENH323_PREFIX}\([^.]*\)\..*/\1/'"`
-               fi
-               case "${OPENH323_SUFFIX}" in
-                       n)
-                               OPENH323_BUILD="notrace";;
-                       r)
-                               OPENH323_BUILD="opt";;
-                       d)
-                               OPENH323_BUILD="debug";;
-                       *)
-                               if test "${OPENH323_PREFIX:-undef}" = "openh323"; then
-                                       notrace=`eval "grep NOTRACE ${OPENH323DIR}/openh323u.mak | grep = | sed -e 's/[A-Z0-9_]*[       ]*=[    ]*//'"`
-                                       if test "x$notrace" = "x"; then
-                                               notrace="0"
-                                       fi
-                                       if test "$notrace" -ne 0; then
-                                               OPENH323_BUILD="notrace"
-                                       else
-                                               OPENH323_BUILD="opt"
-                                       fi
-                                       OPENH323_LIB="-l${OPENH323_PREFIX}"
-                               else
-                                       OPENH323_BUILD="notrace"
-                               fi
-                               ;;
-               esac
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENH323_BUILD}" >&5
-$as_echo "${OPENH323_BUILD}" >&6; }
+if test "x${PBX_COROSYNC}" != "x1" -a "${USE_COROSYNC}" != "no"; then
+   pbxlibdir=""
+   # if --with-COROSYNC=DIR has been specified, use it.
+   if test "x${COROSYNC_DIR}" != "x"; then
+      if test -d ${COROSYNC_DIR}/lib; then
+         pbxlibdir="-L${COROSYNC_DIR}/lib"
+      else
+         pbxlibdir="-L${COROSYNC_DIR}"
+      fi
+   fi
+   pbxfuncname="cpg_join"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_COROSYNC_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_cpg_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcpg" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcpg... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcpg ${pbxlibdir} -lcfg $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_COROSYNC_FOUND=yes
+else
+  AST_COROSYNC_FOUND=no
+fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-       fi
+   # now check for the header.
+   if test "${AST_COROSYNC_FOUND}" = "yes"; then
+      COROSYNC_LIB="${pbxlibdir} -lcpg -lcfg"
+      # if --with-COROSYNC=DIR has been specified, use it.
+      if test "x${COROSYNC_DIR}" != "x"; then
+         COROSYNC_INCLUDE="-I${COROSYNC_DIR}/include"
+      fi
+      COROSYNC_INCLUDE="${COROSYNC_INCLUDE} "
+      if test "xcorosync/cpg.h" = "x" ; then   # no header, assume found
+         COROSYNC_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${COROSYNC_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "corosync/cpg.h" "ac_cv_header_corosync_cpg_h" "$ac_includes_default"
+if test "x$ac_cv_header_corosync_cpg_h" = xyes; then :
+  COROSYNC_HEADER_FOUND=1
+else
+  COROSYNC_HEADER_FOUND=0
+fi
 
-       PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
 
-       if test "${HAS_OPENH323:-unset}" != "unset"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenH323 installation validity" >&5
-$as_echo_n "checking OpenH323 installation validity... " >&6; }
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${COROSYNC_HEADER_FOUND}" = "x0" ; then
+         COROSYNC_LIB=""
+         COROSYNC_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            COROSYNC_LIB=""
+         fi
+         PBX_COROSYNC=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_COROSYNC 1
+_ACEOF
 
-          saved_cppflags="${CPPFLAGS}"
-          saved_libs="${LIBS}"
-          if test "${OPENH323_LIB:-unset}" != "unset"; then
-             LIBS="${LIBS} ${OPENH323_LIB} ${PWLIB_LIB}"
-          else
-             LIBS="${LIBS} -L${OPENH323_LIBDIR} -l${PLATFORM_OPENH323} ${PWLIB_LIB}"
-          fi
-          CPPFLAGS="${CPPFLAGS} -I${OPENH323_INCDIR} ${PWLIB_INCLUDE}"
+      fi
+   fi
+fi
 
-          ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
-          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test "x${PBX_COROSYNC_CFG_STATE_TRACK}" != "x1" -a "${USE_COROSYNC_CFG_STATE_TRACK}" != "no"; then
+   pbxlibdir=""
+   # if --with-COROSYNC_CFG_STATE_TRACK=DIR has been specified, use it.
+   if test "x${COROSYNC_CFG_STATE_TRACK_DIR}" != "x"; then
+      if test -d ${COROSYNC_CFG_STATE_TRACK_DIR}/lib; then
+         pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}/lib"
+      else
+         pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}"
+      fi
+   fi
+   pbxfuncname="corosync_cfg_state_track"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_COROSYNC_CFG_STATE_TRACK_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_cfg_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcfg" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcfg... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcfg ${pbxlibdir} -lcfg $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include "ptlib.h"
-               #include "h323.h"
-               #include "h323ep.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 ()
 {
-H323EndPoint ep = H323EndPoint();
+return ${pbxfuncname} ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-                       ac_cv_lib_OPENH323="yes"
-
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                       ac_cv_lib_OPENH323="no"
-
-
+  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_COROSYNC_CFG_STATE_TRACK_FOUND=yes
+else
+  AST_COROSYNC_CFG_STATE_TRACK_FOUND=no
+fi
 
-          ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
+   # now check for the header.
+   if test "${AST_COROSYNC_CFG_STATE_TRACK_FOUND}" = "yes"; then
+      COROSYNC_CFG_STATE_TRACK_LIB="${pbxlibdir} -lcfg -lcfg"
+      # if --with-COROSYNC_CFG_STATE_TRACK=DIR has been specified, use it.
+      if test "x${COROSYNC_CFG_STATE_TRACK_DIR}" != "x"; then
+         COROSYNC_CFG_STATE_TRACK_INCLUDE="-I${COROSYNC_CFG_STATE_TRACK_DIR}/include"
+      fi
+      COROSYNC_CFG_STATE_TRACK_INCLUDE="${COROSYNC_CFG_STATE_TRACK_INCLUDE} "
+      if test "xcorosync/cfg.h" = "x" ; then   # no header, assume found
+         COROSYNC_CFG_STATE_TRACK_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${COROSYNC_CFG_STATE_TRACK_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "corosync/cfg.h" "ac_cv_header_corosync_cfg_h" "$ac_includes_default"
+if test "x$ac_cv_header_corosync_cfg_h" = xyes; then :
+  COROSYNC_CFG_STATE_TRACK_HEADER_FOUND=1
+else
+  COROSYNC_CFG_STATE_TRACK_HEADER_FOUND=0
+fi
 
-          LIBS="${saved_libs}"
-          CPPFLAGS="${saved_cppflags}"
 
-          if test "${ac_cv_lib_OPENH323}" = "yes"; then
-             if test "${OPENH323_LIB:-undef}" = "undef"; then
-                if test "${OPENH323_LIBDIR}" != "" -a "${OPENH323_LIBDIR}" != "/usr/lib"; then
-                   OPENH323_LIB="-L${OPENH323_LIBDIR} -l${PLATFORM_OPENH323}"
-                else
-                   OPENH323_LIB="-l${PLATFORM_OPENH323}"
-                fi
-             fi
-             if test "${OPENH323_INCDIR}" != "" -a "${OPENH323_INCDIR}" != "/usr/include"; then
-                OPENH323_INCLUDE="-I${OPENH323_INCDIR}"
-             fi
-                 PBX_OPENH323=1
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${COROSYNC_CFG_STATE_TRACK_HEADER_FOUND}" = "x0" ; then
+         COROSYNC_CFG_STATE_TRACK_LIB=""
+         COROSYNC_CFG_STATE_TRACK_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            COROSYNC_CFG_STATE_TRACK_LIB=""
+         fi
+         PBX_COROSYNC_CFG_STATE_TRACK=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_COROSYNC_CFG_STATE_TRACK 1
+_ACEOF
 
-$as_echo "#define HAVE_OPENH323 1" >>confdefs.h
+      fi
+   fi
+fi
 
-          fi
-       fi
 
-fi
 
 
-if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
+if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
    pbxlibdir=""
-   # if --with-LUA=DIR has been specified, use it.
-   if test "x${LUA_DIR}" != "x"; then
-      if test -d ${LUA_DIR}/lib; then
-         pbxlibdir="-L${LUA_DIR}/lib"
+   # if --with-SPEEX=DIR has been specified, use it.
+   if test "x${SPEEX_DIR}" != "x"; then
+      if test -d ${SPEEX_DIR}/lib; then
+         pbxlibdir="-L${SPEEX_DIR}/lib"
       else
-         pbxlibdir="-L${LUA_DIR}"
+         pbxlibdir="-L${SPEEX_DIR}"
       fi
    fi
-   pbxfuncname="luaL_newstate"
+   pbxfuncname="speex_encode"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_LUA_FOUND=yes
+      AST_SPEEX_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_lua5.2_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.2" >&5
-$as_echo_n "checking for ${pbxfuncname} in -llua5.2... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeex" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lspeex... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-llua5.2 ${pbxlibdir} -lm $LIBS"
+LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -28746,47 +32151,47 @@ 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_LUA_FOUND=yes
+  AST_SPEEX_FOUND=yes
 else
-  AST_LUA_FOUND=no
+  AST_SPEEX_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_LUA_FOUND}" = "yes"; then
-      LUA_LIB="${pbxlibdir} -llua5.2 -lm"
-      # if --with-LUA=DIR has been specified, use it.
-      if test "x${LUA_DIR}" != "x"; then
-         LUA_INCLUDE="-I${LUA_DIR}/include"
+   if test "${AST_SPEEX_FOUND}" = "yes"; then
+      SPEEX_LIB="${pbxlibdir} -lspeex -lm"
+      # if --with-SPEEX=DIR has been specified, use it.
+      if test "x${SPEEX_DIR}" != "x"; then
+         SPEEX_INCLUDE="-I${SPEEX_DIR}/include"
       fi
-      LUA_INCLUDE="${LUA_INCLUDE} "
-      if test "xlua5.2/lua.h" = "x" ; then     # no header, assume found
-         LUA_HEADER_FOUND="1"
+      SPEEX_INCLUDE="${SPEEX_INCLUDE} "
+      if test "xspeex/speex.h" = "x" ; then    # no header, assume found
+         SPEEX_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "lua5.2/lua.h" "ac_cv_header_lua5_2_lua_h" "$ac_includes_default"
-if test "x$ac_cv_header_lua5_2_lua_h" = xyes; then :
-  LUA_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${SPEEX_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
+  SPEEX_HEADER_FOUND=1
 else
-  LUA_HEADER_FOUND=0
+  SPEEX_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
-         LUA_LIB=""
-         LUA_INCLUDE=""
+      if test "x${SPEEX_HEADER_FOUND}" = "x0" ; then
+         SPEEX_LIB=""
+         SPEEX_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            LUA_LIB=""
+            SPEEX_LIB=""
          fi
-         PBX_LUA=1
+         PBX_SPEEX=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_LUA 1
+#define HAVE_SPEEX 1
 _ACEOF
 
       fi
@@ -28794,39 +32199,33 @@ _ACEOF
 fi
 
 
-if test "x${PBX_LUA}" = "x1" ; then
-       if test x"${LUA_DIR}" = x; then
-               LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.2"
-       else
-               LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.2"
-       fi
-fi
 
+# See if the main speex library contains the preprocess functions
 
-if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
+if test "x${PBX_SPEEX_PREPROCESS}" != "x1" -a "${USE_SPEEX_PREPROCESS}" != "no"; then
    pbxlibdir=""
-   # if --with-LUA=DIR has been specified, use it.
-   if test "x${LUA_DIR}" != "x"; then
-      if test -d ${LUA_DIR}/lib; then
-         pbxlibdir="-L${LUA_DIR}/lib"
+   # if --with-SPEEX_PREPROCESS=DIR has been specified, use it.
+   if test "x${SPEEX_PREPROCESS_DIR}" != "x"; then
+      if test -d ${SPEEX_PREPROCESS_DIR}/lib; then
+         pbxlibdir="-L${SPEEX_PREPROCESS_DIR}/lib"
       else
-         pbxlibdir="-L${LUA_DIR}"
+         pbxlibdir="-L${SPEEX_PREPROCESS_DIR}"
       fi
    fi
-   pbxfuncname="luaL_newstate"
+   pbxfuncname="speex_preprocess_ctl"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_LUA_FOUND=yes
+      AST_SPEEX_PREPROCESS_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.1" >&5
-$as_echo_n "checking for ${pbxfuncname} in -llua5.1... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeex" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lspeex... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-llua5.1 ${pbxlibdir} -lm $LIBS"
+LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -28858,47 +32257,47 @@ 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_LUA_FOUND=yes
+  AST_SPEEX_PREPROCESS_FOUND=yes
 else
-  AST_LUA_FOUND=no
+  AST_SPEEX_PREPROCESS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_LUA_FOUND}" = "yes"; then
-      LUA_LIB="${pbxlibdir} -llua5.1 -lm"
-      # if --with-LUA=DIR has been specified, use it.
-      if test "x${LUA_DIR}" != "x"; then
-         LUA_INCLUDE="-I${LUA_DIR}/include"
+   if test "${AST_SPEEX_PREPROCESS_FOUND}" = "yes"; then
+      SPEEX_PREPROCESS_LIB="${pbxlibdir} -lspeex -lm"
+      # if --with-SPEEX_PREPROCESS=DIR has been specified, use it.
+      if test "x${SPEEX_PREPROCESS_DIR}" != "x"; then
+         SPEEX_PREPROCESS_INCLUDE="-I${SPEEX_PREPROCESS_DIR}/include"
       fi
-      LUA_INCLUDE="${LUA_INCLUDE} "
-      if test "xlua5.1/lua.h" = "x" ; then     # no header, assume found
-         LUA_HEADER_FOUND="1"
+      SPEEX_PREPROCESS_INCLUDE="${SPEEX_PREPROCESS_INCLUDE} "
+      if test "xspeex/speex.h" = "x" ; then    # no header, assume found
+         SPEEX_PREPROCESS_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "lua5.1/lua.h" "ac_cv_header_lua5_1_lua_h" "$ac_includes_default"
-if test "x$ac_cv_header_lua5_1_lua_h" = xyes; then :
-  LUA_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${SPEEX_PREPROCESS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
+  SPEEX_PREPROCESS_HEADER_FOUND=1
 else
-  LUA_HEADER_FOUND=0
+  SPEEX_PREPROCESS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
-         LUA_LIB=""
-         LUA_INCLUDE=""
+      if test "x${SPEEX_PREPROCESS_HEADER_FOUND}" = "x0" ; then
+         SPEEX_PREPROCESS_LIB=""
+         SPEEX_PREPROCESS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            LUA_LIB=""
+            SPEEX_PREPROCESS_LIB=""
          fi
-         PBX_LUA=1
+         PBX_SPEEX_PREPROCESS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_LUA 1
+#define HAVE_SPEEX_PREPROCESS 1
 _ACEOF
 
       fi
@@ -28906,40 +32305,35 @@ _ACEOF
 fi
 
 
-if test "x${PBX_LUA}" = "x1" ; then
-       if test x"${LUA_DIR}" = x; then
-               LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua5.1"
-       else
-               LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua5.1"
-       fi
+if test "${PBX_SPEEX_PREPROCESS}" = 1; then
+   PBX_SPEEX_PREPROCESS=1
 fi
 
-# Some distributions (like SuSE) remove the 5.1 suffix.
 
-if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
+if test "x${PBX_SPEEXDSP}" != "x1" -a "${USE_SPEEXDSP}" != "no"; then
    pbxlibdir=""
-   # if --with-LUA=DIR has been specified, use it.
-   if test "x${LUA_DIR}" != "x"; then
-      if test -d ${LUA_DIR}/lib; then
-         pbxlibdir="-L${LUA_DIR}/lib"
+   # if --with-SPEEXDSP=DIR has been specified, use it.
+   if test "x${SPEEXDSP_DIR}" != "x"; then
+      if test -d ${SPEEXDSP_DIR}/lib; then
+         pbxlibdir="-L${SPEEXDSP_DIR}/lib"
       else
-         pbxlibdir="-L${LUA_DIR}"
+         pbxlibdir="-L${SPEEXDSP_DIR}"
       fi
    fi
-   pbxfuncname="luaL_openlib"
+   pbxfuncname="speex_preprocess_ctl"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_LUA_FOUND=yes
+      AST_SPEEXDSP_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_lua_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua" >&5
-$as_echo_n "checking for ${pbxfuncname} in -llua... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_speexdsp_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeexdsp" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lspeexdsp... " >&6; }
 if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-llua ${pbxlibdir} -lm $LIBS"
+LIBS="-lspeexdsp ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -28971,47 +32365,47 @@ 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_LUA_FOUND=yes
+  AST_SPEEXDSP_FOUND=yes
 else
-  AST_LUA_FOUND=no
+  AST_SPEEXDSP_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_LUA_FOUND}" = "yes"; then
-      LUA_LIB="${pbxlibdir} -llua -lm"
-      # if --with-LUA=DIR has been specified, use it.
-      if test "x${LUA_DIR}" != "x"; then
-         LUA_INCLUDE="-I${LUA_DIR}/include"
+   if test "${AST_SPEEXDSP_FOUND}" = "yes"; then
+      SPEEXDSP_LIB="${pbxlibdir} -lspeexdsp -lm"
+      # if --with-SPEEXDSP=DIR has been specified, use it.
+      if test "x${SPEEXDSP_DIR}" != "x"; then
+         SPEEXDSP_INCLUDE="-I${SPEEXDSP_DIR}/include"
       fi
-      LUA_INCLUDE="${LUA_INCLUDE} "
-      if test "xlua.h" = "x" ; then    # no header, assume found
-         LUA_HEADER_FOUND="1"
+      SPEEXDSP_INCLUDE="${SPEEXDSP_INCLUDE} "
+      if test "xspeex/speex.h" = "x" ; then    # no header, assume found
+         SPEEXDSP_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default"
-if test "x$ac_cv_header_lua_h" = xyes; then :
-  LUA_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${SPEEXDSP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
+  SPEEXDSP_HEADER_FOUND=1
 else
-  LUA_HEADER_FOUND=0
+  SPEEXDSP_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
-         LUA_LIB=""
-         LUA_INCLUDE=""
+      if test "x${SPEEXDSP_HEADER_FOUND}" = "x0" ; then
+         SPEEXDSP_LIB=""
+         SPEEXDSP_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            LUA_LIB=""
+            SPEEXDSP_LIB=""
          fi
-         PBX_LUA=1
+         PBX_SPEEXDSP=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_LUA 1
+#define HAVE_SPEEXDSP 1
 _ACEOF
 
       fi
@@ -29019,34 +32413,37 @@ _ACEOF
 fi
 
 
+if test "${PBX_SPEEXDSP}" = 1; then
+   PBX_SPEEX_PREPROCESS=1
+fi
+
+
 
-# Accept either RADIUS client library, their APIs are fully compatible,
-# just different header filenames and different SONAMEs
 
-if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
+if test "x${PBX_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then
    pbxlibdir=""
-   # if --with-RADIUS=DIR has been specified, use it.
-   if test "x${RADIUS_DIR}" != "x"; then
-      if test -d ${RADIUS_DIR}/lib; then
-         pbxlibdir="-L${RADIUS_DIR}/lib"
+   # if --with-SQLITE=DIR has been specified, use it.
+   if test "x${SQLITE_DIR}" != "x"; then
+      if test -d ${SQLITE_DIR}/lib; then
+         pbxlibdir="-L${SQLITE_DIR}/lib"
       else
-         pbxlibdir="-L${RADIUS_DIR}"
+         pbxlibdir="-L${SQLITE_DIR}"
       fi
    fi
-   pbxfuncname="rc_read_config"
+   pbxfuncname="sqlite_exec"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_RADIUS_FOUND=yes
+      AST_SQLITE_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_freeradius-client_${pbxfuncname}" |&