Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch

This commit is contained in:
Michael S Collins 2012-07-02 09:45:05 -07:00
commit e2cfaf9fd9
49 changed files with 2303 additions and 243 deletions

View File

@ -16,6 +16,8 @@
## License along with this program; if not, write to the Free Software ## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)

View File

@ -18,34 +18,25 @@
# @start 1 # @start 1
AC_INIT AC_PREREQ([2.59])
AC_INIT([spandsp], [0.0.6])
m4_include(config/ax_compiler_vendor.m4)
m4_include(config/ax_check_real_file.m4)
m4_include(config/ax_fixed_point_machine.m4)
m4_include(config/ax_misaligned_access_fails.m4)
m4_include(config/ax_c99_features.m4)
m4_include(config/ax_check_export_capability.m4)
SPANDSP_MAJOR_VERSION=0
SPANDSP_MINOR_VERSION=0
SPANDSP_MICRO_VERSION=6
SPANDSP_LT_CURRENT=2 SPANDSP_LT_CURRENT=2
SPANDSP_LT_REVISION=0 SPANDSP_LT_REVISION=0
SPANDSP_LT_AGE=0 SPANDSP_LT_AGE=0
VERSION=$SPANDSP_MAJOR_VERSION.$SPANDSP_MINOR_VERSION.$SPANDSP_MICRO_VERSION m4_include(m4/ax_compiler_vendor.m4)
PACKAGE=spandsp m4_include(m4/ax_check_real_file.m4)
m4_include(m4/ax_fixed_point_machine.m4)
AC_SUBST(SPANDSP_LT_CURRENT) m4_include(m4/ax_misaligned_access_fails.m4)
AC_SUBST(SPANDSP_LT_REVISION) m4_include(m4/ax_c99_features.m4)
AC_SUBST(SPANDSP_LT_AGE) m4_include(m4/ax_check_export_capability.m4)
AC_CONFIG_SRCDIR([src/tone_generate.c]) AC_CONFIG_SRCDIR([src/tone_generate.c])
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([src/config.h:config-h.in]) AC_CONFIG_HEADERS([src/config.h:config-h.in])
AM_INIT_AUTOMAKE($PACKAGE, $VERSION) AM_INIT_AUTOMAKE([1.9.5])
AC_CANONICAL_HOST AC_CANONICAL_HOST
#AC_CANONICAL_BUILD #AC_CANONICAL_BUILD
@ -59,51 +50,51 @@ AX_COMPILER_VENDOR
if test "${build}" != "${host}" if test "${build}" != "${host}"
then then
# If we are doing a Canadian Cross, in which the host and build systems # If we are doing a Canadian Cross, in which the host and build systems
# are not the same, we set reasonable default values for the tools. # are not the same, we set reasonable default values for the tools.
CC_FOR_BUILD=${CC_FOR_BUILD-gcc} CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
CC=${CC-${host_alias}-gcc} CC=${CC-${host_alias}-gcc}
CFLAGS=${CFLAGS-"-g -O2"} CFLAGS=${CFLAGS-"-g -O2"}
CXX=${CXX-${host_alias}-c++} CXX=${CXX-${host_alias}-c++}
CXXFLAGS=${CXXFLAGS-"-g -O2"} CXXFLAGS=${CXXFLAGS-"-g -O2"}
else else
# Set reasonable default values for some tools even if not Canadian. # Set reasonable default values for some tools even if not Canadian.
# Of course, these are different reasonable default values, originally # Of course, these are different reasonable default values, originally
# specified directly in the Makefile. # specified directly in the Makefile.
# We don't export, so that autoconf can do its job. # We don't export, so that autoconf can do its job.
# Note that all these settings are above the fragment inclusion point # Note that all these settings are above the fragment inclusion point
# in Makefile.in, so can still be overridden by fragments. # in Makefile.in, so can still be overridden by fragments.
# This is all going to change when we autoconfiscate... # This is all going to change when we autoconfiscate...
CC_FOR_BUILD="\$(CC)" CC_FOR_BUILD="\$(CC)"
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)" CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
AC_PROG_CC AC_PROG_CC
# We must set the default linker to the linker used by gcc for the correct # We must set the default linker to the linker used by gcc for the correct
# operation of libtool. If LD is not defined and we are using gcc, try to # operation of libtool. If LD is not defined and we are using gcc, try to
# set the LD default to the ld used by gcc. # set the LD default to the ld used by gcc.
if test -z "$LD" if test -z "$LD"
then
if test "$GCC" = yes
then then
case $build in if test "$GCC" = yes
*-*-mingw*) then
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; case $build in
*) *-*-mingw*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
esac *)
case $gcc_prog_ld in gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
# Accept absolute paths. esac
[[\\/]* | [A-Za-z]:[\\/]*)] case $gcc_prog_ld in
LD="$gcc_prog_ld" ;; # Accept absolute paths.
esac [[\\/]* | [A-Za-z]:[\\/]*)]
LD="$gcc_prog_ld" ;;
esac
fi
fi fi
fi
CXX=${CXX-"c++"} CXX=${CXX-"c++"}
CFLAGS=${CFLAGS-"-g -O2"} CFLAGS=${CFLAGS-"-g -O2"}
CXXFLAGS=${CXXFLAGS-"-g -O2"} CXXFLAGS=${CXXFLAGS-"-g -O2"}
fi fi
AC_DEFUN([REMOVE_FROM_VAR],[ AC_DEFUN([REMOVE_FROM_VAR],[
@ -143,6 +134,7 @@ AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support])
AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support]) AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support])
AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support]) AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support])
AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support]) AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support])
AC_ARG_ENABLE(avx, [ --enable-avx Enable AVX support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support]) AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp # The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
AC_ARG_ENABLE(builtin_tiff, AC_ARG_ENABLE(builtin_tiff,
@ -207,9 +199,9 @@ AC_CHECK_HEADERS([fenv.h])
AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])]) AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])])
AC_CHECK_HEADERS([pcap.h]) AC_CHECK_HEADERS([pcap.h])
AC_CHECK_HEADERS([pthread.h]) AC_CHECK_HEADERS([pthread.h])
if test "${build}" = "${host}" if test "${build}" == "${host}"
then then
AC_CHECK_HEADERS([X11/X.h]) AC_CHECK_HEADERS([X11/X.h])
fi fi
# Determine XML2 include path # Determine XML2 include path
@ -253,12 +245,12 @@ AC_CHECK_HEADERS([FL/Fl_Audio_Meter.H], [], [], [],[[#include <FL/Fl.H>
AC_LANG([C]) AC_LANG([C])
if test "${build}" = "${host}" if test "${build}" == "${host}"
then then
case "${host}" in case "${host}" in
x86_64-*) x86_64-*)
# X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set # X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set
AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='$(exec_prefix)/lib64') AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='${exec_prefix}/lib64')
AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"])) AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"]))
# The very oldest AMD 64 bit chips support SSE2, SSE and MMX # The very oldest AMD 64 bit chips support SSE2, SSE and MMX
enable_sse2="yes" enable_sse2="yes"
@ -266,6 +258,10 @@ then
esac esac
fi fi
#AC_DEFINE([SPANDSP_SUPPORT_T42], [1], [Support T.42 JPEG compression])
SPANDSP_SUPPORT_T42="#undef SPANDSP_SUPPORT_T42"
#AC_DEFINE([SPANDSP_SUPPORT_T43], [1], [Support T.43 JBIG gray and colour compression])
SPANDSP_SUPPORT_T43="#undef SPANDSP_SUPPORT_T43"
#AC_DEFINE([SPANDSP_SUPPORT_T85], [1], [Support T.85 JBIG compression]) #AC_DEFINE([SPANDSP_SUPPORT_T85], [1], [Support T.85 JBIG compression])
SPANDSP_SUPPORT_T85="#undef SPANDSP_SUPPORT_T85" SPANDSP_SUPPORT_T85="#undef SPANDSP_SUPPORT_T85"
#AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem]) #AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem])
@ -287,14 +283,27 @@ AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have
AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.])) AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.]))
AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.])) AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.]))
# Checks for libraries. AC_SEARCH_LIBS([open_memstream], [m], AC_DEFINE([HAVE_OPEN_MEMSTREAM], [1], [Define to 1 if you have the open_memstream() function.]))
AC_CHECK_LIB([xml2], [xmlParseFile], [AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have the 'libxml2' library (-lxml2).]) SIMLIBS="$SIMLIBS -lxml2"])
if test -n "$enable_tests" ; then if test -n "$enable_tests" ; then
AC_CHECK_PROG([HAVE_SOX], [sox], yes)
if test "x$HAVE_SOX" != "xyes" ; then
AC_MSG_ERROR("Cannot make tests without sox installed")
fi
AC_CHECK_PROG([HAVE_PBMTOG3], [pbmtog3], yes)
if test "x$HAVE_PBMTOG3" != "xyes" ; then
AC_MSG_ERROR("Cannot make tests without pbmtog3 installed (does your system require a netpbm-progs package?)")
fi
AC_CHECK_PROG([HAVE_FAX2TIFF], [fax2tiff], yes)
if test "x$HAVE_FAX2TIFF" != "xyes" ; then
AC_MSG_ERROR("Cannot make tests without fax2tiff installed (does your system require a libtiff-tools package?)")
fi
AC_LANG([C]) AC_LANG([C])
AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)")) # Checks for libraries.
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))]) AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Cannot make tests without libsndfile (does your system require a libsndfile-devel package?)"))
AC_CHECK_LIB([pcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lpcap", AC_MSG_ERROR("Can't make tests without libpcap (does your system require a libpcap-devel package?)")) AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Cannot make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))])
AC_CHECK_LIB([xml2], [xmlParseFile], TESTLIBS="$TESTLIBS -lxml2", AC_MSG_ERROR("Cannot make tests without libxml2 (does your system require a libxml2-devel package?)"))
AC_CHECK_LIB([pcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lpcap", [AC_CHECK_LIB([wpcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lwpcap", AC_MSG_ERROR("Cannot make tests without libpcap (does your system require an libpcap-devel package?)"))])
AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread") AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread")
AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl") AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl")
AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS) AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS)
@ -314,7 +323,10 @@ AX_CHECK_EXPORT_CAPABILITY([$host],
case "${ax_cv_c_compiler_vendor}" in case "${ax_cv_c_compiler_vendor}" in
gnu) gnu)
COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
if test "$enable_avx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse5" = "yes" ; then if test "$enable_sse5" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS"
fi fi
@ -343,9 +355,12 @@ gnu)
COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
fi fi
case $host_os in case $host_os in
mingw* | cygwin*) cygwin*)
COMP_VENDOR_LDFLAGS="-no-undefined" COMP_VENDOR_LDFLAGS="-no-undefined"
;; ;;
mingw*)
COMP_VENDOR_LDFLAGS="-no-undefined -lws2_32"
;;
*) *)
COMP_VENDOR_LDFLAGS= COMP_VENDOR_LDFLAGS=
;; ;;
@ -369,7 +384,10 @@ sun)
REMOVE_FROM_VAR(CFLAGS, -Xc) REMOVE_FROM_VAR(CFLAGS, -Xc)
;; ;;
intel) intel)
COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
if test "$enable_avx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse5" = "yes" ; then if test "$enable_sse5" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS"
fi fi
@ -400,25 +418,13 @@ intel)
COMP_VENDOR_LDFLAGS= COMP_VENDOR_LDFLAGS=
;; ;;
*) *)
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wunused-but-set-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
COMP_VENDOR_LDFLAGS= COMP_VENDOR_LDFLAGS=
;; ;;
esac esac
COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS"
AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes])
AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes])
AM_CONDITIONAL([COND_TESTDATA], [test "$enable_test_data" = yes])
AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes])
AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes])
AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes])
AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes])
AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes])
AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes])
AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes])
if test "$enable_fixed_point" = "yes" ; then if test "$enable_fixed_point" = "yes" ; then
AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1" SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1"
@ -433,6 +439,10 @@ AX_MISALIGNED_ACCESS_FAILS([$host],
SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1"], SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1"],
[SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS"]) [SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS"])
if test "$enable_avx" = "yes" ; then
AC_DEFINE([SPANDSP_USE_AVX], [1], [Use the AVX instruction set (i386 and x86_64 only).])
enable_sse5"yes"
fi
if test "$enable_sse5" = "yes" ; then if test "$enable_sse5" = "yes" ; then
AC_DEFINE([SPANDSP_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).]) AC_DEFINE([SPANDSP_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).])
enable_sse4a="yes" enable_sse4a="yes"
@ -469,23 +479,42 @@ if test "$enable_mmx" = "yes" ; then
AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).]) AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
fi fi
AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes])
AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes])
AM_CONDITIONAL([COND_TESTDATA], [test "$enable_test_data" = yes])
AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes])
AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes])
AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes])
AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes])
AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes])
AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes])
AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes])
AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes])
if test "$enable_builtin_tiff" = "yes" ; then if test "$enable_builtin_tiff" = "yes" ; then
abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`" abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`"
save_CFLAGS=$CFLAGS save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff" CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff"
AC_CHECK_HEADERS([tiffio.h]) AC_CHECK_HEADERS([tiffio.h])
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS" COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS"
COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS" COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS"
LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la" LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la"
AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).]) AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).])
else else
AC_CHECK_HEADERS([tiffio.h]) AC_CHECK_HEADERS([tiffio.h])
AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Can't build without libtiff (does your system require a libtiff-devel package?)"), -lm) AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm)
fi fi
AC_CHECK_HEADERS([jpeglib.h])
AC_CHECK_LIB([jpeg], [jpeg_start_compress])
TESTLIBS="$SIMLIBS $TESTLIBS" TESTLIBS="$SIMLIBS $TESTLIBS"
AC_SUBST(SPANDSP_LT_CURRENT)
AC_SUBST(SPANDSP_LT_REVISION)
AC_SUBST(SPANDSP_LT_AGE)
AC_SUBST(CC_FOR_BUILD) AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CPPFLAGS_FOR_BUILD) AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(COMP_VENDOR_CFLAGS) AC_SUBST(COMP_VENDOR_CFLAGS)
@ -495,6 +524,8 @@ AC_SUBST(TESTLIBS)
AC_SUBST(SPANDSP_USE_FIXED_POINT) AC_SUBST(SPANDSP_USE_FIXED_POINT)
AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS) AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS)
AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY) AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY)
AC_SUBST(SPANDSP_SUPPORT_T42)
AC_SUBST(SPANDSP_SUPPORT_T43)
AC_SUBST(SPANDSP_SUPPORT_T85) AC_SUBST(SPANDSP_SUPPORT_T85)
AC_SUBST(SPANDSP_SUPPORT_V34) AC_SUBST(SPANDSP_SUPPORT_V34)
AC_SUBST(INSERT_INTTYPES_HEADER) AC_SUBST(INSERT_INTTYPES_HEADER)

