Merged revisions 270866 via svnmerge from
[asterisk/asterisk.git] / configure
index 7ba4f4b..20d515a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,9 +1,9 @@
 #! /bin/sh
-# From configure.ac Revision: 265793 .
+# From configure.ac Revision: 270151 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for asterisk 1.6.
+# Generated by GNU Autoconf 2.65 for asterisk trunk.
 #
-# Report bugs to <www.asterisk.org>.
+# Report bugs to <https://issues.asterisk.org>.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -233,11 +233,11 @@ fi
     $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
-    $as_echo "$0: Please tell bug-autoconf@gnu.org and www.asterisk.org
-$0: about your system, including any error possibly output
-$0: before this message. Then install a modern shell, or
-$0: manually run the script under such a shell if you do
-$0: have one."
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: https://issues.asterisk.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
   fi
   exit 1
 fi
@@ -555,9 +555,9 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='asterisk'
 PACKAGE_TARNAME='asterisk'
-PACKAGE_VERSION='1.6'
-PACKAGE_STRING='asterisk 1.6'
-PACKAGE_BUGREPORT='www.asterisk.org'
+PACKAGE_VERSION='trunk'
+PACKAGE_STRING='asterisk trunk'
+PACKAGE_BUGREPORT='https://issues.asterisk.org'
 PACKAGE_URL=''
 
 ac_unique_file="main/asterisk.c"
@@ -597,6 +597,9 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
+ac_default_prefix=/usr/local
+ac_default_prefix=/usr/local
+ac_default_prefix=/usr
 ac_header_list=
 ac_subst_vars='LTLIBOBJS
 PBX_SYSLOG
@@ -614,7 +617,6 @@ PBX_SYSLOG_FACILITY_LOG_AUTH
 PBX_GENERIC_ODBC
 GENERIC_ODBC_INCLUDE
 GENERIC_ODBC_LIB
-_libcurl_config
 PKGCONFIG
 CONFIG_SDL
 PBX_SO_NOSIGPIPE
@@ -662,10 +664,6 @@ POW_LIB
 PBX_WORKING_FORK
 LIBOBJS
 ALLOCA
-PBX_TIMERFD
-TIMERFD_DIR
-TIMERFD_INCLUDE
-TIMERFD_LIB
 PBX_ZLIB
 ZLIB_DIR
 ZLIB_INCLUDE
@@ -698,6 +696,10 @@ PBX_TINFO
 TINFO_DIR
 TINFO_INCLUDE
 TINFO_LIB
+PBX_TIMERFD
+TIMERFD_DIR
+TIMERFD_INCLUDE
+TIMERFD_LIB
 PBX_TERMCAP
 TERMCAP_DIR
 TERMCAP_INCLUDE
@@ -706,14 +708,18 @@ PBX_FREETDS
 FREETDS_DIR
 FREETDS_INCLUDE
 FREETDS_LIB
-PBX_OPENSSL
-OPENSSL_DIR
-OPENSSL_INCLUDE
-OPENSSL_LIB
 PBX_SUPPSERV
 SUPPSERV_DIR
 SUPPSERV_INCLUDE
 SUPPSERV_LIB
+PBX_OPENSSL
+OPENSSL_DIR
+OPENSSL_INCLUDE
+OPENSSL_LIB
+PBX_SRTP
+SRTP_DIR
+SRTP_INCLUDE
+SRTP_LIB
 PBX_SQLITE3
 SQLITE3_DIR
 SQLITE3_INCLUDE
@@ -734,10 +740,15 @@ PBX_SPEEX
 SPEEX_DIR
 SPEEX_INCLUDE
 SPEEX_LIB
-PBX_OPENAIS
-OPENAIS_DIR
-OPENAIS_INCLUDE
-OPENAIS_LIB
+PBX_SS7
+SS7_DIR
+SS7_INCLUDE
+SS7_LIB
+PBX_SPANDSP
+SPANDSP_DIR
+SPANDSP_INCLUDE
+SPANDSP_LIB
+SOUNDS_CACHE_DIR
 PBX_SDL_IMAGE
 SDL_IMAGE_DIR
 SDL_IMAGE_INCLUDE
@@ -746,35 +757,18 @@ PBX_SDL
 SDL_DIR
 SDL_INCLUDE
 SDL_LIB
+PBX_RESAMPLE
+RESAMPLE_DIR
+RESAMPLE_INCLUDE
+RESAMPLE_LIB
 PBX_RADIUS
 RADIUS_DIR
 RADIUS_INCLUDE
 RADIUS_LIB
-PBX_OPENH323
-OPENH323_DIR
-OPENH323_INCLUDE
-OPENH323_LIB
 PBX_PWLIB
 PWLIB_DIR
 PWLIB_INCLUDE
 PWLIB_LIB
-PBX_OPENR2
-OPENR2_DIR
-OPENR2_INCLUDE
-OPENR2_LIB
-PBX_SS7
-SS7_DIR
-SS7_INCLUDE
-SS7_LIB
-PBX_SPANDSP
-SPANDSP_DIR
-SPANDSP_INCLUDE
-SPANDSP_LIB
-SOUNDS_CACHE_DIR
-PBX_RESAMPLE
-RESAMPLE_DIR
-RESAMPLE_INCLUDE
-RESAMPLE_LIB
 PBX_PRI_REVERSE_CHARGE
 PRI_REVERSE_CHARGE_DIR
 PRI_REVERSE_CHARGE_INCLUDE
@@ -815,6 +809,26 @@ PBX_PRI_CCSS
 PRI_CCSS_DIR
 PRI_CCSS_INCLUDE
 PRI_CCSS_LIB
+PBX_PRI_TRANSFER
+PRI_TRANSFER_DIR
+PRI_TRANSFER_INCLUDE
+PRI_TRANSFER_LIB
+PBX_PRI_AOC_EVENTS
+PRI_AOC_EVENTS_DIR
+PRI_AOC_EVENTS_INCLUDE
+PRI_AOC_EVENTS_LIB
+PBX_PRI_CALL_WAITING
+PRI_CALL_WAITING_DIR
+PRI_CALL_WAITING_INCLUDE
+PRI_CALL_WAITING_LIB
+PBX_PRI_MCID
+PRI_MCID_DIR
+PRI_MCID_INCLUDE
+PRI_MCID_LIB
+PBX_PRI_MWI
+PRI_MWI_DIR
+PRI_MWI_INCLUDE
+PRI_MWI_LIB
 PBX_PRI
 PRI_DIR
 PRI_INCLUDE
@@ -839,6 +853,14 @@ PBX_OSPTK
 OSPTK_DIR
 OSPTK_INCLUDE
 OSPTK_LIB
+PBX_OPENR2
+OPENR2_DIR
+OPENR2_INCLUDE
+OPENR2_LIB
+PBX_OPENAIS
+OPENAIS_DIR
+OPENAIS_INCLUDE
+OPENAIS_LIB
 PBX_OGG
 OGG_DIR
 OGG_INCLUDE
@@ -887,6 +909,10 @@ PBX_LIBXML2
 LIBXML2_DIR
 LIBXML2_INCLUDE
 LIBXML2_LIB
+CURL_LIB
+CURL_INCLUDE
+_libcurl_config
+PBX_CURL
 PBX_LDAP
 LDAP_DIR
 LDAP_INCLUDE
@@ -931,6 +957,10 @@ PBX_HOARD
 HOARD_DIR
 HOARD_INCLUDE
 HOARD_LIB
+PBX_OPENH323
+OPENH323_DIR
+OPENH323_INCLUDE
+OPENH323_LIB
 PBX_GMIME
 GMIME_DIR
 GMIME_INCLUDE
@@ -943,10 +973,10 @@ PBX_GSM
 GSM_DIR
 GSM_INCLUDE
 GSM_LIB
-PBX_FFMPEG
-FFMPEG_DIR
-FFMPEG_INCLUDE
-FFMPEG_LIB
+PBX_BKTR
+BKTR_DIR
+BKTR_INCLUDE
+BKTR_LIB
 PBX_DAHDI
 DAHDI_DIR
 DAHDI_INCLUDE
@@ -959,10 +989,6 @@ PBX_CURSES
 CURSES_DIR
 CURSES_INCLUDE
 CURSES_LIB
-PBX_CURL
-CURL_DIR
-CURL_INCLUDE
-CURL_LIB
 PBX_CAP
 CAP_DIR
 CAP_INCLUDE
@@ -971,10 +997,10 @@ PBX_BLUETOOTH
 BLUETOOTH_DIR
 BLUETOOTH_INCLUDE
 BLUETOOTH_LIB
-PBX_BKTR
-BKTR_DIR
-BKTR_INCLUDE
-BKTR_LIB
+PBX_FFMPEG
+FFMPEG_DIR
+FFMPEG_INCLUDE
+FFMPEG_LIB
 PBX_ALSA
 ALSA_DIR
 ALSA_INCLUDE
@@ -1103,17 +1129,17 @@ enable_option_checking
 with_gnu_ld
 enable_dev_mode
 with_asound
-with_execinfo
+with_avcodec
 with_bluetooth
 with_cap
-with_curl
 with_curses
 with_crypto
 with_dahdi
-with_avcodec
+with_execinfo
 with_gsm
 with_gtk2
 with_gmime
+with_h323
 with_hoard
 with_ical
 with_iconv
@@ -1125,6 +1151,7 @@ with_isdnnet
 with_jack
 with_kqueue
 with_ldap
+with_libcurl
 with_libxml2
 with_ltdl
 with_lua
@@ -1137,31 +1164,32 @@ with_neon29
 with_netsnmp
 with_newt
 with_ogg
+with_openais
+with_openr2
 with_osptk
 with_oss
 with_postgres
 with_popt
 with_portaudio
 with_pri
-with_resample
-with_sounds_cache
-with_spandsp
-with_ss7
-with_openr2
 with_pwlib
-with_h323
 with_radius
+with_resample
 with_sdl
 with_SDL_image
-with_openais
+with_sounds_cache
+with_spandsp
+with_ss7
 with_speex
 with_speexdsp
 with_sqlite
 with_sqlite3
-with_suppserv
+with_srtp
 with_ssl
+with_suppserv
 with_tds
 with_termcap
+with_timerfd
 with_tinfo
 with_tonezone
 with_unixodbc
@@ -1170,11 +1198,9 @@ with_vorbis
 with_vpb
 with_x11
 with_z
-with_timerfd
 enable_largefile
 enable_internal_poll
 enable_xmldoc
-with_libcurl
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1730,7 +1756,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures asterisk 1.6 to adapt to many kinds of systems.
+\`configure' configures asterisk trunk to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1795,7 +1821,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of asterisk 1.6:";;
+     short | recursive ) echo "Configuration of asterisk trunk:";;
    esac
   cat <<\_ACEOF
 
@@ -1813,18 +1839,18 @@ Optional Packages:
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-asound=PATH      use Advanced Linux Sound Architecture files in PATH
-  --with-execinfo=PATH    use Stack Backtrace files in PATH
+  --with-avcodec=PATH     use Ffmpeg and avcodec files in PATH
   --with-bluetooth=PATH   use Bluetooth files in PATH
   --with-cap=PATH         use POSIX 1.e capabilities files in PATH
-  --with-curl=PATH        use cURL files in PATH
   --with-curses=PATH      use curses files in PATH
   --with-crypto=PATH      use OpenSSL Cryptography files in PATH
   --with-dahdi=PATH       use DAHDI files in PATH
-  --with-avcodec=PATH     use Ffmpeg and avcodec files in PATH
+  --with-execinfo=PATH    use Stack Backtrace files in PATH
   --with-gsm=PATH         use External GSM files in PATH, use 'internal' GSM
                           otherwise
   --with-gtk2=PATH        use gtk2 files in PATH
   --with-gmime=PATH       use GMime files in PATH
+  --with-h323=PATH        use OpenH323 files in PATH
   --with-hoard=PATH       use Hoard Memory Allocator files in PATH
   --with-ical=PATH        use iCal files in PATH
   --with-iconv=PATH       use Iconv files in PATH
@@ -1836,6 +1862,7 @@ Optional Packages:
   --with-jack=PATH        use Jack Audio Connection Kit 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-libxml2=PATH     use LibXML2 files in PATH
   --with-ltdl=PATH        use libtool files in PATH
   --with-lua=PATH         use Lua files in PATH
@@ -1848,33 +1875,34 @@ Optional Packages:
   --with-netsnmp=PATH     use Net-SNMP files in PATH
   --with-newt=PATH        use newt files in PATH
   --with-ogg=PATH         use OGG files in PATH
+  --with-openais=PATH     use OpenAIS files in PATH
+  --with-openr2=PATH      use MFR2 files in PATH
   --with-osptk=PATH       use OSP Toolkit files in PATH
   --with-oss=PATH         use Open Sound System files in PATH
   --with-postgres=PATH    use PostgreSQL files in PATH
   --with-popt=PATH        use popt files in PATH
   --with-portaudio=PATH   use PortAudio files in PATH
   --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-resample=PATH    use LIBRESAMPLE 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-openr2=PATH      use MFR2 files in PATH
-  --with-pwlib=PATH       use PWlib files in PATH
-  --with-h323=PATH        use OpenH323 files in PATH
-  --with-radius=PATH      use Radius Client files in PATH
-  --with-sdl=PATH         use Sdl files in PATH
-  --with-SDL_image=PATH   use Sdl Image files in PATH
-  --with-openais=PATH     use OpenAIS files in PATH
   --with-speex=PATH       use Speex files in PATH
   --with-speex=PATH       use Speex preprocess routines files in PATH
   --with-speexdsp=PATH    use SpeexDSP files in PATH
   --with-sqlite=PATH      use SQLite files in PATH
   --with-sqlite3=PATH     use SQLite files in PATH
-  --with-suppserv=PATH    use mISDN Supplemental Services files in PATH
+  --with-srtp=PATH        use Secure RTP files in PATH
   --with-ssl=PATH         use OpenSSL Secure Sockets Layer files in PATH
+  --with-suppserv=PATH    use mISDN Supplemental Services files in PATH
   --with-tds=PATH         use FreeTDS files in PATH
   --with-termcap=PATH     use Termcap files in PATH
+  --with-timerfd=PATH     use timerfd files in PATH
   --with-tinfo=PATH       use Term Info files in PATH
   --with-tonezone=PATH    use tonezone files in PATH
   --with-unixodbc=PATH    use unixODBC files in PATH
@@ -1883,8 +1911,6 @@ Optional Packages:
   --with-vpb=PATH         use Voicetronix API files in PATH
   --with-x11=PATH         use X11 files in PATH
   --with-z=PATH           use zlib compression files in PATH
-  --with-timerfd=PATH     use timerfd files in PATH
-  --with-libcurl=DIR      look for the curl library in DIR
 
 Some influential environment variables:
   CC          C compiler command
@@ -1902,7 +1928,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <www.asterisk.org>.
+Report bugs to <https://issues.asterisk.org>.
 _ACEOF
 ac_status=$?
 fi
@@ -1965,7 +1991,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-asterisk configure 1.6
+asterisk configure trunk
 generated by GNU Autoconf 2.65
 
 Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2127,9 +2153,9 @@ $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to www.asterisk.org ##
-## ------------------------------- ##
+## ------------------------------------------ ##
+## Report this to https://issues.asterisk.org ##
+## ------------------------------------------ ##
 _ASBOX
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
@@ -2770,9 +2796,9 @@ $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
 ( cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to www.asterisk.org ##
-## ------------------------------- ##
+## ------------------------------------------ ##
+## Report this to https://issues.asterisk.org ##
+## ------------------------------------------ ##
 _ASBOX
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
@@ -2872,7 +2898,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by asterisk $as_me 1.6, which was
+It was created by asterisk $as_me trunk, which was
 generated by GNU Autoconf 2.65.  Invocation command line was
 
   $ $0 $@
@@ -4620,12 +4646,12 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 
 case "${host_os}" in
      freebsd*)
-     ac_default_prefix=/usr/local
+
      CPPFLAGS=-I/usr/local/include
      LDFLAGS=-L/usr/local/lib
      ;;
      openbsd*)
-     ac_default_prefix=/usr/local
+
      if test ${prefix} = '/usr/local' || test ${prefix} = 'NONE'; then
         if test ${sysconfdir} = '${prefix}/etc'; then
            sysconfdir=/etc
@@ -4643,7 +4669,7 @@ $as_echo "#define AST_POLL_COMPAT 1" >>confdefs.h
 
      ;;
      *)
-     ac_default_prefix=/usr
+
      if test ${prefix} = '/usr' || test ${prefix} = 'NONE'; then
         if test ${sysconfdir} = '${prefix}/etc'; then
            sysconfdir=/etc
@@ -8445,29 +8471,26 @@ fi
 
 
 
-# BKTR is used for backtrace support on platforms that do not
-# have it natively.
-
-    BKTR_DESCRIP="Stack Backtrace"
-    BKTR_OPTION="execinfo"
-    PBX_BKTR=0
+    FFMPEG_DESCRIP="Ffmpeg and avcodec"
+    FFMPEG_OPTION="avcodec"
+    PBX_FFMPEG=0
 
-# Check whether --with-execinfo was given.
-if test "${with_execinfo+set}" = set; then :
-  withval=$with_execinfo;
+# Check whether --with-avcodec was given.
+if test "${with_avcodec+set}" = set; then :
+  withval=$with_avcodec;
        case ${withval} in
        n|no)
-       USE_BKTR=no
+       USE_FFMPEG=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_BKTR=-1
+       PBX_FFMPEG=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} BKTR"
+       ac_mandatory_list="${ac_mandatory_list} FFMPEG"
        ;;
        *)
-       BKTR_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} BKTR"
+       FFMPEG_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} FFMPEG"
        ;;
        esac
 
@@ -8544,38 +8567,6 @@ fi
 
 
 
-    CURL_DESCRIP="cURL"
-    CURL_OPTION="curl"
-    PBX_CURL=0
-
-# Check whether --with-curl was given.
-if test "${with_curl+set}" = set; then :
-  withval=$with_curl;
-       case ${withval} in
-       n|no)
-       USE_CURL=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_CURL=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} CURL"
-       ;;
-       *)
-       CURL_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} CURL"
-       ;;
-       esac
-
-fi
-
-
-
-
-
-
-
-
     CURSES_DESCRIP="curses"
     CURSES_OPTION="curses"
     PBX_CURSES=0
@@ -8672,26 +8663,29 @@ fi
 
 
 
-    FFMPEG_DESCRIP="Ffmpeg and avcodec"
-    FFMPEG_OPTION="avcodec"
-    PBX_FFMPEG=0
+# BKTR is used for backtrace support on platforms that do not
+# have it natively.
 
-# Check whether --with-avcodec was given.
-if test "${with_avcodec+set}" = set; then :
-  withval=$with_avcodec;
+    BKTR_DESCRIP="Stack Backtrace"
+    BKTR_OPTION="execinfo"
+    PBX_BKTR=0
+
+# Check whether --with-execinfo was given.
+if test "${with_execinfo+set}" = set; then :
+  withval=$with_execinfo;
        case ${withval} in
        n|no)
-       USE_FFMPEG=no
+       USE_BKTR=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_FFMPEG=-1
+       PBX_BKTR=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} FFMPEG"
+       ac_mandatory_list="${ac_mandatory_list} BKTR"
        ;;
        *)
-       FFMPEG_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} FFMPEG"
+       BKTR_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} BKTR"
        ;;
        esac
 
@@ -8800,6 +8794,38 @@ fi
 
 
 
+    OPENH323_DESCRIP="OpenH323"
+    OPENH323_OPTION="h323"
+    PBX_OPENH323=0
+
+# Check whether --with-h323 was given.
+if test "${with_h323+set}" = set; then :
+  withval=$with_h323;
+       case ${withval} in
+       n|no)
+       USE_OPENH323=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_OPENH323=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} OPENH323"
+       ;;
+       *)
+       OPENH323_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OPENH323"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     HOARD_DESCRIP="Hoard Memory Allocator"
     HOARD_OPTION="hoard"
     PBX_HOARD=0
@@ -9152,30 +9178,7 @@ fi
 
 
 
-    LIBXML2_DESCRIP="LibXML2"
-    LIBXML2_OPTION="libxml2"
-    PBX_LIBXML2=0
 
-# Check whether --with-libxml2 was given.
-if test "${with_libxml2+set}" = set; then :
-  withval=$with_libxml2;
-       case ${withval} in
-       n|no)
-       USE_LIBXML2=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_LIBXML2=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} LIBXML2"
-       ;;
-       *)
-       LIBXML2_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} LIBXML2"
-       ;;
-       esac
-
-fi
 
 
 
@@ -9184,30 +9187,8 @@ fi
 
 
 
-    LTDL_DESCRIP="libtool"
-    LTDL_OPTION="ltdl"
-    PBX_LTDL=0
 
-# Check whether --with-ltdl was given.
-if test "${with_ltdl+set}" = set; then :
-  withval=$with_ltdl;
-       case ${withval} in
-       n|no)
-       USE_LTDL=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_LTDL=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} LTDL"
-       ;;
-       *)
-       LTDL_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} LTDL"
-       ;;
-       esac
 
-fi
 
 
 
 
 
 
-    LUA_DESCRIP="Lua"
-    LUA_OPTION="lua"
-    PBX_LUA=0
 
-# Check whether --with-lua was given.
-if test "${with_lua+set}" = set; then :
-  withval=$with_lua;
-       case ${withval} in
-       n|no)
-       USE_LUA=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_LUA=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} LUA"
-       ;;
-       *)
-       LUA_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} LUA"
-       ;;
-       esac
 
+# Check whether --with-libcurl was given.
+if test "${with_libcurl+set}" = set; then :
+  withval=$with_libcurl; _libcurl_with=$withval
+else
+  _libcurl_with=yes
 fi
 
 
+  if test "$_libcurl_with" != "no" ; then
 
+     for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    $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
 
-
-
-
-
-    MISDN_DESCRIP="mISDN user"
-    MISDN_OPTION="misdn"
-    PBX_MISDN=0
-
-# Check whether --with-misdn was given.
-if test "${with_misdn+set}" = set; then :
-  withval=$with_misdn;
-       case ${withval} in
-       n|no)
-       USE_MISDN=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_MISDN=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} MISDN"
-       ;;
-       *)
-       MISDN_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} MISDN"
-       ;;
-       esac
-
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+  test -n "$AWK" && break
+done
 
 
+     _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[1]+256*A[2]+A[3]; print X;}'"
 
+     _libcurl_try_link=yes
 
+     if test -d "$_libcurl_with" ; then
+        CURL_INCLUDE="-I$withval/include"
+        _libcurl_ldflags="-L$withval/lib"
+        # Extract the first word of "curl-config", so it can be a program name with args.
+set dummy curl-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 test "${ac_cv_path__libcurl_config+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $_libcurl_config in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in "$withval/bin"
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path__libcurl_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
 
+  test -z "$ac_cv_path__libcurl_config" && ac_cv_path__libcurl_config=""$withval/bin""
+  ;;
+esac
+fi
+_libcurl_config=$ac_cv_path__libcurl_config
+if test -n "$_libcurl_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5
+$as_echo "$_libcurl_config" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-    MYSQLCLIENT_DESCRIP="MySQL client"
-    MYSQLCLIENT_OPTION="mysqlclient"
-    PBX_MYSQLCLIENT=0
 
-# Check whether --with-mysqlclient was given.
-if test "${with_mysqlclient+set}" = set; then :
-  withval=$with_mysqlclient;
-       case ${withval} in
-       n|no)
-       USE_MYSQLCLIENT=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_MYSQLCLIENT=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} MYSQLCLIENT"
-       ;;
-       *)
-       MYSQLCLIENT_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} MYSQLCLIENT"
-       ;;
-       esac
+     else
+        # Extract the first word of "curl-config", so it can be a program name with args.
+set dummy curl-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 test "${ac_cv_path__libcurl_config+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $_libcurl_config in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path__libcurl_config="$_libcurl_config" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path__libcurl_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
+_libcurl_config=$ac_cv_path__libcurl_config
+if test -n "$_libcurl_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5
+$as_echo "$_libcurl_config" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+     fi
 
+     if test x$_libcurl_config != "x" ; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the version of libcurl" >&5
+$as_echo_n "checking for the version of libcurl... " >&6; }
+if test "${libcurl_cv_lib_curl_version+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'`
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_version" >&5
+$as_echo "$libcurl_cv_lib_curl_version" >&6; }
 
