{
#define END_SILENCE_LEN 400
#define HEADER_MS 50
-diff -ur -x '*.c' -x '*.orig' -x configure asterisk-1.4.21.1.new/build_tools/menuselect-deps.in asterisk-1.4.21.1.old/build_tools/menuselect-deps.in
---- asterisk-1.4.21.1.new/build_tools/menuselect-deps.in 2008-05-06 00:10:05.000000000 +0200
-+++ asterisk-1.4.21.1.old/build_tools/menuselect-deps.in 2008-07-18 08:18:42.813626657 +0200
-@@ -2,6 +2,7 @@
- CURL=@PBX_CURL@
- FREETDS=@PBX_FREETDS@
- GSM=@PBX_GSM@
-+GSMAT=@PBX_GSMAT@
- GTK=@PBX_GTK@
- GTK2=@PBX_GTK2@
- H323=@PBX_H323@
-diff -ur asterisk-1.4.21.1.org/channels/chan_zap.c asterisk-1.4.21.1/channels/chan_zap.c
---- asterisk-1.4.21.1/channels/chan_zap.c~ 2008-07-18 21:56:54.854339111 +0200
-+++ asterisk-1.4.21.1/channels/chan_zap.c 2008-07-18 22:02:00.487649563 +0200
-@@ -47,6 +47,7 @@
- <depend>zaptel</depend>
- <depend>tonezone</depend>
- <depend>res_features</depend>
-+ <depend>gsmat</depend>
- <use>pri</use>
- ***/
-
-diff -ur -x '*.c' -x '*.orig' -x configure asterisk-1.4.21.1.new/channels/.chan_zap.moduleinfo asterisk-1.4.21.1.old/channels/.chan_zap.moduleinfo
---- asterisk-1.4.21.1.new/channels/.chan_zap.moduleinfo 2008-06-30 18:24:08.000000000 +0200
-+++ asterisk-1.4.21.1.old/channels/.chan_zap.moduleinfo 2008-07-18 08:18:42.808831904 +0200
-@@ -4,5 +4,6 @@
- <depend>zaptel</depend>
- <depend>tonezone</depend>
- <depend>res_features</depend>
-+ <depend>gsmat</depend>
- <use>pri</use>
- </member>
-diff -ur -x '*.c' -x '*.orig' -x configure asterisk-1.4.21.1.new/channels/.moduleinfo asterisk-1.4.21.1.old/channels/.moduleinfo
---- asterisk-1.4.21.1.new/channels/.moduleinfo 2008-06-30 18:24:08.000000000 +0200
-+++ asterisk-1.4.21.1.old/channels/.moduleinfo 2008-07-18 08:18:42.808831904 +0200
-@@ -51,6 +51,7 @@
- <depend>zaptel</depend>
- <depend>tonezone</depend>
- <depend>res_features</depend>
-+ <depend>gsmat</depend>
- <use>pri</use>
- </member>
- <member name="chan_vpb" displayname="Voicetronix API driver" remove_on_change="channels/chan_vpb.oo channels/chan_vpb.so">
---- asterisk-1.4.21.1/configure.ac~ 2008-07-18 21:40:46.734019409 +0200
-+++ asterisk-1.4.21.1/configure.ac 2008-07-18 21:44:45.714615015 +0200
-@@ -178,6 +178,7 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -178,6 +178,7 @@ AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capa
AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
AST_EXT_LIB_SETUP([GNUTLS], [GNU TLS support (used for iksemel only)], [gnutls])
AST_EXT_LIB_SETUP([GSM], [GSM], [gsm], [, or 'internal'])
-+AST_EXT_LIB_SETUP([GSMAT], [GSM AT command signalling], [gsmat])
++AST_EXT_LIB_SETUP([GSMAT], [GSMAT], [GSM AT command signalling], [gsmat])
AST_EXT_LIB_SETUP([IKSEMEL], [Iksemel Jabber Library], [iksemel])
AST_EXT_LIB_SETUP([IMAP_TK], [UW IMAP Toolkit], [imap])
AST_EXT_LIB_SETUP([ISDNNET], [ISDN4Linux Library], [isdnnet])
-diff -ur -x '*.c' -x '*.orig' -x configure asterisk-1.4.21.1.new/configure.ac asterisk-1.4.21.1.old/configure.ac
---- asterisk-1.4.21.1.new/configure.ac 2008-07-18 08:18:57.389246988 +0200
-+++ asterisk-1.4.21.1.old/configure.ac 2008-07-18 08:18:42.806528869 +0200
-@@ -504,6 +504,8 @@
+--- a/configure
++++ b/configure
+@@ -26600,6 +26600,188 @@ echo "$as_me: *** without explicitly spe
fi
fi
-+AST_EXT_LIB_CHECK([GSMAT], [gsmat], [gsm_new_call], [libgsmat.h])
-+
- AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h])
-
- if test "${PBX_IKSEMEL}" = 1; then
-diff -ur -x '*.c' -x '*.orig' -x configure asterisk-1.4.21.1.new/makeopts.in asterisk-1.4.21.1.old/makeopts.in
---- asterisk-1.4.21.1.new/makeopts.in 2008-03-11 15:07:59.000000000 +0100
-+++ asterisk-1.4.21.1.old/makeopts.in 2008-07-18 08:18:42.813626657 +0200
-@@ -83,6 +83,9 @@
- GSM_INCLUDE=@GSM_INCLUDE@
- GSM_LIB=@GSM_LIB@
-
-+GSMAT_INCLUDE=@GSMAT_INCLUDE@
-+GSMAT_LIB=@GSMAT_LIB@
-+
- GTK_INCLUDE=@GTK_INCLUDE@
- GTK_LIB=@GTK_LIB@
-
-diff -ur -x '*.c' -x '*.orig' -x configure asterisk-1.4.21.1.new/menuselect-tree asterisk-1.4.21.1.old/menuselect-tree
---- asterisk-1.4.21.1.new/menuselect-tree 2008-06-30 18:24:08.000000000 +0200
-+++ asterisk-1.4.21.1.old/menuselect-tree 2008-07-18 08:18:42.813626657 +0200
-@@ -251,6 +251,7 @@
- <depend>zaptel</depend>
- <depend>tonezone</depend>
- <depend>res_features</depend>
-+ <depend>gsmat</depend>
- <use>pri</use>
- </member>
- <member name="chan_vpb" displayname="Voicetronix API driver" remove_on_change="channels/chan_vpb.oo channels/chan_vpb.so">
++{ echo "$as_me:$LINENO: checking for ${GSMAT_DIR}/include/libgsmat.h" >&5
++echo $ECHO_N "checking for ${GSMAT_DIR}/include/libgsmat.h... $ECHO_C" >&6; }
++if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ eval "$as_ac_Header=\$ac_header_preproc"
++fi
++ac_res=`eval echo '${'$as_ac_Header'}'`
++ { echo "$as_me:$LINENO: result: $ac_res" >&5
++echo "${ECHO_T}$ac_res" >&6; }
++
++if test `eval echo '${'$as_ac_Header'}'` = yes; then
++ GSMAT_HEADER_FOUND=1
++else
++ GSMAT_HEADER_FOUND=0
++fi
++
++
++
++ if test "${GSMAT_HEADER_FOUND}" = "yes"; then
++ GSMAT_LIB="-lgsmat "
++ GSMAT_HEADER_FOUND="1"
++ if test "x${GSMAT_DIR}" != "x"; then
++ GSMAT_LIB="${pbxlibdir} ${GSMAT_LIB}"
++ GSMAT_INCLUDE="-I${GSMAT_DIR}/include"
++ fi
++ CPPFLAGS="${saved_cppflags}"
++ else
++ if test "xlibgsmat.h" != "x" ; then
++ if test "${ac_cv_header_libpri_h+set}" = set; then
++ { echo "$as_me:$LINENO: checking for libgsmat.h" >&5
++echo $ECHO_N "checking for libgsmat.h... $ECHO_C" >&6; }
++if test "${ac_cv_header_libgsmat_h+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++fi
++{ echo "$as_me:$LINENO: result: $ac_cv_header_libgsmat_h" >&5
++echo "${ECHO_T}$ac_cv_header_libgsmat_h" >&6; }
++else
++ # Is the header compilable?
++{ echo "$as_me:$LINENO: checking libgsmat.h usability" >&5
++echo $ECHO_N "checking libgsmat.h usability... $ECHO_C" >&6; }
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++$ac_includes_default
++#include <libgsmat.h>
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++ *) ac_try_echo=$ac_try;;
++esac
++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++ (eval "$ac_compile") 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } && {
++ test -z "$ac_c_werror_flag" ||
++ test ! -s conftest.err
++ } && test -s conftest.$ac_objext; then
++ ac_header_compiler=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ ac_header_compiler=no
++fi
++
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
++echo "${ECHO_T}$ac_header_compiler" >&6; }
++
++# Is the header present?
++{ echo "$as_me:$LINENO: checking libgsmat.h presence" >&5
++echo $ECHO_N "checking libgsmat.h presence... $ECHO_C" >&6; }
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++#include <libgsmat.h>
++_ACEOF
++if { (ac_try="$ac_cpp conftest.$ac_ext"
++case "(($ac_try" in
++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++ *) ac_try_echo=$ac_try;;
++esac
++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } >/dev/null && {
++ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
++ test ! -s conftest.err
++ }; then
++ ac_header_preproc=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ ac_header_preproc=no
++fi
++
++rm -f conftest.err conftest.$ac_ext
++{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
++echo "${ECHO_T}$ac_header_preproc" >&6; }
++
++# So? What about this header?
++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
++ yes:no: )
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: accepted by the compiler, rejected by the preprocessor!" >&5
++echo "$as_me: WARNING: libgsmat.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: proceeding with the compiler's result" >&5
++echo "$as_me: WARNING: libgsmat.h: proceeding with the compiler's result" >&2;}
++ ac_header_preproc=yes
++ ;;
++ no:yes:* )
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: present but cannot be compiled" >&5
++echo "$as_me: WARNING: libgsmat.h: present but cannot be compiled" >&2;}
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: check for missing prerequisite headers?" >&5
++echo "$as_me: WARNING: libgsmat.h: check for missing prerequisite headers?" >&2;}
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: see the Autoconf documentation" >&5
++echo "$as_me: WARNING: libgsmat.h: see the Autoconf documentation" >&2;}
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: section \"Present But Cannot Be Compiled\"" >&5
++echo "$as_me: WARNING: libgsmat.h: section \"Present But Cannot Be Compiled\"" >&2;}
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: proceeding with the preprocessor's result" >&5
++echo "$as_me: WARNING: libgsmat.h: proceeding with the preprocessor's result" >&2;}
++ { echo "$as_me:$LINENO: WARNING: libgsmat.h: in the future, the compiler will take precedence" >&5
++echo "$as_me: WARNING: libgsmat.h: in the future, the compiler will take precedence" >&2;}
++
++ ;;
++esac
++{ echo "$as_me:$LINENO: checking for libgsmat.h" >&5
++echo $ECHO_N "checking for libgsmat.h... $ECHO_C" >&6; }
++if test "${ac_cv_header_libgsmat_h+set}" = set; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ ac_cv_header_libgsmat_h=$ac_header_preproc
++fi
++{ echo "$as_me:$LINENO: result: $ac_cv_header_libgsmat_h" >&5
++echo "${ECHO_T}$ac_cv_header_libgsmat_h" >&6; }
++
++fi
++
++
++ fi
++ fi
++ if test "x${GSMAT_HEADER_FOUND}" = "x0" ; then
++ if test -n "${GSMAT_MANDATORY}" ;
++ then
++ { echo "$as_me:$LINENO: ***" >&5
++echo "$as_me: ***" >&6;}
++ { echo "$as_me:$LINENO: *** It appears that you do not have the GSMAT development package installed." >&5
++echo "$as_me: *** It appears that you do not have the GSMAT development package installed." >&6;}
++ { echo "$as_me:$LINENO: *** Please install it to include ${GSMAT_DESCRIP} support, or re-run configure" >&5
++echo "$as_me: *** Please install it to include ${GSMAT_DESCRIP} support, or re-run configure" >&6;}
++ { echo "$as_me:$LINENO: *** without explicitly specifying --with-${GSMAT_OPTION}" >&5
++echo "$as_me: *** without explicitly specifying --with-${GSMAT_OPTION}" >&6;}
++ exit 1
++ fi
++ GSMAT_LIB=""
++ GSMAT_INCLUDE=""
++ PBX_GSMAT=0
++ else
++ PBX_GSMAT=1
++
++cat >>confdefs.h <<_ACEOF
++#define HAVE_GSMAT 1
++_ACEOF
++
++fi
+
+ if test "${USE_PWLIB}" != "no"; then
+ if test -n "${PWLIB_DIR}"; then