View File

@ -357,12 +357,6 @@ MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is YES.
SHOW_DIRECTORIES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that # The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from the # doxygen should invoke to get the current version for each file (typically from the
# version control system). Doxygen will invoke the program by executing (via # version control system). Doxygen will invoke the program by executing (via
@ -635,12 +629,6 @@ HTML_FOOTER =
HTML_STYLESHEET = css.css HTML_STYLESHEET = css.css
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the GENERATE_HTMLHELP tag is set to YES, additional index files # If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the # will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
@ -1123,7 +1111,7 @@ CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES GRAPHICAL_HIERARCHY = YES
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories # then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include # in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories. # relations between the files in the directories.

View File

@ -1,5 +1,5 @@
prefix=@prefix@ prefix=@prefix@
exec_prefix=@prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
@ -7,5 +7,6 @@ Name: spandsp
Description: A DSP library for telephony. Description: A DSP library for telephony.
Requires: Requires:
Version: @VERSION@ Version: @VERSION@
Libs: -L${libdir} -lspandsp -ltiff -lm Libs: -L${libdir} -lspandsp
Libs.private: -ltiff -lm
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -1,19 +1,22 @@
Summary: A DSP library for telephony. %global pre 21
Name: spandsp
Version: 0.0.6
Release: 1
License: LGPL
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel Summary: A DSP library for telephony.
BuildRequires: audiofile-devel Name: spandsp
Version: 0.0.6
Release: 1
License: LGPLv2 and GPLv2
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.6.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel%{?_isa}
BuildRequires: libjpeg-turbo-devel%{?_isa}
BuildRequires: libxml2-devel%{?_isa}
BuildRequires: libsndfile-devel%{?_isa}
BuildRequires: doxygen BuildRequires: doxygen
# for xsltproc:
BuildRequires: libxslt BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%description %description
SpanDSP is a library of DSP functions for telephony, in the 8000 SpanDSP is a library of DSP functions for telephony, in the 8000
@ -26,49 +29,66 @@ relevant patents have expired. See the file DueDiligence for important
information about these intellectual property issues. information about these intellectual property issues.
%package devel %package devel
Summary: SpanDSP development files Summary: SpanDSP development files
Group: Development/Libraries Group: Development/Libraries
Requires: spandsp = %{version} Requires: spandsp%{?_isa} = %{version}-%{release}
Requires: libtiff-devel Requires: libtiff-devel%{?_isa}
PreReq: /sbin/install-info Requires: libjpeg-turbo-devel%{?_isa}
%description devel %description devel
SpanDSP development files. SpanDSP development files.
%package apidoc
Summary: SpanDSP API documentation
Group: Development/Libraries
%description apidoc
SpanDSP API documentation.
%prep %prep
%setup -q %setup -q
%build %build
%configure --enable-doc --disable-static --disable-rpath %configure --enable-doc --disable-static --disable-rpath
make make
find doc/api -type f | xargs touch -r configure
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
make install DESTDIR=%{buildroot} make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libspandsp.la rm %{buildroot}%{_libdir}/libspandsp.la
mkdir -p %{buildroot}%{_datadir}/spandsp
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README %doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libspandsp.so.* %{_libdir}/libspandsp.so.*
%{_datadir}/spandsp
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc doc/api
%{_includedir}/spandsp.h %{_includedir}/spandsp.h
%{_includedir}/spandsp %{_includedir}/spandsp
%{_libdir}/libspandsp.so %{_libdir}/libspandsp.so
%{_libdir}/pkgconfig/spandsp.pc %{_libdir}/pkgconfig/spandsp.pc
%files apidoc
%defattr(-,root,root,-)
%doc doc/api/html/*
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%changelog %changelog
* Mon Oct 03 2011 Steve Underwood <steveu@coppice.org> 0.0.6-1
- Converge with what Fedora do
* Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1 * Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1
- Preparing for 0.0.5pre4 release - Preparing for 0.0.5pre4 release
- License: LGPL - License: LGPL

View File

@ -1,19 +1,22 @@
Summary: A DSP library for telephony. %global pre 21
Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: LGPL
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel Summary: A DSP library for telephony.
BuildRequires: audiofile-devel Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: LGPLv2 and GPLv2
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel%{?_isa}
BuildRequires: libjpeg-turbo-devel%{?_isa}
BuildRequires: libxml2-devel%{?_isa}
BuildRequires: libsndfile-devel%{?_isa}
BuildRequires: doxygen BuildRequires: doxygen
# for xsltproc:
BuildRequires: libxslt BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%description %description
SpanDSP is a library of DSP functions for telephony, in the 8000 SpanDSP is a library of DSP functions for telephony, in the 8000
@ -26,49 +29,66 @@ relevant patents have expired. See the file DueDiligence for important
information about these intellectual property issues. information about these intellectual property issues.
%package devel %package devel
Summary: SpanDSP development files Summary: SpanDSP development files
Group: Development/Libraries Group: Development/Libraries
Requires: spandsp = %{version} Requires: spandsp%{?_isa} = %{version}-%{release}
Requires: libtiff-devel Requires: libtiff-devel%{?_isa}
PreReq: /sbin/install-info Requires: libjpeg-turbo-devel%{?_isa}
%description devel %description devel
SpanDSP development files. SpanDSP development files.
%package apidoc
Summary: SpanDSP API documentation
Group: Development/Libraries
%description apidoc
SpanDSP API documentation.
%prep %prep
%setup -q %setup -q
%build %build
%configure --enable-doc --disable-static --disable-rpath %configure --enable-doc --disable-static --disable-rpath
make make
find doc/api -type f | xargs touch -r configure
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
make install DESTDIR=%{buildroot} make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libspandsp.la rm %{buildroot}%{_libdir}/libspandsp.la
mkdir -p %{buildroot}%{_datadir}/spandsp
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README %doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libspandsp.so.* %{_libdir}/libspandsp.so.*
%{_datadir}/spandsp
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc doc/api
%{_includedir}/spandsp.h %{_includedir}/spandsp.h
%{_includedir}/spandsp %{_includedir}/spandsp
%{_libdir}/libspandsp.so %{_libdir}/libspandsp.so
%{_libdir}/pkgconfig/spandsp.pc %{_libdir}/pkgconfig/spandsp.pc
%files apidoc
%defattr(-,root,root,-)
%doc doc/api/html/*
%post -p /sbin/ldconfig %post -p /sbin/ldconfig
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%changelog %changelog
* Mon Oct 03 2011 Steve Underwood <steveu@coppice.org> 0.0.6-1
- Converge with what Fedora do
* Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1 * Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1
- Preparing for 0.0.5pre4 release - Preparing for 0.0.5pre4 release
- License: LGPL - License: LGPL

View File

@ -87,7 +87,8 @@ INCLUDES = -I$(top_builddir)
lib_LTLIBRARIES = libspandsp.la lib_LTLIBRARIES = libspandsp.la
libspandsp_la_SOURCES = adsi.c \ libspandsp_la_SOURCES = ademco_contactid.c \
adsi.c \
async.c \ async.c \
at_interpreter.c \ at_interpreter.c \
awgn.c \ awgn.c \
@ -173,7 +174,8 @@ libspandsp_la_SOURCES = adsi.c \
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS) libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
nobase_include_HEADERS = spandsp/adsi.h \ nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/adsi.h \
spandsp/async.h \ spandsp/async.h \
spandsp/arctan2.h \ spandsp/arctan2.h \
spandsp/at_interpreter.h \ spandsp/at_interpreter.h \
@ -257,6 +259,7 @@ nobase_include_HEADERS = spandsp/adsi.h \
spandsp/vector_float.h \ spandsp/vector_float.h \
spandsp/vector_int.h \ spandsp/vector_int.h \
spandsp/version.h \ spandsp/version.h \
spandsp/private/ademco_contactid.h \
spandsp/private/adsi.h \ spandsp/private/adsi.h \
spandsp/private/async.h \ spandsp/private/async.h \
spandsp/private/at_interpreter.h \ spandsp/private/at_interpreter.h \

File diff suppressed because it is too large Load Diff

View File

@ -155,6 +155,7 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ademco_contactid.c" />
<ClCompile Include="adsi.c" /> <ClCompile Include="adsi.c" />
<ClCompile Include="async.c" /> <ClCompile Include="async.c" />
<ClCompile Include="at_interpreter.c" /> <ClCompile Include="at_interpreter.c" />
@ -239,6 +240,7 @@
<ClCompile Include="msvc\gettimeofday.c" /> <ClCompile Include="msvc\gettimeofday.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="spandsp\ademco_contactid.h" />
<ClInclude Include="spandsp\adsi.h" /> <ClInclude Include="spandsp\adsi.h" />
<ClInclude Include="spandsp\async.h" /> <ClInclude Include="spandsp\async.h" />
<ClInclude Include="spandsp\arctan2.h" /> <ClInclude Include="spandsp\arctan2.h" />
@ -279,6 +281,7 @@
<ClInclude Include="spandsp\playout.h" /> <ClInclude Include="spandsp\playout.h" />
<ClInclude Include="spandsp\plc.h" /> <ClInclude Include="spandsp\plc.h" />
<ClInclude Include="spandsp\power_meter.h" /> <ClInclude Include="spandsp\power_meter.h" />
<ClInclude Include="spandsp\private\ademco_contactid.h" />
<ClInclude Include="spandsp\queue.h" /> <ClInclude Include="spandsp\queue.h" />
<ClInclude Include="spandsp\saturated.h" /> <ClInclude Include="spandsp\saturated.h" />
<ClInclude Include="spandsp\schedule.h" /> <ClInclude Include="spandsp\schedule.h" />

View File

@ -253,6 +253,12 @@
<ClCompile Include="msvc\gettimeofday.c"> <ClCompile Include="msvc\gettimeofday.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="timezone.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ademco_contactid.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="spandsp\adsi.h"> <ClInclude Include="spandsp\adsi.h">
@ -660,6 +666,14 @@
<ClInclude Include="spandsp.h"> <ClInclude Include="spandsp.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="spandsp\t4_t6_decode.h" />
<ClInclude Include="spandsp\t4_t6_encode.h" />
<ClInclude Include="spandsp\ademco_contactid.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\private\ademco_contactid.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="msvc\spandsp.h" /> <CustomBuild Include="msvc\spandsp.h" />

View File

@ -118,6 +118,7 @@
#include <spandsp/t38_terminal.h> #include <spandsp/t38_terminal.h>
#include <spandsp/t31.h> #include <spandsp/t31.h>
#include <spandsp/adsi.h> #include <spandsp/adsi.h>
#include <spandsp/ademco_contactid.h>
#include <spandsp/oki_adpcm.h> #include <spandsp/oki_adpcm.h>
#include <spandsp/ima_adpcm.h> #include <spandsp/ima_adpcm.h>
#include <spandsp/g722.h> #include <spandsp/g722.h>

View File

@ -647,9 +647,9 @@ SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int
} }
memset(s, 0, sizeof(*s)); memset(s, 0, sizeof(*s));
#if !defined(SPANDSP_USE_FIXED_POINT) #if !defined(SPANDSP_USE_FIXED_POINT)
for (j = 0; j < 2; j++) for (j = 0; j < 3; j++)
{ {
for (i = 0; i < 3; i++) for (i = 0; i < 2; i++)
{ {
s->tone[j].notch_z1[i] = 0.0f; s->tone[j].notch_z1[i] = 0.0f;
s->tone[j].notch_z2[i] = 0.0f; s->tone[j].notch_z2[i] = 0.0f;

View File

@ -33,15 +33,19 @@
@SPANDSP_USE_EXPORT_CAPABILITY@ @SPANDSP_USE_EXPORT_CAPABILITY@
@SPANDSP_SUPPORT_T42@
@SPANDSP_SUPPORT_T43@
@SPANDSP_SUPPORT_T85@
@SPANDSP_SUPPORT_V34@
#include <stdlib.h> #include <stdlib.h>
@INSERT_INTTYPES_HEADER@ @INSERT_INTTYPES_HEADER@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <time.h> #include <time.h>
@INSERT_MATH_HEADER@ @INSERT_MATH_HEADER@
#if !defined(SPANDSP_NO_TIFF)
#include <tiffio.h> #include <tiffio.h>
#endif
#include <spandsp/telephony.h> #include <spandsp/telephony.h>
#include <spandsp/fast_convert.h> #include <spandsp/fast_convert.h>
#include <spandsp/logging.h> #include <spandsp/logging.h>
@ -106,6 +110,8 @@
#include <spandsp/t4_t6_encode.h> #include <spandsp/t4_t6_encode.h>
/*#include <spandsp/t81_t82_arith_coding.h>*/ /*#include <spandsp/t81_t82_arith_coding.h>*/
/*#include <spandsp/t85.h>*/ /*#include <spandsp/t85.h>*/
/*#include <spandsp/t42.h>*/
/*#include <spandsp/t43.h>*/
#include <spandsp/t30.h> #include <spandsp/t30.h>
#include <spandsp/t30_api.h> #include <spandsp/t30_api.h>
#include <spandsp/t30_fcf.h> #include <spandsp/t30_fcf.h>
@ -120,6 +126,7 @@
#include <spandsp/t38_terminal.h> #include <spandsp/t38_terminal.h>
#include <spandsp/t31.h> #include <spandsp/t31.h>
#include <spandsp/adsi.h> #include <spandsp/adsi.h>
#include <spandsp/ademco_contactid.h>
#include <spandsp/oki_adpcm.h> #include <spandsp/oki_adpcm.h>
#include <spandsp/ima_adpcm.h> #include <spandsp/ima_adpcm.h>
#include <spandsp/g722.h> #include <spandsp/g722.h>