+        _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
+        _libcurl_wanted=`echo 7.10.1 | $_libcurl_version_parse`
 
+        if test $_libcurl_wanted -gt 0 ; then
+           { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl >= version 7.10.1" >&5
+$as_echo_n "checking for libcurl >= version 7.10.1... " >&6; }
+if test "${libcurl_cv_lib_version_ok+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
 
+              if test $_libcurl_version -ge $_libcurl_wanted ; then
+                 libcurl_cv_lib_version_ok=yes
+              else
+                 libcurl_cv_lib_version_ok=no
+              fi
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_version_ok" >&5
+$as_echo "$libcurl_cv_lib_version_ok" >&6; }
+        fi
 
-    NBS_DESCRIP="Network Broadcast Sound"
-    NBS_OPTION="nbs"
-    PBX_NBS=0
+        if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
+           if test x"$CURL_INCLUDE" = "x" ; then
+              CURL_INCLUDE=`$_libcurl_config --cflags`
+           fi
+           if test x"$CURL_LIB" = "x" ; then
+              CURL_LIB=`$_libcurl_config --libs`
 
-# Check whether --with-nbs was given.
-if test "${with_nbs+set}" = set; then :
-  withval=$with_nbs;
-       case ${withval} in
-       n|no)
-       USE_NBS=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_NBS=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} NBS"
-       ;;
-       *)
-       NBS_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} NBS"
-       ;;
-       esac
+              # This is so silly, but Apple actually has a bug in their
+              # curl-config script.  Fixed in Tiger, but there are still
+              # lots of Panther installs around.
+              case "${host}" in
+                 powerpc-apple-darwin7*)
+                    CURL_LIB=`echo $CURL_LIB | sed -e 's|-arch i386||g'`
+                 ;;
+              esac
+           fi
+
+           # All curl-config scripts support --feature
+           _libcurl_features=`$_libcurl_config --feature`
+
+           # Is it modern enough to have --protocols? (7.12.4)
+           if test $_libcurl_version -ge 461828 ; then
+              _libcurl_protocols=`$_libcurl_config --protocols`
+           fi
+        else
+           _libcurl_try_link=no
+        fi
+
+        unset _libcurl_wanted
+     fi
+
+     if test $_libcurl_try_link = yes ; then
+
+        # we didn't find curl-config, so let's see if the user-supplied
+        # link line (or failing that, "-lcurl") is enough.
+        CURL_LIB=${CURL_LIB-"$_libcurl_ldflags -lcurl"}
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcurl is usable" >&5
+$as_echo_n "checking whether libcurl is usable... " >&6; }
+if test "${libcurl_cv_lib_curl_usable+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+           _libcurl_save_cppflags=$CPPFLAGS
+           CPPFLAGS="$CURL_INCLUDE $CPPFLAGS"
+           _libcurl_save_libs=$LIBS
+           LIBS="$CURL_LIB $LIBS"
+
+           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <curl/curl.h>
+int
+main ()
+{
+
+/* Try and use a few common options to force a failure if we are
+   missing symbols or can't link. */
+int x;
+curl_easy_setopt(NULL,CURLOPT_URL,NULL);
+x=CURL_ERROR_SIZE;
+x=CURLOPT_WRITEFUNCTION;
+x=CURLOPT_FILE;
+x=CURLOPT_ERRORBUFFER;
+x=CURLOPT_STDERR;
+x=CURLOPT_VERBOSE;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  libcurl_cv_lib_curl_usable=yes
+else
+  libcurl_cv_lib_curl_usable=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+           CPPFLAGS=$_libcurl_save_cppflags
+           LIBS=$_libcurl_save_libs
+           unset _libcurl_save_cppflags
+           unset _libcurl_save_libs
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_usable" >&5
+$as_echo "$libcurl_cv_lib_curl_usable" >&6; }
+
+        if test $libcurl_cv_lib_curl_usable = yes ; then
+
+           # Does curl_free() exist in this version of libcurl?
+           # If not, fake it with free()
 
+           _libcurl_save_cppflags=$CPPFLAGS
+           CPPFLAGS="$CPPFLAGS $CURL_INCLUDE"
+           _libcurl_save_libs=$LIBS
+           LIBS="$LIBS $CURL_LIB"
 
+           ac_fn_c_check_func "$LINENO" "curl_free" "ac_cv_func_curl_free"
+if test "x$ac_cv_func_curl_free" = x""yes; then :
 
+else
 
+$as_echo "#define curl_free free" >>confdefs.h
 
+fi
 
 
+           CPPFLAGS=$_libcurl_save_cppflags
+           LIBS=$_libcurl_save_libs
+           unset _libcurl_save_cppflags
+           unset _libcurl_save_libs
 
-    NCURSES_DESCRIP="ncurses"
-    NCURSES_OPTION="ncurses"
-    PBX_NCURSES=0
 
-# Check whether --with-ncurses was given.
-if test "${with_ncurses+set}" = set; then :
-  withval=$with_ncurses;
+$as_echo "#define HAVE_CURL 1" >>confdefs.h
+
+
+
+           PBX_CURL=1
+
+           for _libcurl_feature in $_libcurl_features ; do
+              cat >>confdefs.h <<_ACEOF
+#define `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_cpp` 1
+_ACEOF
+
+              eval `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_sh`=yes
+           done
+
+           if test "x$_libcurl_protocols" = "x" ; then
+
+              # We don't have --protocols, so just assume that all
+              # protocols are available
+              _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT"
+
+              if test x$libcurl_feature_SSL = xyes ; then
+                 _libcurl_protocols="$_libcurl_protocols HTTPS"
+
+                 # FTPS wasn't standards-compliant until version
+                 # 7.11.0
+                 if test $_libcurl_version -ge 461568; then
+                    _libcurl_protocols="$_libcurl_protocols FTPS"
+                 fi
+              fi
+           fi
+
+           for _libcurl_protocol in $_libcurl_protocols ; do
+              cat >>confdefs.h <<_ACEOF
+#define `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_cpp` 1
+_ACEOF
+
+              eval `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_sh`=yes
+           done
+        else
+           unset CURL_LIB
+           unset CURL_INCLUDE
+           PBX_CURL=0
+        fi
+     fi
+
+     unset _libcurl_try_link
+     unset _libcurl_version_parse
+     unset _libcurl_config
+     unset _libcurl_feature
+     unset _libcurl_features
+     unset _libcurl_protocol
+     unset _libcurl_protocols
+     unset _libcurl_version
+     unset _libcurl_ldflags
+  fi
+
+  if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
+     # This is the IF-NO path
+     :
+  else
+     # This is the IF-YES path
+     :
+  fi
+
+  unset _libcurl_with
+
+
+    LIBXML2_DESCRIP="LibXML2"
+    LIBXML2_OPTION="libxml2"
+    PBX_LIBXML2=0
+
+# Check whether --with-libxml2 was given.
+if test "${with_libxml2+set}" = set; then :
+  withval=$with_libxml2;
        case ${withval} in
        n|no)
-       USE_NCURSES=no
+       USE_LIBXML2=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_NCURSES=-1
+       PBX_LIBXML2=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} NCURSES"
+       ac_mandatory_list="${ac_mandatory_list} LIBXML2"
        ;;
        *)
-       NCURSES_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} NCURSES"
+       LIBXML2_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} LIBXML2"
        ;;
        esac
 
@@ -9376,26 +9587,26 @@ fi
 
 
 
-    NEON_DESCRIP="neon"
-    NEON_OPTION="neon"
-    PBX_NEON=0
+    LTDL_DESCRIP="libtool"
+    LTDL_OPTION="ltdl"
+    PBX_LTDL=0
 
-# Check whether --with-neon was given.
-if test "${with_neon+set}" = set; then :
-  withval=$with_neon;
+# Check whether --with-ltdl was given.
+if test "${with_ltdl+set}" = set; then :
+  withval=$with_ltdl;
        case ${withval} in
        n|no)
-       USE_NEON=no
+       USE_LTDL=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_NEON=-1
+       PBX_LTDL=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} NEON"
+       ac_mandatory_list="${ac_mandatory_list} LTDL"
        ;;
        *)
-       NEON_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} NEON"
+       LTDL_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} LTDL"
        ;;
        esac
 
@@ -9408,26 +9619,26 @@ fi
 
 
 
-    NEON29_DESCRIP="neon29"
-    NEON29_OPTION="neon29"
-    PBX_NEON29=0
+    LUA_DESCRIP="Lua"
+    LUA_OPTION="lua"
+    PBX_LUA=0
 
-# Check whether --with-neon29 was given.
-if test "${with_neon29+set}" = set; then :
-  withval=$with_neon29;
+# Check whether --with-lua was given.
+if test "${with_lua+set}" = set; then :
+  withval=$with_lua;
        case ${withval} in
        n|no)
-       USE_NEON29=no
+       USE_LUA=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_NEON29=-1
+       PBX_LUA=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} NEON29"
+       ac_mandatory_list="${ac_mandatory_list} LUA"
        ;;
        *)
-       NEON29_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} NEON29"
+       LUA_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} LUA"
        ;;
        esac
 
@@ -9440,26 +9651,26 @@ fi
 
 
 
-    NETSNMP_DESCRIP="Net-SNMP"
-    NETSNMP_OPTION="netsnmp"
-    PBX_NETSNMP=0
+    MISDN_DESCRIP="mISDN user"
+    MISDN_OPTION="misdn"
+    PBX_MISDN=0
 
-# Check whether --with-netsnmp was given.
-if test "${with_netsnmp+set}" = set; then :
-  withval=$with_netsnmp;
+# Check whether --with-misdn was given.
+if test "${with_misdn+set}" = set; then :
+  withval=$with_misdn;
        case ${withval} in
        n|no)
-       USE_NETSNMP=no
+       USE_MISDN=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_NETSNMP=-1
+       PBX_MISDN=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} NETSNMP"
+       ac_mandatory_list="${ac_mandatory_list} MISDN"
        ;;
        *)
-       NETSNMP_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} NETSNMP"
+       MISDN_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} MISDN"
        ;;
        esac
 
@@ -9472,26 +9683,26 @@ fi
 
 
 
-    NEWT_DESCRIP="newt"
-    NEWT_OPTION="newt"
-    PBX_NEWT=0
+    MYSQLCLIENT_DESCRIP="MySQL client"
+    MYSQLCLIENT_OPTION="mysqlclient"
+    PBX_MYSQLCLIENT=0
 
-# Check whether --with-newt was given.
-if test "${with_newt+set}" = set; then :
-  withval=$with_newt;
+# Check whether --with-mysqlclient was given.
+if test "${with_mysqlclient+set}" = set; then :
+  withval=$with_mysqlclient;
        case ${withval} in
        n|no)
-       USE_NEWT=no
+       USE_MYSQLCLIENT=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_NEWT=-1
+       PBX_MYSQLCLIENT=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} NEWT"
+       ac_mandatory_list="${ac_mandatory_list} MYSQLCLIENT"
        ;;
        *)
-       NEWT_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} NEWT"
+       MYSQLCLIENT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} MYSQLCLIENT"
        ;;
        esac
 
@@ -9504,26 +9715,26 @@ fi
 
 
 
-    OGG_DESCRIP="OGG"
-    OGG_OPTION="ogg"
-    PBX_OGG=0
+    NBS_DESCRIP="Network Broadcast Sound"
+    NBS_OPTION="nbs"
+    PBX_NBS=0
 
-# Check whether --with-ogg was given.
-if test "${with_ogg+set}" = set; then :
-  withval=$with_ogg;
+# Check whether --with-nbs was given.
+if test "${with_nbs+set}" = set; then :
+  withval=$with_nbs;
        case ${withval} in
        n|no)
-       USE_OGG=no
+       USE_NBS=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_OGG=-1
+       PBX_NBS=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} OGG"
+       ac_mandatory_list="${ac_mandatory_list} NBS"
        ;;
        *)
-       OGG_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} OGG"
+       NBS_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} NBS"
        ;;
        esac
 
@@ -9536,26 +9747,26 @@ fi
 
 
 
-    OSPTK_DESCRIP="OSP Toolkit"
-    OSPTK_OPTION="osptk"
-    PBX_OSPTK=0
+    NCURSES_DESCRIP="ncurses"
+    NCURSES_OPTION="ncurses"
+    PBX_NCURSES=0
 
-# Check whether --with-osptk was given.
-if test "${with_osptk+set}" = set; then :
-  withval=$with_osptk;
+# Check whether --with-ncurses was given.
+if test "${with_ncurses+set}" = set; then :
+  withval=$with_ncurses;
        case ${withval} in
        n|no)
-       USE_OSPTK=no
+       USE_NCURSES=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_OSPTK=-1
+       PBX_NCURSES=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} OSPTK"
+       ac_mandatory_list="${ac_mandatory_list} NCURSES"
        ;;
        *)
-       OSPTK_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} OSPTK"
+       NCURSES_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} NCURSES"
        ;;
        esac
 
@@ -9568,26 +9779,26 @@ fi
 
 
 
-    OSS_DESCRIP="Open Sound System"
-    OSS_OPTION="oss"
-    PBX_OSS=0
+    NEON_DESCRIP="neon"
+    NEON_OPTION="neon"
+    PBX_NEON=0
 
-# Check whether --with-oss was given.
-if test "${with_oss+set}" = set; then :
-  withval=$with_oss;
+# Check whether --with-neon was given.
+if test "${with_neon+set}" = set; then :
+  withval=$with_neon;
        case ${withval} in
        n|no)
-       USE_OSS=no
+       USE_NEON=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_OSS=-1
+       PBX_NEON=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} OSS"
+       ac_mandatory_list="${ac_mandatory_list} NEON"
        ;;
        *)
-       OSS_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} OSS"
+       NEON_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} NEON"
        ;;
        esac
 
@@ -9600,26 +9811,26 @@ fi
 
 
 