View File

@ -0,0 +1,365 @@
/*
* SpanDSP a series of DSP components for telephony
*
* ademco_contactid.h Ademco ContactID alarm protocol
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2012 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_ADEMCO_CONTACTID_H_)
#define _SPANDSP_ADEMCO_CONTACTID_H_
enum
{
ADEMCO_CONTACTID_MESSAGE_TYPE_18 = 0x18,
ADEMCO_CONTACTID_MESSAGE_TYPE_98 = 0x98
};
enum
{
ADEMCO_CONTACTID_QUALIFIER_NEW_EVENT = 1,
ADEMCO_CONTACTID_QUALIFIER_NEW_RESTORE = 3,
ADEMCO_CONTACTID_QUALIFIER_STATUS_REPORT = 6
};
enum
{
ADEMCO_CONTACTID_DATA_IS_ZONE = 0,
ADEMCO_CONTACTID_DATA_IS_USER = 1
};
enum
{
ADEMCO_CONTACTID_MEDICAL = 0x100,
ADEMCO_CONTACTID_PERSONAL_EMERGENCY = 0x101,
ADEMCO_CONTACTID_FAIL_TO_REPORT_IN = 0x102,
ADEMCO_CONTACTID_FIRE = 0x110,
ADEMCO_CONTACTID_SMOKE = 0x111,
ADEMCO_CONTACTID_COMBUSTION = 0x112,
ADEMCO_CONTACTID_WATER_FLOW = 0x113,
ADEMCO_CONTACTID_HEAT = 0x114,
ADEMCO_CONTACTID_PULL_STATION = 0x115,
ADEMCO_CONTACTID_DUCT = 0x116,
ADEMCO_CONTACTID_FLAME = 0x117,
ADEMCO_CONTACTID_NEAR_ALARM_A = 0x118,
ADEMCO_CONTACTID_PANIC = 0x120,
ADEMCO_CONTACTID_DURESS = 0x121,
ADEMCO_CONTACTID_SILENT = 0x122,
ADEMCO_CONTACTID_AUDIBLE = 0x123,
ADEMCO_CONTACTID_DURESS_ACCESS_GRANTED = 0x124,
ADEMCO_CONTACTID_DURESS_EGRESS_GRANTED = 0x125,
ADEMCO_CONTACTID_BURGLARY = 0x130,
ADEMCO_CONTACTID_PERIMETER = 0x131,
ADEMCO_CONTACTID_INTERIOR = 0x132,
ADEMCO_CONTACTID_24_HOUR_SAFE = 0x133,
ADEMCO_CONTACTID_ENTRY_EXIT = 0x134,
ADEMCO_CONTACTID_DAY_NIGHT = 0x135,
ADEMCO_CONTACTID_OUTDOOR = 0x136,
ADEMCO_CONTACTID_TAMPER = 0x137,
ADEMCO_CONTACTID_NEAR_ALARM_B = 0x138,
ADEMCO_CONTACTID_INTRUSION_VERIFIER = 0x139,
ADEMCO_CONTACTID_GENERAL_ALARM = 0x140,
ADEMCO_CONTACTID_POLLING_LOOP_OPEN_A = 0x141,
ADEMCO_CONTACTID_POLLING_LOOP_SHORT_A = 0x142,
ADEMCO_CONTACTID_EXPANSION_MODULE_FAILURE_A = 0x143,
ADEMCO_CONTACTID_SENSOR_TAMPER_A = 0x144,
ADEMCO_CONTACTID_EXPANSION_MODULE_TAMPER = 0x145,
ADEMCO_CONTACTID_SILENT_BURGLARY = 0x146,
ADEMCO_CONTACTID_SENSOR_SUPERVISION_FAILURE = 0x147,
ADEMCO_CONTACTID_24_HOUR_NONBURGLARY = 0x150,
ADEMCO_CONTACTID_GAS_DETECTED = 0x151,
ADEMCO_CONTACTID_REFRIGERATION = 0x152,
ADEMCO_CONTACTID_LOSS_OF_HEAT = 0x153,
ADEMCO_CONTACTID_WATER_LEAKAGE = 0x154,
ADEMCO_CONTACTID_FOIL_BREAK = 0x155,
ADEMCO_CONTACTID_DAY_TROUBLE = 0x156,
ADEMCO_CONTACTID_LOW_BOTTLED_GAS_LEVEL = 0x157,
ADEMCO_CONTACTID_HIGH_TEMP = 0x158,
ADEMCO_CONTACTID_LOW_TEMP = 0x159,
ADEMCO_CONTACTID_LOSS_OF_AIR_FLOW = 0x161,
ADEMCO_CONTACTID_CARBON_MONOXIDE_DETECTED = 0x162,
ADEMCO_CONTACTID_TANK_LEVEL = 0x163,
ADEMCO_CONTACTID_FIRE_SUPERVISORY = 0x200,
ADEMCO_CONTACTID_LOW_WATER_PRESSURE = 0x201,
ADEMCO_CONTACTID_LOW_CO2 = 0x202,
ADEMCO_CONTACTID_GATE_VALVE_SENSOR = 0x203,
ADEMCO_CONTACTID_LOW_WATER_LEVEL = 0x204,
ADEMCO_CONTACTID_PUMP_ACTIVATED = 0x205,
ADEMCO_CONTACTID_PUMP_FAILURE = 0x206,
ADEMCO_CONTACTID_SYSTEM_TROUBLE = 0x300,
ADEMCO_CONTACTID_AC_LOSS = 0x301,
ADEMCO_CONTACTID_LOW_SYSTEM_BATTERY = 0x302,
ADEMCO_CONTACTID_RAM_CHECKSUM_BAD = 0x303,
ADEMCO_CONTACTID_ROM_CHECKSUM_BAD = 0x304,
ADEMCO_CONTACTID_SYSTEM_RESET = 0x305,
ADEMCO_CONTACTID_PANEL_PROGRAMMING_CHANGED = 0x306,
ADEMCO_CONTACTID_SELFTEST_FAILURE = 0x307,
ADEMCO_CONTACTID_SYSTEM_SHUTDOWN = 0x308,
ADEMCO_CONTACTID_BATTERY_TEST_FAILURE = 0x309,
ADEMCO_CONTACTID_GROUND_FAULT = 0x310,
ADEMCO_CONTACTID_BATTERY_MISSING_DEAD = 0x311,
ADEMCO_CONTACTID_POWER_SUPPLY_OVERCURRENT = 0x312,
ADEMCO_CONTACTID_ENGINEER_RESET = 0x313,
ADEMCO_CONTACTID_SOUNDER_RELAY = 0x320,
ADEMCO_CONTACTID_BELL_1 = 0x321,
ADEMCO_CONTACTID_BELL_2 = 0x322,
ADEMCO_CONTACTID_ALARM_RELAY = 0x323,
ADEMCO_CONTACTID_TROUBLE_RELAY = 0x324,
ADEMCO_CONTACTID_REVERSING_RELAY = 0x325,
ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_3 = 0x326,
ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_4 = 0x327,
ADEMCO_CONTACTID_SYSTEM_PERIPHERAL_TROUBLE = 0x330,
ADEMCO_CONTACTID_POLLING_LOOP_OPEN_B = 0x331,
ADEMCO_CONTACTID_POLLING_LOOP_SHORT_B = 0x332,
ADEMCO_CONTACTID_EXPANSION_MODULE_FAILURE_B = 0x333,
ADEMCO_CONTACTID_REPEATER_FAILURE = 0x334,
ADEMCO_CONTACTID_LOCAL_PRINTER_OUT_OF_PAPER = 0x335,
ADEMCO_CONTACTID_LOCAL_PRINTER_FAILURE = 0x336,
ADEMCO_CONTACTID_EXP_MODULE_DC_LOSS = 0x337,
ADEMCO_CONTACTID_EXP_MODULE_LOW_BATTERY = 0x338,
ADEMCO_CONTACTID_EXP_MODULE_RESET = 0x339,
ADEMCO_CONTACTID_EXP_MODULE_TAMPER = 0x341,
ADEMCO_CONTACTID_EXP_MODULE_AC_LOSS = 0x342,
ADEMCO_CONTACTID_EXP_MODULE_SELFTEST_FAIL = 0x343,
ADEMCO_CONTACTID_RF_RECEIVER_JAM_DETECT = 0x344,
ADEMCO_CONTACTID_COMMUNICATION_TROUBLE = 0x350,
ADEMCO_CONTACTID_TELCO_1_FAULT = 0x351,
ADEMCO_CONTACTID_TELCO_2_FAULT = 0x352,
ADEMCO_CONTACTID_LONG_RANGE_RADIO_TRANSMITTER_FAULT = 0x353,
ADEMCO_CONTACTID_FAILURE_TO_COMMUNICATE_EVENT = 0x354,
ADEMCO_CONTACTID_LOSS_OF_RADIO_SUPERVISION = 0x355,
ADEMCO_CONTACTID_LOSS_OF_CENTRAL_POLLING = 0x356,
ADEMCO_CONTACTID_LONG_RANGE_RADIO_VSWR_PROBLEM = 0x357,
ADEMCO_CONTACTID_PROTECTION_LOOP = 0x370,
ADEMCO_CONTACTID_PROTECTION_LOOP_OPEN = 0x371,
ADEMCO_CONTACTID_PROTECTION_LOOP_SHORT = 0x372,
ADEMCO_CONTACTID_FIRE_TROUBLE = 0x373,
ADEMCO_CONTACTID_EXIT_ERROR_ALARM_ZONE = 0x374,
ADEMCO_CONTACTID_PANIC_ZONE_TROUBLE = 0x375,
ADEMCO_CONTACTID_HOLDUP_ZONE_TROUBLE = 0x376,
ADEMCO_CONTACTID_SWINGER_TROUBLE = 0x377,
ADEMCO_CONTACTID_CROSSZONE_TROUBLE = 0x378,
ADEMCO_CONTACTID_SENSOR_TROUBLE = 0x380,
ADEMCO_CONTACTID_LOSS_OF_SUPERVISION__RF = 0x381,
ADEMCO_CONTACTID_LOSS_OF_SUPERVISION__RPM = 0x382,
ADEMCO_CONTACTID_SENSOR_TAMPER_B = 0x383,
ADEMCO_CONTACTID_RF_LOW_BATTERY = 0x384,
ADEMCO_CONTACTID_SMOKE_DETECTOR_HIGH_SENSITIVITY = 0x385,
ADEMCO_CONTACTID_SMOKE_DETECTOR_LOW_SENSITIVITY = 0x386,
ADEMCO_CONTACTID_INTRUSION_DETECTOR_HIGH_SENSITIVITY = 0x387,
ADEMCO_CONTACTID_INTRUSION_DETECTOR_LOW_SENSITIVITY = 0x388,
ADEMCO_CONTACTID_SENSOR_SELFTEST_FAILURE = 0x389,
ADEMCO_CONTACTID_SENSOR_WATCH_TROUBLE = 0x391,
ADEMCO_CONTACTID_DRIFT_COMPENSATION_ERROR = 0x392,
ADEMCO_CONTACTID_MAINTENANCE_ALERT = 0x393,
ADEMCO_CONTACTID_OPEN_CLOSE = 0x400,
ADEMCO_CONTACTID_OC_BY_USER = 0x401,
ADEMCO_CONTACTID_GROUP_OC = 0x402,
ADEMCO_CONTACTID_AUTOMATIC_OC = 0x403,
ADEMCO_CONTACTID_LATE_TO_OC = 0x404,
ADEMCO_CONTACTID_DEFERRED_OC = 0x405,
ADEMCO_CONTACTID_CANCEL = 0x406,
ADEMCO_CONTACTID_REMOTE_ARM_DISARM = 0x407,
ADEMCO_CONTACTID_QUICK_ARM = 0x408,
ADEMCO_CONTACTID_KEYSWITCH_OC = 0x409,
ADEMCO_CONTACTID_ARMED_STAY = 0x441,
ADEMCO_CONTACTID_KEYSWITCH_ARMED_STAY = 0x442,
ADEMCO_CONTACTID_EXCEPTION_OC = 0x450,
ADEMCO_CONTACTID_EARLY_OC = 0x451,
ADEMCO_CONTACTID_LATE_OC = 0x452,
ADEMCO_CONTACTID_FAILED_TO_OPEN = 0x453,
ADEMCO_CONTACTID_FAILED_TO_CLOSE = 0x454,
ADEMCO_CONTACTID_AUTOARM_FAILED = 0x455,
ADEMCO_CONTACTID_PARTIAL_ARM = 0x456,
ADEMCO_CONTACTID_EXIT_ERROR_USER = 0x457,
ADEMCO_CONTACTID_USER_ON_PREMISES = 0x458,
ADEMCO_CONTACTID_RECENT_CLOSE = 0x459,
ADEMCO_CONTACTID_WRONG_CODE_ENTRY = 0x461,
ADEMCO_CONTACTID_LEGAL_CODE_ENTRY = 0x462,
ADEMCO_CONTACTID_REARM_AFTER_ALARM = 0x463,
ADEMCO_CONTACTID_AUTOARM_TIME_EXTENDED = 0x464,
ADEMCO_CONTACTID_PANIC_ALARM_RESET = 0x465,
ADEMCO_CONTACTID_SERVICE_ON_OFF_PREMISES = 0x466,
ADEMCO_CONTACTID_CALLBACK_REQUEST_MADE = 0x411,
ADEMCO_CONTACTID_SUCCESSFUL_DOWNLOAD_ACCESS = 0x412,
ADEMCO_CONTACTID_UNSUCCESSFUL_ACCESS = 0x413,
ADEMCO_CONTACTID_SYSTEM_SHUTDOWN_COMMAND_RECEIVED = 0x414,
ADEMCO_CONTACTID_DIALER_SHUTDOWN_COMMAND_RECEIVED = 0x415,
ADEMCO_CONTACTID_SUCCESSFUL_UPLOAD = 0x416,
ADEMCO_CONTACTID_ACCESS_DENIED = 0x421,
ADEMCO_CONTACTID_ACCESS_REPORT_BY_USER = 0x422,
ADEMCO_CONTACTID_FORCED_ACCESS = 0x423,
ADEMCO_CONTACTID_EGRESS_DENIED = 0x424,
ADEMCO_CONTACTID_EGRESS_GRANTED = 0x425,
ADEMCO_CONTACTID_ACCESS_DOOR_PROPPED_OPEN = 0x426,
ADEMCO_CONTACTID_ACCESS_POINT_DOOR_STATUS_MONITOR_TROUBLE = 0x427,
ADEMCO_CONTACTID_ACCESS_POINT_REQUEST_TO_EXIT_TROUBLE = 0x428,
ADEMCO_CONTACTID_ACCESS_PROGRAM_MODE_ENTRY = 0x429,
ADEMCO_CONTACTID_ACCESS_PROGRAM_MODE_EXIT = 0x430,
ADEMCO_CONTACTID_ACCESS_THREAT_LEVEL_CHANGE = 0x431,
ADEMCO_CONTACTID_ACCESS_RELAY_TRIGGER_FAIL = 0x432,
ADEMCO_CONTACTID_ACCESS_RTE_SHUNT = 0x433,
ADEMCO_CONTACTID_ACCESS_DSM_SHUNT = 0x434,
ADEMCO_CONTACTID_ACCESS_READER_DISABLE = 0x501,
ADEMCO_CONTACTID_SOUNDER_RELAY_DISABLE = 0x520,
ADEMCO_CONTACTID_BELL_1_DISABLE = 0x521,
ADEMCO_CONTACTID_BELL_2_DISABLE = 0x522,
ADEMCO_CONTACTID_ALARM_RELAY_DISABLE = 0x523,
ADEMCO_CONTACTID_TROUBLE_RELAY_DISABLE = 0x524,
ADEMCO_CONTACTID_REVERSING_RELAY_DISABLE = 0x525,
ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_3_DISABLE = 0x526,
ADEMCO_CONTACTID_NOTIFICATION_APPLIANCE_CKT_4_DISABLE = 0x527,
ADEMCO_CONTACTID_MODULE_ADDED = 0x531,
ADEMCO_CONTACTID_MODULE_REMOVED = 0x532,
ADEMCO_CONTACTID_DIALER_DISABLED = 0x551,
ADEMCO_CONTACTID_RADIO_TRANSMITTER_DISABLED = 0x552,
ADEMCO_CONTACTID_REMOTE_UPLOAD_DOWNLOAD_DISABLED = 0x553,
ADEMCO_CONTACTID_ZONE_SENSOR_BYPASS = 0x570,
ADEMCO_CONTACTID_FIRE_BYPASS = 0x571,
ADEMCO_CONTACTID_24_HOUR_ZONE_BYPASS = 0x572,
ADEMCO_CONTACTID_BURG_BYPASS = 0x573,
ADEMCO_CONTACTID_GROUP_BYPASS = 0x574,
ADEMCO_CONTACTID_SWINGER_BYPASS = 0x575,
ADEMCO_CONTACTID_ACCESS_ZONE_SHUNT = 0x576,
ADEMCO_CONTACTID_ACCESS_POINT_BYPASS = 0x577,
ADEMCO_CONTACTID_MANUAL_TRIGGER_TEST_REPORT = 0x601,
ADEMCO_CONTACTID_PERIODIC_TEST_REPORT = 0x602,
ADEMCO_CONTACTID_PERIODIC_RF_TRANSMISSION = 0x603,
ADEMCO_CONTACTID_FIRE_TEST = 0x604,
ADEMCO_CONTACTID_STATUS_REPORT_TO_FOLLOW = 0x605,
ADEMCO_CONTACTID_LISTENIN_TO_FOLLOW = 0x606,
ADEMCO_CONTACTID_WALK_TEST_MODE = 0x607,
ADEMCO_CONTACTID_PERIODIC_TEST__SYSTEM_TROUBLE_PRESENT = 0x608,
ADEMCO_CONTACTID_VIDEO_TRANSMITTER_ACTIVE = 0x609,
ADEMCO_CONTACTID_POINT_TESTED_OK = 0x611,
ADEMCO_CONTACTID_POINT_NOT_TESTED = 0x612,
ADEMCO_CONTACTID_INTRUSION_ZONE_WALK_TESTED = 0x613,
ADEMCO_CONTACTID_FIRE_ZONE_WALK_TESTED = 0x614,
ADEMCO_CONTACTID_PANIC_ZONE_WALK_TESTED = 0x615,
ADEMCO_CONTACTID_SERVICE_REQUEST = 0x616,
ADEMCO_CONTACTID_EVENT_LOG_RESET = 0x621,
ADEMCO_CONTACTID_EVENT_LOG_50PC_FULL = 0x622,
ADEMCO_CONTACTID_EVENT_LOG_90PC_FULL = 0x623,
ADEMCO_CONTACTID_EVENT_LOG_OVERFLOW = 0x624,
ADEMCO_CONTACTID_TIME_DATE_RESET = 0x625,
ADEMCO_CONTACTID_TIME_DATE_INACCURATE = 0x626,
ADEMCO_CONTACTID_PROGRAM_MODE_ENTRY = 0x627,
ADEMCO_CONTACTID_PROGRAM_MODE_EXIT = 0x628,
ADEMCO_CONTACTID_32_HOUR_EVENT_LOG_MARKER = 0x629,
ADEMCO_CONTACTID_SCHEDULE_CHANGE = 0x630,
ADEMCO_CONTACTID_EXCEPTION_SCHEDULE_CHANGE = 0x631,
ADEMCO_CONTACTID_ACCESS_SCHEDULE_CHANGE = 0x632,
ADEMCO_CONTACTID_SENIOR_WATCH_TROUBLE = 0x641,
ADEMCO_CONTACTID_LATCHKEY_SUPERVISION = 0x642,
ADEMCO_CONTACTID_RESERVED_FOR_ADEMCO_USE_1 = 0x651,
ADEMCO_CONTACTID_RESERVED_FOR_ADEMCO_USE_2 = 0x652,
ADEMCO_CONTACTID_RESERVED_FOR_ADEMCO_USE_3 = 0x653,
ADEMCO_CONTACTID_SYSTEM_INACTIVITY = 0x654,
ADEMCO_CONTACTID_DOWNLOAD_ABORT = 0x900,
ADEMCO_CONTACTID_DOWNLOAD_START_END = 0x901,
ADEMCO_CONTACTID_DOWNLOAD_INTERRUPTED = 0x902,
ADEMCO_CONTACTID_AUTOCLOSE_WITH_BYPASS = 0x910,
ADEMCO_CONTACTID_BYPASS_CLOSING = 0x911,
ADEMCO_CONTACTID_32_HOUR_NO_READ_OF_EVENT_LOG = 0x999
};
typedef struct ademco_contactid_sender_state_s ademco_contactid_sender_state_t;
typedef struct ademco_contactid_receiver_state_s ademco_contactid_receiver_state_t;
typedef struct
{
int acct;
int mt;
int q;
int xyz;
int gg;
int ccc;
} ademco_contactid_report_t;
typedef void (*ademco_contactid_report_func_t)(void *user_data, const ademco_contactid_report_t *report);
#if defined(__cplusplus)
extern "C"
{
#endif
SPAN_DECLARE(const char *) ademco_contactid_msg_qualifier_to_str(int q);
SPAN_DECLARE(const char *) ademco_contactid_event_to_str(int xyz);
SPAN_DECLARE(int) encode_msg(char buf[], const ademco_contactid_report_t *report);
SPAN_DECLARE(int) decode_msg(ademco_contactid_report_t *report, const char buf[]);
SPAN_DECLARE(int) ademco_contactid_receiver_log_msg(ademco_contactid_receiver_state_t *s, const ademco_contactid_report_t *report);
SPAN_DECLARE(int) ademco_contactid_receiver_tx(ademco_contactid_receiver_state_t *s, int16_t amp[], int max_samples);
SPAN_DECLARE(int) ademco_contactid_receiver_rx(ademco_contactid_receiver_state_t *s, const int16_t amp[], int samples);
SPAN_DECLARE(int) ademco_contactid_receiver_fillin(ademco_contactid_receiver_state_t *s, int samples);
SPAN_DECLARE(logging_state_t *) ademco_contactid_receiver_get_logging_state(ademco_contactid_receiver_state_t *s);
SPAN_DECLARE(void) ademco_contactid_receiver_set_realtime_callback(ademco_contactid_receiver_state_t *s,
ademco_contactid_report_func_t callback,
void *user_data);
SPAN_DECLARE(ademco_contactid_receiver_state_t *) ademco_contactid_receiver_init(ademco_contactid_receiver_state_t *s,
ademco_contactid_report_func_t callback,
void *user_data);
SPAN_DECLARE(int) ademco_contactid_receiver_release(ademco_contactid_receiver_state_t *s);
SPAN_DECLARE(int) ademco_contactid_receiver_free(ademco_contactid_receiver_state_t *s);
SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s, int16_t amp[], int max_samples);
SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s, const int16_t amp[], int samples);
SPAN_DECLARE(int) ademco_contactid_sender_fillin(ademco_contactid_sender_state_t *s, int samples);
SPAN_DECLARE(int) ademco_contactid_sender_put(ademco_contactid_sender_state_t *s, const ademco_contactid_report_t *report);
SPAN_DECLARE(logging_state_t *) ademco_contactid_sender_get_logging_state(ademco_contactid_sender_state_t *s);
SPAN_DECLARE(void) ademco_contactid_sender_set_realtime_callback(ademco_contactid_sender_state_t *s,
tone_report_func_t callback,
void *user_data);
SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ademco_contactid_sender_state_t *s,
tone_report_func_t callback,
void *user_data);
SPAN_DECLARE(int) ademco_contactid_sender_release(ademco_contactid_sender_state_t *s);
SPAN_DECLARE(int) ademco_contactid_sender_free(ademco_contactid_sender_state_t *s);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -93,6 +93,7 @@
#include <spandsp/private/t31.h> #include <spandsp/private/t31.h>
#include <spandsp/private/v18.h> #include <spandsp/private/v18.h>
#include <spandsp/private/adsi.h> #include <spandsp/private/adsi.h>
#include <spandsp/private/ademco_contactid.h>
#endif #endif
/*- End of file ------------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/

View File

@ -0,0 +1,95 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* private/ademco_contactid.h - Ademco ContactID alarm protocol
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2012 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_)
#define _SPANDSP_PRIVATE_ADEMCO_CONTACTID_H_
struct ademco_contactid_receiver_state_s
{
ademco_contactid_report_func_t callback;
void *callback_user_data;
int step;
int remaining_samples;
uint32_t tone_phase;
int32_t tone_phase_rate;
int16_t tone_level;
dtmf_rx_state_t dtmf;
char rx_digits[16 + 1];
int rx_digits_len;
/*! \brief Error and flow logging control */
logging_state_t logging;
};
struct ademco_contactid_sender_state_s
{
tone_report_func_t callback;
void *callback_user_data;
int step;
int remaining_samples;
dtmf_tx_state_t dtmf;
#if defined(SPANDSP_USE_FIXED_POINT)
/*! Minimum acceptable tone level for detection. */
int32_t threshold;
/*! The accumlating total energy on the same period over which the Goertzels work. */
int32_t energy;
#else
/*! Minimum acceptable tone level for detection. */
float threshold;
/*! The accumlating total energy on the same period over which the Goertzels work. */
float energy;
#endif
goertzel_state_t tone_1400;
goertzel_state_t tone_2300;
/*! The current sample number within a processing block. */
int current_sample;
/*! \brief A buffer to save the sent message, in case we need to retry. */
char tx_digits[16 + 1];
int tx_digits_len;
/*! \brief The number of consecutive retries. */
int tries;
int tone_state;
int duration;
int last_hit;
int in_tone;
int clear_to_send;
int timer;
int busy;
/*! \brief Error and flow logging control */
logging_state_t logging;
};
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -2534,7 +2534,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
we sent - which would have been a T30_MCF - If the block is for the previous we sent - which would have been a T30_MCF - If the block is for the previous
page, or the previous block of the current page, we can assume we have hit this page, or the previous block of the current page, we can assume we have hit this
condition. */ condition. */
if (((s->rx_page_number & 0xFF) == page && (s->ecm_block & 0xFF) == block) if (((s->rx_page_number & 0xFF) == page && ((s->ecm_block - 1) & 0xFF) == block)
|| ||
(((s->rx_page_number - 1) & 0xFF) == page && s->ecm_block == 0)) (((s->rx_page_number - 1) & 0xFF) == page && s->ecm_block == 0))
{ {
@ -2568,7 +2568,6 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
{ {
frame_no = (i << 3) + j; frame_no = (i << 3) + j;
#if defined(VET_ALL_FCD_FRAMES)
if (s->ecm_len[frame_no] >= 0) if (s->ecm_len[frame_no] >= 0)
{ {
/* The correct pattern of frame lengths is they will all be 64 or 256 octets long, except the /* The correct pattern of frame lengths is they will all be 64 or 256 octets long, except the
@ -2598,7 +2597,6 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len)
} }
} }
} }
#endif
if (s->ecm_len[frame_no] < 0) if (s->ecm_len[frame_no] < 0)
{ {
s->ecm_frame_map[i + 3] |= (1 << j); s->ecm_frame_map[i + 3] |= (1 << j);

View File

@ -383,7 +383,6 @@ static void hdlc_underflow_handler(void *user_data)
{ {
t38_gateway_state_t *s; t38_gateway_state_t *s;
t38_gateway_hdlc_state_t *t; t38_gateway_hdlc_state_t *t;
int old_data_type;
s = (t38_gateway_state_t *) user_data; s = (t38_gateway_state_t *) user_data;
t = &s->core.hdlc_to_modem; t = &s->core.hdlc_to_modem;
@ -392,7 +391,6 @@ static void hdlc_underflow_handler(void *user_data)
underflow must be an end of preamble condition. */ underflow must be an end of preamble condition. */
if ((t->buf[t->out].flags & HDLC_FLAG_PROCEED_WITH_OUTPUT)) if ((t->buf[t->out].flags & HDLC_FLAG_PROCEED_WITH_OUTPUT))
{ {
old_data_type = t->buf[t->out].contents;
t->buf[t->out].len = 0; t->buf[t->out].len = 0;
t->buf[t->out].flags = 0; t->buf[t->out].flags = 0;
t->buf[t->out].contents = 0; t->buf[t->out].contents = 0;
@ -2117,6 +2115,7 @@ static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit)
static int restart_rx_modem(t38_gateway_state_t *s) static int restart_rx_modem(t38_gateway_state_t *s)
{ {
fax_modems_state_t *t;
put_bit_func_t put_bit_func; put_bit_func_t put_bit_func;
void *put_bit_user_data; void *put_bit_user_data;
@ -2138,19 +2137,20 @@ static int restart_rx_modem(t38_gateway_state_t *s)
s->core.short_train, s->core.short_train,
s->core.ecm_mode); s->core.ecm_mode);
hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s); t = &s->audio.modems;
s->audio.modems.rx_signal_present = FALSE; hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s);
s->audio.modems.rx_trained = FALSE; t->rx_signal_present = FALSE;
t->rx_trained = FALSE;
/* Default to the transmit data being V.21, unless a faster modem pops up trained. */ /* Default to the transmit data being V.21, unless a faster modem pops up trained. */
s->t38x.current_tx_data_type = T38_DATA_V21; s->t38x.current_tx_data_type = T38_DATA_V21;
fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx)); fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &t->hdlc_rx);
#if 0 #if 0
fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -45.5f); fsk_rx_signal_cutoff(&t->v21_rx, -45.5f);
#endif #endif
if (s->core.image_data_mode && s->core.ecm_mode) if (s->core.image_data_mode && s->core.ecm_mode)
{ {
put_bit_func = (put_bit_func_t) t38_hdlc_rx_put_bit; put_bit_func = (put_bit_func_t) t38_hdlc_rx_put_bit;
put_bit_user_data = (void *) &(s->audio.modems.hdlc_rx); put_bit_user_data = (void *) &t->hdlc_rx;
} }
else else
{ {
@ -2166,26 +2166,26 @@ static int restart_rx_modem(t38_gateway_state_t *s)
s->core.to_t38.octets_per_data_packet = 1; s->core.to_t38.octets_per_data_packet = 1;
switch (s->core.fast_rx_modem) switch (s->core.fast_rx_modem)
{ {
case FAX_MODEM_V17_RX:
v17_rx_restart(&s->audio.modems.fast_modems.v17_rx, s->core.fast_bit_rate, s->core.short_train);
v17_rx_set_put_bit(&s->audio.modems.fast_modems.v17_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V17_RX;
break;
case FAX_MODEM_V27TER_RX: case FAX_MODEM_V27TER_RX:
v27ter_rx_restart(&s->audio.modems.fast_modems.v27ter_rx, s->core.fast_bit_rate, FALSE); v27ter_rx_restart(&t->fast_modems.v27ter_rx, s->core.fast_bit_rate, FALSE);
v27ter_rx_set_put_bit(&s->audio.modems.fast_modems.v27ter_rx, put_bit_func, put_bit_user_data); v27ter_rx_set_put_bit(&t->fast_modems.v27ter_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v27ter_v21_rx, &v27ter_v21_rx_fillin, s); set_rx_handler(s, &v27ter_v21_rx, &v27ter_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V27TER_RX; s->core.fast_rx_active = FAX_MODEM_V27TER_RX;
break; break;
case FAX_MODEM_V29_RX: case FAX_MODEM_V29_RX:
v29_rx_restart(&s->audio.modems.fast_modems.v29_rx, s->core.fast_bit_rate, FALSE); v29_rx_restart(&t->fast_modems.v29_rx, s->core.fast_bit_rate, FALSE);
v29_rx_set_put_bit(&s->audio.modems.fast_modems.v29_rx, put_bit_func, put_bit_user_data); v29_rx_set_put_bit(&t->fast_modems.v29_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v29_v21_rx, &v29_v21_rx_fillin, s); set_rx_handler(s, &v29_v21_rx, &v29_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V29_RX; s->core.fast_rx_active = FAX_MODEM_V29_RX;
break; break;
case FAX_MODEM_V17_RX:
v17_rx_restart(&t->fast_modems.v17_rx, s->core.fast_bit_rate, s->core.short_train);
v17_rx_set_put_bit(&t->fast_modems.v17_rx, put_bit_func, put_bit_user_data);
set_rx_handler(s, &v17_v21_rx, &v17_v21_rx_fillin, s);
s->core.fast_rx_active = FAX_MODEM_V17_RX;
break;
default: default:
set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &(s->audio.modems.v21_rx)); set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx);
s->core.fast_rx_active = FAX_MODEM_NONE; s->core.fast_rx_active = FAX_MODEM_NONE;
break; break;
} }

View File

@ -152,9 +152,12 @@ enum
T38_TIMED_STEP_NO_SIGNAL = 0x60 T38_TIMED_STEP_NO_SIGNAL = 0x60
}; };
static __inline__ void front_end_status(t38_terminal_state_t *s, int status) static __inline__ int front_end_status(t38_terminal_state_t *s, int status)
{ {
t30_front_end_status(&s->t30, status); t30_front_end_status(&s->t30, status);
if (s->t38_fe.timed_step == T38_TIMED_STEP_NONE)
return -1;
return 0;
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/
@ -749,6 +752,9 @@ static int stream_non_ecm(t38_terminal_state_t *s)
contain data. Hopefully, following the current spec will not cause compatibility contain data. Hopefully, following the current spec will not cause compatibility
issues. */ issues. */
len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet); len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet);
if (len < 0)
return -1;
/*endif*/
if (len > 0) if (len > 0)
bit_reverse(buf, buf, len); bit_reverse(buf, buf, len);
/*endif*/ /*endif*/
@ -776,7 +782,8 @@ static int stream_non_ecm(t38_terminal_state_t *s)
return res; return res;
/*endif*/ /*endif*/
fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
break; break;
} }
/*endif*/ /*endif*/
@ -806,7 +813,8 @@ static int stream_non_ecm(t38_terminal_state_t *s)
if (fe->us_per_tx_chunk) if (fe->us_per_tx_chunk)
delay = bits_to_us(s, 8*len) + 60000; delay = bits_to_us(s, 8*len) + 60000;
/*endif*/ /*endif*/
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
break; break;
} }
/*endif*/ /*endif*/
@ -910,7 +918,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
previous = fe->current_tx_data_type; previous = fe->current_tx_data_type;
fe->hdlc_tx.ptr = 0; fe->hdlc_tx.ptr = 0;
fe->hdlc_tx.len = 0; fe->hdlc_tx.len = 0;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */ /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
if (fe->hdlc_tx.len >= 0) if (fe->hdlc_tx.len >= 0)
{ {
@ -940,7 +949,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
if (fe->us_per_tx_chunk) if (fe->us_per_tx_chunk)
delay += 100000; delay += 100000;
/*endif*/ /*endif*/
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
} }
/*endif*/ /*endif*/
break; break;
@ -969,7 +979,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
previous = fe->current_tx_data_type; previous = fe->current_tx_data_type;
fe->hdlc_tx.ptr = 0; fe->hdlc_tx.ptr = 0;
fe->hdlc_tx.len = 0; fe->hdlc_tx.len = 0;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */ /* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
if (fe->hdlc_tx.len >= 0) if (fe->hdlc_tx.len >= 0)
{ {
@ -1003,7 +1014,8 @@ static int stream_hdlc(t38_terminal_state_t *s)
if (fe->us_per_tx_chunk) if (fe->us_per_tx_chunk)
delay += 100000; delay += 100000;
/*endif*/ /*endif*/
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
} }
/*endif*/ /*endif*/
break; break;
@ -1059,7 +1071,8 @@ static int stream_ced(t38_terminal_state_t *s)
case T38_TIMED_STEP_CED_3: case T38_TIMED_STEP_CED_3:
/* End of CED */ /* End of CED */
fe->timed_step = fe->queued_timed_step; fe->timed_step = fe->queued_timed_step;
front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
return 0; return 0;
} }
/*endswitch*/ /*endswitch*/