-    PGSQL_DESCRIP="PostgreSQL"
-    PGSQL_OPTION="postgres"
-    PBX_PGSQL=0
+    NEON29_DESCRIP="neon29"
+    NEON29_OPTION="neon29"
+    PBX_NEON29=0
 
-# Check whether --with-postgres was given.
-if test "${with_postgres+set}" = set; then :
-  withval=$with_postgres;
+# Check whether --with-neon29 was given.
+if test "${with_neon29+set}" = set; then :
+  withval=$with_neon29;
        case ${withval} in
        n|no)
-       USE_PGSQL=no
+       USE_NEON29=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_PGSQL=-1
+       PBX_NEON29=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} PGSQL"
+       ac_mandatory_list="${ac_mandatory_list} NEON29"
        ;;
        *)
-       PGSQL_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} PGSQL"
+       NEON29_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} NEON29"
        ;;
        esac
 
@@ -9632,26 +9843,26 @@ fi
 
 
 
-    POPT_DESCRIP="popt"
-    POPT_OPTION="popt"
-    PBX_POPT=0
+    NETSNMP_DESCRIP="Net-SNMP"
+    NETSNMP_OPTION="netsnmp"
+    PBX_NETSNMP=0
 
-# Check whether --with-popt was given.
-if test "${with_popt+set}" = set; then :
-  withval=$with_popt;
+# Check whether --with-netsnmp was given.
+if test "${with_netsnmp+set}" = set; then :
+  withval=$with_netsnmp;
        case ${withval} in
        n|no)
-       USE_POPT=no
+       USE_NETSNMP=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_POPT=-1
+       PBX_NETSNMP=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} POPT"
+       ac_mandatory_list="${ac_mandatory_list} NETSNMP"
        ;;
        *)
-       POPT_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} POPT"
+       NETSNMP_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} NETSNMP"
        ;;
        esac
 
@@ -9664,26 +9875,26 @@ fi
 
 
 
-    PORTAUDIO_DESCRIP="PortAudio"
-    PORTAUDIO_OPTION="portaudio"
-    PBX_PORTAUDIO=0
+    NEWT_DESCRIP="newt"
+    NEWT_OPTION="newt"
+    PBX_NEWT=0
 
-# Check whether --with-portaudio was given.
-if test "${with_portaudio+set}" = set; then :
-  withval=$with_portaudio;
+# Check whether --with-newt was given.
+if test "${with_newt+set}" = set; then :
+  withval=$with_newt;
        case ${withval} in
        n|no)
-       USE_PORTAUDIO=no
+       USE_NEWT=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_PORTAUDIO=-1
+       PBX_NEWT=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} PORTAUDIO"
+       ac_mandatory_list="${ac_mandatory_list} NEWT"
        ;;
        *)
-       PORTAUDIO_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} PORTAUDIO"
+       NEWT_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} NEWT"
        ;;
        esac
 
@@ -9696,26 +9907,26 @@ fi
 
 
 
-    PRI_DESCRIP="ISDN PRI"
-    PRI_OPTION="pri"
-    PBX_PRI=0
+    OGG_DESCRIP="OGG"
+    OGG_OPTION="ogg"
+    PBX_OGG=0
 
-# Check whether --with-pri was given.
-if test "${with_pri+set}" = set; then :
-  withval=$with_pri;
+# Check whether --with-ogg was given.
+if test "${with_ogg+set}" = set; then :
+  withval=$with_ogg;
        case ${withval} in
        n|no)
-       USE_PRI=no
+       USE_OGG=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_PRI=-1
+       PBX_OGG=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} PRI"
+       ac_mandatory_list="${ac_mandatory_list} OGG"
        ;;
        *)
-       PRI_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} PRI"
+       OGG_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OGG"
        ;;
        esac
 
@@ -9728,35 +9939,31 @@ fi
 
 
 
-PRI_CCSS_DESCRIP="ISDN PRI call completion supplementary service"
-PRI_CCSS_OPTION=pri
-
-for i in ${ac_mandatory_list}; do
-   if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_CCSS"
-      break
-   fi
-done
-
-PBX_PRI_CCSS=0
-
-
-
-
-
-
+    OPENAIS_DESCRIP="OpenAIS"
+    OPENAIS_OPTION="openais"
+    PBX_OPENAIS=0
 
-PRI_HANGUP_FIX_DESCRIP="ISDN PRI hangup fix"
-PRI_HANGUP_FIX_OPTION=pri
+# Check whether --with-openais was given.
+if test "${with_openais+set}" = set; then :
+  withval=$with_openais;
+       case ${withval} in
+       n|no)
+       USE_OPENAIS=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_OPENAIS=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} OPENAIS"
+       ;;
+       *)
+       OPENAIS_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OPENAIS"
+       ;;
+       esac
 
-for i in ${ac_mandatory_list}; do
-   if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_HANGUP_FIX"
-      break
-   fi
-done
+fi
 
-PBX_PRI_HANGUP_FIX=0
 
 
 
@@ -9764,17 +9971,30 @@ PBX_PRI_HANGUP_FIX=0
 
 
 
-PRI_SUBADDR_DESCRIP="ISDN PRI subaddressing"
-PRI_SUBADDR_OPTION=pri
+    OPENR2_DESCRIP="MFR2"
+    OPENR2_OPTION="openr2"
+    PBX_OPENR2=0
 
-for i in ${ac_mandatory_list}; do
-   if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_SUBADDR"
-      break
-   fi
-done
+# Check whether --with-openr2 was given.
+if test "${with_openr2+set}" = set; then :
+  withval=$with_openr2;
+       case ${withval} in
+       n|no)
+       USE_OPENR2=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_OPENR2=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} OPENR2"
+       ;;
+       *)
+       OPENR2_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OPENR2"
+       ;;
+       esac
 
-PBX_PRI_SUBADDR=0
+fi
 
 
 
@@ -9782,17 +10002,210 @@ PBX_PRI_SUBADDR=0
 
 
 
-PRI_CALL_HOLD_DESCRIP="ISDN PRI call hold"
-PRI_CALL_HOLD_OPTION=pri
+
+    OSPTK_DESCRIP="OSP Toolkit"
+    OSPTK_OPTION="osptk"
+    PBX_OSPTK=0
+
+# Check whether --with-osptk was given.
+if test "${with_osptk+set}" = set; then :
+  withval=$with_osptk;
+       case ${withval} in
+       n|no)
+       USE_OSPTK=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_OSPTK=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} OSPTK"
+       ;;
+       *)
+       OSPTK_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OSPTK"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+    OSS_DESCRIP="Open Sound System"
+    OSS_OPTION="oss"
+    PBX_OSS=0
+
+# Check whether --with-oss was given.
+if test "${with_oss+set}" = set; then :
+  withval=$with_oss;
+       case ${withval} in
+       n|no)
+       USE_OSS=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_OSS=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} OSS"
+       ;;
+       *)
+       OSS_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} OSS"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+    PGSQL_DESCRIP="PostgreSQL"
+    PGSQL_OPTION="postgres"
+    PBX_PGSQL=0
+
+# Check whether --with-postgres was given.
+if test "${with_postgres+set}" = set; then :
+  withval=$with_postgres;
+       case ${withval} in
+       n|no)
+       USE_PGSQL=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_PGSQL=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} PGSQL"
+       ;;
+       *)
+       PGSQL_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} PGSQL"
+       ;;
+       esac
+
+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
+
+# Check whether --with-portaudio was given.
+if test "${with_portaudio+set}" = set; then :
+  withval=$with_portaudio;
+       case ${withval} in
+       n|no)
+       USE_PORTAUDIO=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_PORTAUDIO=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} PORTAUDIO"
+       ;;
+       *)
+       PORTAUDIO_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} PORTAUDIO"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+    PRI_DESCRIP="ISDN PRI"
+    PRI_OPTION="pri"
+    PBX_PRI=0
+
+# Check whether --with-pri was given.
+if test "${with_pri+set}" = set; then :
+  withval=$with_pri;
+       case ${withval} in
+       n|no)
+       USE_PRI=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_PRI=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} PRI"
+       ;;
+       *)
+       PRI_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} PRI"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+PRI_MWI_DESCRIP="ISDN PRI Message Waiting Indication"
+PRI_MWI_OPTION=pri
 
 for i in ${ac_mandatory_list}; do
    if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_CALL_HOLD"
+      ac_mandatory_list="${ac_mandatory_list} PRI_MWI"
       break
    fi
 done
 
-PBX_PRI_CALL_HOLD=0
+PBX_PRI_MWI=0
 
 
 
@@ -9800,17 +10213,17 @@ PBX_PRI_CALL_HOLD=0
 
 
 
-PRI_CALL_REROUTING_DESCRIP="ISDN PRI call rerouting and call deflection"
-PRI_CALL_REROUTING_OPTION=pri
+PRI_MCID_DESCRIP="ISDN PRI Malicious Call ID"
+PRI_MCID_OPTION=pri
 
 for i in ${ac_mandatory_list}; do
    if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_CALL_REROUTING"
+      ac_mandatory_list="${ac_mandatory_list} PRI_MCID"
       break
    fi
 done
 
-PBX_PRI_CALL_REROUTING=0
+PBX_PRI_MCID=0
 
 
 
@@ -9818,38 +10231,35 @@ PBX_PRI_CALL_REROUTING=0
 
 
 
-PRI_SETUP_KEYPAD_DESCRIP="ISDN PRI keypad facility in SETUP"
-PRI_SETUP_KEYPAD_OPTION=pri
+PRI_CALL_WAITING_DESCRIP="ISDN PRI call waiting supplementary service"
+PRI_CALL_WAITING_OPTION=pri
 
 for i in ${ac_mandatory_list}; do
    if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_SETUP_KEYPAD"
+      ac_mandatory_list="${ac_mandatory_list} PRI_CALL_WAITING"
       break
    fi
 done
 
-PBX_PRI_SETUP_KEYPAD=0
+PBX_PRI_CALL_WAITING=0
 
 
 
 
 
 
-# ------------------------------------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.
 
-PRI_INBANDDISCONNECT_DESCRIP="ISDN PRI set_inbanddisconnect"
-PRI_INBANDDISCONNECT_OPTION=pri
+PRI_AOC_EVENTS_DESCRIP="ISDN PRI advice of charge supplementary service events"
+PRI_AOC_EVENTS_OPTION=pri
 
 for i in ${ac_mandatory_list}; do
    if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_INBANDDISCONNECT"
+      ac_mandatory_list="${ac_mandatory_list} PRI_AOC_EVENTS"
       break
    fi
 done
 
-PBX_PRI_INBANDDISCONNECT=0
+PBX_PRI_AOC_EVENTS=0
 
 
 
@@ -9857,17 +10267,17 @@ PBX_PRI_INBANDDISCONNECT=0
 
 
 
-PRI_PROG_W_CAUSE_DESCRIP="ISDN progress with cause"
-PRI_PROG_W_CAUSE_OPTION=pri
+PRI_TRANSFER_DESCRIP="ISDN PRI call transfer supplementary service"
+PRI_TRANSFER_OPTION=pri
 
 for i in ${ac_mandatory_list}; do
    if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_PROG_W_CAUSE"
+      ac_mandatory_list="${ac_mandatory_list} PRI_TRANSFER"
       break
    fi
 done
 
-PBX_PRI_PROG_W_CAUSE=0
+PBX_PRI_TRANSFER=0
 
 
 
@@ -9875,17 +10285,17 @@ PBX_PRI_PROG_W_CAUSE=0
 
 
 
-PRI_SERVICE_MESSAGES_DESCRIP="ISDN service messages"
-PRI_SERVICE_MESSAGES_OPTION=pri
+PRI_CCSS_DESCRIP="ISDN PRI call completion supplementary service"
+PRI_CCSS_OPTION=pri
 
 for i in ${ac_mandatory_list}; do
    if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_SERVICE_MESSAGES"
+      ac_mandatory_list="${ac_mandatory_list} PRI_CCSS"
       break
    fi
 done
 
-PBX_PRI_SERVICE_MESSAGES=0
+PBX_PRI_CCSS=0
 
 
 
@@ -9893,49 +10303,35 @@ PBX_PRI_SERVICE_MESSAGES=0
 
 
 
-PRI_REVERSE_CHARGE_DESCRIP="ISDN reverse charge"
-PRI_REVERSE_CHARGE_OPTION=pri
+PRI_HANGUP_FIX_DESCRIP="ISDN PRI hangup fix"
+PRI_HANGUP_FIX_OPTION=pri
 
 for i in ${ac_mandatory_list}; do
    if test "xPRI" = "x$i"; then
-      ac_mandatory_list="${ac_mandatory_list} PRI_REVERSE_CHARGE"
+      ac_mandatory_list="${ac_mandatory_list} PRI_HANGUP_FIX"
       break
    fi
 done
 
-PBX_PRI_REVERSE_CHARGE=0
+PBX_PRI_HANGUP_FIX=0
 
 
 
 
 
 
-# ------------------------------------^
 
-    RESAMPLE_DESCRIP="LIBRESAMPLE"
-    RESAMPLE_OPTION="resample"
-    PBX_RESAMPLE=0
+PRI_SUBADDR_DESCRIP="ISDN PRI subaddressing"
+PRI_SUBADDR_OPTION=pri
 
-# Check whether --with-resample was given.
-if test "${with_resample+set}" = set; then :
-  withval=$with_resample;
-       case ${withval} in
-       n|no)
-       USE_RESAMPLE=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_RESAMPLE=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} RESAMPLE"
-       ;;
-       *)
-       RESAMPLE_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} RESAMPLE"
-       ;;
-       esac
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_SUBADDR"
+      break
+   fi
+done
 
-fi
+PBX_PRI_SUBADDR=0
 
 
 
 
 
 
+PRI_CALL_HOLD_DESCRIP="ISDN PRI call hold"
+PRI_CALL_HOLD_OPTION=pri
 
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_CALL_HOLD"
+      break
+   fi
+done
 
-# 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${SOUNDS_CACHE_DIR}" = "x"; then
-                       SOUNDS_CACHE_DIR="${HOME}/.asterisk_sounds_cache"
-               else
-                       SOUNDS_CACHE_DIR="${withval}"
-               fi
-               ;;
-       esac
+PBX_PRI_CALL_HOLD=0
 
-fi
 
 
 
 
-    SPANDSP_DESCRIP="SPANDSP"
-    SPANDSP_OPTION="spandsp"
-    PBX_SPANDSP=0
 
-# Check whether --with-spandsp was given.
-if test "${with_spandsp+set}" = set; then :
-  withval=$with_spandsp;
-       case ${withval} in
-       n|no)
-       USE_SPANDSP=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_SPANDSP=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} SPANDSP"
-       ;;
-       *)
-       SPANDSP_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} SPANDSP"
-       ;;
-       esac
 
-fi
+PRI_CALL_REROUTING_DESCRIP="ISDN PRI call rerouting and call deflection"
+PRI_CALL_REROUTING_OPTION=pri
 
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_CALL_REROUTING"
+      break
+   fi
+done
 
+PBX_PRI_CALL_REROUTING=0
 
 
 
 
 
 
-    SS7_DESCRIP="ISDN SS7"
-    SS7_OPTION="ss7"
-    PBX_SS7=0
 
-# Check whether --with-ss7 was given.
-if test "${with_ss7+set}" = set; then :
-  withval=$with_ss7;
-       case ${withval} in
-       n|no)
-       USE_SS7=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_SS7=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} SS7"
-       ;;
-       *)
-       SS7_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} SS7"
-       ;;
-       esac
+PRI_SETUP_KEYPAD_DESCRIP="ISDN PRI keypad facility in SETUP"
+PRI_SETUP_KEYPAD_OPTION=pri
 
-fi
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_SETUP_KEYPAD"
+      break
+   fi
+done
 
+PBX_PRI_SETUP_KEYPAD=0
 
 
 
 
 
 
+# ------------------------------------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.
 
-    OPENR2_DESCRIP="MFR2"
-    OPENR2_OPTION="openr2"
-    PBX_OPENR2=0
+PRI_INBANDDISCONNECT_DESCRIP="ISDN PRI set_inbanddisconnect"
+PRI_INBANDDISCONNECT_OPTION=pri
 
-# Check whether --with-openr2 was given.
-if test "${with_openr2+set}" = set; then :
-  withval=$with_openr2;
-       case ${withval} in
-       n|no)
-       USE_OPENR2=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_OPENR2=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} OPENR2"
-       ;;
-       *)
-       OPENR2_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} OPENR2"
-       ;;
-       esac
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_INBANDDISCONNECT"
+      break
+   fi
+done
 
-fi
+PBX_PRI_INBANDDISCONNECT=0
+
+
+
+
+
+
+
+PRI_PROG_W_CAUSE_DESCRIP="ISDN progress with cause"
+PRI_PROG_W_CAUSE_OPTION=pri
+
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_PROG_W_CAUSE"
+      break
+   fi
+done
+
+PBX_PRI_PROG_W_CAUSE=0
+
+
+
+
+
+
+
+PRI_SERVICE_MESSAGES_DESCRIP="ISDN service messages"
+PRI_SERVICE_MESSAGES_OPTION=pri
+
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_SERVICE_MESSAGES"
+      break
+   fi
+done
+
+PBX_PRI_SERVICE_MESSAGES=0
+
+
+
+
+
+
+
+PRI_REVERSE_CHARGE_DESCRIP="ISDN reverse charge"
+PRI_REVERSE_CHARGE_OPTION=pri
+
+for i in ${ac_mandatory_list}; do
+   if test "xPRI" = "x$i"; then
+      ac_mandatory_list="${ac_mandatory_list} PRI_REVERSE_CHARGE"
+      break
+   fi
+done
 
+PBX_PRI_REVERSE_CHARGE=0
 
 
 
 
 
 
+# ------------------------------------^
 
     PWLIB_DESCRIP="PWlib"
     PWLIB_OPTION="pwlib"
 
 
 
-    OPENH323_DESCRIP="OpenH323"
-    OPENH323_OPTION="h323"
-    PBX_OPENH323=0
+    RADIUS_DESCRIP="Radius Client"
+    RADIUS_OPTION="radius"
+    PBX_RADIUS=0
 
-# Check whether --with-h323 was given.
-if test "${with_h323+set}" = set; then :
-  withval=$with_h323;
+# Check whether --with-radius was given.
+if test "${with_radius+set}" = set; then :
+  withval=$with_radius;
        case ${withval} in
        n|no)
-       USE_OPENH323=no
+       USE_RADIUS=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_OPENH323=-1
+       PBX_RADIUS=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} OPENH323"
+       ac_mandatory_list="${ac_mandatory_list} RADIUS"
        ;;
        *)
-       OPENH323_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} OPENH323"
+       RADIUS_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} RADIUS"
        ;;
        esac
 
 
 
 
-    RADIUS_DESCRIP="Radius Client"
-    RADIUS_OPTION="radius"
-    PBX_RADIUS=0
+    RESAMPLE_DESCRIP="LIBRESAMPLE"
+    RESAMPLE_OPTION="resample"
+    PBX_RESAMPLE=0
 
-# Check whether --with-radius was given.
-if test "${with_radius+set}" = set; then :
-  withval=$with_radius;
+# Check whether --with-resample was given.
+if test "${with_resample+set}" = set; then :
+  withval=$with_resample;
        case ${withval} in
        n|no)