View File

@ -112,9 +112,11 @@ static const int year_lengths[2] =
DAYS_PER_LEAP_YEAR DAYS_PER_LEAP_YEAR
}; };
static int increment_overflow(int *number, int delta) static int add_with_overflow_detection(int *number, int delta)
{ {
int last_number; /* This needs to be considered volatile, or clever optimisation destroys
the effect of the the rollover detection logic */
volatile int last_number;
last_number = *number; last_number = *number;
*number += delta; *number += delta;
@ -209,7 +211,7 @@ static struct tm *time_sub(const time_t * const timep, const long int offset, co
if (idelta == 0) if (idelta == 0)
idelta = (tdays < 0) ? -1 : 1; idelta = (tdays < 0) ? -1 : 1;
newy = y; newy = y;
if (increment_overflow(&newy, idelta)) if (add_with_overflow_detection(&newy, idelta))
return NULL; return NULL;
leapdays = leaps_thru_end_of(newy - 1) - leaps_thru_end_of(y - 1); leapdays = leaps_thru_end_of(newy - 1) - leaps_thru_end_of(y - 1);
tdays -= ((time_t) newy - y)*DAYS_PER_NON_LEAP_YEAR; tdays -= ((time_t) newy - y)*DAYS_PER_NON_LEAP_YEAR;
@ -234,18 +236,18 @@ static struct tm *time_sub(const time_t * const timep, const long int offset, co
} }
while (idays < 0) while (idays < 0)
{ {
if (increment_overflow(&y, -1)) if (add_with_overflow_detection(&y, -1))
return NULL; return NULL;
idays += year_lengths[isleap(y)]; idays += year_lengths[isleap(y)];
} }
while (idays >= year_lengths[isleap(y)]) while (idays >= year_lengths[isleap(y)])
{ {
idays -= year_lengths[isleap(y)]; idays -= year_lengths[isleap(y)];
if (increment_overflow(&y, 1)) if (add_with_overflow_detection(&y, 1))
return NULL; return NULL;
} }
tmp->tm_year = y; tmp->tm_year = y;
if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE)) if (add_with_overflow_detection(&tmp->tm_year, -TM_YEAR_BASE))
return NULL; return NULL;
tmp->tm_yday = idays; tmp->tm_yday = idays;
/* The "extra" mods below avoid overflow problems. */ /* The "extra" mods below avoid overflow problems. */