-       USE_RADIUS=no
+       USE_RESAMPLE=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_RADIUS=-1
+       PBX_RESAMPLE=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} RADIUS"
+       ac_mandatory_list="${ac_mandatory_list} RESAMPLE"
        ;;
        *)
-       RADIUS_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} RADIUS"
+       RESAMPLE_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} RESAMPLE"
        ;;
        esac
 
 
 
 
-    OPENAIS_DESCRIP="OpenAIS"
-    OPENAIS_OPTION="openais"
-    PBX_OPENAIS=0
 
-# Check whether --with-openais was given.
-if test "${with_openais+set}" = set; then :
-  withval=$with_openais;
+# Check whether --with-sounds-cache was given.
+if test "${with_sounds_cache+set}" = set; then :
+  withval=$with_sounds_cache;
        case ${withval} in
        n|no)
-       USE_OPENAIS=no
+               unset SOUNDS_CACHE_DIR
+               ;;
+       *)
+               if test "x${SOUNDS_CACHE_DIR}" = "x"; then
+                       SOUNDS_CACHE_DIR="${HOME}/.asterisk_sounds_cache"
+               else
+                       SOUNDS_CACHE_DIR="${withval}"
+               fi
+               ;;
+       esac
+
+else
+  SOUNDS_CACHE_DIR="${HOME}/.asterisk_sounds_cache"
+fi
+
+
+
+
+    SPANDSP_DESCRIP="SPANDSP"
+    SPANDSP_OPTION="spandsp"
+    PBX_SPANDSP=0
+
+# Check whether --with-spandsp was given.
+if test "${with_spandsp+set}" = set; then :
+  withval=$with_spandsp;
+       case ${withval} in
+       n|no)
+       USE_SPANDSP=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_OPENAIS=-1
+       PBX_SPANDSP=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} OPENAIS"
+       ac_mandatory_list="${ac_mandatory_list} SPANDSP"
        ;;
        *)
-       OPENAIS_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} OPENAIS"
+       SPANDSP_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SPANDSP"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
+    SS7_DESCRIP="ISDN SS7"
+    SS7_OPTION="ss7"
+    PBX_SS7=0
+
+# Check whether --with-ss7 was given.
+if test "${with_ss7+set}" = set; then :
+  withval=$with_ss7;
+       case ${withval} in
+       n|no)
+       USE_SS7=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_SS7=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} SS7"
+       ;;
+       *)
+       SS7_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SS7"
        ;;
        esac
 
 
 
 
-    SUPPSERV_DESCRIP="mISDN Supplemental Services"
-    SUPPSERV_OPTION="suppserv"
-    PBX_SUPPSERV=0
+    SRTP_DESCRIP="Secure RTP"
+    SRTP_OPTION="srtp"
+    PBX_SRTP=0
 
-# Check whether --with-suppserv was given.
-if test "${with_suppserv+set}" = set; then :
-  withval=$with_suppserv;
+# Check whether --with-srtp was given.
+if test "${with_srtp+set}" = set; then :
+  withval=$with_srtp;
        case ${withval} in
        n|no)
-       USE_SUPPSERV=no
+       USE_SRTP=no
        # -1 is a magic value used by menuselect to know that the package
        # was disabled, other than 'not found'
-       PBX_SUPPSERV=-1
+       PBX_SRTP=-1
        ;;
        y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} SUPPSERV"
+       ac_mandatory_list="${ac_mandatory_list} SRTP"
        ;;
        *)
-       SUPPSERV_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} SUPPSERV"
+       SRTP_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SRTP"
        ;;
        esac
 
 
 
 
+    SUPPSERV_DESCRIP="mISDN Supplemental Services"
+    SUPPSERV_OPTION="suppserv"
+    PBX_SUPPSERV=0
+
+# Check whether --with-suppserv was given.
+if test "${with_suppserv+set}" = set; then :
+  withval=$with_suppserv;
+       case ${withval} in
+       n|no)
+       USE_SUPPSERV=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_SUPPSERV=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} SUPPSERV"
+       ;;
+       *)
+       SUPPSERV_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} SUPPSERV"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     FREETDS_DESCRIP="FreeTDS"
     FREETDS_OPTION="tds"
     PBX_FREETDS=0
 
 
 
+    TIMERFD_DESCRIP="timerfd"
+    TIMERFD_OPTION="timerfd"
+    PBX_TIMERFD=0
+
+# Check whether --with-timerfd was given.
+if test "${with_timerfd+set}" = set; then :
+  withval=$with_timerfd;
+       case ${withval} in
+       n|no)
+       USE_TIMERFD=no
+       # -1 is a magic value used by menuselect to know that the package
+       # was disabled, other than 'not found'
+       PBX_TIMERFD=-1
+       ;;
+       y|ye|yes)
+       ac_mandatory_list="${ac_mandatory_list} TIMERFD"
+       ;;
+       *)
+       TIMERFD_DIR="${withval}"
+       ac_mandatory_list="${ac_mandatory_list} TIMERFD"
+       ;;
+       esac
+
+fi
+
+
+
+
+
+
+
+
     TINFO_DESCRIP="Term Info"
     TINFO_OPTION="tinfo"
     PBX_TINFO=0
 
 
 
-    TIMERFD_DESCRIP="timerfd"
-    TIMERFD_OPTION="timerfd"
-    PBX_TIMERFD=0
-
-# Check whether --with-timerfd was given.
-if test "${with_timerfd+set}" = set; then :
-  withval=$with_timerfd;
-       case ${withval} in
-       n|no)
-       USE_TIMERFD=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_TIMERFD=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} TIMERFD"
-       ;;
-       *)
-       TIMERFD_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} TIMERFD"
-       ;;
-       esac
-
-fi
-
-
-
-
-
-
-
-
 # check for basic system features and functionality before
 # checking for package libraries
 
@@ -13361,7 +13856,7 @@ fi
 done
 
 
-for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
+for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll newlocale putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
 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"
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t in locale.h" >&5
+$as_echo_n "checking for locale_t in locale.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <locale.h>
+int
+main ()
+{
+locale_t lt = NULL
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_LOCALE_T_IN_LOCALE_H 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t in xlocale.h" >&5
+$as_echo_n "checking for locale_t in xlocale.h... " >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <xlocale.h>
+int
+main ()
+{
+locale_t lt = NULL
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_LOCALE_T_IN_XLOCALE_H 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_exeext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_EVTONLY in fcntl.h" >&5
 $as_echo_n "checking for O_EVTONLY in fcntl.h... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -16672,9 +17220,6 @@ _ACEOF
 fi
 
 
-if test x"${PBX_ICAL}" = x1; then
-       ICAL_INCLUDE+=" -I/usr/include/libical"
-fi
 
 
 if test "x${PBX_ICAL}" != "x1" -a "${USE_ICAL}" != "no"; then
 
 
 
-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} "
@@ -21177,47 +21722,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -21282,47 +21827,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -21387,47 +21932,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -21492,47 +22037,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -21597,47 +22142,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -21702,47 +22247,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -21811,47 +22352,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -21916,47 +22457,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -22021,47 +22562,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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} "
@@ -22126,47 +22667,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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
@@ -22174,33 +22715,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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
 
@@ -22233,47 +22772,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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" = x""yes; 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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
 
@@ -22401,47 +22881,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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" = x""yes; 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
@@ -22449,36 +22929,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"
+   # 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${SPANDSP_DIR}"
+        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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
 
@@ -22511,47 +22986,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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" = x""yes; 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
@@ -22559,33 +23034,31 @@ _ACEOF
 fi
 
 
-fi
-
 
-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_pollflags"
+   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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
 
@@ -22618,47 +23091,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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" = x""yes; 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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
 
@@ -22724,47 +23196,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = 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" = x""yes; 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" = x""yes; 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
@@ -22772,1429 +23244,1355 @@ _ACEOF
 fi
 
 
-
-if test "${USE_PWLIB}" != "no"; then
-       if test -n "${PWLIB_DIR}"; then
-               PWLIBDIR="${PWLIB_DIR}"
-       fi
+# ------------------------------------^
 
 
+if test "x${PBX_RESAMPLE}" != "x1" -a "${USE_RESAMPLE}" != "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"
+      else
+        pbxlibdir="-L${RESAMPLE_DIR}"
+      fi
+   fi
+   pbxfuncname="resample_open"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_RESAMPLE_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; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lresample ${pbxlibdir} -lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-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"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = 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"
-eval as_val=\$$as_ac_Header
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  HAS_PWLIB=1
+  AST_RESAMPLE_FOUND=yes
+else
+  AST_RESAMPLE_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"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
-  HAS_PWLIB=1
+   # 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"
+      fi
+      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} ${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" = x""yes; then :
+  RESAMPLE_HEADER_FOUND=1
+else
+  RESAMPLE_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" = x""yes; then :
-  HAS_PWLIB=1
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${RESAMPLE_HEADER_FOUND}" = "x0" ; then
+         RESAMPLE_LIB=""
+         RESAMPLE_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            RESAMPLE_LIB=""
+         fi
+         PBX_RESAMPLE=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_RESAMPLE 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 test "${ac_cv_path_PTLIB_CONFIG+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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; }
+
+    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 "$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" = x""yes; then :
-  HAS_PWLIB=1
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    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 test "${ac_cv_path_PTLIB_CONFIG+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+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
 
-  ;;
-esac
+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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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
-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; }
+eval as_val=\$$as_ac_Lib
+   if test "x$as_val" = x""yes; then :
+  AST_SPANDSP_FOUND=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  AST_SPANDSP_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   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
-          fi
-          PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs`
-          PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`"
-        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
-    fi
-  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" = x""yes; then :
+  SPANDSP_HEADER_FOUND=1
+else
+  SPANDSP_HEADER_FOUND=0
 fi
 
-#if test "${HAS_PWLIB:-unset}" = "unset" ; then
-#  echo "Cannot find pwlib - please install or set PWLIBDIR and try again"
-#  exit
-#fi
 
-if test "${HAS_PWLIB:-unset}" != "unset" ; then
-  if test "${PWLIBDIR:-unset}" = "unset" ; then
-    if test "${PTLIB_CONFIG:-unset}" != "unset" ; then
-      PWLIBDIR=`$PTLIB_CONFIG --prefix`
-    else
-      echo "Cannot find ptlib-config - please install and try again"
-      exit
-    fi
-  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
 
-  if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
-    PWLIBDIR="/usr/share/pwlib"
-    PWLIB_INCDIR="/usr/include"
-    if test "x$LIB64" != "x"; then
-      PWLIB_LIBDIR="/usr/lib64"
-    else
-      PWLIB_LIBDIR="/usr/lib"
-    fi
-  fi
-  if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
-    PWLIBDIR="/usr/local/share/pwlib"
-    PWLIB_INCDIR="/usr/local/include"
-    if test "x$LIB64" != "x"; then
-      PWLIB_LIBDIR="/usr/local/lib64"
-    else
-      PWLIB_LIBDIR="/usr/local/lib"
-    fi
-  fi
+      fi
+   fi
+fi
 
-  if test "${PWLIB_INCDIR:-unset}" = "unset"; then
-    PWLIB_INCDIR="${PWLIBDIR}/include"
-  fi
-  if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
-    PWLIB_LIBDIR="${PWLIBDIR}/lib"
-  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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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; }
+eval as_val=\$$as_ac_Lib
+   if test "x$as_val" = x""yes; then :
+  AST_SPANDSP_FOUND=yes
+else
+  AST_SPANDSP_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
-
-
-
-       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.`
-               let PWLIB_VER=${PWLIB_MAJOR_VERSION}*10000+${PWLIB_MINOR_VERSION}*100+${PWLIB_BUILD_NUMBER}
-               let PWLIB_REQ=1*10000+9*100+2
-
-               { $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
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-               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}"
 
+      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" = x""yes; then :
+  SPANDSP_HEADER_FOUND=1
+else
+  SPANDSP_HEADER_FOUND=0
+fi
 
 
-               PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
-
+         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
 
-       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; }
+      fi
+   fi
+fi
 
-          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
+fi
 
 
-          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+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_pollflags"
+   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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
-#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
-
-          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
+LIBS=$ac_check_lib_save_LIBS
 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"
-eval as_val=\$$as_ac_Header
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  HAS_OPENH323=1
+  AST_SS7_FOUND=yes
+else
+  AST_SS7_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   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"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
-  OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1
+   # 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" = x""yes; then :
+  SS7_HEADER_FOUND=1
+else
+  SS7_HEADER_FOUND=0
 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>
-"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+         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
 
-else
-  OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}"
+      fi
+   fi
 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>
-"
-eval as_val=\$$as_ac_Header
+
+
+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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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; }
+eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  HAS_OPENH323=1
+  AST_OPENR2_FOUND=yes
+else
+  AST_OPENR2_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   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" = x""yes; then :
-  HAS_OPENH323=1
+   # 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" = x""yes; then :
+  OPENR2_HEADER_FOUND=1
+else
+  OPENR2_HEADER_FOUND=0
 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
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${OPENR2_HEADER_FOUND}" = "x0" ; then
+         OPENR2_LIB=""
+         OPENR2_INCLUDE=""
       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" = x""yes; then :
-  HAS_OPENH323=1
-fi
-
+         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
 
-        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
 
-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 "${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"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  HAS_PWLIB=1
 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
 
 
+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"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  HAS_PWLIB=1
+fi
 
-       if test "x" != "x"; then
-               VNAME=""
-               else
-               VNAME="OPENH323_VERSION"
-       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.`
-               let OPENH323_VER=${OPENH323_MAJOR_VERSION}*10000+${OPENH323_MINOR_VERSION}*100+${OPENH323_BUILD_NUMBER}
-               let OPENH323_REQ=1*10000+17*100+3
-
-               { $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
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-               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; }
 
+  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"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  HAS_PWLIB=1
+fi
 
 
-       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; }
-
-          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
+    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" = x""yes; then :
+  HAS_PWLIB=1
+fi
 
 
-          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"
+      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 test "${ac_cv_path_PTLIB_CONFIG+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 "$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
 
+        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" = x""yes; then :
+  HAS_PWLIB=1
+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
+        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 test "${ac_cv_path_PTLIB_CONFIG+set}" = set; 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
 
-$as_echo "#define HAVE_OPENH323 1" >>confdefs.h
+  ;;
+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"
+            else
+              PWLIB_LIBDIR="/usr/lib"
+            fi
+          fi
+          PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs`
+          PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`"
+        fi
+      fi
+    fi
+  fi
 fi
 
+#if test "${HAS_PWLIB:-unset}" = "unset" ; then
+#  echo "Cannot find pwlib - please install or set PWLIBDIR and try again"
+#  exit
+#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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
+if test "${HAS_PWLIB:-unset}" != "unset" ; then
+  if test "${PWLIBDIR:-unset}" = "unset" ; then
+    if test "${PTLIB_CONFIG:-unset}" != "unset" ; then
+      PWLIBDIR=`$PTLIB_CONFIG --prefix`
+    else
+      echo "Cannot find ptlib-config - please install and try again"
+      exit
+    fi
+  fi
 
-/* 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; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
-  AST_LUA_FOUND=yes
-else
-  AST_LUA_FOUND=no
-fi
+  if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
+    PWLIBDIR="/usr/share/pwlib"
+    PWLIB_INCDIR="/usr/include"
+    if test "x$LIB64" != "x"; then
+      PWLIB_LIBDIR="/usr/lib64"
+    else
+      PWLIB_LIBDIR="/usr/lib"
+    fi
+  fi
+  if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
+    PWLIBDIR="/usr/local/share/pwlib"
+    PWLIB_INCDIR="/usr/local/include"
+    if test "x$LIB64" != "x"; then
+      PWLIB_LIBDIR="/usr/local/lib64"
+    else
+      PWLIB_LIBDIR="/usr/local/lib"
+    fi
+  fi
 
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+  if test "${PWLIB_INCDIR:-unset}" = "unset"; then
+    PWLIB_INCDIR="${PWLIBDIR}/include"
+  fi
+  if test "${PWLIB_LIBDIR:-unset}" = "unset"; then
+    PWLIB_LIBDIR="${PWLIBDIR}/lib"
+  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" = x""yes; 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
+  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${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"
+
+       if test "xP[WT]LIB_VERSION" != "x"; then
+               VNAME="P[WT]LIB_VERSION"
+               else
+               VNAME="PWLIB_VERSION"
        fi
-fi
 
-# Some distributions (like SuSE) remove the 5.1 suffix.
+       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${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_register"
-   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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
+               { $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
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+               fi
+       fi
 
-/* 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; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
-  AST_LUA_FOUND=yes
-else
-  AST_LUA_FOUND=no
-fi
 
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
+       if test "${HAS_PWLIB:-unset}" != "unset"; then
 
-   # 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" = x""yes; then :
-  LUA_HEADER_FOUND=1
-else
-  LUA_HEADER_FOUND=0
-fi
+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 ;
+                  ;;
 
-         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
+   * )            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
 
-      fi
-   fi
-fi
+PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}"
 
 
 
 
-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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; 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.  */
+               PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r"
 