View File

@ -567,9 +567,11 @@ SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch)
static void v18_rx_dtmf(void *user_data, const char digits[], int len) static void v18_rx_dtmf(void *user_data, const char digits[], int len)
{ {
#if 0
v18_state_t *s; v18_state_t *s;
s = (v18_state_t *) user_data; s = (v18_state_t *) user_data;
#endif
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/

View File

@ -124,7 +124,7 @@ SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function)
case V8_CALL_FUNCTION_EXTENSION: case V8_CALL_FUNCTION_EXTENSION:
return "Call function is in extension octet"; return "Call function is in extension octet";
} }
return "???"; return "Unknown call function";
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/
@ -199,7 +199,7 @@ SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access)
case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR: case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR:
return "DCE on digital, and answering and calling modems on cellular"; return "DCE on digital, and answering and calling modems on cellular";
} }
return "???"; return "PSTN access unknown";
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/
@ -235,7 +235,7 @@ SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availa
case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE: case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE:
return "V.91 and V.90/V.92 digital/analogue available"; return "V.91 and V.90/V.92 digital/analogue available";
} }
return "???"; return "PCM availability unknown";
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/
@ -374,6 +374,7 @@ static const uint8_t *process_pstn_access(v8_state_t *s, const uint8_t *p)
static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p) static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p)
{ {
/* TODO: This is wrong */
s->result.nsf = (*p >> 5) & 0x07; s->result.nsf = (*p >> 5) & 0x07;
span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_nsf_to_str(s->result.nsf)); span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_nsf_to_str(s->result.nsf));
return p; return p;