-/* 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} ();
+
+       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 ()
 {
-return ${pbxfuncname} ();
+int q = (int) PTime::IsDaylightSavings();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+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
-  eval "$as_ac_Lib=no"
+       { $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
-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; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
-  AST_RADIUS_FOUND=yes
-else
-  AST_RADIUS_FOUND=no
-fi
 
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   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
 
-   # 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" = x""yes; then :
-  RADIUS_HEADER_FOUND=1
-else
-  RADIUS_HEADER_FOUND=0
-fi
 
+          LIBS="${saved_libs}"
+          CPPFLAGS="${saved_cppflags}"
 
-         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
+          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
 
-      fi
-   fi
-fi
+$as_echo "#define HAVE_PWLIB 1" >>confdefs.h
 
+          fi
+       fi
 
+       fi
+fi
 
-# This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
-# *any* implementation of AIS, not just OpenAIS. However, the configure script needs
-# to know the specifics of each possible implementation, and then represent the one
-# that was found as 'AIS'.
+if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
+       if test -n "${OPENH323_DIR}"; then
+               OPENH323DIR="${OPENH323_DIR}"
+       fi
 
-PBX_AIS=0
+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
 
-# OpenAIS installs its libraries into /usr/lib/openais by default, so check there
+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"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  HAS_OPENH323=1
+fi
 
 
-if test "x${PBX_OPENAIS}" != "x1" -a "${USE_OPENAIS}" != "no"; then
-   pbxlibdir=""
-   # if --with-OPENAIS=DIR has been specified, use it.
-   if test "x${OPENAIS_DIR}" != "x"; then
-      if test -d ${OPENAIS_DIR}/lib; then
-        pbxlibdir="-L${OPENAIS_DIR}/lib"
-      else
-        pbxlibdir="-L${OPENAIS_DIR}"
-      fi
-   fi
-   pbxfuncname="saClmInitialize"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OPENAIS_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_SaClm_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lSaClm" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lSaClm... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSaClm ${pbxlibdir} -L/usr/lib/openais -L/usr/lib64/openais $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+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"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = 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>
+"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
 
-/* 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
+  OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}"
 fi
-eval ac_res=\$$as_ac_Lib
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
+
+
+    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>
+"
+eval as_val=\$$as_ac_Header
    if test "x$as_val" = x""yes; then :
-  AST_OPENAIS_FOUND=yes
-else
-  AST_OPENAIS_FOUND=no
+  HAS_OPENH323=1
 fi
 
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
 
-   # now check for the header.
-   if test "${AST_OPENAIS_FOUND}" = "yes"; then
-      OPENAIS_LIB="${pbxlibdir} -lSaClm -L/usr/lib/openais -L/usr/lib64/openais"
-      # if --with-OPENAIS=DIR has been specified, use it.
-      if test "x${OPENAIS_DIR}" != "x"; then
-         OPENAIS_INCLUDE="-I${OPENAIS_DIR}/include"
-      fi
-      OPENAIS_INCLUDE="${OPENAIS_INCLUDE} "
-      if test "xopenais/saClm.h" = "x" ; then  # no header, assume found
-         OPENAIS_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${OPENAIS_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "openais/saClm.h" "ac_cv_header_openais_saClm_h" "$ac_includes_default"
-if test "x$ac_cv_header_openais_saClm_h" = x""yes; then :
-  OPENAIS_HEADER_FOUND=1
-else
-  OPENAIS_HEADER_FOUND=0
+    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" = x""yes; then :
+  HAS_OPENH323=1
 fi
 
 
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${OPENAIS_HEADER_FOUND}" = "x0" ; then
-         OPENAIS_LIB=""
-         OPENAIS_INCLUDE=""
+      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
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            OPENAIS_LIB=""
-         fi
-         PBX_OPENAIS=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENAIS 1
-_ACEOF
+        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" = x""yes; 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
 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 "${PBX_OPENAIS}" = 1; then
-   PBX_AIS=1
-   if test -n "${OPENAIS_DIR}"; then
-      AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
-      AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
-   else
-      AIS_INCLUDE="-I/usr/include/openais"
-      AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais -L/usr/lib64/openais"
-   fi
 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="OPENH323_VERSION"
+       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))
 
+               { $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
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+               fi
+       fi
 
-if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
-   pbxlibdir=""
-   # 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${SPEEX_DIR}"
-      fi
-   fi
-   pbxfuncname="speex_encode"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SPEEX_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspeex ${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; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
-  AST_SPEEX_FOUND=yes
-else
-  AST_SPEEX_FOUND=no
-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; }
 
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
 
-   # now check for the header.
-   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
-      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} ${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" = x""yes; then :
-  SPEEX_HEADER_FOUND=1
-else
-  SPEEX_HEADER_FOUND=0
-fi
 
+       fi
 
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${SPEEX_HEADER_FOUND}" = "x0" ; then
-         SPEEX_LIB=""
-         SPEEX_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SPEEX_LIB=""
-         fi
-         PBX_SPEEX=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_SPEEX 1
-_ACEOF
+       PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
 
-      fi
-   fi
-fi
+       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; }
 
+          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
 
-# See if the main speex library contains the preprocess functions
 
-if test "x${PBX_SPEEX_PREPROCESS}" != "x1" -a "${USE_SPEEX_PREPROCESS}" != "no"; then
-   pbxlibdir=""
-   # 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${SPEEX_PREPROCESS_DIR}"
-      fi
-   fi
-   pbxfuncname="speex_preprocess_ctl"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SPEEX_PREPROCESS_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+          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} ();
+#include "ptlib.h"
+               #include "h323.h"
+               #include "h323ep.h"
 int
 main ()
 {
-return ${pbxfuncname} ();
+H323EndPoint ep = H323EndPoint();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+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
-  eval "$as_ac_Lib=no"
+       { $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
-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; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
-  AST_SPEEX_PREPROCESS_FOUND=yes
-else
-  AST_SPEEX_PREPROCESS_FOUND=no
-fi
 
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   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
 
-   # now check for the header.
-   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
-      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} ${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" = x""yes; then :
-  SPEEX_PREPROCESS_HEADER_FOUND=1
-else
-  SPEEX_PREPROCESS_HEADER_FOUND=0
-fi
 
+          LIBS="${saved_libs}"
+          CPPFLAGS="${saved_cppflags}"
 
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      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
-            SPEEX_PREPROCESS_LIB=""
-         fi
-         PBX_SPEEX_PREPROCESS=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_SPEEX_PREPROCESS 1
-_ACEOF
+          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
 
-      fi
-   fi
-fi
+$as_echo "#define HAVE_OPENH323 1" >>confdefs.h
 
+          fi
+       fi
 
-if test "${PBX_SPEEX_PREPROCESS}" = 1; then
-   PBX_SPEEX_PREPROCESS=1
 fi
 
 
-if test "x${PBX_SPEEXDSP}" != "x1" -a "${USE_SPEEXDSP}" != "no"; then
+if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
    pbxlibdir=""
-   # 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"
+   # 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${SPEEXDSP_DIR}"
+        pbxlibdir="-L${LUA_DIR}"
       fi
    fi
-   pbxfuncname="speex_preprocess_ctl"
+   pbxfuncname="luaL_newstate"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SPEEXDSP_FOUND=yes
+      AST_LUA_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      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; }
+      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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lspeexdsp ${pbxlibdir} -lm $LIBS"
+LIBS="-llua5.1 ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24227,85 +24625,88 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_SPEEXDSP_FOUND=yes
+  AST_LUA_FOUND=yes
 else
-  AST_SPEEXDSP_FOUND=no
+  AST_LUA_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   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"
+   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
-      SPEEXDSP_INCLUDE="${SPEEXDSP_INCLUDE} "
-      if test "xspeex/speex.h" = "x" ; then    # no header, assume found
-         SPEEXDSP_HEADER_FOUND="1"
+      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} ${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" = x""yes; then :
-  SPEEXDSP_HEADER_FOUND=1
+         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" = x""yes; then :
+  LUA_HEADER_FOUND=1
 else
-  SPEEXDSP_HEADER_FOUND=0
+  LUA_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${SPEEXDSP_HEADER_FOUND}" = "x0" ; then
-         SPEEXDSP_LIB=""
-         SPEEXDSP_INCLUDE=""
+      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
+         LUA_LIB=""
+         LUA_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SPEEXDSP_LIB=""
+            LUA_LIB=""
          fi
-         PBX_SPEEXDSP=1
+         PBX_LUA=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_SPEEXDSP 1
+#define HAVE_LUA 1
 _ACEOF
 
-      fi
-   fi
-fi
-
-
-if test "${PBX_SPEEXDSP}" = 1; then
-   PBX_SPEEX_PREPROCESS=1
+      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_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then
+if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
    pbxlibdir=""
-   # 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"
+   # 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${SQLITE_DIR}"
+        pbxlibdir="-L${LUA_DIR}"
       fi
    fi
-   pbxfuncname="sqlite_exec"
+   pbxfuncname="luaL_register"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SQLITE_FOUND=yes
+      AST_LUA_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_sqlite_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lsqlite... " >&6; }
+      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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsqlite ${pbxlibdir}  $LIBS"
+LIBS="-llua ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24338,47 +24739,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_SQLITE_FOUND=yes
+  AST_LUA_FOUND=yes
 else
-  AST_SQLITE_FOUND=no
+  AST_LUA_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_SQLITE_FOUND}" = "yes"; then
-      SQLITE_LIB="${pbxlibdir} -lsqlite "
-      # if --with-SQLITE=DIR has been specified, use it.
-      if test "x${SQLITE_DIR}" != "x"; then
-         SQLITE_INCLUDE="-I${SQLITE_DIR}/include"
+   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
-      SQLITE_INCLUDE="${SQLITE_INCLUDE} "
-      if test "xsqlite.h" = "x" ; then # no header, assume found
-         SQLITE_HEADER_FOUND="1"
+      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} ${SQLITE_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "sqlite.h" "ac_cv_header_sqlite_h" "$ac_includes_default"
-if test "x$ac_cv_header_sqlite_h" = x""yes; then :
-  SQLITE_HEADER_FOUND=1
+         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" = x""yes; then :
+  LUA_HEADER_FOUND=1
 else
-  SQLITE_HEADER_FOUND=0
+  LUA_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${SQLITE_HEADER_FOUND}" = "x0" ; then
-         SQLITE_LIB=""
-         SQLITE_INCLUDE=""
+      if test "x${LUA_HEADER_FOUND}" = "x0" ; then
+         LUA_LIB=""
+         LUA_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SQLITE_LIB=""
+            LUA_LIB=""
          fi
-         PBX_SQLITE=1
+         PBX_LUA=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_SQLITE 1
+#define HAVE_LUA 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_SQLITE3}" != "x1" -a "${USE_SQLITE3}" != "no"; then
+if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
    pbxlibdir=""
-   # if --with-SQLITE3=DIR has been specified, use it.
-   if test "x${SQLITE3_DIR}" != "x"; then
-      if test -d ${SQLITE3_DIR}/lib; then
-        pbxlibdir="-L${SQLITE3_DIR}/lib"
+   # 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${SQLITE3_DIR}"
+        pbxlibdir="-L${RADIUS_DIR}"
       fi
    fi
-   pbxfuncname="sqlite3_open"
+   pbxfuncname="rc_read_config"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_SQLITE3_FOUND=yes
+      AST_RADIUS_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_sqlite3_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite3" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lsqlite3... " >&6; }
+      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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsqlite3 ${pbxlibdir}  $LIBS"
+LIBS="-lradiusclient-ng ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24444,47 +24845,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_SQLITE3_FOUND=yes
+  AST_RADIUS_FOUND=yes
 else
-  AST_SQLITE3_FOUND=no
+  AST_RADIUS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_SQLITE3_FOUND}" = "yes"; then
-      SQLITE3_LIB="${pbxlibdir} -lsqlite3 "
-      # if --with-SQLITE3=DIR has been specified, use it.
-      if test "x${SQLITE3_DIR}" != "x"; then
-         SQLITE3_INCLUDE="-I${SQLITE3_DIR}/include"
+   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
-      SQLITE3_INCLUDE="${SQLITE3_INCLUDE} "
-      if test "xsqlite3.h" = "x" ; then        # no header, assume found
-         SQLITE3_HEADER_FOUND="1"
+      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} ${SQLITE3_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
-if test "x$ac_cv_header_sqlite3_h" = x""yes; then :
-  SQLITE3_HEADER_FOUND=1
+         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" = x""yes; then :
+  RADIUS_HEADER_FOUND=1
 else
-  SQLITE3_HEADER_FOUND=0
+  RADIUS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${SQLITE3_HEADER_FOUND}" = "x0" ; then
-         SQLITE3_LIB=""
-         SQLITE3_INCLUDE=""
+      if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then
+         RADIUS_LIB=""
+         RADIUS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            SQLITE3_LIB=""
+            RADIUS_LIB=""
          fi
-         PBX_SQLITE3=1
+         PBX_RADIUS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_SQLITE3 1
+#define HAVE_RADIUS 1
 _ACEOF
 
       fi
 
 
 
+# This is a bit complex... in reality, Asterisk's AIS support is dependent on finding
+# *any* implementation of AIS, not just OpenAIS. However, the configure script needs
+# to know the specifics of each possible implementation, and then represent the one
+# that was found as 'AIS'.
+
+PBX_AIS=0
+
+# OpenAIS installs its libraries into /usr/lib/openais by default, so check there
+
 
-if test "x${PBX_CRYPTO}" != "x1" -a "${USE_CRYPTO}" != "no"; then
+if test "x${PBX_OPENAIS}" != "x1" -a "${USE_OPENAIS}" != "no"; then
    pbxlibdir=""
-   # if --with-CRYPTO=DIR has been specified, use it.
-   if test "x${CRYPTO_DIR}" != "x"; then
-      if test -d ${CRYPTO_DIR}/lib; then
-        pbxlibdir="-L${CRYPTO_DIR}/lib"
+   # if --with-OPENAIS=DIR has been specified, use it.
+   if test "x${OPENAIS_DIR}" != "x"; then
+      if test -d ${OPENAIS_DIR}/lib; then
+        pbxlibdir="-L${OPENAIS_DIR}/lib"
       else
-        pbxlibdir="-L${CRYPTO_DIR}"
+        pbxlibdir="-L${OPENAIS_DIR}"
       fi
    fi
-   pbxfuncname="AES_encrypt"
+   pbxfuncname="saClmInitialize"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_CRYPTO_FOUND=yes
+      AST_OPENAIS_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_crypto_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcrypto" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lcrypto... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_SaClm_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lSaClm" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lSaClm... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto ${pbxlibdir}  $LIBS"
+LIBS="-lSaClm ${pbxlibdir} -L/usr/lib/openais -L/usr/lib64/openais $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24550,47 +24960,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_CRYPTO_FOUND=yes
+  AST_OPENAIS_FOUND=yes
 else
-  AST_CRYPTO_FOUND=no
+  AST_OPENAIS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_CRYPTO_FOUND}" = "yes"; then
-      CRYPTO_LIB="${pbxlibdir} -lcrypto "
-      # if --with-CRYPTO=DIR has been specified, use it.
-      if test "x${CRYPTO_DIR}" != "x"; then
-         CRYPTO_INCLUDE="-I${CRYPTO_DIR}/include"
+   if test "${AST_OPENAIS_FOUND}" = "yes"; then
+      OPENAIS_LIB="${pbxlibdir} -lSaClm -L/usr/lib/openais -L/usr/lib64/openais"
+      # if --with-OPENAIS=DIR has been specified, use it.
+      if test "x${OPENAIS_DIR}" != "x"; then
+         OPENAIS_INCLUDE="-I${OPENAIS_DIR}/include"
       fi
-      CRYPTO_INCLUDE="${CRYPTO_INCLUDE} "
-      if test "xopenssl/aes.h" = "x" ; then    # no header, assume found
-         CRYPTO_HEADER_FOUND="1"
+      OPENAIS_INCLUDE="${OPENAIS_INCLUDE} "
+      if test "xopenais/saClm.h" = "x" ; then  # no header, assume found
+         OPENAIS_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${CRYPTO_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "openssl/aes.h" "ac_cv_header_openssl_aes_h" "$ac_includes_default"
-if test "x$ac_cv_header_openssl_aes_h" = x""yes; then :
-  CRYPTO_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${OPENAIS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openais/saClm.h" "ac_cv_header_openais_saClm_h" "$ac_includes_default"
+if test "x$ac_cv_header_openais_saClm_h" = x""yes; then :
+  OPENAIS_HEADER_FOUND=1
 else
-  CRYPTO_HEADER_FOUND=0
+  OPENAIS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${CRYPTO_HEADER_FOUND}" = "x0" ; then
-         CRYPTO_LIB=""
-         CRYPTO_INCLUDE=""
+      if test "x${OPENAIS_HEADER_FOUND}" = "x0" ; then
+         OPENAIS_LIB=""
+         OPENAIS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            CRYPTO_LIB=""
+            OPENAIS_LIB=""
          fi
-         PBX_CRYPTO=1
+         PBX_OPENAIS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_CRYPTO 1
+#define HAVE_OPENAIS 1
 _ACEOF
 
       fi
 
 
 
-if test "$PBX_CRYPTO" = "1";
-then
+if test "${PBX_OPENAIS}" = 1; then
+   PBX_AIS=1
+   if test -n "${OPENAIS_DIR}"; then
+      AIS_INCLUDE="${OPENAIS_INCLUDE}/openais"
+      AIS_LIB="-lSaEvt ${OPENAIS_LIB}"
+   else
+      AIS_INCLUDE="-I/usr/include/openais"
+      AIS_LIB="-lSaClm -lSaEvt -L/usr/lib/openais -L/usr/lib64/openais"
+   fi
+fi
 
-if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "no"; then
+
+
+
+
+
+if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
    pbxlibdir=""
-   # if --with-OPENSSL=DIR has been specified, use it.
-   if test "x${OPENSSL_DIR}" != "x"; then
-      if test -d ${OPENSSL_DIR}/lib; then
-        pbxlibdir="-L${OPENSSL_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${OPENSSL_DIR}"
+        pbxlibdir="-L${SPEEX_DIR}"
       fi
    fi
-   pbxfuncname="ssl2_connect"
+   pbxfuncname="speex_encode"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_OPENSSL_FOUND=yes
+      AST_SPEEX_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_ssl_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lssl" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lssl... " >&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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssl ${pbxlibdir} -lcrypto $LIBS"
+LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24658,47 +25081,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_OPENSSL_FOUND=yes
+  AST_SPEEX_FOUND=yes
 else
-  AST_OPENSSL_FOUND=no
+  AST_SPEEX_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_OPENSSL_FOUND}" = "yes"; then
-      OPENSSL_LIB="${pbxlibdir} -lssl -lcrypto"
-      # if --with-OPENSSL=DIR has been specified, use it.
-      if test "x${OPENSSL_DIR}" != "x"; then
-         OPENSSL_INCLUDE="-I${OPENSSL_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
-      OPENSSL_INCLUDE="${OPENSSL_INCLUDE} "
-      if test "xopenssl/ssl.h" = "x" ; then    # no header, assume found
-         OPENSSL_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} ${OPENSSL_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
-if test "x$ac_cv_header_openssl_ssl_h" = x""yes; then :
-  OPENSSL_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" = x""yes; then :
+  SPEEX_HEADER_FOUND=1
 else
-  OPENSSL_HEADER_FOUND=0
+  SPEEX_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${OPENSSL_HEADER_FOUND}" = "x0" ; then
-         OPENSSL_LIB=""
-         OPENSSL_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
-            OPENSSL_LIB=""
+            SPEEX_LIB=""
          fi
-         PBX_OPENSSL=1
+         PBX_SPEEX=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_OPENSSL 1
+#define HAVE_SPEEX 1
 _ACEOF
 
       fi
@@ -24706,46 +25129,33 @@ _ACEOF
 fi
 
 
-fi
-
-if test "$PBX_OPENSSL" = "1";
-then
-
-       # if OSPTK has not been checked and is not excluded
-       if test "x${PBX_OSPTK}" != "x1" -a "${USE_OSPTK}" != "no"; then
-               # if --with-osptk=DIR has been specified, use it.
-               if test "x${OSPTK_DIR}" != "x"; then
-                       osptk_cflags="-I${OSPTK_DIR}/include"
-                       osptk_ldflags="-L${OSPTK_DIR}/lib"
-               else
-                       osptk_cflags=""
-                       osptk_ldflags=""
-               fi
-
-               # check for the header
-               osptk_saved_cppflags="${CPPFLAGS}"
-               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
-               ac_fn_c_check_header_mongrel "$LINENO" "osp/osp.h" "ac_cv_header_osp_osp_h" "$ac_includes_default"
-if test "x$ac_cv_header_osp_osp_h" = x""yes; then :
-  osptk_header_found=yes
-else
-  osptk_header_found=no
-fi
-
-
-               CPPFLAGS="${osptk_saved_cppflags}"
 
-               # check for the library
-               if test "${osptk_header_found}" = "yes"; then
-                       osptk_extralibs="-lssl -lcrypto"
+# See if the main speex library contains the preprocess functions
 
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSPPInit in -losptk" >&5
-$as_echo_n "checking for OSPPInit in -losptk... " >&6; }
-if test "${ac_cv_lib_osptk_OSPPInit+set}" = set; then :
+if test "x${PBX_SPEEX_PREPROCESS}" != "x1" -a "${USE_SPEEX_PREPROCESS}" != "no"; then
+   pbxlibdir=""
+   # 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${SPEEX_PREPROCESS_DIR}"
+      fi
+   fi
+   pbxfuncname="speex_preprocess_ctl"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SPEEX_PREPROCESS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-losptk ${osptk_ldflags} ${osptk_extralibs} $LIBS"
+LIBS="-lspeex ${pbxlibdir} -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -24753,260 +25163,219 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    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 OSPPInit ();
-int
-main ()
-{
-return OSPPInit ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_osptk_OSPPInit=yes
-else
-  ac_cv_lib_osptk_OSPPInit=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_osptk_OSPPInit" >&5
-$as_echo "$ac_cv_lib_osptk_OSPPInit" >&6; }
-if test "x$ac_cv_lib_osptk_OSPPInit" = x""yes; then :
-  osptk_library_found=yes
-else
-  osptk_library_found=no
-fi
-
-
-                       # check OSP Toolkit version
-                       if test "${osptk_library_found}" = "yes"; then
-                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OSP Toolkit version is compatible with app_osplookup" >&5
-$as_echo_n "checking if OSP Toolkit version is compatible with app_osplookup... " >&6; }
-
-                               osptk_saved_cppflags="${CPPFLAGS}"
-                               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
-                               if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run test program while cross compiling
-See \`config.log' for more details." "$LINENO" 5; }
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-                                               #include <osp/osp.h>
-                                               int main(void) {
-                                                       int ver = OSP_CLIENT_TOOLKIT_VERSION_MAJOR * 10000 + OSP_CLIENT_TOOLKIT_VERSION_MINOR * 100 + OSP_CLIENT_TOOLKIT_VERSION_BUGFIX;
-                                                       int req = 3 * 10000 + 6 * 100 + 0;
-                                                       return (ver < req) ? 1 : 0;
-                                               }
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  osptk_compatible=yes
-else
-  osptk_compatible=no
-
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-                               CPPFLAGS="${osptk_saved_cppflags}"
-
-                               if test "${osptk_compatible}" = "yes"; then
-                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-                                       PBX_OSPTK=1
-                                       OSPTK_INCLUDE="${osptk_cflags}"
-                                       OSPTK_LIB="${osptk_ldflags} -losptk ${osptk_extralibs}"
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OSPTK 1
-_ACEOF
-
-                               else
-                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                               fi
-                       fi
-               fi
-       fi
-
-fi
-
-
-    if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
-       PBX_GMIME=0
-       if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gmime-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gmime-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 test "${ac_cv_prog_CONFIG_GMIME+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CONFIG_GMIME"; then
-  ac_cv_prog_CONFIG_GMIME="$CONFIG_GMIME" # Let the user override the test.
-else
-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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CONFIG_GMIME="${ac_tool_prefix}gmime-config"
-    $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
-
-fi
-fi
-CONFIG_GMIME=$ac_cv_prog_CONFIG_GMIME
-if test -n "$CONFIG_GMIME"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_GMIME" >&5
-$as_echo "$CONFIG_GMIME" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CONFIG_GMIME"; then
-  ac_ct_CONFIG_GMIME=$CONFIG_GMIME
-  # Extract the first word of "gmime-config", so it can be a program name with args.
-set dummy gmime-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 test "${ac_cv_prog_ac_ct_CONFIG_GMIME+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CONFIG_GMIME"; then
-  ac_cv_prog_ac_ct_CONFIG_GMIME="$ac_ct_CONFIG_GMIME" # Let the user override the test.
-else
-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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CONFIG_GMIME="gmime-config"
-    $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
-
+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
-ac_ct_CONFIG_GMIME=$ac_cv_prog_ac_ct_CONFIG_GMIME
-if test -n "$ac_ct_CONFIG_GMIME"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CONFIG_GMIME" >&5
-$as_echo "$ac_ct_CONFIG_GMIME" >&6; }
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_ac_Lib
+   if test "x$as_val" = x""yes; then :
+  AST_SPEEX_PREPROCESS_FOUND=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  AST_SPEEX_PREPROCESS_FOUND=no
 fi
 
-  if test "x$ac_ct_CONFIG_GMIME" = x; then
-    CONFIG_GMIME="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CONFIG_GMIME=$ac_ct_CONFIG_GMIME
-  fi
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   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
+      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} ${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" = x""yes; then :
+  SPEEX_PREPROCESS_HEADER_FOUND=1
 else
-  CONFIG_GMIME="$ac_cv_prog_CONFIG_GMIME"
+  SPEEX_PREPROCESS_HEADER_FOUND=0
 fi
 
-       if test ! "x${CONFIG_GMIME}" = xNo; then
-           if test x"" = x ; then A=--cflags ; else A="" ; fi
-           GMIME_INCLUDE=$(${CONFIG_GMIME} $A)
-           if test x"" = x ; then A=--libs ; else A="" ; fi
-           GMIME_LIB=$(${CONFIG_GMIME} $A)
-           if test x"#include <gmime/gmime.h>" != x ; then
-               saved_cppflags="${CPPFLAGS}"
-               if test "x${GMIME_DIR}" != "x"; then
-                   GMIME_INCLUDE="-I${GMIME_DIR}/include"
-               fi
-               CPPFLAGS="${CPPFLAGS} ${GMIME_INCLUDE}"
 
-               saved_libs="${LIBS}"
-               LIBS="${GMIME_LIB}"
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      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
+            SPEEX_PREPROCESS_LIB=""
+         fi
+         PBX_SPEEX_PREPROCESS=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SPEEX_PREPROCESS 1
+_ACEOF
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+      fi
+   fi
+fi
+
+
+if test "${PBX_SPEEX_PREPROCESS}" = 1; then
+   PBX_SPEEX_PREPROCESS=1
+fi
+
+
+if test "x${PBX_SPEEXDSP}" != "x1" -a "${USE_SPEEXDSP}" != "no"; then
+   pbxlibdir=""
+   # 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${SPEEXDSP_DIR}"
+      fi
+   fi
+   pbxfuncname="speex_preprocess_ctl"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_SPEEXDSP_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      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 { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lspeexdsp ${pbxlibdir} -lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-  #include <gmime/gmime.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 ()
 {
- gboolean q = g_mime_check_version(0,0,0);;
-
+return ${pbxfuncname} ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-     PBX_GMIME=1
+  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; }
+eval as_val=\$$as_ac_Lib
+   if test "x$as_val" = x""yes; then :
+  AST_SPEEXDSP_FOUND=yes
+else
+  AST_SPEEXDSP_FOUND=no
+fi
 
-$as_echo "#define HAVE_GMIME 1" >>confdefs.h
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   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
+      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} ${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" = x""yes; then :
+  SPEEXDSP_HEADER_FOUND=1
+else
+  SPEEXDSP_HEADER_FOUND=0
+fi
 
 
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${SPEEXDSP_HEADER_FOUND}" = "x0" ; then
+         SPEEXDSP_LIB=""
+         SPEEXDSP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            SPEEXDSP_LIB=""
+         fi
+         PBX_SPEEXDSP=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_SPEEXDSP 1
+_ACEOF
+
+      fi
+   fi
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-               CPPFLAGS="${saved_cppflags}"
-               LIBS="${saved_libs}"
-           else
-               PBX_GMIME=1
 
-$as_echo "#define HAVE_GMIME 1" >>confdefs.h
 
-           fi
-       fi
-    fi
+if test "${PBX_SPEEXDSP}" = 1; then
+   PBX_SPEEX_PREPROCESS=1
+fi
 
 
 
-if test "x${PBX_HOARD}" != "x1" -a "${USE_HOARD}" != "no"; then
+
+if test "x${PBX_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then
    pbxlibdir=""
-   # if --with-HOARD=DIR has been specified, use it.
-   if test "x${HOARD_DIR}" != "x"; then
-      if test -d ${HOARD_DIR}/lib; then
-        pbxlibdir="-L${HOARD_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${HOARD_DIR}"
+        pbxlibdir="-L${SQLITE_DIR}"
       fi
    fi
-   pbxfuncname="malloc"
+   pbxfuncname="sqlite_exec"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_HOARD_FOUND=yes
+      AST_SQLITE_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_hoard_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lhoard" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lhoard... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_sqlite_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lsqlite... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lhoard ${pbxlibdir}  $LIBS"
+LIBS="-lsqlite ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25039,47 +25408,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_HOARD_FOUND=yes
+  AST_SQLITE_FOUND=yes
 else
-  AST_HOARD_FOUND=no
+  AST_SQLITE_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_HOARD_FOUND}" = "yes"; then
-      HOARD_LIB="${pbxlibdir} -lhoard "
-      # if --with-HOARD=DIR has been specified, use it.
-      if test "x${HOARD_DIR}" != "x"; then
-         HOARD_INCLUDE="-I${HOARD_DIR}/include"
+   if test "${AST_SQLITE_FOUND}" = "yes"; then
+      SQLITE_LIB="${pbxlibdir} -lsqlite "
+      # if --with-SQLITE=DIR has been specified, use it.
+      if test "x${SQLITE_DIR}" != "x"; then
+         SQLITE_INCLUDE="-I${SQLITE_DIR}/include"
       fi
-      HOARD_INCLUDE="${HOARD_INCLUDE} "
-      if test "x" = "x" ; then # no header, assume found
-         HOARD_HEADER_FOUND="1"
+      SQLITE_INCLUDE="${SQLITE_INCLUDE} "
+      if test "xsqlite.h" = "x" ; then # no header, assume found
+         SQLITE_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${HOARD_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
-  HOARD_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${SQLITE_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "sqlite.h" "ac_cv_header_sqlite_h" "$ac_includes_default"
+if test "x$ac_cv_header_sqlite_h" = x""yes; then :
+  SQLITE_HEADER_FOUND=1
 else
-  HOARD_HEADER_FOUND=0
+  SQLITE_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${HOARD_HEADER_FOUND}" = "x0" ; then
-         HOARD_LIB=""
-         HOARD_INCLUDE=""
+      if test "x${SQLITE_HEADER_FOUND}" = "x0" ; then
+         SQLITE_LIB=""
+         SQLITE_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            HOARD_LIB=""
+            SQLITE_LIB=""
          fi
-         PBX_HOARD=1
+         PBX_SQLITE=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_HOARD 1
+#define HAVE_SQLITE 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
+if test "x${PBX_SQLITE3}" != "x1" -a "${USE_SQLITE3}" != "no"; then
    pbxlibdir=""
-   # if --with-FREETDS=DIR has been specified, use it.
-   if test "x${FREETDS_DIR}" != "x"; then
-      if test -d ${FREETDS_DIR}/lib; then
-        pbxlibdir="-L${FREETDS_DIR}/lib"
+   # if --with-SQLITE3=DIR has been specified, use it.
+   if test "x${SQLITE3_DIR}" != "x"; then
+      if test -d ${SQLITE3_DIR}/lib; then
+        pbxlibdir="-L${SQLITE3_DIR}/lib"
       else
-        pbxlibdir="-L${FREETDS_DIR}"
+        pbxlibdir="-L${SQLITE3_DIR}"
       fi
    fi
-   pbxfuncname="dbinit"
+   pbxfuncname="sqlite3_open"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_FREETDS_FOUND=yes
+      AST_SQLITE3_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_sybdb_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsybdb" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lsybdb... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_sqlite3_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite3" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lsqlite3... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsybdb ${pbxlibdir}  $LIBS"
+LIBS="-lsqlite3 ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25145,47 +25514,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_FREETDS_FOUND=yes
+  AST_SQLITE3_FOUND=yes
 else
-  AST_FREETDS_FOUND=no
+  AST_SQLITE3_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_FREETDS_FOUND}" = "yes"; then
-      FREETDS_LIB="${pbxlibdir} -lsybdb "
-      # if --with-FREETDS=DIR has been specified, use it.
-      if test "x${FREETDS_DIR}" != "x"; then
-         FREETDS_INCLUDE="-I${FREETDS_DIR}/include"
+   if test "${AST_SQLITE3_FOUND}" = "yes"; then
+      SQLITE3_LIB="${pbxlibdir} -lsqlite3 "
+      # if --with-SQLITE3=DIR has been specified, use it.
+      if test "x${SQLITE3_DIR}" != "x"; then
+         SQLITE3_INCLUDE="-I${SQLITE3_DIR}/include"
       fi
-      FREETDS_INCLUDE="${FREETDS_INCLUDE} "
-      if test "xsybdb.h" = "x" ; then  # no header, assume found
-         FREETDS_HEADER_FOUND="1"
+      SQLITE3_INCLUDE="${SQLITE3_INCLUDE} "
+      if test "xsqlite3.h" = "x" ; then        # no header, assume found
+         SQLITE3_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${FREETDS_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "sybdb.h" "ac_cv_header_sybdb_h" "$ac_includes_default"
-if test "x$ac_cv_header_sybdb_h" = x""yes; then :
-  FREETDS_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${SQLITE3_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
+if test "x$ac_cv_header_sqlite3_h" = x""yes; then :
+  SQLITE3_HEADER_FOUND=1
 else
-  FREETDS_HEADER_FOUND=0
+  SQLITE3_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${FREETDS_HEADER_FOUND}" = "x0" ; then
-         FREETDS_LIB=""
-         FREETDS_INCLUDE=""
+      if test "x${SQLITE3_HEADER_FOUND}" = "x0" ; then
+         SQLITE3_LIB=""
+         SQLITE3_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            FREETDS_LIB=""
+            SQLITE3_LIB=""
          fi
-         PBX_FREETDS=1
+         PBX_SQLITE3=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_FREETDS 1
+#define HAVE_SQLITE3 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_TERMCAP}" != "x1" -a "${USE_TERMCAP}" != "no"; then
+if test "x${PBX_CRYPTO}" != "x1" -a "${USE_CRYPTO}" != "no"; then
    pbxlibdir=""
-   # if --with-TERMCAP=DIR has been specified, use it.
-   if test "x${TERMCAP_DIR}" != "x"; then
-      if test -d ${TERMCAP_DIR}/lib; then
-        pbxlibdir="-L${TERMCAP_DIR}/lib"
+   # if --with-CRYPTO=DIR has been specified, use it.
+   if test "x${CRYPTO_DIR}" != "x"; then
+      if test -d ${CRYPTO_DIR}/lib; then
+        pbxlibdir="-L${CRYPTO_DIR}/lib"
       else
-        pbxlibdir="-L${TERMCAP_DIR}"
+        pbxlibdir="-L${CRYPTO_DIR}"
       fi
    fi
-   pbxfuncname="tgetent"
+   pbxfuncname="AES_encrypt"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TERMCAP_FOUND=yes
+      AST_CRYPTO_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_termcap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltermcap" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltermcap... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_crypto_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcrypto" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcrypto... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltermcap ${pbxlibdir}  $LIBS"
+LIBS="-lcrypto ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25251,47 +25620,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_TERMCAP_FOUND=yes
+  AST_CRYPTO_FOUND=yes
 else
-  AST_TERMCAP_FOUND=no
+  AST_CRYPTO_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_TERMCAP_FOUND}" = "yes"; then
-      TERMCAP_LIB="${pbxlibdir} -ltermcap "
-      # if --with-TERMCAP=DIR has been specified, use it.
-      if test "x${TERMCAP_DIR}" != "x"; then
-         TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
+   if test "${AST_CRYPTO_FOUND}" = "yes"; then
+      CRYPTO_LIB="${pbxlibdir} -lcrypto "
+      # if --with-CRYPTO=DIR has been specified, use it.
+      if test "x${CRYPTO_DIR}" != "x"; then
+         CRYPTO_INCLUDE="-I${CRYPTO_DIR}/include"
       fi
-      TERMCAP_INCLUDE="${TERMCAP_INCLUDE} "
-      if test "x" = "x" ; then # no header, assume found
-         TERMCAP_HEADER_FOUND="1"
+      CRYPTO_INCLUDE="${CRYPTO_INCLUDE} "
+      if test "xopenssl/aes.h" = "x" ; then    # no header, assume found
+         CRYPTO_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
-  TERMCAP_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${CRYPTO_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openssl/aes.h" "ac_cv_header_openssl_aes_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_aes_h" = x""yes; then :
+  CRYPTO_HEADER_FOUND=1
 else
-  TERMCAP_HEADER_FOUND=0
+  CRYPTO_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
-         TERMCAP_LIB=""
-         TERMCAP_INCLUDE=""
+      if test "x${CRYPTO_HEADER_FOUND}" = "x0" ; then
+         CRYPTO_LIB=""
+         CRYPTO_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            TERMCAP_LIB=""
+            CRYPTO_LIB=""
          fi
-         PBX_TERMCAP=1
+         PBX_CRYPTO=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_TERMCAP 1
+#define HAVE_CRYPTO 1
 _ACEOF
 
       fi
 
 
 
+if test "$PBX_CRYPTO" = "1";
+then
 
-if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
+if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "no"; then
    pbxlibdir=""
-   # if --with-TINFO=DIR has been specified, use it.
-   if test "x${TINFO_DIR}" != "x"; then
-      if test -d ${TINFO_DIR}/lib; then
-        pbxlibdir="-L${TINFO_DIR}/lib"
+   # if --with-OPENSSL=DIR has been specified, use it.
+   if test "x${OPENSSL_DIR}" != "x"; then
+      if test -d ${OPENSSL_DIR}/lib; then
+        pbxlibdir="-L${OPENSSL_DIR}/lib"
       else
-        pbxlibdir="-L${TINFO_DIR}"
+        pbxlibdir="-L${OPENSSL_DIR}"
       fi
    fi
-   pbxfuncname="tgetent"
+   pbxfuncname="ssl2_connect"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TINFO_FOUND=yes
+      AST_OPENSSL_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_tinfo_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltinfo" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltinfo... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_ssl_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lssl" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lssl... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltinfo ${pbxlibdir}  $LIBS"
+LIBS="-lssl ${pbxlibdir} -lcrypto $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25357,47 +25728,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_TINFO_FOUND=yes
+  AST_OPENSSL_FOUND=yes
 else
-  AST_TINFO_FOUND=no
+  AST_OPENSSL_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_TINFO_FOUND}" = "yes"; then
-      TINFO_LIB="${pbxlibdir} -ltinfo "
-      # if --with-TINFO=DIR has been specified, use it.
-      if test "x${TINFO_DIR}" != "x"; then
-         TINFO_INCLUDE="-I${TINFO_DIR}/include"
+   if test "${AST_OPENSSL_FOUND}" = "yes"; then
+      OPENSSL_LIB="${pbxlibdir} -lssl -lcrypto"
+      # if --with-OPENSSL=DIR has been specified, use it.
+      if test "x${OPENSSL_DIR}" != "x"; then
+         OPENSSL_INCLUDE="-I${OPENSSL_DIR}/include"
       fi
-      TINFO_INCLUDE="${TINFO_INCLUDE} "
-      if test "x" = "x" ; then # no header, assume found
-         TINFO_HEADER_FOUND="1"
+      OPENSSL_INCLUDE="${OPENSSL_INCLUDE} "
+      if test "xopenssl/ssl.h" = "x" ; then    # no header, assume found
+         OPENSSL_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
-  TINFO_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${OPENSSL_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ssl_h" = x""yes; then :
+  OPENSSL_HEADER_FOUND=1
 else
-  TINFO_HEADER_FOUND=0
+  OPENSSL_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
-         TINFO_LIB=""
-         TINFO_INCLUDE=""
+      if test "x${OPENSSL_HEADER_FOUND}" = "x0" ; then
+         OPENSSL_LIB=""
+         OPENSSL_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            TINFO_LIB=""
+            OPENSSL_LIB=""
          fi
-         PBX_TINFO=1
+         PBX_OPENSSL=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_TINFO 1
+#define HAVE_OPENSSL 1
 _ACEOF
 
       fi
@@ -25405,14 +25776,46 @@ _ACEOF
 fi
 
 
+fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tone_zone_find_by_num in -ltonezone" >&5
-$as_echo_n "checking for tone_zone_find_by_num in -ltonezone... " >&6; }
-if test "${ac_cv_lib_tonezone_tone_zone_find_by_num+set}" = set; then :
+if test "$PBX_OPENSSL" = "1";
+then
+
+       # if OSPTK has not been checked and is not excluded
+       if test "x${PBX_OSPTK}" != "x1" -a "${USE_OSPTK}" != "no"; then
+               # if --with-osptk=DIR has been specified, use it.
+               if test "x${OSPTK_DIR}" != "x"; then
+                       osptk_cflags="-I${OSPTK_DIR}/include"
+                       osptk_ldflags="-L${OSPTK_DIR}/lib"
+               else
+                       osptk_cflags=""
+                       osptk_ldflags=""
+               fi
+
+               # check for the header
+               osptk_saved_cppflags="${CPPFLAGS}"
+               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
+               ac_fn_c_check_header_mongrel "$LINENO" "osp/osp.h" "ac_cv_header_osp_osp_h" "$ac_includes_default"
+if test "x$ac_cv_header_osp_osp_h" = x""yes; then :
+  osptk_header_found=yes
+else
+  osptk_header_found=no
+fi
+
+
+               CPPFLAGS="${osptk_saved_cppflags}"
+
+               # check for the library
+               if test "${osptk_header_found}" = "yes"; then
+                       osptk_extralibs="-lssl -lcrypto"
+
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSPPInit in -losptk" >&5
+$as_echo_n "checking for OSPPInit in -losptk... " >&6; }
+if test "${ac_cv_lib_osptk_OSPPInit+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltonezone  $LIBS"
+LIBS="-losptk ${osptk_ldflags} ${osptk_extralibs} $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25422,62 +25825,115 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char tone_zone_find_by_num ();
+char OSPPInit ();
 int
 main ()
 {
-return tone_zone_find_by_num ();
+return OSPPInit ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_tonezone_tone_zone_find_by_num=yes
+  ac_cv_lib_osptk_OSPPInit=yes
 else
-  ac_cv_lib_tonezone_tone_zone_find_by_num=no
+  ac_cv_lib_osptk_OSPPInit=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tonezone_tone_zone_find_by_num" >&5
-$as_echo "$ac_cv_lib_tonezone_tone_zone_find_by_num" >&6; }
-if test "x$ac_cv_lib_tonezone_tone_zone_find_by_num" = x""yes; then :
-  tonezone_does_not_need_lm=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_osptk_OSPPInit" >&5
+$as_echo "$ac_cv_lib_osptk_OSPPInit" >&6; }
+if test "x$ac_cv_lib_osptk_OSPPInit" = x""yes; then :
+  osptk_library_found=yes
 else
-  tonezone_does_not_need_lm=no
+  osptk_library_found=no
 fi
 
 
-if test "${tonezone_does_not_need_lm}" = "no" ; then
-  tonezone_extra="-lm"
+                       # check OSP Toolkit version
+                       if test "${osptk_library_found}" = "yes"; then
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OSP Toolkit version is compatible with app_osplookup" >&5
+$as_echo_n "checking if OSP Toolkit version is compatible with app_osplookup... " >&6; }
+
+                               osptk_saved_cppflags="${CPPFLAGS}"
+                               CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
+                               if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                                               #include <osp/osp.h>
+                                               int main(void) {
+                                                       int ver = OSP_CLIENT_TOOLKIT_VERSION_MAJOR * 10000 + OSP_CLIENT_TOOLKIT_VERSION_MINOR * 100 + OSP_CLIENT_TOOLKIT_VERSION_BUGFIX;
+                                                       int req = 3 * 10000 + 6 * 100 + 0;
+                                                       return (ver < req) ? 1 : 0;
+                                               }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  osptk_compatible=yes
+else
+  osptk_compatible=no
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+                               CPPFLAGS="${osptk_saved_cppflags}"
 
-if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
+                               if test "${osptk_compatible}" = "yes"; then
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                                       PBX_OSPTK=1
+                                       OSPTK_INCLUDE="${osptk_cflags}"
+                                       OSPTK_LIB="${osptk_ldflags} -losptk ${osptk_extralibs}"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_OSPTK 1
+_ACEOF
+
+                               else
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                               fi
+                       fi
+               fi
+       fi
+
+fi
+
+
+if test "x${PBX_SRTP}" != "x1" -a "${USE_SRTP}" != "no"; then
    pbxlibdir=""
-   # if --with-TONEZONE=DIR has been specified, use it.
-   if test "x${TONEZONE_DIR}" != "x"; then
-      if test -d ${TONEZONE_DIR}/lib; then
-        pbxlibdir="-L${TONEZONE_DIR}/lib"
+   # if --with-SRTP=DIR has been specified, use it.
+   if test "x${SRTP_DIR}" != "x"; then
+      if test -d ${SRTP_DIR}/lib; then
+        pbxlibdir="-L${SRTP_DIR}/lib"
       else
-        pbxlibdir="-L${TONEZONE_DIR}"
+        pbxlibdir="-L${SRTP_DIR}"
       fi
    fi
-   pbxfuncname="tone_zone_find"
+   pbxfuncname="srtp_init"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TONEZONE_FOUND=yes
+      AST_SRTP_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_tonezone_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltonezone" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltonezone... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_srtp_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsrtp" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lsrtp... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltonezone ${pbxlibdir} ${tonezone_extra} ${DAHDI_INCLUDE} $LIBS"
+LIBS="-lsrtp ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25510,47 +25966,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_TONEZONE_FOUND=yes
+  AST_SRTP_FOUND=yes
 else
-  AST_TONEZONE_FOUND=no
+  AST_SRTP_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_TONEZONE_FOUND}" = "yes"; then
-      TONEZONE_LIB="${pbxlibdir} -ltonezone ${tonezone_extra} ${DAHDI_INCLUDE}"
-      # if --with-TONEZONE=DIR has been specified, use it.
-      if test "x${TONEZONE_DIR}" != "x"; then
-         TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
-      fi
-      TONEZONE_INCLUDE="${TONEZONE_INCLUDE} "
-      if test "xdahdi/tonezone.h" = "x" ; then # no header, assume found
-         TONEZONE_HEADER_FOUND="1"
+   if test "${AST_SRTP_FOUND}" = "yes"; then
+      SRTP_LIB="${pbxlibdir} -lsrtp "
+      # if --with-SRTP=DIR has been specified, use it.
+      if test "x${SRTP_DIR}" != "x"; then
+         SRTP_INCLUDE="-I${SRTP_DIR}/include"
+      fi
+      SRTP_INCLUDE="${SRTP_INCLUDE} "
+      if test "xsrtp/srtp.h" = "x" ; then      # no header, assume found
+         SRTP_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "dahdi/tonezone.h" "ac_cv_header_dahdi_tonezone_h" "$ac_includes_default"
-if test "x$ac_cv_header_dahdi_tonezone_h" = x""yes; then :
-  TONEZONE_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${SRTP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "srtp/srtp.h" "ac_cv_header_srtp_srtp_h" "$ac_includes_default"
+if test "x$ac_cv_header_srtp_srtp_h" = x""yes; then :
+  SRTP_HEADER_FOUND=1
 else
-  TONEZONE_HEADER_FOUND=0
+  SRTP_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
-         TONEZONE_LIB=""
-         TONEZONE_INCLUDE=""
+      if test "x${SRTP_HEADER_FOUND}" = "x0" ; then
+         SRTP_LIB=""
+         SRTP_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            TONEZONE_LIB=""
+            SRTP_LIB=""
          fi
-         PBX_TONEZONE=1
+         PBX_SRTP=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_TONEZONE 1
+#define HAVE_SRTP 1
 _ACEOF
 
       fi
 
 
 
-if test "x${PBX_USB}" != "x1" -a "${USE_USB}" != "no"; then
+    if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
+       PBX_GMIME=0
+       if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gmime-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gmime-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 test "${ac_cv_prog_CONFIG_GMIME+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CONFIG_GMIME"; then
+  ac_cv_prog_CONFIG_GMIME="$CONFIG_GMIME" # Let the user override the test.
+else
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CONFIG_GMIME="${ac_tool_prefix}gmime-config"
+    $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
+
+fi
+fi
+CONFIG_GMIME=$ac_cv_prog_CONFIG_GMIME
+if test -n "$CONFIG_GMIME"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_GMIME" >&5
+$as_echo "$CONFIG_GMIME" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CONFIG_GMIME"; then
+  ac_ct_CONFIG_GMIME=$CONFIG_GMIME
+  # Extract the first word of "gmime-config", so it can be a program name with args.
+set dummy gmime-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 test "${ac_cv_prog_ac_ct_CONFIG_GMIME+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CONFIG_GMIME"; then
+  ac_cv_prog_ac_ct_CONFIG_GMIME="$ac_ct_CONFIG_GMIME" # Let the user override the test.
+else
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CONFIG_GMIME="gmime-config"
+    $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
+
+fi
+fi
+ac_ct_CONFIG_GMIME=$ac_cv_prog_ac_ct_CONFIG_GMIME
+if test -n "$ac_ct_CONFIG_GMIME"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CONFIG_GMIME" >&5
+$as_echo "$ac_ct_CONFIG_GMIME" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CONFIG_GMIME" = x; then
+    CONFIG_GMIME="No"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CONFIG_GMIME=$ac_ct_CONFIG_GMIME
+  fi
+else
+  CONFIG_GMIME="$ac_cv_prog_CONFIG_GMIME"
+fi
+
+       if test ! "x${CONFIG_GMIME}" = xNo; then
+           if test x"" = x ; then A=--cflags ; else A="" ; fi
+           GMIME_INCLUDE=$(${CONFIG_GMIME} $A)
+           if test x"" = x ; then A=--libs ; else A="" ; fi
+           GMIME_LIB=$(${CONFIG_GMIME} $A)
+           if test x"#include <gmime/gmime.h>" != x ; then
+               saved_cppflags="${CPPFLAGS}"
+               if test "x${GMIME_DIR}" != "x"; then
+                   GMIME_INCLUDE="-I${GMIME_DIR}/include"
+               fi
+               CPPFLAGS="${CPPFLAGS} ${GMIME_INCLUDE}"
+
+               saved_libs="${LIBS}"
+               LIBS="${GMIME_LIB}"
+
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+  #include <gmime/gmime.h>
+int
+main ()
+{
+ gboolean q = g_mime_check_version(0,0,0);;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+     PBX_GMIME=1
+
+$as_echo "#define HAVE_GMIME 1" >>confdefs.h
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+               CPPFLAGS="${saved_cppflags}"
+               LIBS="${saved_libs}"
+           else
+               PBX_GMIME=1
+
+$as_echo "#define HAVE_GMIME 1" >>confdefs.h
+
+           fi
+       fi
+    fi
+
+
+
+if test "x${PBX_HOARD}" != "x1" -a "${USE_HOARD}" != "no"; then
    pbxlibdir=""
-   # if --with-USB=DIR has been specified, use it.
-   if test "x${USB_DIR}" != "x"; then
-      if test -d ${USB_DIR}/lib; then
-        pbxlibdir="-L${USB_DIR}/lib"
+   # if --with-HOARD=DIR has been specified, use it.
+   if test "x${HOARD_DIR}" != "x"; then
+      if test -d ${HOARD_DIR}/lib; then
+        pbxlibdir="-L${HOARD_DIR}/lib"
       else
-        pbxlibdir="-L${USB_DIR}"
+        pbxlibdir="-L${HOARD_DIR}"
       fi
    fi
-   pbxfuncname="usb_init"
+   pbxfuncname="malloc"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_USB_FOUND=yes
+      AST_HOARD_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_usb_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lusb" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lusb... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_hoard_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lhoard" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lhoard... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lusb ${pbxlibdir}  $LIBS"
+LIBS="-lhoard ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25616,47 +26215,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_USB_FOUND=yes
+  AST_HOARD_FOUND=yes
 else
-  AST_USB_FOUND=no
+  AST_HOARD_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_USB_FOUND}" = "yes"; then
-      USB_LIB="${pbxlibdir} -lusb "
-      # if --with-USB=DIR has been specified, use it.
-      if test "x${USB_DIR}" != "x"; then
-         USB_INCLUDE="-I${USB_DIR}/include"
+   if test "${AST_HOARD_FOUND}" = "yes"; then
+      HOARD_LIB="${pbxlibdir} -lhoard "
+      # if --with-HOARD=DIR has been specified, use it.
+      if test "x${HOARD_DIR}" != "x"; then
+         HOARD_INCLUDE="-I${HOARD_DIR}/include"
       fi
-      USB_INCLUDE="${USB_INCLUDE} "
-      if test "xusb.h" = "x" ; then    # no header, assume found
-         USB_HEADER_FOUND="1"
+      HOARD_INCLUDE="${HOARD_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         HOARD_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${USB_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
-if test "x$ac_cv_header_usb_h" = x""yes; then :
-  USB_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${HOARD_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = x""yes; then :
+  HOARD_HEADER_FOUND=1
 else
-  USB_HEADER_FOUND=0
+  HOARD_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${USB_HEADER_FOUND}" = "x0" ; then
-         USB_LIB=""
-         USB_INCLUDE=""
+      if test "x${HOARD_HEADER_FOUND}" = "x0" ; then
+         HOARD_LIB=""
+         HOARD_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            USB_LIB=""
+            HOARD_LIB=""
          fi
-         PBX_USB=1
+         PBX_HOARD=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_USB 1
+#define HAVE_HOARD 1
 _ACEOF
 
       fi
 
 
 
-if test "${OSARCH}" = "OpenBSD";
-then
 
-if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
+if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
    pbxlibdir=""
-   # if --with-VORBIS=DIR has been specified, use it.
-   if test "x${VORBIS_DIR}" != "x"; then
-      if test -d ${VORBIS_DIR}/lib; then
-        pbxlibdir="-L${VORBIS_DIR}/lib"
+   # if --with-FREETDS=DIR has been specified, use it.
+   if test "x${FREETDS_DIR}" != "x"; then
+      if test -d ${FREETDS_DIR}/lib; then
+        pbxlibdir="-L${FREETDS_DIR}/lib"
       else
-        pbxlibdir="-L${VORBIS_DIR}"
+        pbxlibdir="-L${FREETDS_DIR}"
       fi
    fi
-   pbxfuncname="vorbis_info_init"
+   pbxfuncname="dbinit"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_VORBIS_FOUND=yes
+      AST_FREETDS_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_vorbis_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lvorbis" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lvorbis... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_sybdb_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsybdb" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lsybdb... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lvorbis ${pbxlibdir} -lm -lvorbisenc -logg $LIBS"
+LIBS="-lsybdb ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25724,47 +26321,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_VORBIS_FOUND=yes
+  AST_FREETDS_FOUND=yes
 else
-  AST_VORBIS_FOUND=no
+  AST_FREETDS_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_VORBIS_FOUND}" = "yes"; then
-      VORBIS_LIB="${pbxlibdir} -lvorbis -lm -lvorbisenc -logg"
-      # if --with-VORBIS=DIR has been specified, use it.
-      if test "x${VORBIS_DIR}" != "x"; then
-         VORBIS_INCLUDE="-I${VORBIS_DIR}/include"
+   if test "${AST_FREETDS_FOUND}" = "yes"; then
+      FREETDS_LIB="${pbxlibdir} -lsybdb "
+      # if --with-FREETDS=DIR has been specified, use it.
+      if test "x${FREETDS_DIR}" != "x"; then
+         FREETDS_INCLUDE="-I${FREETDS_DIR}/include"
       fi
-      VORBIS_INCLUDE="${VORBIS_INCLUDE} "
-      if test "xvorbis/codec.h" = "x" ; then   # no header, assume found
-         VORBIS_HEADER_FOUND="1"
+      FREETDS_INCLUDE="${FREETDS_INCLUDE} "
+      if test "xsybdb.h" = "x" ; then  # no header, assume found
+         FREETDS_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${VORBIS_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "vorbis/codec.h" "ac_cv_header_vorbis_codec_h" "$ac_includes_default"
-if test "x$ac_cv_header_vorbis_codec_h" = x""yes; then :
-  VORBIS_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${FREETDS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "sybdb.h" "ac_cv_header_sybdb_h" "$ac_includes_default"
+if test "x$ac_cv_header_sybdb_h" = x""yes; then :
+  FREETDS_HEADER_FOUND=1
 else
-  VORBIS_HEADER_FOUND=0
+  FREETDS_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${VORBIS_HEADER_FOUND}" = "x0" ; then
-         VORBIS_LIB=""
-         VORBIS_INCLUDE=""
+      if test "x${FREETDS_HEADER_FOUND}" = "x0" ; then
+         FREETDS_LIB=""
+         FREETDS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            VORBIS_LIB=""
+            FREETDS_LIB=""
          fi
-         PBX_VORBIS=1
+         PBX_FREETDS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_VORBIS 1
+#define HAVE_FREETDS 1
 _ACEOF
 
       fi
@@ -25772,32 +26369,32 @@ _ACEOF
 fi
 
 
-else
 
-if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
+
+if test "x${PBX_TERMCAP}" != "x1" -a "${USE_TERMCAP}" != "no"; then
    pbxlibdir=""
-   # if --with-VORBIS=DIR has been specified, use it.
-   if test "x${VORBIS_DIR}" != "x"; then
-      if test -d ${VORBIS_DIR}/lib; then
-        pbxlibdir="-L${VORBIS_DIR}/lib"
+   # if --with-TERMCAP=DIR has been specified, use it.
+   if test "x${TERMCAP_DIR}" != "x"; then
+      if test -d ${TERMCAP_DIR}/lib; then
+        pbxlibdir="-L${TERMCAP_DIR}/lib"
       else
-        pbxlibdir="-L${VORBIS_DIR}"
+        pbxlibdir="-L${TERMCAP_DIR}"
       fi
    fi
-   pbxfuncname="vorbis_info_init"
+   pbxfuncname="tgetent"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_VORBIS_FOUND=yes
+      AST_TERMCAP_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_vorbis_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lvorbis" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lvorbis... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_termcap_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltermcap" >&5
+$as_echo_n "checking for ${pbxfuncname} in -ltermcap... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lvorbis ${pbxlibdir} -lm -lvorbisenc $LIBS"
+LIBS="-ltermcap ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -25830,153 +26427,80 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_VORBIS_FOUND=yes
+  AST_TERMCAP_FOUND=yes
 else
-  AST_VORBIS_FOUND=no
+  AST_TERMCAP_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_VORBIS_FOUND}" = "yes"; then
-      VORBIS_LIB="${pbxlibdir} -lvorbis -lm -lvorbisenc"
-      # if --with-VORBIS=DIR has been specified, use it.
-      if test "x${VORBIS_DIR}" != "x"; then
-         VORBIS_INCLUDE="-I${VORBIS_DIR}/include"
+   if test "${AST_TERMCAP_FOUND}" = "yes"; then
+      TERMCAP_LIB="${pbxlibdir} -ltermcap "
+      # if --with-TERMCAP=DIR has been specified, use it.
+      if test "x${TERMCAP_DIR}" != "x"; then
+         TERMCAP_INCLUDE="-I${TERMCAP_DIR}/include"
       fi
-      VORBIS_INCLUDE="${VORBIS_INCLUDE} "
-      if test "xvorbis/codec.h" = "x" ; then   # no header, assume found
-         VORBIS_HEADER_FOUND="1"
+      TERMCAP_INCLUDE="${TERMCAP_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TERMCAP_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${VORBIS_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "vorbis/codec.h" "ac_cv_header_vorbis_codec_h" "$ac_includes_default"
-if test "x$ac_cv_header_vorbis_codec_h" = x""yes; then :
-  VORBIS_HEADER_FOUND=1
-else
-  VORBIS_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${VORBIS_HEADER_FOUND}" = "x0" ; then
-         VORBIS_LIB=""
-         VORBIS_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            VORBIS_LIB=""
-         fi
-         PBX_VORBIS=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_VORBIS 1
-_ACEOF
-
-      fi
-   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
-
-
-if test "${USE_VPB}" != "no"; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vpb_open in -lvpb" >&5
-$as_echo_n "checking for vpb_open in -lvpb... " >&6; }
-   saved_libs="${LIBS}"
-   saved_cppflags="${CPPFLAGS}"
-   if test "x${VPB_DIR}" != "x"; then
-      if test -d ${VPB_DIR}/lib; then
-         vpblibdir=${VPB_DIR}/lib
-      else
-         vpblibdir=${VPB_DIR}
-      fi
-      LIBS="${LIBS} -L${vpblibdir}"
-      CPPFLAGS="${CPPFLAGS} -I${VPB_DIR}/include"
-   fi
-   LIBS="${PTHREAD_LIBS} ${LIBS} -lvpb"
-   CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS}"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-       #include <vpbapi.h>
-int
-main ()
-{
-int q = vpb_open(0,0);
-  ;
-  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_vpb_vpb_open="yes"
-
-else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-               ac_cv_lib_vpb_vpb_open="no"
-
-
+         CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = x""yes; then :
+  TERMCAP_HEADER_FOUND=1
+else
+  TERMCAP_HEADER_FOUND=0
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-   LIBS="${saved_libs}"
-   CPPFLAGS="${saved_cppflags}"
-   if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
-       VPB_LIB="-lvpb"
-       if test "${VPB_DIR}" != ""; then
-          VPB_LIB="-L${vpblibdir}  ${VPB_LIB}"
-          VPB_INCLUDE="-I${VPB_DIR}/include"
-       fi
-       PBX_VPB=1
 
-$as_echo "#define HAVE_VPB 1" >>confdefs.h
 
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${TERMCAP_HEADER_FOUND}" = "x0" ; then
+         TERMCAP_LIB=""
+         TERMCAP_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            TERMCAP_LIB=""
+         fi
+         PBX_TERMCAP=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_TERMCAP 1
+_ACEOF
+
+      fi
    fi
 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${PBX_ZLIB}" != "x1" -a "${USE_ZLIB}" != "no"; then
+if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
    pbxlibdir=""
-   # if --with-ZLIB=DIR has been specified, use it.
-   if test "x${ZLIB_DIR}" != "x"; then
-      if test -d ${ZLIB_DIR}/lib; then
-        pbxlibdir="-L${ZLIB_DIR}/lib"
+   # if --with-TINFO=DIR has been specified, use it.
+   if test "x${TINFO_DIR}" != "x"; then
+      if test -d ${TINFO_DIR}/lib; then
+        pbxlibdir="-L${TINFO_DIR}/lib"
       else
-        pbxlibdir="-L${ZLIB_DIR}"
+        pbxlibdir="-L${TINFO_DIR}"
       fi
    fi
-   pbxfuncname="compress"
+   pbxfuncname="tgetent"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_ZLIB_FOUND=yes
+      AST_TINFO_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_z_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lz" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lz... " >&6; }
+      as_ac_Lib=`$as_echo "ac_cv_lib_tinfo_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltinfo" >&5
+$as_echo_n "checking for ${pbxfuncname} in -ltinfo... " >&6; }
 if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz ${pbxlibdir}  $LIBS"
+LIBS="-ltinfo ${pbxlibdir}  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -26009,47 +26533,47 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 eval as_val=\$$as_ac_Lib
    if test "x$as_val" = x""yes; then :
-  AST_ZLIB_FOUND=yes
+  AST_TINFO_FOUND=yes
 else
-  AST_ZLIB_FOUND=no
+  AST_TINFO_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_ZLIB_FOUND}" = "yes"; then
-      ZLIB_LIB="${pbxlibdir} -lz "
-      # if --with-ZLIB=DIR has been specified, use it.
-      if test "x${ZLIB_DIR}" != "x"; then
-         ZLIB_INCLUDE="-I${ZLIB_DIR}/include"
+   if test "${AST_TINFO_FOUND}" = "yes"; then
+      TINFO_LIB="${pbxlibdir} -ltinfo "
+      # if --with-TINFO=DIR has been specified, use it.
+      if test "x${TINFO_DIR}" != "x"; then
+         TINFO_INCLUDE="-I${TINFO_DIR}/include"
       fi
-      ZLIB_INCLUDE="${ZLIB_INCLUDE} "
-      if test "xzlib.h" = "x" ; then   # no header, assume found
-         ZLIB_HEADER_FOUND="1"
+      TINFO_INCLUDE="${TINFO_INCLUDE} "
+      if test "x" = "x" ; then # no header, assume found
+         TINFO_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${ZLIB_INCLUDE}"
-         ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_zlib_h" = x""yes; then :
-  ZLIB_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = x""yes; then :
+  TINFO_HEADER_FOUND=1
 else
-  ZLIB_HEADER_FOUND=0
+  TINFO_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${ZLIB_HEADER_FOUND}" = "x0" ; then
-         ZLIB_LIB=""
-         ZLIB_INCLUDE=""
+      if test "x${TINFO_HEADER_FOUND}" = "x0" ; then
+         TINFO_LIB=""
+         TINFO_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            ZLIB_LIB=""
+            TINFO_LIB=""
          fi
-         PBX_ZLIB=1
+         PBX_TINFO=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_ZLIB 1
+#define HAVE_TINFO 1
 _ACEOF
 
       fi
 
 
 
-EDITLINE_LIB=""
-if test "x$TERMCAP_LIB" != "x" ; then
-  EDITLINE_LIB="$TERMCAP_LIB"
-elif test "x$TINFO_LIB" != "x" ; then
-  EDITLINE_LIB="$TINFO_LIB"
-elif test "x$CURSES_LIB" != "x" ; then
-  EDITLINE_LIB="$CURSES_LIB"
-elif test "x$NCURSES_LIB" != "x" ; then
-  EDITLINE_LIB="$NCURSES_LIB"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tone_zone_find_by_num in -ltonezone" >&5
+$as_echo_n "checking for tone_zone_find_by_num in -ltonezone... " >&6; }
+if test "${ac_cv_lib_tonezone_tone_zone_find_by_num+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  as_fn_error "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5
-fi
-
-
-if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
-       # Does ODBC support wide characters?
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ODBC has support for Unicode types" >&5
-$as_echo_n "checking whether ODBC has support for Unicode types... " >&6; }
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltonezone  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sql.h>
-#include <sqlext.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 tone_zone_find_by_num ();
 int
 main ()
 {
-int foo = SQL_WCHAR
+return tone_zone_find_by_num ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-$as_echo "#define HAVE_ODBC_WCHAR 1" >>confdefs.h
-
+  ac_cv_lib_tonezone_tone_zone_find_by_num=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
+  ac_cv_lib_tonezone_tone_zone_find_by_num=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-ac_fn_c_check_header_mongrel "$LINENO" "h323.h" "ac_cv_header_h323_h" "$ac_includes_default"
-if test "x$ac_cv_header_h323_h" = x""yes; then :
-  PBX_H323=1
-else
-  PBX_H323=0
-fi
-
-
-
-
-ac_fn_c_check_header_mongrel "$LINENO" "linux/compiler.h" "ac_cv_header_linux_compiler_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_compiler_h" = x""yes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_LINUX_COMPILER_H 1
-_ACEOF
-
-fi
-
-
-
-ac_fn_c_check_header_compile "$LINENO" "linux/ixjuser.h" "ac_cv_header_linux_ixjuser_h" "
-                                  #include <linux/version.h>
-                                  #ifdef HAVE_LINUX_COMPILER_H
-                                  #include <linux/compiler.h>
-                                  #endif
-
-"
-if test "x$ac_cv_header_linux_ixjuser_h" = x""yes; then :
-  PBX_IXJUSER=1
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tonezone_tone_zone_find_by_num" >&5
+$as_echo "$ac_cv_lib_tonezone_tone_zone_find_by_num" >&6; }
+if test "x$ac_cv_lib_tonezone_tone_zone_find_by_num" = x""yes; then :
+  tonezone_does_not_need_lm=yes
 else
-  PBX_IXJUSER=0
+  tonezone_does_not_need_lm=no
 fi
 
 
-
-
-# Used in res/res_pktccops
-
-    if test "x${PBX_MSG_NOSIGNAL}" != "x1"; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL in sys/socket.h" >&5
-$as_echo_n "checking for MSG_NOSIGNAL in sys/socket.h... " >&6; }
-       saved_cppflags="${CPPFLAGS}"
-       if test "x${MSG_NOSIGNAL_DIR}" != "x"; then
-           MSG_NOSIGNAL_INCLUDE="-I${MSG_NOSIGNAL_DIR}/include"
-       fi
-       CPPFLAGS="${CPPFLAGS} ${MSG_NOSIGNAL_INCLUDE}"
-
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
- #include <sys/socket.h>
-int
-main ()
-{
-#if defined(MSG_NOSIGNAL)
-                               int foo = 0;
-                               #else
-                               int foo = bar;
-                               #endif
-                               0
-
-  ;
-  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_MSG_NOSIGNAL=1
-
-$as_echo "#define HAVE_MSG_NOSIGNAL 1" >>confdefs.h
-
-
-
-else
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
+if test "${tonezone_does_not_need_lm}" = "no" ; then
+  tonezone_extra="-lm"
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CPPFLAGS="${saved_cppflags}"
-    fi
 
 
-
-    if test "x${PBX_SO_NOSIGPIPE}" != "x1"; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SO_NOSIGPIPE in sys/socket.h" >&5
-$as_echo_n "checking for SO_NOSIGPIPE in sys/socket.h... " >&6; }
-       saved_cppflags="${CPPFLAGS}"
-       if test "x${SO_NOSIGPIPE_DIR}" != "x"; then
-           SO_NOSIGPIPE_INCLUDE="-I${SO_NOSIGPIPE_DIR}/include"
-       fi
-       CPPFLAGS="${CPPFLAGS} ${SO_NOSIGPIPE_INCLUDE}"
-
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
+   pbxlibdir=""
+   # if --with-TONEZONE=DIR has been specified, use it.
+   if test "x${TONEZONE_DIR}" != "x"; then
+      if test -d ${TONEZONE_DIR}/lib; then
+        pbxlibdir="-L${TONEZONE_DIR}/lib"
+      else
+        pbxlibdir="-L${TONEZONE_DIR}"
+      fi
+   fi
+   pbxfuncname="tone_zone_find"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_TONEZONE_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_tonezone_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltonezone" >&5
+$as_echo_n "checking for ${pbxfuncname} in -ltonezone... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltonezone ${pbxlibdir} ${tonezone_extra} ${DAHDI_INCLUDE} $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
- #include <sys/socket.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 ()
 {
-#if defined(SO_NOSIGPIPE)
-                               int foo = 0;
-                               #else
-                               int foo = bar;
-                               #endif
-                               0
-
+return ${pbxfuncname} ();
   ;
   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_SO_NOSIGPIPE=1
+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; }
+eval as_val=\$$as_ac_Lib
+   if test "x$as_val" = x""yes; then :
+  AST_TONEZONE_FOUND=yes
+else
+  AST_TONEZONE_FOUND=no
+fi
 
-$as_echo "#define HAVE_SO_NOSIGPIPE 1" >>confdefs.h
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
+   # now check for the header.
+   if test "${AST_TONEZONE_FOUND}" = "yes"; then
+      TONEZONE_LIB="${pbxlibdir} -ltonezone ${tonezone_extra} ${DAHDI_INCLUDE}"
+      # if --with-TONEZONE=DIR has been specified, use it.
+      if test "x${TONEZONE_DIR}" != "x"; then
+         TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
+      fi
+      TONEZONE_INCLUDE="${TONEZONE_INCLUDE} "
+      if test "xdahdi/tonezone.h" = "x" ; then # no header, assume found
+         TONEZONE_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "dahdi/tonezone.h" "ac_cv_header_dahdi_tonezone_h" "$ac_includes_default"
+if test "x$ac_cv_header_dahdi_tonezone_h" = x""yes; then :
+  TONEZONE_HEADER_FOUND=1
+else
+  TONEZONE_HEADER_FOUND=0
+fi
 
 
-else
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
+         TONEZONE_LIB=""
+         TONEZONE_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            TONEZONE_LIB=""
+         fi
+         PBX_TONEZONE=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_TONEZONE 1
+_ACEOF
 
+      fi
+   fi
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CPPFLAGS="${saved_cppflags}"
-    fi
 
 
 
 
-    if test "x${PBX_SDL}" != "x1" -a "${USE_SDL}" != "no"; then
-       PBX_SDL=0
-       if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}sdl-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}sdl-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 test "${ac_cv_prog_CONFIG_SDL+set}" = set; then :
+if test "x${PBX_USB}" != "x1" -a "${USE_USB}" != "no"; then
+   pbxlibdir=""
+   # if --with-USB=DIR has been specified, use it.
+   if test "x${USB_DIR}" != "x"; then
+      if test -d ${USB_DIR}/lib; then
+        pbxlibdir="-L${USB_DIR}/lib"
+      else
+        pbxlibdir="-L${USB_DIR}"
+      fi
+   fi
+   pbxfuncname="usb_init"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_USB_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_usb_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lusb" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lusb... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$CONFIG_SDL"; then
-  ac_cv_prog_CONFIG_SDL="$CONFIG_SDL" # Let the user override the test.
-else
-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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CONFIG_SDL="${ac_tool_prefix}sdl-config"
-    $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="-lusb ${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
-CONFIG_SDL=$ac_cv_prog_CONFIG_SDL
-if test -n "$CONFIG_SDL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_SDL" >&5
-$as_echo "$CONFIG_SDL" >&6; }
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_ac_Lib
+   if test "x$as_val" = x""yes; then :
+  AST_USB_FOUND=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  AST_USB_FOUND=no
 fi
 
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
 
-fi
-if test -z "$ac_cv_prog_CONFIG_SDL"; then
-  ac_ct_CONFIG_SDL=$CONFIG_SDL
-  # Extract the first word of "sdl-config", so it can be a program name with args.
-set dummy sdl-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 test "${ac_cv_prog_ac_ct_CONFIG_SDL+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CONFIG_SDL"; then
-  ac_cv_prog_ac_ct_CONFIG_SDL="$ac_ct_CONFIG_SDL" # Let the user override the test.
-else
-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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CONFIG_SDL="sdl-config"
-    $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
-
-fi
-fi
-ac_ct_CONFIG_SDL=$ac_cv_prog_ac_ct_CONFIG_SDL
-if test -n "$ac_ct_CONFIG_SDL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CONFIG_SDL" >&5
-$as_echo "$ac_ct_CONFIG_SDL" >&6; }
+   # now check for the header.
+   if test "${AST_USB_FOUND}" = "yes"; then
+      USB_LIB="${pbxlibdir} -lusb "
+      # if --with-USB=DIR has been specified, use it.
+      if test "x${USB_DIR}" != "x"; then
+         USB_INCLUDE="-I${USB_DIR}/include"
+      fi
+      USB_INCLUDE="${USB_INCLUDE} "
+      if test "xusb.h" = "x" ; then    # no header, assume found
+         USB_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${USB_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
+if test "x$ac_cv_header_usb_h" = x""yes; then :
+  USB_HEADER_FOUND=1
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  USB_HEADER_FOUND=0
 fi
 
-  if test "x$ac_ct_CONFIG_SDL" = x; then
-    CONFIG_SDL="No"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CONFIG_SDL=$ac_ct_CONFIG_SDL
-  fi
-else
-  CONFIG_SDL="$ac_cv_prog_CONFIG_SDL"
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${USB_HEADER_FOUND}" = "x0" ; then
+         USB_LIB=""
+         USB_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
+            USB_LIB=""
+         fi
+         PBX_USB=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_USB 1
+_ACEOF
+
+      fi
+   fi
 fi
 
-       if test ! "x${CONFIG_SDL}" = xNo; then
-           if test x"" = x ; then A=--cflags ; else A="" ; fi
-           SDL_INCLUDE=$(${CONFIG_SDL} $A)
-           if test x"" = x ; then A=--libs ; else A="" ; fi
-           SDL_LIB=$(${CONFIG_SDL} $A)
-           if test x"" != x ; then
-               saved_cppflags="${CPPFLAGS}"
-               if test "x${SDL_DIR}" != "x"; then
-                   SDL_INCLUDE="-I${SDL_DIR}/include"
-               fi
-               CPPFLAGS="${CPPFLAGS} ${SDL_INCLUDE}"
 
-               saved_libs="${LIBS}"
-               LIBS="${SDL_LIB}"
 
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test "${OSARCH}" = "OpenBSD";
+then
+
+if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
+   pbxlibdir=""
+   # if --with-VORBIS=DIR has been specified, use it.
+   if test "x${VORBIS_DIR}" != "x"; then
+      if test -d ${VORBIS_DIR}/lib; then
+        pbxlibdir="-L${VORBIS_DIR}/lib"
+      else
+        pbxlibdir="-L${VORBIS_DIR}"
+      fi
+   fi
+   pbxfuncname="vorbis_info_init"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_VORBIS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_vorbis_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lvorbis" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lvorbis... " >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lvorbis ${pbxlibdir} -lm -lvorbisenc -logg $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 :
-     PBX_SDL=1
-
-$as_echo "#define HAVE_SDL 1" >>confdefs.h
-
-
+  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
-               CPPFLAGS="${saved_cppflags}"
-               LIBS="${saved_libs}"
-           else
-               PBX_SDL=1
+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; }
+eval as_val=\$$as_ac_Lib
+   if test "x$as_val" = x""yes; then :
+  AST_VORBIS_FOUND=yes
+else
+  AST_VOR