View File

@ -50,7 +50,8 @@ INCLUDES = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$(pk
LIBDIR = -L$(top_builddir)/src LIBDIR = -L$(top_builddir)/src
noinst_PROGRAMS = adsi_tests \ noinst_PROGRAMS = ademco_contactid_tests \
adsi_tests \
async_tests \ async_tests \
at_interpreter_tests \ at_interpreter_tests \
awgn_tests \ awgn_tests \
@ -134,6 +135,9 @@ noinst_HEADERS = echo_monitor.h \
pcap_parse.h \ pcap_parse.h \
udptl.h udptl.h
ademco_contactid_tests_SOURCES = ademco_contactid_tests.c
ademco_contactid_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
adsi_tests_SOURCES = adsi_tests.c adsi_tests_SOURCES = adsi_tests.c
adsi_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp adsi_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp

View File

@ -0,0 +1,391 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* ademco_contactid.c - Ademco ContactID alarm protocol
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2012 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \page ademco_contactid_tests_page Ademco ContactID tests
\section ademco_contactid_tests_page_sec_1 What does it do?
\section ademco_contactid_tests_page_sec_2 How does it work?
*/
/* Enable the following definition to enable direct probing into the FAX structures */
//#define WITH_SPANDSP_INTERNALS
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <sndfile.h>
//#if defined(WITH_SPANDSP_INTERNALS)
//#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
//#endif
#include "spandsp.h"
#include "spandsp-sim.h"
#define SAMPLES_PER_CHUNK 160
#define OUTPUT_FILE_NAME "ademco_contactid.wav"
#define MITEL_DIR "../test-data/mitel/"
#define BELLCORE_DIR "../test-data/bellcore/"
const char *bellcore_files[] =
{
MITEL_DIR "mitel-cm7291-talkoff.wav",
BELLCORE_DIR "tr-tsy-00763-1.wav",
BELLCORE_DIR "tr-tsy-00763-2.wav",
BELLCORE_DIR "tr-tsy-00763-3.wav",
BELLCORE_DIR "tr-tsy-00763-4.wav",
BELLCORE_DIR "tr-tsy-00763-5.wav",
BELLCORE_DIR "tr-tsy-00763-6.wav",
""
};
static const ademco_contactid_report_t reports[] =
{
{0x1234, 0x18, 0x1, 0x131, 0x1, 0x15},
{0x1234, 0x18, 0x3, 0x131, 0x1, 0x15},
{0x1234, 0x18, 0x1, 0x401, 0x2, 0x3},
{0x1234, 0x18, 0x3, 0x401, 0x3, 0x5},
{0x1234, 0x56, 0x7, 0x890, 0xBC, 0xDEF},
{0x1234, 0x56, 0x7, 0x89A, 0xBC, 0xDEF} /* This one is bad, as it contains a hex 'A' */
};
static int reports_entry = 0;
static int16_t amp[1000000];
int tx_callback_reported = FALSE;
int rx_callback_reported = FALSE;
int sending_complete = FALSE;
SNDFILE *outhandle;
static void talkoff_tx_callback(void *user_data, int tone, int level, int duration)
{
printf("Ademco sender report %d\n", tone);
tx_callback_reported = TRUE;
}
static int mitel_cm7291_side_2_and_bellcore_tests(void)
{
int j;
SNDFILE *inhandle;
int frames;
ademco_contactid_sender_state_t *sender;
logging_state_t *logging;
if ((sender = ademco_contactid_sender_init(NULL, talkoff_tx_callback, NULL)) == NULL)
return -1;
logging = ademco_contactid_sender_get_logging_state(sender);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "Ademco-tx");
tx_callback_reported = FALSE;
/* The remainder of the Mitel tape is the talk-off test */
/* Here we use the Bellcore test tapes (much tougher), in six
files - 1 from each side of the original 3 cassette tapes */
/* Bellcore say you should get no more than 470 false detections with
a good receiver. Dialogic claim 20. Of course, we can do better than
that, eh? */
printf("Talk-off test\n");
for (j = 0; bellcore_files[j][0]; j++)
{
if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
{
printf(" Cannot open speech file '%s'\n", bellcore_files[j]);
return -1;
}
while ((frames = sf_readf_short(inhandle, amp, SAMPLE_RATE)))
{
ademco_contactid_sender_rx(sender, amp, frames);
}
if (sf_close_telephony(inhandle))
{
printf(" Cannot close speech file '%s'\n", bellcore_files[j]);
return -1;
}
printf(" File %d gave %d false hits.\n", j + 1, 0);
}
if (tx_callback_reported)
{
printf(" Failed\n");
return -1;
}
printf(" Passed\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
static void rx_callback(void *user_data, const ademco_contactid_report_t *report)
{
printf("Ademco Contact ID message:\n");
printf(" Account %X\n", report->acct);
printf(" Message type %X\n", report->mt);
printf(" Qualifier %X\n", report->q);
printf(" Event %X\n", report->xyz);
printf(" Group/partition %X\n", report->gg);
printf(" User/Zone information %X\n", report->ccc);
if (memcmp(&reports[reports_entry], report, sizeof (*report)))
{
printf("Report mismatch\n");
exit(2);
}
rx_callback_reported = TRUE;
}
/*- End of function --------------------------------------------------------*/
static void tx_callback(void *user_data, int tone, int level, int duration)
{
ademco_contactid_sender_state_t *sender;
sender = (ademco_contactid_sender_state_t *) user_data;
printf("Ademco sender report %d\n", tone);
switch (tone)
{
case -1:
/* We are connected and ready to send */
ademco_contactid_sender_put(sender, &reports[reports_entry]);
break;
case 1:
/* We have succeeded in sending, and are ready to send another message. */
if (++reports_entry < 5)
ademco_contactid_sender_put(sender, &reports[reports_entry]);
else
sending_complete = TRUE;
break;
case 0:
/* Sending failed after retries */
sending_complete = TRUE;
break;
}
}
/*- End of function --------------------------------------------------------*/
static int end_to_end_tests(void)
{
ademco_contactid_receiver_state_t *receiver;
ademco_contactid_sender_state_t *sender;
logging_state_t *logging;
codec_munge_state_t *munge;
awgn_state_t noise_source;
int16_t amp[SAMPLES_PER_CHUNK];
int16_t sndfile_buf[2*SAMPLES_PER_CHUNK];
int samples;
int i;
int j;
printf("End to end tests\n");
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL)
{
fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME);
exit(2);
}
if ((receiver = ademco_contactid_receiver_init(NULL, rx_callback, NULL)) == NULL)
return -1;
ademco_contactid_receiver_set_realtime_callback(receiver, rx_callback, receiver);
logging = ademco_contactid_receiver_get_logging_state(receiver);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "Ademco-rx");
if ((sender = ademco_contactid_sender_init(NULL, tx_callback, NULL)) == NULL)
return -1;
ademco_contactid_sender_set_realtime_callback(sender, tx_callback, sender);
logging = ademco_contactid_sender_get_logging_state(sender);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "Ademco-tx");
awgn_init_dbm0(&noise_source, 1234567, -50);
munge = codec_munge_init(MUNGE_CODEC_ALAW, 0);
sending_complete = FALSE;
rx_callback_reported = FALSE;
for (i = 0; i < 1000; i++)
{
samples = ademco_contactid_sender_tx(sender, amp, SAMPLES_PER_CHUNK);
for (j = samples; j < SAMPLES_PER_CHUNK; j++)
amp[j] = 0;
for (j = 0; j < SAMPLES_PER_CHUNK; j++)
sndfile_buf[2*j] = amp[j];
/* There is no point in impairing this signal. It is just DTMF tones, which
will work as wel as the DTMF detector beign used. */
ademco_contactid_receiver_rx(receiver, amp, SAMPLES_PER_CHUNK);
samples = ademco_contactid_receiver_tx(receiver, amp, SAMPLES_PER_CHUNK);
for (j = samples; j < SAMPLES_PER_CHUNK; j++)
amp[j] = 0;
/* We add AWGN and codec impairments to the signal, to stress the tone detector. */
codec_munge(munge, amp, SAMPLES_PER_CHUNK);
for (j = 0; j < SAMPLES_PER_CHUNK; j++)
{
sndfile_buf[2*j + 1] = amp[j];
/* Add noise to the tones */
amp[j] += awgn(&noise_source);
}
codec_munge(munge, amp, SAMPLES_PER_CHUNK);
ademco_contactid_sender_rx(sender, amp, SAMPLES_PER_CHUNK);
sf_writef_short(outhandle, sndfile_buf, SAMPLES_PER_CHUNK);
}
if (!rx_callback_reported)
{
fprintf(stderr, " Report not received\n");
return -1;
}
if (sf_close_telephony(outhandle))
{
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
return -1;
}
printf(" Passed\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
static int encode_decode_tests(void)
{
char buf[100];
ademco_contactid_receiver_state_t *receiver;
ademco_contactid_sender_state_t *sender;
logging_state_t *logging;
ademco_contactid_report_t result;
int i;
printf("Encode and decode tests\n");
if ((receiver = ademco_contactid_receiver_init(NULL, NULL, NULL)) == NULL)
return 2;
logging = ademco_contactid_receiver_get_logging_state(receiver);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "Ademco-rx");
if ((sender = ademco_contactid_sender_init(NULL, NULL, NULL)) == NULL)
return 2;
logging = ademco_contactid_sender_get_logging_state(sender);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "Ademco-tx");
for (i = 0; i < 5; i++)
{
if (encode_msg(buf, &reports[i]) < 0)
{
printf("Bad encode message\n");
return -1;
}
printf("'%s'\n", buf);
if (decode_msg(&result, buf))
{
printf("Bad decode message\n");
return -1;
}
ademco_contactid_receiver_log_msg(receiver, &result);
printf("\n");
if (memcmp(&reports[i], &result, sizeof(result)))
{
printf("Received message does not match the one sent\n");
return -1;
}
}
if (encode_msg(buf, &reports[5]) >= 0)
{
printf("Incorrectly good message\n");
return -1;
}
printf("'%s'\n", buf);
printf("\n");
printf(" Passed\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
static void decode_file(const char *file)
{
//SPAN_DECLARE(int) decode_msg(ademco_contactid_report_t *report, const char buf[])
}
/*- End of function --------------------------------------------------------*/
int main(int argc, char *argv[])
{
int opt;
const char *decode_test_file;
decode_test_file = NULL;
while ((opt = getopt(argc, argv, "d:")) != -1)
{
switch (opt)
{
case 'd':
decode_test_file = optarg;
break;
default:
//usage();
exit(2);
break;
}
}
if (decode_test_file)
{
decode_file(decode_test_file);
return 0;
}
if (encode_decode_tests())
{
printf("Tests failed\n");
return 2;
}
if (mitel_cm7291_side_2_and_bellcore_tests())
{
printf("Tests failed\n");
return 2;
}
if (end_to_end_tests())
{
printf("Tests failed\n");
return 2;
}
printf("Tests passed\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -633,20 +633,20 @@ static int perform_test_sanity(void)
int16_t tx; int16_t tx;
int16_t clean; int16_t clean;
int far_tx; int far_tx;
int16_t far_sound[SAMPLE_RATE]; //int16_t far_sound[SAMPLE_RATE];
int16_t result_sound[64000]; int16_t result_sound[64000];
int result_cur; int result_cur;
int outframes; int outframes;
int local_cur; //int local_cur;
int far_cur; //int far_cur;
//int32_t coeffs[200][128]; //int32_t coeffs[200][128];
//int coeff_index; //int coeff_index;
print_test_title("Performing basic sanity test\n"); print_test_title("Performing basic sanity test\n");
ctx = echo_can_init(TEST_EC_TAPS, 0); ctx = echo_can_init(TEST_EC_TAPS, 0);
local_cur = 0; //local_cur = 0;
far_cur = 0; //far_cur = 0;
result_cur = 0; result_cur = 0;
echo_can_flush(ctx); echo_can_flush(ctx);
@ -684,7 +684,7 @@ static int perform_test_sanity(void)
far_tx = 0; far_tx = 0;
} }
#else #else
far_sound[0] = 0; //far_sound[0] = 0;
far_tx = 0; far_tx = 0;
#endif #endif
rx = channel_model(&chan_model, tx, far_tx); rx = channel_model(&chan_model, tx, far_tx);

View File

@ -89,7 +89,7 @@ int decode_test = FALSE;
int rx_bits = 0; int rx_bits = 0;
t30_state_t t30_dummy; t30_state_t t30_dummy;
t4_state_t t4_state; t4_state_t t4_rx_state;
int t4_up = FALSE; int t4_up = FALSE;
hdlc_rx_state_t hdlcrx; hdlc_rx_state_t hdlcrx;
@ -291,12 +291,12 @@ static void t4_begin(void)
int i; int i;
//printf("Begin T.4 - %d %d %d %d\n", line_encoding, x_resolution, y_resolution, image_width); //printf("Begin T.4 - %d %d %d %d\n", line_encoding, x_resolution, y_resolution, image_width);
t4_rx_set_rx_encoding(&t4_state, line_encoding); t4_rx_set_rx_encoding(&t4_rx_state, line_encoding);
t4_rx_set_x_resolution(&t4_state, x_resolution); t4_rx_set_x_resolution(&t4_rx_state, x_resolution);
t4_rx_set_y_resolution(&t4_state, y_resolution); t4_rx_set_y_resolution(&t4_rx_state, y_resolution);
t4_rx_set_image_width(&t4_state, image_width); t4_rx_set_image_width(&t4_rx_state, image_width);
t4_rx_start_page(&t4_state); t4_rx_start_page(&t4_rx_state);
t4_up = TRUE; t4_up = TRUE;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
@ -316,13 +316,13 @@ static void t4_end(void)
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
if (ecm_len[i] > 0) if (ecm_len[i] > 0)
t4_rx_put_chunk(&t4_state, ecm_data[i], ecm_len[i]); t4_rx_put_chunk(&t4_rx_state, ecm_data[i], ecm_len[i]);
fprintf(stderr, "%d", (ecm_len[i] <= 0) ? 0 : 1); fprintf(stderr, "%d", (ecm_len[i] <= 0) ? 0 : 1);
} }
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
t4_rx_end_page(&t4_state); t4_rx_end_page(&t4_rx_state);
t4_rx_get_transfer_statistics(&t4_state, &stats); t4_rx_get_transfer_statistics(&t4_rx_state, &stats);
fprintf(stderr, "Pages = %d\n", stats.pages_transferred); fprintf(stderr, "Pages = %d\n", stats.pages_transferred);
fprintf(stderr, "Image size = %dx%d\n", stats.width, stats.length); fprintf(stderr, "Image size = %dx%d\n", stats.width, stats.length);
fprintf(stderr, "Image resolution = %dx%d\n", stats.x_resolution, stats.y_resolution); fprintf(stderr, "Image resolution = %dx%d\n", stats.x_resolution, stats.y_resolution);
@ -378,7 +378,7 @@ static void v17_put_bit(void *user_data, int bit)
} }
else else
{ {
if (t4_rx_put_bit(&t4_state, bit)) if (t4_rx_put_bit(&t4_rx_state, bit))
{ {
t4_end(); t4_end();
fprintf(stderr, "End of page detected\n"); fprintf(stderr, "End of page detected\n");
@ -414,7 +414,7 @@ static void v29_put_bit(void *user_data, int bit)
} }
else else
{ {
if (t4_rx_put_bit(&t4_state, bit)) if (t4_rx_put_bit(&t4_rx_state, bit))
{ {
t4_end(); t4_end();
fprintf(stderr, "End of page detected\n"); fprintf(stderr, "End of page detected\n");
@ -450,7 +450,7 @@ static void v27ter_put_bit(void *user_data, int bit)
} }
else else
{ {
if (t4_rx_put_bit(&t4_state, bit)) if (t4_rx_put_bit(&t4_rx_state, bit))
{ {
t4_end(); t4_end();
fprintf(stderr, "End of page detected\n"); fprintf(stderr, "End of page detected\n");
@ -527,7 +527,7 @@ int main(int argc, char *argv[])
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
#endif #endif
if (t4_rx_init(&t4_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL) if (t4_rx_init(&t4_rx_state, "fax_decode.tif", T4_COMPRESSION_ITU_T4_2D) == NULL)
{ {
fprintf(stderr, "Failed to init\n"); fprintf(stderr, "Failed to init\n");
exit(0); exit(0);
@ -543,7 +543,7 @@ int main(int argc, char *argv[])
v29_rx(v29, amp, len); v29_rx(v29, amp, len);
//v27ter_rx(v27ter, amp, len); //v27ter_rx(v27ter, amp, len);
} }
t4_rx_release(&t4_state); t4_rx_release(&t4_rx_state);
if (sf_close(inhandle)) if (sf_close(inhandle))
{ {

View File

@ -271,14 +271,11 @@ static void non_ecm_rx_status(void *user_data, int status)
static void non_ecm_put_bit(void *user_data, int bit) static void non_ecm_put_bit(void *user_data, int bit)
{ {
faxtester_state_t *s;
if (bit < 0) if (bit < 0)
{ {
non_ecm_rx_status(user_data, bit); non_ecm_rx_status(user_data, bit);
return; return;
} }
s = (faxtester_state_t *) user_data;
} }
/*- End of function --------------------------------------------------------*/ /*- End of function --------------------------------------------------------*/

View File

@ -18,7 +18,7 @@
run_fax_test() run_fax_test()
{ {
rm -f fax_tests_1.tif rm -f fax_tests_1.tif
echo -i ${FILE} ${OPTS} -i ${FILE} echo ./fax_tests -i ${FILE} ${OPTS} -i ${FILE}
./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2 ./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2
RETVAL=$? RETVAL=$?
if [ $RETVAL != 0 ] if [ $RETVAL != 0 ]
@ -28,7 +28,7 @@ run_fax_test()
fi fi
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
# option means the normal differences in tags will be ignored. # option means the normal differences in tags will be ignored.
tiffcmp -t ${FILE} fax_tests.tif #>/dev/null tiffcmp -t ${FILE} fax_tests.tif >/dev/null
RETVAL=$? RETVAL=$?
if [ $RETVAL != 0 ] if [ $RETVAL != 0 ]
then then

View File

@ -307,7 +307,7 @@ static void itu_compliance_tests(void)
/* Get the upper reference output data */ /* Get the upper reference output data */
len_comp_upper = get_test_vector(decode_test_files[file + 4], itu_ref_upper, MAX_TEST_VECTOR_LEN); len_comp_upper = get_test_vector(decode_test_files[file + 4], itu_ref_upper, MAX_TEST_VECTOR_LEN);
if (len_data != len_comp_lower || len_data != len_comp_lower) if (len_data != len_comp_lower || len_data != len_comp_upper)
{ {
printf("Test data length mismatch\n"); printf("Test data length mismatch\n");
exit(2); exit(2);

View File

@ -634,7 +634,7 @@ do
done done
echo v27ter_tests completed OK echo v27ter_tests completed OK
for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -58" "-b 4800 -s -42 -n -55" for OPTS in "-b 9600 -s -42 -n -62" "-b 7200 -s -42 -n -59" "-b 4800 -s -42 -n -55"
do do
./v29_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST ./v29_tests ${OPTS} >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$? RETVAL=$?

View File

@ -86,7 +86,7 @@ int main(int argc, char *argv[])
int i; int i;
span_sched_state_t sched; span_sched_state_t sched;
uint64_t when; uint64_t when;
span_schedule_init(&sched); span_schedule_init(&sched);
span_schedule_event(&sched, 500000, callback1, NULL); span_schedule_event(&sched, 500000, callback1, NULL);

View File

@ -410,7 +410,6 @@ static int detection_range_tests(super_tone_rx_state_t *super)
int16_t amp[SAMPLES_PER_CHUNK]; int16_t amp[SAMPLES_PER_CHUNK];
int i; int i;
int j; int j;
int x;
uint32_t phase; uint32_t phase;
int32_t phase_inc; int32_t phase_inc;
int scale; int scale;
@ -427,7 +426,7 @@ static int detection_range_tests(super_tone_rx_state_t *super)
{ {
for (i = 0; i < SAMPLES_PER_CHUNK; i++) for (i = 0; i < SAMPLES_PER_CHUNK; i++)
amp[i] = (dds(&phase, phase_inc)*scale) >> 15; amp[i] = (dds(&phase, phase_inc)*scale) >> 15;
x = super_tone_rx(super, amp, SAMPLES_PER_CHUNK); super_tone_rx(super, amp, SAMPLES_PER_CHUNK);
} }
} }
return 0; return 0;

View File

@ -80,6 +80,8 @@ int test_local_interrupt = FALSE;
const char *output_tiff_file_name; const char *output_tiff_file_name;
int log_audio = FALSE;
fax_state_t *fax; fax_state_t *fax;
faxtester_state_t state; faxtester_state_t state;
@ -1058,10 +1060,8 @@ static void exchange(faxtester_state_t *s)
int len; int len;
int i; int i;
int total_audio_time; int total_audio_time;
int log_audio;
logging_state_t *logging; logging_state_t *logging;
log_audio = TRUE;
output_tiff_file_name = OUTPUT_TIFF_FILE_NAME; output_tiff_file_name = OUTPUT_TIFF_FILE_NAME;
if (log_audio) if (log_audio)
@ -1295,10 +1295,14 @@ int main(int argc, char *argv[])
xml_file_name = "../spandsp/tsb85.xml"; xml_file_name = "../spandsp/tsb85.xml";
test_name = "MRGN01"; test_name = "MRGN01";
while ((opt = getopt(argc, argv, "x:")) != -1) log_audio = FALSE;
while ((opt = getopt(argc, argv, "lx:")) != -1)
{ {
switch (opt) switch (opt)
{ {
case 'l':
log_audio = TRUE;
break;
case 'x': case 'x':
xml_file_name = optarg; xml_file_name = optarg;
break; break;

View File

@ -403,6 +403,7 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event);
SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map); SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map);
SWITCH_DECLARE(int) switch_event_check_permission_list(switch_event_t *list, const char *name); SWITCH_DECLARE(int) switch_event_check_permission_list(switch_event_t *list, const char *name);
SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix); SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix);
SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max);
///\} ///\}

View File

@ -2869,6 +2869,10 @@ SWITCH_STANDARD_APP(audio_bridge_function)
moh = switch_channel_get_variable(caller_channel, "campon_hold_music"); moh = switch_channel_get_variable(caller_channel, "campon_hold_music");
} }
if (!zstr(moh) && !strcasecmp(moh, "silence")) {
moh = NULL;
}
do { do {
fail = 0; fail = 0;

View File

@ -5764,6 +5764,8 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_to")); switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_to"));
} else { } else {
int break_rfc = switch_true(switch_channel_get_variable(channel, "sip_recovery_break_rfc"));
tech_pvt->redirected = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_contact_uri")); tech_pvt->redirected = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_contact_uri"));
if (zstr(rr)) { if (zstr(rr)) {
@ -5776,11 +5778,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri")); tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri"));
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE, -1)) { if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE, -1)) {
switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_to")); switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, break_rfc ? "sip_full_from" : "sip_full_to"));
} }
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE, -1)) { if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE, -1)) {
switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_from")); switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, break_rfc ? "sip_full_to" : "sip_full_from"));
} }
} }

View File

@ -1538,7 +1538,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_log_init(runtime.memory_pool, runtime.colorize_console); switch_log_init(runtime.memory_pool, runtime.colorize_console);
if (flags & SCF_MINIMAL) return SWITCH_STATUS_SUCCESS; if (flags & SCF_MINIMAL) return SWITCH_STATUS_SUCCESS;
runtime.tipping_point = 0; runtime.tipping_point = 0;
runtime.timer_affinity = -1; runtime.timer_affinity = -1;
runtime.microseconds_per_tick = 20000; runtime.microseconds_per_tick = 20000;
@ -1813,6 +1813,23 @@ static void switch_load_core_config(const char *file)
switch_core_min_idle_cpu(atof(val)); switch_core_min_idle_cpu(atof(val));
} else if (!strcasecmp(var, "tipping-point") && !zstr(val)) { } else if (!strcasecmp(var, "tipping-point") && !zstr(val)) {
runtime.tipping_point = atoi(val); runtime.tipping_point = atoi(val);
} else if (!strcasecmp(var, "initial-event-threads") && !zstr(val)) {
int tmp = atoi(val);
if (tmp > runtime.cpu_count / 2) {
tmp = runtime.cpu_count / 2;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "This value cannot be higher than %d so setting it to that value\n",
runtime.cpu_count / 2);
}
if (tmp < 1) {
tmp = 1;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "This value cannot be lower than 1 so setting it to that level\n");
}
switch_event_launch_dispatch_threads(tmp);
} else if (!strcasecmp(var, "1ms-timer") && switch_true(val)) { } else if (!strcasecmp(var, "1ms-timer") && switch_true(val)) {
runtime.microseconds_per_tick = 1000; runtime.microseconds_per_tick = 1000;
} else if (!strcasecmp(var, "timer-affinity") && !zstr(val)) { } else if (!strcasecmp(var, "timer-affinity") && !zstr(val)) {

View File

@ -34,6 +34,7 @@
#include <switch.h> #include <switch.h>
#include <switch_event.h> #include <switch_event.h>
//#define SWITCH_EVENT_RECYCLE //#define SWITCH_EVENT_RECYCLE
#define DISPATCH_QUEUE_LEN 100 #define DISPATCH_QUEUE_LEN 100
//#define DEBUG_DISPATCH_QUEUES //#define DEBUG_DISPATCH_QUEUES
@ -87,7 +88,6 @@ static uint64_t EVENT_SEQUENCE_NR = 0;
static switch_queue_t *EVENT_RECYCLE_QUEUE = NULL; static switch_queue_t *EVENT_RECYCLE_QUEUE = NULL;
static switch_queue_t *EVENT_HEADER_RECYCLE_QUEUE = NULL; static switch_queue_t *EVENT_HEADER_RECYCLE_QUEUE = NULL;
#endif #endif
static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool);
static char *my_dup(const char *s) static char *my_dup(const char *s)
{ {
@ -305,7 +305,7 @@ static switch_status_t switch_event_queue_dispatch_event(switch_event_t **eventp
if (launch) { if (launch) {
if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) { if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) {
launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, RUNTIME_POOL); switch_event_launch_dispatch_threads(SOFT_MAX_DISPATCH + 1);
} }
} }
@ -515,13 +515,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void)
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool) SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max)
{ {
switch_threadattr_t *thd_attr; switch_threadattr_t *thd_attr;
uint32_t index = 0; uint32_t index = 0;
int launched = 0; int launched = 0;
uint32_t sanity = 200; uint32_t sanity = 200;
switch_memory_pool_t *pool = RUNTIME_POOL;
if (max > MAX_DISPATCH) { if (max > MAX_DISPATCH) {
return; return;
} }
@ -532,6 +534,7 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool)
for (index = SOFT_MAX_DISPATCH; index < max && index < MAX_DISPATCH; index++) { for (index = SOFT_MAX_DISPATCH; index < max && index < MAX_DISPATCH; index++) {
if (EVENT_DISPATCH_QUEUE_THREADS[index]) { if (EVENT_DISPATCH_QUEUE_THREADS[index]) {
printf("Index exists continue\n");
continue; continue;
} }
@ -540,13 +543,13 @@ static void launch_dispatch_threads(uint32_t max, switch_memory_pool_t *pool)
switch_threadattr_priority_increase(thd_attr); switch_threadattr_priority_increase(thd_attr);
switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE, pool); switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE, pool);
while(--sanity && !EVENT_DISPATCH_QUEUE_RUNNING[index]) switch_yield(10000); while(--sanity && !EVENT_DISPATCH_QUEUE_RUNNING[index]) switch_yield(10000);
if (index == 1) { if (index == 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create event dispatch thread %d\n", index);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create additional event dispatch thread %d\n", index); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create additional event dispatch thread %d\n", index);
} }
launched++; launched++;
break;
} }
SOFT_MAX_DISPATCH = index; SOFT_MAX_DISPATCH = index;
@ -598,7 +601,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
//switch_threadattr_priority_increase(thd_attr); //switch_threadattr_priority_increase(thd_attr);
switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, pool); switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, pool);
launch_dispatch_threads(1, RUNTIME_POOL); switch_event_launch_dispatch_threads(1);
//switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL); //switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
//switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL); //switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);

View File

@ -1734,7 +1734,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
(long) switch_epoch_time_now(NULL), new_profile->uuid_str, (long) switch_epoch_time_now(NULL), new_profile->uuid_str,
extension, use_context, use_dialplan); extension, use_context, use_dialplan);
switch_channel_add_variable_var_check(channel, SWITCH_TRANSFER_HISTORY_VARIABLE, new_profile->transfer_source, SWITCH_FALSE, SWITCH_STACK_PUSH); switch_channel_add_variable_var_check(channel, SWITCH_TRANSFER_HISTORY_VARIABLE, new_profile->transfer_source, SWITCH_FALSE, SWITCH_STACK_PUSH);
switch_channel_set_variable(channel, SWITCH_TRANSFER_SOURCE_VARIABLE, new_profile->transfer_source); switch_channel_set_variable_var_check(channel, SWITCH_TRANSFER_SOURCE_VARIABLE, new_profile->transfer_source, SWITCH_FALSE);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }

View File

@ -2331,7 +2331,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
q = !q; q = !q;
} }
if (end && p < end && *p == ',') { if (end && p < end && *p == ',' && *(p-1) != '\\') {
if (q || alt) { if (q || alt) {
*p = QUOTED_ESC_COMMA; *p = QUOTED_ESC_COMMA;

View File

@ -1879,6 +1879,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
size_t len = 0; size_t len = 0;
char tb[2] = ""; char tb[2] = "";
int term_required = 0;
if (valid_terminators && *valid_terminators == '=') {
term_required = 1;
}
switch_assert(session); switch_assert(session);
@ -1945,6 +1951,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
} }
} }
} }
} else if (term_required) {
status = SWITCH_STATUS_TOO_SMALL;
} }
len = strlen(digit_buffer); len = strlen(digit_buffer);

View File

@ -296,6 +296,7 @@ static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj)
} }
if (!pop) { if (!pop) {
THREAD_RUNNING = -1;
break; break;
} }
@ -558,7 +559,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void)
{ {
switch_status_t st; switch_status_t st;
THREAD_RUNNING = -1;
switch_queue_push(LOG_QUEUE, NULL); switch_queue_push(LOG_QUEUE, NULL);
while (THREAD_RUNNING) { while (THREAD_RUNNING) {
switch_cond_next(); switch_cond_next();

View File

@ -2883,7 +2883,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
#endif #endif
#ifdef ENABLE_SRTP #ifdef ENABLE_SRTP
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtcp_recv_msg.header.version == 2) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) {
int sbytes = (int) *bytes; int sbytes = (int) *bytes;
err_status_t stat = 0; err_status_t stat = 0;
@ -3002,7 +3002,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
} }
#ifdef ENABLE_SRTP #ifdef ENABLE_SRTP
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV) && rtp_session->rtcp_recv_msg.header.version == 2) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) {
int sbytes = (int) *bytes; int sbytes = (int) *bytes;
err_status_t stat = 0; err_status_t stat = 0;