mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 08:05:37 +00:00
Merged OpenZAP and FreeTDM into the FreeSWITCH tree.
This commit is contained in:
commit
f6a8204280
13
libs/freetdm/.gitignore
vendored
Normal file
13
libs/freetdm/.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
*.o
|
||||
*.lo
|
||||
*.so
|
||||
*.a
|
||||
*.orig
|
||||
*.rej
|
||||
*.log
|
||||
|
||||
Makefile
|
||||
config.*
|
||||
configure
|
||||
libtool
|
||||
aclocal.m4
|
1
libs/freetdm/.update
Normal file
1
libs/freetdm/.update
Normal file
@ -0,0 +1 @@
|
||||
Fri Oct 3 17:54:41 EDT 2008
|
0
libs/freetdm/AUTHORS
Normal file
0
libs/freetdm/AUTHORS
Normal file
0
libs/freetdm/ChangeLog
Normal file
0
libs/freetdm/ChangeLog
Normal file
276
libs/freetdm/Makefile.am
Normal file
276
libs/freetdm/Makefile.am
Normal file
@ -0,0 +1,276 @@
|
||||
# Copyright (c) 2007, Anthony Minessale II
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the name of the original author; nor the names of any contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PREFIX = $(prefix)
|
||||
SRC = src
|
||||
|
||||
moddir = @modinstdir@
|
||||
libdir = @libdir@
|
||||
library_includedir = $(PREFIX)/include
|
||||
|
||||
INCS = -I$(FT_SRCDIR)/$(SRC)/include -I$(FT_SRCDIR)/$(SRC)/isdn/include
|
||||
if HAVE_SCTP
|
||||
INCS += -I$(FT_SRCDIR)/$(SRC)/ftmod/ftmod_sangoma_boost
|
||||
endif
|
||||
MY_CFLAGS = $(INCS) $(FTDM_CFLAGS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@
|
||||
COMPILE = $(CC) $(MY_CFLAGS) $(INCS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
|
||||
LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(MY_CFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
|
||||
#
|
||||
# GNU pkgconfig file
|
||||
#
|
||||
EXTRA_DIST = freetdm.pc.in
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = freetdm.pc
|
||||
|
||||
|
||||
#
|
||||
# libfreetdm
|
||||
#
|
||||
libfreetdm_la_SOURCES = \
|
||||
$(SRC)/hashtable.c \
|
||||
$(SRC)/hashtable_itr.c \
|
||||
$(SRC)/ftdm_io.c \
|
||||
$(SRC)/ftdm_queue.c \
|
||||
$(SRC)/ftdm_config.c \
|
||||
$(SRC)/ftdm_callerid.c \
|
||||
$(SRC)/fsk.c \
|
||||
$(SRC)/uart.c \
|
||||
$(SRC)/g711.c \
|
||||
$(SRC)/libteletone_detect.c \
|
||||
$(SRC)/libteletone_generate.c \
|
||||
$(SRC)/ftdm_buffer.c \
|
||||
$(SRC)/ftdm_threadmutex.c \
|
||||
$(SRC)/ftdm_dso.c
|
||||
|
||||
library_include_HEADERS = \
|
||||
$(SRC)/include/fsk.h \
|
||||
$(SRC)/include/g711.h \
|
||||
$(SRC)/include/hashtable.h \
|
||||
$(SRC)/include/hashtable_itr.h \
|
||||
$(SRC)/include/hashtable_private.h \
|
||||
$(SRC)/include/libteletone_detect.h \
|
||||
$(SRC)/include/libteletone_generate.h \
|
||||
$(SRC)/include/libteletone.h \
|
||||
$(SRC)/include/freetdm.h \
|
||||
$(SRC)/include/sangoma_tdm_api.h \
|
||||
$(SRC)/include/uart.h \
|
||||
$(SRC)/include/ftdm_buffer.h \
|
||||
$(SRC)/include/ftdm_config.h \
|
||||
$(SRC)/include/ftdm_threadmutex.h \
|
||||
$(SRC)/include/ftdm_dso.h \
|
||||
$(SRC)/include/ftdm_types.h
|
||||
|
||||
lib_LTLIBRARIES = libfreetdm.la
|
||||
libfreetdm_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
libfreetdm_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS)
|
||||
libfreetdm_la_LIBADD = $(LIBS)
|
||||
|
||||
MYLIB = libfreetdm.la
|
||||
|
||||
core: libfreetdm.la
|
||||
core-install: install-libLTLIBRARIES
|
||||
|
||||
#
|
||||
# tools & test programs
|
||||
#
|
||||
noinst_PROGRAMS = testtones detect_tones detect_dtmf testisdn testpri testr2 testanalog testapp testcid
|
||||
if HAVE_SCTP
|
||||
noinst_PROGRAMS += testboost
|
||||
endif
|
||||
noinst_PROGRAMS += testsangomaboost
|
||||
|
||||
testapp_SOURCES = $(SRC)/testapp.c
|
||||
testapp_LDADD = libfreetdm.la
|
||||
testapp_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
testcid_SOURCES = $(SRC)/testcid.c
|
||||
testcid_LDADD = libfreetdm.la
|
||||
testcid_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
testtones_SOURCES = $(SRC)/testtones.c
|
||||
testtones_LDADD = libfreetdm.la
|
||||
testtones_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
detect_tones_SOURCES = $(SRC)/detect_tones.c
|
||||
detect_tones_LDADD = libfreetdm.la
|
||||
detect_tones_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
detect_dtmf_SOURCES = $(SRC)/detect_dtmf.c
|
||||
detect_dtmf_LDADD = libfreetdm.la
|
||||
detect_dtmf_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
testisdn_SOURCES = $(SRC)/testisdn.c
|
||||
testisdn_LDADD = libfreetdm.la
|
||||
testisdn_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
testpri_SOURCES = $(SRC)/testpri.c
|
||||
testpri_LDADD = libfreetdm.la
|
||||
testpri_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
testr2_SOURCES = $(SRC)/testr2.c
|
||||
testr2_LDADD = libfreetdm.la
|
||||
testr2_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
if HAVE_SCTP
|
||||
testboost_SOURCES = $(SRC)/testboost.c
|
||||
testboost_LDADD = libfreetdm.la
|
||||
testboost_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
endif
|
||||
|
||||
testsangomaboost_SOURCES = $(SRC)/testsangomaboost.c
|
||||
testsangomaboost_LDADD = libfreetdm.la
|
||||
testsangomaboost_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
testanalog_SOURCES = $(SRC)/testanalog.c
|
||||
testanalog_LDADD = libfreetdm.la
|
||||
testanalog_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
|
||||
#
|
||||
# ftmod modules
|
||||
#
|
||||
mod_LTLIBRARIES = ftmod_zt.la ftmod_skel.la ftmod_isdn.la ftmod_analog.la ftmod_analog_em.la
|
||||
|
||||
|
||||
if HAVE_SCTP
|
||||
mod_LTLIBRARIES += ftmod_sangoma_boost.la
|
||||
endif
|
||||
|
||||
if LIBSANGOMA
|
||||
mod_LTLIBRARIES += ftmod_wanpipe.la
|
||||
endif
|
||||
|
||||
if LIBPRI
|
||||
mod_LTLIBRARIES += ftmod_libpri.la
|
||||
endif
|
||||
|
||||
if OPENR2
|
||||
mod_LTLIBRARIES += ftmod_r2.la
|
||||
endif
|
||||
|
||||
ftmod_zt_la_SOURCES = $(SRC)/ftmod/ftmod_zt/ftmod_zt.c
|
||||
ftmod_zt_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
ftmod_zt_la_LDFLAGS = -module -avoid-version
|
||||
ftmod_zt_la_LIBADD = $(MYLIB)
|
||||
|
||||
ftmod_skel_la_SOURCES = $(SRC)/ftmod/ftmod_skel/ftmod_skel.c
|
||||
ftmod_skel_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
ftmod_skel_la_LDFLAGS = -module -avoid-version
|
||||
ftmod_skel_la_LIBADD = $(MYLIB)
|
||||
|
||||
if LIBSANGOMA
|
||||
ftmod_wanpipe_la_SOURCES = $(SRC)/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
|
||||
ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe
|
||||
ftmod_wanpipe_la_LDFLAGS = -module -avoid-version -lsangoma
|
||||
ftmod_wanpipe_la_LIBADD = $(MYLIB)
|
||||
endif
|
||||
|
||||
ftmod_isdn_la_SOURCES = \
|
||||
$(SRC)/isdn/EuroISDNStateNT.c \
|
||||
$(SRC)/isdn/EuroISDNStateTE.c \
|
||||
$(SRC)/isdn/mfifo.c \
|
||||
$(SRC)/isdn/Q921.c \
|
||||
$(SRC)/isdn/Q931api.c \
|
||||
$(SRC)/isdn/Q931.c \
|
||||
$(SRC)/isdn/Q931ie.c \
|
||||
$(SRC)/isdn/Q931mes.c \
|
||||
$(SRC)/isdn/Q931StateNT.c \
|
||||
$(SRC)/isdn/Q931StateTE.c \
|
||||
$(SRC)/isdn/nationalmes.c \
|
||||
$(SRC)/isdn/nationalStateNT.c \
|
||||
$(SRC)/isdn/nationalStateTE.c \
|
||||
$(SRC)/isdn/DMSmes.c \
|
||||
$(SRC)/isdn/DMSStateNT.c \
|
||||
$(SRC)/isdn/DMSStateTE.c \
|
||||
$(SRC)/isdn/5ESSmes.c \
|
||||
$(SRC)/isdn/5ESSStateNT.c \
|
||||
$(SRC)/isdn/5ESSStateTE.c \
|
||||
$(SRC)/isdn/Q932mes.c \
|
||||
$(SRC)/ftmod/ftmod_isdn/ftmod_isdn.c
|
||||
|
||||
ftmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE
|
||||
ftmod_isdn_la_LDFLAGS = $(PCAP_LIB_FLAGS) -module -avoid-version
|
||||
ftmod_isdn_la_LIBADD = $(MYLIB)
|
||||
|
||||
ftmod_analog_la_SOURCES = $(SRC)/ftmod/ftmod_analog/ftmod_analog.c
|
||||
ftmod_analog_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
ftmod_analog_la_LDFLAGS = -module -avoid-version
|
||||
ftmod_analog_la_LIBADD = $(MYLIB)
|
||||
|
||||
ftmod_analog_em_la_SOURCES = $(SRC)/ftmod/ftmod_analog_em/ftmod_analog_em.c
|
||||
ftmod_analog_em_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
ftmod_analog_em_la_LDFLAGS = -module -avoid-version
|
||||
ftmod_analog_em_la_LIBADD = $(MYLIB)
|
||||
|
||||
if HAVE_SCTP
|
||||
ftmod_sangoma_boost_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_boost/sangoma_boost_client.c $(SRC)/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c
|
||||
ftmod_sangoma_boost_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
ftmod_sangoma_boost_la_LDFLAGS = -module -avoid-version
|
||||
ftmod_sangoma_boost_la_LIBADD = $(MYLIB)
|
||||
endif
|
||||
|
||||
if LIBPRI
|
||||
ftmod_libpri_la_SOURCES = $(SRC)/ftmod/ftmod_libpri/ftmod_libpri.c $(SRC)/ftmod/ftmod_libpri/lpwrap_pri.c
|
||||
ftmod_libpri_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
ftmod_libpri_la_LDFLAGS = -module -avoid-version -lpri
|
||||
ftmod_libpri_la_LIBADD = $(MYLIB)
|
||||
endif
|
||||
|
||||
if OPENR2
|
||||
ftmod_r2_la_SOURCES = $(SRC)/ftmod/ftmod_r2/ftmod_r2.c
|
||||
ftmod_r2_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS)
|
||||
ftmod_r2_la_LDFLAGS = -module -avoid-version -lopenr2
|
||||
ftmod_r2_la_LIBADD = $(MYLIB)
|
||||
endif
|
||||
|
||||
|
||||
dox doxygen:
|
||||
cd docs && doxygen $(FT_SRCDIR)/docs/Doxygen.conf
|
||||
|
||||
mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN): $(MYLIB) mod_freetdm/mod_freetdm.c
|
||||
cd mod_freetdm && make
|
||||
|
||||
mod_freetdm: mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN)
|
||||
|
||||
mod_freetdm-install: mod_freetdm
|
||||
cd mod_freetdm && make install
|
||||
|
||||
mod_freetdm-clean:
|
||||
@if [ -f mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN) ] ; then cd mod_freetdm && make clean ; fi
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(PREFIX)
|
||||
$(mkinstalldirs) $(DESTDIR)@confdir@
|
||||
@[ -f "$(DESTDIR)@confdir@/freetdm.conf" ] || ( cp conf/*.conf $(DESTDIR)@confdir@)
|
||||
@echo OpenFTDM Installed
|
0
libs/freetdm/NEWS
Normal file
0
libs/freetdm/NEWS
Normal file
3
libs/freetdm/README
Normal file
3
libs/freetdm/README
Normal file
@ -0,0 +1,3 @@
|
||||
FREETDM (WORK IN PROGRESS)
|
||||
|
||||
*shrug*
|
9
libs/freetdm/TODO
Normal file
9
libs/freetdm/TODO
Normal file
@ -0,0 +1,9 @@
|
||||
== Interface inconsistency ==
|
||||
- enum_id member of ftdm_event_t is inconsistent. Most of the time is just for OOB events, the only other
|
||||
type of event as of now is FTDM_EVENT_DTMF and is not using the enum_id member. I think we can get rid
|
||||
of the FTDM_EVENT_DTMF and create ftdm_dtmf_event_t type instead of reusing ftdm_event_t
|
||||
then ftdm_event_t would be renamed to ftdm_oob_event_t and the enum_id renamed to type, then ftdm_span_next_event()
|
||||
will only return OOB events
|
||||
|
||||
- query span hw status (connected/disconnected) on startup
|
||||
|
1
libs/freetdm/acinclude.m4
Normal file
1
libs/freetdm/acinclude.m4
Normal file
@ -0,0 +1 @@
|
||||
m4_include([build/libpcap.m4])
|
6
libs/freetdm/bootstrap
Executable file
6
libs/freetdm/bootstrap
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
autoheader
|
||||
libtoolize --force --copy
|
||||
aclocal
|
||||
automake -f --copy --add-missing
|
||||
autoconf
|
144
libs/freetdm/build/libpcap.m4
Normal file
144
libs/freetdm/build/libpcap.m4
Normal file
@ -0,0 +1,144 @@
|
||||
dnl libpcap.m4--PCAP libraries and includes
|
||||
dnl Derrick Brashear
|
||||
dnl from KTH krb and Arla
|
||||
dnl $Id: libpcap.m4,v 1.4 2006/01/20 20:21:09 snsimon Exp $
|
||||
|
||||
AC_DEFUN([PCAP_INC_WHERE1], [
|
||||
ac_cv_found_pcap_inc=no
|
||||
if test -f "$1/pcap.h" ; then
|
||||
ac_cv_found_pcap_inc=yes
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([PCAP_INC_WHERE], [
|
||||
for i in $1; do
|
||||
AC_MSG_CHECKING(for pcap header in $i)
|
||||
PCAP_INC_WHERE1($i)
|
||||
if test "$ac_cv_found_pcap_inc" = "yes"; then
|
||||
ac_cv_pcap_where_inc=$i
|
||||
AC_MSG_RESULT(found)
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT(no found)
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFUN([PCAP_LIB_WHERE1], [
|
||||
saved_LIBS=$LIBS
|
||||
LIBS="$saved_LIBS -L$1 -lpcap"
|
||||
AC_TRY_LINK(,
|
||||
[pcap_lookupdev("");],
|
||||
[ac_cv_found_pcap_lib=yes],
|
||||
ac_cv_found_pcap_lib=no)
|
||||
LIBS=$saved_LIBS
|
||||
])
|
||||
|
||||
AC_DEFUN([TEST_LIBPATH], [
|
||||
changequote(<<, >>)
|
||||
define(<<AC_CV_FOUND>>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>))
|
||||
changequote([, ])
|
||||
if test "$AC_CV_FOUND" = "yes"; then
|
||||
if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl" -a \! -r "$1/lib$2.dylib"; then
|
||||
AC_CV_FOUND=no
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([PCAP_LIB_WHERE], [
|
||||
for i in $1; do
|
||||
AC_MSG_CHECKING(for pcap library in $i)
|
||||
PCAP_LIB_WHERE1($i)
|
||||
TEST_LIBPATH($i, pcap)
|
||||
if test "$ac_cv_found_pcap_lib" = "yes" ; then
|
||||
ac_cv_pcap_where_lib=$i
|
||||
AC_MSG_RESULT(found)
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT(no found)
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFUN([FIND_LIB_SUBDIR],
|
||||
[dnl
|
||||
AC_ARG_WITH([lib-subdir], AC_HELP_STRING([--with-lib-subdir=DIR],[Find libraries in DIR instead of lib]))
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CACHE_CHECK([what directory libraries are found in], [ac_cv_cmu_lib_subdir],
|
||||
[test "X$with_lib_subdir" = "Xyes" && with_lib_subdir=
|
||||
test "X$with_lib_subdir" = "Xno" && with_lib_subdir=
|
||||
if test "X$with_lib_subdir" = "X" ; then
|
||||
ac_cv_cmu_lib_subdir=lib
|
||||
if test $ac_cv_sizeof_long -eq 4 ; then
|
||||
test -d /usr/lib32 && ac_cv_cmu_lib_subdir=lib32
|
||||
test -r /usr/lib/libpcap.so && ac_cv_cmu_lib_subdir=lib
|
||||
fi
|
||||
if test $ac_cv_sizeof_long -eq 8 ; then
|
||||
test -d /usr/lib64 && ac_cv_cmu_lib_subdir=lib64
|
||||
fi
|
||||
else
|
||||
ac_cv_cmu_lib_subdir=$with_lib_subdir
|
||||
fi])
|
||||
AC_SUBST(LIB_SUBDIR, $ac_cv_cmu_lib_subdir)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AX_LIB_PCAP], [
|
||||
AC_REQUIRE([FIND_LIB_SUBDIR])
|
||||
AC_ARG_WITH(pcap,
|
||||
[ --with-pcap=PREFIX Compile with PCAP support],
|
||||
[if test "X$with_pcap" = "X"; then
|
||||
with_pcap=yes
|
||||
fi])
|
||||
AC_ARG_WITH(pcap-lib,
|
||||
[ --with-pcap-lib=dir use pcap libraries in dir],
|
||||
[if test "$withval" = "yes" -o "$withval" = "no"; then
|
||||
AC_MSG_ERROR([No argument for --with-pcap-lib])
|
||||
fi])
|
||||
AC_ARG_WITH(pcap-include,
|
||||
[ --with-pcap-include=dir use pcap headers in dir],
|
||||
[if test "$withval" = "yes" -o "$withval" = "no"; then
|
||||
AC_MSG_ERROR([No argument for --with-pcap-include])
|
||||
fi])
|
||||
|
||||
if test "X$with_pcap" != "X"; then
|
||||
if test "$with_pcap" != "yes"; then
|
||||
ac_cv_pcap_where_lib=$with_pcap
|
||||
ac_cv_pcap_where_inc=$with_pcap/include
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "X$with_pcap_lib" != "X"; then
|
||||
ac_cv_pcap_where_lib=$with_pcap_lib
|
||||
fi
|
||||
if test "X$ac_cv_pcap_where_lib" = "X"; then
|
||||
PCAP_LIB_WHERE(/usr/$LIB_SUBDIR /usr/local/$LIB_SUBDIR)
|
||||
fi
|
||||
|
||||
if test "X$with_pcap_include" != "X"; then
|
||||
ac_cv_pcap_where_inc=$with_pcap_include
|
||||
fi
|
||||
if test "X$ac_cv_pcap_where_inc" = "X"; then
|
||||
PCAP_INC_WHERE(/usr/ng/include /usr/include /usr/local/include)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to include pcap)
|
||||
if test "X$ac_cv_pcap_where_lib" != "X" -a "X$ac_cv_pcap_where_inc" != "X"; then
|
||||
ac_cv_found_pcap=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
PCAP_INC_DIR=$ac_cv_pcap_where_inc
|
||||
PCAP_LIB_DIR=$ac_cv_pcap_where_lib
|
||||
PCAP_INC_FLAGS="-I${PCAP_INC_DIR}"
|
||||
PCAP_LIB_FLAGS="-L${PCAP_LIB_DIR} -lpcap"
|
||||
AC_SUBST(PCAP_INC_DIR)
|
||||
AC_SUBST(PCAP_LIB_DIR)
|
||||
AC_SUBST(PCAP_INC_FLAGS)
|
||||
AC_SUBST(PCAP_LIB_FLAGS)
|
||||
AC_DEFINE([HAVE_LIBPCAP],[1],[libpcap])
|
||||
else
|
||||
ac_cv_found_pcap=no
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
||||
|
19
libs/freetdm/conf/freetdm.conf
Normal file
19
libs/freetdm/conf/freetdm.conf
Normal file
@ -0,0 +1,19 @@
|
||||
[span wanpipe]
|
||||
name => FreeTDM
|
||||
number => 1
|
||||
fxs-channel => 1:3-4
|
||||
|
||||
[span wanpipe]
|
||||
fxo-channel => 1:1-2
|
||||
|
||||
[span zt]
|
||||
name => FreeTDM
|
||||
number => 2
|
||||
fxs-channel => 1
|
||||
|
||||
[span zt]
|
||||
name => FreeTDM
|
||||
number => 2
|
||||
fxo-channel => 3
|
||||
|
||||
|
45
libs/freetdm/conf/freetdm.conf.xml
Normal file
45
libs/freetdm/conf/freetdm.conf.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<configuration name="freetdm.conf" description="FreeTDM Configuration">
|
||||
<settings>
|
||||
<param name="debug" value="0"/>
|
||||
<!--<param name="hold-music" value="$${moh_uri}"/>-->
|
||||
<!--<param name="enable-analog-option" value="call-swap"/>-->
|
||||
<!--<param name="enable-analog-option" value="3-way"/>-->
|
||||
</settings>
|
||||
<pri_spans>
|
||||
<span name="PRI_1">
|
||||
<!-- Log Levels: none, alert, crit, err, warning, notice, info, debug -->
|
||||
<param name="q921loglevel" value="alert"/>
|
||||
<param name="q931loglevel" value="alert"/>
|
||||
<param name="mode" value="user"/>
|
||||
<param name="dialect" value="5ess"/>
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="context" value="default"/>
|
||||
</span>
|
||||
<span name="PRI_2">
|
||||
<param name="q921loglevel" value="alert"/>
|
||||
<param name="q931loglevel" value="alert"/>
|
||||
<param name="mode" value="user"/>
|
||||
<param name="dialect" value="5ess"/>
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="context" value="default"/>
|
||||
</span>
|
||||
</pri_spans>
|
||||
<!-- one entry here per openzap span -->
|
||||
<analog_spans>
|
||||
<span id="1">
|
||||
<!--<param name="hold-music" value="$${moh_uri}"/>-->
|
||||
<!--<param name="enable-analog-option" value="call-swap"/>-->
|
||||
<!--<param name="enable-analog-option" value="3-way"/>-->
|
||||
<param name="tonegroup" value="us"/>
|
||||
<param name="digit-timeout" value="2000"/>
|
||||
<param name="max-digits" value="11"/>
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="context" value="default"/>
|
||||
<param name="enable-callerid" value="true"/>
|
||||
<!-- regex to stop dialing when it matches -->
|
||||
<!--<param name="dial-regex" value="5555"/>-->
|
||||
<!-- regex to stop dialing when it does not match -->
|
||||
<!--<param name="fail-dial-regex" value="^5"/>-->
|
||||
</span>
|
||||
</analog_spans>
|
||||
</configuration>
|
38
libs/freetdm/conf/m3ua.conf
Normal file
38
libs/freetdm/conf/m3ua.conf
Normal file
@ -0,0 +1,38 @@
|
||||
;M3UA SS7 Links Config
|
||||
;
|
||||
;ss7box-m3ua_mode => true
|
||||
;local_sctp_ip => localhost
|
||||
;local sctp_port => 30000
|
||||
;remote_sctp_ip => localhost
|
||||
;remote_sctp_port => 30001
|
||||
;opc => 0-0-0
|
||||
;dpc => 0-0-0
|
||||
|
||||
|
||||
; AP Specific Stuff. This will likely move later.
|
||||
|
||||
; CNAM Gateways
|
||||
cnam1_dpc => 0-0-0
|
||||
cnam1_ssn => 253
|
||||
cnam2_dpc => 0-0-0
|
||||
cnam2_ssn => 253
|
||||
cnam3_dpc => 0-0-0
|
||||
cnam3_ssn => 253
|
||||
|
||||
;LNP Gateways
|
||||
lnp1_dpc => 0-0-0
|
||||
lnp1_ssn => 253
|
||||
lnp2_dpc => 0-0-0
|
||||
lnp2_ssn => 253
|
||||
lnp3_dpc => 0-0-0
|
||||
lnp3_ssn => 253
|
||||
|
||||
;LNP Gateways
|
||||
sms8001_dpc => 0-0-0
|
||||
sms8001_ssn => 253
|
||||
sms8002_dpc => 0-0-0
|
||||
sms8002_ssn => 253
|
||||
sms8003_dpc => 0-0-0
|
||||
sms8003_ssn => 253
|
||||
|
||||
|
41
libs/freetdm/conf/pika.conf
Normal file
41
libs/freetdm/conf/pika.conf
Normal file
@ -0,0 +1,41 @@
|
||||
; each category is a config profile
|
||||
; to apply the profile append it to a channel def in
|
||||
; openzap.conf with @<profile_name>
|
||||
; e.g.
|
||||
; [span pika]
|
||||
; name => pika
|
||||
; number => pika
|
||||
; fxs-channel => 1:0:1-12@default
|
||||
|
||||
[default]
|
||||
; region is na or eu
|
||||
;region => na
|
||||
;rx-gain => 0.00
|
||||
;rx-agc-enabled => false
|
||||
;rx-agc-targetPower => -15.00
|
||||
;rx-agc-minGain => -6.00
|
||||
;rx-agc-maxGain => 18.00
|
||||
;rx-agc-attackRate => 170
|
||||
;rx-agc-decayRate => 750
|
||||
;rx-agc-speechThreshold => -36.00
|
||||
;rx-vad-enabled => false
|
||||
;rx-vad-activationThreshold => -40.00
|
||||
;rx-vad-activationDebounceTime => 72
|
||||
;rx-vad-deactivationThreshold => -40.00
|
||||
;rx-vad-deactivationDebounceTime => 984
|
||||
;rx-vad-preSpeechBufferSize => 240
|
||||
;tx-gain => 0.00
|
||||
;tx-agc-enabled => true
|
||||
;tx-agc-targetPower => -15.00
|
||||
;tx-agc-minGain => -6.00
|
||||
;tx-agc-maxGain => 18.00
|
||||
;tx-agc-attackRate => 170
|
||||
;tx-agc-decayRate => 750
|
||||
;tx-agc-speechThreshold => -36.00
|
||||
;ec-enabled => false
|
||||
;ec-doubleTalkerThreshold => -6.00
|
||||
;ec-speechPresentThreshold => -40.00
|
||||
;ec-echoSuppressionThreshold => -18.00
|
||||
;ec-echoSuppressionEnabled => true
|
||||
;ec-comfortNoiseEnabled => true
|
||||
;ec-adaptationModeEnabled => true
|
63
libs/freetdm/conf/tones.conf
Normal file
63
libs/freetdm/conf/tones.conf
Normal file
@ -0,0 +1,63 @@
|
||||
[us]
|
||||
generate-dial => v=-7;%(1000,0,350,440)
|
||||
detect-dial => 350,440
|
||||
|
||||
generate-ring => v=-7;%(2000,4000,440,480)
|
||||
detect-ring => 440,480
|
||||
|
||||
generate-busy => v=-7;%(500,500,480,620)
|
||||
detect-busy => 480,620
|
||||
|
||||
generate-attn => v=0;%(100,100,1400,2060,2450,2600)
|
||||
detect-attn => 1400,2060,2450,2600
|
||||
|
||||
generate-callwaiting-sas => v=0;%(300,0,440)
|
||||
detect-callwaiting-sas => 440
|
||||
|
||||
generate-callwaiting-cas => v=0;%(80,0,2750,2130)
|
||||
detect-callwaiting-cas => 2750,2130
|
||||
|
||||
detect-fail1 => 913.8
|
||||
detect-fail2 => 1370.6
|
||||
detect-fail3 => 1776.7
|
||||
|
||||
|
||||
[sg]
|
||||
generate-dial => v=-7;%(1000,0,425)
|
||||
detect-dial => 425
|
||||
|
||||
generate-ring => v=-7;%(2000,4000,425)
|
||||
detect-ring => 425
|
||||
|
||||
generate-busy => v=-7;%(750,750,425)
|
||||
detect-busy => 425
|
||||
|
||||
generate-attn => v=0;%(100,100,1400,2060,2450,2600)
|
||||
detect-attn => 1400,2060,2450,2600
|
||||
|
||||
generate-callwaiting-sas => v=0;%(300,0,440)
|
||||
detect-callwaiting-sas => 440
|
||||
|
||||
generate-callwaiting-cas => v=0;%(80,0,2750,2130)
|
||||
detect-callwaiting-cas => 2750,2130
|
||||
|
||||
detect-fail1 => 913.8
|
||||
detect-fail2 => 1370.6
|
||||
detect-fail3 => 1776.7
|
||||
|
||||
[ru]
|
||||
generate-dial => v=-7;%(1000,425)
|
||||
detect-dial => 0
|
||||
generate-ring => v=-7;%(800,5000,425,0)
|
||||
detect-ring => 425,0
|
||||
generate-busy => v=-7;%(350,350,425,0)
|
||||
detect-busy => 425,0
|
||||
generate-attn => v=0;%(100,100,1400,2060,2450,2600)
|
||||
detect-attn => 1400,2060,2450,2600
|
||||
generate-callwaiting-sas => v=0;%(300,0,440)
|
||||
detect-callwaiting-sas => 440,480
|
||||
generate-callwaiting-cas => v=0;%(80,0,2750,2130)
|
||||
detect-callwaiting-cas => 2750,2130
|
||||
detect-fail1 => 913.8
|
||||
detect-fail2 => 1370.6
|
||||
detect-fail3 => 1776.7
|
4
libs/freetdm/conf/wanpipe.conf
Normal file
4
libs/freetdm/conf/wanpipe.conf
Normal file
@ -0,0 +1,4 @@
|
||||
[defaults]
|
||||
codec_ms => 20
|
||||
wink_ms => 150
|
||||
flash_ms => 750
|
8
libs/freetdm/conf/zt.conf
Normal file
8
libs/freetdm/conf/zt.conf
Normal file
@ -0,0 +1,8 @@
|
||||
[defaults]
|
||||
codec_ms => 20
|
||||
wink_ms => 150
|
||||
flash_ms => 750
|
||||
echo_cancel_level => 64
|
||||
rxgain => 0.0
|
||||
txgain => 0.0
|
||||
|
181
libs/freetdm/configure.ac
Normal file
181
libs/freetdm/configure.ac
Normal file
@ -0,0 +1,181 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([freetdm],[pre-alpha],[bugs@freeswitch.org])
|
||||
AC_CONFIG_SRCDIR([src/ftdm_io.c])
|
||||
|
||||
AC_CONFIG_AUX_DIR(build)
|
||||
AM_INIT_AUTOMAKE(libfreetdm,0.1)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
AC_PREFIX_DEFAULT(/usr/local/freetdm)
|
||||
# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
|
||||
if test "x$prefix" = "xNONE" ; then
|
||||
prefix='/usr/local/freetdm'
|
||||
fi
|
||||
|
||||
# Absolute source/build directory
|
||||
FT_SRCDIR=`(cd $srcdir && pwd)`
|
||||
ft_builddir=`pwd`
|
||||
AC_SUBST(FT_SRCDIR)
|
||||
AC_SUBST(ft_builddir)
|
||||
|
||||
if test "$sysconfdir" = "\${prefix}/etc" ; then
|
||||
confdir="$prefix/conf"
|
||||
else
|
||||
confdir="$sysconfdir"
|
||||
fi
|
||||
|
||||
AC_SUBST(confdir)
|
||||
|
||||
#override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html)
|
||||
m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
|
||||
m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
|
||||
m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
|
||||
#AM_PROG_CC_C_O
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# Check for com;iler type
|
||||
AC_DEFUN([AX_COMPILER_VENDOR],
|
||||
[
|
||||
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
|
||||
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
|
||||
# note: don't check for GCC first, since some other compilers define __GNUC__
|
||||
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
|
||||
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
|
||||
#if !($vencpp)
|
||||
thisisanerror;
|
||||
#endif
|
||||
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
|
||||
done
|
||||
])
|
||||
])
|
||||
AC_ARG_ENABLE([enable_64], [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], [enable_64="$enableval"], [enable_64="no"])
|
||||
|
||||
AX_COMPILER_VENDOR
|
||||
|
||||
case "${ax_cv_c_compiler_vendor}" in
|
||||
gnu)
|
||||
COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0"
|
||||
;;
|
||||
sun)
|
||||
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara"
|
||||
if test "$enable_64" = "yes" ; then
|
||||
COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#set SOLINK variable based on compiler and host
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
||||
SOLINK="-Bdynamic -dy -G"
|
||||
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
|
||||
case "$host" in
|
||||
*darwin*)
|
||||
SOLINK="-dynamic -bundle -force-flat-namespace"
|
||||
;;
|
||||
*-solaris2*)
|
||||
SOLINK="-shared -Xlinker"
|
||||
;;
|
||||
*)
|
||||
SOLINK="-shared -Xlinker -x"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
AC_ERROR([Please update configure.in with SOLINK values for your compiler])
|
||||
fi
|
||||
|
||||
# set DYNAMIC_LIB_EXTEN
|
||||
# we should really be using libtool so we don't need to do this
|
||||
case "$host" in
|
||||
*cygwin* | *mingw*)
|
||||
DYNAMIC_LIB_EXTEN="dll"
|
||||
;;
|
||||
*)
|
||||
DYNAMIC_LIB_EXTEN="so"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(SOLINK)
|
||||
AC_SUBST(DYNAMIC_LIB_EXTEN)
|
||||
|
||||
AC_CHECK_LIB([dl], [dlopen])
|
||||
AC_CHECK_LIB([pthread], [pthread_create])
|
||||
AC_CHECK_LIB([m], [cos])
|
||||
AX_LIB_PCAP
|
||||
|
||||
AC_CHECK_HEADERS([netinet/sctp.h netdb.h sys/select.h])
|
||||
AM_CONDITIONAL([HAVE_SCTP],[test "${ac_cv_header_netinet_sctp_h}" = "yes"])
|
||||
|
||||
AC_CHECK_FUNC([gethostbyname_r],
|
||||
[], [AC_CHECK_LIB([nsl], [gethostbyname_r])]
|
||||
)
|
||||
if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes" ; then
|
||||
|
||||
AC_MSG_CHECKING([whether gethostbyname_r requires five arguments])
|
||||
|
||||
ac_cv_func_gethostbyname_r_five_args="no"
|
||||
|
||||
AC_TRY_COMPILE([#include <netdb.h>],
|
||||
[char *name;
|
||||
struct hostent *he, *res;
|
||||
char buffer[2048];
|
||||
int buflen = 2048;
|
||||
(void)gethostbyname_r(name, he, buffer, buflen, &res)],
|
||||
[ac_cv_func_gethostbyname_r_five_args="yes"
|
||||
AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])]
|
||||
)
|
||||
|
||||
AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args])
|
||||
AC_DEFINE([HAVE_GETHOSTBYNAME_R],[1],[threadsafe gethostbyname])
|
||||
fi
|
||||
|
||||
# Enable debugging
|
||||
AC_ARG_ENABLE(debug,
|
||||
[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enableval"],[enable_debug="yes"])
|
||||
|
||||
if test "${enable_debug}" = "yes"; then
|
||||
AC_DEFINE([DEBUG],[],[Enable extra debugging.])
|
||||
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
|
||||
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Where to install the modules
|
||||
AC_ARG_WITH([modinstdir],
|
||||
[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"])
|
||||
|
||||
AC_SUBST(modinstdir)
|
||||
|
||||
|
||||
# libpri?
|
||||
AC_ARG_WITH([libpri],
|
||||
[AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])], [enable_libpri="yes"], [enable_libpri="no"])
|
||||
AC_SUBST(enable_libpri)
|
||||
|
||||
AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [have_libsangoma="yes"])
|
||||
AM_CONDITIONAL([LIBSANGOMA],[test "${have_libsangoma}" = "yes"])
|
||||
|
||||
AM_CONDITIONAL([LIBPRI],[test "${enable_libpri}" = "yes"])
|
||||
|
||||
AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [have_openr2="yes"])
|
||||
AM_CONDITIONAL([OPENR2],[test "${have_openr2}" = "yes"])
|
||||
|
||||
COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS"
|
||||
AC_SUBST(COMP_VENDOR_CFLAGS)
|
||||
AC_CONFIG_FILES([Makefile
|
||||
freetdm.pc
|
||||
mod_freetdm/Makefile])
|
||||
AC_OUTPUT
|
3
libs/freetdm/configure.gnu
Normal file
3
libs/freetdm/configure.gnu
Normal file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
./configure "$@" --with-pic
|
||||
|
11
libs/freetdm/cyginstall.sh
Normal file
11
libs/freetdm/cyginstall.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# this script must be run from openzap root dir and it is assuming
|
||||
# FreeSWITCH is trunk is located at ../../
|
||||
fsdir=../..
|
||||
set -x
|
||||
cp Debug/*.dll $fsdir/Debug/
|
||||
cp Debug/mod/*.dll $fsdir/Debug/mod/
|
||||
cp Debug/*.pdb $fsdir/Debug/
|
||||
echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS"
|
||||
set +x
|
||||
|
277
libs/freetdm/docs/Doxygen.conf
Normal file
277
libs/freetdm/docs/Doxygen.conf
Normal file
@ -0,0 +1,277 @@
|
||||
# Doxyfile 1.4.6
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = OpenZAP
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = .
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = YES
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
IGNORE_PREFIX = zap_ ZAP_ Q921 Q931
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../src ../src/include \
|
||||
../src/isdn ../src/isdn/include \
|
||||
../mod_openzap ../ \
|
||||
../src/ozmod \
|
||||
../src/ozmod/ozmod_analog \
|
||||
../src/ozmod/ozmod_analog_em \
|
||||
../src/ozmod/ozmod_isdn \
|
||||
../src/ozmod/ozmod_pika \
|
||||
../src/ozmod/ozmod_skel \
|
||||
../src/ozmod/ozmod_ss7_boost \
|
||||
../src/ozmod/ozmod_wanpipe \
|
||||
../src/ozmod/ozmod_zt
|
||||
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.d \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.idl \
|
||||
*.odl \
|
||||
*.cs \
|
||||
*.php \
|
||||
*.php3 \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.py
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = YES
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
USE_HTAGS = YES
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 1
|
||||
IGNORE_PREFIX = zap_
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE = freeswitch.chm
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = YES
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = NO
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS = *.h
|
||||
PREDEFINED = ZAP_DECLARE(x)=x \
|
||||
APR_DECLARE(x)=x \
|
||||
ZAP_MOD_DECLARE(x)=x \
|
||||
DoxyDefine(x)=x
|
||||
|
||||
EXPAND_AS_DEFINED = NO
|
||||
SKIP_FUNCTION_MACROS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = YES
|
||||
TEMPLATE_RELATIONS = YES
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = jpg
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
112
libs/freetdm/freetdm.2008.sln
Normal file
112
libs/freetdm/freetdm.2008.sln
Normal file
@ -0,0 +1,112 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetdm", "msvc\freetdm.2008.vcproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2008.vcproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2008.vcproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_freetdm", "mod_freetdm\mod_freetdm.2008.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog", "src\ftmod\ftmod_analog\ftmod_analog.2008.vcproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog_em", "src\ftmod\ftmod_analog_em\ftmod_analog_em.2008.vcproj", "{B3F49375-2834-4937-9D8C-4AC2EC911010}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_isdn", "src\ftmod\ftmod_isdn\ftmod_isdn.2008.vcproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_pika", "src\ftmod\ftmod_pika\ftmod_pika.2008.vcproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_wanpipe", "src\ftmod\ftmod_wanpipe\ftmod_wanpipe.2008.vcproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_boost", "src\ftmod\ftmod_sangoma_boost\ftmod_sangoma_boost.2008.vcproj", "{D021EF2A-460D-4827-A0F7-41FDECF46F1B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testboost", "msvc\testboost\testboost.2008.vcproj", "{2B1BAF36-0241-43E7-B865-A8338AD48E2E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsangomaboost", "msvc\testboost\testsangomaboost.2008.vcproj", "{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.Build.0 = Release|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32
|
||||
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.Build.0 = Release|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.Build.0 = Release|Win32
|
||||
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.Build.0 = Release|Win32
|
||||
{2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.Build.0 = Release|Win32
|
||||
{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
17
libs/freetdm/freetdm.pc.in
Normal file
17
libs/freetdm/freetdm.pc.in
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# OpenZAP pkg-config file
|
||||
#
|
||||
prefix=@prefix@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: OpenZAP
|
||||
Description:
|
||||
Version: @PACKAGE_VERSION@
|
||||
URL: http://www.openzap.org/
|
||||
Requires:
|
||||
Conflicts:
|
||||
Libs: -L${libdir} -lopenzap
|
||||
Libs.private: -lm
|
||||
Cflags: -I${includedir}
|
23
libs/freetdm/mod_freetdm/Makefile.in
Normal file
23
libs/freetdm/mod_freetdm/Makefile.in
Normal file
@ -0,0 +1,23 @@
|
||||
FT_CFLAGS=@CFLAGS@ @COMP_VENDOR_CFLAGS@ @DEFS@
|
||||
|
||||
BASE=../../..
|
||||
FT_DIR=..
|
||||
VERBOSE=1
|
||||
FTLA=$(FT_DIR)/libfreetdm.la
|
||||
LOCAL_CFLAGS=-I$(FT_DIR)/src/include -I$(FT_DIR)/src/isdn/include $(FT_CFLAGS)
|
||||
LOCAL_LDFLAGS=-L$(FT_DIR) -lfreetdm
|
||||
include $(BASE)/build/modmake.rules
|
||||
|
||||
local_depend: $(FTLA)
|
||||
|
||||
$(FTLA): $(FT_DIR)/.update
|
||||
cd $(FT_DIR) && $(MAKE)
|
||||
|
||||
local_install:
|
||||
cd $(FT_DIR) && $(MAKE) install
|
||||
[ -f $(DESTDIR)@confdir@/autoload_configs/freetdm.conf.xml ] || cp -f $(FT_DIR)/conf/freetdm.conf.xml $(DESTDIR)@confdir@/autoload_configs
|
||||
|
||||
local_clean:
|
||||
cd $(FT_DIR) && $(MAKE) clean
|
||||
|
||||
|
369
libs/freetdm/mod_freetdm/mod_freetdm.2008.vcproj
Normal file
369
libs/freetdm/mod_freetdm/mod_freetdm.2008.vcproj
Normal file
@ -0,0 +1,369 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mod_freetdm"
|
||||
ProjectGUID="{FE3540C5-3303-46E0-A69E-D92F775687F1}"
|
||||
RootNamespace="mod_freetdm"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="FreeSwitchCore.lib"
|
||||
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_freetdm.dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(OutDir)/mod_freetdm.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="FreeSwitchCore.lib"
|
||||
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_freetdm.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(OutDir)/mod_freetdm.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="FreeSwitchCore.lib"
|
||||
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_freetdm.dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(OutDir)/mod_freetdm.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="FreeSwitchCore.lib"
|
||||
OutputFile="$(SolutionDir)$(OutDir)/mod/mod_freetdm.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(OutDir)/mod_freetdm.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\mod_freetdm.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
3193
libs/freetdm/mod_freetdm/mod_freetdm.c
Normal file
3193
libs/freetdm/mod_freetdm/mod_freetdm.c
Normal file
File diff suppressed because it is too large
Load Diff
201
libs/freetdm/mod_freetdm/mod_openzap.2005.vcproj
Normal file
201
libs/freetdm/mod_freetdm/mod_openzap.2005.vcproj
Normal file
@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="mod_freetdm"
|
||||
ProjectGUID="{FE3540C5-3303-46E0-A69E-D92F775687F1}"
|
||||
RootNamespace="mod_freetdm"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="FreeSwitchCore.lib"
|
||||
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/mod_freetdm.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../src/include;../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="FreeSwitchCore.lib"
|
||||
OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
ImportLibrary="$(OutDir)/mod_freetdm.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\mod_freetdm.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
455
libs/freetdm/msvc/freetdm.2008.vcproj
Normal file
455
libs/freetdm/msvc/freetdm.2008.vcproj
Normal file
@ -0,0 +1,455 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="freetdm"
|
||||
ProjectGUID="{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
|
||||
RootNamespace="freetdm"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DisableLanguageExtensions="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
DisableLanguageExtensions="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DisableLanguageExtensions="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
DisableLanguageExtensions="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\src\include\fsk.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\g711.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\hashtable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\hashtable_itr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\hashtable_private.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\libteletone.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\libteletone_detect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\libteletone_generate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\freetdm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\uart.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_buffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_dso.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_threadmutex.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_types.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\src\fsk.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\g711.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\hashtable.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\hashtable_itr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\libteletone_detect.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\libteletone_generate.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\uart.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_buffer.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_callerid.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_config.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_dso.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_io.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_queue.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_threadmutex.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
301
libs/freetdm/msvc/openzap.2005.vcproj
Normal file
301
libs/freetdm/msvc/openzap.2005.vcproj
Normal file
@ -0,0 +1,301 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="freetdm"
|
||||
ProjectGUID="{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
|
||||
RootNamespace="freetdm"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DisableLanguageExtensions="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../src/include;../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
DisableLanguageExtensions="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\src\fsk.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\g711.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\hashtable.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\hashtable_itr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\libteletone_detect.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\libteletone_generate.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\uart.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_buffer.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_callerid.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_config.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_dso.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_io.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ftdm_threadmutex.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\src\include\fsk.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\g711.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\hashtable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\hashtable_itr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\hashtable_private.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\libteletone.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\libteletone_detect.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\libteletone_generate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\freetdm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\uart.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_buffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_dso.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_threadmutex.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\include\ftdm_types.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
193
libs/freetdm/msvc/testanalog/testanalog.2005.vcproj
Normal file
193
libs/freetdm/msvc/testanalog/testanalog.2005.vcproj
Normal file
@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="testanalog"
|
||||
ProjectGUID="{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
|
||||
RootNamespace="testanalog"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\testanalog.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
349
libs/freetdm/msvc/testanalog/testanalog.2008.vcproj
Normal file
349
libs/freetdm/msvc/testanalog/testanalog.2008.vcproj
Normal file
@ -0,0 +1,349 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="testanalog"
|
||||
ProjectGUID="{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
|
||||
RootNamespace="testanalog"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testanalog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\testanalog.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
191
libs/freetdm/msvc/testboost/testboost.2008.vcproj
Normal file
191
libs/freetdm/msvc/testboost/testboost.2008.vcproj
Normal file
@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="testboost"
|
||||
ProjectGUID="{2B1BAF36-0241-43E7-B865-A8338AD48E2E}"
|
||||
RootNamespace="testboost"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testboost.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\debug\freetdm.lib"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testboost.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\testboost.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
191
libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj
Normal file
191
libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj
Normal file
@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="testsangomaboost"
|
||||
ProjectGUID="{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}"
|
||||
RootNamespace="testsangomaboost"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testsangomaboost.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\debug\freetdm.lib"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testsangomaboost.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\testsangomaboost.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
193
libs/freetdm/msvc/testisdn/testisdn.2005.vcproj
Normal file
193
libs/freetdm/msvc/testisdn/testisdn.2005.vcproj
Normal file
@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="testisdn"
|
||||
ProjectGUID="{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
|
||||
RootNamespace="testisdn"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\testisdn.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
349
libs/freetdm/msvc/testisdn/testisdn.2008.vcproj
Normal file
349
libs/freetdm/msvc/testisdn/testisdn.2008.vcproj
Normal file
@ -0,0 +1,349 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="testisdn"
|
||||
ProjectGUID="{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
|
||||
RootNamespace="testisdn"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog-testisdn.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../src/include;../../src/isdn/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\testisdn.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
82
libs/freetdm/openzap.2005.sln
Normal file
82
libs/freetdm/openzap.2005.sln
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openzap", "msvc\openzap.2005.vcproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2005.vcproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2005.vcproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_openzap", "mod_openzap\mod_openzap.2005.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog", "src\ozmod\ozmod_analog\ozmod_analog.2005.vcproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog_em", "src\ozmod\ozmod_analog_em\ozmod_analog_em.2005.vcproj", "{C539D7C8-26A8-4A94-B938-77672165C130}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_isdn", "src\ozmod\ozmod_isdn\ozmod_isdn.2005.vcproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_wanpipe", "src\ozmod\ozmod_wanpipe\ozmod_wanpipe.2005.vcproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_pika", "src\ozmod\ozmod_pika\ozmod_pika.2005.vcproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.Build.0 = Release|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32
|
||||
{C539D7C8-26A8-4A94-B938-77672165C130}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C539D7C8-26A8-4A94-B938-77672165C130}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C539D7C8-26A8-4A94-B938-77672165C130}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C539D7C8-26A8-4A94-B938-77672165C130}.Release|Win32.Build.0 = Release|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.Build.0 = Release|Win32
|
||||
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
99
libs/freetdm/ozrename.sh
Executable file
99
libs/freetdm/ozrename.sh
Executable file
@ -0,0 +1,99 @@
|
||||
# renaming main header and build file
|
||||
copy="cp -r"
|
||||
|
||||
$copy src/include/openzap.h src/include/freetdm.h
|
||||
svn delete src/include/openzap.h
|
||||
$copy openzap.pc.in freetdm.pc.in
|
||||
svn delete openzap.pc.in
|
||||
|
||||
# create mod_freetdm
|
||||
mkdir mod_freetdm
|
||||
cp mod_openzap/* mod_freetdm/
|
||||
mv mod_freetdm/mod_openzap.c mod_freetdm/mod_freetdm.c
|
||||
svn delete --force mod_openzap
|
||||
|
||||
|
||||
##### ozmod stuff ####
|
||||
# rename anything ozmod to ftmod, including directories first
|
||||
mkdir ./src/ftmod
|
||||
for file in `find ./src/ozmod -name *ozmod_* -type d`
|
||||
do
|
||||
$copy ${file} ${file//ozmod/ftmod}
|
||||
done
|
||||
|
||||
#remove .svn directories in the copied ozmod dirs
|
||||
find ./src/ftmod -name *.svn -exec rm -rf {} \;
|
||||
|
||||
# copy ozmod c files
|
||||
for file in `find ./src/ftmod -name *ozmod_*.c`
|
||||
do
|
||||
mv $file ${file//ozmod/ftmod}
|
||||
done
|
||||
|
||||
# copy ozmod h files
|
||||
for file in `find ./src/ftmod -name *ozmod_*.h`
|
||||
do
|
||||
mv $file ${file//ozmod/ftmod}
|
||||
done
|
||||
|
||||
#### end ozmod stuff ####
|
||||
|
||||
# renaming other zap files
|
||||
for file in `find ./ -name *zap_*.c`
|
||||
do
|
||||
mv $file ${file//zap_/ftdm_}
|
||||
done
|
||||
|
||||
for file in `find ./ -name *zap_*.h`
|
||||
do
|
||||
mv $file ${file//zap_/ftdm_}
|
||||
done
|
||||
|
||||
svn revert -R src/ozmod
|
||||
svn delete --force src/ozmod
|
||||
|
||||
# replace full openzap occurences first (handles openzap.h, libopenzap etc)
|
||||
find ./ -name *.c -exec sed -i 's,openzap,freetdm,g' {} \;
|
||||
|
||||
find ./ -name *.h -exec sed -i 's,openzap,freetdm,g' {} \;
|
||||
|
||||
sed -i 's,openzap,freetdm,g' Makefile.am
|
||||
|
||||
sed -i 's,openzap,freetdm,g' configure.ac
|
||||
|
||||
sed -i 's,openzap,freetdm,g' mod_freetdm/Makefile.in
|
||||
|
||||
# replace inside files
|
||||
find ./ -name *.c -exec sed -i 's,oz,ft,g' {} \;
|
||||
find ./ -name *.c -exec sed -i 's,OZ,FT,g' {} \;
|
||||
find ./ -name *.c -exec sed -i 's,zap,ftdm,g' {} \;
|
||||
find ./ -name *.c -exec sed -i 's,ZAP,FTDM,g' {} \;
|
||||
find ./ -name *.c -exec sed -i 's,zchan,ftdmchan,g' {} \;
|
||||
|
||||
find ./ -name *.h -exec sed -i 's,oz,ft,g' {} \;
|
||||
find ./ -name *.h -exec sed -i 's,OZ,FT,g' {} \;
|
||||
find ./ -name *.h -exec sed -i 's,zap,ftdm,g' {} \;
|
||||
find ./ -name *.h -exec sed -i 's,ZAP,FTDM,g' {} \;
|
||||
find ./ -name *.h -exec sed -i 's,zchan,ftdmchan,g' {} \;
|
||||
|
||||
sed -i 's,oz,ft,g' Makefile.am
|
||||
sed -i 's,OZ,FT,g' Makefile.am
|
||||
sed -i 's,zap,ftdm,g' Makefile.am
|
||||
sed -i 's,ZAP,FTDM,g' Makefile.am
|
||||
sed -i 's,zchan,ftdmchan,g' Makefile.am
|
||||
|
||||
sed -i 's,oz,ft,g' configure.ac
|
||||
sed -i 's,OZ,FT,g' configure.ac
|
||||
sed -i 's,zap,ftdm,g' configure.ac
|
||||
sed -i 's,ZAP,FTDM,g' configure.ac
|
||||
sed -i 's,zchan,ftdmchan,g' configure.ac
|
||||
|
||||
sed -i 's,oz,ft,g' mod_freetdm/Makefile.in
|
||||
sed -i 's,OZ,FT,g' mod_freetdm/Makefile.in
|
||||
sed -i 's,zap,ftdm,g' mod_freetdm/Makefile.in
|
||||
sed -i 's,ZAP,FTDM,g' mod_freetdm/Makefile.in
|
||||
sed -i 's,zchan,ftdmchan,g' mod_freetdm/Makefile.in
|
||||
|
||||
svn add src/ftmod/
|
||||
svn add mod_freetdm/
|
||||
|
13
libs/freetdm/ozreplace.sh
Executable file
13
libs/freetdm/ozreplace.sh
Executable file
@ -0,0 +1,13 @@
|
||||
##### ozmod stuff ####
|
||||
# replace full openzap occurences first (handles openzap.h, libopenzap etc)
|
||||
sed -i 's,openzap,freetdm,g' $1
|
||||
sed -i 's,ozmod,ftmod,g' $1
|
||||
|
||||
sed -i 's,zchan,ftdmchan,g' $1
|
||||
sed -i 's,oz,ft,g' $1
|
||||
sed -i 's,OZ,FT,g' $1
|
||||
sed -i 's,zap,ftdm,g' $1
|
||||
sed -i 's,ZAP,FTDM,g' $1
|
||||
sed -i 's,zio,fio,g' $1
|
||||
sed -i 's,ZIO,FIO,g' $1
|
||||
|
134
libs/freetdm/patches/oz.diff
Normal file
134
libs/freetdm/patches/oz.diff
Normal file
@ -0,0 +1,134 @@
|
||||
Index: src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
|
||||
===================================================================
|
||||
--- src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (revision 745)
|
||||
+++ src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (working copy)
|
||||
@@ -98,19 +98,21 @@
|
||||
* so we can have one analong handler thread that will deal with all the idle analog channels for events
|
||||
* the alternative would be for the driver to provide one socket for all of the oob events for all analog channels
|
||||
*/
|
||||
-static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int *flags)
|
||||
+static __inline__ int tdmv_api_wait_socket(zap_channel_t *zchan, int timeout, int *flags)
|
||||
{
|
||||
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
int err;
|
||||
- sangoma_wait_obj_t sangoma_wait_obj;
|
||||
+ sangoma_wait_obj_t *sangoma_wait_obj = zchan->mod_data;
|
||||
|
||||
- sangoma_init_wait_obj(&sangoma_wait_obj, fd, 1, 1, *flags, SANGOMA_WAIT_OBJ);
|
||||
+ sangoma_init_wait_obj(sangoma_wait_obj, zchan->sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ);
|
||||
|
||||
- err=sangoma_socket_waitfor_many(&sangoma_wait_obj,1 , timeout);
|
||||
+ err = sangoma_socket_waitfor_many(&sangoma_wait_obj, 1, timeout);
|
||||
+
|
||||
if (err > 0) {
|
||||
- *flags=sangoma_wait_obj.flags_out;
|
||||
+ *flags = sangoma_wait_obj.flags_out;
|
||||
}
|
||||
+
|
||||
return err;
|
||||
|
||||
#else
|
||||
@@ -118,7 +120,7 @@
|
||||
int res;
|
||||
|
||||
memset(&pfds[0], 0, sizeof(pfds[0]));
|
||||
- pfds[0].fd = fd;
|
||||
+ pfds[0].fd = zchan->sockfd;
|
||||
pfds[0].events = *flags;
|
||||
res = poll(pfds, 1, timeout);
|
||||
*flags = 0;
|
||||
@@ -200,6 +202,15 @@
|
||||
|
||||
if (sockfd != WP_INVALID_SOCKET && zap_span_add_channel(span, sockfd, type, &chan) == ZAP_SUCCESS) {
|
||||
wanpipe_tdm_api_t tdm_api;
|
||||
+#ifdef LIBSANGOMA_VERSION
|
||||
+ sangoma_wait_obj_t *sangoma_wait_obj;
|
||||
+
|
||||
+ sangoma_wait_obj = malloc(sizeof(*sangoma_wait_obj));
|
||||
+ memset(sangoma_wait_obj, 0, sizeof(*sangoma_wait_obj));
|
||||
+ sangoma_init_wait_obj(sangoma_wait_obj, sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ);
|
||||
+ chan->mod_data = sangoma_wait_obj;
|
||||
+#endif
|
||||
+
|
||||
memset(&tdm_api,0,sizeof(tdm_api));
|
||||
|
||||
chan->physical_span_id = spanno;
|
||||
@@ -211,7 +222,7 @@
|
||||
|
||||
dtmf = "software";
|
||||
|
||||
- /* FIXME: Handle Error Conditino Check for return code */
|
||||
+ /* FIXME: Handle Error Condition Check for return code */
|
||||
err= sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api);
|
||||
|
||||
if (tdm_api.wp_tdm_cmd.hw_tdm_coding) {
|
||||
@@ -606,7 +617,7 @@
|
||||
inflags |= POLLPRI;
|
||||
}
|
||||
|
||||
- result = tdmv_api_wait_socket(zchan->sockfd, to, &inflags);
|
||||
+ result = tdmv_api_wait_socket(zchan, to, &inflags);
|
||||
|
||||
*flags = ZAP_NO_FLAGS;
|
||||
|
||||
@@ -643,26 +654,30 @@
|
||||
ZIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event)
|
||||
{
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
- sangoma_wait_obj_t pfds[ZAP_MAX_CHANNELS_SPAN];
|
||||
+ sangoma_wait_obj_t *pfds[ZAP_MAX_CHANNELS_SPAN] = { 0 };
|
||||
#else
|
||||
struct pollfd pfds[ZAP_MAX_CHANNELS_SPAN];
|
||||
#endif
|
||||
|
||||
uint32_t i, j = 0, k = 0, l = 0;
|
||||
- int objects=0;
|
||||
int r;
|
||||
|
||||
for(i = 1; i <= span->chan_count; i++) {
|
||||
zap_channel_t *zchan = span->channels[i];
|
||||
|
||||
+
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
- sangoma_init_wait_obj(&pfds[j], zchan->sockfd , 1, 1, POLLPRI, SANGOMA_WAIT_OBJ);
|
||||
+ if (!zchan->mod_data) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ pfds[j] = zchan->mod_data;
|
||||
+
|
||||
#else
|
||||
memset(&pfds[j], 0, sizeof(pfds[j]));
|
||||
pfds[j].fd = span->channels[i]->sockfd;
|
||||
pfds[j].events = POLLPRI;
|
||||
#endif
|
||||
- objects++;
|
||||
+
|
||||
/* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */
|
||||
|
||||
if (zap_test_flag(zchan, ZAP_CHANNEL_WINK) || zap_test_flag(zchan, ZAP_CHANNEL_FLASH)) {
|
||||
@@ -703,7 +718,7 @@
|
||||
ms = l;
|
||||
}
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
- r = sangoma_socket_waitfor_many(pfds,objects,ms);
|
||||
+ r = sangoma_socket_waitfor_many(pfds, j, ms);
|
||||
#else
|
||||
r = poll(pfds, j, ms);
|
||||
#endif
|
||||
@@ -935,6 +950,15 @@
|
||||
*/
|
||||
static ZIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
|
||||
{
|
||||
+ sangoma_wait_obj_t *sangoma_wait_obj;
|
||||
+
|
||||
+ if (zchan->mod_data) {
|
||||
+ sangoma_wait_obj = zchan->mod_data;
|
||||
+ zchan->mod_data = NULL;
|
||||
+ sangoma_release_wait_obj(sangoma_wait_obj);
|
||||
+ free(sangoma_wait_obj);
|
||||
+ }
|
||||
+
|
||||
if (zchan->sockfd > -1) {
|
||||
close(zchan->sockfd);
|
||||
zchan->sockfd = WP_INVALID_SOCKET;
|
33
libs/freetdm/src/detect_dtmf.c
Normal file
33
libs/freetdm/src/detect_dtmf.c
Normal file
@ -0,0 +1,33 @@
|
||||
//#include "freetdm.h"
|
||||
#include "libteletone_detect.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fd, b;
|
||||
short sln[512] = {0};
|
||||
teletone_dtmf_detect_state_t dtmf_detect = {0};
|
||||
char digit_str[128] = "";
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Arg Error!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
teletone_dtmf_detect_init (&dtmf_detect, 8000);
|
||||
|
||||
if ((fd = open(argv[1], O_RDONLY)) < 0) {
|
||||
fprintf(stderr, "File Error! [%s]\n", strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
while((b = read(fd, sln, 320)) > 0) {
|
||||
teletone_dtmf_detect(&dtmf_detect, sln, b / 2);
|
||||
teletone_dtmf_get(&dtmf_detect, digit_str, sizeof(digit_str));
|
||||
if (*digit_str) {
|
||||
printf("digit: %s\n", digit_str);
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
32
libs/freetdm/src/detect_tones.c
Normal file
32
libs/freetdm/src/detect_tones.c
Normal file
@ -0,0 +1,32 @@
|
||||
//#include "freetdm.h"
|
||||
#include "libteletone_detect.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
teletone_multi_tone_t mt = {0};
|
||||
teletone_tone_map_t map = {{0}};
|
||||
|
||||
int fd, b;
|
||||
short sln[512] = {0};
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Arg Error!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
map.freqs[0] = atof("350");
|
||||
map.freqs[1] = atof("440");
|
||||
teletone_multi_tone_init(&mt, &map);
|
||||
|
||||
if ((fd = open(argv[1], O_RDONLY)) < 0) {
|
||||
fprintf(stderr, "File Error! [%s]\n", strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
while((b = read(fd, sln, 320)) > 0) {
|
||||
printf("TEST %d %d\n", b, teletone_multi_tone_detect(&mt, sln, b / 2));
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
351
libs/freetdm/src/fsk.c
Normal file
351
libs/freetdm/src/fsk.c
Normal file
@ -0,0 +1,351 @@
|
||||
|
||||
/*
|
||||
* bell202.c
|
||||
*
|
||||
* Copyright (c) 2005 Robert Krten. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This module contains a Bell-202 1200-baud FSK decoder, suitable for
|
||||
* use in a library. The general style of the library calls is modeled
|
||||
* after the POSIX pthread_*() functions.
|
||||
*
|
||||
* 2005 03 20 R. Krten created
|
||||
*/
|
||||
#include <freetdm.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "fsk.h"
|
||||
#include "uart.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
fsk_modem_definition_t fsk_modem_definitions[] =
|
||||
{
|
||||
{ /* FSK_V23_FORWARD_MODE1 */ 1700, 1300, 600 },
|
||||
{ /* FSK_V23_FORWARD_MODE2 */ 2100, 1300, 1200 },
|
||||
{ /* FSK_V23_BACKWARD */ 450, 390, 75 },
|
||||
{ /* FSK_BELL202 */ 2200, 1200, 1200 },
|
||||
};
|
||||
|
||||
/*
|
||||
* dsp_fsk_attr_init
|
||||
*
|
||||
* Initializes the attributes structure; this must be done before the
|
||||
* attributes structure is used.
|
||||
*/
|
||||
|
||||
void dsp_fsk_attr_init (dsp_fsk_attr_t *attr)
|
||||
{
|
||||
memset(attr, 0, sizeof(*attr));
|
||||
}
|
||||
|
||||
/*
|
||||
* dsp_fsk_attr_get_bithandler
|
||||
* dsp_fsk_attr_set_bithandler
|
||||
* dsp_fsk_attr_get_bytehandler
|
||||
* dsp_fsk_attr_set_bytehandler
|
||||
* dsp_fsk_attr_getsamplerate
|
||||
* dsp_fsk_attr_setsamplerate
|
||||
*
|
||||
* These functions get and set their respective elements from the
|
||||
* attributes structure. If an error code is returned, it is just
|
||||
* zero == ok, -1 == fail.
|
||||
*/
|
||||
|
||||
bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attr, void **bithandler_arg)
|
||||
{
|
||||
*bithandler_arg = attr->bithandler_arg;
|
||||
return attr->bithandler;
|
||||
}
|
||||
|
||||
void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attr, bithandler_func_t bithandler, void *bithandler_arg)
|
||||
{
|
||||
attr->bithandler = bithandler;
|
||||
attr->bithandler_arg = bithandler_arg;
|
||||
}
|
||||
|
||||
bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attr, void **bytehandler_arg)
|
||||
{
|
||||
*bytehandler_arg = attr->bytehandler_arg;
|
||||
return attr->bytehandler;
|
||||
}
|
||||
|
||||
void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg)
|
||||
{
|
||||
attr->bytehandler = bytehandler;
|
||||
attr->bytehandler_arg = bytehandler_arg;
|
||||
}
|
||||
|
||||
int dsp_fsk_attr_get_samplerate (dsp_fsk_attr_t *attr)
|
||||
{
|
||||
return attr->sample_rate;
|
||||
}
|
||||
|
||||
int dsp_fsk_attr_set_samplerate (dsp_fsk_attr_t *attr, int samplerate)
|
||||
{
|
||||
if (samplerate <= 0) {
|
||||
return -1;
|
||||
}
|
||||
attr->sample_rate = samplerate;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* dsp_fsk_create
|
||||
*
|
||||
* Creates a handle for subsequent use. The handle is created to contain
|
||||
* a context data structure for use by the sample handler function. The
|
||||
* function expects an initialized attributes structure, and returns the
|
||||
* handle or a NULL if there were errors.
|
||||
*
|
||||
* Once created, the handle can be used until it is destroyed.
|
||||
*/
|
||||
|
||||
dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr)
|
||||
{
|
||||
int i;
|
||||
double phi_mark, phi_space;
|
||||
dsp_fsk_handle_t *handle;
|
||||
|
||||
handle = ftdm_malloc(sizeof(*handle));
|
||||
if (!handle) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(handle, 0, sizeof(*handle));
|
||||
|
||||
/* fill the attributes member */
|
||||
memcpy(&handle->attr, attr, sizeof(*attr));
|
||||
|
||||
/* see if we can do downsampling. We only really need 6 samples to "match" */
|
||||
if (attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark > 6) {
|
||||
handle->downsampling_count = attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark / 6;
|
||||
} else {
|
||||
handle->downsampling_count = 1;
|
||||
}
|
||||
handle->current_downsample = 1;
|
||||
|
||||
/* calculate the correlate size (number of samples required for slowest wave) */
|
||||
handle->corrsize = attr->sample_rate / handle->downsampling_count / fsk_modem_definitions[FSK_BELL202].freq_mark;
|
||||
|
||||
/* allocate the correlation sin/cos arrays and initialize */
|
||||
for (i = 0; i < 4; i++) {
|
||||
handle->correlates[i] = ftdm_malloc(sizeof(double) * handle->corrsize);
|
||||
if (handle->correlates[i] == NULL) {
|
||||
/* some failed, back out memory allocations */
|
||||
dsp_fsk_destroy(&handle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* now initialize them */
|
||||
phi_mark = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_mark);
|
||||
phi_space = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_space);
|
||||
|
||||
for (i = 0; i < handle->corrsize; i++) {
|
||||
handle->correlates[0][i] = sin(phi_mark * (double) i);
|
||||
handle->correlates[1][i] = cos(phi_mark * (double) i);
|
||||
handle->correlates[2][i] = sin(phi_space * (double) i);
|
||||
handle->correlates[3][i] = cos(phi_space * (double) i);
|
||||
}
|
||||
|
||||
/* initialize the ring buffer */
|
||||
handle->buffer = ftdm_malloc(sizeof(double) * handle->corrsize);
|
||||
if (!handle->buffer) { /* failed; back out memory allocations */
|
||||
dsp_fsk_destroy(&handle);
|
||||
return NULL;
|
||||
}
|
||||
memset(handle->buffer, 0, sizeof(double) * handle->corrsize);
|
||||
handle->ringstart = 0;
|
||||
|
||||
/* initalize intra-cell position */
|
||||
handle->cellpos = 0;
|
||||
handle->celladj = fsk_modem_definitions[FSK_BELL202].baud_rate / (double) attr->sample_rate * (double) handle->downsampling_count;
|
||||
|
||||
/* if they have provided a byte handler, add a UART to the processing chain */
|
||||
if (handle->attr.bytehandler) {
|
||||
dsp_uart_attr_t uart_attr;
|
||||
dsp_uart_handle_t *uart_handle;
|
||||
|
||||
dsp_uart_attr_init(&uart_attr);
|
||||
dsp_uart_attr_set_bytehandler(&uart_attr, handle->attr.bytehandler, handle->attr.bytehandler_arg);
|
||||
uart_handle = dsp_uart_create(&uart_attr);
|
||||
if (uart_handle == NULL) {
|
||||
dsp_fsk_destroy(&handle);
|
||||
return NULL;
|
||||
}
|
||||
handle->attr.bithandler = dsp_uart_bit_handler;
|
||||
handle->attr.bithandler_arg = uart_handle;
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
/*
|
||||
* dsp_fsk_destroy
|
||||
*
|
||||
* Destroys a handle, releasing any associated memory. Sets handle pointer to NULL
|
||||
* so A destroyed handle can not be used for anything after the destroy.
|
||||
*/
|
||||
|
||||
void dsp_fsk_destroy(dsp_fsk_handle_t **handle)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* if empty handle, just return */
|
||||
if (*handle == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if ((*handle)->correlates[i] != NULL) {
|
||||
ftdm_safe_free((*handle)->correlates[i]);
|
||||
(*handle)->correlates[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*handle)->buffer != NULL) {
|
||||
ftdm_safe_free((*handle)->buffer);
|
||||
(*handle)->buffer = NULL;
|
||||
}
|
||||
|
||||
if ((*handle)->attr.bytehandler) {
|
||||
dsp_uart_handle_t** dhandle = (void *)(&(*handle)->attr.bithandler_arg);
|
||||
dsp_uart_destroy(dhandle);
|
||||
}
|
||||
|
||||
ftdm_safe_free(*handle);
|
||||
*handle = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* dsp_fsk_sample
|
||||
*
|
||||
* This is the main processing entry point. The function accepts a normalized
|
||||
* sample (i.e., one whose range is between -1 and +1). The function performs
|
||||
* the Bell-202 FSK modem decode processing, and, if it detects a valid bit,
|
||||
* will call the bithandler associated with the attributes structure.
|
||||
*
|
||||
* For the Bell-202 standard, a logical zero (space) is 2200 Hz, and a logical
|
||||
* one (mark) is 1200 Hz.
|
||||
*/
|
||||
|
||||
void
|
||||
dsp_fsk_sample (dsp_fsk_handle_t *handle, double normalized_sample)
|
||||
{
|
||||
double val;
|
||||
double factors[4];
|
||||
int i, j;
|
||||
|
||||
/* if we can avoid processing samples, do so */
|
||||
if (handle->downsampling_count != 1) {
|
||||
if (handle->current_downsample < handle->downsampling_count) {
|
||||
handle->current_downsample++;
|
||||
return; /* throw this sample out */
|
||||
}
|
||||
handle->current_downsample = 1;
|
||||
}
|
||||
|
||||
/* store sample in buffer */
|
||||
handle->buffer[handle->ringstart++] = normalized_sample;
|
||||
if (handle->ringstart >= handle->corrsize) {
|
||||
handle->ringstart = 0;
|
||||
}
|
||||
|
||||
/* do the correlation calculation */
|
||||
factors[0] = factors[1] = factors[2] = factors[3] = 0; /* clear out intermediate sums */
|
||||
j = handle->ringstart;
|
||||
for (i = 0; i < handle->corrsize; i++) {
|
||||
if (j >= handle->corrsize) {
|
||||
j = 0;
|
||||
}
|
||||
val = handle->buffer[j];
|
||||
factors[0] += handle->correlates[0][i] * val;
|
||||
factors[1] += handle->correlates[1][i] * val;
|
||||
factors[2] += handle->correlates[2][i] * val;
|
||||
factors[3] += handle->correlates[3][i] * val;
|
||||
j++;
|
||||
}
|
||||
|
||||
/* store the bit (bit value is comparison of the two sets of correlate factors) */
|
||||
handle->previous_bit = handle->current_bit;
|
||||
handle->current_bit = (factors[0] * factors[0] + factors[1] * factors[1] > factors[2] * factors[2] + factors[3] * factors[3]);
|
||||
|
||||
/* if there's a transition, we can synchronize the cell position */
|
||||
if (handle->previous_bit != handle->current_bit) {
|
||||
handle->cellpos = 0.5; /* adjust cell position to be in the middle of the cell */
|
||||
}
|
||||
handle->cellpos += handle->celladj; /* walk the cell along */
|
||||
|
||||
if (handle->cellpos > 1.0) {
|
||||
handle->cellpos -= 1.0;
|
||||
|
||||
switch (handle->state) {
|
||||
case FSK_STATE_DATA:
|
||||
{
|
||||
|
||||
(*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
|
||||
}
|
||||
break;
|
||||
case FSK_STATE_CHANSEIZE:
|
||||
{
|
||||
|
||||
if (handle->last_bit != handle->current_bit) {
|
||||
handle->conscutive_state_bits++;
|
||||
} else {
|
||||
handle->conscutive_state_bits = 0;
|
||||
}
|
||||
|
||||
if (handle->conscutive_state_bits > 15) {
|
||||
handle->state = FSK_STATE_CARRIERSIG;
|
||||
handle->conscutive_state_bits = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FSK_STATE_CARRIERSIG:
|
||||
{
|
||||
if (handle->current_bit) {
|
||||
handle->conscutive_state_bits++;
|
||||
} else {
|
||||
handle->conscutive_state_bits = 0;
|
||||
}
|
||||
|
||||
if (handle->conscutive_state_bits > 15) {
|
||||
handle->state = FSK_STATE_DATA;
|
||||
handle->conscutive_state_bits = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
handle->last_bit = handle->current_bit;
|
||||
}
|
||||
}
|
||||
|
302
libs/freetdm/src/ftdm_buffer.c
Normal file
302
libs/freetdm/src/ftdm_buffer.c
Normal file
@ -0,0 +1,302 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "ftdm_buffer.h"
|
||||
|
||||
static unsigned buffer_id = 0;
|
||||
|
||||
struct ftdm_buffer {
|
||||
unsigned char *data;
|
||||
unsigned char *head;
|
||||
ftdm_size_t used;
|
||||
ftdm_size_t actually_used;
|
||||
ftdm_size_t datalen;
|
||||
ftdm_size_t max_len;
|
||||
ftdm_size_t blocksize;
|
||||
unsigned id;
|
||||
int loops;
|
||||
};
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_buffer_create(ftdm_buffer_t **buffer, ftdm_size_t blocksize, ftdm_size_t start_len, ftdm_size_t max_len)
|
||||
{
|
||||
ftdm_buffer_t *new_buffer;
|
||||
|
||||
new_buffer = ftdm_malloc(sizeof(*new_buffer));
|
||||
if (new_buffer) {
|
||||
memset(new_buffer, 0, sizeof(*new_buffer));
|
||||
|
||||
if (start_len) {
|
||||
new_buffer->data = ftdm_malloc(start_len);
|
||||
if (!new_buffer->data) {
|
||||
ftdm_safe_free(new_buffer);
|
||||
return FTDM_MEMERR;
|
||||
}
|
||||
memset(new_buffer->data, 0, start_len);
|
||||
}
|
||||
|
||||
new_buffer->max_len = max_len;
|
||||
new_buffer->datalen = start_len;
|
||||
new_buffer->id = buffer_id++;
|
||||
new_buffer->blocksize = blocksize;
|
||||
new_buffer->head = new_buffer->data;
|
||||
|
||||
*buffer = new_buffer;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
return FTDM_MEMERR;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_len(ftdm_buffer_t *buffer)
|
||||
{
|
||||
|
||||
assert(buffer != NULL);
|
||||
|
||||
return buffer->datalen;
|
||||
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_freespace(ftdm_buffer_t *buffer)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
|
||||
|
||||
if (buffer->max_len) {
|
||||
return (ftdm_size_t) (buffer->max_len - buffer->used);
|
||||
}
|
||||
return 1000000;
|
||||
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_inuse(ftdm_buffer_t *buffer)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
|
||||
return buffer->used;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_seek(ftdm_buffer_t *buffer, ftdm_size_t datalen)
|
||||
{
|
||||
ftdm_size_t reading = 0;
|
||||
|
||||
assert(buffer != NULL);
|
||||
|
||||
if (buffer->used < 1) {
|
||||
buffer->used = 0;
|
||||
return 0;
|
||||
} else if (buffer->used >= datalen) {
|
||||
reading = datalen;
|
||||
} else {
|
||||
reading = buffer->used;
|
||||
}
|
||||
|
||||
buffer->used = buffer->actually_used - reading;
|
||||
buffer->head = buffer->data + reading;
|
||||
|
||||
return reading;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_toss(ftdm_buffer_t *buffer, ftdm_size_t datalen)
|
||||
{
|
||||
ftdm_size_t reading = 0;
|
||||
|
||||
assert(buffer != NULL);
|
||||
|
||||
if (buffer->used < 1) {
|
||||
buffer->used = 0;
|
||||
return 0;
|
||||
} else if (buffer->used >= datalen) {
|
||||
reading = datalen;
|
||||
} else {
|
||||
reading = buffer->used;
|
||||
}
|
||||
|
||||
buffer->used -= reading;
|
||||
buffer->head += reading;
|
||||
|
||||
return buffer->used;
|
||||
}
|
||||
|
||||
FT_DECLARE(void) ftdm_buffer_set_loops(ftdm_buffer_t *buffer, int loops)
|
||||
{
|
||||
buffer->loops = loops;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_read_loop(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen)
|
||||
{
|
||||
ftdm_size_t len;
|
||||
if ((len = ftdm_buffer_read(buffer, data, datalen)) < datalen) {
|
||||
if (buffer->loops == 0) {
|
||||
return len;
|
||||
}
|
||||
buffer->head = buffer->data;
|
||||
buffer->used = buffer->actually_used;
|
||||
len = ftdm_buffer_read(buffer, (char*)data + len, datalen - len);
|
||||
buffer->loops--;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_read(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen)
|
||||
{
|
||||
ftdm_size_t reading = 0;
|
||||
|
||||
assert(buffer != NULL);
|
||||
assert(data != NULL);
|
||||
|
||||
|
||||
if (buffer->used < 1) {
|
||||
buffer->used = 0;
|
||||
return 0;
|
||||
} else if (buffer->used >= datalen) {
|
||||
reading = datalen;
|
||||
} else {
|
||||
reading = buffer->used;
|
||||
}
|
||||
|
||||
memcpy(data, buffer->head, reading);
|
||||
buffer->used -= reading;
|
||||
buffer->head += reading;
|
||||
|
||||
/* if (buffer->id == 4) printf("%u o %d = %d\n", buffer->id, (unsigned)reading, (unsigned)buffer->used); */
|
||||
return reading;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_write(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen)
|
||||
{
|
||||
ftdm_size_t freespace, actual_freespace;
|
||||
|
||||
assert(buffer != NULL);
|
||||
assert(data != NULL);
|
||||
assert(buffer->data != NULL);
|
||||
|
||||
if (!datalen) {
|
||||
return buffer->used;
|
||||
}
|
||||
|
||||
actual_freespace = buffer->datalen - buffer->actually_used;
|
||||
if (actual_freespace < datalen && (!buffer->max_len || (buffer->used + datalen <= buffer->max_len))) {
|
||||
memmove(buffer->data, buffer->head, buffer->used);
|
||||
buffer->head = buffer->data;
|
||||
buffer->actually_used = buffer->used;
|
||||
}
|
||||
|
||||
freespace = buffer->datalen - buffer->used;
|
||||
|
||||
/*
|
||||
if (buffer->data != buffer->head) {
|
||||
memmove(buffer->data, buffer->head, buffer->used);
|
||||
buffer->head = buffer->data;
|
||||
}
|
||||
*/
|
||||
|
||||
if (freespace < datalen) {
|
||||
ftdm_size_t new_size, new_block_size;
|
||||
void *data;
|
||||
|
||||
new_size = buffer->datalen + datalen;
|
||||
new_block_size = buffer->datalen + buffer->blocksize;
|
||||
|
||||
if (new_block_size > new_size) {
|
||||
new_size = new_block_size;
|
||||
}
|
||||
buffer->head = buffer->data;
|
||||
data = realloc(buffer->data, new_size);
|
||||
if (!data) {
|
||||
return 0;
|
||||
}
|
||||
buffer->data = data;
|
||||
buffer->head = buffer->data;
|
||||
buffer->datalen = new_size;
|
||||
}
|
||||
|
||||
|
||||
freespace = buffer->datalen - buffer->used;
|
||||
|
||||
if (freespace < datalen) {
|
||||
return 0;
|
||||
} else {
|
||||
memcpy(buffer->head + buffer->used, data, datalen);
|
||||
buffer->used += datalen;
|
||||
buffer->actually_used += datalen;
|
||||
}
|
||||
/* if (buffer->id == 4) printf("%u i %d = %d\n", buffer->id, (unsigned)datalen, (unsigned)buffer->used); */
|
||||
|
||||
return buffer->used;
|
||||
}
|
||||
|
||||
FT_DECLARE(void) ftdm_buffer_zero(ftdm_buffer_t *buffer)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(buffer->data != NULL);
|
||||
|
||||
buffer->used = 0;
|
||||
buffer->actually_used = 0;
|
||||
buffer->head = buffer->data;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_zwrite(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen)
|
||||
{
|
||||
ftdm_size_t w;
|
||||
|
||||
if (!(w = ftdm_buffer_write(buffer, data, datalen))) {
|
||||
ftdm_buffer_zero(buffer);
|
||||
return ftdm_buffer_write(buffer, data, datalen);
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
FT_DECLARE(void) ftdm_buffer_destroy(ftdm_buffer_t **buffer)
|
||||
{
|
||||
if (*buffer) {
|
||||
ftdm_safe_free((*buffer)->data);
|
||||
ftdm_safe_free(*buffer);
|
||||
}
|
||||
|
||||
*buffer = NULL;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
307
libs/freetdm/src/ftdm_callerid.c
Normal file
307
libs/freetdm/src/ftdm_callerid.c
Normal file
@ -0,0 +1,307 @@
|
||||
#include "freetdm.h"
|
||||
#include "fsk.h"
|
||||
#include "uart.h"
|
||||
|
||||
|
||||
|
||||
static void fsk_byte_handler (void *x, int data)
|
||||
{
|
||||
ftdm_fsk_data_state_t *state = (ftdm_fsk_data_state_t *) x;
|
||||
uint8_t byte = (uint8_t)data;
|
||||
|
||||
top:
|
||||
|
||||
if (state->init == 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (state->dlen) {
|
||||
goto add_byte;
|
||||
}
|
||||
|
||||
if (state->bpos == 1) {
|
||||
state->blen = byte;
|
||||
|
||||
if ((uint32_t)(state->dlen = state->bpos + byte + 2) > state->bufsize) {
|
||||
state->dlen = state->bufsize;
|
||||
}
|
||||
goto top;
|
||||
}
|
||||
|
||||
add_byte:
|
||||
|
||||
if (state->bpos <= state->dlen) {
|
||||
state->buf[state->bpos++] = byte;
|
||||
} else {
|
||||
state->init = 3;
|
||||
}
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_init(ftdm_fsk_data_state_t *state, uint8_t *data, uint32_t datalen)
|
||||
{
|
||||
memset(state, 0, sizeof(*state));
|
||||
state->buf = data;
|
||||
state->bufsize = datalen;
|
||||
state->bpos = 2;
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_sdmf(ftdm_fsk_data_state_t *state, const char *date, char *number)
|
||||
{
|
||||
size_t dlen = strlen(date);
|
||||
size_t nlen = strlen(number);
|
||||
|
||||
state->buf[0] = FTDM_CID_TYPE_SDMF;
|
||||
memcpy(&state->buf[state->bpos], date, dlen);
|
||||
state->bpos += dlen;
|
||||
memcpy(&state->buf[state->bpos], number, nlen);
|
||||
state->bpos += nlen;
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_mdmf(ftdm_fsk_data_state_t *state, ftdm_mdmf_type_t type, const uint8_t *data, uint32_t datalen)
|
||||
{
|
||||
state->buf[0] = FTDM_CID_TYPE_MDMF;
|
||||
state->buf[state->bpos++] = type;
|
||||
state->buf[state->bpos++] = (uint8_t)datalen;
|
||||
memcpy(&state->buf[state->bpos], data, datalen);
|
||||
state->bpos += datalen;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_checksum(ftdm_fsk_data_state_t *state)
|
||||
{
|
||||
uint32_t i;
|
||||
uint8_t check = 0;
|
||||
|
||||
state->buf[1] = (uint8_t)(state->bpos - 2);
|
||||
|
||||
for (i = 0; i < state->bpos; i++) {
|
||||
check = check + state->buf[i];
|
||||
}
|
||||
|
||||
state->checksum = state->buf[state->bpos] = (uint8_t)(256 - check);
|
||||
state->bpos++;
|
||||
|
||||
state->dlen = state->bpos;
|
||||
state->blen = state->buf[1];
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_parse(ftdm_fsk_data_state_t *state, ftdm_size_t *type, char **data, ftdm_size_t *len)
|
||||
{
|
||||
|
||||
ftdm_size_t i;
|
||||
int sum = 0;
|
||||
|
||||
top:
|
||||
|
||||
if (state->checksum != 0 || state->ppos >= state->dlen - 1) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (!state->ppos) {
|
||||
for(i = 0; i < state->bpos; i++) {
|
||||
sum += state->buf[i];
|
||||
}
|
||||
state->checksum = sum % 256;
|
||||
state->ppos = 2;
|
||||
|
||||
if (state->buf[0] != FTDM_CID_TYPE_MDMF && state->buf[0] != FTDM_CID_TYPE_SDMF) {
|
||||
state->checksum = -1;
|
||||
}
|
||||
goto top;
|
||||
}
|
||||
|
||||
if (state->buf[0] == FTDM_CID_TYPE_SDMF) {
|
||||
/* convert sdmf to mdmf so we don't need 2 parsers */
|
||||
if (state->ppos == 2) {
|
||||
*type = MDMF_DATETIME;
|
||||
*len = 8;
|
||||
} else {
|
||||
if (state->buf[state->ppos] == 'P' || state->buf[state->ppos] == 'O') {
|
||||
*type = MDMF_NO_NUM;
|
||||
*len = 1;
|
||||
} else {
|
||||
*type = MDMF_PHONE_NUM;
|
||||
*len = state->blen - 8;
|
||||
}
|
||||
}
|
||||
*data = (char *)&state->buf[state->ppos];
|
||||
state->ppos += *len;
|
||||
return FTDM_SUCCESS;
|
||||
} else if (state->buf[0] == FTDM_CID_TYPE_MDMF) {
|
||||
*type = state->buf[state->ppos++];
|
||||
*len = state->buf[state->ppos++];
|
||||
*data = (char *)&state->buf[state->ppos];
|
||||
state->ppos += *len;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_feed(ftdm_fsk_data_state_t *state, int16_t *data, ftdm_size_t samples)
|
||||
{
|
||||
uint32_t x;
|
||||
int16_t *sp = data;
|
||||
|
||||
if (state->init == 3) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
for (x = 0; x < samples; x++) {
|
||||
dsp_fsk_sample (state->fsk1200_handle, (double) *sp++ / 32767.0);
|
||||
if (state->dlen && state->bpos >= state->dlen) {
|
||||
state->init = 3;
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_destroy(ftdm_fsk_data_state_t *state)
|
||||
{
|
||||
dsp_fsk_destroy(&state->fsk1200_handle);
|
||||
memset(state, 0, sizeof(*state));
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(int) ftdm_fsk_demod_init(ftdm_fsk_data_state_t *state, int rate, uint8_t *buf, ftdm_size_t bufsize)
|
||||
{
|
||||
|
||||
dsp_fsk_attr_t fsk1200_attr;
|
||||
|
||||
if (state->fsk1200_handle) {
|
||||
dsp_fsk_destroy(&state->fsk1200_handle);
|
||||
}
|
||||
|
||||
memset(state, 0, sizeof(*state));
|
||||
memset(buf, 0, bufsize);
|
||||
state->buf = buf;
|
||||
state->bufsize = bufsize;
|
||||
|
||||
dsp_fsk_attr_init (&fsk1200_attr);
|
||||
dsp_fsk_attr_set_samplerate (&fsk1200_attr, rate);
|
||||
dsp_fsk_attr_set_bytehandler (&fsk1200_attr, fsk_byte_handler, state);
|
||||
state->fsk1200_handle = dsp_fsk_create (&fsk1200_attr);
|
||||
|
||||
if (state->fsk1200_handle == NULL) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_fsk_modulator_generate_bit(ftdm_fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, ftdm_size_t buflen)
|
||||
{
|
||||
ftdm_size_t i;
|
||||
|
||||
for(i = 0 ; i < buflen; i++) {
|
||||
fsk_trans->bit_accum += fsk_trans->bit_factor;
|
||||
if (fsk_trans->bit_accum >= FTDM_FSK_MOD_FACTOR) {
|
||||
fsk_trans->bit_accum -= (FTDM_FSK_MOD_FACTOR + fsk_trans->bit_factor);
|
||||
break;
|
||||
}
|
||||
|
||||
buf[i] = teletone_dds_state_modulate_sample(&fsk_trans->dds, bit);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(int32_t) ftdm_fsk_modulator_generate_carrier_bits(ftdm_fsk_modulator_t *fsk_trans, uint32_t bits)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
ftdm_size_t r = 0;
|
||||
int8_t bit = 1;
|
||||
|
||||
for (i = 0; i < bits; i++) {
|
||||
if ((r = ftdm_fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) {
|
||||
if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != FTDM_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(void) ftdm_fsk_modulator_generate_chan_sieze(ftdm_fsk_modulator_t *fsk_trans)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
ftdm_size_t r = 0;
|
||||
int8_t bit = 0;
|
||||
|
||||
for (i = 0; i < fsk_trans->chan_sieze_bits; i++) {
|
||||
if ((r = ftdm_fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) {
|
||||
if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != FTDM_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
bit = !bit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(void) ftdm_fsk_modulator_send_data(ftdm_fsk_modulator_t *fsk_trans)
|
||||
{
|
||||
ftdm_size_t r = 0;
|
||||
int8_t bit = 0;
|
||||
|
||||
while((bit = ftdm_bitstream_get_bit(&fsk_trans->bs)) > -1) {
|
||||
if ((r = ftdm_fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) {
|
||||
if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != FTDM_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_modulator_init(ftdm_fsk_modulator_t *fsk_trans,
|
||||
fsk_modem_types_t modem_type,
|
||||
uint32_t sample_rate,
|
||||
ftdm_fsk_data_state_t *fsk_data,
|
||||
float db_level,
|
||||
uint32_t carrier_bits_start,
|
||||
uint32_t carrier_bits_stop,
|
||||
uint32_t chan_sieze_bits,
|
||||
ftdm_fsk_write_sample_t write_sample_callback,
|
||||
void *user_data)
|
||||
{
|
||||
memset(fsk_trans, 0, sizeof(*fsk_trans));
|
||||
fsk_trans->modem_type = modem_type;
|
||||
teletone_dds_state_set_tone(&fsk_trans->dds, fsk_modem_definitions[fsk_trans->modem_type].freq_space, sample_rate, 0);
|
||||
teletone_dds_state_set_tone(&fsk_trans->dds, fsk_modem_definitions[fsk_trans->modem_type].freq_mark, sample_rate, 1);
|
||||
fsk_trans->bit_factor = (uint32_t)((fsk_modem_definitions[fsk_trans->modem_type].baud_rate * FTDM_FSK_MOD_FACTOR) / (float)sample_rate);
|
||||
fsk_trans->samples_per_bit = (uint32_t) (sample_rate / fsk_modem_definitions[fsk_trans->modem_type].baud_rate);
|
||||
fsk_trans->est_bytes = (int32_t)(((fsk_data->dlen * 10) + carrier_bits_start + carrier_bits_stop + chan_sieze_bits) * ((fsk_trans->samples_per_bit + 1) * 2));
|
||||
fsk_trans->bit_accum = 0;
|
||||
fsk_trans->fsk_data = fsk_data;
|
||||
teletone_dds_state_set_tx_level(&fsk_trans->dds, db_level);
|
||||
ftdm_bitstream_init(&fsk_trans->bs, fsk_trans->fsk_data->buf, (uint32_t)fsk_trans->fsk_data->dlen, FTDM_ENDIAN_BIG, 1);
|
||||
fsk_trans->carrier_bits_start = carrier_bits_start;
|
||||
fsk_trans->carrier_bits_stop = carrier_bits_stop;
|
||||
fsk_trans->chan_sieze_bits = chan_sieze_bits;
|
||||
fsk_trans->write_sample_callback = write_sample_callback;
|
||||
fsk_trans->user_data = user_data;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
251
libs/freetdm/src/ftdm_config.c
Normal file
251
libs/freetdm/src/ftdm_config.c
Normal file
@ -0,0 +1,251 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "ftdm_config.h"
|
||||
|
||||
int ftdm_config_open_file(ftdm_config_t *cfg, const char *file_path)
|
||||
{
|
||||
FILE *f;
|
||||
const char *path = NULL;
|
||||
char path_buf[1024];
|
||||
|
||||
if (file_path[0] == '/') {
|
||||
path = file_path;
|
||||
} else {
|
||||
snprintf(path_buf, sizeof(path_buf), "%s%s%s", FTDM_CONFIG_DIR, FTDM_PATH_SEPARATOR, file_path);
|
||||
path = path_buf;
|
||||
}
|
||||
|
||||
if (!path) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(cfg, 0, sizeof(*cfg));
|
||||
cfg->lockto = -1;
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Configuration file is %s.\n", path);
|
||||
f = fopen(path, "r");
|
||||
|
||||
if (!f) {
|
||||
if (file_path[0] != '/') {
|
||||
int last = -1;
|
||||
char *var, *val;
|
||||
|
||||
snprintf(path_buf, sizeof(path_buf), "%s%sfreetdm.conf", FTDM_CONFIG_DIR, FTDM_PATH_SEPARATOR);
|
||||
path = path_buf;
|
||||
|
||||
if ((f = fopen(path, "r")) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cfg->file = f;
|
||||
ftdm_set_string(cfg->path, path);
|
||||
|
||||
while (ftdm_config_next_pair(cfg, &var, &val)) {
|
||||
if ((cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
|
||||
cfg->lockto = cfg->sectno;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ftdm_config_close_file(cfg);
|
||||
memset(cfg, 0, sizeof(*cfg));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
cfg->file = f;
|
||||
ftdm_set_string(cfg->path, path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void ftdm_config_close_file(ftdm_config_t *cfg)
|
||||
{
|
||||
|
||||
if (cfg->file) {
|
||||
fclose(cfg->file);
|
||||
}
|
||||
|
||||
memset(cfg, 0, sizeof(*cfg));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ftdm_config_next_pair(ftdm_config_t *cfg, char **var, char **val)
|
||||
{
|
||||
int ret = 0;
|
||||
char *p, *end;
|
||||
|
||||
*var = *val = NULL;
|
||||
|
||||
if (!cfg->path) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
cfg->lineno++;
|
||||
|
||||
if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
*var = cfg->buf;
|
||||
|
||||
if (**var == '[' && (end = strchr(*var, ']')) != 0) {
|
||||
*end = '\0';
|
||||
(*var)++;
|
||||
if (**var == '+') {
|
||||
(*var)++;
|
||||
ftdm_copy_string(cfg->section, *var, sizeof(cfg->section));
|
||||
cfg->sectno++;
|
||||
|
||||
if (cfg->lockto > -1 && cfg->sectno != cfg->lockto) {
|
||||
break;
|
||||
}
|
||||
cfg->catno = 0;
|
||||
cfg->lineno = 0;
|
||||
*var = (char *) "";
|
||||
*val = (char *) "";
|
||||
return 1;
|
||||
} else {
|
||||
ftdm_copy_string(cfg->category, *var, sizeof(cfg->category));
|
||||
cfg->catno++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (**var == '#' || **var == ';' || **var == '\n' || **var == '\r') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strncmp(*var, "__END__", 7)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((end = strchr(*var, ';')) && *(end+1) == *end) {
|
||||
*end = '\0';
|
||||
end--;
|
||||
} else if ((end = strchr(*var, '\n')) != 0) {
|
||||
if (*(end - 1) == '\r') {
|
||||
end--;
|
||||
}
|
||||
*end = '\0';
|
||||
}
|
||||
|
||||
p = *var;
|
||||
while ((*p == ' ' || *p == '\t') && p != end) {
|
||||
*p = '\0';
|
||||
p++;
|
||||
}
|
||||
*var = p;
|
||||
|
||||
|
||||
if ((*val = strchr(*var, '=')) == 0) {
|
||||
ret = -1;
|
||||
/* log_printf(0, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); */
|
||||
continue;
|
||||
} else {
|
||||
p = *val - 1;
|
||||
*(*val) = '\0';
|
||||
(*val)++;
|
||||
if (*(*val) == '>') {
|
||||
*(*val) = '\0';
|
||||
(*val)++;
|
||||
}
|
||||
|
||||
while ((*p == ' ' || *p == '\t') && p != *var) {
|
||||
*p = '\0';
|
||||
p--;
|
||||
}
|
||||
|
||||
p = *val;
|
||||
while ((*p == ' ' || *p == '\t') && p != end) {
|
||||
*p = '\0';
|
||||
p++;
|
||||
}
|
||||
*val = p;
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
FT_DECLARE (int) ftdm_config_get_cas_bits(char *strvalue, unsigned char *outbits)
|
||||
{
|
||||
char cas_bits[5];
|
||||
unsigned char bit = 0x8;
|
||||
int x = 0;
|
||||
char *double_colon = strchr(strvalue, ':');
|
||||
if (!double_colon) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "No CAS bits specified: %s, :xxxx definition expected, where x is 1 or 0\n", strvalue);
|
||||
return -1;
|
||||
}
|
||||
double_colon++;
|
||||
*outbits = 0;
|
||||
cas_bits[4] = 0;
|
||||
if (sscanf(double_colon, "%c%c%c%c", &cas_bits[0], &cas_bits[1], &cas_bits[2], &cas_bits[3]) != 4) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Invalid CAS bits specified: '%s', :xxxx definition expected, where x is 1 or 0\n", double_colon);
|
||||
return -1;
|
||||
}
|
||||
ftdm_log(FTDM_LOG_DEBUG, "CAS bits specification found: %s\n", cas_bits);
|
||||
for (; cas_bits[x]; x++) {
|
||||
if ('1' == cas_bits[x]) {
|
||||
*outbits |= bit;
|
||||
} else if ('0' != cas_bits[x]) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Invalid CAS pattern specified: %s, just 0 or 1 allowed for each bit\n");
|
||||
return -1;
|
||||
}
|
||||
bit >>= 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
116
libs/freetdm/src/ftdm_dso.c
Normal file
116
libs/freetdm/src/ftdm_dso.c
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Cross Platform dso/dll load abstraction
|
||||
* Copyright(C) 2008 Michael Jerris
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so.
|
||||
*
|
||||
* This work is provided under this license on an "as is" basis, without warranty of any kind,
|
||||
* either expressed or implied, including, without limitation, warranties that the covered code
|
||||
* is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
|
||||
* risk as to the quality and performance of the covered code is with you. Should any covered
|
||||
* code prove defective in any respect, you (not the initial developer or any other contributor)
|
||||
* assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
|
||||
* constitutes an essential part of this license. No use of any covered code is authorized hereunder
|
||||
* except under this disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "ftdm_dso.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
FT_DECLARE(void) ftdm_dso_destroy(ftdm_dso_lib_t *lib) {
|
||||
if (lib && *lib) {
|
||||
FreeLibrary(*lib);
|
||||
*lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_dso_lib_t) ftdm_dso_open(const char *path, char **err) {
|
||||
HINSTANCE lib;
|
||||
|
||||
lib = LoadLibraryEx(path, NULL, 0);
|
||||
|
||||
if (!lib) {
|
||||
LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
}
|
||||
|
||||
if (!lib) {
|
||||
DWORD error = GetLastError();
|
||||
char tmp[80];
|
||||
sprintf(tmp, "dll open error [%ul]\n", error);
|
||||
*err = ftdm_strdup(tmp);
|
||||
}
|
||||
|
||||
return lib;
|
||||
}
|
||||
|
||||
FT_DECLARE(void*) ftdm_dso_func_sym(ftdm_dso_lib_t lib, const char *sym, char **err) {
|
||||
FARPROC func = GetProcAddress(lib, sym);
|
||||
if (!func) {
|
||||
DWORD error = GetLastError();
|
||||
char tmp[80];
|
||||
sprintf(tmp, "dll sym error [%ul]\n", error);
|
||||
*err = ftdm_strdup(tmp);
|
||||
}
|
||||
return (void *)(intptr_t)func; // this should really be addr - ftdm_dso_func_data
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
** {========================================================================
|
||||
** This is an implementation of loadlib based on the dlfcn interface.
|
||||
** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD,
|
||||
** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least
|
||||
** as an emulation layer on top of native functions.
|
||||
** =========================================================================
|
||||
*/
|
||||
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
FT_DECLARE(void) ftdm_dso_destroy(ftdm_dso_lib_t *lib) {
|
||||
if (lib && *lib) {
|
||||
dlclose(*lib);
|
||||
*lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_dso_lib_t) ftdm_dso_open(const char *path, char **err) {
|
||||
void *lib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
|
||||
if (lib == NULL) {
|
||||
*err = ftdm_strdup(dlerror());
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
FT_DECLARE(void*) ftdm_dso_func_sym(ftdm_dso_lib_t lib, const char *sym, char **err) {
|
||||
void *func = dlsym(lib, sym);
|
||||
if (!func) {
|
||||
*err = ftdm_strdup(dlerror());
|
||||
}
|
||||
return func;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4
|
||||
*/
|
3927
libs/freetdm/src/ftdm_io.c
Normal file
3927
libs/freetdm/src/ftdm_io.c
Normal file
File diff suppressed because it is too large
Load Diff
692
libs/freetdm/src/ftdm_m3ua.c
Normal file
692
libs/freetdm/src/ftdm_m3ua.c
Normal file
@ -0,0 +1,692 @@
|
||||
/*
|
||||
* ftdm_m3ua.c
|
||||
* freetdm
|
||||
*
|
||||
* Created by Shane Burrell on 4/3/08.
|
||||
* Copyright 2008 Shane Burrell. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic *
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "m3ua_client.h"
|
||||
#include "ftdm_m3ua.h"
|
||||
|
||||
#define MAX_REQ_ID MAX_PENDING_CALLS
|
||||
typedef uint16_t m3ua_request_id_t;
|
||||
|
||||
typedef enum {
|
||||
BST_FREE,
|
||||
BST_WAITING,
|
||||
BST_READY,
|
||||
BST_FAIL
|
||||
} m3ua_request_status_t;
|
||||
|
||||
typedef struct {
|
||||
m3ua_request_status_t status;
|
||||
m3uac_event_t event;
|
||||
ftdm_span_t *span;
|
||||
ftdm_channel_t *ftdmchan;
|
||||
} m3ua_request_t;
|
||||
|
||||
|
||||
struct general_config {
|
||||
uint32_t region;
|
||||
};
|
||||
typedef struct general_config general_config_t;
|
||||
|
||||
|
||||
struct m3ua_channel_profile {
|
||||
char name[80];
|
||||
int cust_span;
|
||||
unsigned char opc[3];
|
||||
unsigned char dpc[3];
|
||||
int local_ip[4];
|
||||
int local_port;
|
||||
int remote_ip[4];
|
||||
int remote_port;
|
||||
int m3ua_mode;
|
||||
};
|
||||
typedef struct m3ua_channel_profile m3ua_channel_profile_t;
|
||||
|
||||
static struct {
|
||||
ftdm_hash_t *profile_hash;
|
||||
general_config_t general_config;
|
||||
} globals;
|
||||
|
||||
struct m3ua_span_data {
|
||||
uint32_t boardno;
|
||||
uint32_t flags;
|
||||
};
|
||||
typedef struct m3ua_span_data m3ua_span_data_t;
|
||||
|
||||
struct m3ua_chan_data {
|
||||
ftdm_buffer_t *digit_buffer;
|
||||
ftdm_mutex_t *digit_mutex;
|
||||
ftdm_size_t dtmf_len;
|
||||
uint32_t flags;
|
||||
uint32_t hdlc_bytes;
|
||||
};
|
||||
typedef struct m3ua_chan_data m3ua_chan_data_t;
|
||||
|
||||
static ftdm_mutex_t *request_mutex = NULL;
|
||||
static ftdm_mutex_t *signal_mutex = NULL;
|
||||
|
||||
static uint8_t req_map[MAX_REQ_ID+1] = { 0 };
|
||||
|
||||
static void release_request_id(m3ua_request_id_t r)
|
||||
{
|
||||
ftdm_mutex_lock(request_mutex);
|
||||
req_map[r] = 0;
|
||||
ftdm_mutex_unlock(request_mutex);
|
||||
}
|
||||
|
||||
/*static m3ua_request_id_t next_request_id(void)
|
||||
{
|
||||
m3ua_request_id_t r = 0;
|
||||
int ok = 0;
|
||||
|
||||
while(!ok) {
|
||||
ftdm_mutex_lock(request_mutex);
|
||||
for (r = 1; r <= MAX_REQ_ID; r++) {
|
||||
if (!req_map[r]) {
|
||||
ok = 1;
|
||||
req_map[r] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ftdm_mutex_unlock(request_mutex);
|
||||
if (!ok) {
|
||||
ftdm_sleep(5);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
*/
|
||||
|
||||
static __inline__ void state_advance(ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
|
||||
m3ua_data_t *m3ua_data = ftdmchan->span->signal_data;
|
||||
m3uac_connection_t *mcon = &m3ua_data->mcon;
|
||||
ftdm_sigmsg_t sig;
|
||||
ftdm_status_t status;
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state));
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
|
||||
switch (ftdmchan->state) {
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
{
|
||||
if (ftdmchan->extra_id) {
|
||||
release_request_id((m3ua_request_id_t)ftdmchan->extra_id);
|
||||
ftdmchan->extra_id = 0;
|
||||
}
|
||||
ftdm_channel_done(ftdmchan);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_PROGRESS_MEDIA:
|
||||
case FTDM_CHANNEL_STATE_PROGRESS:
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA;
|
||||
if ((status = m3ua_data->signal_cb(&sig) != FTDM_SUCCESS)) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
}
|
||||
} else {
|
||||
m3uac_exec_command(mcon,
|
||||
ftdmchan->physical_span_id-1,
|
||||
ftdmchan->physical_chan_id-1,
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_START_ACK,
|
||||
0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_RING:
|
||||
{
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
sig.event_id = FTDM_SIGEVENT_START;
|
||||
if ((status = m3ua_data->signal_cb(&sig) != FTDM_SUCCESS)) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
{
|
||||
if (ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP && ftdmchan->last_state != FTDM_CHANNEL_STATE_DOWN) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_UP:
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
sig.event_id = FTDM_SIGEVENT_UP;
|
||||
if ((status = m3ua_data->signal_cb(&sig) != FTDM_SUCCESS)) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
}
|
||||
} else {
|
||||
if (!(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_PROGRESS) || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_MEDIA))) {
|
||||
m3uac_exec_command(mcon,
|
||||
ftdmchan->physical_span_id-1,
|
||||
ftdmchan->physical_chan_id-1,
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_START_ACK,
|
||||
0);
|
||||
}
|
||||
|
||||
m3uac_exec_command(mcon,
|
||||
ftdmchan->physical_span_id-1,
|
||||
ftdmchan->physical_chan_id-1,
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_ANSWERED,
|
||||
0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALING:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_HANGUP_COMPLETE:
|
||||
{
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_HANGUP:
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_ANSWERED) || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_PROGRESS) || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_MEDIA)) {
|
||||
m3uac_exec_command(mcon,
|
||||
ftdmchan->physical_span_id-1,
|
||||
ftdmchan->physical_chan_id-1,
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_STOPPED,
|
||||
ftdmchan->caller_data.hangup_cause);
|
||||
} else {
|
||||
m3uac_exec_command(mcon,
|
||||
ftdmchan->physical_span_id-1,
|
||||
ftdmchan->physical_chan_id-1,
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_START_NACK,
|
||||
ftdmchan->caller_data.hangup_cause);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_CANCEL:
|
||||
{
|
||||
sig.event_id = FTDM_SIGEVENT_STOP;
|
||||
status = m3ua_data->signal_cb(&sig);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
m3uac_exec_command(mcon,
|
||||
ftdmchan->physical_span_id-1,
|
||||
ftdmchan->physical_chan_id-1,
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_START_NACK_ACK,
|
||||
0);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_TERMINATING:
|
||||
{
|
||||
sig.event_id = FTDM_SIGEVENT_STOP;
|
||||
status = m3ua_data->signal_cb(&sig);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
m3uac_exec_command(mcon,
|
||||
ftdmchan->physical_span_id-1,
|
||||
ftdmchan->physical_chan_id-1,
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_STOPPED_ACK,
|
||||
0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void check_state(ftdm_span_t *span)
|
||||
{
|
||||
if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) {
|
||||
uint32_t j;
|
||||
ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE);
|
||||
for(j = 1; j <= span->chan_count; j++) {
|
||||
if (ftdm_test_flag((&span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) {
|
||||
ftdm_clear_flag_locked((&span->channels[j]), FTDM_CHANNEL_STATE_CHANGE);
|
||||
state_advance(&span->channels[j]);
|
||||
ftdm_channel_complete_state(&span->channels[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int parse_ss7_event(ftdm_span_t *span, m3uac_connection_t *mcon, m3uac_event_t *event)
|
||||
{
|
||||
ftdm_mutex_lock(signal_mutex);
|
||||
|
||||
if (!ftdm_running()) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "System is shutting down.\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (ftdm_test_flag(span, FTDM_SPAN_SUSPENDED) &&
|
||||
event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK && event->event_id != SIGBOOST_EVENT_HEARTBEAT) {
|
||||
|
||||
ftdm_log(FTDM_LOG_WARNING,
|
||||
"INVALID EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n",
|
||||
m3uac_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
event->span+1,
|
||||
event->chan+1,
|
||||
event->release_cause,
|
||||
event->call_setup_id,
|
||||
event->fseqno,
|
||||
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
|
||||
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")
|
||||
);
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG,
|
||||
"RX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n",
|
||||
m3uac_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
event->span+1,
|
||||
event->chan+1,
|
||||
event->release_cause,
|
||||
event->call_setup_id,
|
||||
event->fseqno,
|
||||
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
|
||||
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")
|
||||
);
|
||||
|
||||
|
||||
|
||||
switch(event->event_id) {
|
||||
|
||||
case SIGBOOST_EVENT_CALL_START:
|
||||
//handle_call_start(span, mcon, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_CALL_STOPPED:
|
||||
//handle_call_stop(span, mcon, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_CALL_START_ACK:
|
||||
//handle_call_start_ack(mcon, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_CALL_START_NACK:
|
||||
//handle_call_start_nack(span, mcon, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_CALL_ANSWERED:
|
||||
//handle_call_answer(span, mcon, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_HEARTBEAT:
|
||||
//handle_heartbeat(mcon, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_CALL_STOPPED_ACK:
|
||||
case SIGBOOST_EVENT_CALL_START_NACK_ACK:
|
||||
//handle_call_done(span, mcon, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_INSERT_CHECK_LOOP:
|
||||
//handle_call_loop_start(event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_REMOVE_CHECK_LOOP:
|
||||
//handle_call_stop(event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_SYSTEM_RESTART_ACK:
|
||||
//handle_restart_ack(mcon, span, event);
|
||||
break;
|
||||
case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE:
|
||||
//handle_gap_abate(event);
|
||||
break;
|
||||
default:
|
||||
ftdm_log(FTDM_LOG_WARNING, "No handler implemented for [%s]\n", m3uac_event_id_name(event->event_id));
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
ftdm_mutex_unlock(signal_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static FIO_CONFIGURE_FUNCTION(m3ua_configure)
|
||||
{
|
||||
m3ua_channel_profile_t *profile = NULL;
|
||||
|
||||
int ok = 1;
|
||||
|
||||
if (!(profile = (m3ua_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)category))) {
|
||||
profile = ftdm_malloc(sizeof(*profile));
|
||||
memset(profile, 0, sizeof(*profile));
|
||||
ftdm_set_string(profile->name, category);
|
||||
hashtable_insert(globals.profile_hash, (void *)profile->name, profile);
|
||||
ftdm_log(FTDM_LOG_INFO, "creating profile [%s]\n", category);
|
||||
}
|
||||
|
||||
// ftdm_set_string(m3ua_data->mcon. cfg.local_ip, local_ip);
|
||||
if (!strcasecmp(var, "local_sctp_port")) {
|
||||
profile->local_port = 30000 ;
|
||||
profile->remote_port = 30000;
|
||||
profile->cust_span++;
|
||||
}
|
||||
ok = 1;
|
||||
|
||||
|
||||
if (ok) {
|
||||
ftdm_log(FTDM_LOG_INFO, "setting param [%s]=[%s] for profile [%s]\n", var, val, category);
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_ERROR, "unknown param [%s]\n", var);
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
static FIO_CONFIGURE_SPAN_FUNCTION(m3ua_configure_span)
|
||||
{
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_OPEN_FUNCTION(m3ua_open)
|
||||
{
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_CLOSE_FUNCTION(m3ua_close)
|
||||
{
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/*static FIO_SET_INTERVAL_FUNCTION(m3ua_set_interval)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
static FIO_WAIT_FUNCTION(m3ua_wait)
|
||||
{
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_READ_FUNCTION(m3ua_read)
|
||||
{
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_WRITE_FUNCTION(m3ua_write)
|
||||
{
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_COMMAND_FUNCTION(m3ua_command)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_SPAN_POLL_EVENT_FUNCTION(m3ua_poll_event)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_SPAN_NEXT_EVENT_FUNCTION(m3ua_next_event)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
|
||||
static FIO_SPAN_DESTROY_FUNCTION(m3ua_span_destroy)
|
||||
{
|
||||
m3ua_span_data_t *span_data = (m3ua_span_data_t *) span->mod_data;
|
||||
|
||||
if (span_data) {
|
||||
ftdm_safe_free(span_data);
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
static FIO_CHANNEL_DESTROY_FUNCTION(m3ua_channel_destroy)
|
||||
{
|
||||
m3ua_chan_data_t *chan_data = (m3ua_chan_data_t *) ftdmchan->mod_data;
|
||||
m3ua_span_data_t *span_data = (m3ua_span_data_t *) ftdmchan->span->mod_data;
|
||||
|
||||
if (!chan_data) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ftdm_mutex_destroy(&chan_data->digit_mutex);
|
||||
ftdm_buffer_destroy(&chan_data->digit_buffer);
|
||||
|
||||
|
||||
ftdm_safe_free(chan_data);
|
||||
|
||||
if (span_data) {
|
||||
ftdm_safe_free(span_data);
|
||||
}
|
||||
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static FIO_GET_ALARMS_FUNCTION(m3ua_get_alarms)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static ftdm_io_interface_t m3ua_interface;
|
||||
|
||||
ftdm_status_t m3ua_init(ftdm_io_interface_t **zint)
|
||||
{
|
||||
assert(zint != NULL);
|
||||
memset(&m3ua_interface, 0, sizeof(m3ua_interface));
|
||||
|
||||
m3ua_interface.name = "m3ua";
|
||||
m3ua_interface.configure = m3ua_configure;
|
||||
m3ua_interface.configure_span = m3ua_configure_span;
|
||||
m3ua_interface.open = m3ua_open;
|
||||
m3ua_interface.close = m3ua_close;
|
||||
m3ua_interface.wait = m3ua_wait;
|
||||
m3ua_interface.read = m3ua_read;
|
||||
m3ua_interface.write = m3ua_write;
|
||||
m3ua_interface.command = m3ua_command;
|
||||
m3ua_interface.poll_event = m3ua_poll_event;
|
||||
m3ua_interface.next_event = m3ua_next_event;
|
||||
m3ua_interface.channel_destroy = m3ua_channel_destroy;
|
||||
m3ua_interface.span_destroy = m3ua_span_destroy;
|
||||
m3ua_interface.get_alarms = m3ua_get_alarms;
|
||||
*zint = &m3ua_interface;
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
ftdm_status_t m3ua_destroy(void)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
|
||||
static void *m3ua_run(ftdm_thread_t *me, void *obj)
|
||||
{
|
||||
ftdm_span_t *span = (ftdm_span_t *) obj;
|
||||
m3ua_data_t *m3ua_data = span->signal_data;
|
||||
m3uac_connection_t *mcon, *pcon;
|
||||
uint32_t ms = 10, too_long = 60000;
|
||||
|
||||
|
||||
m3ua_data->pcon = m3ua_data->mcon;
|
||||
|
||||
if (m3uac_connection_open(&m3ua_data->mcon,
|
||||
m3ua_data->mcon.cfg.local_ip,
|
||||
m3ua_data->mcon.cfg.local_port,
|
||||
m3ua_data->mcon.cfg.remote_ip,
|
||||
m3ua_data->mcon.cfg.remote_port) < 0) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Error: Opening MCON Socket [%d] %s\n", m3ua_data->mcon.socket, strerror(errno));
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (m3uac_connection_open(&m3ua_data->pcon,
|
||||
m3ua_data->pcon.cfg.local_ip,
|
||||
++m3ua_data->pcon.cfg.local_port,
|
||||
m3ua_data->pcon.cfg.remote_ip,
|
||||
m3ua_data->pcon.cfg.remote_port) < 0) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Error: Opening PCON Socket [%d] %s\n", m3ua_data->pcon.socket, strerror(errno));
|
||||
goto end;
|
||||
}
|
||||
|
||||
mcon = &m3ua_data->mcon;
|
||||
pcon = &m3ua_data->pcon;
|
||||
|
||||
top:
|
||||
|
||||
//init_outgoing_array();
|
||||
|
||||
m3uac_exec_command(mcon,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART,
|
||||
0);
|
||||
|
||||
while (ftdm_test_flag(m3ua_data, FTDM_M3UA_RUNNING)) {
|
||||
fd_set rfds, efds;
|
||||
struct timeval tv = { 0, ms * 1000 };
|
||||
int max, activity, i = 0;
|
||||
m3uac_event_t *event = NULL;
|
||||
|
||||
if (!ftdm_running()) {
|
||||
m3uac_exec_command(mcon,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART,
|
||||
0);
|
||||
break;
|
||||
}
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&efds);
|
||||
FD_SET(mcon->socket, &rfds);
|
||||
FD_SET(mcon->socket, &efds);
|
||||
FD_SET(pcon->socket, &rfds);
|
||||
FD_SET(pcon->socket, &efds);
|
||||
|
||||
max = ((pcon->socket > mcon->socket) ? pcon->socket : mcon->socket) + 1;
|
||||
|
||||
if ((activity = select(max, &rfds, NULL, &efds, &tv)) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (activity) {
|
||||
if (FD_ISSET(pcon->socket, &efds) || FD_ISSET(mcon->socket, &efds)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (FD_ISSET(pcon->socket, &rfds)) {
|
||||
if ((event = m3uac_connection_readp(pcon, i))) {
|
||||
parse_ss7_event(span, mcon, event);
|
||||
} else goto top;
|
||||
}
|
||||
|
||||
if (FD_ISSET(mcon->socket, &rfds)) {
|
||||
if ((event = m3uac_connection_read(mcon, i))) {
|
||||
parse_ss7_event(span, mcon, event);
|
||||
} else goto top;
|
||||
}
|
||||
}
|
||||
|
||||
check_state(span);
|
||||
mcon->hb_elapsed += ms;
|
||||
|
||||
if (mcon->hb_elapsed >= too_long && (mcon->up || !ftdm_test_flag(span, FTDM_SPAN_SUSPENDED))) {
|
||||
ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_flag_locked(span, FTDM_SPAN_SUSPENDED);
|
||||
mcon->up = 0;
|
||||
ftdm_log(FTDM_LOG_CRIT, "Lost Heartbeat!\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
goto end;
|
||||
|
||||
error:
|
||||
ftdm_log(FTDM_LOG_CRIT, "Socket Error!\n");
|
||||
|
||||
end:
|
||||
|
||||
m3uac_connection_close(&m3ua_data->mcon);
|
||||
m3uac_connection_close(&m3ua_data->pcon);
|
||||
|
||||
ftdm_clear_flag(m3ua_data, FTDM_M3UA_RUNNING);
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "M3UA thread ended.\n");
|
||||
return NULL;
|
||||
}
|
||||
ftdm_status_t m3ua_start(ftdm_span_t *span)
|
||||
{
|
||||
m3ua_data_t *m3ua_data = span->signal_data;
|
||||
ftdm_set_flag(m3ua_data, FTDM_M3UA_RUNNING);
|
||||
return ftdm_thread_create_detached(m3ua_run, span);
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
*/
|
234
libs/freetdm/src/ftdm_queue.c
Normal file
234
libs/freetdm/src/ftdm_queue.c
Normal file
@ -0,0 +1,234 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Sangoma Technologies
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
|
||||
static ftdm_status_t ftdm_std_queue_create(ftdm_queue_t **outqueue, ftdm_size_t capacity);
|
||||
static ftdm_status_t ftdm_std_queue_enqueue(ftdm_queue_t *queue, void *obj);
|
||||
static void *ftdm_std_queue_dequeue(ftdm_queue_t *queue);
|
||||
static ftdm_status_t ftdm_std_queue_wait(ftdm_queue_t *queue, int ms);
|
||||
static ftdm_status_t ftdm_std_queue_get_interrupt(ftdm_queue_t *queue, ftdm_interrupt_t **interrupt);
|
||||
static ftdm_status_t ftdm_std_queue_destroy(ftdm_queue_t **inqueue);
|
||||
|
||||
struct ftdm_queue {
|
||||
ftdm_mutex_t *mutex;
|
||||
ftdm_interrupt_t *interrupt;
|
||||
ftdm_size_t capacity;
|
||||
ftdm_size_t size;
|
||||
unsigned rindex;
|
||||
unsigned windex;
|
||||
void **elements;
|
||||
};
|
||||
|
||||
FT_DECLARE_DATA ftdm_queue_handler_t g_ftdm_queue_handler =
|
||||
{
|
||||
/*.create = */ ftdm_std_queue_create,
|
||||
/*.enqueue = */ ftdm_std_queue_enqueue,
|
||||
/*.dequeue = */ ftdm_std_queue_dequeue,
|
||||
/*.wait = */ ftdm_std_queue_wait,
|
||||
/*.get_interrupt = */ ftdm_std_queue_get_interrupt,
|
||||
/*.destroy = */ ftdm_std_queue_destroy
|
||||
};
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *handler)
|
||||
{
|
||||
if (!handler ||
|
||||
!handler->create ||
|
||||
!handler->enqueue ||
|
||||
!handler->dequeue ||
|
||||
!handler->wait ||
|
||||
!handler->get_interrupt ||
|
||||
!handler->destroy) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
memcpy(&g_ftdm_queue_handler, handler, sizeof(*handler));
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
static ftdm_status_t ftdm_std_queue_create(ftdm_queue_t **outqueue, ftdm_size_t capacity)
|
||||
{
|
||||
ftdm_queue_t *queue = NULL;
|
||||
ftdm_assert_return(outqueue, FTDM_FAIL, "Queue double pointer is null\n");
|
||||
ftdm_assert_return(capacity > 0, FTDM_FAIL, "Queue capacity is not bigger than 0\n");
|
||||
|
||||
*outqueue = NULL;
|
||||
queue = ftdm_calloc(1, sizeof(*queue));
|
||||
if (!queue) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
queue->elements = ftdm_calloc(1, (sizeof(void*)*capacity));
|
||||
if (!queue->elements) {
|
||||
goto failed;
|
||||
}
|
||||
queue->capacity = capacity;
|
||||
|
||||
if (ftdm_mutex_create(&queue->mutex) != FTDM_SUCCESS) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET) != FTDM_SUCCESS) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
*outqueue = queue;
|
||||
return FTDM_SUCCESS;
|
||||
|
||||
failed:
|
||||
if (queue) {
|
||||
if (queue->interrupt) {
|
||||
ftdm_interrupt_destroy(&queue->interrupt);
|
||||
}
|
||||
if (queue->mutex) {
|
||||
ftdm_mutex_destroy(&queue->mutex);
|
||||
}
|
||||
ftdm_safe_free(queue->elements);
|
||||
ftdm_safe_free(queue);
|
||||
}
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static ftdm_status_t ftdm_std_queue_enqueue(ftdm_queue_t *queue, void *obj)
|
||||
{
|
||||
ftdm_status_t status = FTDM_FAIL;
|
||||
|
||||
ftdm_assert_return(queue != NULL, FTDM_FAIL, "Queue is null!");
|
||||
|
||||
ftdm_mutex_lock(queue->mutex);
|
||||
|
||||
if (queue->windex == queue->capacity) {
|
||||
/* try to see if we can wrap around */
|
||||
queue->windex = 0;
|
||||
}
|
||||
|
||||
if (queue->size != 0 && queue->windex == queue->rindex) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failed to enqueue obj %p in queue %p, no more room! windex == rindex == %d!\n", obj, queue, queue->windex);
|
||||
goto done;
|
||||
}
|
||||
|
||||
queue->elements[queue->windex++] = obj;
|
||||
queue->size++;
|
||||
status = FTDM_SUCCESS;
|
||||
|
||||
/* wake up queue reader */
|
||||
ftdm_interrupt_signal(queue->interrupt);
|
||||
|
||||
done:
|
||||
|
||||
ftdm_mutex_unlock(queue->mutex);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void *ftdm_std_queue_dequeue(ftdm_queue_t *queue)
|
||||
{
|
||||
void *obj = NULL;
|
||||
|
||||
ftdm_assert_return(queue != NULL, NULL, "Queue is null!");
|
||||
|
||||
ftdm_mutex_lock(queue->mutex);
|
||||
|
||||
if (queue->size == 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
obj = queue->elements[queue->rindex];
|
||||
queue->elements[queue->rindex++] = NULL;
|
||||
queue->size--;
|
||||
if (queue->rindex == queue->capacity) {
|
||||
queue->rindex = 0;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
ftdm_mutex_unlock(queue->mutex);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static ftdm_status_t ftdm_std_queue_wait(ftdm_queue_t *queue, int ms)
|
||||
{
|
||||
ftdm_status_t ret;
|
||||
ftdm_assert_return(queue != NULL, FTDM_FAIL, "Queue is null!");
|
||||
|
||||
ftdm_mutex_lock(queue->mutex);
|
||||
|
||||
/* if there is elements in the queue, no need to wait */
|
||||
if (queue->size != 0) {
|
||||
ftdm_mutex_unlock(queue->mutex);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/* no elements on the queue, wait for someone to write an element */
|
||||
ret = ftdm_interrupt_wait(queue->interrupt, ms);
|
||||
|
||||
/* got an element or timeout, bail out */
|
||||
ftdm_mutex_unlock(queue->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ftdm_status_t ftdm_std_queue_get_interrupt(ftdm_queue_t *queue, ftdm_interrupt_t **interrupt)
|
||||
{
|
||||
ftdm_assert_return(queue != NULL, FTDM_FAIL, "Queue is null!\n");
|
||||
ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Queue is null!\n");
|
||||
*interrupt = queue->interrupt;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
static ftdm_status_t ftdm_std_queue_destroy(ftdm_queue_t **inqueue)
|
||||
{
|
||||
ftdm_queue_t *queue = NULL;
|
||||
ftdm_assert_return(inqueue != NULL, FTDM_FAIL, "Queue is null!\n");
|
||||
ftdm_assert_return(*inqueue != NULL, FTDM_FAIL, "Queue is null!\n");
|
||||
|
||||
queue = *inqueue;
|
||||
ftdm_interrupt_destroy(&queue->interrupt);
|
||||
ftdm_mutex_destroy(&queue->mutex);
|
||||
ftdm_safe_free(queue->elements);
|
||||
ftdm_safe_free(queue);
|
||||
*inqueue = NULL;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
457
libs/freetdm/src/ftdm_threadmutex.c
Normal file
457
libs/freetdm/src/ftdm_threadmutex.c
Normal file
@ -0,0 +1,457 @@
|
||||
/*
|
||||
* Cross Platform Thread/Mutex abstraction
|
||||
* Copyright(C) 2007 Michael Jerris
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so.
|
||||
*
|
||||
* This work is provided under this license on an "as is" basis, without warranty of any kind,
|
||||
* either expressed or implied, including, without limitation, warranties that the covered code
|
||||
* is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
|
||||
* risk as to the quality and performance of the covered code is with you. Should any covered
|
||||
* code prove defective in any respect, you (not the initial developer or any other contributor)
|
||||
* assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
|
||||
* constitutes an essential part of this license. No use of any covered code is authorized hereunder
|
||||
* except under this disclaimer.
|
||||
*
|
||||
* Contributors:
|
||||
*
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
/* required for TryEnterCriticalSection definition. Must be defined before windows.h include */
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "ftdm_threadmutex.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <process.h>
|
||||
|
||||
#define FTDM_THREAD_CALLING_CONVENTION __stdcall
|
||||
|
||||
struct ftdm_mutex {
|
||||
CRITICAL_SECTION mutex;
|
||||
};
|
||||
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <poll.h>
|
||||
|
||||
#define FTDM_THREAD_CALLING_CONVENTION
|
||||
|
||||
struct ftdm_mutex {
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
struct ftdm_interrupt {
|
||||
ftdm_socket_t device;
|
||||
#ifdef WIN32
|
||||
/* for generic interruption */
|
||||
HANDLE event;
|
||||
#else
|
||||
/* for generic interruption */
|
||||
int readfd;
|
||||
int writefd;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ftdm_thread {
|
||||
#ifdef WIN32
|
||||
void *handle;
|
||||
#else
|
||||
pthread_t handle;
|
||||
#endif
|
||||
void *private_data;
|
||||
ftdm_thread_function_t function;
|
||||
ftdm_size_t stack_size;
|
||||
#ifndef WIN32
|
||||
pthread_attr_t attribute;
|
||||
#endif
|
||||
};
|
||||
|
||||
ftdm_size_t thread_default_stacksize = 0;
|
||||
|
||||
FT_DECLARE(void) ftdm_thread_override_default_stacksize(ftdm_size_t size)
|
||||
{
|
||||
thread_default_stacksize = size;
|
||||
}
|
||||
|
||||
static void * FTDM_THREAD_CALLING_CONVENTION thread_launch(void *args)
|
||||
{
|
||||
void *exit_val;
|
||||
ftdm_thread_t *thread = (ftdm_thread_t *)args;
|
||||
exit_val = thread->function(thread, thread->private_data);
|
||||
#ifndef WIN32
|
||||
pthread_attr_destroy(&thread->attribute);
|
||||
#endif
|
||||
ftdm_safe_free(thread);
|
||||
|
||||
return exit_val;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached(ftdm_thread_function_t func, void *data)
|
||||
{
|
||||
return ftdm_thread_create_detached_ex(func, data, thread_default_stacksize);
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached_ex(ftdm_thread_function_t func, void *data, ftdm_size_t stack_size)
|
||||
{
|
||||
ftdm_thread_t *thread = NULL;
|
||||
ftdm_status_t status = FTDM_FAIL;
|
||||
|
||||
if (!func || !(thread = (ftdm_thread_t *)ftdm_malloc(sizeof(ftdm_thread_t)))) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
thread->private_data = data;
|
||||
thread->function = func;
|
||||
thread->stack_size = stack_size;
|
||||
|
||||
#if defined(WIN32)
|
||||
thread->handle = (void *)_beginthreadex(NULL, (unsigned)thread->stack_size, (unsigned int (__stdcall *)(void *))thread_launch, thread, 0, NULL);
|
||||
if (!thread->handle) {
|
||||
goto fail;
|
||||
}
|
||||
CloseHandle(thread->handle);
|
||||
|
||||
status = FTDM_SUCCESS;
|
||||
goto done;
|
||||
#else
|
||||
|
||||
if (pthread_attr_init(&thread->attribute) != 0) goto fail;
|
||||
|
||||
if (pthread_attr_setdetachstate(&thread->attribute, PTHREAD_CREATE_DETACHED) != 0) goto failpthread;
|
||||
|
||||
if (thread->stack_size && pthread_attr_setstacksize(&thread->attribute, thread->stack_size) != 0) goto failpthread;
|
||||
|
||||
if (pthread_create(&thread->handle, &thread->attribute, thread_launch, thread) != 0) goto failpthread;
|
||||
|
||||
status = FTDM_SUCCESS;
|
||||
goto done;
|
||||
failpthread:
|
||||
pthread_attr_destroy(&thread->attribute);
|
||||
#endif
|
||||
|
||||
fail:
|
||||
if (thread) {
|
||||
ftdm_safe_free(thread);
|
||||
}
|
||||
done:
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_mutex_create(ftdm_mutex_t **mutex)
|
||||
{
|
||||
ftdm_status_t status = FTDM_FAIL;
|
||||
#ifndef WIN32
|
||||
pthread_mutexattr_t attr;
|
||||
#endif
|
||||
ftdm_mutex_t *check = NULL;
|
||||
|
||||
check = (ftdm_mutex_t *)ftdm_malloc(sizeof(**mutex));
|
||||
if (!check)
|
||||
goto done;
|
||||
#ifdef WIN32
|
||||
InitializeCriticalSection(&check->mutex);
|
||||
#else
|
||||
if (pthread_mutexattr_init(&attr))
|
||||
goto done;
|
||||
|
||||
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE))
|
||||
goto fail;
|
||||
|
||||
if (pthread_mutex_init(&check->mutex, &attr))
|
||||
goto fail;
|
||||
|
||||
goto success;
|
||||
|
||||
fail:
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
goto done;
|
||||
|
||||
success:
|
||||
#endif
|
||||
*mutex = check;
|
||||
status = FTDM_SUCCESS;
|
||||
|
||||
done:
|
||||
return status;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_mutex_destroy(ftdm_mutex_t **mutex)
|
||||
{
|
||||
ftdm_mutex_t *mp = *mutex;
|
||||
*mutex = NULL;
|
||||
if (!mp) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
#ifdef WIN32
|
||||
DeleteCriticalSection(&mp->mutex);
|
||||
#else
|
||||
if (pthread_mutex_destroy(&mp->mutex))
|
||||
return FTDM_FAIL;
|
||||
#endif
|
||||
ftdm_safe_free(mp);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_lock(ftdm_mutex_t *mutex)
|
||||
{
|
||||
#ifdef WIN32
|
||||
EnterCriticalSection(&mutex->mutex);
|
||||
#else
|
||||
int err;
|
||||
if ((err = pthread_mutex_lock(&mutex->mutex))) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failed to lock mutex %d:%s\n", err, strerror(err));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
#endif
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(ftdm_mutex_t *mutex)
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (!TryEnterCriticalSection(&mutex->mutex))
|
||||
return FTDM_FAIL;
|
||||
#else
|
||||
if (pthread_mutex_trylock(&mutex->mutex))
|
||||
return FTDM_FAIL;
|
||||
#endif
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(ftdm_mutex_t *mutex)
|
||||
{
|
||||
#ifdef WIN32
|
||||
LeaveCriticalSection(&mutex->mutex);
|
||||
#else
|
||||
if (pthread_mutex_unlock(&mutex->mutex))
|
||||
return FTDM_FAIL;
|
||||
#endif
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device)
|
||||
{
|
||||
ftdm_interrupt_t *interrupt = NULL;
|
||||
#ifndef WIN32
|
||||
int fds[2];
|
||||
#endif
|
||||
|
||||
ftdm_assert_return(ininterrupt != NULL, FTDM_FAIL, "interrupt double pointer is null!\n");
|
||||
|
||||
interrupt = ftdm_calloc(1, sizeof(*interrupt));
|
||||
if (!interrupt) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt memory\n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
interrupt->device = device;
|
||||
#ifdef WIN32
|
||||
interrupt->interrupt = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (!interrupt->interrupt) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt event\n");
|
||||
goto failed;
|
||||
}
|
||||
#else
|
||||
if (pipe(fds)) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt pipe: %s\n", strerror(errno));
|
||||
goto failed;
|
||||
}
|
||||
interrupt->readfd = fds[0];
|
||||
interrupt->writefd = fds[1];
|
||||
#endif
|
||||
|
||||
*ininterrupt = interrupt;
|
||||
return FTDM_SUCCESS;
|
||||
|
||||
failed:
|
||||
if (interrupt) {
|
||||
#ifndef WIN32
|
||||
if (interrupt->readfd) {
|
||||
close(interrupt->readfd);
|
||||
close(interrupt->writefd);
|
||||
interrupt->readfd = -1;
|
||||
interrupt->writefd = -1;
|
||||
}
|
||||
#endif
|
||||
ftdm_safe_free(interrupt);
|
||||
}
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
#define ONE_BILLION 1000000000
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int ms)
|
||||
{
|
||||
int num = 1;
|
||||
#ifdef WIN32
|
||||
DWORD res = 0;
|
||||
HANDLE ints[2];
|
||||
#else
|
||||
int res = 0;
|
||||
struct pollfd ints[2];
|
||||
char pipebuf[255];
|
||||
#endif
|
||||
|
||||
ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Condition is null!\n");
|
||||
|
||||
|
||||
/* start implementation */
|
||||
#ifdef WIN32
|
||||
ints[0] = interrupt->event;
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
num++;
|
||||
ints[1] = interrupt->device;
|
||||
}
|
||||
res = WaitForMultipleObjects(num, &ints, FALSE, ms >= 0 ? ms : INFINITE);
|
||||
switch (res) {
|
||||
case WAIT_TIMEOUT:
|
||||
return FTDM_TIMEOUT;
|
||||
case WAIT_FAILED:
|
||||
case WAIT_ABANDONED: /* is it right to fail with abandoned? */
|
||||
return FTDM_FAIL;
|
||||
default:
|
||||
if (res >= (sizeof(ints)/sizeof(ints[0]))) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Error waiting for freetdm interrupt event (WaitForSingleObject returned %d)\n", res);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
#else
|
||||
ints[0].fd = interrupt->readfd;
|
||||
ints[0].events = POLLIN;
|
||||
ints[0].revents = 0;
|
||||
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
num++;
|
||||
ints[1].fd = interrupt->device;
|
||||
ints[1].events = POLLIN;
|
||||
ints[1].revents = 0;
|
||||
}
|
||||
|
||||
res = poll(ints, num, ms);
|
||||
|
||||
if (res == -1) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "interrupt poll failed (%s)\n", strerror(errno));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (res == 0) {
|
||||
return FTDM_TIMEOUT;
|
||||
}
|
||||
|
||||
if (ints[0].revents & POLLIN) {
|
||||
res = read(ints[0].fd, pipebuf, sizeof(pipebuf));
|
||||
if (res == -1) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *interrupt)
|
||||
{
|
||||
ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Interrupt is null!\n");
|
||||
#ifdef WIN32
|
||||
if (!SetEvent(interrupt->interrupt)) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failed to signal interrupt\n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
#else
|
||||
int err;
|
||||
if ((err = write(interrupt->writefd, "w", 1)) != 1) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failed to signal interrupt: %s\n", errno, strerror(errno));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
#endif
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **ininterrupt)
|
||||
{
|
||||
ftdm_interrupt_t *interrupt = NULL;
|
||||
ftdm_assert_return(ininterrupt != NULL, FTDM_FAIL, "Interrupt null when destroying!\n");
|
||||
interrupt = *ininterrupt;
|
||||
#ifdef WIN32
|
||||
CloseHandle(interrupt->interrupt);
|
||||
#else
|
||||
close(interrupt->readfd);
|
||||
close(interrupt->writefd);
|
||||
interrupt->readfd = -1;
|
||||
interrupt->writefd = -1;
|
||||
#endif
|
||||
ftdm_safe_free(interrupt);
|
||||
*ininterrupt = NULL;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms)
|
||||
{
|
||||
#ifndef WIN32
|
||||
int i;
|
||||
int res = 0;
|
||||
int numdevices = 0;
|
||||
char pipebuf[255];
|
||||
struct pollfd ints[size*2];
|
||||
|
||||
memset(&ints, 0, sizeof(ints));
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
ints[i].events = POLLIN;
|
||||
ints[i].revents = 0;
|
||||
ints[i].fd = interrupts[i]->readfd;
|
||||
if (interrupts[i]->device != FTDM_INVALID_SOCKET) {
|
||||
ints[i+numdevices].events = POLLIN;
|
||||
ints[i+numdevices].revents = 0;
|
||||
ints[i+numdevices].fd = interrupts[i]->device;
|
||||
numdevices++;
|
||||
}
|
||||
}
|
||||
|
||||
res = poll(ints, size + numdevices, ms);
|
||||
|
||||
if (res == -1) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "interrupt poll failed (%s)\n", strerror(errno));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (res == 0) {
|
||||
return FTDM_TIMEOUT;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
if (ints[i].revents & POLLIN) {
|
||||
res = read(ints[i].fd, pipebuf, sizeof(pipebuf));
|
||||
if (res == -1) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
69
libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h
Normal file
69
libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FTDM_ANALOG_H
|
||||
#define FTDM_ANALOG_H
|
||||
#include "freetdm.h"
|
||||
|
||||
typedef enum {
|
||||
FTDM_ANALOG_RUNNING = (1 << 0),
|
||||
FTDM_ANALOG_CALLERID = (1 << 1)
|
||||
} ftdm_analog_flag_t;
|
||||
|
||||
#define FTDM_MAX_HOTLINE_STR 20
|
||||
#define MAX_DTMF 256
|
||||
|
||||
struct ftdm_analog_data {
|
||||
uint32_t flags;
|
||||
uint32_t max_dialstr;
|
||||
uint32_t digit_timeout;
|
||||
char hotline[FTDM_MAX_HOTLINE_STR];
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void *ftdm_analog_run(ftdm_thread_t *me, void *obj);
|
||||
typedef struct ftdm_analog_data ftdm_analog_data_t;
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
353
libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj
Normal file
353
libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj
Normal file
@ -0,0 +1,353 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ftmod_analog"
|
||||
ProjectGUID="{37C94798-6E33-4B4F-8EE0-C72A7DC91157}"
|
||||
RootNamespace="ftmod_analog"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftmod_analog.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftdm_analog.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
975
libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c
Normal file
975
libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c
Normal file
@ -0,0 +1,975 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "ftdm_analog.h"
|
||||
|
||||
#ifndef localtime_r
|
||||
struct tm * localtime_r(const time_t *clock, struct tm *result);
|
||||
#endif
|
||||
|
||||
static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj);
|
||||
|
||||
/**
|
||||
* \brief Starts an FXO channel thread (outgoing call)
|
||||
* \param ftdmchan Channel to initiate call on
|
||||
* \return Success or failure
|
||||
*
|
||||
* Initialises state, starts tone progress detection and runs the channel in a new a thread.
|
||||
*/
|
||||
static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxo_outgoing_call)
|
||||
{
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) {
|
||||
ftdm_channel_clear_needed_tones(ftdmchan);
|
||||
ftdm_channel_clear_detected_tones(ftdmchan);
|
||||
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_PROGRESS_DETECT, NULL);
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_DIAL] = 1;
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING);
|
||||
ftdm_thread_create_detached(ftdm_analog_channel_run, ftdmchan);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Starts an FXS channel thread (outgoing call)
|
||||
* \param ftdmchan Channel to initiate call on
|
||||
* \return Success or failure
|
||||
*
|
||||
* Indicates call waiting if channel is already in use, otherwise runs the channel in a new thread.
|
||||
*/
|
||||
static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxs_outgoing_call)
|
||||
{
|
||||
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CALLWAITING);
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_GENRING);
|
||||
ftdm_thread_create_detached(ftdm_analog_channel_run, ftdmchan);
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Starts an analog span thread (monitor)
|
||||
* \param span Span to monitor
|
||||
* \return Success or failure
|
||||
*/
|
||||
static ftdm_status_t ftdm_analog_start(ftdm_span_t *span)
|
||||
{
|
||||
ftdm_analog_data_t *analog_data = span->signal_data;
|
||||
ftdm_set_flag(analog_data, FTDM_ANALOG_RUNNING);
|
||||
return ftdm_thread_create_detached(ftdm_analog_run, span);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Initialises an analog span from configuration variables
|
||||
* \param span Span to configure
|
||||
* \param sig_cb Callback function for event signals
|
||||
* \param ap List of configuration variables
|
||||
* \return Success or failure
|
||||
*/
|
||||
static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span)
|
||||
//ftdm_status_t ftdm_analog_configure_span(ftdm_span_t *span, char *tonemap, uint32_t digit_timeout, uint32_t max_dialstr, fio_signal_cb_t sig_cb)
|
||||
{
|
||||
ftdm_analog_data_t *analog_data;
|
||||
const char *tonemap = "us";
|
||||
const char *hotline = "";
|
||||
uint32_t digit_timeout = 10;
|
||||
uint32_t max_dialstr = MAX_DTMF;
|
||||
const char *var, *val;
|
||||
int *intval;
|
||||
uint32_t flags = FTDM_ANALOG_CALLERID;
|
||||
|
||||
assert(sig_cb != NULL);
|
||||
|
||||
if (span->signal_type) {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling.");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
analog_data = ftdm_malloc(sizeof(*analog_data));
|
||||
assert(analog_data != NULL);
|
||||
memset(analog_data, 0, sizeof(*analog_data));
|
||||
|
||||
while ((var = va_arg(ap, char *))) {
|
||||
if (!strcasecmp(var, "tonemap")) {
|
||||
if (!(val = va_arg(ap, char *))) {
|
||||
break;
|
||||
}
|
||||
tonemap = val;
|
||||
} else if (!strcasecmp(var, "digit_timeout")) {
|
||||
if (!(intval = va_arg(ap, int *))) {
|
||||
break;
|
||||
}
|
||||
digit_timeout = *intval;
|
||||
} else if (!strcasecmp(var, "enable_callerid")) {
|
||||
if (!(val = va_arg(ap, char *))) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ftdm_true(val)) {
|
||||
flags |= FTDM_ANALOG_CALLERID;
|
||||
} else {
|
||||
flags &= ~FTDM_ANALOG_CALLERID;
|
||||
}
|
||||
} else if (!strcasecmp(var, "max_dialstr")) {
|
||||
if (!(intval = va_arg(ap, int *))) {
|
||||
break;
|
||||
}
|
||||
max_dialstr = *intval;
|
||||
} else if (!strcasecmp(var, "hotline")) {
|
||||
if (!(val = va_arg(ap, char *))) {
|
||||
break;
|
||||
}
|
||||
hotline = val;
|
||||
} else {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (digit_timeout < 2000 || digit_timeout > 10000) {
|
||||
digit_timeout = 2000;
|
||||
}
|
||||
|
||||
if ((max_dialstr < 1 && !strlen(hotline)) || max_dialstr > MAX_DTMF) {
|
||||
max_dialstr = MAX_DTMF;
|
||||
}
|
||||
|
||||
span->start = ftdm_analog_start;
|
||||
analog_data->flags = flags;
|
||||
analog_data->digit_timeout = digit_timeout;
|
||||
analog_data->max_dialstr = max_dialstr;
|
||||
span->signal_cb = sig_cb;
|
||||
strncpy(analog_data->hotline, hotline, sizeof(analog_data->hotline));
|
||||
span->signal_type = FTDM_SIGTYPE_ANALOG;
|
||||
span->signal_data = analog_data;
|
||||
span->outgoing_call = span->trunk_type == FTDM_TRUNK_FXS ? analog_fxs_outgoing_call : analog_fxo_outgoing_call;
|
||||
ftdm_span_load_tones(span, tonemap);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retrieves tone generation output to be sent
|
||||
* \param ts Teletone generator
|
||||
* \param map Tone map
|
||||
* \return -1 on error, 0 on success
|
||||
*/
|
||||
static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
|
||||
{
|
||||
ftdm_buffer_t *dt_buffer = ts->user_data;
|
||||
int wrote;
|
||||
|
||||
if (!dt_buffer) {
|
||||
return -1;
|
||||
}
|
||||
wrote = teletone_mux_tones(ts, map);
|
||||
ftdm_buffer_write(dt_buffer, ts->buffer, wrote * 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sends caller id on an analog channel (FSK coded)
|
||||
* \param ftdmchan Channel to send caller id on
|
||||
*/
|
||||
static void send_caller_id(ftdm_channel_t *ftdmchan)
|
||||
{
|
||||
ftdm_fsk_data_state_t fsk_data;
|
||||
uint8_t databuf[1024] = "";
|
||||
char time_str[9];
|
||||
struct tm tm;
|
||||
time_t now;
|
||||
ftdm_mdmf_type_t mt = MDMF_INVALID;
|
||||
|
||||
time(&now);
|
||||
#ifdef WIN32
|
||||
_tzset();
|
||||
_localtime64_s(&tm, &now);
|
||||
#else
|
||||
localtime_r(&now, &tm);
|
||||
#endif
|
||||
strftime(time_str, sizeof(time_str), "%m%d%H%M", &tm);
|
||||
|
||||
ftdm_fsk_data_init(&fsk_data, databuf, sizeof(databuf));
|
||||
ftdm_fsk_data_add_mdmf(&fsk_data, MDMF_DATETIME, (uint8_t *) time_str, 8);
|
||||
|
||||
if (ftdm_strlen_zero(ftdmchan->caller_data.cid_num.digits)) {
|
||||
mt = MDMF_NO_NUM;
|
||||
ftdm_set_string(ftdmchan->caller_data.cid_num.digits, "O");
|
||||
} else if (!strcasecmp(ftdmchan->caller_data.cid_num.digits, "P") || !strcasecmp(ftdmchan->caller_data.cid_num.digits, "O")) {
|
||||
mt = MDMF_NO_NUM;
|
||||
} else {
|
||||
mt = MDMF_PHONE_NUM;
|
||||
}
|
||||
ftdm_fsk_data_add_mdmf(&fsk_data, mt, (uint8_t *) ftdmchan->caller_data.cid_num.digits, (uint8_t)strlen(ftdmchan->caller_data.cid_num.digits));
|
||||
|
||||
if (ftdm_strlen_zero(ftdmchan->caller_data.cid_name)) {
|
||||
mt = MDMF_NO_NAME;
|
||||
ftdm_set_string(ftdmchan->caller_data.cid_name, "O");
|
||||
} else if (!strcasecmp(ftdmchan->caller_data.cid_name, "P") || !strcasecmp(ftdmchan->caller_data.cid_name, "O")) {
|
||||
mt = MDMF_NO_NAME;
|
||||
} else {
|
||||
mt = MDMF_PHONE_NAME;
|
||||
}
|
||||
ftdm_fsk_data_add_mdmf(&fsk_data, mt, (uint8_t *) ftdmchan->caller_data.cid_name, (uint8_t)strlen(ftdmchan->caller_data.cid_name));
|
||||
|
||||
ftdm_fsk_data_add_checksum(&fsk_data);
|
||||
ftdm_channel_send_fsk_data(ftdmchan, &fsk_data, -14);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Main thread function for analog channel (outgoing call)
|
||||
* \param me Current thread
|
||||
* \param obj Channel to run in this thread
|
||||
*/
|
||||
static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj)
|
||||
{
|
||||
ftdm_channel_t *ftdmchan = (ftdm_channel_t *) obj;
|
||||
ftdm_buffer_t *dt_buffer = NULL;
|
||||
teletone_generation_session_t ts;
|
||||
uint8_t frame[1024];
|
||||
ftdm_size_t len, rlen;
|
||||
ftdm_tone_type_t tt = FTDM_TONE_DTMF;
|
||||
char dtmf[MAX_DTMF+1] = "";
|
||||
ftdm_size_t dtmf_offset = 0;
|
||||
ftdm_analog_data_t *analog_data = ftdmchan->span->signal_data;
|
||||
ftdm_channel_t *closed_chan;
|
||||
uint32_t state_counter = 0, elapsed = 0, collecting = 0, interval = 0, last_digit = 0, indicate = 0, dial_timeout = 30000;
|
||||
ftdm_sigmsg_t sig;
|
||||
ftdm_status_t status;
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG CHANNEL thread starting.\n");
|
||||
|
||||
ts.buffer = NULL;
|
||||
|
||||
if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "OPEN ERROR [%s]\n", ftdmchan->last_error);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ftdm_buffer_create(&dt_buffer, 1024, 3192, 0) != FTDM_SUCCESS) {
|
||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "memory error!");
|
||||
ftdm_log(FTDM_LOG_ERROR, "MEM ERROR\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, &tt) != FTDM_SUCCESS) {
|
||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "error initilizing tone detector!");
|
||||
ftdm_log(FTDM_LOG_ERROR, "TONE ERROR\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_INTHREAD);
|
||||
teletone_init_session(&ts, 0, teletone_handler, dt_buffer);
|
||||
ts.rate = 8000;
|
||||
#if 0
|
||||
ts.debug = 1;
|
||||
ts.debug_stream = stdout;
|
||||
#endif
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval);
|
||||
ftdm_buffer_set_loops(dt_buffer, -1);
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
|
||||
assert(interval != 0);
|
||||
|
||||
while (ftdm_running() && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) {
|
||||
ftdm_wait_flag_t flags = FTDM_READ;
|
||||
ftdm_size_t dlen = 0;
|
||||
|
||||
len = sizeof(frame);
|
||||
|
||||
elapsed += interval;
|
||||
state_counter += interval;
|
||||
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) {
|
||||
switch(ftdmchan->state) {
|
||||
case FTDM_CHANNEL_STATE_GET_CALLERID:
|
||||
{
|
||||
if (state_counter > 5000 || !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_CALLERID_DETECT, NULL);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALING:
|
||||
{
|
||||
if (state_counter > dial_timeout) {
|
||||
if (ftdmchan->needed_tones[FTDM_TONEMAP_DIAL]) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_GENRING:
|
||||
{
|
||||
if (state_counter > 60000) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else if (!ftdmchan->fsk_buffer || !ftdm_buffer_inuse(ftdmchan->fsk_buffer)) {
|
||||
ftdm_sleep(interval);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALTONE:
|
||||
{
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_HOLD) && state_counter > 10000) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_BUSY:
|
||||
{
|
||||
if (state_counter > 20000) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_ATTN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_ATTN:
|
||||
{
|
||||
if (state_counter > 20000) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_HANGUP:
|
||||
{
|
||||
if (state_counter > 500) {
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_OFF, NULL);
|
||||
}
|
||||
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) &&
|
||||
(ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE
|
||||
|| ftdmchan->last_state >= FTDM_CHANNEL_STATE_IDLE)) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING;
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_CALLWAITING:
|
||||
{
|
||||
int done = 0;
|
||||
|
||||
if (ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] == 1) {
|
||||
send_caller_id(ftdmchan);
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]++;
|
||||
} else if (state_counter > 600 && !ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]) {
|
||||
send_caller_id(ftdmchan);
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]++;
|
||||
} else if (state_counter > 1000 && !ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK]) {
|
||||
done = 1;
|
||||
} else if (state_counter > 10000) {
|
||||
if (ftdmchan->fsk_buffer) {
|
||||
ftdm_buffer_zero(ftdmchan->fsk_buffer);
|
||||
} else {
|
||||
ftdm_buffer_create(&ftdmchan->fsk_buffer, 128, 128, 0);
|
||||
}
|
||||
|
||||
ts.user_data = ftdmchan->fsk_buffer;
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_CALLWAITING_SAS]);
|
||||
ts.user_data = dt_buffer;
|
||||
done = 1;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE);
|
||||
ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE);
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0;
|
||||
}
|
||||
}
|
||||
case FTDM_CHANNEL_STATE_UP:
|
||||
case FTDM_CHANNEL_STATE_IDLE:
|
||||
{
|
||||
ftdm_sleep(interval);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE);
|
||||
ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE);
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
indicate = 0;
|
||||
state_counter = 0;
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Executing state handler on %d:%d for %s\n",
|
||||
ftdmchan->span_id, ftdmchan->chan_id,
|
||||
ftdm_channel_state2str(ftdmchan->state));
|
||||
switch(ftdmchan->state) {
|
||||
case FTDM_CHANNEL_STATE_UP:
|
||||
{
|
||||
ftdm_channel_use(ftdmchan);
|
||||
ftdm_channel_clear_needed_tones(ftdmchan);
|
||||
ftdm_channel_flush_dtmf(ftdmchan);
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL);
|
||||
}
|
||||
|
||||
if (ftdmchan->fsk_buffer && ftdm_buffer_inuse(ftdmchan->fsk_buffer)) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Cancel FSK transmit due to early answer.\n");
|
||||
ftdm_buffer_zero(ftdmchan->fsk_buffer);
|
||||
}
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_OFF, NULL);
|
||||
}
|
||||
|
||||
if (ftdmchan->token_count == 1) {
|
||||
ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD);
|
||||
}
|
||||
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_HOLD)) {
|
||||
ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD);
|
||||
sig.event_id = FTDM_SIGEVENT_ADD_CALL;
|
||||
} else {
|
||||
sig.event_id = FTDM_SIGEVENT_UP;
|
||||
}
|
||||
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALING:
|
||||
{
|
||||
ftdm_channel_use(ftdmchan);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_IDLE:
|
||||
{
|
||||
ftdm_channel_use(ftdmchan);
|
||||
sig.event_id = FTDM_SIGEVENT_START;
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) {
|
||||
ftdm_set_string(ftdmchan->caller_data.dnis.digits, ftdmchan->chan_number);
|
||||
} else {
|
||||
ftdm_set_string(ftdmchan->caller_data.dnis.digits, dtmf);
|
||||
}
|
||||
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
{
|
||||
sig.event_id = FTDM_SIGEVENT_STOP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALTONE:
|
||||
{
|
||||
memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data));
|
||||
*dtmf = '\0';
|
||||
dtmf_offset = 0;
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_DIAL]);
|
||||
indicate = 1;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_CALLWAITING:
|
||||
{
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0;
|
||||
if (ftdmchan->fsk_buffer) {
|
||||
ftdm_buffer_zero(ftdmchan->fsk_buffer);
|
||||
} else {
|
||||
ftdm_buffer_create(&ftdmchan->fsk_buffer, 128, 128, 0);
|
||||
}
|
||||
|
||||
ts.user_data = ftdmchan->fsk_buffer;
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_CALLWAITING_SAS]);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_CALLWAITING_CAS]);
|
||||
ts.user_data = dt_buffer;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_GENRING:
|
||||
{
|
||||
ftdm_sigmsg_t sig;
|
||||
|
||||
send_caller_id(ftdmchan);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_ON, NULL);
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
sig.event_id = FTDM_SIGEVENT_PROGRESS;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_GET_CALLERID:
|
||||
{
|
||||
memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data));
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_CALLERID_DETECT, NULL);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_RING:
|
||||
{
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]);
|
||||
indicate = 1;
|
||||
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_BUSY:
|
||||
{
|
||||
ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CIRCUIT_CONGESTION;
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_BUSY]);
|
||||
indicate = 1;
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_ATTN:
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_ATTN]);
|
||||
indicate = 1;
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE || ftdmchan->state == FTDM_CHANNEL_STATE_COLLECT) {
|
||||
if ((dlen = ftdm_channel_dequeue_dtmf(ftdmchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) {
|
||||
|
||||
if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
collecting = 1;
|
||||
}
|
||||
dtmf_offset = strlen(dtmf);
|
||||
last_digit = elapsed;
|
||||
sig.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT;
|
||||
sig.raw_data = dtmf;
|
||||
if (ftdm_span_send_signal(ftdmchan->span, &sig) == FTDM_BREAK) {
|
||||
collecting = 0;
|
||||
}
|
||||
}
|
||||
else if(!analog_data->max_dialstr)
|
||||
{
|
||||
last_digit = elapsed;
|
||||
collecting = 0;
|
||||
strcpy(dtmf, analog_data->hotline);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (last_digit && (!collecting || ((elapsed - last_digit > analog_data->digit_timeout) || strlen(dtmf) >= analog_data->max_dialstr))) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Number obtained [%s]\n", dtmf);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
last_digit = 0;
|
||||
collecting = 0;
|
||||
}
|
||||
|
||||
if (ftdm_channel_wait(ftdmchan, &flags, interval * 2) != FTDM_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(flags & FTDM_READ)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ftdm_channel_read(ftdmchan, frame, &len) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "READ ERROR [%s]\n", ftdmchan->last_error);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && ftdmchan->detected_tones[0]) {
|
||||
ftdm_sigmsg_t sig;
|
||||
int i;
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
sig.event_id = FTDM_SIGEVENT_TONE_DETECTED;
|
||||
|
||||
for (i = 1; i < FTDM_TONEMAP_INVALID; i++) {
|
||||
if (ftdmchan->detected_tones[i]) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Detected tone %s on %d:%d\n", ftdm_tonemap2str(i), ftdmchan->span_id, ftdmchan->chan_id);
|
||||
sig.raw_data = &i;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
}
|
||||
}
|
||||
|
||||
if (ftdmchan->detected_tones[FTDM_TONEMAP_BUSY] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_FAIL1] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_FAIL2] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_FAIL3] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_ATTN]
|
||||
) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failure indication detected!\n");
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else if (ftdmchan->detected_tones[FTDM_TONEMAP_DIAL]) {
|
||||
if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "No Digits to send!\n");
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, ftdmchan->caller_data.dnis.digits) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Send Digits Failed [%s]\n", ftdmchan->last_error);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
state_counter = 0;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_RING] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_BUSY] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_FAIL1] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_FAIL2] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_FAIL3] = 1;
|
||||
dial_timeout = ((ftdmchan->dtmf_on + ftdmchan->dtmf_off) * strlen(ftdmchan->caller_data.dnis.digits)) + 2000;
|
||||
}
|
||||
}
|
||||
} else if (ftdmchan->detected_tones[FTDM_TONEMAP_RING]) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
}
|
||||
|
||||
ftdm_channel_clear_detected_tones(ftdmchan);
|
||||
}
|
||||
|
||||
if ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer)) || (ftdmchan->fsk_buffer && ftdm_buffer_inuse(ftdmchan->fsk_buffer))) {
|
||||
//rlen = len;
|
||||
//memset(frame, 0, len);
|
||||
//ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!indicate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL);
|
||||
}
|
||||
|
||||
if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) {
|
||||
len *= 2;
|
||||
}
|
||||
|
||||
rlen = ftdm_buffer_read_loop(dt_buffer, frame, len);
|
||||
|
||||
if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) {
|
||||
fio_codec_t codec_func = NULL;
|
||||
|
||||
if (ftdmchan->native_codec == FTDM_CODEC_ULAW) {
|
||||
codec_func = fio_slin2ulaw;
|
||||
} else if (ftdmchan->native_codec == FTDM_CODEC_ALAW) {
|
||||
codec_func = fio_slin2alaw;
|
||||
}
|
||||
|
||||
if (codec_func) {
|
||||
status = codec_func(frame, sizeof(frame), &rlen);
|
||||
} else {
|
||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen);
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL);
|
||||
}
|
||||
|
||||
if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RINGING)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_OFF, NULL);
|
||||
}
|
||||
|
||||
|
||||
closed_chan = ftdmchan;
|
||||
ftdm_channel_close(&ftdmchan);
|
||||
|
||||
ftdm_channel_command(closed_chan, FTDM_COMMAND_SET_NATIVE_CODEC, NULL);
|
||||
|
||||
if (ts.buffer) {
|
||||
teletone_destroy_session(&ts);
|
||||
}
|
||||
|
||||
if (dt_buffer) {
|
||||
ftdm_buffer_destroy(&dt_buffer);
|
||||
}
|
||||
|
||||
if (closed_chan->state != FTDM_CHANNEL_STATE_DOWN) {
|
||||
ftdm_set_state_locked(closed_chan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG CHANNEL %d:%d thread ended.\n", closed_chan->span_id, closed_chan->chan_id);
|
||||
ftdm_clear_flag(closed_chan, FTDM_CHANNEL_INTHREAD);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Processes freetdm event
|
||||
* \param span Span on which the event was fired
|
||||
* \param event Event to be treated
|
||||
* \return Success or failure
|
||||
*/
|
||||
static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event)
|
||||
{
|
||||
ftdm_sigmsg_t sig;
|
||||
ftdm_analog_data_t *analog_data = event->channel->span->signal_data;
|
||||
int locked = 0;
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = event->channel->chan_id;
|
||||
sig.span_id = event->channel->span_id;
|
||||
sig.channel = event->channel;
|
||||
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n",
|
||||
ftdm_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state));
|
||||
|
||||
ftdm_mutex_lock(event->channel->mutex);
|
||||
locked++;
|
||||
|
||||
switch(event->enum_id) {
|
||||
case FTDM_OOB_RING_START:
|
||||
{
|
||||
if (event->channel->type != FTDM_CHAN_TYPE_FXO) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Cannot get a RING_START event on a non-fxo channel, please check your config.\n");
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN);
|
||||
goto end;
|
||||
}
|
||||
if (!event->channel->ring_count && (event->channel->state == FTDM_CHANNEL_STATE_DOWN && !ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD))) {
|
||||
if (ftdm_test_flag(analog_data, FTDM_ANALOG_CALLERID)) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_GET_CALLERID);
|
||||
} else {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_IDLE);
|
||||
}
|
||||
event->channel->ring_count = 1;
|
||||
ftdm_mutex_unlock(event->channel->mutex);
|
||||
locked = 0;
|
||||
ftdm_thread_create_detached(ftdm_analog_channel_run, event->channel);
|
||||
} else {
|
||||
event->channel->ring_count++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_OOB_ONHOOK:
|
||||
{
|
||||
if (ftdm_test_flag(event->channel, FTDM_CHANNEL_RINGING)) {
|
||||
ftdm_channel_command(event->channel, FTDM_COMMAND_GENERATE_RING_OFF, NULL);
|
||||
}
|
||||
|
||||
if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case FTDM_OOB_FLASH:
|
||||
{
|
||||
if (event->channel->state == FTDM_CHANNEL_STATE_CALLWAITING) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP);
|
||||
ftdm_clear_flag_locked(event->channel, FTDM_CHANNEL_STATE_CHANGE);
|
||||
ftdm_clear_flag_locked(event->channel->span, FTDM_SPAN_STATE_CHANGE);
|
||||
event->channel->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0;
|
||||
}
|
||||
|
||||
ftdm_channel_rotate_tokens(event->channel);
|
||||
|
||||
if (ftdm_test_flag(event->channel, FTDM_CHANNEL_HOLD) && event->channel->token_count != 1) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP);
|
||||
} else {
|
||||
sig.event_id = FTDM_SIGEVENT_FLASH;
|
||||
ftdm_span_send_signal(span, &sig);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_OOB_OFFHOOK:
|
||||
{
|
||||
if (event->channel->type == FTDM_CHAN_TYPE_FXS) {
|
||||
if (ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD)) {
|
||||
if (ftdm_test_flag(event->channel, FTDM_CHANNEL_RINGING)) {
|
||||
ftdm_channel_command(event->channel, FTDM_COMMAND_GENERATE_RING_OFF, NULL);
|
||||
}
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP);
|
||||
} else {
|
||||
if(!analog_data->max_dialstr) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_COLLECT);
|
||||
} else {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DIALTONE);
|
||||
}
|
||||
ftdm_mutex_unlock(event->channel->mutex);
|
||||
locked = 0;
|
||||
ftdm_thread_create_detached(ftdm_analog_channel_run, event->channel);
|
||||
}
|
||||
} else {
|
||||
if (!ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD)) {
|
||||
if (ftdm_test_flag(event->channel, FTDM_CHANNEL_OFFHOOK)) {
|
||||
ftdm_channel_command(event->channel, FTDM_COMMAND_ONHOOK, NULL);
|
||||
}
|
||||
}
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
if (locked) {
|
||||
ftdm_mutex_unlock(event->channel->mutex);
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Main thread function for analog span (monitor)
|
||||
* \param me Current thread
|
||||
* \param obj Span to run in this thread
|
||||
*/
|
||||
static void *ftdm_analog_run(ftdm_thread_t *me, void *obj)
|
||||
{
|
||||
ftdm_span_t *span = (ftdm_span_t *) obj;
|
||||
ftdm_analog_data_t *analog_data = span->signal_data;
|
||||
int errs = 0;
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG thread starting.\n");
|
||||
|
||||
while(ftdm_running() && ftdm_test_flag(analog_data, FTDM_ANALOG_RUNNING)) {
|
||||
int waitms = 1000;
|
||||
ftdm_status_t status;
|
||||
|
||||
if ((status = ftdm_span_poll_event(span, waitms)) != FTDM_FAIL) {
|
||||
errs = 0;
|
||||
}
|
||||
|
||||
switch(status) {
|
||||
case FTDM_SUCCESS:
|
||||
{
|
||||
ftdm_event_t *event;
|
||||
while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) {
|
||||
if (event->enum_id == FTDM_OOB_NOOP) {
|
||||
continue;
|
||||
}
|
||||
if (process_event(span, event) != FTDM_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_FAIL:
|
||||
{
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failure Polling event! [%s]\n", span->last_error);
|
||||
if (++errs > 300) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Too Many Errors!\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
ftdm_clear_flag(analog_data, FTDM_ANALOG_RUNNING);
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG thread ending.\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief FreeTDM analog signaling module initialisation
|
||||
* \return Success
|
||||
*/
|
||||
static FIO_SIG_LOAD_FUNCTION(ftdm_analog_init)
|
||||
{
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief FreeTDM analog signaling module definition
|
||||
*/
|
||||
EX_DECLARE_DATA ftdm_module_t ftdm_module = {
|
||||
"analog",
|
||||
NULL,
|
||||
NULL,
|
||||
ftdm_analog_init,
|
||||
ftdm_analog_configure_span,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
202
libs/freetdm/src/ftmod/ftmod_analog/ozmod_analog.2005.vcproj
Normal file
202
libs/freetdm/src/ftmod/ftmod_analog/ozmod_analog.2005.vcproj
Normal file
@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ftmod_analog"
|
||||
ProjectGUID="{37C94798-6E33-4B4F-8EE0-C72A7DC91157}"
|
||||
RootNamespace="ftmod_analog"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftmod_analog.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftdm_analog.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
70
libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h
Normal file
70
libs/freetdm/src/ftmod/ftmod_analog_em/ftdm_analog_em.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* John Wehle (john@feith.com)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FTDM_ANALOG_EM_H
|
||||
#define FTDM_ANALOG_EM_H
|
||||
#include "freetdm.h"
|
||||
|
||||
#define MAX_DIALSTRING 256
|
||||
|
||||
typedef enum {
|
||||
FTDM_ANALOG_EM_RUNNING = (1 << 0)
|
||||
} ftdm_analog_em_flag_t;
|
||||
|
||||
|
||||
struct ftdm_analog_data {
|
||||
uint32_t flags;
|
||||
uint32_t max_dialstr;
|
||||
uint32_t digit_timeout;
|
||||
};
|
||||
|
||||
static void *ftdm_analog_em_run(ftdm_thread_t *me, void *obj);
|
||||
typedef struct ftdm_analog_data ftdm_analog_em_data_t;
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
@ -0,0 +1,353 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ftmod_analog_em"
|
||||
ProjectGUID="{B3F49375-2834-4937-9D8C-4AC2EC911010}"
|
||||
RootNamespace="ftmod_analog_em"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftmod_analog_em.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftdm_analog_em.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
707
libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c
Normal file
707
libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c
Normal file
@ -0,0 +1,707 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* John Wehle (john@feith.com)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "ftdm_analog_em.h"
|
||||
|
||||
#ifndef localtime_r
|
||||
struct tm * localtime_r(const time_t *clock, struct tm *result);
|
||||
#endif
|
||||
|
||||
static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj);
|
||||
|
||||
/**
|
||||
* \brief Starts an EM channel thread (outgoing call)
|
||||
* \param ftdmchan Channel to initiate call on
|
||||
* \return Success or failure
|
||||
*
|
||||
* Initialises state, starts tone progress detection and runs the channel in a new a thread.
|
||||
*/
|
||||
static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_em_outgoing_call)
|
||||
{
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) {
|
||||
ftdm_channel_clear_needed_tones(ftdmchan);
|
||||
ftdm_channel_clear_detected_tones(ftdmchan);
|
||||
|
||||
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND);
|
||||
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_PROGRESS_DETECT, NULL);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING);
|
||||
ftdm_thread_create_detached(ftdm_analog_em_channel_run, ftdmchan);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Starts an EM span thread (monitor)
|
||||
* \param span Span to monitor
|
||||
* \return Success or failure
|
||||
*/
|
||||
static ftdm_status_t ftdm_analog_em_start(ftdm_span_t *span)
|
||||
{
|
||||
ftdm_analog_em_data_t *analog_data = span->signal_data;
|
||||
ftdm_set_flag(analog_data, FTDM_ANALOG_EM_RUNNING);
|
||||
return ftdm_thread_create_detached(ftdm_analog_em_run, span);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Initialises an EM span from configuration variables
|
||||
* \param span Span to configure
|
||||
* \param sig_cb Callback function for event signals
|
||||
* \param ap List of configuration variables
|
||||
* \return Success or failure
|
||||
*/
|
||||
static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_em_configure_span)
|
||||
//ftdm_status_t ftdm_analog_em_configure_span(ftdm_span_t *span, char *tonemap, uint32_t digit_timeout, uint32_t max_dialstr, fio_signal_cb_t sig_cb)
|
||||
{
|
||||
ftdm_analog_em_data_t *analog_data;
|
||||
const char *tonemap = "us";
|
||||
uint32_t digit_timeout = 10;
|
||||
uint32_t max_dialstr = 11;
|
||||
const char *var, *val;
|
||||
int *intval;
|
||||
|
||||
assert(sig_cb != NULL);
|
||||
|
||||
if (span->signal_type) {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling.");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
analog_data = ftdm_malloc(sizeof(*analog_data));
|
||||
assert(analog_data != NULL);
|
||||
memset(analog_data, 0, sizeof(*analog_data));
|
||||
|
||||
while((var = va_arg(ap, char *))) {
|
||||
if (!strcasecmp(var, "tonemap")) {
|
||||
if (!(val = va_arg(ap, char *))) {
|
||||
break;
|
||||
}
|
||||
tonemap = val;
|
||||
} else if (!strcasecmp(var, "digit_timeout")) {
|
||||
if (!(intval = va_arg(ap, int *))) {
|
||||
break;
|
||||
}
|
||||
digit_timeout = *intval;
|
||||
} else if (!strcasecmp(var, "max_dialstr")) {
|
||||
if (!(intval = va_arg(ap, int *))) {
|
||||
break;
|
||||
}
|
||||
max_dialstr = *intval;
|
||||
} else {
|
||||
snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (digit_timeout < 2000 || digit_timeout > 10000) {
|
||||
digit_timeout = 2000;
|
||||
}
|
||||
|
||||
if (max_dialstr < 2 || max_dialstr > MAX_DIALSTRING) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Invalid max_dialstr, setting to %d\n", MAX_DIALSTRING);
|
||||
max_dialstr = MAX_DIALSTRING;
|
||||
}
|
||||
|
||||
span->start = ftdm_analog_em_start;
|
||||
analog_data->digit_timeout = digit_timeout;
|
||||
analog_data->max_dialstr = max_dialstr;
|
||||
span->signal_cb = sig_cb;
|
||||
span->signal_type = FTDM_SIGTYPE_ANALOG;
|
||||
span->signal_data = analog_data;
|
||||
span->outgoing_call = analog_em_outgoing_call;
|
||||
ftdm_span_load_tones(span, tonemap);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retrieves tone generation output to be sent
|
||||
* \param ts Teletone generator
|
||||
* \param map Tone map
|
||||
* \return -1 on error, 0 on success
|
||||
*/
|
||||
static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
|
||||
{
|
||||
ftdm_buffer_t *dt_buffer = ts->user_data;
|
||||
int wrote;
|
||||
|
||||
if (!dt_buffer) {
|
||||
return -1;
|
||||
}
|
||||
wrote = teletone_mux_tones(ts, map);
|
||||
ftdm_buffer_write(dt_buffer, ts->buffer, wrote * 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Main thread function for EM channel (outgoing call)
|
||||
* \param me Current thread
|
||||
* \param obj Channel to run in this thread
|
||||
*/
|
||||
static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj)
|
||||
{
|
||||
ftdm_channel_t *ftdmchan = (ftdm_channel_t *) obj;
|
||||
ftdm_buffer_t *dt_buffer = NULL;
|
||||
teletone_generation_session_t ts;
|
||||
uint8_t frame[1024];
|
||||
ftdm_size_t len, rlen;
|
||||
ftdm_tone_type_t tt = FTDM_TONE_DTMF;
|
||||
char dtmf[128] = "";
|
||||
ftdm_size_t dtmf_offset = 0;
|
||||
ftdm_analog_em_data_t *analog_data = ftdmchan->span->signal_data;
|
||||
ftdm_channel_t *closed_chan;
|
||||
uint32_t state_counter = 0, elapsed = 0, collecting = 0, interval = 0, last_digit = 0, indicate = 0, dial_timeout = 30000;
|
||||
ftdm_sigmsg_t sig;
|
||||
ftdm_status_t status;
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM CHANNEL thread starting.\n");
|
||||
|
||||
ts.buffer = NULL;
|
||||
|
||||
if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "OPEN ERROR [%s]\n", ftdmchan->last_error);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ftdm_buffer_create(&dt_buffer, 1024, 3192, 0) != FTDM_SUCCESS) {
|
||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "memory error!");
|
||||
ftdm_log(FTDM_LOG_ERROR, "MEM ERROR\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, &tt) != FTDM_SUCCESS) {
|
||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "error initilizing tone detector!");
|
||||
ftdm_log(FTDM_LOG_ERROR, "TONE ERROR\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_INTHREAD);
|
||||
teletone_init_session(&ts, 0, teletone_handler, dt_buffer);
|
||||
ts.rate = 8000;
|
||||
#if 0
|
||||
ts.debug = 1;
|
||||
ts.debug_stream = stdout;
|
||||
#endif
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval);
|
||||
ftdm_buffer_set_loops(dt_buffer, -1);
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
|
||||
assert(interval != 0);
|
||||
|
||||
while (ftdm_running() && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) {
|
||||
ftdm_wait_flag_t flags = FTDM_READ;
|
||||
ftdm_size_t dlen = 0;
|
||||
|
||||
len = sizeof(frame);
|
||||
|
||||
elapsed += interval;
|
||||
state_counter += interval;
|
||||
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) {
|
||||
switch(ftdmchan->state) {
|
||||
case FTDM_CHANNEL_STATE_DIALING:
|
||||
{
|
||||
if (! ftdmchan->needed_tones[FTDM_TONEMAP_RING]
|
||||
&& ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) {
|
||||
if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "No Digits to send!\n");
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, ftdmchan->caller_data.dnis.digits) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Send Digits Failed [%s]\n", ftdmchan->last_error);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
state_counter = 0;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_RING] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_BUSY] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_FAIL1] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_FAIL2] = 1;
|
||||
ftdmchan->needed_tones[FTDM_TONEMAP_FAIL3] = 1;
|
||||
dial_timeout = ((ftdmchan->dtmf_on + ftdmchan->dtmf_off) * strlen(ftdmchan->caller_data.dnis.digits)) + 2000;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (state_counter > dial_timeout) {
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALTONE:
|
||||
{
|
||||
if (state_counter > 10000) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_BUSY:
|
||||
{
|
||||
if (state_counter > 20000) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_ATTN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_ATTN:
|
||||
{
|
||||
if (state_counter > 20000) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_HANGUP:
|
||||
{
|
||||
if (state_counter > 500) {
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) &&
|
||||
(ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE
|
||||
|| ftdmchan->last_state >= FTDM_CHANNEL_STATE_IDLE)) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else {
|
||||
ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING;
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_UP:
|
||||
case FTDM_CHANNEL_STATE_IDLE:
|
||||
{
|
||||
ftdm_sleep(interval);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE);
|
||||
ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE);
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
indicate = 0;
|
||||
state_counter = 0;
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Executing state handler on %d:%d for %s\n",
|
||||
ftdmchan->span_id, ftdmchan->chan_id,
|
||||
ftdm_channel_state2str(ftdmchan->state));
|
||||
switch(ftdmchan->state) {
|
||||
case FTDM_CHANNEL_STATE_UP:
|
||||
{
|
||||
ftdm_channel_use(ftdmchan);
|
||||
ftdm_channel_clear_needed_tones(ftdmchan);
|
||||
ftdm_channel_flush_dtmf(ftdmchan);
|
||||
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL);
|
||||
}
|
||||
|
||||
sig.event_id = FTDM_SIGEVENT_UP;
|
||||
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALING:
|
||||
{
|
||||
ftdm_channel_use(ftdmchan);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_IDLE:
|
||||
{
|
||||
ftdm_channel_use(ftdmchan);
|
||||
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
ftdm_set_string(ftdmchan->caller_data.dnis.digits, ftdmchan->chan_number);
|
||||
} else {
|
||||
ftdm_set_string(ftdmchan->caller_data.dnis.digits, dtmf);
|
||||
}
|
||||
|
||||
sig.event_id = FTDM_SIGEVENT_START;
|
||||
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
{
|
||||
sig.event_id = FTDM_SIGEVENT_STOP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_DIALTONE:
|
||||
{
|
||||
memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data));
|
||||
*dtmf = '\0';
|
||||
dtmf_offset = 0;
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_DIAL]);
|
||||
indicate = 1;
|
||||
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_WINK, NULL);
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_RING:
|
||||
{
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]);
|
||||
indicate = 1;
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_BUSY:
|
||||
{
|
||||
ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CIRCUIT_CONGESTION;
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_BUSY]);
|
||||
indicate = 1;
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_ATTN:
|
||||
{
|
||||
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
ftdm_buffer_zero(dt_buffer);
|
||||
teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_ATTN]);
|
||||
indicate = 1;
|
||||
} else {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE || ftdmchan->state == FTDM_CHANNEL_STATE_COLLECT) {
|
||||
if ((dlen = ftdm_channel_dequeue_dtmf(ftdmchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) {
|
||||
|
||||
if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
collecting = 1;
|
||||
}
|
||||
dtmf_offset = strlen(dtmf);
|
||||
last_digit = elapsed;
|
||||
sig.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT;
|
||||
sig.raw_data = dtmf;
|
||||
if (ftdm_span_send_signal(ftdmchan->span, &sig) == FTDM_BREAK) {
|
||||
collecting = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (last_digit && (!collecting || ((elapsed - last_digit > analog_data->digit_timeout) || strlen(dtmf) > analog_data->max_dialstr))) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Number obtained [%s]\n", dtmf);
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
last_digit = 0;
|
||||
collecting = 0;
|
||||
}
|
||||
|
||||
if (ftdm_channel_wait(ftdmchan, &flags, interval * 2) != FTDM_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(flags & FTDM_READ)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ftdm_channel_read(ftdmchan, frame, &len) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "READ ERROR [%s]\n", ftdmchan->last_error);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ftdmchan->detected_tones[0]) {
|
||||
ftdm_sigmsg_t sig;
|
||||
int i;
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
sig.event_id = FTDM_SIGEVENT_TONE_DETECTED;
|
||||
|
||||
for (i = 1; i < FTDM_TONEMAP_INVALID; i++) {
|
||||
if (ftdmchan->detected_tones[i]) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Detected tone %s on %d:%d\n", ftdm_tonemap2str(i), ftdmchan->span_id, ftdmchan->chan_id);
|
||||
sig.raw_data = &i;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sig);
|
||||
}
|
||||
}
|
||||
|
||||
if (ftdmchan->detected_tones[FTDM_TONEMAP_BUSY] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_FAIL1] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_FAIL2] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_FAIL3] ||
|
||||
ftdmchan->detected_tones[FTDM_TONEMAP_ATTN]
|
||||
) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failure indication detected!\n");
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY);
|
||||
} else if (ftdmchan->detected_tones[FTDM_TONEMAP_RING]) {
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
}
|
||||
|
||||
ftdm_channel_clear_detected_tones(ftdmchan);
|
||||
}
|
||||
|
||||
if ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer))) {
|
||||
rlen = len;
|
||||
memset(frame, 0, len);
|
||||
ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!indicate) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) {
|
||||
len *= 2;
|
||||
}
|
||||
|
||||
rlen = ftdm_buffer_read_loop(dt_buffer, frame, len);
|
||||
|
||||
if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) {
|
||||
fio_codec_t codec_func = NULL;
|
||||
|
||||
if (ftdmchan->native_codec == FTDM_CODEC_ULAW) {
|
||||
codec_func = fio_slin2ulaw;
|
||||
} else if (ftdmchan->native_codec == FTDM_CODEC_ALAW) {
|
||||
codec_func = fio_slin2alaw;
|
||||
}
|
||||
|
||||
if (codec_func) {
|
||||
status = codec_func(frame, sizeof(frame), &rlen);
|
||||
} else {
|
||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen);
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL);
|
||||
|
||||
closed_chan = ftdmchan;
|
||||
ftdm_channel_close(&ftdmchan);
|
||||
|
||||
ftdm_channel_command(closed_chan, FTDM_COMMAND_SET_NATIVE_CODEC, NULL);
|
||||
|
||||
if (ts.buffer) {
|
||||
teletone_destroy_session(&ts);
|
||||
}
|
||||
|
||||
if (dt_buffer) {
|
||||
ftdm_buffer_destroy(&dt_buffer);
|
||||
}
|
||||
|
||||
ftdm_clear_flag(closed_chan, FTDM_CHANNEL_INTHREAD);
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM CHANNEL thread ended.\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Processes EM events coming from ftdmtel/dahdi
|
||||
* \param span Span on which the event was fired
|
||||
* \param event Event to be treated
|
||||
* \return Success or failure
|
||||
*/
|
||||
static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event)
|
||||
{
|
||||
ftdm_sigmsg_t sig;
|
||||
int locked = 0;
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
sig.chan_id = event->channel->chan_id;
|
||||
sig.span_id = event->channel->span_id;
|
||||
sig.channel = event->channel;
|
||||
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n",
|
||||
ftdm_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state));
|
||||
|
||||
ftdm_mutex_lock(event->channel->mutex);
|
||||
locked++;
|
||||
|
||||
switch(event->enum_id) {
|
||||
case FTDM_OOB_ONHOOK:
|
||||
{
|
||||
if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case FTDM_OOB_OFFHOOK:
|
||||
{
|
||||
if (ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD)) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP);
|
||||
} else {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DIALTONE);
|
||||
ftdm_mutex_unlock(event->channel->mutex);
|
||||
locked = 0;
|
||||
ftdm_thread_create_detached(ftdm_analog_em_channel_run, event->channel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FTDM_OOB_WINK:
|
||||
{
|
||||
if (event->channel->state != FTDM_CHANNEL_STATE_DIALING) {
|
||||
ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
ftdm_set_flag_locked(event->channel, FTDM_CHANNEL_WINK);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (locked) {
|
||||
ftdm_mutex_unlock(event->channel->mutex);
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Main thread function for EM span (monitor)
|
||||
* \param me Current thread
|
||||
* \param obj Span to run in this thread
|
||||
*/
|
||||
static void *ftdm_analog_em_run(ftdm_thread_t *me, void *obj)
|
||||
{
|
||||
ftdm_span_t *span = (ftdm_span_t *) obj;
|
||||
ftdm_analog_em_data_t *analog_data = span->signal_data;
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM thread starting.\n");
|
||||
|
||||
while(ftdm_running() && ftdm_test_flag(analog_data, FTDM_ANALOG_EM_RUNNING)) {
|
||||
int waitms = 10;
|
||||
ftdm_status_t status;
|
||||
|
||||
status = ftdm_span_poll_event(span, waitms);
|
||||
|
||||
switch(status) {
|
||||
case FTDM_SUCCESS:
|
||||
{
|
||||
ftdm_event_t *event;
|
||||
while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) {
|
||||
if (event->enum_id == FTDM_OOB_NOOP) {
|
||||
continue;
|
||||
}
|
||||
if (process_event(span, event) != FTDM_SUCCESS) {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FTDM_FAIL:
|
||||
{
|
||||
ftdm_log(FTDM_LOG_ERROR, "Failure Polling event! [%s]\n", span->last_error);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
ftdm_clear_flag(analog_data, FTDM_ANALOG_EM_RUNNING);
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "ANALOG EM thread ending.\n");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief FreeTDM analog EM module initialisation
|
||||
* \return Success
|
||||
*/
|
||||
static FIO_SIG_LOAD_FUNCTION(ftdm_analog_em_init)
|
||||
{
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief FreeTDM analog EM module definition
|
||||
*/
|
||||
EX_DECLARE_DATA ftdm_module_t ftdm_module = {
|
||||
"analog_em",
|
||||
NULL,
|
||||
NULL,
|
||||
ftdm_analog_em_init,
|
||||
ftdm_analog_em_configure_span,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ftmod_analog_em"
|
||||
ProjectGUID="{C539D7C8-26A8-4A94-B938-77672165C130}"
|
||||
RootNamespace="ftmod_analog_em"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftmod_analog_em.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftdm_analog_em.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
96
libs/freetdm/src/ftmod/ftmod_isdn/ftdm_isdn.h
Normal file
96
libs/freetdm/src/ftmod/ftmod_isdn/ftdm_isdn.h
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FTDM_ISDN_H
|
||||
#define FTDM_ISDN_H
|
||||
#include "freetdm.h"
|
||||
|
||||
#define DEFAULT_DIGIT_TIMEOUT 10000 /* default overlap timeout: 10 seconds */
|
||||
|
||||
|
||||
typedef enum {
|
||||
FTDM_ISDN_OPT_NONE = 0,
|
||||
FTDM_ISDN_OPT_SUGGEST_CHANNEL = (1 << 0),
|
||||
FTDM_ISDN_OPT_OMIT_DISPLAY_IE = (1 << 1), /*!< Do not send Caller name in outgoing SETUP message (= Display IE) */
|
||||
FTDM_ISDN_OPT_DISABLE_TONES = (1 << 2), /*!< Disable tone generating thread (NT mode) */
|
||||
|
||||
FTDM_ISDN_OPT_MAX = (2 << 0)
|
||||
} ftdm_isdn_opts_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_ISDN_RUNNING = (1 << 0),
|
||||
FTDM_ISDN_TONES_RUNNING = (1 << 1),
|
||||
FTDM_ISDN_STOP = (1 << 2)
|
||||
} ftdm_isdn_flag_t;
|
||||
|
||||
|
||||
struct ftdm_isdn_data {
|
||||
Q921Data_t q921;
|
||||
Q931_TrunkInfo_t q931;
|
||||
ftdm_channel_t *dchan;
|
||||
ftdm_channel_t *dchans[2];
|
||||
struct ftdm_sigmsg sigmsg;
|
||||
uint32_t flags;
|
||||
int32_t mode;
|
||||
int32_t digit_timeout;
|
||||
ftdm_isdn_opts_t opts;
|
||||
ftdm_caller_data_t *outbound_crv[32768];
|
||||
ftdm_channel_t *channels_local_crv[32768];
|
||||
ftdm_channel_t *channels_remote_crv[32768];
|
||||
};
|
||||
|
||||
typedef struct ftdm_isdn_data ftdm_isdn_data_t;
|
||||
|
||||
|
||||
/* b-channel private data */
|
||||
struct ftdm_isdn_bchan_data
|
||||
{
|
||||
L2ULONG digit_timeout;
|
||||
};
|
||||
|
||||
typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
465
libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2008.vcproj
Normal file
465
libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2008.vcproj
Normal file
@ -0,0 +1,465 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ftmod_isdn"
|
||||
ProjectGUID="{729344A5-D5E9-434D-8EE8-AF8C6C795D15}"
|
||||
RootNamespace="ftmod_isdn"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\isdn\5ESSmes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\5ESSStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\5ESSStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\DMSmes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\DMSStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\DMSStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\EuroISDNStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\EuroISDNStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\mfifo.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\nationalmes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\nationalStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\nationalStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ftmod_isdn.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q921.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931api.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931ie.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931mes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931StateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931StateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q932mes.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\5ESS.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\DMS.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\mfifo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\national.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q921.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q921priv.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q931.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q931ie.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q932.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ftdm_isdn.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
2420
libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c
Normal file
2420
libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c
Normal file
File diff suppressed because it is too large
Load Diff
316
libs/freetdm/src/ftmod/ftmod_isdn/ozmod_isdn.2005.vcproj
Normal file
316
libs/freetdm/src/ftmod/ftmod_isdn/ozmod_isdn.2005.vcproj
Normal file
@ -0,0 +1,316 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ftmod_isdn"
|
||||
ProjectGUID="{729344A5-D5E9-434D-8EE8-AF8C6C795D15}"
|
||||
RootNamespace="ftmod_isdn"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\isdn\5ESSmes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\5ESSStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\5ESSStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\DMSmes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\DMSStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\DMSStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\EuroISDNStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\EuroISDNStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\mfifo.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\nationalmes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\nationalStateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\nationalStateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ftmod_isdn.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q921.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931api.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931ie.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931mes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931StateNT.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q931StateTE.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\Q932mes.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\5ESS.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\DMS.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\mfifo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\national.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q921.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q921priv.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q931.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q931ie.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\isdn\include\Q932.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ftdm_isdn.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1364
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c
Normal file
1364
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c
Normal file
File diff suppressed because it is too large
Load Diff
97
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h
Normal file
97
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FTMOD_LIBPRI_H
|
||||
#define FTMOD_LIBPRI_H
|
||||
#include "freetdm.h"
|
||||
#include "lpwrap_pri.h"
|
||||
|
||||
typedef enum {
|
||||
FTMOD_LIBPRI_OPT_NONE = 0,
|
||||
FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL = (1 << 0),
|
||||
FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE = (1 << 1),
|
||||
FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE = (1 << 2),
|
||||
|
||||
FTMOD_LIBPRI_OPT_MAX = (1 << 3)
|
||||
} ftdm_isdn_opts_t;
|
||||
|
||||
typedef enum {
|
||||
FTMOD_LIBPRI_RUNNING = (1 << 0)
|
||||
} ftdm_isdn_flag_t;
|
||||
|
||||
|
||||
struct ftdm_libpri_data {
|
||||
ftdm_channel_t *dchan;
|
||||
ftdm_channel_t *dchans[2];
|
||||
struct ftdm_sigmsg sigmsg;
|
||||
uint32_t flags;
|
||||
int32_t mode;
|
||||
ftdm_isdn_opts_t opts;
|
||||
|
||||
int node;
|
||||
int pswitch;
|
||||
char *dialplan;
|
||||
unsigned int l1;
|
||||
unsigned int dp;
|
||||
|
||||
int debug;
|
||||
|
||||
lpwrap_pri_t spri;
|
||||
};
|
||||
|
||||
typedef struct ftdm_libpri_data ftdm_libpri_data_t;
|
||||
|
||||
|
||||
/* b-channel private data */
|
||||
struct ftdm_isdn_bchan_data
|
||||
{
|
||||
int32_t digit_timeout;
|
||||
};
|
||||
|
||||
typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
303
libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c
Normal file
303
libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c
Normal file
@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//#define IODEBUG
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "lpwrap_pri.h"
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
|
||||
#ifdef WIN32
|
||||
#include <mmsystem.h>
|
||||
|
||||
static __inline int gettimeofday(struct timeval *tp, void *nothing)
|
||||
{
|
||||
#ifdef WITHOUT_MM_LIB
|
||||
SYSTEMTIME st;
|
||||
time_t tt;
|
||||
struct tm tmtm;
|
||||
/* mktime converts local to UTC */
|
||||
GetLocalTime (&st);
|
||||
tmtm.tm_sec = st.wSecond;
|
||||
tmtm.tm_min = st.wMinute;
|
||||
tmtm.tm_hour = st.wHour;
|
||||
tmtm.tm_mday = st.wDay;
|
||||
tmtm.tm_mon = st.wMonth - 1;
|
||||
tmtm.tm_year = st.wYear - 1900; tmtm.tm_isdst = -1;
|
||||
tt = mktime (&tmtm);
|
||||
tp->tv_sec = tt;
|
||||
tp->tv_usec = st.wMilliseconds * 1000;
|
||||
#else
|
||||
/**
|
||||
** The earlier time calculations using GetLocalTime
|
||||
** had a time resolution of 10ms.The timeGetTime, part
|
||||
** of multimedia apis offer a better time resolution
|
||||
** of 1ms.Need to link against winmm.lib for this
|
||||
**/
|
||||
unsigned long Ticks = 0;
|
||||
unsigned long Sec =0;
|
||||
unsigned long Usec = 0;
|
||||
Ticks = timeGetTime();
|
||||
|
||||
Sec = Ticks/1000;
|
||||
Usec = (Ticks - (Sec*1000))*1000;
|
||||
tp->tv_sec = Sec;
|
||||
tp->tv_usec = Usec;
|
||||
#endif /* WITHOUT_MM_LIB */
|
||||
(void)nothing;
|
||||
return 0;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
#endif /* HAVE_GETTIMEOFDAY */
|
||||
|
||||
static struct lpwrap_pri_event_list LPWRAP_PRI_EVENT_LIST[] = {
|
||||
{0, LPWRAP_PRI_EVENT_ANY, "ANY"},
|
||||
{1, LPWRAP_PRI_EVENT_DCHAN_UP, "DCHAN_UP"},
|
||||
{2, LPWRAP_PRI_EVENT_DCHAN_DOWN, "DCHAN_DOWN"},
|
||||
{3, LPWRAP_PRI_EVENT_RESTART, "RESTART"},
|
||||
{4, LPWRAP_PRI_EVENT_CONFIG_ERR, "CONFIG_ERR"},
|
||||
{5, LPWRAP_PRI_EVENT_RING, "RING"},
|
||||
{6, LPWRAP_PRI_EVENT_HANGUP, "HANGUP"},
|
||||
{7, LPWRAP_PRI_EVENT_RINGING, "RINGING"},
|
||||
{8, LPWRAP_PRI_EVENT_ANSWER, "ANSWER"},
|
||||
{9, LPWRAP_PRI_EVENT_HANGUP_ACK, "HANGUP_ACK"},
|
||||
{10, LPWRAP_PRI_EVENT_RESTART_ACK, "RESTART_ACK"},
|
||||
{11, LPWRAP_PRI_EVENT_FACNAME, "FACNAME"},
|
||||
{12, LPWRAP_PRI_EVENT_INFO_RECEIVED, "INFO_RECEIVED"},
|
||||
{13, LPWRAP_PRI_EVENT_PROCEEDING, "PROCEEDING"},
|
||||
{14, LPWRAP_PRI_EVENT_SETUP_ACK, "SETUP_ACK"},
|
||||
{15, LPWRAP_PRI_EVENT_HANGUP_REQ, "HANGUP_REQ"},
|
||||
{16, LPWRAP_PRI_EVENT_NOTIFY, "NOTIFY"},
|
||||
{17, LPWRAP_PRI_EVENT_PROGRESS, "PROGRESS"},
|
||||
{18, LPWRAP_PRI_EVENT_KEYPAD_DIGIT, "KEYPAD_DIGIT"},
|
||||
{19, LPWRAP_PRI_EVENT_IO_FAIL, "IO_FAIL"},
|
||||
};
|
||||
|
||||
#define LINE "--------------------------------------------------------------------------------"
|
||||
|
||||
const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id)
|
||||
{
|
||||
return LPWRAP_PRI_EVENT_LIST[event_id].name;
|
||||
}
|
||||
|
||||
static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen)
|
||||
{
|
||||
struct lpwrap_pri *spri = (struct lpwrap_pri *) pri_get_userdata(pri);
|
||||
ftdm_size_t len = buflen;
|
||||
int res;
|
||||
ftdm_status_t zst;
|
||||
|
||||
if ((zst = ftdm_channel_read(spri->dchan, buf, &len)) != FTDM_SUCCESS) {
|
||||
if (zst == FTDM_FAIL) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "span %d D-READ FAIL! [%s]\n", spri->span->span_id, spri->dchan->last_error);
|
||||
spri->errs++;
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_CRIT, "span %d D-READ TIMEOUT\n", spri->span->span_id);
|
||||
}
|
||||
|
||||
ftdm_clear_flag(spri, LPWRAP_PRI_READY);
|
||||
return -1;
|
||||
}
|
||||
spri->errs = 0;
|
||||
res = (int)len;
|
||||
memset(&((unsigned char*)buf)[res],0,2);
|
||||
res+=2;
|
||||
|
||||
#ifdef IODEBUG
|
||||
{
|
||||
char bb[2048] = { 0 };
|
||||
|
||||
print_hex_bytes(buf, res - 2, bb, sizeof(bb));
|
||||
ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res-2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int __pri_lpwrap_write(struct pri *pri, void *buf, int buflen)
|
||||
{
|
||||
struct lpwrap_pri *spri = (struct lpwrap_pri *) pri_get_userdata(pri);
|
||||
ftdm_size_t len = buflen -2;
|
||||
|
||||
if (ftdm_channel_write(spri->dchan, buf, buflen, &len) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "span %d D-WRITE FAIL! [%s]\n", spri->span->span_id, spri->dchan->last_error);
|
||||
ftdm_clear_flag(spri, LPWRAP_PRI_READY);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef IODEBUG
|
||||
{
|
||||
char bb[2048] = { 0 };
|
||||
|
||||
print_hex_bytes(buf, buflen - 2, bb, sizeof(bb));
|
||||
ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n", (int)buflen-2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (int) buflen;
|
||||
}
|
||||
|
||||
int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int debug)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
memset(spri, 0, sizeof(struct lpwrap_pri));
|
||||
|
||||
spri->dchan = dchan;
|
||||
spri->span = span;
|
||||
|
||||
if ((spri->pri = pri_new_cb(spri->dchan->sockfd, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))){
|
||||
unsigned char buf[4] = { 0 };
|
||||
size_t buflen = sizeof(buf), len = 0;
|
||||
pri_set_debug(spri->pri, debug);
|
||||
ret = 0;
|
||||
ftdm_set_flag(spri, LPWRAP_PRI_READY);
|
||||
ftdm_channel_write(spri->dchan, buf, buflen, &len);
|
||||
} else {
|
||||
fprintf(stderr, "Unable to create PRI\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int lpwrap_one_loop(struct lpwrap_pri *spri)
|
||||
{
|
||||
fd_set rfds, efds;
|
||||
struct timeval now = {0,0}, *next;
|
||||
pri_event *event;
|
||||
event_handler handler;
|
||||
int sel;
|
||||
|
||||
if (spri->on_loop) {
|
||||
if ((sel = spri->on_loop(spri)) < 0) {
|
||||
return sel;
|
||||
}
|
||||
}
|
||||
|
||||
if (spri->errs >= 2) {
|
||||
spri->errs = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&efds);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//Windows macro for FD_SET includes a warning C4127: conditional expression is constant
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127)
|
||||
#endif
|
||||
|
||||
FD_SET(pri_fd(spri->pri), &rfds);
|
||||
FD_SET(pri_fd(spri->pri), &efds);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
now.tv_sec = 0;
|
||||
now.tv_usec = 100000;
|
||||
|
||||
sel = select(pri_fd(spri->pri) + 1, &rfds, NULL, &efds, &now);
|
||||
|
||||
event = NULL;
|
||||
|
||||
if (!sel) {
|
||||
if ((next = pri_schedule_next(spri->pri))) {
|
||||
gettimeofday(&now, NULL);
|
||||
if (now.tv_sec >= next->tv_sec && (now.tv_usec >= next->tv_usec || next->tv_usec <= 100000)) {
|
||||
//ftdm_log(FTDM_LOG_DEBUG, "Check event\n");
|
||||
event = pri_schedule_run(spri->pri);
|
||||
}
|
||||
}
|
||||
} else if (sel > 0) {
|
||||
event = pri_check_event(spri->pri);
|
||||
}
|
||||
|
||||
if (event) {
|
||||
/* 0 is catchall event handler */
|
||||
if ((handler = spri->eventmap[event->e] ? spri->eventmap[event->e] : spri->eventmap[0] ? spri->eventmap[0] : NULL)) {
|
||||
handler(spri, event->e, event);
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_CRIT, "No event handler found for event %d.\n", event->e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return sel;
|
||||
|
||||
|
||||
if ((handler = spri->eventmap[LPWRAP_PRI_EVENT_IO_FAIL] ? spri->eventmap[LPWRAP_PRI_EVENT_IO_FAIL] : spri->eventmap[0] ? spri->eventmap[0] : NULL)) {
|
||||
handler(spri, LPWRAP_PRI_EVENT_IO_FAIL, NULL);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int lpwrap_run_pri(struct lpwrap_pri *spri)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for (;;){
|
||||
ret = lpwrap_one_loop(spri);
|
||||
|
||||
if (ret < 0) {
|
||||
|
||||
#ifndef WIN32 //This needs to be adressed fror WIN32 still
|
||||
if (errno == EINTR){
|
||||
/* Igonore an interrupted system call */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
ftdm_log(FTDM_LOG_CRIT, "Error = %i [%s]\n", ret, strerror(errno));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
126
libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h
Normal file
126
libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LPWRAP_PRI_H
|
||||
#define _LPWRAP_PRI_H
|
||||
#include <libpri.h>
|
||||
#include <freetdm.h>
|
||||
|
||||
|
||||
#define LPWRAP_MAX_CHAN_PER_SPAN 32
|
||||
|
||||
typedef enum {
|
||||
LPWRAP_PRI_EVENT_ANY = 0,
|
||||
LPWRAP_PRI_EVENT_DCHAN_UP = PRI_EVENT_DCHAN_UP,
|
||||
LPWRAP_PRI_EVENT_DCHAN_DOWN = PRI_EVENT_DCHAN_DOWN,
|
||||
LPWRAP_PRI_EVENT_RESTART = PRI_EVENT_RESTART,
|
||||
LPWRAP_PRI_EVENT_CONFIG_ERR = PRI_EVENT_CONFIG_ERR,
|
||||
LPWRAP_PRI_EVENT_RING = PRI_EVENT_RING,
|
||||
LPWRAP_PRI_EVENT_HANGUP = PRI_EVENT_HANGUP,
|
||||
LPWRAP_PRI_EVENT_RINGING = PRI_EVENT_RINGING,
|
||||
LPWRAP_PRI_EVENT_ANSWER = PRI_EVENT_ANSWER,
|
||||
LPWRAP_PRI_EVENT_HANGUP_ACK = PRI_EVENT_HANGUP_ACK,
|
||||
LPWRAP_PRI_EVENT_RESTART_ACK = PRI_EVENT_RESTART_ACK,
|
||||
LPWRAP_PRI_EVENT_FACNAME = PRI_EVENT_FACNAME,
|
||||
LPWRAP_PRI_EVENT_INFO_RECEIVED = PRI_EVENT_INFO_RECEIVED,
|
||||
LPWRAP_PRI_EVENT_PROCEEDING = PRI_EVENT_PROCEEDING,
|
||||
LPWRAP_PRI_EVENT_SETUP_ACK = PRI_EVENT_SETUP_ACK,
|
||||
LPWRAP_PRI_EVENT_HANGUP_REQ = PRI_EVENT_HANGUP_REQ,
|
||||
LPWRAP_PRI_EVENT_NOTIFY = PRI_EVENT_NOTIFY,
|
||||
LPWRAP_PRI_EVENT_PROGRESS = PRI_EVENT_PROGRESS,
|
||||
LPWRAP_PRI_EVENT_KEYPAD_DIGIT = PRI_EVENT_KEYPAD_DIGIT,
|
||||
LPWRAP_PRI_EVENT_IO_FAIL = 19,
|
||||
|
||||
/* don't touch */
|
||||
LPWRAP_PRI_EVENT_MAX
|
||||
} lpwrap_pri_event_t;
|
||||
|
||||
typedef enum {
|
||||
LPWRAP_PRI_NETWORK = PRI_NETWORK,
|
||||
LPWRAP_PRI_CPE = PRI_CPE
|
||||
} lpwrap_pri_node_t;
|
||||
|
||||
typedef enum {
|
||||
LPWRAP_PRI_SWITCH_UNKNOWN = PRI_SWITCH_UNKNOWN,
|
||||
LPWRAP_PRI_SWITCH_NI2 = PRI_SWITCH_NI2,
|
||||
LPWRAP_PRI_SWITCH_DMS100 = PRI_SWITCH_DMS100,
|
||||
LPWRAP_PRI_SWITCH_LUCENT5E = PRI_SWITCH_LUCENT5E,
|
||||
LPWRAP_PRI_SWITCH_ATT4ESS = PRI_SWITCH_ATT4ESS,
|
||||
LPWRAP_PRI_SWITCH_EUROISDN_E1 = PRI_SWITCH_EUROISDN_E1,
|
||||
LPWRAP_PRI_SWITCH_EUROISDN_T1 = PRI_SWITCH_EUROISDN_T1,
|
||||
LPWRAP_PRI_SWITCH_NI1 = PRI_SWITCH_NI1,
|
||||
LPWRAP_PRI_SWITCH_GR303_EOC = PRI_SWITCH_GR303_EOC,
|
||||
LPWRAP_PRI_SWITCH_GR303_TMC = PRI_SWITCH_GR303_TMC,
|
||||
LPWRAP_PRI_SWITCH_QSIG = PRI_SWITCH_QSIG,
|
||||
|
||||
/* don't touch */
|
||||
LPWRAP_PRI_SWITCH_MAX
|
||||
} lpwrap_pri_switch_t;
|
||||
|
||||
typedef enum {
|
||||
LPWRAP_PRI_READY = (1 << 0)
|
||||
} lpwrap_pri_flag_t;
|
||||
|
||||
struct lpwrap_pri;
|
||||
typedef int (*event_handler)(struct lpwrap_pri *, lpwrap_pri_event_t, pri_event *);
|
||||
typedef int (*loop_handler)(struct lpwrap_pri *);
|
||||
|
||||
struct lpwrap_pri {
|
||||
struct pri *pri;
|
||||
ftdm_span_t *span;
|
||||
ftdm_channel_t *dchan;
|
||||
unsigned int flags;
|
||||
void *private_info;
|
||||
event_handler eventmap[LPWRAP_PRI_EVENT_MAX];
|
||||
loop_handler on_loop;
|
||||
int errs;
|
||||
};
|
||||
|
||||
typedef struct lpwrap_pri lpwrap_pri_t;
|
||||
|
||||
struct lpwrap_pri_event_list {
|
||||
int event_id;
|
||||
int pri_event;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define LPWRAP_MAP_PRI_EVENT(spri, event, func) spri.eventmap[event] = func;
|
||||
|
||||
const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id);
|
||||
int lpwrap_one_loop(struct lpwrap_pri *spri);
|
||||
int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int debug);
|
||||
int lpwrap_run_pri(struct lpwrap_pri *spri);
|
||||
|
||||
#endif
|
132
libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h
Normal file
132
libs/freetdm/src/ftmod/ftmod_pika/ftdm_pika.h
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FTDM_PIKA_H
|
||||
#define FTDM_PIKA_H
|
||||
#include "freetdm.h"
|
||||
#include "pikahmpapi.h"
|
||||
|
||||
|
||||
|
||||
#define PIKA_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type);
|
||||
#define PIKA_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \
|
||||
_TYPE _FUNC1 (const char *name) \
|
||||
{ \
|
||||
int i; \
|
||||
_TYPE t = _MAX ; \
|
||||
\
|
||||
for (i = 0; i < _MAX ; i++) { \
|
||||
if (!strcasecmp(name, _STRINGS[i])) { \
|
||||
t = (_TYPE) i; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return t; \
|
||||
} \
|
||||
const char * _FUNC2 (_TYPE type) \
|
||||
{ \
|
||||
if (type > _MAX) { \
|
||||
type = _MAX; \
|
||||
} \
|
||||
return _STRINGS[(int)type]; \
|
||||
}
|
||||
|
||||
|
||||
typedef enum {
|
||||
PIKA_SPAN_FRAMING_T1_D4,
|
||||
PIKA_SPAN_FRAMING_T1_ESF,
|
||||
PIKA_SPAN_FRAMING_E1_BASIC,
|
||||
PIKA_SPAN_FRAMING_E1_CRC4,
|
||||
PIKA_SPAN_INVALID
|
||||
} PIKA_TSpanFraming;
|
||||
#define PIKA_SPAN_STRINGS "T1_D4", "T1_ESF", "E1_BASIC", "E1_CRC4"
|
||||
PIKA_STR2ENUM_P(pika_str2span, pika_span2str, PIKA_TSpanFraming)
|
||||
|
||||
typedef enum {
|
||||
PIKA_SPAN_ENCODING_T1_AMI_ZS_NONE,
|
||||
PIKA_SPAN_ENCODING_T1_AMI_ZS_GTE,
|
||||
PIKA_SPAN_ENCODING_T1_AMI_ZS_BELL,
|
||||
PIKA_SPAN_ENCODING_T1_AMI_ZS_JAM8,
|
||||
PIKA_SPAN_ENCODING_T1_B8ZS,
|
||||
PIKA_SPAN_ENCODING_E1_AMI,
|
||||
PIKA_SPAN_ENCODING_E1_HDB3,
|
||||
PIKA_SPAN_ENCODING_INVALID
|
||||
} PIKA_TSpanEncoding;
|
||||
#define PIKA_SPAN_ENCODING_STRINGS "T1_AMI_ZS_NONE", "T1_AMI_ZS_GTE", "T1_AMI_ZS_BELL", "T1_AMI_ZS_JAM8", "T1_B8ZS", "E1_AMI", "E1_HDB3"
|
||||
PIKA_STR2ENUM_P(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding)
|
||||
|
||||
typedef enum {
|
||||
PIKA_SPAN_LOOP_LENGTH_SHORT_HAUL,
|
||||
PIKA_SPAN_LOOP_LENGTH_LONG_HAUL,
|
||||
PIKA_SPAN_LOOP_INVALID
|
||||
} PIKA_TSpanLoopLength;
|
||||
#define PIKA_LL_STRINGS "SHORT_HAUL", "LONG_HAUL"
|
||||
PIKA_STR2ENUM_P(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength)
|
||||
|
||||
typedef enum {
|
||||
PIKA_SPAN_LBO_T1_LONG_0_DB,
|
||||
PIKA_SPAN_LBO_T1_LONG_7_DB,
|
||||
PIKA_SPAN_LBO_T1_LONG_15_DB,
|
||||
PIKA_SPAN_LBO_T1_LONG_22_DB,
|
||||
PIKA_SPAN_LBO_T1_SHORT_133_FT,
|
||||
PIKA_SPAN_LBO_T1_SHORT_266_FT,
|
||||
PIKA_SPAN_LBO_T1_SHORT_399_FT,
|
||||
PIKA_SPAN_LBO_T1_SHORT_533_FT,
|
||||
PIKA_SPAN_LBO_T1_SHORT_655_FT,
|
||||
PIKA_SPAN_LBO_E1_WAVEFORM_120_OHM,
|
||||
PIKA_SPAN_LBO_INVALID
|
||||
} PIKA_TSpanBuildOut;
|
||||
#define PIKA_LBO_STRINGS "T1_LONG_0_DB", "T1_LONG_7_DB", "T1_LONG_15_DB", "T1_LONG_22_DB", "T1_SHORT_133_FT", "T1_SHORT_266_FT", "T1_SHORT_399_FT", "T1_SHORT_533_FT", "T1_SHORT_655_FT", "E1_WAVEFORM_120_OHM"
|
||||
PIKA_STR2ENUM_P(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut)
|
||||
|
||||
typedef enum {
|
||||
PIKA_SPAN_COMPAND_MODE_MU_LAW = 1,
|
||||
PIKA_SPAN_COMPAND_MODE_A_LAW,
|
||||
PIKA_SPAN_COMPAND_MODE_INVALID
|
||||
} PIKA_TSpanCompandMode;
|
||||
#define PIKA_SPAN_COMPAND_MODE_STRINGS "MU_LAW", "A_LAW"
|
||||
PIKA_STR2ENUM_P(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode)
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
197
libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2008.vcproj
Normal file
197
libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2008.vcproj
Normal file
@ -0,0 +1,197 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ftmod_pika"
|
||||
ProjectGUID="{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}"
|
||||
RootNamespace="ftmod_pika"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="pikahmpapi.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\pika\aoh\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="pikahmpapi.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\pika\aoh\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ftmod_pika.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ftdm_pika.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1469
libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c
Normal file
1469
libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c
Normal file
File diff suppressed because it is too large
Load Diff
197
libs/freetdm/src/ftmod/ftmod_pika/ozmod_pika.2005.vcproj
Normal file
197
libs/freetdm/src/ftmod/ftmod_pika/ozmod_pika.2005.vcproj
Normal file
@ -0,0 +1,197 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ftmod_pika"
|
||||
ProjectGUID="{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}"
|
||||
RootNamespace="ftmod_pika"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="pikahmpapi.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\..\..\pika\aoh\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="pikahmpapi.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\..\..\pika\aoh\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ftmod_pika.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ftdm_pika.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1363
libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c
Normal file
1363
libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c
Normal file
File diff suppressed because it is too large
Load Diff
20
libs/freetdm/src/ftmod/ftmod_sangoma_boost/BOOST.limitations
Normal file
20
libs/freetdm/src/ftmod/ftmod_sangoma_boost/BOOST.limitations
Normal file
@ -0,0 +1,20 @@
|
||||
== Boost sigmod current limitations ==
|
||||
- we don't support having openzap spans with physical channels
|
||||
belonging to other physical spans. this is due to netborder sangoma abstraction, therefore
|
||||
any openzap span using sigboost must have only channels belonging to the corresponding
|
||||
physical span.
|
||||
|
||||
This is the reason we added group functionality in openzap core, furthermore, previous groups in openzap
|
||||
were only possible through adding of b-channels to a single span, but this forces the user to create groups
|
||||
of channels only whithin the same type of trunk among other things.
|
||||
|
||||
- all spans must be configured and then started, cannot configure, start, configure start etc
|
||||
this is due to netborder telesoft abstraction. that requires configuring everything and
|
||||
then starting everything at once.
|
||||
|
||||
- sangoma_prid and sangoma_brid on Windows had to be compiled hacking make/Makefile.platform to comment all VC runtime checks,
|
||||
otherwise when running in debug mode exceptions are thrown due to loss of data ie short to char conversions.
|
||||
|
||||
== TODO ==
|
||||
- proper upper layer management of HW alarms (this must be done in mod_openzap.c)
|
||||
|
146
libs/freetdm/src/ftmod/ftmod_sangoma_boost/boost-tasks.txt
Normal file
146
libs/freetdm/src/ftmod/ftmod_sangoma_boost/boost-tasks.txt
Normal file
@ -0,0 +1,146 @@
|
||||
== General Design ==
|
||||
|
||||
NBE will do its current loading of spans and configuration process through Sangoma Board Manager (SBM).
|
||||
After doing SangomaBoardManager::getInstance().configure -> start. It will proceed to initalize
|
||||
the openzap stack (just as the TelesoftStack is loaded after starting SMB. The procedure will be:
|
||||
|
||||
- create a static or malloced zap_io_interface_t
|
||||
- call zap_global_set_logger with the logging hooks.
|
||||
- call zap_global_set_memhandler() with the memory hooks.
|
||||
- call zap_global_init() to initialize the stack
|
||||
- call zap_add_io_iface() to add the I/O iface.
|
||||
- iterate over all SBM spans configured for BRI or any boost-managed signaling and:
|
||||
* call zap_span_create(NBE I/O mod, in_ptrSpan, SMB span name)
|
||||
* Fill in some members like:
|
||||
span->trunk_type = E1/T1/J1/FXO/FXS etc ...
|
||||
* iterate over all channels in SMB span and:
|
||||
* zap_span_add_channel(zap_span, sock, type:CAS|BCHAN|DCHAN|ETC)
|
||||
* call zap_configure_span("sangoma_boost", span, sigmsg_callback, "param1", value1, "param2", value1 ...)
|
||||
* zap_span_start(span);
|
||||
|
||||
|
||||
At this point, NBE would receive signaling msgs via sigmsg_callback registered when configuring
|
||||
and NBE would request hangup or making calls throug openzap API, like zap_set_state_* and zap_channel_outgoing_call() to place calls.
|
||||
|
||||
When NBE wants to check for link status.
|
||||
|
||||
zap_get_siglink_state() which would return
|
||||
ZAP_SIG_STATE_UP (D-chan UP, R2 bits in IDLE, ss7?)
|
||||
ZAP_SIG_STATE_SUSPENDED (D-chan in power saving mode?)
|
||||
ZAP_SIG_STATE_DOWN (D-chan down, R2 bits in blocked, ss7?)
|
||||
|
||||
Whenever a state in sig link changes, the sigmsg_callback will be used to notify NBE or any other user.
|
||||
|
||||
NOTE: right now hardware alarms notification in openzap is seriously broken,
|
||||
see ozmod_libpri.c process_event ... reads an event from hardware (zap_event_t *),
|
||||
then checks the event type, if its ZAP_OOB_ALARM_TRAP prepares a zap_sigmsg_t
|
||||
(signaling event) setting its event_id to ZAP_OOB_ALARM_TRAP, which is *WRONG*
|
||||
because event_id is of type zap_signal_event_t and not zap_oob_event_t!
|
||||
this means on alarm the user will get ZAP_SIGEVENT_PROGRESS_MEDIA!! which is
|
||||
value 7 that is in conflict with ZAP_OOB_ALARM_TRAP, I think a separate
|
||||
callback should be used if the outside user wants to be notified about
|
||||
hardware events like HW DTMF or so. Currently there is alreadya generic DTMF
|
||||
listener.
|
||||
|
||||
== Tasks Stage 1 / OpenZAP and Boost changes (To be tested with FreeSWITCH) ==
|
||||
|
||||
- Change malloc and other mem functions in openzap
|
||||
to use internal hooks provided via zap_global_set_memhandler()
|
||||
which would be called before zap_global_init(), this is
|
||||
already done for the logger via zap_global_set_logger()
|
||||
|
||||
question: should the mem routines allow for memory pool ptr?
|
||||
this could be useful to provide a memory pool to
|
||||
the whole module.
|
||||
|
||||
question: should we allow hooks for threads and locking?
|
||||
I think we can skip this one unless needed. They already
|
||||
use their own threading abstraction which is working for
|
||||
Linux and Windows. If we ever need to profile threading
|
||||
we can add profiling hooks.
|
||||
|
||||
question: I had to add openzap calls to the hash table and libteletone implementations, is that acceptable?
|
||||
|
||||
- Modify zap_global_init() API
|
||||
|
||||
This API must just initialize vars, mutexes etc.
|
||||
and NOT DO ANY CONFIGURATION LOADING, PARSING, SPAN CREATION and I/O
|
||||
configuration, which is what is currently doing.
|
||||
We don't want zap_global_init() to create the spans based on that configuration
|
||||
since NBE will have its own configuration and will take care of creating
|
||||
the needed data structures on its own.
|
||||
|
||||
- Add new zap_std_io_config() API
|
||||
|
||||
This API will parse the standard openzap.conf module and create the spans.
|
||||
This will be used by FS but not by NBE, which will create the openzap spans by itself.
|
||||
The NBE flow to initialize openzap will be:
|
||||
|
||||
- Add new API zap_global_add_io_iface(),
|
||||
|
||||
This API will add a new I/O interface structure to the internal openzap hash of I/O structs.
|
||||
This is needed because NBE I/O structure will NOT be loaded from an openzap module (.so/.dll)
|
||||
but rather just registered on runtime (probably from a static structure in NBE code).
|
||||
This openzap hash is used by zap_api_execute() for example, to find the module that can
|
||||
handle a given API, ie (oz libpri status). This is an example of how an openzap I/O interface
|
||||
can decide to implement just the ->api() member to handle commands and NOTHING else,
|
||||
so I/O interfaces not necessary are hardware-related.
|
||||
|
||||
- Add new zap_channel_get_siglink_state(zap_channel, zap_siglink_status_t &status)
|
||||
|
||||
- Modify mod_openzap.c to read proto= setting in boost spans, this will determine wich boost sig
|
||||
module will handle the configuration and those channels.
|
||||
|
||||
<boost_spans> <span sigmod="bri|ss7|blah"> <param="proto-specific-setting" value="setting"> </span> </boost_spans>
|
||||
|
||||
Then as first config arg to zap_config_span() the boost proto module name would be included as "sigmod" which will be used
|
||||
by ozmod_sangoma_boost to decide which sig module must handle that span configuration
|
||||
|
||||
- Create minimal boost mod interface.
|
||||
|
||||
ozmod_boost_ss7 should load sig boost mods and get interface via dlsym(boost_get_interface) boost_get_interface(boost_iface);
|
||||
The boost interface will have
|
||||
* const char *name // boost sigmod name (brid,ss7d)
|
||||
* set_write_boost_msg_cb(callback) // tell the stack how to send us boost messages
|
||||
* set_sig_status_cb(callback); // tell the stack how to notify us about link status changes
|
||||
* write_boost_msg(struct boost_msg) // send a boost msg to the stack
|
||||
* configure_span(zap_span_t span, "configuration", value, "configuration", value) // configure a given span
|
||||
* get_sig_status(openzap_sigstatus_t status)
|
||||
* start(span) // to start a given openzap span
|
||||
* stop(span) // to stop the stack on a given openzap span
|
||||
|
||||
- Migrate current sangoma_brid sig module to openzap
|
||||
* Make sangoma_brid a library
|
||||
* Move from using malloc, threading, locking, logging and I/O to openzap functions. Export the boost sigmod interface and its supporting code.
|
||||
|
||||
== State 2 Tasks ==
|
||||
|
||||
- Create the I/O NBE interface and supporting functions. It must be possible to poll over the span
|
||||
given that ozmod_sangoma_boost BRI module and others may need to *wait* for data. The poll()
|
||||
function in I/O NBE interface would wait on a pthread condition or Windows event, which would
|
||||
be triggered by some external NBE component registered with Sangoma Board Manager (SMB) for d-chan
|
||||
data, whenever d-chan data arrives, saves the data in a buffer and triggers the condition to wakeup
|
||||
any waiter, then the waiter (sangoma_brid or any other boost client) calls zap_channel_read which calls
|
||||
our own I/O NBE interface read method and retrieves the data from the buffer.
|
||||
|
||||
Dropped alternative design:
|
||||
Another option is to add a new API zap_span_push_incoming_data(span/chan, data); However this changes
|
||||
the model openzap has followed and I don't think fits that well, since now we have 2 different models
|
||||
to support in openzap.
|
||||
|
||||
== TODO ==
|
||||
|
||||
- how about logging specific modules, like, just ozmod_boost, or just the BRI stack?
|
||||
more work to be done so the BRI module uses zap_log instead of current syslog
|
||||
then work to be done to be able to filter logs from specific openzap code? is it worth it?
|
||||
|
||||
- remove FORCE_SEGFAULT from sprid
|
||||
|
||||
|
||||
=== Shortcomings ==
|
||||
|
||||
- we had to drop smg support in the branch where we work on sangoma prid.
|
||||
After all, most people using sangoma_prid is using freeswitch/openzap and not Sangoma Media Gateway
|
||||
The problem is in freeswitch/openzap mode, sangoma_boost ozmod takes care of span events (POLLPRI)
|
||||
where in SMG and Netborder POLLPRI is done typically by sangoma board manager.
|
||||
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FTDM_SANGOMA_BOOST_H
|
||||
#define FTDM_SANGOMA_BOOST_H
|
||||
#include "sangoma_boost_client.h"
|
||||
#include "freetdm.h"
|
||||
|
||||
#define MAX_CHANS_PER_TRUNKGROUP 1024
|
||||
|
||||
typedef enum {
|
||||
FTDM_SANGOMA_BOOST_RUNNING = (1 << 0),
|
||||
FTDM_SANGOMA_BOOST_RESTARTING = (1 << 1)
|
||||
} ftdm_sangoma_boost_flag_t;
|
||||
|
||||
typedef struct ftdm_sangoma_boost_data {
|
||||
sangomabc_connection_t mcon;
|
||||
sangomabc_connection_t pcon;
|
||||
int iteration;
|
||||
uint32_t flags;
|
||||
boost_sigmod_interface_t *sigmod;
|
||||
ftdm_queue_t *boost_queue;
|
||||
} ftdm_sangoma_boost_data_t;
|
||||
|
||||
typedef struct ftdm_sangoma_boost_trunkgroup {
|
||||
ftdm_mutex_t *mutex;
|
||||
ftdm_size_t size; /* Number of b-channels in group */
|
||||
unsigned int last_used_index; /* index of last b-channel used */
|
||||
ftdm_channel_t* ftdmchans[MAX_CHANS_PER_TRUNKGROUP];
|
||||
//DAVIDY need to merge congestion timeouts to this struct
|
||||
} ftdm_sangoma_boost_trunkgroup_t;
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
@ -0,0 +1,215 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ftmod_sangoma_boost"
|
||||
ProjectGUID="{D021EF2A-460D-4827-A0F7-41FDECF46F1B}"
|
||||
RootNamespace="ftmod_sangoma_boost"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\isdn\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="ftmod_sangoma_boost.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sangoma_boost_client.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="sangoma_boost_client.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sangoma_boost_interface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="sigboost.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ftdm_sangoma_boost.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
2273
libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c
Normal file
2273
libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,575 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "sangoma_boost_client.h"
|
||||
|
||||
#ifndef HAVE_GETHOSTBYNAME_R
|
||||
extern int gethostbyname_r (const char *__name,
|
||||
struct hostent *__result_buf,
|
||||
char *__buf, size_t __buflen,
|
||||
struct hostent **__result,
|
||||
int *__h_errnop);
|
||||
#endif
|
||||
|
||||
struct sangomabc_map {
|
||||
uint32_t event_id;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
static struct sangomabc_map sangomabc_table[] = {
|
||||
{SIGBOOST_EVENT_CALL_START, "CALL_START"},
|
||||
{SIGBOOST_EVENT_CALL_START_ACK, "CALL_START_ACK"},
|
||||
{SIGBOOST_EVENT_CALL_START_NACK, "CALL_START_NACK"},
|
||||
{SIGBOOST_EVENT_CALL_PROGRESS, "CALL PROGRESS"},
|
||||
{SIGBOOST_EVENT_CALL_START_NACK_ACK, "CALL_START_NACK_ACK"},
|
||||
{SIGBOOST_EVENT_CALL_ANSWERED, "CALL_ANSWERED"},
|
||||
{SIGBOOST_EVENT_CALL_STOPPED, "CALL_STOPPED"},
|
||||
{SIGBOOST_EVENT_CALL_STOPPED_ACK, "CALL_STOPPED_ACK"},
|
||||
{SIGBOOST_EVENT_CALL_RELEASED, "CALL_RELEASED"},
|
||||
{SIGBOOST_EVENT_SYSTEM_RESTART, "SYSTEM_RESTART"},
|
||||
{SIGBOOST_EVENT_SYSTEM_RESTART_ACK, "SYSTEM_RESTART_ACK"},
|
||||
{SIGBOOST_EVENT_HEARTBEAT, "HEARTBEAT"},
|
||||
{SIGBOOST_EVENT_INSERT_CHECK_LOOP, "LOOP START"},
|
||||
{SIGBOOST_EVENT_REMOVE_CHECK_LOOP, "LOOP STOP"},
|
||||
{SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE, "AUTO_CALL_GAP_ABATE"},
|
||||
{SIGBOOST_EVENT_DIGIT_IN, "DIGIT_IN"}
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void sangomabc_print_event_call(sangomabc_connection_t *mcon, sangomabc_event_t *event, int priority, int dir, const char *file, const char *func, int line)
|
||||
{
|
||||
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
|
||||
return;
|
||||
|
||||
ftdm_log(file, func, line, FTDM_LOG_LEVEL_DEBUG, "%s EVENT (%s): %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s] Rdnis=[%s]\n",
|
||||
dir ? "TX":"RX",
|
||||
priority ? "P":"N",
|
||||
sangomabc_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
event->span,
|
||||
event->chan,
|
||||
event->call_setup_id,
|
||||
event->fseqno,
|
||||
strlen(event->calling_name)?event->calling_name:"N/A",
|
||||
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
|
||||
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"),
|
||||
event->isup_in_rdnis);
|
||||
|
||||
}
|
||||
static void sangomabc_print_event_short(sangomabc_connection_t *mcon, sangomabc_short_event_t *event, int priority, int dir, const char *file, const char *func, int line)
|
||||
{
|
||||
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
|
||||
return;
|
||||
ftdm_log(file, func, line, FTDM_LOG_LEVEL_DEBUG, "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n",
|
||||
dir ? "TX":"RX",
|
||||
priority ? "P":"N",
|
||||
sangomabc_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
event->span,
|
||||
event->chan,
|
||||
event->release_cause,
|
||||
event->call_setup_id,
|
||||
event->fseqno);
|
||||
}
|
||||
|
||||
|
||||
static int create_conn_socket(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
|
||||
{
|
||||
#ifndef WIN32
|
||||
int rc;
|
||||
struct hostent *result, *local_result;
|
||||
char buf[512], local_buf[512];
|
||||
int err = 0, local_err = 0;
|
||||
|
||||
if (mcon->sigmod) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "I should not be called on a sigmod-managed connection!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&mcon->remote_hp, 0, sizeof(mcon->remote_hp));
|
||||
memset(&mcon->local_hp, 0, sizeof(mcon->local_hp));
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Creating SCTP socket L=%s:%d R=%s:%d\n",
|
||||
local_ip, local_port, ip, port);
|
||||
mcon->socket = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
|
||||
#else
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Creating UDP socket L=%s:%d R=%s:%d\n",
|
||||
local_ip, local_port, ip, port);
|
||||
mcon->socket = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
|
||||
if (mcon->socket >= 0) {
|
||||
int flag;
|
||||
|
||||
flag = 1;
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_FIVE
|
||||
gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &err);
|
||||
gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_err);
|
||||
if (!err && !local_err) {
|
||||
#else
|
||||
gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &result, &err);
|
||||
gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_result, &local_err);
|
||||
if (result && local_result) {
|
||||
#endif
|
||||
mcon->remote_addr.sin_family = mcon->remote_hp.h_addrtype;
|
||||
memcpy((char *) &mcon->remote_addr.sin_addr.s_addr, mcon->remote_hp.h_addr_list[0], mcon->remote_hp.h_length);
|
||||
mcon->remote_addr.sin_port = htons(port);
|
||||
|
||||
mcon->local_addr.sin_family = mcon->local_hp.h_addrtype;
|
||||
memcpy((char *) &mcon->local_addr.sin_addr.s_addr, mcon->local_hp.h_addr_list[0], mcon->local_hp.h_length);
|
||||
mcon->local_addr.sin_port = htons(local_port);
|
||||
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
setsockopt(mcon->socket, IPPROTO_SCTP, SCTP_NODELAY,
|
||||
(char *)&flag, sizeof(int));
|
||||
#endif
|
||||
|
||||
if ((rc = bind(mcon->socket,
|
||||
(struct sockaddr *) &mcon->local_addr,
|
||||
sizeof(mcon->local_addr))) < 0) {
|
||||
close(mcon->socket);
|
||||
mcon->socket = -1;
|
||||
} else {
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
rc=listen(mcon->socket, 100);
|
||||
if (rc) {
|
||||
close(mcon->socket);
|
||||
mcon->socket = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mcon->socket;
|
||||
#else
|
||||
return 0;
|
||||
#endif // ifndef WIN32
|
||||
}
|
||||
|
||||
int sangomabc_connection_close(sangomabc_connection_t *mcon)
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (mcon->sigmod) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "I should not be called on a sigmod-managed connection!\n");
|
||||
return 0;
|
||||
}
|
||||
if (mcon->socket > -1) {
|
||||
close(mcon->socket);
|
||||
}
|
||||
|
||||
if (mcon->mutex) {
|
||||
ftdm_mutex_lock(mcon->mutex);
|
||||
ftdm_mutex_unlock(mcon->mutex);
|
||||
ftdm_mutex_destroy(&mcon->mutex);
|
||||
}
|
||||
memset(mcon, 0, sizeof(*mcon));
|
||||
mcon->socket = -1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangomabc_connection_open(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
|
||||
{
|
||||
ftdm_mutex_create(&mcon->mutex);
|
||||
if (mcon->sigmod) {
|
||||
/*value of mcon->socket will be ignored in sigmod mode */
|
||||
return 0;
|
||||
}
|
||||
#ifndef WIN32
|
||||
create_conn_socket(mcon, local_ip, local_port, ip, port);
|
||||
return mcon->socket;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int sangomabc_exec_command(sangomabc_connection_t *mcon, int span, int chan, int id, int cmd, int cause, int flags)
|
||||
{
|
||||
sangomabc_short_event_t oevent;
|
||||
int retry = 5;
|
||||
|
||||
sangomabc_event_init(&oevent, cmd, chan, span);
|
||||
oevent.release_cause = (uint8_t)cause;
|
||||
oevent.flags = flags;
|
||||
|
||||
if (cmd == SIGBOOST_EVENT_SYSTEM_RESTART || cmd == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) {
|
||||
mcon->rxseq_reset = 1;
|
||||
mcon->txseq = 0;
|
||||
mcon->rxseq = 0;
|
||||
mcon->txwindow = 0;
|
||||
}
|
||||
|
||||
if (id >= 0) {
|
||||
oevent.call_setup_id = (uint16_t)id;
|
||||
}
|
||||
|
||||
while (sangomabc_connection_write(mcon, (sangomabc_event_t*)&oevent) <= 0) {
|
||||
if (--retry <= 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Failed to tx on boost socket: %s\n", strerror(errno));
|
||||
return -1;
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_WARNING, "Failed to tx on boost socket: %s :retry %i\n", strerror(errno), retry);
|
||||
ftdm_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int sangomabc_exec_commandp(sangomabc_connection_t *pcon, int span, int chan, int id, int cmd, int cause)
|
||||
{
|
||||
sangomabc_short_event_t oevent;
|
||||
int retry = 5;
|
||||
|
||||
sangomabc_event_init(&oevent, cmd, chan, span);
|
||||
oevent.release_cause = (uint8_t)cause;
|
||||
|
||||
if (id >= 0) {
|
||||
oevent.call_setup_id = (uint16_t)id;
|
||||
}
|
||||
|
||||
while (sangomabc_connection_writep(pcon, (sangomabc_event_t*)&oevent) <= 0) {
|
||||
if (--retry <= 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Failed to tx on boost socket: %s\n", strerror(errno));
|
||||
return -1;
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_WARNING, "Failed to tx on boost socket: %s :retry %i\n", strerror(errno), retry);
|
||||
ftdm_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
|
||||
{
|
||||
#ifndef WIN32
|
||||
unsigned int fromlen = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
int bytes = 0;
|
||||
int msg_ok = 0;
|
||||
sangomabc_queue_element_t *e = NULL;
|
||||
|
||||
if (mcon->sigmod) {
|
||||
e = ftdm_queue_dequeue(mcon->boost_queue);
|
||||
if (e) {
|
||||
bytes = e->size;
|
||||
memcpy(&mcon->event, e->boostmsg, bytes);
|
||||
ftdm_safe_free(e);
|
||||
}
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT,
|
||||
(struct sockaddr *) &mcon->local_addr, &fromlen);
|
||||
}
|
||||
#endif
|
||||
if (bytes <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mcon->event.version != SIGBOOST_VERSION) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Invalid Boost Version %i Expecting %i\n",mcon->event.version, SIGBOOST_VERSION);
|
||||
}
|
||||
|
||||
if ((bytes >= MIN_SIZE_CALLSTART_MSG) && boost_full_event(mcon->event.event_id)) {
|
||||
msg_ok=1;
|
||||
|
||||
} else if (bytes == sizeof(sangomabc_short_event_t)) {
|
||||
msg_ok=1;
|
||||
|
||||
} else {
|
||||
msg_ok=0;
|
||||
}
|
||||
|
||||
if (msg_ok) {
|
||||
if (sangomabc_test_flag(mcon, MSU_FLAG_DOWN)) {
|
||||
if (mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART &&
|
||||
mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK &&
|
||||
mcon->event.event_id != SIGBOOST_EVENT_HEARTBEAT) {
|
||||
ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Not reading packets when connection is down. [%s]\n",
|
||||
sangomabc_event_id_name(mcon->event.event_id));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (boost_full_event(mcon->event.event_id)) {
|
||||
sangomabc_print_event_call(mcon, &mcon->event, 0, 0, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)&mcon->event, 0, 0, file, func, line);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* NC: NOT USED ANY MORE */
|
||||
if (mcon->rxseq_reset) {
|
||||
//if (mcon->event.event_id == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Rx sync ok\n");
|
||||
mcon->rxseq = mcon->event.fseqno;
|
||||
return &mcon->event;
|
||||
//}
|
||||
errno=EAGAIN;
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Waiting for rx sync...\n");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
mcon->txwindow = mcon->txseq - mcon->event.bseqno;
|
||||
mcon->rxseq++;
|
||||
|
||||
#if 0
|
||||
if (mcon->rxseq != mcon->event.fseqno) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Invalid Sequence Number Expect=%i Rx=%i\n", mcon->rxseq, mcon->event.fseqno);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return &mcon->event;
|
||||
} else {
|
||||
if (iteration == 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "NC - Invalid Event length from boost rxlen=%i evsz=%i\n", bytes, sizeof(mcon->event));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sangomabc_event_t *__sangomabc_connection_readp(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line)
|
||||
{
|
||||
#ifndef WIN32
|
||||
unsigned int fromlen = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
int bytes = 0;
|
||||
|
||||
if (mcon->sigmod) {
|
||||
/* priority stuff is handled just the same when there is a sigmod */
|
||||
return sangomabc_connection_read(mcon, iteration);
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, (struct sockaddr *) &mcon->local_addr, &fromlen);
|
||||
}
|
||||
#endif
|
||||
if (bytes <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mcon->event.version != SIGBOOST_VERSION) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Invalid Boost Version %i Expecting %i\n",mcon->event.version, SIGBOOST_VERSION);
|
||||
}
|
||||
|
||||
if (bytes == sizeof(sangomabc_short_event_t)) {
|
||||
|
||||
if (boost_full_event(mcon->event.event_id)) {
|
||||
sangomabc_print_event_call(mcon, &mcon->event, 1, 0, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)&mcon->event, 1, 0, file, func, line);
|
||||
}
|
||||
|
||||
return &mcon->event;
|
||||
} else {
|
||||
if (iteration == 0) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Critical Error: PQ Invalid Event lenght from boost rxlen=%i evsz=%i\n", bytes, sizeof(mcon->event));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int __sangomabc_connection_write(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line)
|
||||
{
|
||||
int err = 0;
|
||||
int event_size=MIN_SIZE_CALLSTART_MSG+event->isup_in_rdnis_size;
|
||||
|
||||
ftdm_assert_return(event != NULL, -1, "No event!");
|
||||
ftdm_assert_return(mcon->socket >= 0, -1, "No mcon->socket!");
|
||||
ftdm_assert_return(mcon->mutex != NULL, -1, "No mcon->mutex!");
|
||||
|
||||
ftdm_assert_return(event->span <= FTDM_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN, -1, "Invalid span when writing boost event\n");
|
||||
ftdm_assert_return(event->chan <= FTDM_MAX_CHANNELS_PHYSICAL_SPAN, -1, "Invalid chan when writing boost event\n");
|
||||
|
||||
if (!boost_full_event(event->event_id)) {
|
||||
event_size=sizeof(sangomabc_short_event_t);
|
||||
}
|
||||
|
||||
if (sangomabc_test_flag(mcon, MSU_FLAG_DOWN)) {
|
||||
if (event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART &&
|
||||
event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK &&
|
||||
event->event_id != SIGBOOST_EVENT_HEARTBEAT) {
|
||||
ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Not writing packets when connection is down. [%s]\n",
|
||||
sangomabc_event_id_name(event->event_id));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ftdm_mutex_lock(mcon->mutex);
|
||||
if (event->event_id == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) {
|
||||
mcon->txseq=0;
|
||||
mcon->rxseq=0;
|
||||
event->fseqno=0;
|
||||
} else {
|
||||
event->fseqno = mcon->txseq++;
|
||||
}
|
||||
event->bseqno = mcon->rxseq;
|
||||
event->version = SIGBOOST_VERSION;
|
||||
|
||||
if (boost_full_event(event->event_id)) {
|
||||
sangomabc_print_event_call(mcon, event, 0, 1, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)event, 0, 1, file, func, line);
|
||||
}
|
||||
|
||||
if (mcon->sigmod) {
|
||||
mcon->sigmod->write_msg(mcon->span, event, event_size);
|
||||
err = event_size;
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
err = sendto(mcon->socket, event, event_size, 0, (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
ftdm_mutex_unlock(mcon->mutex);
|
||||
|
||||
ftdm_assert_return(err == event_size, -1, "Failed to send the boost message completely!");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int __sangomabc_connection_writep(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line)
|
||||
{
|
||||
int err = 0;
|
||||
int event_size=sizeof(sangomabc_event_t);
|
||||
|
||||
if (!mcon->sigmod) {
|
||||
ftdm_assert_return(event != NULL, -1, "No event!");
|
||||
ftdm_assert_return(mcon->socket >= 0, -1, "No mcon->socket!");
|
||||
ftdm_assert_return(mcon->mutex != NULL, -1, "No mcon->mutex!");
|
||||
}
|
||||
|
||||
if (!boost_full_event(event->event_id)) {
|
||||
event_size=sizeof(sangomabc_short_event_t);
|
||||
}
|
||||
|
||||
ftdm_mutex_lock(mcon->mutex);
|
||||
event->version = SIGBOOST_VERSION;
|
||||
if (mcon->sigmod) {
|
||||
mcon->sigmod->write_msg(mcon->span, event, event_size);
|
||||
err = event_size;
|
||||
|
||||
}
|
||||
#ifndef WIN32
|
||||
else {
|
||||
err = sendto(mcon->socket, event, event_size, 0, (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr));
|
||||
}
|
||||
#endif
|
||||
ftdm_mutex_unlock(mcon->mutex);
|
||||
|
||||
ftdm_assert_return(err == event_size, -1, "Failed to send boost message completely!");
|
||||
|
||||
if (boost_full_event(event->event_id)) {
|
||||
sangomabc_print_event_call(mcon, event, 1, 1, file, func, line);
|
||||
} else {
|
||||
sangomabc_print_event_short(mcon, (sangomabc_short_event_t*)event, 1, 1, file, func, line);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
void sangomabc_call_init(sangomabc_event_t *event, const char *calling, const char *called, int setup_id)
|
||||
{
|
||||
memset(event, 0, sizeof(sangomabc_event_t));
|
||||
event->event_id = SIGBOOST_EVENT_CALL_START;
|
||||
|
||||
if (calling) {
|
||||
strncpy((char*)event->calling_number_digits, calling, sizeof(event->calling_number_digits)-1);
|
||||
event->calling_number_digits_count = (uint8_t)strlen(calling);
|
||||
}
|
||||
|
||||
if (called) {
|
||||
strncpy((char*)event->called_number_digits, called, sizeof(event->called_number_digits)-1);
|
||||
event->called_number_digits_count = (uint8_t)strlen(called);
|
||||
}
|
||||
|
||||
event->call_setup_id = (uint16_t)setup_id;
|
||||
|
||||
}
|
||||
|
||||
void sangomabc_event_init(sangomabc_short_event_t *event, sangomabc_event_id_t event_id, int chan, int span)
|
||||
{
|
||||
memset(event, 0, sizeof(sangomabc_short_event_t));
|
||||
event->event_id = event_id;
|
||||
event->chan = (uint8_t)chan;
|
||||
event->span = (uint8_t)span;
|
||||
}
|
||||
|
||||
const char *sangomabc_event_id_name(uint32_t event_id)
|
||||
{
|
||||
unsigned int x;
|
||||
const char *ret = NULL;
|
||||
|
||||
for (x = 0 ; x < sizeof(sangomabc_table)/sizeof(struct sangomabc_map); x++) {
|
||||
if (sangomabc_table[x].event_id == event_id) {
|
||||
ret = sangomabc_table[x].name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SANGOMABC_H
|
||||
#define _SANGOMABC_H
|
||||
|
||||
#include "sangoma_boost_interface.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
#include <netinet/sctp.h>
|
||||
#endif
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include "sigboost.h"
|
||||
|
||||
#define sangomabc_test_flag(p,flag) ((p)->flags & (flag))
|
||||
|
||||
#define sangomabc_set_flag(p,flag) do { \
|
||||
((p)->flags |= (flag)); \
|
||||
} while (0)
|
||||
|
||||
#define sangomabc_clear_flag(p,flag) do { \
|
||||
((p)->flags &= ~(flag)); \
|
||||
} while (0)
|
||||
|
||||
#define sangomabc_copy_flags(dest,src,flagz) do { \
|
||||
(dest)->flags &= ~(flagz); \
|
||||
(dest)->flags |= ((src)->flags & (flagz)); \
|
||||
} while (0)
|
||||
|
||||
typedef t_sigboost_callstart sangomabc_event_t;
|
||||
typedef t_sigboost_short sangomabc_short_event_t;
|
||||
typedef uint32_t sangomabc_event_id_t;
|
||||
|
||||
typedef struct sangomabc_ip_cfg
|
||||
{
|
||||
char local_ip[25];
|
||||
int local_port;
|
||||
char remote_ip[25];
|
||||
int remote_port;
|
||||
}sangomabc_ip_cfg_t;
|
||||
|
||||
typedef enum {
|
||||
MSU_FLAG_EVENT = (1 << 0),
|
||||
MSU_FLAG_DOWN = (1 << 1)
|
||||
} sangomabc_flag_t;
|
||||
|
||||
|
||||
struct sangomabc_connection {
|
||||
ftdm_socket_t socket;
|
||||
struct sockaddr_in local_addr;
|
||||
struct sockaddr_in remote_addr;
|
||||
sangomabc_event_t event;
|
||||
struct hostent remote_hp;
|
||||
struct hostent local_hp;
|
||||
unsigned int flags;
|
||||
ftdm_mutex_t *mutex;
|
||||
FILE *log;
|
||||
unsigned int txseq;
|
||||
unsigned int rxseq;
|
||||
unsigned int txwindow;
|
||||
unsigned int rxseq_reset;
|
||||
sangomabc_ip_cfg_t cfg;
|
||||
/* boost signaling mod interface pointer (if not working in TCP mode) */
|
||||
boost_sigmod_interface_t *sigmod;
|
||||
ftdm_queue_t *boost_queue;
|
||||
ftdm_interrupt_t *sock_interrupt;
|
||||
ftdm_span_t *span;
|
||||
};
|
||||
|
||||
typedef struct sangomabc_connection sangomabc_connection_t;
|
||||
|
||||
typedef struct sangomabc_queue_element {
|
||||
unsigned char boostmsg[sizeof(sangomabc_event_t)];
|
||||
ftdm_size_t size;
|
||||
} sangomabc_queue_element_t;
|
||||
|
||||
/* disable nagle's algorythm */
|
||||
static __inline__ void sctp_no_nagle(int socket)
|
||||
{
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
int flag = 1;
|
||||
setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY, (char *) &flag, sizeof(int));
|
||||
#endif
|
||||
}
|
||||
|
||||
int sangomabc_connection_close(sangomabc_connection_t *mcon);
|
||||
int sangomabc_connection_open(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
|
||||
sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
|
||||
sangomabc_event_t *__sangomabc_connection_readp(sangomabc_connection_t *mcon, int iteration, const char *file, const char *func, int line);
|
||||
int __sangomabc_connection_write(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line);
|
||||
int __sangomabc_connection_writep(sangomabc_connection_t *mcon, sangomabc_event_t *event, const char *file, const char *func, int line);
|
||||
#define sangomabc_connection_write(_m,_e) __sangomabc_connection_write(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
#define sangomabc_connection_writep(_m,_e) __sangomabc_connection_writep(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
#define sangomabc_connection_read(_m,_e) __sangomabc_connection_read(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
#define sangomabc_connection_readp(_m,_e) __sangomabc_connection_readp(_m, _e, __FILE__, __FUNCTION__, __LINE__)
|
||||
void sangomabc_event_init(sangomabc_short_event_t *event, sangomabc_event_id_t event_id, int chan, int span);
|
||||
void sangomabc_call_init(sangomabc_event_t *event, const char *calling, const char *called, int setup_id);
|
||||
const char *sangomabc_event_id_name(uint32_t event_id);
|
||||
int sangomabc_exec_command(sangomabc_connection_t *mcon, int span, int chan, int id, int cmd, int cause, int flags);
|
||||
int sangomabc_exec_commandp(sangomabc_connection_t *pcon, int span, int chan, int id, int cmd, int cause);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Sangoma Technologies
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SANGOMA_BOOST_INTERFACE_H
|
||||
#define SANGOMA_BOOST_INTERFACE_H
|
||||
|
||||
#include "freetdm.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief Callback used to notify signaling status changes on a channel
|
||||
\param ftdmchan The freetdm channel where the signaling status just changed
|
||||
\param status The new signaling status
|
||||
*/
|
||||
#define BOOST_SIG_STATUS_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status)
|
||||
typedef void (*boost_sig_status_cb_func_t) BOOST_SIG_STATUS_CB_ARGS;
|
||||
#define BOOST_SIG_STATUS_CB_FUNCTION(name) void name BOOST_SIG_STATUS_CB_ARGS
|
||||
|
||||
/*!
|
||||
\brief Write a boost msg to a boost endpoint
|
||||
\param span The freetdm span where this msg was generated
|
||||
\param msg The generic message pointer, owned by the caller
|
||||
\param msglen The length of the provided structure pointed by msg
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
|
||||
The msg buffer is owned by the caller and it should
|
||||
be either t_sigboost_callstart or t_sigboost_short
|
||||
the endpoint receiving the msg will first cast to
|
||||
t_sigboost_short, check the event type, and if needed.
|
||||
*/
|
||||
#define BOOST_WRITE_MSG_ARGS (ftdm_span_t *span, void *msg, ftdm_size_t msglen)
|
||||
typedef ftdm_status_t (*boost_write_msg_func_t) BOOST_WRITE_MSG_ARGS;
|
||||
#define BOOST_WRITE_MSG_FUNCTION(name) ftdm_status_t name BOOST_WRITE_MSG_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set the callback to be used by a signaling module to write boost messages
|
||||
\param callback The callback to be used by the signaling module
|
||||
|
||||
The provided callback will be used for the signaling boost module to notify the
|
||||
user with boost messages.
|
||||
*/
|
||||
#define BOOST_SET_WRITE_MSG_CB_ARGS (boost_write_msg_func_t callback)
|
||||
typedef void (*boost_set_write_msg_cb_func_t) BOOST_SET_WRITE_MSG_CB_ARGS;
|
||||
#define BOOST_SET_WRITE_MSG_CB_FUNCTION(name) void name BOOST_SET_WRITE_MSG_CB_ARGS
|
||||
|
||||
/*!
|
||||
\brief Notify hardware status change
|
||||
\param ftdmchan The freetdm channel
|
||||
\param status The hw status
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_ON_HW_LINK_STATUS_CHANGE_ARGS (ftdm_channel_t *ftdmchan, ftdm_channel_hw_link_status_t status)
|
||||
typedef void (*boost_on_hw_link_status_change_func_t) BOOST_ON_HW_LINK_STATUS_CHANGE_ARGS;
|
||||
#define BOOST_ON_HW_LINK_STATUS_CHANGE_FUNCTION(name) void name BOOST_ON_HW_LINK_STATUS_CHANGE_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set signaling status callback used by the signaling module to report signaling status changes
|
||||
\param callback The callback to be used by the signaling module
|
||||
|
||||
The provided callback will be used for the signaling boost module to notify the
|
||||
user with signaling link status changes.
|
||||
*/
|
||||
#define BOOST_SET_SIG_STATUS_CB_ARGS (boost_sig_status_cb_func_t callback)
|
||||
typedef void (*boost_set_sig_status_cb_func_t) BOOST_SET_SIG_STATUS_CB_ARGS;
|
||||
#define BOOST_SET_SIG_STATUS_CB_FUNCTION(name) void name BOOST_SET_SIG_STATUS_CB_ARGS
|
||||
|
||||
/*!
|
||||
\brief Get the signaling status on the given channel.
|
||||
\param ftdmchan The freetdm channel
|
||||
\param status The status pointer where the current signaling status will be set
|
||||
*/
|
||||
#define BOOST_GET_CHANNEL_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status)
|
||||
typedef ftdm_status_t (*boost_get_channel_sig_status_func_t) BOOST_GET_CHANNEL_SIG_STATUS_ARGS;
|
||||
#define BOOST_GET_CHANNEL_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_GET_CHANNEL_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set the signaling status on the given channel.
|
||||
\param ftdmchan The freetdm channel
|
||||
\param status The new status for the channel
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_SET_CHANNEL_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status)
|
||||
typedef ftdm_status_t (*boost_set_channel_sig_status_func_t) BOOST_SET_CHANNEL_SIG_STATUS_ARGS;
|
||||
#define BOOST_SET_CHANNEL_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_SET_CHANNEL_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Get the signaling status on the given span.
|
||||
\param span The freetdm span
|
||||
\param status The status pointer where the current signaling status will be set
|
||||
*/
|
||||
#define BOOST_GET_SPAN_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status)
|
||||
typedef ftdm_status_t (*boost_get_span_sig_status_func_t) BOOST_GET_SPAN_SIG_STATUS_ARGS;
|
||||
#define BOOST_GET_SPAN_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_GET_SPAN_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Set the signaling status on the given span.
|
||||
\param ftdmchan The freetdm span
|
||||
\param status The new status for the span
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_SET_SPAN_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status)
|
||||
typedef ftdm_status_t (*boost_set_span_sig_status_func_t) BOOST_SET_SPAN_SIG_STATUS_ARGS;
|
||||
#define BOOST_SET_SPAN_SIG_STATUS_FUNCTION(name) ftdm_status_t name BOOST_SET_SPAN_SIG_STATUS_ARGS
|
||||
|
||||
/*!
|
||||
\brief Configure the given span signaling
|
||||
\param span The freetdm span
|
||||
\param parameters The array of configuration key,value pairs (must be null terminated)
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_CONFIGURE_SPAN_ARGS (ftdm_span_t *span, ftdm_conf_parameter_t *parameters)
|
||||
typedef ftdm_status_t (*boost_configure_span_func_t) BOOST_CONFIGURE_SPAN_ARGS;
|
||||
#define BOOST_CONFIGURE_SPAN_FUNCTION(name) ftdm_status_t name BOOST_CONFIGURE_SPAN_ARGS
|
||||
|
||||
/*!
|
||||
\brief Start the given span
|
||||
\param span The freetdm span
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_START_SPAN_ARGS (ftdm_span_t *span)
|
||||
typedef ftdm_status_t (*boost_start_span_func_t) BOOST_START_SPAN_ARGS;
|
||||
#define BOOST_START_SPAN_FUNCTION(name) ftdm_status_t name BOOST_START_SPAN_ARGS
|
||||
|
||||
/*!
|
||||
\brief Stop the given span
|
||||
\param span The freetdm span
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_STOP_SPAN_ARGS (ftdm_span_t *span)
|
||||
typedef ftdm_status_t (*boost_stop_span_func_t) BOOST_START_SPAN_ARGS;
|
||||
#define BOOST_STOP_SPAN_FUNCTION(name) ftdm_status_t name BOOST_STOP_SPAN_ARGS
|
||||
|
||||
/*!
|
||||
\brief Called when the module is being loaded BEFORE calling anything else
|
||||
\return FTDM_SUCCESS or FTDM_FAIL
|
||||
*/
|
||||
#define BOOST_ON_LOAD_ARGS (void)
|
||||
typedef ftdm_status_t (*boost_on_load_func_t) BOOST_ON_LOAD_ARGS;
|
||||
#define BOOST_ON_LOAD_FUNCTION(name) ftdm_status_t name BOOST_ON_LOAD_ARGS
|
||||
|
||||
/*!
|
||||
\brief Called when the module is being unloaded, last chance to stop everything!
|
||||
*/
|
||||
#define BOOST_ON_UNLOAD_ARGS (void)
|
||||
typedef ftdm_status_t (*boost_on_unload_func_t) BOOST_ON_UNLOAD_ARGS;
|
||||
#define BOOST_ON_UNLOAD_FUNCTION(name) ftdm_status_t name BOOST_ON_UNLOAD_ARGS
|
||||
|
||||
/*!
|
||||
\brief The boost signaling module interface
|
||||
*/
|
||||
typedef struct boost_sigmod_interface_s {
|
||||
/*! \brief Module name */
|
||||
const char *name;
|
||||
/*! \brief write boost message function */
|
||||
boost_write_msg_func_t write_msg;
|
||||
/*! \brief set the user write boost message function */
|
||||
boost_set_write_msg_cb_func_t set_write_msg_cb;
|
||||
/*! \brief set the user signaling status function */
|
||||
boost_set_sig_status_cb_func_t set_sig_status_cb;
|
||||
/*! \brief get channel signaling status */
|
||||
boost_get_channel_sig_status_func_t get_channel_sig_status;
|
||||
/*! \brief set channel signaling status */
|
||||
boost_set_channel_sig_status_func_t set_channel_sig_status;
|
||||
/*! \brief get span signaling status */
|
||||
boost_get_span_sig_status_func_t get_span_sig_status;
|
||||
/*! \brief set span signaling status */
|
||||
boost_set_span_sig_status_func_t set_span_sig_status;
|
||||
/*! \brief set notify hardware link status change */
|
||||
boost_on_hw_link_status_change_func_t on_hw_link_status_change;
|
||||
/*! \brief configure span signaling */
|
||||
boost_configure_span_func_t configure_span;
|
||||
/*! \brief start freetdm span */
|
||||
boost_start_span_func_t start_span;
|
||||
/*! \brief stop freetdm span */
|
||||
boost_stop_span_func_t stop_span;
|
||||
/*! \brief the module was just loaded */
|
||||
boost_on_load_func_t on_load;
|
||||
/*! \brief the module is about to be unloaded */
|
||||
boost_on_unload_func_t on_unload;
|
||||
/*! \brief private pointer for the interface user */
|
||||
void *pvt;
|
||||
} boost_sigmod_interface_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern C
|
||||
#endif
|
||||
|
||||
#define BOOST_INTERFACE_NAME boost_sigmod_interface
|
||||
#define BOOST_INTERFACE_NAME_STR "boost_sigmod_interface"
|
||||
/* use this in your sig boost module to declare your interface */
|
||||
#ifndef WIN32
|
||||
#define BOOST_INTERFACE boost_sigmod_interface_t BOOST_INTERFACE_NAME
|
||||
#else
|
||||
#define BOOST_INTERFACE __declspec(dllexport) boost_sigmod_interface_t BOOST_INTERFACE_NAME
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
203
libs/freetdm/src/ftmod/ftmod_sangoma_boost/sigboost.h
Normal file
203
libs/freetdm/src/ftmod/ftmod_sangoma_boost/sigboost.h
Normal file
@ -0,0 +1,203 @@
|
||||
/****************************************************************************
|
||||
* sigboost.h $Revision: 1.13 $
|
||||
*
|
||||
* Definitions for the sigboost interface.
|
||||
*
|
||||
* WARNING WARNING WARNING
|
||||
*
|
||||
* This file is used by sangoma_mgd and perhaps other programs. Any changes
|
||||
* to this file must be coordinated with other user programs,
|
||||
*
|
||||
* Copyright (C) 2005 Xygnada Technology, Inc.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef _SIGBOOST_H_
|
||||
#define _SIGBOOST_H_
|
||||
|
||||
#define SIGBOOST_VERSION 103
|
||||
|
||||
// handy to define integer types that actually work on both Lin and Win
|
||||
#include <freetdm.h>
|
||||
|
||||
enum e_sigboost_event_id_values
|
||||
{
|
||||
SIGBOOST_EVENT_CALL_START = 0x80, /*128*/
|
||||
SIGBOOST_EVENT_CALL_START_ACK = 0x81, /*129*/
|
||||
SIGBOOST_EVENT_CALL_START_NACK = 0x82, /*130*/
|
||||
SIGBOOST_EVENT_CALL_START_NACK_ACK = 0x83, /*131*/
|
||||
SIGBOOST_EVENT_CALL_ANSWERED = 0x84, /*132*/
|
||||
SIGBOOST_EVENT_CALL_STOPPED = 0x85, /*133*/
|
||||
SIGBOOST_EVENT_CALL_STOPPED_ACK = 0x86, /*134*/
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART = 0x87, /*135*/
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART_ACK = 0x88, /*136*/
|
||||
/* CALL_RELEASED is aimed to fix a race condition that became obvious
|
||||
* when the boost socket was replaced by direct function calls
|
||||
* and the channel hunting was moved to freetdm, the problem is
|
||||
* we can get CALL_STOPPED msg and reply with CALL_STOPPED_ACK
|
||||
* but the signaling module will still (in PRI) send RELEASE and
|
||||
* wait for RELEASE_COMPLETE from the isdn network before
|
||||
* marking the channel as available, therefore freetdm should
|
||||
* also not mark the channel as available until CALL_RELEASED
|
||||
* is received, for socket mode we can continue working as usual
|
||||
* with CALL_STOPPED being the last step because the hunting is
|
||||
* done in the signaling module.
|
||||
* */
|
||||
SIGBOOST_EVENT_CALL_RELEASED = 0x51, /* 81 */
|
||||
SIGBOOST_EVENT_CALL_PROGRESS = 0x50, /*decimal 80*/
|
||||
/* Following IDs are ss7boost to sangoma_mgd only. */
|
||||
SIGBOOST_EVENT_HEARTBEAT = 0x89, /*137*/
|
||||
SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/
|
||||
SIGBOOST_EVENT_REMOVE_CHECK_LOOP = 0x8b, /*139*/
|
||||
SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE = 0x8c, /*140*/
|
||||
SIGBOOST_EVENT_DIGIT_IN = 0x8d, /*141*/
|
||||
};
|
||||
enum e_sigboost_release_cause_values
|
||||
{
|
||||
SIGBOOST_RELEASE_CAUSE_UNDEFINED = 0,
|
||||
SIGBOOST_RELEASE_CAUSE_NORMAL = 16,
|
||||
/* probable elimination */
|
||||
//SIGBOOST_RELEASE_CAUSE_BUSY = 0x91, /* 145 */
|
||||
//SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST = 0x92, /* 146 */
|
||||
//SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET = 0x93, /* 147 */
|
||||
//SIGBOOST_RELEASE_CAUSE_NOANSWER = 0x94, /* 148 */
|
||||
};
|
||||
|
||||
enum e_sigboost_call_setup_ack_nack_cause_values
|
||||
{
|
||||
//SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY = 34, /* Q.850 value - don't use */
|
||||
SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY = 117, /* non Q.850 value indicates local all ckt busy
|
||||
causing sangoma_mgd to perform automatic call
|
||||
gapping*/
|
||||
SIGBOOST_CALL_SETUP_NACK_TEST_CKT_BUSY = 17, /* Q.850 value */
|
||||
SIGBOOST_CALL_SETUP_NACK_INVALID_NUMBER = 28, /* Q.850 value */
|
||||
SIGBOOST_CALL_SETUP_CSUPID_DBL_USE = 200, /* unused Q.850 value */
|
||||
};
|
||||
|
||||
|
||||
enum e_sigboost_huntgroup_values
|
||||
{
|
||||
SIGBOOST_HUNTGRP_SEQ_ASC = 0x00, /* sequential with lowest available first */
|
||||
SIGBOOST_HUNTGRP_SEQ_DESC = 0x01, /* sequential with highest available first */
|
||||
SIGBOOST_HUNTGRP_RR_ASC = 0x02, /* round-robin with lowest available first */
|
||||
SIGBOOST_HUNTGRP_RR_DESC = 0x03, /* round-robin with highest available first */
|
||||
};
|
||||
|
||||
enum e_sigboost_event_info_par_values
|
||||
{
|
||||
SIGBOOST_EVI_SPARE = 0x00,
|
||||
SIGBOOST_EVI_ALERTING = 0x01,
|
||||
SIGBOOST_EVI_PROGRESS = 0x02,
|
||||
};
|
||||
|
||||
enum e_sigboost_progress_flags
|
||||
{
|
||||
SIGBOOST_PROGRESS_RING = (1 << 0),
|
||||
SIGBOOST_PROGRESS_MEDIA = (1 << 1)
|
||||
};
|
||||
|
||||
#define MAX_DIALED_DIGITS 31
|
||||
|
||||
/* Next two defines are used to create the range of values for call_setup_id
|
||||
* in the t_sigboost structure.
|
||||
* 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */
|
||||
#define CORE_MAX_SPANS 200
|
||||
#define CORE_MAX_CHAN_PER_SPAN 32
|
||||
#define MAX_PENDING_CALLS CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN
|
||||
/* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */
|
||||
|
||||
/* Should only be used by server */
|
||||
#define MAX_CALL_SETUP_ID 0xFFFF
|
||||
|
||||
#define SIZE_CUSTOM 900
|
||||
#define SIZE_RDNIS SIZE_CUSTOM
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t capability;
|
||||
uint8_t uil1p;
|
||||
} t_sigboost_bearer;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t digits_count;
|
||||
char digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */
|
||||
uint8_t npi;
|
||||
uint8_t ton;
|
||||
uint8_t screening_ind;
|
||||
uint8_t presentation_ind;
|
||||
}t_sigboost_digits;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t version;
|
||||
uint32_t event_id;
|
||||
/* delete sequence numbers - SCTP does not need them */
|
||||
uint32_t fseqno;
|
||||
uint32_t bseqno;
|
||||
uint16_t call_setup_id;
|
||||
uint32_t trunk_group;
|
||||
uint8_t span;
|
||||
uint8_t chan;
|
||||
uint32_t flags;
|
||||
/* struct timeval tv; */
|
||||
t_sigboost_digits called;
|
||||
t_sigboost_digits calling;
|
||||
t_sigboost_digits rdnis;
|
||||
/* ref. Q.931 Table 4-11 and Q.951 Section 3 */
|
||||
char calling_name[MAX_DIALED_DIGITS + 1];
|
||||
t_sigboost_bearer bearer;
|
||||
uint8_t hunt_group;
|
||||
uint16_t custom_data_size;
|
||||
char custom_data[SIZE_CUSTOM]; /* it's a null terminated string */
|
||||
|
||||
} t_sigboost_callstart;
|
||||
|
||||
#define called_number_digits_count called.digits_count
|
||||
#define called_number_digits called.digits
|
||||
#define calling_number_digits_count calling.digits_count
|
||||
#define calling_number_digits calling.digits
|
||||
#define calling_number_screening_ind calling.screening_ind
|
||||
#define calling_number_presentation calling.presentation_ind
|
||||
|
||||
#define isup_in_rdnis_size custom_data_size
|
||||
#define isup_in_rdnis custom_data
|
||||
|
||||
|
||||
#define MIN_SIZE_CALLSTART_MSG sizeof(t_sigboost_callstart) - SIZE_CUSTOM
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t version;
|
||||
uint32_t event_id;
|
||||
/* delete sequence numbers - SCTP does not need them */
|
||||
uint32_t fseqno;
|
||||
uint32_t bseqno;
|
||||
uint16_t call_setup_id;
|
||||
uint32_t trunk_group;
|
||||
uint8_t span;
|
||||
uint8_t chan;
|
||||
uint32_t flags;
|
||||
/* struct timeval tv; */
|
||||
uint8_t release_cause;
|
||||
} t_sigboost_short;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
static __inline__ int boost_full_event(int event_id)
|
||||
{
|
||||
switch (event_id) {
|
||||
case SIGBOOST_EVENT_CALL_START:
|
||||
case SIGBOOST_EVENT_DIGIT_IN:
|
||||
case SIGBOOST_EVENT_CALL_PROGRESS:
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
152
libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c
Normal file
152
libs/freetdm/src/ftmod/ftmod_skel/ftmod_skel.c
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include "freetdm.h"
|
||||
//#include "ftdm_skel.h"
|
||||
|
||||
static FIO_CONFIGURE_FUNCTION(skel_configure)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_CONFIGURE_SPAN_FUNCTION(skel_configure_span)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_OPEN_FUNCTION(skel_open)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_CLOSE_FUNCTION(skel_close)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_WAIT_FUNCTION(skel_wait)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_READ_FUNCTION(skel_read)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_WRITE_FUNCTION(skel_write)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_COMMAND_FUNCTION(skel_command)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_SPAN_POLL_EVENT_FUNCTION(skel_poll_event)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_SPAN_NEXT_EVENT_FUNCTION(skel_next_event)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_CHANNEL_DESTROY_FUNCTION(skel_channel_destroy)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_SPAN_DESTROY_FUNCTION(skel_span_destroy)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static FIO_GET_ALARMS_FUNCTION(skel_get_alarms)
|
||||
{
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
static ftdm_io_interface_t skel_interface;
|
||||
|
||||
static FIO_IO_LOAD_FUNCTION(skel_init)
|
||||
{
|
||||
assert(fio != NULL);
|
||||
memset(&skel_interface, 0, sizeof(skel_interface));
|
||||
|
||||
skel_interface.name = "skel";
|
||||
skel_interface.configure = skel_configure;
|
||||
skel_interface.configure_span = skel_configure_span;
|
||||
skel_interface.open = skel_open;
|
||||
skel_interface.close = skel_close;
|
||||
skel_interface.wait = skel_wait;
|
||||
skel_interface.read = skel_read;
|
||||
skel_interface.write = skel_write;
|
||||
skel_interface.command = skel_command;
|
||||
skel_interface.poll_event = skel_poll_event;
|
||||
skel_interface.next_event = skel_next_event;
|
||||
skel_interface.channel_destroy = skel_channel_destroy;
|
||||
skel_interface.span_destroy = skel_span_destroy;
|
||||
skel_interface.get_alarms = skel_get_alarms;
|
||||
*fio = &skel_interface;
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
static FIO_IO_UNLOAD_FUNCTION(skel_destroy)
|
||||
{
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
ftdm_module_t ftdm_module = {
|
||||
"skel",
|
||||
skel_init,
|
||||
skel_destroy,
|
||||
};
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
355
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2008.vcproj
Normal file
355
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2008.vcproj
Normal file
@ -0,0 +1,355 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ftmod_wanpipe"
|
||||
ProjectGUID="{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}"
|
||||
RootNamespace="ftmod_wanpipe"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;"C:\Program Files\Sangoma\include""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib libsangoma.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";"C:\Program Files\Sangoma\lib""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib libsangoma.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x64"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib libsangoma.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x86"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib libsangoma.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x64"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ftmod_wanpipe.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1238
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
Normal file
1238
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
Normal file
File diff suppressed because it is too large
Load Diff
196
libs/freetdm/src/ftmod/ftmod_wanpipe/ozmod_wanpipe.2005.vcproj
Normal file
196
libs/freetdm/src/ftmod/ftmod_wanpipe/ozmod_wanpipe.2005.vcproj
Normal file
@ -0,0 +1,196 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ftmod_wanpipe"
|
||||
ProjectGUID="{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}"
|
||||
RootNamespace="ftmod_wanpipe"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib libsangoma.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x86"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="freetdm.lib libsangoma.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x86"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ftmod_wanpipe.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
351
libs/freetdm/src/ftmod/ftmod_wanpipe/wanpipe_tdm_api_iface.h
Normal file
351
libs/freetdm/src/ftmod/ftmod_wanpipe/wanpipe_tdm_api_iface.h
Normal file
@ -0,0 +1,351 @@
|
||||
/*****************************************************************************
|
||||
* wanpipe_tdm_api_iface.h
|
||||
*
|
||||
* WANPIPE(tm) AFT TE1 Hardware Support
|
||||
*
|
||||
* Authors: Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright (c) 2007 - 08, Sangoma Technologies
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the <organization> nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
* ============================================================================
|
||||
* Oct 04, 2005 Nenad Corbic Initial version.
|
||||
*
|
||||
* Jul 25, 2006 David Rokhvarg <davidr@sangoma.com> Ported to Windows.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __WANPIPE_TDM_API_IFACE_H_
|
||||
#define __WANPIPE_TDM_API_IFACE_H_
|
||||
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
typedef HANDLE sng_fd_t;
|
||||
#else
|
||||
typedef int sng_fd_t;
|
||||
#endif
|
||||
|
||||
/* Indicate to library that new features exist */
|
||||
#define WP_TDM_FEATURE_DTMF_EVENTS 1
|
||||
#define WP_TDM_FEATURE_FE_ALARM 1
|
||||
#define WP_TDM_FEATURE_EVENTS 1
|
||||
#define WP_TDM_FEATURE_LINK_STATUS 1
|
||||
|
||||
enum wanpipe_tdm_api_cmds {
|
||||
|
||||
SIOC_WP_TDM_GET_USR_MTU_MRU, /* 0x00 */
|
||||
|
||||
SIOC_WP_TDM_SET_USR_PERIOD, /* 0x01 */
|
||||
SIOC_WP_TDM_GET_USR_PERIOD, /* 0x02 */
|
||||
|
||||
SIOC_WP_TDM_SET_HW_MTU_MRU, /* 0x03 */
|
||||
SIOC_WP_TDM_GET_HW_MTU_MRU, /* 0x04 */
|
||||
|
||||
SIOC_WP_TDM_SET_CODEC, /* 0x05 */
|
||||
SIOC_WP_TDM_GET_CODEC, /* 0x06 */
|
||||
|
||||
SIOC_WP_TDM_SET_POWER_LEVEL, /* 0x07 */
|
||||
SIOC_WP_TDM_GET_POWER_LEVEL, /* 0x08 */
|
||||
|
||||
SIOC_WP_TDM_TOGGLE_RX, /* 0x09 */
|
||||
SIOC_WP_TDM_TOGGLE_TX, /* 0x0A */
|
||||
|
||||
SIOC_WP_TDM_GET_HW_CODING, /* 0x0B */
|
||||
SIOC_WP_TDM_SET_HW_CODING, /* 0x0C */
|
||||
|
||||
SIOC_WP_TDM_GET_FULL_CFG, /* 0x0D */
|
||||
|
||||
SIOC_WP_TDM_SET_EC_TAP, /* 0x0E */
|
||||
SIOC_WP_TDM_GET_EC_TAP, /* 0x0F */
|
||||
|
||||
SIOC_WP_TDM_ENABLE_RBS_EVENTS, /* 0x10 */
|
||||
SIOC_WP_TDM_DISABLE_RBS_EVENTS, /* 0x11 */
|
||||
SIOC_WP_TDM_WRITE_RBS_BITS, /* 0x12 */
|
||||
|
||||
SIOC_WP_TDM_GET_STATS, /* 0x13 */
|
||||
SIOC_WP_TDM_FLUSH_BUFFERS, /* 0x14 */
|
||||
|
||||
SIOC_WP_TDM_READ_EVENT, /* 0x15 */
|
||||
|
||||
SIOC_WP_TDM_SET_EVENT, /* 0x16 */
|
||||
|
||||
SIOC_WP_TDM_SET_RX_GAINS, /* 0x17 */
|
||||
SIOC_WP_TDM_SET_TX_GAINS, /* 0x18 */
|
||||
SIOC_WP_TDM_CLEAR_RX_GAINS, /* 0x19 */
|
||||
SIOC_WP_TDM_CLEAR_TX_GAINS, /* 0x1A */
|
||||
|
||||
SIOC_WP_TDM_GET_FE_ALARMS, /* 0x1B */
|
||||
|
||||
SIOC_WP_TDM_ENABLE_HWEC, /* 0x1C */
|
||||
SIOC_WP_TDM_DISABLE_HWEC, /* 0x1D */
|
||||
|
||||
SIOC_WP_TDM_SET_FE_STATUS, /* 0x1E */
|
||||
SIOC_WP_TDM_GET_FE_STATUS, /* 0x1F */
|
||||
|
||||
SIOC_WP_TDM_GET_HW_DTMF, /* 0x20 */
|
||||
|
||||
SIOC_WP_TDM_NOTSUPP /* */
|
||||
|
||||
};
|
||||
|
||||
#define SIOC_WP_TDM_GET_LINK_STATUS SIOC_WP_TDM_GET_FE_STATUS
|
||||
|
||||
enum wanpipe_tdm_api_events {
|
||||
WP_TDMAPI_EVENT_NONE,
|
||||
WP_TDMAPI_EVENT_RBS,
|
||||
WP_TDMAPI_EVENT_ALARM,
|
||||
WP_TDMAPI_EVENT_DTMF,
|
||||
WP_TDMAPI_EVENT_RM_DTMF,
|
||||
WP_TDMAPI_EVENT_RXHOOK,
|
||||
WP_TDMAPI_EVENT_RING,
|
||||
WP_TDMAPI_EVENT_RING_DETECT,
|
||||
WP_TDMAPI_EVENT_RING_TRIP_DETECT,
|
||||
WP_TDMAPI_EVENT_TONE,
|
||||
WP_TDMAPI_EVENT_TXSIG_KEWL,
|
||||
WP_TDMAPI_EVENT_TXSIG_START,
|
||||
WP_TDMAPI_EVENT_TXSIG_OFFHOOK,
|
||||
WP_TDMAPI_EVENT_TXSIG_ONHOOK,
|
||||
WP_TDMAPI_EVENT_ONHOOKTRANSFER,
|
||||
WP_TDMAPI_EVENT_SETPOLARITY,
|
||||
WP_TDMAPI_EVENT_BRI_CHAN_LOOPBACK,
|
||||
WP_TDMAPI_EVENT_LINK_STATUS
|
||||
};
|
||||
|
||||
#define WP_TDMAPI_EVENT_FE_ALARM WP_TDMAPI_EVENT_ALARM
|
||||
|
||||
|
||||
#define WP_TDMAPI_EVENT_ENABLE 0x01
|
||||
#define WP_TDMAPI_EVENT_DISABLE 0x02
|
||||
#define WP_TDMAPI_EVENT_MODE_DECODE(mode) \
|
||||
((mode) == WP_TDMAPI_EVENT_ENABLE) ? "Enable" : \
|
||||
((mode) == WP_TDMAPI_EVENT_DISABLE) ? "Disable" : \
|
||||
"(Unknown mode)"
|
||||
|
||||
#define WPTDM_A_BIT WAN_RBS_SIG_A
|
||||
#define WPTDM_B_BIT WAN_RBS_SIG_B
|
||||
#define WPTDM_C_BIT WAN_RBS_SIG_C
|
||||
#define WPTDM_D_BIT WAN_RBS_SIG_D
|
||||
|
||||
#define WP_TDMAPI_EVENT_RXHOOK_OFF 0x01
|
||||
#define WP_TDMAPI_EVENT_RXHOOK_ON 0x02
|
||||
#define WP_TDMAPI_EVENT_RXHOOK_DECODE(state) \
|
||||
((state) == WP_TDMAPI_EVENT_RXHOOK_OFF) ? "Off-hook" : \
|
||||
((state) == WP_TDMAPI_EVENT_RXHOOK_ON) ? "On-hook" : \
|
||||
"(Unknown state)"
|
||||
|
||||
#define WP_TDMAPI_EVENT_RING_PRESENT 0x01
|
||||
#define WP_TDMAPI_EVENT_RING_STOP 0x02
|
||||
#define WP_TDMAPI_EVENT_RING_DECODE(state) \
|
||||
((state) == WP_TDMAPI_EVENT_RING_PRESENT) ? "Ring Present" : \
|
||||
((state) == WP_TDMAPI_EVENT_RING_STOP) ? "Ring Stop" : \
|
||||
"(Unknown state)"
|
||||
|
||||
#define WP_TDMAPI_EVENT_RING_TRIP_PRESENT 0x01
|
||||
#define WP_TDMAPI_EVENT_RING_TRIP_STOP 0x02
|
||||
#define WP_TDMAPI_EVENT_RING_TRIP_DECODE(state) \
|
||||
((state) == WP_TDMAPI_EVENT_RING_TRIP_PRESENT) ? "Ring Present" : \
|
||||
((state) == WP_TDMAPI_EVENT_RING_TRIP_STOP) ? "Ring Stop" : \
|
||||
"(Unknown state)"
|
||||
/*Link Status */
|
||||
#define WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED 0x01
|
||||
#define WP_TDMAPI_EVENT_LINK_STATUS_DISCONNECTED 0x02
|
||||
#define WP_TDMAPI_EVENT_LINK_STATUS_DECODE(status) \
|
||||
((status) == WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED) ? "Connected" : \
|
||||
((status) == WP_TDMAPI_EVENT_LINK_STATUS_DISCONNECTED) ? "Disconnected" : \
|
||||
"Unknown"
|
||||
#define WP_TDMAPI_EVENT_TONE_DIAL 0x01
|
||||
#define WP_TDMAPI_EVENT_TONE_BUSY 0x02
|
||||
#define WP_TDMAPI_EVENT_TONE_RING 0x03
|
||||
#define WP_TDMAPI_EVENT_TONE_CONGESTION 0x04
|
||||
|
||||
/* BRI channels list */
|
||||
#define WAN_BRI_BCHAN1 0x01
|
||||
#define WAN_BRI_BCHAN2 0x02
|
||||
#define WAN_BRI_DCHAN 0x03
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
u_int8_t type;
|
||||
u_int8_t mode;
|
||||
u_int32_t time_stamp;
|
||||
u_int8_t channel;
|
||||
u_int32_t chan_map;
|
||||
u_int8_t span;
|
||||
union {
|
||||
struct {
|
||||
u_int8_t alarm;
|
||||
} te1_alarm;
|
||||
struct {
|
||||
u_int8_t rbs_bits;
|
||||
} te1_rbs;
|
||||
struct {
|
||||
u_int8_t state;
|
||||
u_int8_t sig;
|
||||
} rm_hook;
|
||||
struct {
|
||||
u_int8_t state;
|
||||
} rm_ring;
|
||||
struct {
|
||||
u_int8_t type;
|
||||
} rm_tone;
|
||||
struct {
|
||||
u_int8_t digit; /* DTMF: digit */
|
||||
u_int8_t port; /* DTMF: SOUT/ROUT */
|
||||
u_int8_t type; /* DTMF: PRESET/STOP */
|
||||
} dtmf;
|
||||
struct {
|
||||
u_int16_t polarity;
|
||||
u_int16_t ohttimer;
|
||||
} rm_common;
|
||||
struct{
|
||||
u_int16_t status;
|
||||
} linkstatus;
|
||||
} wp_tdm_api_event_u;
|
||||
#define wp_tdm_api_event_type type
|
||||
#define wp_tdm_api_event_mode mode
|
||||
#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm
|
||||
#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm
|
||||
#define wp_tdm_api_event_rbs_bits wp_tdm_api_event_u.te1_rbs.rbs_bits
|
||||
#define wp_tdm_api_event_hook_state wp_tdm_api_event_u.rm_hook.state
|
||||
#define wp_tdm_api_event_hook_sig wp_tdm_api_event_u.rm_hook.sig
|
||||
#define wp_tdm_api_event_ring_state wp_tdm_api_event_u.rm_ring.state
|
||||
#define wp_tdm_api_event_tone_type wp_tdm_api_event_u.rm_tone.type
|
||||
#define wp_tdm_api_event_dtmf_digit wp_tdm_api_event_u.dtmf.digit
|
||||
#define wp_tdm_api_event_dtmf_type wp_tdm_api_event_u.dtmf.type
|
||||
#define wp_tdm_api_event_dtmf_port wp_tdm_api_event_u.dtmf.port
|
||||
#define wp_tdm_api_event_ohttimer wp_tdm_api_event_u.rm_common.ohttimer
|
||||
#define wp_tdm_api_event_polarity wp_tdm_api_event_u.rm_common.polarity
|
||||
#define wp_tdm_api_event_link_status wp_tdm_api_event_u.linkstatus.status
|
||||
} wp_tdm_api_event_t;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
unsigned char reserved[16];
|
||||
}wp_rx_hdr_u;
|
||||
} wp_tdm_api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
wp_tdm_api_rx_hdr_t hdr;
|
||||
unsigned char data[1];
|
||||
} wp_tdm_api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
unsigned char _rbs_rx_bits;
|
||||
unsigned int _time_stamp;
|
||||
}wp_tx;
|
||||
unsigned char reserved[16];
|
||||
}wp_tx_hdr_u;
|
||||
#define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp
|
||||
} wp_tdm_api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
wp_tdm_api_tx_hdr_t hdr;
|
||||
unsigned char data[1];
|
||||
} wp_tdm_api_tx_element_t;
|
||||
|
||||
|
||||
|
||||
typedef struct wp_tdm_chan_stats
|
||||
{
|
||||
unsigned int rx_packets; /* total packets received */
|
||||
unsigned int tx_packets; /* total packets transmitted */
|
||||
unsigned int rx_bytes; /* total bytes received */
|
||||
unsigned int tx_bytes; /* total bytes transmitted */
|
||||
unsigned int rx_errors; /* bad packets received */
|
||||
unsigned int tx_errors; /* packet transmit problems */
|
||||
unsigned int rx_dropped; /* no space in linux buffers */
|
||||
unsigned int tx_dropped; /* no space available in linux */
|
||||
unsigned int multicast; /* multicast packets received */
|
||||
#if !defined(__WINDOWS__)
|
||||
unsigned int collisions;
|
||||
#endif
|
||||
/* detailed rx_errors: */
|
||||
unsigned int rx_length_errors;
|
||||
unsigned int rx_over_errors; /* receiver ring buff overflow */
|
||||
unsigned int rx_crc_errors; /* recved pkt with crc error */
|
||||
unsigned int rx_frame_errors; /* recv'd frame alignment error */
|
||||
#if !defined(__WINDOWS__)
|
||||
unsigned int rx_fifo_errors; /* recv'r fifo overrun */
|
||||
#endif
|
||||
unsigned int rx_missed_errors; /* receiver missed packet */
|
||||
|
||||
/* detailed tx_errors */
|
||||
#if !defined(__WINDOWS__)
|
||||
unsigned int tx_aborted_errors;
|
||||
unsigned int tx_carrier_errors;
|
||||
#endif
|
||||
unsigned int tx_fifo_errors;
|
||||
unsigned int tx_heartbeat_errors;
|
||||
unsigned int tx_window_errors;
|
||||
|
||||
}wp_tdm_chan_stats_t;
|
||||
|
||||
|
||||
|
||||
typedef struct wanpipe_tdm_api_cmd{
|
||||
unsigned int cmd;
|
||||
unsigned int hw_tdm_coding; /* Set/Get HW TDM coding: uLaw muLaw */
|
||||
unsigned int hw_mtu_mru; /* Set/Get HW TDM MTU/MRU */
|
||||
unsigned int usr_period; /* Set/Get User Period in ms */
|
||||
unsigned int tdm_codec; /* Set/Get TDM Codec: SLinear */
|
||||
unsigned int power_level; /* Set/Get Power level treshold */
|
||||
unsigned int rx_disable; /* Enable/Disable Rx */
|
||||
unsigned int tx_disable; /* Enable/Disable Tx */
|
||||
unsigned int usr_mtu_mru; /* Set/Get User TDM MTU/MRU */
|
||||
unsigned int ec_tap; /* Echo Cancellation Tap */
|
||||
unsigned int rbs_poll; /* Enable/Disable RBS Polling */
|
||||
unsigned int rbs_rx_bits; /* Rx RBS Bits */
|
||||
unsigned int rbs_tx_bits; /* Tx RBS Bits */
|
||||
unsigned int hdlc; /* HDLC based device */
|
||||
unsigned int idle_flag; /* IDLE flag to Tx */
|
||||
unsigned int fe_alarms; /* FE Alarms detected */
|
||||
wp_tdm_chan_stats_t stats; /* TDM Statistics */
|
||||
/* Do NOT add anything above this! Important for binary backward compatibility. */
|
||||
wp_tdm_api_event_t event; /* TDM Event */
|
||||
unsigned int data_len;
|
||||
void *data;
|
||||
unsigned char fe_status; /* FE status - Connected or Disconnected */
|
||||
unsigned int hw_dtmf; /* HW DTMF enabled */
|
||||
}wanpipe_tdm_api_cmd_t;
|
||||
|
||||
typedef struct wanpipe_tdm_api_event{
|
||||
int (*wp_rbs_event)(sng_fd_t fd, unsigned char rbs_bits);
|
||||
int (*wp_dtmf_event)(sng_fd_t fd, unsigned char dtmf, unsigned char type, unsigned char port);
|
||||
int (*wp_rxhook_event)(sng_fd_t fd, unsigned char hook_state);
|
||||
int (*wp_ring_detect_event)(sng_fd_t fd, unsigned char ring_state);
|
||||
int (*wp_ring_trip_detect_event)(sng_fd_t fd, unsigned char ring_state);
|
||||
int (*wp_fe_alarm_event)(sng_fd_t fd, unsigned char fe_alarm_event);
|
||||
int (*wp_link_status_event)(sng_fd_t fd, unsigned char link_status_event);
|
||||
}wanpipe_tdm_api_event_t;
|
||||
|
||||
typedef struct wanpipe_tdm_api{
|
||||
wanpipe_tdm_api_cmd_t wp_tdm_cmd;
|
||||
wanpipe_tdm_api_event_t wp_tdm_event;
|
||||
}wanpipe_tdm_api_t;
|
||||
|
||||
|
||||
#endif
|
1232
libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c
Normal file
1232
libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c
Normal file
File diff suppressed because it is too large
Load Diff
364
libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h
Normal file
364
libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.h
Normal file
@ -0,0 +1,364 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FTDM_ZT_H
|
||||
#define FTDM_ZT_H
|
||||
#include "freetdm.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <poll.h>
|
||||
|
||||
#ifdef __sun
|
||||
#include <unistd.h>
|
||||
#include <sys/ioccom.h>
|
||||
#include <stropts.h>
|
||||
#endif
|
||||
|
||||
/* Hardware interface structures and defines */
|
||||
/* Based on documentation of the structures required for the hardware interface */
|
||||
/* from http://wiki.freeswitch.org/wiki/Zapata_ftdmtel_interface */
|
||||
|
||||
/* Structures */
|
||||
|
||||
/* Used with ioctl: ZT_GET_PARAMS and ZT_SET_PARAMS */
|
||||
struct zt_params {
|
||||
int chan_no; /* Channel Number */
|
||||
int span_no; /* Span Number */
|
||||
int chan_position; /* Channel Position */
|
||||
int sig_type; /* Signal Type (read-only) */
|
||||
int sig_cap; /* Signal Cap (read-only) */
|
||||
int receive_offhook; /* Receive is offhook (read-only) */
|
||||
int receive_bits; /* Number of bits in receive (read-only) */
|
||||
int transmit_bits; /* Number of bits in transmit (read-only) */
|
||||
int transmit_hook_sig; /* Transmit Hook Signal (read-only) */
|
||||
int receive_hook_sig; /* Receive Hook Signal (read-only) */
|
||||
int g711_type; /* Member of zt_g711_t (read-only) */
|
||||
int idlebits; /* bits for the idle state (read-only) */
|
||||
char chan_name[40]; /* Channel Name */
|
||||
int prewink_time;
|
||||
int preflash_time;
|
||||
int wink_time;
|
||||
int flash_time;
|
||||
int start_time;
|
||||
int receive_wink_time;
|
||||
int receive_flash_time;
|
||||
int debounce_time;
|
||||
int pulse_break_time;
|
||||
int pulse_make_time;
|
||||
int pulse_after_time;
|
||||
/* latest version of this struct include chan_alarms field */
|
||||
uint32_t chan_alarms;
|
||||
};
|
||||
|
||||
typedef struct zt_params zt_params_t;
|
||||
|
||||
/* Used with ioctl: ZT_CONFLINK, ZT_GETCONF and ZT_SETCONF */
|
||||
struct zt_confinfo {
|
||||
int chan_no; /* Channel Number, 0 for current */
|
||||
int conference_number;
|
||||
int conference_mode;
|
||||
};
|
||||
|
||||
/* Used with ioctl: ZT_GETGAINS and ZT_SETGAINS */
|
||||
struct zt_gains {
|
||||
int chan_no; /* Channel Number, 0 for current */
|
||||
unsigned char receive_gain[256]; /* Receive gain table */
|
||||
unsigned char transmit_gain[256]; /* Transmit gain table */
|
||||
};
|
||||
|
||||
/* Used with ioctl: ZT_SPANSTAT */
|
||||
struct zt_spaninfo {
|
||||
int span_no; /* span number (-1 to use name) */
|
||||
char name[20]; /* Name of span */
|
||||
char description[40]; /* Description of span */
|
||||
int alarms; /* alarms status */
|
||||
int transmit_level; /* Transmit level */
|
||||
int receive_level; /* Receive level */
|
||||
int bpv_count; /* Current BPV count */
|
||||
int crc4_count; /* Current CRC4 error count */
|
||||
int ebit_count; /* Current E-bit error count */
|
||||
int fas_count; /* Current FAS error count */
|
||||
int irq_misses; /* Current IRQ misses */
|
||||
int sync_src; /* Span # of sync source (0 = free run) */
|
||||
int configured_chan_count; /* Count of channels configured on the span */
|
||||
int channel_count; /* Total count of channels on the span */
|
||||
int span_count; /* Total count of ftdmtel spans on the system*/
|
||||
/* end v1 of the struct */
|
||||
/* as long as we don't use the fields below we should be ok regardless of the ftdmtel/dahdi version */
|
||||
int lbo; /* Line Build Out */
|
||||
int lineconfig; /* framing/coding */
|
||||
/* end of v2 of the struct */
|
||||
char lboname[40]; /* Line Build Out in text form */
|
||||
char location[40]; /* span's device location in system */
|
||||
char manufacturer[40]; /* manufacturer of span's device */
|
||||
char devicetype[40]; /* span's device type */
|
||||
int irq; /* span's device IRQ */
|
||||
int linecompat; /* signaling modes possible on this span */
|
||||
char spantype[6]; /* type of span in text form */
|
||||
};
|
||||
|
||||
struct zt_maintinfo {
|
||||
int span_no; /* span number */
|
||||
int command; /* Maintenance mode to set (from zt_maintenance_mode_t) */
|
||||
};
|
||||
|
||||
struct zt_lineconfig {
|
||||
/* Used in ZT_SPANCONFIG */
|
||||
int span; /* Which span number (0 to use name) */
|
||||
char name[20]; /* Name of span to use */
|
||||
int lbo; /* line build-outs */
|
||||
int lineconfig; /* line config parameters (framing, coding) */
|
||||
int sync; /* what level of sync source we are */
|
||||
};
|
||||
|
||||
struct zt_chanconfig {
|
||||
/* Used in ZT_CHANCONFIG */
|
||||
int chan; /* Channel we're applying this to (0 to use name) */
|
||||
char name[40]; /* Name of channel to use */
|
||||
int sigtype; /* Signal type */
|
||||
int deflaw; /* Default law (ZT_LAW_DEFAULT, ZT_LAW_MULAW, or ZT_LAW_ALAW */
|
||||
int master; /* Master channel if sigtype is ZT_SLAVE */
|
||||
int idlebits; /* Idle bits (if this is a CAS channel) or channel to monitor (if this is DACS channel) */
|
||||
char netdev_name[16]; /* name for the hdlc network device */
|
||||
};
|
||||
|
||||
struct zt_bufferinfo {
|
||||
/* used in ZT_SET_BUFINFO and ZT_GET_BUFINFO */
|
||||
int txbufpolicy; /* Policy for handling receive buffers */
|
||||
int rxbufpolicy; /* Policy for handling receive buffers */
|
||||
int numbufs; /* How many buffers to use */
|
||||
int bufsize; /* How big each buffer is */
|
||||
int readbufs; /* How many read buffers are full (read-only) */
|
||||
int writebufs; /* How many write buffers are full (read-only) */
|
||||
};
|
||||
|
||||
/* Enumerations */
|
||||
|
||||
/* Values in zt_params structure for member g711_type */
|
||||
typedef enum {
|
||||
ZT_G711_DEFAULT = 0, /* Default mulaw/alaw from the span */
|
||||
ZT_G711_MULAW = 1,
|
||||
ZT_G711_ALAW = 2
|
||||
} zt_g711_t;
|
||||
|
||||
typedef enum {
|
||||
ZT_EVENT_NONE = 0,
|
||||
ZT_EVENT_ONHOOK = 1,
|
||||
ZT_EVENT_RINGOFFHOOK = 2,
|
||||
ZT_EVENT_WINKFLASH = 3,
|
||||
ZT_EVENT_ALARM = 4,
|
||||
ZT_EVENT_NOALARM = 5,
|
||||
ZT_EVENT_ABORT = 6,
|
||||
ZT_EVENT_OVERRUN = 7,
|
||||
ZT_EVENT_BADFCS = 8,
|
||||
ZT_EVENT_DIALCOMPLETE = 9,
|
||||
ZT_EVENT_RINGERON = 10,
|
||||
ZT_EVENT_RINGEROFF = 11,
|
||||
ZT_EVENT_HOOKCOMPLETE = 12,
|
||||
ZT_EVENT_BITSCHANGED = 13,
|
||||
ZT_EVENT_PULSE_START = 14,
|
||||
ZT_EVENT_TIMER_EXPIRED = 15,
|
||||
ZT_EVENT_TIMER_PING = 16,
|
||||
ZT_EVENT_POLARITY = 17,
|
||||
ZT_EVENT_RINGBEGIN = 18
|
||||
} zt_event_t;
|
||||
|
||||
typedef enum {
|
||||
ZT_FLUSH_READ = 1,
|
||||
ZT_FLUSH_WRITE = 2,
|
||||
ZT_FLUSH_BOTH = (ZT_FLUSH_READ | ZT_FLUSH_WRITE),
|
||||
ZT_FLUSH_EVENT = 4,
|
||||
ZT_FLUSH_ALL = (ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT)
|
||||
} zt_flush_t;
|
||||
|
||||
typedef enum {
|
||||
ZT_IOMUX_READ = 1,
|
||||
ZT_IOMUX_WRITE = 2,
|
||||
ZT_IOMUX_WRITEEMPTY = 4,
|
||||
ZT_IOMUX_SIGEVENT = 8,
|
||||
ZT_IOMUX_NOWAIT = 256
|
||||
} zt_iomux_t;
|
||||
|
||||
typedef enum {
|
||||
ZT_ONHOOK = 0,
|
||||
ZT_OFFHOOK = 1,
|
||||
ZT_WINK = 2,
|
||||
ZT_FLASH = 3,
|
||||
ZT_START = 4,
|
||||
ZT_RING = 5,
|
||||
ZT_RINGOFF = 6
|
||||
} zt_hookstate_t;
|
||||
|
||||
typedef enum {
|
||||
ZT_MAINT_NONE = 0, /* Normal Mode */
|
||||
ZT_MAINT_LOCALLOOP = 1, /* Local Loopback */
|
||||
ZT_MAINT_REMOTELOOP = 2, /* Remote Loopback */
|
||||
ZT_MAINT_LOOPUP = 3, /* Send Loopup Code */
|
||||
ZT_MAINT_LOOPDOWN = 4, /* Send Loopdown Code */
|
||||
ZT_MAINT_LOOPSTOP = 5 /* Stop Sending Loop Codes */
|
||||
} zt_maintenance_mode_t;
|
||||
|
||||
typedef enum {
|
||||
/* Signalling type */
|
||||
ZT_SIG_NONE = 0, /* chan not configured. */
|
||||
|
||||
ZT_SIG_FXSLS = ((1 << 0) | (1 << 13)), /* FXS, Loopstart */
|
||||
ZT_SIG_FXSGS = ((1 << 1) | (1 << 13)), /* FXS, Groundstart */
|
||||
ZT_SIG_FXSKS = ((1 << 2) | (1 << 13)), /* FXS, Kewlstart */
|
||||
ZT_SIG_FXOLS = ((1 << 3) | (1 << 12)), /* FXO, Loopstart */
|
||||
ZT_SIG_FXOGS = ((1 << 4) | (1 << 12)), /* FXO, Groupstart */
|
||||
ZT_SIG_FXOKS = ((1 << 5) | (1 << 12)), /* FXO, Kewlstart */
|
||||
ZT_SIG_EM = (1 << 6), /* E&M */
|
||||
ZT_SIG_CLEAR = (1 << 7),
|
||||
ZT_SIG_HDLCRAW = ((1 << 8) | ZT_SIG_CLEAR),
|
||||
ZT_SIG_HDLCFCS = ((1 << 9) | ZT_SIG_HDLCRAW),
|
||||
ZT_SIG_CAS = (1 << 15),
|
||||
ZT_SIG_HARDHDLC = ((1 << 19) | ZT_SIG_CLEAR),
|
||||
} zt_sigtype_t;
|
||||
|
||||
typedef enum {
|
||||
ZT_DBIT = 1,
|
||||
ZT_CBIT = 2,
|
||||
ZT_BBIT = 4,
|
||||
ZT_ABIT = 8
|
||||
} zt_cas_bit_t;
|
||||
|
||||
/* Defines */
|
||||
|
||||
#define ZT_MAX_BLOCKSIZE 8192
|
||||
#define ZT_DEFAULT_MTU_MRU 2048
|
||||
|
||||
/* ioctl defines */
|
||||
|
||||
#define ZT_CODE 'J'
|
||||
#define DAHDI_CODE 0xDA
|
||||
|
||||
|
||||
#define ZT_GET_BLOCKSIZE _IOR (ZT_CODE, 1, int) /* Get Transfer Block Size. */
|
||||
#define ZT_SET_BLOCKSIZE _IOW (ZT_CODE, 2, int) /* Set Transfer Block Size. */
|
||||
#define ZT_FLUSH _IOW (ZT_CODE, 3, int) /* Flush Buffer(s) and stop I/O */
|
||||
#define ZT_SYNC _IOW (ZT_CODE, 4, int) /* Wait for Write to Finish */
|
||||
#define ZT_GET_PARAMS _IOR (ZT_CODE, 5, struct zt_params) /* Get channel parameters */
|
||||
#define ZT_SET_PARAMS _IOW (ZT_CODE, 6, struct zt_params) /* Set channel parameters */
|
||||
#define ZT_HOOK _IOW (ZT_CODE, 7, int) /* Set Hookswitch Status */
|
||||
#define ZT_GETEVENT _IOR (ZT_CODE, 8, int) /* Get Signalling Event */
|
||||
#define ZT_IOMUX _IOWR (ZT_CODE, 9, int) /* Wait for something to happen (IO Mux) */
|
||||
#define ZT_SPANSTAT _IOWR (ZT_CODE, 10, struct zt_spaninfo) /* Get Span Status */
|
||||
#define ZT_MAINT _IOW (ZT_CODE, 11, struct zt_maintinfo)/* Set Maintenance Mode for a span */
|
||||
#define ZT_GETCONF _IOWR (ZT_CODE, 12, struct zt_confinfo) /* Get Conference Mode */
|
||||
#define ZT_SETCONF _IOWR (ZT_CODE, 13, struct zt_confinfo) /* Set Conference Mode */
|
||||
#define ZT_CONFLINK _IOW (ZT_CODE, 14, struct zt_confinfo) /* Setup or Remove Conference Link */
|
||||
#define ZT_CONFDIAG _IOR (ZT_CODE, 15, int) /* Display Conference Diagnostic Information on Console */
|
||||
|
||||
#define ZT_GETGAINS _IOWR (ZT_CODE, 16, struct zt_gains) /* Get Channel audio gains */
|
||||
#define ZT_SETGAINS _IOWR (ZT_CODE, 17, struct zt_gains) /* Set Channel audio gains */
|
||||
#define ZT_SPANCONFIG _IOW (ZT_CODE, 18, struct zt_lineconfig)/* Set Line (T1) Configurations and start system */
|
||||
#define ZT_CHANCONFIG _IOW (ZT_CODE, 19, struct zt_chanconfig)/* Set Channel Configuration */
|
||||
#define ZT_SET_BUFINFO _IOW (ZT_CODE, 27, struct zt_bufferinfo)/* Set buffer policy */
|
||||
#define ZT_GET_BUFINFO _IOR (ZT_CODE, 28, struct zt_bufferinfo)/* Get current buffer info */
|
||||
#define ZT_AUDIOMODE _IOW (ZT_CODE, 32, int) /* Set a clear channel into audio mode */
|
||||
#define ZT_ECHOCANCEL _IOW (ZT_CODE, 33, int) /* Control Echo Canceller */
|
||||
#define ZT_HDLCRAWMODE _IOW (ZT_CODE, 36, int) /* Set a clear channel into HDLC w/out FCS checking/calculation mode */
|
||||
#define ZT_HDLCFCSMODE _IOW (ZT_CODE, 37, int) /* Set a clear channel into HDLC w/ FCS mode */
|
||||
|
||||
/* Specify a channel on /dev/ftdm/chan -- must be done before any other ioctl's and is only valid on /dev/ftdm/chan */
|
||||
#define ZT_SPECIFY _IOW (ZT_CODE, 38, int)
|
||||
|
||||
/* Temporarily set the law on a channel to ZT_LAW_DEFAULT, ZT_LAW_ALAW, or ZT_LAW_MULAW. Is reset on close. */
|
||||
#define ZT_SETLAW _IOW (ZT_CODE, 39, int)
|
||||
|
||||
/* Temporarily set the channel to operate in linear mode when non-zero or default law if 0 */
|
||||
#define ZT_SETLINEAR _IOW (ZT_CODE, 40, int)
|
||||
|
||||
#define ZT_GETCONFMUTE _IOR (ZT_CODE, 49, int) /* Get Conference to mute mode */
|
||||
#define ZT_ECHOTRAIN _IOW (ZT_CODE, 50, int) /* Control Echo Trainer */
|
||||
|
||||
/* Set/Get CAS bits */
|
||||
#define ZT_SETTXBITS _IOW (ZT_CODE, 43, int)
|
||||
#define ZT_GETRXBITS _IOR (ZT_CODE, 45, int)
|
||||
|
||||
#define DAHDI_GET_BLOCKSIZE _IOR (DAHDI_CODE, 1, int) /* Get Transfer Block Size. */
|
||||
#define DAHDI_SET_BLOCKSIZE _IOW (DAHDI_CODE, 1, int) /* Set Transfer Block Size. */
|
||||
#define DAHDI_FLUSH _IOW (DAHDI_CODE, 3, int) /* Flush Buffer(s) and stop I/O */
|
||||
#define DAHDI_SYNC _IO (DAHDI_CODE, 4) /* Wait for Write to Finish */
|
||||
#define DAHDI_GET_PARAMS _IOR (DAHDI_CODE, 5, struct zt_params) /* Get channel parameters */
|
||||
#define DAHDI_SET_PARAMS _IOW (DAHDI_CODE, 5, struct zt_params) /* Set channel parameters */
|
||||
#define DAHDI_HOOK _IOW (DAHDI_CODE, 7, int) /* Set Hookswitch Status */
|
||||
#define DAHDI_GETEVENT _IOR (DAHDI_CODE, 8, int) /* Get Signalling Event */
|
||||
#define DAHDI_IOMUX _IOWR (DAHDI_CODE, 9, int) /* Wait for something to happen (IO Mux) */
|
||||
#define DAHDI_SPANSTAT _IOWR (DAHDI_CODE, 10, struct zt_spaninfo) /* Get Span Status */
|
||||
#define DAHDI_MAINT _IOW (DAHDI_CODE, 11, struct zt_maintinfo) /* Set Maintenance Mode for a span */
|
||||
#define DAHDI_GETCONF _IOR (DAHDI_CODE, 12, struct zt_confinfo) /* Get Conference Mode */
|
||||
#define DAHDI_SETCONF _IOW (DAHDI_CODE, 12, struct zt_confinfo) /* Set Conference Mode */
|
||||
#define DAHDI_CONFLINK _IOW (DAHDI_CODE, 14, struct zt_confinfo) /* Setup or Remove Conference Link */
|
||||
#define DAHDI_CONFDIAG _IOR (DAHDI_CODE, 15, int) /* Display Conference Diagnostic Information on Console */
|
||||
|
||||
#define DAHDI_GETGAINS _IOR (DAHDI_CODE, 16, struct zt_gains) /* Get Channel audio gains */
|
||||
#define DAHDI_SETGAINS _IOW (DAHDI_CODE, 16, struct zt_gains) /* Set Channel audio gains */
|
||||
#define DAHDI_SPANCONFIG _IOW (DAHDI_CODE, 18, struct zt_lineconfig)/* Set Line (T1) Configurations and start system */
|
||||
#define DAHDI_CHANCONFIG _IOW (DAHDI_CODE, 19, struct zt_chanconfig)/* Set Channel Configuration */
|
||||
#define DAHDI_SET_BUFINFO _IOW (DAHDI_CODE, 27, struct zt_bufferinfo)/* Set buffer policy */
|
||||
#define DAHDI_GET_BUFINFO _IOR (DAHDI_CODE, 27, struct zt_bufferinfo)/* Get current buffer info */
|
||||
#define DAHDI_AUDIOMODE _IOW (DAHDI_CODE, 32, int) /* Set a clear channel into audio mode */
|
||||
#define DAHDI_ECHOCANCEL _IOW (DAHDI_CODE, 33, int) /* Control Echo Canceller */
|
||||
#define DAHDI_HDLCRAWMODE _IOW (DAHDI_CODE, 36, int) /* Set a clear channel into HDLC w/out FCS checking/calculation mode */
|
||||
#define DAHDI_HDLCFCSMODE _IOW (DAHDI_CODE, 37, int) /* Set a clear channel into HDLC w/ FCS mode */
|
||||
|
||||
/* Specify a channel on /dev/dahdi/chan -- must be done before any other ioctl's and is only valid on /dev/dahdi/chan */
|
||||
#define DAHDI_SPECIFY _IOW (DAHDI_CODE, 38, int)
|
||||
|
||||
/* Temporarily set the law on a channel to DAHDI_LAW_DEFAULT, DAHDI_LAW_ALAW, or DAHDI_LAW_MULAW. Is reset on close. */
|
||||
#define DAHDI_SETLAW _IOW (DAHDI_CODE, 39, int)
|
||||
|
||||
/* Temporarily set the channel to operate in linear mode when non-zero or default law if 0 */
|
||||
#define DAHDI_SETLINEAR _IOW (DAHDI_CODE, 40, int)
|
||||
|
||||
#define DAHDI_GETCONFMUTE _IOR (DAHDI_CODE, 49, int) /* Get Conference to mute mode */
|
||||
#define DAHDI_ECHOTRAIN _IOW (DAHDI_CODE, 50, int) /* Control Echo Trainer */
|
||||
|
||||
/* Set/Get CAS bits */
|
||||
#define DAHDI_SETTXBITS _IOW (DAHDI_CODE, 43, int)
|
||||
#define DAHDI_GETRXBITS _IOR (DAHDI_CODE, 43, int)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
104
libs/freetdm/src/g711.c
Normal file
104
libs/freetdm/src/g711.c
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* g711.c - A-law and u-law transcoding routines
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2006 Steve Underwood
|
||||
*
|
||||
* Despite my general liking of the GPL, I place this code in the
|
||||
* public domain for the benefit of all mankind - even the slimy
|
||||
* ones who might try to proprietize my work and use it to my
|
||||
* detriment.
|
||||
*
|
||||
* $Id: g711.c,v 1.1 2006/06/07 15:46:39 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <inttypes.h>
|
||||
#ifdef HAVE_TGMATH_H
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "g711.h"
|
||||
|
||||
/* Copied from the CCITT G.711 specification */
|
||||
static const uint8_t ulaw_to_alaw_table[256] =
|
||||
{
|
||||
42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
|
||||
58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53,
|
||||
10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 26,
|
||||
27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106,
|
||||
104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120,
|
||||
126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77,
|
||||
66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93,
|
||||
82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85,
|
||||
170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
|
||||
186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181,
|
||||
138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154,
|
||||
155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234,
|
||||
232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248,
|
||||
254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205,
|
||||
194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221,
|
||||
210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213
|
||||
};
|
||||
|
||||
/* These transcoding tables are copied from the CCITT G.711 specification. To achieve
|
||||
optimal results, do not change them. */
|
||||
|
||||
static const uint8_t alaw_to_ulaw_table[256] =
|
||||
{
|
||||
42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
|
||||
57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 47, 48, 53, 54, 51, 52,
|
||||
10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5,
|
||||
26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21,
|
||||
98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94,
|
||||
116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109,
|
||||
72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67,
|
||||
86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81,
|
||||
170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
|
||||
185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180,
|
||||
138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133,
|
||||
154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149,
|
||||
226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222,
|
||||
244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237,
|
||||
200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195,
|
||||
214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209
|
||||
};
|
||||
|
||||
uint8_t alaw_to_ulaw(uint8_t alaw)
|
||||
{
|
||||
return alaw_to_ulaw_table[alaw];
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
uint8_t ulaw_to_alaw(uint8_t ulaw)
|
||||
{
|
||||
return ulaw_to_alaw_table[ulaw];
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
340
libs/freetdm/src/hashtable.c
Normal file
340
libs/freetdm/src/hashtable.c
Normal file
@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Copyright (c) 2002, Christopher Clark
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "hashtable.h"
|
||||
#include "hashtable_private.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
Credit for primes table: Aaron Krowne
|
||||
http://br.endernet.org/~akrowne/
|
||||
http://planetmath.org/encyclopedia/GoodHashTablePrimes.html
|
||||
*/
|
||||
static const unsigned int primes[] = {
|
||||
53, 97, 193, 389,
|
||||
769, 1543, 3079, 6151,
|
||||
12289, 24593, 49157, 98317,
|
||||
196613, 393241, 786433, 1572869,
|
||||
3145739, 6291469, 12582917, 25165843,
|
||||
50331653, 100663319, 201326611, 402653189,
|
||||
805306457, 1610612741
|
||||
};
|
||||
const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
|
||||
const float max_load_factor = 0.65f;
|
||||
|
||||
/*****************************************************************************/
|
||||
FT_DECLARE(struct hashtable *)
|
||||
create_hashtable(unsigned int minsize,
|
||||
unsigned int (*hashf) (void*),
|
||||
int (*eqf) (void*,void*))
|
||||
{
|
||||
struct hashtable *h;
|
||||
unsigned int pindex, size = primes[0];
|
||||
/* Check requested hashtable isn't too large */
|
||||
if (minsize > (1u << 30)) return NULL;
|
||||
/* Enforce size as prime */
|
||||
for (pindex=0; pindex < prime_table_length; pindex++) {
|
||||
if (primes[pindex] > minsize) { size = primes[pindex]; break; }
|
||||
}
|
||||
h = (struct hashtable *)ftdm_malloc(sizeof(struct hashtable));
|
||||
if (NULL == h) return NULL; /*oom*/
|
||||
h->table = (struct entry **)ftdm_malloc(sizeof(struct entry*) * size);
|
||||
if (NULL == h->table) { ftdm_safe_free(h); return NULL; } /*oom*/
|
||||
memset(h->table, 0, size * sizeof(struct entry *));
|
||||
h->tablelength = size;
|
||||
h->primeindex = pindex;
|
||||
h->entrycount = 0;
|
||||
h->hashfn = hashf;
|
||||
h->eqfn = eqf;
|
||||
h->loadlimit = (unsigned int) ceil(size * max_load_factor);
|
||||
return h;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
unsigned int
|
||||
hash(struct hashtable *h, void *k)
|
||||
{
|
||||
/* Aim to protect against poor hash functions by adding logic here
|
||||
* - logic taken from java 1.4 hashtable source */
|
||||
unsigned int i = h->hashfn(k);
|
||||
i += ~(i << 9);
|
||||
i ^= ((i >> 14) | (i << 18)); /* >>> */
|
||||
i += (i << 4);
|
||||
i ^= ((i >> 10) | (i << 22)); /* >>> */
|
||||
return i;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
hashtable_expand(struct hashtable *h)
|
||||
{
|
||||
/* Double the size of the table to accomodate more entries */
|
||||
struct entry **newtable;
|
||||
struct entry *e;
|
||||
struct entry **pE;
|
||||
unsigned int newsize, i, index;
|
||||
/* Check we're not hitting max capacity */
|
||||
if (h->primeindex == (prime_table_length - 1)) return 0;
|
||||
newsize = primes[++(h->primeindex)];
|
||||
|
||||
newtable = (struct entry **)ftdm_malloc(sizeof(struct entry*) * newsize);
|
||||
if (NULL != newtable)
|
||||
{
|
||||
memset(newtable, 0, newsize * sizeof(struct entry *));
|
||||
/* This algorithm is not 'stable'. ie. it reverses the list
|
||||
* when it transfers entries between the tables */
|
||||
for (i = 0; i < h->tablelength; i++) {
|
||||
while (NULL != (e = h->table[i])) {
|
||||
h->table[i] = e->next;
|
||||
index = indexFor(newsize,e->h);
|
||||
e->next = newtable[index];
|
||||
newtable[index] = e;
|
||||
}
|
||||
}
|
||||
ftdm_safe_free(h->table);
|
||||
h->table = newtable;
|
||||
}
|
||||
/* Plan B: realloc instead */
|
||||
else
|
||||
{
|
||||
newtable = (struct entry **)
|
||||
realloc(h->table, newsize * sizeof(struct entry *));
|
||||
if (NULL == newtable) { (h->primeindex)--; return 0; }
|
||||
h->table = newtable;
|
||||
memset(newtable[h->tablelength], 0, newsize - h->tablelength);
|
||||
for (i = 0; i < h->tablelength; i++) {
|
||||
for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {
|
||||
index = indexFor(newsize,e->h);
|
||||
if (index == i)
|
||||
{
|
||||
pE = &(e->next);
|
||||
}
|
||||
else
|
||||
{
|
||||
*pE = e->next;
|
||||
e->next = newtable[index];
|
||||
newtable[index] = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
h->tablelength = newsize;
|
||||
h->loadlimit = (unsigned int) ceil(newsize * max_load_factor);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
FT_DECLARE(unsigned int)
|
||||
hashtable_count(struct hashtable *h)
|
||||
{
|
||||
return h->entrycount;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
FT_DECLARE(int)
|
||||
hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags)
|
||||
{
|
||||
/* This method allows duplicate keys - but they shouldn't be used */
|
||||
unsigned int index;
|
||||
struct entry *e;
|
||||
if (++(h->entrycount) > h->loadlimit)
|
||||
{
|
||||
/* Ignore the return value. If expand fails, we should
|
||||
* still try cramming just this value into the existing table
|
||||
* -- we may not have memory for a larger table, but one more
|
||||
* element may be ok. Next time we insert, we'll try expanding again.*/
|
||||
hashtable_expand(h);
|
||||
}
|
||||
e = (struct entry *)ftdm_malloc(sizeof(struct entry));
|
||||
if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
|
||||
e->h = hash(h,k);
|
||||
index = indexFor(h->tablelength,e->h);
|
||||
e->k = k;
|
||||
e->v = v;
|
||||
e->flags = flags;
|
||||
e->next = h->table[index];
|
||||
h->table[index] = e;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
FT_DECLARE(void *) /* returns value associated with key */
|
||||
hashtable_search(struct hashtable *h, void *k)
|
||||
{
|
||||
struct entry *e;
|
||||
unsigned int hashvalue, index;
|
||||
hashvalue = hash(h,k);
|
||||
index = indexFor(h->tablelength,hashvalue);
|
||||
e = h->table[index];
|
||||
while (NULL != e)
|
||||
{
|
||||
/* Check hash value to short circuit heavier comparison */
|
||||
if ((hashvalue == e->h) && (h->eqfn(k, e->k))) return e->v;
|
||||
e = e->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
FT_DECLARE(void *) /* returns value associated with key */
|
||||
hashtable_remove(struct hashtable *h, void *k)
|
||||
{
|
||||
/* TODO: consider compacting the table when the load factor drops enough,
|
||||
* or provide a 'compact' method. */
|
||||
|
||||
struct entry *e;
|
||||
struct entry **pE;
|
||||
void *v;
|
||||
unsigned int hashvalue, index;
|
||||
|
||||
hashvalue = hash(h,k);
|
||||
index = indexFor(h->tablelength,hash(h,k));
|
||||
pE = &(h->table[index]);
|
||||
e = *pE;
|
||||
while (NULL != e)
|
||||
{
|
||||
/* Check hash value to short circuit heavier comparison */
|
||||
if ((hashvalue == e->h) && (h->eqfn(k, e->k)))
|
||||
{
|
||||
*pE = e->next;
|
||||
h->entrycount--;
|
||||
v = e->v;
|
||||
if (e->flags & HASHTABLE_FLAG_FREE_KEY) {
|
||||
freekey(e->k);
|
||||
}
|
||||
ftdm_safe_free(e);
|
||||
return v;
|
||||
}
|
||||
pE = &(e->next);
|
||||
e = e->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* destroy */
|
||||
FT_DECLARE(void)
|
||||
hashtable_destroy(struct hashtable *h)
|
||||
{
|
||||
unsigned int i;
|
||||
struct entry *e, *f;
|
||||
struct entry **table = h->table;
|
||||
|
||||
for (i = 0; i < h->tablelength; i++)
|
||||
{
|
||||
e = table[i];
|
||||
while (NULL != e)
|
||||
{ f = e; e = e->next; if (f->flags & HASHTABLE_FLAG_FREE_KEY) freekey(f->k); if (f->flags & HASHTABLE_FLAG_FREE_VALUE) ftdm_safe_free(f->v); ftdm_safe_free(f); }
|
||||
}
|
||||
|
||||
ftdm_safe_free(h->table);
|
||||
ftdm_safe_free(h);
|
||||
}
|
||||
|
||||
FT_DECLARE(struct hashtable_iterator *) hashtable_next(struct hashtable_iterator *i)
|
||||
{
|
||||
|
||||
if (i->e) {
|
||||
if ((i->e = i->e->next) != 0) {
|
||||
return i;
|
||||
} else {
|
||||
i->pos++;
|
||||
}
|
||||
}
|
||||
|
||||
while(i->pos < i->h->tablelength && !i->h->table[i->pos]) {
|
||||
i->pos++;
|
||||
}
|
||||
|
||||
if (i->pos >= i->h->tablelength) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((i->e = i->h->table[i->pos]) != 0) {
|
||||
return i;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FT_DECLARE(struct hashtable_iterator *) hashtable_first(struct hashtable *h)
|
||||
{
|
||||
h->iterator.pos = 0;
|
||||
h->iterator.e = NULL;
|
||||
h->iterator.h = h;
|
||||
return hashtable_next(&h->iterator);
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_DECLARE(void) hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val)
|
||||
{
|
||||
if (i->e) {
|
||||
if (key) {
|
||||
*key = i->e->k;
|
||||
}
|
||||
if (klen) {
|
||||
*klen = (int)strlen(i->e->k);
|
||||
}
|
||||
if (val) {
|
||||
*val = i->e->v;
|
||||
}
|
||||
} else {
|
||||
if (key) {
|
||||
*key = NULL;
|
||||
}
|
||||
if (klen) {
|
||||
*klen = 0;
|
||||
}
|
||||
if (val) {
|
||||
*val = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
186
libs/freetdm/src/hashtable_itr.c
Normal file
186
libs/freetdm/src/hashtable_itr.c
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2004, Christopher Clark
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "freetdm.h"
|
||||
#include "hashtable.h"
|
||||
#include "hashtable_private.h"
|
||||
#include "hashtable_itr.h"
|
||||
#include <stdlib.h> /* defines NULL */
|
||||
|
||||
/*****************************************************************************/
|
||||
/* hashtable_iterator - iterator constructor */
|
||||
|
||||
struct hashtable_itr *
|
||||
hashtable_iterator(struct hashtable *h)
|
||||
{
|
||||
unsigned int i, tablelength;
|
||||
struct hashtable_itr *itr = ftdm_malloc(sizeof(struct hashtable_itr));
|
||||
if (NULL == itr) return NULL;
|
||||
itr->h = h;
|
||||
itr->e = NULL;
|
||||
itr->parent = NULL;
|
||||
tablelength = h->tablelength;
|
||||
itr->index = tablelength;
|
||||
if (0 == h->entrycount) return itr;
|
||||
|
||||
for (i = 0; i < tablelength; i++)
|
||||
{
|
||||
if (NULL != h->table[i])
|
||||
{
|
||||
itr->e = h->table[i];
|
||||
itr->index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return itr;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* advance - advance the iterator to the next element
|
||||
* returns zero if advanced to end of table */
|
||||
|
||||
int
|
||||
hashtable_iterator_advance(struct hashtable_itr *itr)
|
||||
{
|
||||
unsigned int j,tablelength;
|
||||
struct entry **table;
|
||||
struct entry *next;
|
||||
if (NULL == itr->e) return 0; /* stupidity check */
|
||||
|
||||
next = itr->e->next;
|
||||
if (NULL != next)
|
||||
{
|
||||
itr->parent = itr->e;
|
||||
itr->e = next;
|
||||
return -1;
|
||||
}
|
||||
tablelength = itr->h->tablelength;
|
||||
itr->parent = NULL;
|
||||
if (tablelength <= (j = ++(itr->index)))
|
||||
{
|
||||
itr->e = NULL;
|
||||
return 0;
|
||||
}
|
||||
table = itr->h->table;
|
||||
while (NULL == (next = table[j]))
|
||||
{
|
||||
if (++j >= tablelength)
|
||||
{
|
||||
itr->index = tablelength;
|
||||
itr->e = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
itr->index = j;
|
||||
itr->e = next;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* remove - remove the entry at the current iterator position
|
||||
* and advance the iterator, if there is a successive
|
||||
* element.
|
||||
* If you want the value, read it before you remove:
|
||||
* beware memory leaks if you don't.
|
||||
* Returns zero if end of iteration. */
|
||||
|
||||
int
|
||||
hashtable_iterator_remove(struct hashtable_itr *itr)
|
||||
{
|
||||
struct entry *remember_e, *remember_parent;
|
||||
int ret;
|
||||
|
||||
/* Do the removal */
|
||||
if (NULL == (itr->parent))
|
||||
{
|
||||
/* element is head of a chain */
|
||||
itr->h->table[itr->index] = itr->e->next;
|
||||
} else {
|
||||
/* element is mid-chain */
|
||||
itr->parent->next = itr->e->next;
|
||||
}
|
||||
/* itr->e is now outside the hashtable */
|
||||
remember_e = itr->e;
|
||||
itr->h->entrycount--;
|
||||
freekey(remember_e->k);
|
||||
|
||||
/* Advance the iterator, correcting the parent */
|
||||
remember_parent = itr->parent;
|
||||
ret = hashtable_iterator_advance(itr);
|
||||
if (itr->parent == remember_e) { itr->parent = remember_parent; }
|
||||
ftdm_safe_free(remember_e);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int /* returns zero if not found */
|
||||
hashtable_iterator_search(struct hashtable_itr *itr,
|
||||
struct hashtable *h, void *k)
|
||||
{
|
||||
struct entry *e, *parent;
|
||||
unsigned int hashvalue, index;
|
||||
|
||||
hashvalue = hash(h,k);
|
||||
index = indexFor(h->tablelength,hashvalue);
|
||||
|
||||
e = h->table[index];
|
||||
parent = NULL;
|
||||
while (NULL != e)
|
||||
{
|
||||
/* Check hash value to short circuit heavier comparison */
|
||||
if ((hashvalue == e->h) && (h->eqfn(k, e->k)))
|
||||
{
|
||||
itr->index = index;
|
||||
itr->e = e;
|
||||
itr->parent = parent;
|
||||
itr->h = h;
|
||||
return -1;
|
||||
}
|
||||
parent = e;
|
||||
e = e->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
968
libs/freetdm/src/include/freetdm.h
Normal file
968
libs/freetdm/src/include/freetdm.h
Normal file
@ -0,0 +1,968 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributors:
|
||||
*
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FREETDM_H
|
||||
#define FREETDM_H
|
||||
|
||||
|
||||
#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__)
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRINGS_H
|
||||
#define HAVE_STRINGS_H 1
|
||||
#endif
|
||||
#ifndef HAVE_SYS_SOCKET_H
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#if defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32) || defined(_WIN64)
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(FT_DECLARE_STATIC)
|
||||
#define FT_DECLARE(type) type __stdcall
|
||||
#define FT_DECLARE_NONSTD(type) type __cdecl
|
||||
#define FT_DECLARE_DATA
|
||||
#elif defined(FREETDM_EXPORTS)
|
||||
#define FT_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define FT_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||
#define FT_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define FT_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define FT_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||
#define FT_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
#define EX_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
|
||||
#define FT_DECLARE(type) __attribute__((visibility("default"))) type
|
||||
#define FT_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
|
||||
#define FT_DECLARE_DATA __attribute__((visibility("default")))
|
||||
#else
|
||||
#define FT_DECLARE(type) type
|
||||
#define FT_DECLARE_NONSTD(type) type
|
||||
#define FT_DECLARE_DATA
|
||||
#endif
|
||||
#define EX_DECLARE_DATA
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
#if (_MSC_VER >= 1400) /* VC8+ */
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
#ifndef _CRT_NONSTDC_NO_DEPRECATE
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE
|
||||
#endif
|
||||
#endif
|
||||
#ifndef strcasecmp
|
||||
#define strcasecmp(s1, s2) _stricmp(s1, s2)
|
||||
#endif
|
||||
#ifndef strncasecmp
|
||||
#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n)
|
||||
#endif
|
||||
#ifndef snprintf
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR _S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#endif
|
||||
#undef HAVE_STRINGS_H
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
/* disable warning for zero length array in a struct */
|
||||
/* this will cause errors on c99 and ansi compliant compilers and will need to be fixed in the wanpipe header files */
|
||||
#pragma warning(disable:4706)
|
||||
#pragma comment(lib, "Winmm")
|
||||
#endif
|
||||
|
||||
#define FTDM_THREAD_STACKSIZE 240 * 1024
|
||||
#define FTDM_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL };
|
||||
#define FTDM_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) FT_DECLARE(_TYPE) _FUNC1 (const char *name); FT_DECLARE(const char *) _FUNC2 (_TYPE type);
|
||||
#define FTDM_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \
|
||||
FT_DECLARE(_TYPE) _FUNC1 (const char *name) \
|
||||
{ \
|
||||
int i; \
|
||||
_TYPE t = _MAX ; \
|
||||
\
|
||||
for (i = 0; i < _MAX ; i++) { \
|
||||
if (!strcasecmp(name, _STRINGS[i])) { \
|
||||
t = (_TYPE) i; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return t; \
|
||||
} \
|
||||
FT_DECLARE(const char *) _FUNC2 (_TYPE type) \
|
||||
{ \
|
||||
if (type > _MAX) { \
|
||||
type = _MAX; \
|
||||
} \
|
||||
return _STRINGS[(int)type]; \
|
||||
} \
|
||||
|
||||
#define ftdm_true(expr) \
|
||||
(expr && ( !strcasecmp(expr, "yes") || \
|
||||
!strcasecmp(expr, "on") || \
|
||||
!strcasecmp(expr, "true") || \
|
||||
!strcasecmp(expr, "enabled") || \
|
||||
!strcasecmp(expr, "active") || \
|
||||
atoi(expr))) ? 1 : 0
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#ifndef __WINDOWS__
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include "ftdm_types.h"
|
||||
#include "hashtable.h"
|
||||
#include "ftdm_config.h"
|
||||
#include "g711.h"
|
||||
#include "libteletone.h"
|
||||
#include "ftdm_buffer.h"
|
||||
#include "ftdm_threadmutex.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#define ftdm_sleep(x) Sleep(x)
|
||||
#else
|
||||
#define ftdm_sleep(x) usleep(x * 1000)
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#undef assert
|
||||
#define assert(_Expression) ((void)(_Expression))
|
||||
#endif
|
||||
|
||||
#define FTDM_MAX_CHANNELS_PHYSICAL_SPAN 32
|
||||
#define FTDM_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN 32
|
||||
#define FTDM_MAX_CHANNELS_SPAN FTDM_MAX_CHANNELS_PHYSICAL_SPAN * FTDM_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN
|
||||
#define FTDM_MAX_SPANS_INTERFACE 128
|
||||
|
||||
#define FTDM_MAX_CHANNELS_GROUP 1024
|
||||
#define FTDM_MAX_GROUPS_INTERFACE FTDM_MAX_SPANS_INTERFACE
|
||||
|
||||
#define GOTO_STATUS(label,st) status = st; goto label ;
|
||||
|
||||
#define ftdm_copy_string(x,y,z) strncpy(x, y, z - 1)
|
||||
#define ftdm_set_string(x,y) strncpy(x, y, sizeof(x)-1)
|
||||
#define ftdm_strlen_zero(s) (!s || *s == '\0')
|
||||
#define ftdm_strlen_zero_buf(s) (*s == '\0')
|
||||
|
||||
|
||||
#define ftdm_channel_test_feature(obj, flag) ((obj)->features & flag)
|
||||
#define ftdm_channel_set_feature(obj, flag) (obj)->features |= (flag)
|
||||
#define ftdm_channel_clear_feature(obj, flag) (obj)->features &= ~(flag)
|
||||
#define ftdm_channel_set_member_locked(obj, _m, _v) ftdm_mutex_lock(obj->mutex); obj->_m = _v; ftdm_mutex_unlock(obj->mutex)
|
||||
|
||||
/*!
|
||||
\brief Test for the existance of a flag on an arbitary object
|
||||
\command obj the object to test
|
||||
\command flag the or'd list of flags to test
|
||||
\return true value if the object has the flags defined
|
||||
*/
|
||||
#define ftdm_test_flag(obj, flag) ((obj)->flags & flag)
|
||||
#define ftdm_test_pflag(obj, flag) ((obj)->pflags & flag)
|
||||
#define ftdm_test_sflag(obj, flag) ((obj)->sflags & flag)
|
||||
|
||||
|
||||
#define ftdm_set_alarm_flag(obj, flag) (obj)->alarm_flags |= (flag)
|
||||
#define ftdm_clear_alarm_flag(obj, flag) (obj)->alarm_flags &= ~(flag)
|
||||
#define ftdm_test_alarm_flag(obj, flag) ((obj)->alarm_flags & flag)
|
||||
|
||||
/*!
|
||||
\brief Set a flag on an arbitrary object
|
||||
\command obj the object to set the flags on
|
||||
\command flag the or'd list of flags to set
|
||||
*/
|
||||
#define ftdm_set_flag(obj, flag) (obj)->flags |= (flag)
|
||||
#define ftdm_set_flag_locked(obj, flag) assert(obj->mutex != NULL); \
|
||||
ftdm_mutex_lock(obj->mutex); \
|
||||
(obj)->flags |= (flag); \
|
||||
ftdm_mutex_unlock(obj->mutex);
|
||||
|
||||
#define ftdm_set_pflag(obj, flag) (obj)->pflags |= (flag)
|
||||
#define ftdm_set_pflag_locked(obj, flag) assert(obj->mutex != NULL); \
|
||||
ftdm_mutex_lock(obj->mutex); \
|
||||
(obj)->pflags |= (flag); \
|
||||
ftdm_mutex_unlock(obj->mutex);
|
||||
|
||||
#define ftdm_set_sflag(obj, flag) (obj)->sflags |= (flag)
|
||||
#define ftdm_set_sflag_locked(obj, flag) assert(obj->mutex != NULL); \
|
||||
ftdm_mutex_lock(obj->mutex); \
|
||||
(obj)->sflags |= (flag); \
|
||||
ftdm_mutex_unlock(obj->mutex);
|
||||
|
||||
/*!
|
||||
\brief Clear a flag on an arbitrary object while locked
|
||||
\command obj the object to test
|
||||
\command flag the or'd list of flags to clear
|
||||
*/
|
||||
#define ftdm_clear_flag(obj, flag) (obj)->flags &= ~(flag)
|
||||
|
||||
#define ftdm_clear_flag_locked(obj, flag) assert(obj->mutex != NULL); ftdm_mutex_lock(obj->mutex); (obj)->flags &= ~(flag); ftdm_mutex_unlock(obj->mutex);
|
||||
|
||||
#define ftdm_clear_pflag(obj, flag) (obj)->pflags &= ~(flag)
|
||||
|
||||
#define ftdm_clear_pflag_locked(obj, flag) assert(obj->mutex != NULL); ftdm_mutex_lock(obj->mutex); (obj)->pflags &= ~(flag); ftdm_mutex_unlock(obj->mutex);
|
||||
|
||||
#define ftdm_clear_sflag(obj, flag) (obj)->sflags &= ~(flag)
|
||||
|
||||
#define ftdm_clear_sflag_locked(obj, flag) assert(obj->mutex != NULL); ftdm_mutex_lock(obj->mutex); (obj)->sflags &= ~(flag); ftdm_mutex_unlock(obj->mutex);
|
||||
|
||||
|
||||
#define ftdm_set_state_locked(obj, s) if ( obj->state == s ) { \
|
||||
ftdm_log(FTDM_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(obj->state), ftdm_channel_state2str(s)); \
|
||||
} else if (ftdm_test_flag(obj, FTDM_CHANNEL_READY)) { \
|
||||
ftdm_channel_state_t st = obj->state; \
|
||||
ftdm_channel_set_state(obj, s, 1); \
|
||||
if (obj->state == s) ftdm_log(FTDM_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(st), ftdm_channel_state2str(s)); \
|
||||
else ftdm_log(FTDM_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(st), ftdm_channel_state2str(s)); \
|
||||
}
|
||||
|
||||
#define ftdm_set_state(obj, s) if ( obj->state == s ) { \
|
||||
ftdm_log(FTDM_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(obj->state), ftdm_channel_state2str(s)); \
|
||||
} else if (ftdm_test_flag(obj, FTDM_CHANNEL_READY)) { \
|
||||
ftdm_channel_state_t st = obj->state; \
|
||||
ftdm_channel_set_state(obj, s, 0); \
|
||||
if (obj->state == s) ftdm_log(FTDM_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(st), ftdm_channel_state2str(s)); \
|
||||
else ftdm_log(FTDM_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(st), ftdm_channel_state2str(s)); \
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* The while(0) below throws a conditional expression is constant warning */
|
||||
#pragma warning(disable:4127)
|
||||
#endif
|
||||
|
||||
#define ftdm_set_state_locked_wait(obj, s) \
|
||||
do { \
|
||||
int __safety = 100; \
|
||||
ftdm_set_state_locked(obj, s); \
|
||||
while(__safety-- && ftdm_test_flag(obj, FTDM_CHANNEL_STATE_CHANGE)) { \
|
||||
ftdm_sleep(10); \
|
||||
} \
|
||||
if(!__safety) { \
|
||||
ftdm_log(FTDM_LOG_CRIT, "State change not completed\n"); \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define ftdm_wait_for_flag_cleared(obj, flag, time) \
|
||||
do { \
|
||||
int __safety = time; \
|
||||
while(__safety-- && ftdm_test_flag(obj, flag)) { \
|
||||
ftdm_mutex_unlock(obj->mutex); \
|
||||
ftdm_sleep(10); \
|
||||
ftdm_mutex_lock(obj->mutex); \
|
||||
} \
|
||||
if(!__safety) { \
|
||||
ftdm_log(FTDM_LOG_CRIT, "flag %d was never cleared\n", flag); \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define ftdm_set_state_wait(obj, s) \
|
||||
do { \
|
||||
ftdm_channel_set_state(obj, s, 0); \
|
||||
ftdm_wait_for_flag_cleared(obj, FTDM_CHANNEL_STATE_CHANGE, 100); \
|
||||
} while(0);
|
||||
|
||||
|
||||
typedef enum {
|
||||
FTDM_STATE_CHANGE_FAIL,
|
||||
FTDM_STATE_CHANGE_SUCCESS,
|
||||
FTDM_STATE_CHANGE_SAME,
|
||||
} ftdm_state_change_result_t;
|
||||
|
||||
#define ftdm_set_state_r(obj, s, l, r) if ( obj->state == s ) { \
|
||||
if (s != FTDM_CHANNEL_STATE_HANGUP) ftdm_log(FTDM_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(obj->state), ftdm_channel_state2str(s)); r = FTDM_STATE_CHANGE_SAME; \
|
||||
} else if (ftdm_test_flag(obj, FTDM_CHANNEL_READY)) { \
|
||||
int st = obj->state; \
|
||||
r = (ftdm_channel_set_state(obj, s, l) == FTDM_SUCCESS) ? FTDM_STATE_CHANGE_SUCCESS : FTDM_STATE_CHANGE_FAIL; \
|
||||
if (obj->state == s) {ftdm_log(FTDM_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(st), ftdm_channel_state2str(s));} \
|
||||
else ftdm_log(FTDM_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, ftdm_channel_state2str(st), ftdm_channel_state2str(s)); \
|
||||
}
|
||||
|
||||
|
||||
#define ftdm_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119)
|
||||
|
||||
/*!
|
||||
\brief Copy flags from one arbitrary object to another
|
||||
\command dest the object to copy the flags to
|
||||
\command src the object to copy the flags from
|
||||
\command flags the flags to copy
|
||||
*/
|
||||
#define ftdm_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags))
|
||||
|
||||
struct ftdm_stream_handle {
|
||||
ftdm_stream_handle_write_function_t write_function;
|
||||
ftdm_stream_handle_raw_write_function_t raw_write_function;
|
||||
void *data;
|
||||
void *end;
|
||||
ftdm_size_t data_size;
|
||||
ftdm_size_t data_len;
|
||||
ftdm_size_t alloc_len;
|
||||
ftdm_size_t alloc_chunk;
|
||||
};
|
||||
|
||||
|
||||
FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_raw_write(ftdm_stream_handle_t *handle, uint8_t *data, ftdm_size_t datalen);
|
||||
FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_write(ftdm_stream_handle_t *handle, const char *fmt, ...);
|
||||
|
||||
#define FTDM_CMD_CHUNK_LEN 1024
|
||||
#define FTDM_STANDARD_STREAM(s) memset(&s, 0, sizeof(s)); s.data = malloc(FTDM_CMD_CHUNK_LEN); \
|
||||
assert(s.data); \
|
||||
memset(s.data, 0, FTDM_CMD_CHUNK_LEN); \
|
||||
s.end = s.data; \
|
||||
s.data_size = FTDM_CMD_CHUNK_LEN; \
|
||||
s.write_function = ftdm_console_stream_write; \
|
||||
s.raw_write_function = ftdm_console_stream_raw_write; \
|
||||
s.alloc_len = FTDM_CMD_CHUNK_LEN; \
|
||||
s.alloc_chunk = FTDM_CMD_CHUNK_LEN
|
||||
|
||||
struct ftdm_event {
|
||||
ftdm_event_type_t e_type;
|
||||
uint32_t enum_id;
|
||||
ftdm_channel_t *channel;
|
||||
void *data;
|
||||
};
|
||||
|
||||
typedef struct ftdm_queue ftdm_queue_t;
|
||||
typedef ftdm_status_t (*ftdm_queue_create_func_t)(ftdm_queue_t **queue, ftdm_size_t capacity);
|
||||
typedef ftdm_status_t (*ftdm_queue_enqueue_func_t)(ftdm_queue_t *queue, void *obj);
|
||||
typedef void *(*ftdm_queue_dequeue_func_t)(ftdm_queue_t *queue);
|
||||
typedef ftdm_status_t (*ftdm_queue_wait_func_t)(ftdm_queue_t *queue, int ms);
|
||||
typedef ftdm_status_t (*ftdm_queue_get_interrupt_func_t)(ftdm_queue_t *queue, ftdm_interrupt_t **interrupt);
|
||||
typedef ftdm_status_t (*ftdm_queue_destroy_func_t)(ftdm_queue_t **queue);
|
||||
typedef struct ftdm_queue_handler {
|
||||
ftdm_queue_create_func_t create;
|
||||
ftdm_queue_enqueue_func_t enqueue;
|
||||
ftdm_queue_dequeue_func_t dequeue;
|
||||
ftdm_queue_wait_func_t wait;
|
||||
ftdm_queue_get_interrupt_func_t get_interrupt;
|
||||
ftdm_queue_destroy_func_t destroy;
|
||||
} ftdm_queue_handler_t;
|
||||
FT_DECLARE_DATA extern ftdm_queue_handler_t g_ftdm_queue_handler;
|
||||
|
||||
/*! brief create a new queue */
|
||||
#define ftdm_queue_create(queue, capacity) g_ftdm_queue_handler.create(queue, capacity)
|
||||
|
||||
/*! Enqueue an object */
|
||||
#define ftdm_queue_enqueue(queue, obj) g_ftdm_queue_handler.enqueue(queue, obj)
|
||||
|
||||
/*! dequeue an object from the queue */
|
||||
#define ftdm_queue_dequeue(queue) g_ftdm_queue_handler.dequeue(queue)
|
||||
|
||||
/*! wait ms milliseconds for a queue to have available objects, -1 to wait forever */
|
||||
#define ftdm_queue_wait(queue, ms) g_ftdm_queue_handler.wait(queue, ms)
|
||||
|
||||
/*! get the internal interrupt object (to wait for elements to be added from the outside bypassing ftdm_queue_wait) */
|
||||
#define ftdm_queue_get_interrupt(queue, ms) g_ftdm_queue_handler.get_interrupt(queue, ms)
|
||||
|
||||
/*! destroy the queue */
|
||||
#define ftdm_queue_destroy(queue) g_ftdm_queue_handler.destroy(queue)
|
||||
|
||||
|
||||
#define FTDM_TOKEN_STRLEN 128
|
||||
#define FTDM_MAX_TOKENS 10
|
||||
|
||||
static __inline__ char *ftdm_clean_string(char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = s; p && *p; p++) {
|
||||
uint8_t x = (uint8_t) *p;
|
||||
if (x < 32 || x > 127) {
|
||||
*p = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
struct ftdm_bitstream {
|
||||
uint8_t *data;
|
||||
uint32_t datalen;
|
||||
uint32_t byte_index;
|
||||
uint8_t bit_index;
|
||||
int8_t endian;
|
||||
uint8_t top;
|
||||
uint8_t bot;
|
||||
uint8_t ss;
|
||||
uint8_t ssv;
|
||||
};
|
||||
|
||||
struct ftdm_fsk_data_state {
|
||||
dsp_fsk_handle_t *fsk1200_handle;
|
||||
uint8_t init;
|
||||
uint8_t *buf;
|
||||
size_t bufsize;
|
||||
ftdm_size_t blen;
|
||||
ftdm_size_t bpos;
|
||||
ftdm_size_t dlen;
|
||||
ftdm_size_t ppos;
|
||||
int checksum;
|
||||
};
|
||||
|
||||
struct ftdm_fsk_modulator {
|
||||
teletone_dds_state_t dds;
|
||||
ftdm_bitstream_t bs;
|
||||
uint32_t carrier_bits_start;
|
||||
uint32_t carrier_bits_stop;
|
||||
uint32_t chan_sieze_bits;
|
||||
uint32_t bit_factor;
|
||||
uint32_t bit_accum;
|
||||
uint32_t sample_counter;
|
||||
int32_t samples_per_bit;
|
||||
int32_t est_bytes;
|
||||
fsk_modem_types_t modem_type;
|
||||
ftdm_fsk_data_state_t *fsk_data;
|
||||
ftdm_fsk_write_sample_t write_sample_callback;
|
||||
void *user_data;
|
||||
int16_t sample_buffer[64];
|
||||
};
|
||||
|
||||
/**
|
||||
* Type Of Number (TON)
|
||||
*/
|
||||
typedef enum {
|
||||
FTDM_TON_UNKNOWN = 0,
|
||||
FTDM_TON_INTERNATIONAL,
|
||||
FTDM_TON_NATIONAL,
|
||||
FTDM_TON_NETWORK_SPECIFIC,
|
||||
FTDM_TON_SUBSCRIBER_NUMBER,
|
||||
FTDM_TON_ABBREVIATED_NUMBER,
|
||||
FTDM_TON_RESERVED,
|
||||
FTDM_TON_INVALID = 255
|
||||
} ftdm_ton_t;
|
||||
|
||||
/**
|
||||
* Numbering Plan Identification (NPI)
|
||||
*/
|
||||
typedef enum {
|
||||
FTDM_NPI_UNKNOWN = 0,
|
||||
FTDM_NPI_ISDN = 1,
|
||||
FTDM_NPI_DATA = 3,
|
||||
FTDM_NPI_TELEX = 4,
|
||||
FTDM_NPI_NATIONAL = 8,
|
||||
FTDM_NPI_PRIVATE = 9,
|
||||
FTDM_NPI_RESERVED = 10,
|
||||
FTDM_NPI_INVALID = 255
|
||||
} ftdm_npi_t;
|
||||
|
||||
typedef struct {
|
||||
char digits[25];
|
||||
uint8_t type;
|
||||
uint8_t plan;
|
||||
} ftdm_number_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_CALLER_STATE_DIALING,
|
||||
FTDM_CALLER_STATE_SUCCESS,
|
||||
FTDM_CALLER_STATE_FAIL
|
||||
} ftdm_caller_state_t;
|
||||
|
||||
struct ftdm_caller_data {
|
||||
char cid_date[8];
|
||||
char cid_name[80];
|
||||
ftdm_number_t cid_num;
|
||||
ftdm_number_t ani;
|
||||
ftdm_number_t dnis;
|
||||
ftdm_number_t rdnis;
|
||||
char aniII[25];
|
||||
uint8_t screen;
|
||||
uint8_t pres;
|
||||
char collected[25];
|
||||
int CRV;
|
||||
int hangup_cause;
|
||||
uint8_t raw_data[1024];
|
||||
uint32_t raw_data_len;
|
||||
uint32_t flags;
|
||||
ftdm_caller_state_t call_state;
|
||||
uint32_t chan_id;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
FTDM_TYPE_NONE,
|
||||
FTDM_TYPE_SPAN = 0xFF,
|
||||
FTDM_TYPE_CHANNEL
|
||||
} ftdm_data_type_t;
|
||||
|
||||
/* 2^8 table size, one for each byte value */
|
||||
#define FTDM_GAINS_TABLE_SIZE 256
|
||||
struct ftdm_channel {
|
||||
ftdm_data_type_t data_type;
|
||||
uint32_t span_id;
|
||||
uint32_t chan_id;
|
||||
uint32_t physical_span_id;
|
||||
uint32_t physical_chan_id;
|
||||
uint32_t rate;
|
||||
uint32_t extra_id;
|
||||
ftdm_chan_type_t type;
|
||||
ftdm_socket_t sockfd;
|
||||
uint32_t flags;
|
||||
uint32_t pflags;
|
||||
uint32_t sflags;
|
||||
ftdm_alarm_flag_t alarm_flags;
|
||||
ftdm_channel_feature_t features;
|
||||
ftdm_codec_t effective_codec;
|
||||
ftdm_codec_t native_codec;
|
||||
uint32_t effective_interval;
|
||||
uint32_t native_interval;
|
||||
uint32_t packet_len;
|
||||
ftdm_channel_state_t state;
|
||||
ftdm_channel_state_t last_state;
|
||||
ftdm_channel_state_t init_state;
|
||||
ftdm_mutex_t *mutex;
|
||||
teletone_dtmf_detect_state_t dtmf_detect;
|
||||
uint32_t buffer_delay;
|
||||
ftdm_event_t event_header;
|
||||
char last_error[256];
|
||||
fio_event_cb_t event_callback;
|
||||
uint32_t skip_read_frames;
|
||||
ftdm_buffer_t *dtmf_buffer;
|
||||
ftdm_buffer_t *gen_dtmf_buffer;
|
||||
ftdm_buffer_t *pre_buffer;
|
||||
ftdm_buffer_t *digit_buffer;
|
||||
ftdm_buffer_t *fsk_buffer;
|
||||
ftdm_mutex_t *pre_buffer_mutex;
|
||||
uint32_t dtmf_on;
|
||||
uint32_t dtmf_off;
|
||||
char *dtmf_hangup_buf;
|
||||
teletone_generation_session_t tone_session;
|
||||
ftdm_time_t last_event_time;
|
||||
ftdm_time_t ring_time;
|
||||
char tokens[FTDM_MAX_TOKENS+1][FTDM_TOKEN_STRLEN];
|
||||
uint8_t needed_tones[FTDM_TONEMAP_INVALID];
|
||||
uint8_t detected_tones[FTDM_TONEMAP_INVALID];
|
||||
ftdm_tonemap_t last_detected_tone;
|
||||
uint32_t token_count;
|
||||
char chan_name[128];
|
||||
char chan_number[32];
|
||||
ftdm_filehandle_t fds[2];
|
||||
ftdm_fsk_data_state_t fsk;
|
||||
uint8_t fsk_buf[80];
|
||||
uint32_t ring_count;
|
||||
void *mod_data;
|
||||
void *call_data;
|
||||
struct ftdm_caller_data caller_data;
|
||||
struct ftdm_span *span;
|
||||
struct ftdm_io_interface *fio;
|
||||
ftdm_hash_t *variable_hash;
|
||||
unsigned char rx_cas_bits;
|
||||
uint32_t pre_buffer_size;
|
||||
unsigned char rxgain_table[FTDM_GAINS_TABLE_SIZE];
|
||||
unsigned char txgain_table[FTDM_GAINS_TABLE_SIZE];
|
||||
float rxgain;
|
||||
float txgain;
|
||||
};
|
||||
|
||||
|
||||
struct ftdm_sigmsg {
|
||||
ftdm_signal_event_t event_id;
|
||||
uint32_t chan_id;
|
||||
uint32_t span_id;
|
||||
ftdm_channel_t *channel;
|
||||
void *raw_data;
|
||||
uint32_t raw_data_len;
|
||||
};
|
||||
|
||||
|
||||
struct ftdm_span {
|
||||
ftdm_data_type_t data_type;
|
||||
char *name;
|
||||
uint32_t span_id;
|
||||
uint32_t chan_count;
|
||||
ftdm_span_flag_t flags;
|
||||
struct ftdm_io_interface *fio;
|
||||
fio_event_cb_t event_callback;
|
||||
ftdm_mutex_t *mutex;
|
||||
ftdm_trunk_type_t trunk_type;
|
||||
ftdm_analog_start_type_t start_type;
|
||||
ftdm_signal_type_t signal_type;
|
||||
void *signal_data;
|
||||
fio_signal_cb_t signal_cb;
|
||||
ftdm_event_t event_header;
|
||||
char last_error[256];
|
||||
char tone_map[FTDM_TONEMAP_INVALID+1][FTDM_TONEMAP_LEN];
|
||||
teletone_tone_map_t tone_detect_map[FTDM_TONEMAP_INVALID+1];
|
||||
teletone_multi_tone_t tone_finder[FTDM_TONEMAP_INVALID+1];
|
||||
ftdm_channel_t *channels[FTDM_MAX_CHANNELS_SPAN+1];
|
||||
fio_channel_outgoing_call_t outgoing_call;
|
||||
fio_channel_set_sig_status_t set_channel_sig_status;
|
||||
fio_channel_get_sig_status_t get_channel_sig_status;
|
||||
fio_span_set_sig_status_t set_span_sig_status;
|
||||
fio_span_get_sig_status_t get_span_sig_status;
|
||||
fio_channel_request_t channel_request;
|
||||
ftdm_span_start_t start;
|
||||
ftdm_span_stop_t stop;
|
||||
void *mod_data;
|
||||
char *type;
|
||||
char *dtmf_hangup;
|
||||
size_t dtmf_hangup_len;
|
||||
int suggest_chan_id;
|
||||
ftdm_state_map_t *state_map;
|
||||
ftdm_caller_data_t default_caller_data;
|
||||
ftdm_queue_t *pendingchans;
|
||||
struct ftdm_span *next;
|
||||
};
|
||||
|
||||
struct ftdm_group {
|
||||
char *name;
|
||||
uint32_t group_id;
|
||||
uint32_t chan_count;
|
||||
ftdm_channel_t *channels[FTDM_MAX_CHANNELS_GROUP];
|
||||
uint32_t last_used_index;
|
||||
ftdm_mutex_t *mutex;
|
||||
struct ftdm_group *next;
|
||||
};
|
||||
|
||||
FT_DECLARE_DATA extern ftdm_logger_t ftdm_log;
|
||||
|
||||
typedef enum {
|
||||
FTDM_CRASH_NEVER = 0,
|
||||
FTDM_CRASH_ON_ASSERT
|
||||
} ftdm_crash_policy_t;
|
||||
|
||||
FT_DECLARE_DATA extern ftdm_crash_policy_t g_ftdm_crash_policy;
|
||||
|
||||
typedef void *(*ftdm_malloc_func_t)(void *pool, ftdm_size_t len);
|
||||
typedef void *(*ftdm_calloc_func_t)(void *pool, ftdm_size_t elements, ftdm_size_t len);
|
||||
typedef void (*ftdm_free_func_t)(void *pool, void *ptr);
|
||||
typedef struct ftdm_memory_handler {
|
||||
void *pool;
|
||||
ftdm_malloc_func_t malloc;
|
||||
ftdm_calloc_func_t calloc;
|
||||
ftdm_free_func_t free;
|
||||
} ftdm_memory_handler_t;
|
||||
|
||||
FT_DECLARE_DATA extern ftdm_memory_handler_t g_ftdm_mem_handler;
|
||||
|
||||
struct ftdm_io_interface {
|
||||
const char *name;
|
||||
fio_configure_span_t configure_span;
|
||||
fio_configure_t configure;
|
||||
fio_open_t open;
|
||||
fio_close_t close;
|
||||
fio_channel_destroy_t channel_destroy;
|
||||
fio_span_destroy_t span_destroy;
|
||||
fio_get_alarms_t get_alarms;
|
||||
fio_command_t command;
|
||||
fio_wait_t wait;
|
||||
fio_read_t read;
|
||||
fio_write_t write;
|
||||
fio_span_poll_event_t poll_event;
|
||||
fio_span_next_event_t next_event;
|
||||
fio_api_t api;
|
||||
};
|
||||
|
||||
/*! \brief Override the default queue handler */
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *handler);
|
||||
|
||||
/*! \brief Duplicate string */
|
||||
FT_DECLARE(char *) ftdm_strdup(const char *str);
|
||||
FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen);
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_fsk_modulator_generate_bit(ftdm_fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, ftdm_size_t buflen);
|
||||
FT_DECLARE(int32_t) ftdm_fsk_modulator_generate_carrier_bits(ftdm_fsk_modulator_t *fsk_trans, uint32_t bits);
|
||||
FT_DECLARE(void) ftdm_fsk_modulator_generate_chan_sieze(ftdm_fsk_modulator_t *fsk_trans);
|
||||
FT_DECLARE(void) ftdm_fsk_modulator_send_data(ftdm_fsk_modulator_t *fsk_trans);
|
||||
#define ftdm_fsk_modulator_send_all(_it) ftdm_fsk_modulator_generate_chan_sieze(_it); \
|
||||
ftdm_fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_start); \
|
||||
ftdm_fsk_modulator_send_data(_it); \
|
||||
ftdm_fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_stop)
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_modulator_init(ftdm_fsk_modulator_t *fsk_trans,
|
||||
fsk_modem_types_t modem_type,
|
||||
uint32_t sample_rate,
|
||||
ftdm_fsk_data_state_t *fsk_data,
|
||||
float db_level,
|
||||
uint32_t carrier_bits_start,
|
||||
uint32_t carrier_bits_stop,
|
||||
uint32_t chan_sieze_bits,
|
||||
ftdm_fsk_write_sample_t write_sample_callback,
|
||||
void *user_data);
|
||||
FT_DECLARE(int8_t) ftdm_bitstream_get_bit(ftdm_bitstream_t *bsp);
|
||||
FT_DECLARE(void) ftdm_bitstream_init(ftdm_bitstream_t *bsp, uint8_t *data, uint32_t datalen, ftdm_endian_t endian, uint8_t ss);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_parse(ftdm_fsk_data_state_t *state, ftdm_size_t *type, char **data, ftdm_size_t *len);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_feed(ftdm_fsk_data_state_t *state, int16_t *data, size_t samples);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_demod_destroy(ftdm_fsk_data_state_t *state);
|
||||
FT_DECLARE(int) ftdm_fsk_demod_init(ftdm_fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsize);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_init(ftdm_fsk_data_state_t *state, uint8_t *data, uint32_t datalen);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_mdmf(ftdm_fsk_data_state_t *state, ftdm_mdmf_type_t type, const uint8_t *data, uint32_t datalen);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_checksum(ftdm_fsk_data_state_t *state);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_sdmf(ftdm_fsk_data_state_t *state, const char *date, char *number);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_outgoing_call(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_get_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_set_sig_status(ftdm_span_t *span, ftdm_signaling_status_t status);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signaling_status_t *status);
|
||||
FT_DECLARE(void) ftdm_channel_rotate_tokens(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(void) ftdm_channel_clear_needed_tones(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_get_alarms(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_send_fsk_data(ftdm_channel_t *ftdmchan, ftdm_fsk_data_state_t *fsk_data, float db_level);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_clear_token(ftdm_channel_t *ftdmchan, const char *token);
|
||||
FT_DECLARE(void) ftdm_channel_replace_token(ftdm_channel_t *ftdmchan, const char *old_token, const char *new_token);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_add_token(ftdm_channel_t *ftdmchan, char *token, int end);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int lock);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_load_tones(ftdm_span_t *span, const char *mapname);
|
||||
FT_DECLARE(ftdm_size_t) ftdm_channel_dequeue_dtmf(ftdm_channel_t *ftdmchan, char *dtmf, ftdm_size_t len);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, const char *dtmf);
|
||||
FT_DECLARE(void) ftdm_channel_flush_dtmf(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_find(uint32_t id, ftdm_span_t **span);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_create(ftdm_io_interface_t *fio, ftdm_span_t **span, const char *name);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_close_all(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_add_channel(ftdm_span_t *span, ftdm_socket_t sockfd, ftdm_chan_type_t type, ftdm_channel_t **chan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_set_event_callback(ftdm_span_t *span, fio_event_cb_t event_callback);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_channel_t* ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_remove_from_group(ftdm_group_t* group, ftdm_channel_t* ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_group_find(uint32_t id, ftdm_group_t **group);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_group_find_by_name(const char *name, ftdm_group_t **group);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *name);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_set_event_callback(ftdm_channel_t *ftdmchan, fio_event_cb_t event_callback);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_channel_use_count(ftdm_span_t *span, uint32_t *count);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_group_channel_use_count(ftdm_group_t *group, uint32_t *count);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_use(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_command_t command, void *obj);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_wait(ftdm_channel_t *ftdmchan, ftdm_wait_flag_t *flags, int32_t to);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen);
|
||||
FT_DECLARE(void) ftdm_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t datasize, ftdm_size_t *datalen);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_add_var(ftdm_channel_t *ftdmchan, const char *var_name, const char *value);
|
||||
FT_DECLARE(const char *) ftdm_channel_get_var(ftdm_channel_t *ftdmchan, const char *var_name);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_init(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_set_memory_handler(ftdm_memory_handler_t *handler);
|
||||
FT_DECLARE(void) ftdm_global_set_crash_policy(ftdm_crash_policy_t policy);
|
||||
FT_DECLARE(void) ftdm_global_set_logger(ftdm_logger_t logger);
|
||||
FT_DECLARE(void) ftdm_global_set_default_logger(int level);
|
||||
FT_DECLARE(uint32_t) ftdm_separate_string(char *buf, char delim, char **array, int arraylen);
|
||||
FT_DECLARE(void) print_bits(uint8_t *b, int bl, char *buf, int blen, int e, uint8_t ss);
|
||||
FT_DECLARE(void) print_hex_bytes(uint8_t *data, ftdm_size_t dlen, char *buf, ftdm_size_t blen);
|
||||
FT_DECLARE_NONSTD(int) ftdm_hash_equalkeys(void *k1, void *k2);
|
||||
FT_DECLARE_NONSTD(uint32_t) ftdm_hash_hashfromstring(void *ky);
|
||||
FT_DECLARE(uint32_t) ftdm_running(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_complete_state(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *ftdmchan);
|
||||
FT_DECLARE(int) ftdm_load_modules(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_unload_modules(void);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_configure_span(const char *type, ftdm_span_t *span, fio_signal_cb_t sig_cb, ...);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(const char *type, ftdm_span_t *span, fio_signal_cb_t sig_cb, ftdm_conf_parameter_t *parameters);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg);
|
||||
FT_DECLARE(char *) ftdm_build_dso_path(const char *name, char *path, ftdm_size_t len);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_global_add_io_interface(ftdm_io_interface_t *io_interface);
|
||||
FT_DECLARE(int) ftdm_load_module(const char *name);
|
||||
FT_DECLARE(int) ftdm_load_module_assume(const char *name);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_span_find_by_name(const char *name, ftdm_span_t **span);
|
||||
FT_DECLARE(char *) ftdm_api_execute(const char *type, const char *cmd);
|
||||
FT_DECLARE(int) ftdm_vasprintf(char **ret, const char *fmt, va_list ap);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_channel_set_caller_data(ftdm_channel_t *ftdmchan, ftdm_caller_data_t *caller_data);
|
||||
|
||||
FIO_CODEC_FUNCTION(fio_slin2ulaw);
|
||||
FIO_CODEC_FUNCTION(fio_ulaw2slin);
|
||||
FIO_CODEC_FUNCTION(fio_slin2alaw);
|
||||
FIO_CODEC_FUNCTION(fio_alaw2slin);
|
||||
FIO_CODEC_FUNCTION(fio_ulaw2alaw);
|
||||
FIO_CODEC_FUNCTION(fio_alaw2ulaw);
|
||||
|
||||
#ifdef DEBUG_LOCKS
|
||||
#define ftdm_mutex_lock(_x) printf("++++++lock %s:%d\n", __FILE__, __LINE__) && _ftdm_mutex_lock(_x)
|
||||
#define ftdm_mutex_trylock(_x) printf("++++++try %s:%d\n", __FILE__, __LINE__) && _ftdm_mutex_trylock(_x)
|
||||
#define ftdm_mutex_unlock(_x) printf("------unlock %s:%d\n", __FILE__, __LINE__) && _ftdm_mutex_unlock(_x)
|
||||
#else
|
||||
#define ftdm_mutex_lock(_x) _ftdm_mutex_lock(_x)
|
||||
#define ftdm_mutex_trylock(_x) _ftdm_mutex_trylock(_x)
|
||||
#define ftdm_mutex_unlock(_x) _ftdm_mutex_unlock(_x)
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief Assert condition
|
||||
*/
|
||||
#define ftdm_assert(assertion, msg) \
|
||||
if (!(assertion)) { \
|
||||
ftdm_log(FTDM_LOG_CRIT, msg); \
|
||||
if (g_ftdm_crash_policy & FTDM_CRASH_ON_ASSERT) { \
|
||||
ftdm_abort(); \
|
||||
} \
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Assert condition and return
|
||||
*/
|
||||
#define ftdm_assert_return(assertion, retval, msg) \
|
||||
if (!(assertion)) { \
|
||||
ftdm_log(FTDM_LOG_CRIT, msg); \
|
||||
if (g_ftdm_crash_policy & FTDM_CRASH_ON_ASSERT) { \
|
||||
ftdm_abort(); \
|
||||
} else { \
|
||||
return retval; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Allocate uninitialized memory
|
||||
\command chunksize the chunk size
|
||||
*/
|
||||
#define ftdm_malloc(chunksize) g_ftdm_mem_handler.malloc(g_ftdm_mem_handler.pool, chunksize)
|
||||
|
||||
/*!
|
||||
\brief Allocate initialized memory
|
||||
\command chunksize the chunk size
|
||||
*/
|
||||
#define ftdm_calloc(elements, chunksize) g_ftdm_mem_handler.calloc(g_ftdm_mem_handler.pool, elements, chunksize)
|
||||
|
||||
/*!
|
||||
\brief Free chunk of memory
|
||||
\command chunksize the chunk size
|
||||
*/
|
||||
#define ftdm_free(chunk) g_ftdm_mem_handler.free(g_ftdm_mem_handler.pool, chunk)
|
||||
|
||||
/*!
|
||||
\brief Free a pointer and set it to NULL unless it already is NULL
|
||||
\command it the pointer
|
||||
*/
|
||||
#define ftdm_safe_free(it) if (it) { ftdm_free(it); it = NULL; }
|
||||
|
||||
/*!
|
||||
\brief Socket the given socket
|
||||
\command it the socket
|
||||
*/
|
||||
#define ftdm_socket_close(it) if (it > -1) { close(it); it = -1;}
|
||||
|
||||
#define ftdm_array_len(array) sizeof(array)/sizeof(array[0])
|
||||
|
||||
static __inline__ void ftdm_abort(void)
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
::abort();
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ void ftdm_set_state_all(ftdm_span_t *span, ftdm_channel_state_t state)
|
||||
{
|
||||
uint32_t j;
|
||||
ftdm_mutex_lock(span->mutex);
|
||||
for(j = 1; j <= span->chan_count; j++) {
|
||||
ftdm_set_state_locked((span->channels[j]), state);
|
||||
}
|
||||
ftdm_mutex_unlock(span->mutex);
|
||||
}
|
||||
|
||||
static __inline__ int ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t state)
|
||||
{
|
||||
uint32_t j;
|
||||
for(j = 1; j <= span->chan_count; j++) {
|
||||
if (span->channels[j]->state != state || ftdm_test_flag(span->channels[j], FTDM_CHANNEL_STATE_CHANGE)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static __inline__ void ftdm_set_flag_all(ftdm_span_t *span, uint32_t flag)
|
||||
{
|
||||
uint32_t j;
|
||||
ftdm_mutex_lock(span->mutex);
|
||||
for(j = 1; j <= span->chan_count; j++) {
|
||||
ftdm_set_flag_locked((span->channels[j]), flag);
|
||||
}
|
||||
ftdm_mutex_unlock(span->mutex);
|
||||
}
|
||||
|
||||
static __inline__ void ftdm_clear_flag_all(ftdm_span_t *span, uint32_t flag)
|
||||
{
|
||||
uint32_t j;
|
||||
ftdm_mutex_lock(span->mutex);
|
||||
for(j = 1; j <= span->chan_count; j++) {
|
||||
ftdm_clear_flag_locked((span->channels[j]), flag);
|
||||
}
|
||||
ftdm_mutex_unlock(span->mutex);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
121
libs/freetdm/src/include/fsk.h
Normal file
121
libs/freetdm/src/include/fsk.h
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* bell202.h
|
||||
*
|
||||
* Copyright (c) 2005 Robert Krten. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This module contains the manifest constants and declarations for
|
||||
* the Bell-202 1200 baud FSK modem.
|
||||
*
|
||||
* 2005 03 20 R. Krten created
|
||||
*/
|
||||
|
||||
#ifndef __FSK_H__
|
||||
#define __FSK_H__
|
||||
#include "uart.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int freq_space; /* Frequency of the 0 bit */
|
||||
int freq_mark; /* Frequency of the 1 bit */
|
||||
int baud_rate; /* baud rate for the modem */
|
||||
} fsk_modem_definition_t;
|
||||
|
||||
/* Must be kept in sync with fsk_modem_definitions array in fsk.c */
|
||||
/* V.23 definitions: http://www.itu.int/rec/recommendation.asp?type=folders&lang=e&parent=T-REC-V.23 */
|
||||
typedef enum {
|
||||
FSK_V23_FORWARD_MODE1 = 0, /* Maximum 600 bps for long haul */
|
||||
FSK_V23_FORWARD_MODE2, /* Standard 1200 bps V.23 */
|
||||
FSK_V23_BACKWARD, /* 75 bps return path for V.23 */
|
||||
FSK_BELL202 /* Bell 202 half-duplex 1200 bps */
|
||||
} fsk_modem_types_t;
|
||||
|
||||
typedef enum {
|
||||
FSK_STATE_CHANSEIZE = 0,
|
||||
FSK_STATE_CARRIERSIG,
|
||||
FSK_STATE_DATA
|
||||
} fsk_state_t;
|
||||
|
||||
typedef struct dsp_fsk_attr_s
|
||||
{
|
||||
int sample_rate; /* sample rate in HZ */
|
||||
bithandler_func_t bithandler; /* bit handler */
|
||||
void *bithandler_arg; /* arbitrary ID passed to bithandler as first argument */
|
||||
bytehandler_func_t bytehandler; /* byte handler */
|
||||
void *bytehandler_arg; /* arbitrary ID passed to bytehandler as first argument */
|
||||
} dsp_fsk_attr_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fsk_state_t state;
|
||||
dsp_fsk_attr_t attr; /* attributes structure */
|
||||
double *correlates[4]; /* one for each of sin/cos for mark/space */
|
||||
int corrsize; /* correlate size (also number of samples in ring buffer) */
|
||||
double *buffer; /* sample ring buffer */
|
||||
int ringstart; /* ring buffer start offset */
|
||||
double cellpos; /* bit cell position */
|
||||
double celladj; /* bit cell adjustment for each sample */
|
||||
int previous_bit; /* previous bit (for detecting a transition to sync-up cell position) */
|
||||
int current_bit; /* current bit */
|
||||
int last_bit;
|
||||
int downsampling_count; /* number of samples to skip */
|
||||
int current_downsample; /* current skip count */
|
||||
int conscutive_state_bits; /* number of bits in a row that matches the pattern for the current state */
|
||||
} dsp_fsk_handle_t;
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*
|
||||
* General calling order is:
|
||||
* a) create the attributes structure (dsp_fsk_attr_init)
|
||||
* b) initialize fields in the attributes structure (dsp_fsk_attr_set_*)
|
||||
* c) create a Bell-202 handle (dsp_fsk_create)
|
||||
* d) feed samples through the handler (dsp_fsk_sample)
|
||||
*/
|
||||
|
||||
void dsp_fsk_attr_init(dsp_fsk_attr_t *attributes);
|
||||
|
||||
bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attributes, void **bithandler_arg);
|
||||
void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attributes, bithandler_func_t bithandler, void *bithandler_arg);
|
||||
bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attributes, void **bytehandler_arg);
|
||||
void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg);
|
||||
int dsp_fsk_attr_get_samplerate(dsp_fsk_attr_t *attributes);
|
||||
int dsp_fsk_attr_set_samplerate(dsp_fsk_attr_t *attributes, int samplerate);
|
||||
|
||||
dsp_fsk_handle_t * dsp_fsk_create(dsp_fsk_attr_t *attributes);
|
||||
void dsp_fsk_destroy(dsp_fsk_handle_t **handle);
|
||||
|
||||
void dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample);
|
||||
|
||||
extern fsk_modem_definition_t fsk_modem_definitions[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
154
libs/freetdm/src/include/ftdm_buffer.h
Normal file
154
libs/freetdm/src/include/ftdm_buffer.h
Normal file
@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FTDM_BUFFER_H
|
||||
#define FTDM_BUFFER_H
|
||||
|
||||
#include "freetdm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup ftdm_buffer Buffer Routines
|
||||
* @ingroup buffer
|
||||
* The purpose of this module is to make a plain buffering interface that can be used for read/write buffers
|
||||
* throughout the application.
|
||||
* @{
|
||||
*/
|
||||
struct ftdm_buffer;
|
||||
typedef struct ftdm_buffer ftdm_buffer_t;
|
||||
|
||||
/*! \brief Allocate a new dynamic ftdm_buffer
|
||||
* \param buffer returned pointer to the new buffer
|
||||
* \param blocksize length to realloc by as data is added
|
||||
* \param start_len ammount of memory to reserve initially
|
||||
* \param max_len length the buffer is allowed to grow to
|
||||
* \return status
|
||||
*/
|
||||
FT_DECLARE(ftdm_status_t) ftdm_buffer_create(ftdm_buffer_t **buffer, ftdm_size_t blocksize, ftdm_size_t start_len, ftdm_size_t max_len);
|
||||
|
||||
/*! \brief Get the length of a ftdm_buffer_t
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \return int size of the buffer.
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_len(ftdm_buffer_t *buffer);
|
||||
|
||||
/*! \brief Get the freespace of a ftdm_buffer_t
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \return int freespace in the buffer.
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_freespace(ftdm_buffer_t *buffer);
|
||||
|
||||
/*! \brief Get the in use amount of a ftdm_buffer_t
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \return int ammount of buffer curently in use
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_inuse(ftdm_buffer_t *buffer);
|
||||
|
||||
/*! \brief Read data from a ftdm_buffer_t up to the ammount of datalen if it is available. Remove read data from buffer.
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \param data pointer to the read data to be returned
|
||||
* \param datalen amount of data to be returned
|
||||
* \return int ammount of data actually read
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_read(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen);
|
||||
|
||||
/*! \brief Read data endlessly from a ftdm_buffer_t
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \param data pointer to the read data to be returned
|
||||
* \param datalen amount of data to be returned
|
||||
* \return int ammount of data actually read
|
||||
* \note Once you have read all the data from the buffer it will loop around.
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_read_loop(ftdm_buffer_t *buffer, void *data, ftdm_size_t datalen);
|
||||
|
||||
/*! \brief Assign a number of loops to read
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \param loops the number of loops (-1 for infinite)
|
||||
*/
|
||||
FT_DECLARE(void) ftdm_buffer_set_loops(ftdm_buffer_t *buffer, int32_t loops);
|
||||
|
||||
/*! \brief Write data into a ftdm_buffer_t up to the length of datalen
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \param data pointer to the data to be written
|
||||
* \param datalen amount of data to be written
|
||||
* \return int amount of buffer used after the write, or 0 if no space available
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_write(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen);
|
||||
|
||||
/*! \brief Remove data from the buffer
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
* \param datalen amount of data to be removed
|
||||
* \return int size of buffer, or 0 if unable to toss that much data
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_toss(ftdm_buffer_t *buffer, ftdm_size_t datalen);
|
||||
|
||||
/*! \brief Remove all data from the buffer
|
||||
* \param buffer any buffer of type ftdm_buffer_t
|
||||
*/
|
||||
FT_DECLARE(void) ftdm_buffer_zero(ftdm_buffer_t *buffer);
|
||||
|
||||
/*! \brief Destroy the buffer
|
||||
* \param buffer buffer to destroy
|
||||
* \note only neccessary on dynamic buffers (noop on pooled ones)
|
||||
*/
|
||||
FT_DECLARE(void) ftdm_buffer_destroy(ftdm_buffer_t **buffer);
|
||||
|
||||
/*! \brief Seek to offset from the beginning of the buffer
|
||||
* \param buffer buffer to seek
|
||||
* \param datalen offset in bytes
|
||||
* \return new position
|
||||
*/
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_seek(ftdm_buffer_t *buffer, ftdm_size_t datalen);
|
||||
|
||||
/** @} */
|
||||
|
||||
FT_DECLARE(ftdm_size_t) ftdm_buffer_zwrite(ftdm_buffer_t *buffer, const void *data, ftdm_size_t datalen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
145
libs/freetdm/src/include/ftdm_config.h
Normal file
145
libs/freetdm/src/include/ftdm_config.h
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup config Config File Parser
|
||||
* @ingroup config
|
||||
* This module implements a basic interface and file format parser
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* EXAMPLE
|
||||
*
|
||||
* [category1]
|
||||
* var1 => val1
|
||||
* var2 => val2
|
||||
* \# lines that begin with \# are comments
|
||||
* \#var3 => val3
|
||||
* </pre>
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef FTDM_CONFIG_H
|
||||
#define FTDM_CONFIG_H
|
||||
|
||||
#include "freetdm.h"
|
||||
#define FTDM_URL_SEPARATOR "://"
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define FTDM_PATH_SEPARATOR "\\"
|
||||
#ifndef FTDM_CONFIG_DIR
|
||||
#define FTDM_CONFIG_DIR "c:\\freetdm"
|
||||
#endif
|
||||
#define ftdm_is_file_path(file) (*(file +1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR))
|
||||
#else
|
||||
#define FTDM_PATH_SEPARATOR "/"
|
||||
#ifndef FTDM_CONFIG_DIR
|
||||
#define FTDM_CONFIG_DIR "/etc/freetdm"
|
||||
#endif
|
||||
#define ftdm_is_file_path(file) ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ftdm_config ftdm_config_t;
|
||||
|
||||
/*! \brief A simple file handle representing an open configuration file **/
|
||||
struct ftdm_config {
|
||||
/*! FILE stream buffer to the opened file */
|
||||
FILE *file;
|
||||
/*! path to the file */
|
||||
char path[512];
|
||||
/*! current category */
|
||||
char category[256];
|
||||
/*! current section */
|
||||
char section[256];
|
||||
/*! buffer of current line being read */
|
||||
char buf[1024];
|
||||
/*! current line number in file */
|
||||
int lineno;
|
||||
/*! current category number in file */
|
||||
int catno;
|
||||
/*! current section number in file */
|
||||
int sectno;
|
||||
|
||||
int lockto;
|
||||
};
|
||||
|
||||
/*!
|
||||
\brief Open a configuration file
|
||||
\param cfg (ftdm_config_t *) config handle to use
|
||||
\param file_path path to the file
|
||||
\return 1 (true) on success 0 (false) on failure
|
||||
*/
|
||||
int ftdm_config_open_file(ftdm_config_t * cfg, const char *file_path);
|
||||
|
||||
/*!
|
||||
\brief Close a previously opened configuration file
|
||||
\param cfg (ftdm_config_t *) config handle to use
|
||||
*/
|
||||
void ftdm_config_close_file(ftdm_config_t * cfg);
|
||||
|
||||
/*!
|
||||
\brief Retrieve next name/value pair from configuration file
|
||||
\param cfg (ftdm_config_t *) config handle to use
|
||||
\param var pointer to aim at the new variable name
|
||||
\param val pointer to aim at the new value
|
||||
*/
|
||||
int ftdm_config_next_pair(ftdm_config_t * cfg, char **var, char **val);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the CAS bits from a configuration string value
|
||||
\param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx)
|
||||
\param outbits pointer to aim at the CAS bits
|
||||
*/
|
||||
FT_DECLARE (int) ftdm_config_get_cas_bits(char *strvalue, unsigned char *outbits);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
51
libs/freetdm/src/include/ftdm_dso.h
Normal file
51
libs/freetdm/src/include/ftdm_dso.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Cross Platform dso/dll load abstraction
|
||||
* Copyright(C) 2008 Michael Jerris
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so.
|
||||
*
|
||||
* This work is provided under this license on an "as is" basis, without warranty of any kind,
|
||||
* either expressed or implied, including, without limitation, warranties that the covered code
|
||||
* is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
|
||||
* risk as to the quality and performance of the covered code is with you. Should any covered
|
||||
* code prove defective in any respect, you (not the initial developer or any other contributor)
|
||||
* assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
|
||||
* constitutes an essential part of this license. No use of any covered code is authorized hereunder
|
||||
* except under this disclaimer.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FTDM_DSO_H
|
||||
#define _FTDM_DSO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*ftdm_func_ptr_t) (void);
|
||||
typedef void * ftdm_dso_lib_t;
|
||||
|
||||
FT_DECLARE(void) ftdm_dso_destroy(ftdm_dso_lib_t *lib);
|
||||
FT_DECLARE(ftdm_dso_lib_t) ftdm_dso_open(const char *path, char **err);
|
||||
FT_DECLARE(void *) ftdm_dso_func_sym(ftdm_dso_lib_t lib, const char *sym, char **err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4
|
||||
*/
|
||||
|
134
libs/freetdm/src/include/ftdm_m3ua.h
Normal file
134
libs/freetdm/src/include/ftdm_m3ua.h
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* ftdm_m3ua.h
|
||||
* freetdm
|
||||
*
|
||||
* Created by Shane Burrell on 4/3/08.
|
||||
* Copyright 2008 Shane Burrell. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2007, Anthony Minessale II, Nenad Corbic
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
//#include "m3ua_client.h"
|
||||
#include "freetdm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
enum e_sigboost_event_id_values
|
||||
{
|
||||
SIGBOOST_EVENT_CALL_START = 0x80, /*128*/
|
||||
SIGBOOST_EVENT_CALL_START_ACK = 0x81, /*129*/
|
||||
SIGBOOST_EVENT_CALL_START_NACK = 0x82, /*130*/
|
||||
SIGBOOST_EVENT_CALL_START_NACK_ACK = 0x83, /*131*/
|
||||
SIGBOOST_EVENT_CALL_ANSWERED = 0x84, /*132*/
|
||||
SIGBOOST_EVENT_CALL_STOPPED = 0x85, /*133*/
|
||||
SIGBOOST_EVENT_CALL_STOPPED_ACK = 0x86, /*134*/
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART = 0x87, /*135*/
|
||||
SIGBOOST_EVENT_SYSTEM_RESTART_ACK = 0x88, /*136*/
|
||||
/* Following IDs are ss7boost to sangoma_mgd only. */
|
||||
SIGBOOST_EVENT_HEARTBEAT = 0x89, /*137*/
|
||||
SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/
|
||||
SIGBOOST_EVENT_REMOVE_CHECK_LOOP = 0x8b, /*139*/
|
||||
SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE = 0x8c, /*140*/
|
||||
};
|
||||
enum e_sigboost_release_cause_values
|
||||
{
|
||||
SIGBOOST_RELEASE_CAUSE_UNDEFINED = 0,
|
||||
SIGBOOST_RELEASE_CAUSE_NORMAL = 16,
|
||||
SIGBOOST_RELEASE_CAUSE_BUSY = 17,
|
||||
/* probable elimination */
|
||||
//SIGBOOST_RELEASE_CAUSE_BUSY = 0x91, /* 145 */
|
||||
//SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST = 0x92, /* 146 */
|
||||
//SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET = 0x93, /* 147 */
|
||||
//SIGBOOST_RELEASE_CAUSE_NOANSWER = 0x94, /* 148 */
|
||||
};
|
||||
|
||||
enum e_sigboost_call_setup_ack_nack_cause_values
|
||||
{
|
||||
SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY = 117, /* unused Q.850 value */
|
||||
SIGBOOST_CALL_SETUP_NACK_TEST_CKT_BUSY = 118, /* unused Q.850 value */
|
||||
SIGBOOST_CALL_SETUP_NACK_INVALID_NUMBER = 28,
|
||||
/* probable elimination */
|
||||
//SIGBOOST_CALL_SETUP_RESERVED = 0x00,
|
||||
//SIGBOOST_CALL_SETUP_CIRCUIT_RESET = 0x10,
|
||||
//SIGBOOST_CALL_SETUP_NACK_CKT_START_TIMEOUT = 0x11,
|
||||
//SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP = 0x17,
|
||||
};
|
||||
typedef enum {
|
||||
M3UA_SPAN_SIGNALING_M3UA,
|
||||
M3UA_SPAN_SIGNALING_SS7BOX,
|
||||
|
||||
} M3UA_TSpanSignaling;
|
||||
#define M3UA_SPAN_STRINGS "M3UA", "SS7BOX"
|
||||
FTDM_STR2ENUM_P(m3ua_str2span, m3ua_span2str, M3UA_TSpanSignaling)
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
FTDM_M3UA_RUNNING = (1 << 0)
|
||||
} ftdm_m3uat_flag_t;
|
||||
|
||||
/*typedef struct m3ua_data {
|
||||
m3uac_connection_t mcon;
|
||||
m3uac_connection_t pcon;
|
||||
fio_signal_cb_t signal_cb;
|
||||
uint32_t flags;
|
||||
} m3ua_data_t;
|
||||
|
||||
*/
|
||||
/*typedef struct mu3a_link {
|
||||
ss7bc_connection_t mcon;
|
||||
ss7bc_connection_t pcon;
|
||||
fio_signal_cb_t signal_cb;
|
||||
uint32_t flags;
|
||||
} ftdm_m3ua_data_t;
|
||||
*/
|
||||
|
||||
ftdm_status_t m3ua_init(ftdm_io_interface_t **zint);
|
||||
ftdm_status_t m3ua_destroy(void);
|
||||
ftdm_status_t m3ua_start(ftdm_span_t *span);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
68
libs/freetdm/src/include/ftdm_threadmutex.h
Normal file
68
libs/freetdm/src/include/ftdm_threadmutex.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Cross Platform Thread/Mutex abstraction
|
||||
* Copyright(C) 2007 Michael Jerris
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so.
|
||||
*
|
||||
* This work is provided under this license on an "as is" basis, without warranty of any kind,
|
||||
* either expressed or implied, including, without limitation, warranties that the covered code
|
||||
* is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
|
||||
* risk as to the quality and performance of the covered code is with you. Should any covered
|
||||
* code prove defective in any respect, you (not the initial developer or any other contributor)
|
||||
* assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
|
||||
* constitutes an essential part of this license. No use of any covered code is authorized hereunder
|
||||
* except under this disclaimer.
|
||||
*
|
||||
* Contributors:
|
||||
*
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FTDM_THREADMUTEX_H
|
||||
#define _FTDM_THREADMUTEX_H
|
||||
|
||||
#include "freetdm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef struct ftdm_mutex ftdm_mutex_t;
|
||||
typedef struct ftdm_thread ftdm_thread_t;
|
||||
typedef struct ftdm_interrupt ftdm_interrupt_t;
|
||||
typedef void *(*ftdm_thread_function_t) (ftdm_thread_t *, void *);
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached(ftdm_thread_function_t func, void *data);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached_ex(ftdm_thread_function_t func, void *data, ftdm_size_t stack_size);
|
||||
FT_DECLARE(void) ftdm_thread_override_default_stacksize(ftdm_size_t size);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_mutex_create(ftdm_mutex_t **mutex);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_mutex_destroy(ftdm_mutex_t **mutex);
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_lock(ftdm_mutex_t *mutex);
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(ftdm_mutex_t *mutex);
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(ftdm_mutex_t *mutex);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **cond);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *cond);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *cond, int ms);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
708
libs/freetdm/src/include/ftdm_types.h
Normal file
708
libs/freetdm/src/include/ftdm_types.h
Normal file
@ -0,0 +1,708 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributors:
|
||||
*
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FTDM_TYPES_H
|
||||
#define FTDM_TYPES_H
|
||||
#include "fsk.h"
|
||||
|
||||
#define FTDM_INVALID_SOCKET -1
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
typedef HANDLE ftdm_socket_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int8 int8_t;
|
||||
typedef intptr_t ftdm_ssize_t;
|
||||
typedef int ftdm_filehandle_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdarg.h>
|
||||
typedef int ftdm_socket_t;
|
||||
typedef ssize_t ftdm_ssize_t;
|
||||
typedef int ftdm_filehandle_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define TAG_END NULL
|
||||
|
||||
typedef size_t ftdm_size_t;
|
||||
struct ftdm_io_interface;
|
||||
|
||||
#define FTDM_COMMAND_OBJ_INT *((int *)obj)
|
||||
#define FTDM_COMMAND_OBJ_CHAR_P (char *)obj
|
||||
#define FTDM_COMMAND_OBJ_FLOAT *(float *)obj
|
||||
#define FTDM_FSK_MOD_FACTOR 0x10000
|
||||
#define FTDM_DEFAULT_DTMF_ON 250
|
||||
#define FTDM_DEFAULT_DTMF_OFF 50
|
||||
|
||||
#define FTDM_END -1
|
||||
#define FTDM_ANY_STATE -1
|
||||
|
||||
typedef uint64_t ftdm_time_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_ENDIAN_BIG = 1,
|
||||
FTDM_ENDIAN_LITTLE = -1
|
||||
} ftdm_endian_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_CID_TYPE_SDMF = 0x04,
|
||||
FTDM_CID_TYPE_MDMF = 0x80
|
||||
} ftdm_cid_type_t;
|
||||
|
||||
typedef enum {
|
||||
MDMF_DATETIME = 1,
|
||||
MDMF_PHONE_NUM = 2,
|
||||
MDMF_DDN = 3,
|
||||
MDMF_NO_NUM = 4,
|
||||
MDMF_PHONE_NAME = 7,
|
||||
MDMF_NO_NAME = 8,
|
||||
MDMF_ALT_ROUTE = 9,
|
||||
MDMF_INVALID = 10
|
||||
} ftdm_mdmf_type_t;
|
||||
#define MDMF_STRINGS "X", "DATETIME", "PHONE_NUM", "DDN", "NO_NUM", "X", "X", "PHONE_NAME", "NO_NAME", "ALT_ROUTE", "INVALID"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_mdmf_type, ftdm_mdmf_type2str, ftdm_mdmf_type_t)
|
||||
|
||||
#define FTDM_TONEMAP_LEN 128
|
||||
typedef enum {
|
||||
FTDM_TONEMAP_NONE,
|
||||
FTDM_TONEMAP_DIAL,
|
||||
FTDM_TONEMAP_RING,
|
||||
FTDM_TONEMAP_BUSY,
|
||||
FTDM_TONEMAP_FAIL1,
|
||||
FTDM_TONEMAP_FAIL2,
|
||||
FTDM_TONEMAP_FAIL3,
|
||||
FTDM_TONEMAP_ATTN,
|
||||
FTDM_TONEMAP_CALLWAITING_CAS,
|
||||
FTDM_TONEMAP_CALLWAITING_SAS,
|
||||
FTDM_TONEMAP_CALLWAITING_ACK,
|
||||
FTDM_TONEMAP_INVALID
|
||||
} ftdm_tonemap_t;
|
||||
#define TONEMAP_STRINGS "NONE", "DIAL", "RING", "BUSY", "FAIL1", "FAIL2", "FAIL3", "ATTN", "CALLWAITING-CAS", "CALLWAITING-SAS", "CALLWAITING-ACK", "INVALID"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_tonemap, ftdm_tonemap2str, ftdm_tonemap_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_TRUNK_E1,
|
||||
FTDM_TRUNK_T1,
|
||||
FTDM_TRUNK_J1,
|
||||
FTDM_TRUNK_BRI,
|
||||
FTDM_TRUNK_BRI_PTMP,
|
||||
FTDM_TRUNK_FXO,
|
||||
FTDM_TRUNK_FXS,
|
||||
FTDM_TRUNK_EM,
|
||||
FTDM_TRUNK_NONE
|
||||
} ftdm_trunk_type_t;
|
||||
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "NONE"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_ANALOG_START_KEWL,
|
||||
FTDM_ANALOG_START_LOOP,
|
||||
FTDM_ANALOG_START_GROUND,
|
||||
FTDM_ANALOG_START_WINK,
|
||||
FTDM_ANALOG_START_NA
|
||||
} ftdm_analog_start_type_t;
|
||||
#define START_TYPE_STRINGS "KEWL", "LOOP", "GROUND", "WINK", "NA"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_analog_start_type, ftdm_analog_start_type2str, ftdm_analog_start_type_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_OOB_ONHOOK,
|
||||
FTDM_OOB_OFFHOOK,
|
||||
FTDM_OOB_WINK,
|
||||
FTDM_OOB_FLASH,
|
||||
FTDM_OOB_RING_START,
|
||||
FTDM_OOB_RING_STOP,
|
||||
FTDM_OOB_ALARM_TRAP,
|
||||
FTDM_OOB_ALARM_CLEAR,
|
||||
FTDM_OOB_NOOP,
|
||||
FTDM_OOB_CAS_BITS_CHANGE,
|
||||
FTDM_OOB_INVALID
|
||||
} ftdm_oob_event_t;
|
||||
#define OOB_STRINGS "DTMF", "ONHOOK", "OFFHOOK", "WINK", "FLASH", "RING_START", "RING_STOP", "ALARM_TRAP", "ALARM_CLEAR", "NOOP", "CAS_BITS_CHANGE", "INVALID"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_oob_event, ftdm_oob_event2str, ftdm_oob_event_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_ALARM_NONE = 0,
|
||||
FTDM_ALARM_RECOVER = (1 << 0),
|
||||
FTDM_ALARM_LOOPBACK = (1 << 2),
|
||||
FTDM_ALARM_YELLOW = (1 << 3),
|
||||
FTDM_ALARM_RED = (1 << 4),
|
||||
FTDM_ALARM_BLUE = (1 << 5),
|
||||
FTDM_ALARM_NOTOPEN = ( 1 << 6),
|
||||
FTDM_ALARM_AIS = ( 1 << 7),
|
||||
FTDM_ALARM_RAI = ( 1 << 8),
|
||||
FTDM_ALARM_GENERAL = ( 1 << 30)
|
||||
} ftdm_alarm_flag_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_SIGTYPE_NONE,
|
||||
FTDM_SIGTYPE_ISDN,
|
||||
FTDM_SIGTYPE_RBS,
|
||||
FTDM_SIGTYPE_ANALOG,
|
||||
FTDM_SIGTYPE_SANGOMABOOST,
|
||||
FTDM_SIGTYPE_M3UA,
|
||||
FTDM_SIGTYPE_R2
|
||||
} ftdm_signal_type_t;
|
||||
|
||||
/*!
|
||||
\brief Signaling status on a given span or specific channel on protocols that support it
|
||||
*/
|
||||
typedef enum {
|
||||
/* The signaling link is down (no d-chans up in the span/group, MFC-R2 bit pattern unidentified) */
|
||||
FTDM_SIG_STATE_DOWN,
|
||||
/* The signaling link is suspended (MFC-R2 bit pattern blocked, ss7 blocked?) */
|
||||
FTDM_SIG_STATE_SUSPENDED,
|
||||
/* The signaling link is ready and calls can be placed */
|
||||
FTDM_SIG_STATE_UP,
|
||||
/* Invalid status */
|
||||
FTDM_SIG_STATE_INVALID
|
||||
} ftdm_signaling_status_t;
|
||||
#define SIGSTATUS_STRINGS "DOWN", "SUSPENDED", "UP", "INVALID"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_SIGEVENT_START,
|
||||
FTDM_SIGEVENT_STOP,
|
||||
FTDM_SIGEVENT_TRANSFER,
|
||||
FTDM_SIGEVENT_ANSWER,
|
||||
FTDM_SIGEVENT_UP,
|
||||
FTDM_SIGEVENT_FLASH,
|
||||
FTDM_SIGEVENT_PROGRESS,
|
||||
FTDM_SIGEVENT_PROGRESS_MEDIA,
|
||||
FTDM_SIGEVENT_NOTIFY,
|
||||
FTDM_SIGEVENT_TONE_DETECTED,
|
||||
FTDM_SIGEVENT_ALARM_TRAP,
|
||||
FTDM_SIGEVENT_ALARM_CLEAR,
|
||||
FTDM_SIGEVENT_MISC,
|
||||
FTDM_SIGEVENT_COLLECTED_DIGIT,
|
||||
FTDM_SIGEVENT_ADD_CALL,
|
||||
FTDM_SIGEVENT_RESTART,
|
||||
/* Signaling status changed (D-chan up, down, R2 blocked etc) */
|
||||
FTDM_SIGEVENT_SIGSTATUS_CHANGED,
|
||||
FTDM_SIGEVENT_INVALID
|
||||
} ftdm_signal_event_t;
|
||||
#define SIGNAL_STRINGS "START", "STOP", "TRANSFER", "ANSWER", "UP", "FLASH", "PROGRESS", \
|
||||
"PROGRESS_MEDIA", "NOTIFY", "TONE_DETECTED", "ALARM_TRAP", "ALARM_CLEAR", "MISC", \
|
||||
"COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGLINK_CHANGED", "HWSTATUS_CHANGED", "INVALID"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_EVENT_NONE,
|
||||
FTDM_EVENT_DTMF,
|
||||
FTDM_EVENT_OOB,
|
||||
FTDM_EVENT_COUNT
|
||||
} ftdm_event_type_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_TOP_DOWN,
|
||||
FTDM_BOTTOM_UP
|
||||
} ftdm_direction_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_SUCCESS,
|
||||
FTDM_FAIL,
|
||||
FTDM_MEMERR,
|
||||
FTDM_TIMEOUT,
|
||||
FTDM_NOTIMPL,
|
||||
FTDM_CHECKSUM_ERROR,
|
||||
FTDM_STATUS_COUNT,
|
||||
FTDM_BREAK
|
||||
} ftdm_status_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_NO_FLAGS = 0,
|
||||
FTDM_READ = (1 << 0),
|
||||
FTDM_WRITE = (1 << 1),
|
||||
FTDM_EVENTS = (1 << 2)
|
||||
} ftdm_wait_flag_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_CODEC_ULAW = 0,
|
||||
FTDM_CODEC_ALAW = 8,
|
||||
FTDM_CODEC_SLIN = 10,
|
||||
FTDM_CODEC_NONE = (1 << 30)
|
||||
} ftdm_codec_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_TONE_DTMF = (1 << 0)
|
||||
} ftdm_tone_type_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_COMMAND_NOOP,
|
||||
FTDM_COMMAND_SET_INTERVAL,
|
||||
FTDM_COMMAND_GET_INTERVAL,
|
||||
FTDM_COMMAND_SET_CODEC,
|
||||
FTDM_COMMAND_GET_CODEC,
|
||||
FTDM_COMMAND_SET_NATIVE_CODEC,
|
||||
FTDM_COMMAND_GET_NATIVE_CODEC,
|
||||
FTDM_COMMAND_ENABLE_DTMF_DETECT,
|
||||
FTDM_COMMAND_DISABLE_DTMF_DETECT,
|
||||
FTDM_COMMAND_SEND_DTMF,
|
||||
FTDM_COMMAND_SET_DTMF_ON_PERIOD,
|
||||
FTDM_COMMAND_GET_DTMF_ON_PERIOD,
|
||||
FTDM_COMMAND_SET_DTMF_OFF_PERIOD,
|
||||
FTDM_COMMAND_GET_DTMF_OFF_PERIOD,
|
||||
FTDM_COMMAND_GENERATE_RING_ON,
|
||||
FTDM_COMMAND_GENERATE_RING_OFF,
|
||||
FTDM_COMMAND_OFFHOOK,
|
||||
FTDM_COMMAND_ONHOOK,
|
||||
FTDM_COMMAND_FLASH,
|
||||
FTDM_COMMAND_WINK,
|
||||
FTDM_COMMAND_ENABLE_PROGRESS_DETECT,
|
||||
FTDM_COMMAND_DISABLE_PROGRESS_DETECT,
|
||||
FTDM_COMMAND_TRACE_INPUT,
|
||||
FTDM_COMMAND_TRACE_OUTPUT,
|
||||
FTDM_COMMAND_ENABLE_CALLERID_DETECT,
|
||||
FTDM_COMMAND_DISABLE_CALLERID_DETECT,
|
||||
FTDM_COMMAND_ENABLE_ECHOCANCEL,
|
||||
FTDM_COMMAND_DISABLE_ECHOCANCEL,
|
||||
FTDM_COMMAND_ENABLE_ECHOTRAIN,
|
||||
FTDM_COMMAND_DISABLE_ECHOTRAIN,
|
||||
FTDM_COMMAND_SET_CAS_BITS,
|
||||
FTDM_COMMAND_GET_CAS_BITS,
|
||||
FTDM_COMMAND_SET_RX_GAIN,
|
||||
FTDM_COMMAND_GET_RX_GAIN,
|
||||
FTDM_COMMAND_SET_TX_GAIN,
|
||||
FTDM_COMMAND_GET_TX_GAIN,
|
||||
FTDM_COMMAND_FLUSH_TX_BUFFERS,
|
||||
FTDM_COMMAND_FLUSH_RX_BUFFERS,
|
||||
FTDM_COMMAND_FLUSH_BUFFERS,
|
||||
FTDM_COMMAND_SET_PRE_BUFFER_SIZE,
|
||||
FTDM_COMMAND_SET_LINK_STATUS,
|
||||
FTDM_COMMAND_GET_LINK_STATUS,
|
||||
FTDM_COMMAND_ENABLE_LOOP,
|
||||
FTDM_COMMAND_DISABLE_LOOP,
|
||||
FTDM_COMMAND_COUNT
|
||||
} ftdm_command_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_SPAN_CONFIGURED = (1 << 0),
|
||||
FTDM_SPAN_READY = (1 << 1),
|
||||
FTDM_SPAN_STATE_CHANGE = (1 << 2),
|
||||
FTDM_SPAN_SUSPENDED = (1 << 3),
|
||||
FTDM_SPAN_IN_THREAD = (1 << 4),
|
||||
FTDM_SPAN_STOP_THREAD = (1 << 5)
|
||||
} ftdm_span_flag_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_CHAN_TYPE_B,
|
||||
FTDM_CHAN_TYPE_DQ921,
|
||||
FTDM_CHAN_TYPE_DQ931,
|
||||
FTDM_CHAN_TYPE_FXS,
|
||||
FTDM_CHAN_TYPE_FXO,
|
||||
FTDM_CHAN_TYPE_EM,
|
||||
FTDM_CHAN_TYPE_CAS,
|
||||
FTDM_CHAN_TYPE_COUNT
|
||||
} ftdm_chan_type_t;
|
||||
|
||||
#define FTDM_IS_VOICE_CHANNEL(ftdm_chan) ((ftdm_chan)->type != FTDM_CHAN_TYPE_DQ921 && (ftdm_chan)->type != FTDM_CHAN_TYPE_DQ931)
|
||||
|
||||
#define CHAN_TYPE_STRINGS "B", "DQ921", "DQ931", "FXS", "FXO", "EM", "CAS", "INVALID"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_CHANNEL_FEATURE_DTMF_DETECT = (1 << 0),
|
||||
FTDM_CHANNEL_FEATURE_DTMF_GENERATE = (1 << 1),
|
||||
FTDM_CHANNEL_FEATURE_CODECS = (1 << 2),
|
||||
FTDM_CHANNEL_FEATURE_INTERVAL = (1 << 3),
|
||||
FTDM_CHANNEL_FEATURE_CALLERID = (1 << 4),
|
||||
FTDM_CHANNEL_FEATURE_PROGRESS = (1 << 5)
|
||||
} ftdm_channel_feature_t;
|
||||
|
||||
typedef enum {
|
||||
FTDM_CHANNEL_STATE_DOWN,
|
||||
FTDM_CHANNEL_STATE_HOLD,
|
||||
FTDM_CHANNEL_STATE_SUSPENDED,
|
||||
FTDM_CHANNEL_STATE_DIALTONE,
|
||||
FTDM_CHANNEL_STATE_COLLECT,
|
||||
FTDM_CHANNEL_STATE_RING,
|
||||
FTDM_CHANNEL_STATE_BUSY,
|
||||
FTDM_CHANNEL_STATE_ATTN,
|
||||
FTDM_CHANNEL_STATE_GENRING,
|
||||
FTDM_CHANNEL_STATE_DIALING,
|
||||
FTDM_CHANNEL_STATE_GET_CALLERID,
|
||||
FTDM_CHANNEL_STATE_CALLWAITING,
|
||||
FTDM_CHANNEL_STATE_RESTART,
|
||||
FTDM_CHANNEL_STATE_PROGRESS,
|
||||
FTDM_CHANNEL_STATE_PROGRESS_MEDIA,
|
||||
FTDM_CHANNEL_STATE_UP,
|
||||
FTDM_CHANNEL_STATE_IDLE,
|
||||
FTDM_CHANNEL_STATE_TERMINATING,
|
||||
FTDM_CHANNEL_STATE_CANCEL,
|
||||
FTDM_CHANNEL_STATE_HANGUP,
|
||||
FTDM_CHANNEL_STATE_HANGUP_COMPLETE,
|
||||
FTDM_CHANNEL_STATE_IN_LOOP,
|
||||
FTDM_CHANNEL_STATE_INVALID
|
||||
} ftdm_channel_state_t;
|
||||
#define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \
|
||||
"RING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \
|
||||
"RESTART", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", "HANGUP", "HANGUP_COMPLETE", "INVALID"
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t)
|
||||
|
||||
typedef enum {
|
||||
FTDM_CHANNEL_CONFIGURED = (1 << 0),
|
||||
FTDM_CHANNEL_READY = (1 << 1),
|
||||
FTDM_CHANNEL_OPEN = (1 << 2),
|
||||
FTDM_CHANNEL_DTMF_DETECT = (1 << 3),
|
||||
FTDM_CHANNEL_SUPRESS_DTMF = (1 << 4),
|
||||
FTDM_CHANNEL_TRANSCODE = (1 << 5),
|
||||
FTDM_CHANNEL_BUFFER = (1 << 6),
|
||||
FTDM_CHANNEL_EVENT = (1 << 7),
|
||||
FTDM_CHANNEL_INTHREAD = (1 << 8),
|
||||
FTDM_CHANNEL_WINK = (1 << 9),
|
||||
FTDM_CHANNEL_FLASH = (1 << 10),
|
||||
FTDM_CHANNEL_STATE_CHANGE = (1 << 11),
|
||||
FTDM_CHANNEL_HOLD = (1 << 12),
|
||||
FTDM_CHANNEL_INUSE = (1 << 13),
|
||||
FTDM_CHANNEL_OFFHOOK = (1 << 14),
|
||||
FTDM_CHANNEL_RINGING = (1 << 15),
|
||||
FTDM_CHANNEL_PROGRESS_DETECT = (1 << 16),
|
||||
FTDM_CHANNEL_CALLERID_DETECT = (1 << 17),
|
||||
FTDM_CHANNEL_OUTBOUND = (1 << 18),
|
||||
FTDM_CHANNEL_SUSPENDED = (1 << 19),
|
||||
FTDM_CHANNEL_3WAY = (1 << 20),
|
||||
FTDM_CHANNEL_PROGRESS = (1 << 21),
|
||||
FTDM_CHANNEL_MEDIA = (1 << 22),
|
||||
FTDM_CHANNEL_ANSWERED = (1 << 23),
|
||||
FTDM_CHANNEL_MUTE = (1 << 24),
|
||||
FTDM_CHANNEL_USE_RX_GAIN = (1 << 25),
|
||||
FTDM_CHANNEL_USE_TX_GAIN = (1 << 26),
|
||||
FTDM_CHANNEL_IN_ALARM = (1 << 27),
|
||||
} ftdm_channel_flag_t;
|
||||
#if defined(__cplusplus) && defined(WIN32)
|
||||
// fix C2676
|
||||
__inline__ ftdm_channel_flag_t operator|=(ftdm_channel_flag_t a, int32_t b) {
|
||||
a = (ftdm_channel_flag_t)(a | b);
|
||||
return a;
|
||||
}
|
||||
__inline__ ftdm_channel_flag_t operator&=(ftdm_channel_flag_t a, int32_t b) {
|
||||
a = (ftdm_channel_flag_t)(a & b);
|
||||
return a;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
ZSM_NONE,
|
||||
ZSM_UNACCEPTABLE,
|
||||
ZSM_ACCEPTABLE
|
||||
} ftdm_state_map_type_t;
|
||||
|
||||
typedef enum {
|
||||
ZSD_INBOUND,
|
||||
ZSD_OUTBOUND,
|
||||
} ftdm_state_direction_t;
|
||||
|
||||
#define FTDM_MAP_NODE_SIZE 512
|
||||
#define FTDM_MAP_MAX FTDM_CHANNEL_STATE_INVALID+2
|
||||
|
||||
struct ftdm_state_map_node {
|
||||
ftdm_state_direction_t direction;
|
||||
ftdm_state_map_type_t type;
|
||||
ftdm_channel_state_t check_states[FTDM_MAP_MAX];
|
||||
ftdm_channel_state_t states[FTDM_MAP_MAX];
|
||||
};
|
||||
typedef struct ftdm_state_map_node ftdm_state_map_node_t;
|
||||
|
||||
struct ftdm_state_map {
|
||||
ftdm_state_map_node_t nodes[FTDM_MAP_NODE_SIZE];
|
||||
};
|
||||
typedef struct ftdm_state_map ftdm_state_map_t;
|
||||
|
||||
typedef enum ftdm_channel_hw_link_status {
|
||||
FTDM_HW_LINK_DISCONNECTED = 0,
|
||||
FTDM_HW_LINK_CONNECTED
|
||||
} ftdm_channel_hw_link_status_t;
|
||||
|
||||
typedef struct ftdm_conf_parameter_s {
|
||||
const char *var;
|
||||
const char *val;
|
||||
} ftdm_conf_parameter_t;
|
||||
|
||||
typedef struct ftdm_channel ftdm_channel_t;
|
||||
typedef struct ftdm_event ftdm_event_t;
|
||||
typedef struct ftdm_sigmsg ftdm_sigmsg_t;
|
||||
typedef struct ftdm_span ftdm_span_t;
|
||||
typedef struct ftdm_group ftdm_group_t;
|
||||
typedef struct ftdm_caller_data ftdm_caller_data_t;
|
||||
typedef struct ftdm_io_interface ftdm_io_interface_t;
|
||||
|
||||
struct ftdm_stream_handle;
|
||||
typedef struct ftdm_stream_handle ftdm_stream_handle_t;
|
||||
|
||||
typedef ftdm_status_t (*ftdm_stream_handle_raw_write_function_t) (ftdm_stream_handle_t *handle, uint8_t *data, ftdm_size_t datalen);
|
||||
typedef ftdm_status_t (*ftdm_stream_handle_write_function_t) (ftdm_stream_handle_t *handle, const char *fmt, ...);
|
||||
|
||||
#define FIO_CHANNEL_REQUEST_ARGS (ftdm_span_t *span, uint32_t chan_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan)
|
||||
#define FIO_CHANNEL_OUTGOING_CALL_ARGS (ftdm_channel_t *ftdmchan)
|
||||
#define FIO_CHANNEL_SET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status)
|
||||
#define FIO_CHANNEL_GET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status)
|
||||
#define FIO_SPAN_SET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status)
|
||||
#define FIO_SPAN_GET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status)
|
||||
#define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms)
|
||||
#define FIO_SPAN_NEXT_EVENT_ARGS (ftdm_span_t *span, ftdm_event_t **event)
|
||||
#define FIO_SIGNAL_CB_ARGS (ftdm_sigmsg_t *sigmsg)
|
||||
#define FIO_EVENT_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t *event)
|
||||
#define FIO_CODEC_ARGS (void *data, ftdm_size_t max, ftdm_size_t *datalen)
|
||||
#define FIO_CONFIGURE_SPAN_ARGS (ftdm_span_t *span, const char *str, ftdm_chan_type_t type, char *name, char *number)
|
||||
#define FIO_CONFIGURE_ARGS (const char *category, const char *var, const char *val, int lineno)
|
||||
#define FIO_OPEN_ARGS (ftdm_channel_t *ftdmchan)
|
||||
#define FIO_CLOSE_ARGS (ftdm_channel_t *ftdmchan)
|
||||
#define FIO_CHANNEL_DESTROY_ARGS (ftdm_channel_t *ftdmchan)
|
||||
#define FIO_SPAN_DESTROY_ARGS (ftdm_span_t *span)
|
||||
#define FIO_COMMAND_ARGS (ftdm_channel_t *ftdmchan, ftdm_command_t command, void *obj)
|
||||
#define FIO_WAIT_ARGS (ftdm_channel_t *ftdmchan, ftdm_wait_flag_t *flags, int32_t to)
|
||||
#define FIO_GET_ALARMS_ARGS (ftdm_channel_t *ftdmchan)
|
||||
#define FIO_READ_ARGS (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen)
|
||||
#define FIO_WRITE_ARGS (ftdm_channel_t *ftdmchan, void *data, ftdm_size_t *datalen)
|
||||
#define FIO_IO_LOAD_ARGS (ftdm_io_interface_t **fio)
|
||||
#define FIO_IO_UNLOAD_ARGS (void)
|
||||
#define FIO_SIG_LOAD_ARGS (void)
|
||||
#define FIO_SIG_CONFIGURE_ARGS (ftdm_span_t *span, fio_signal_cb_t sig_cb, va_list ap)
|
||||
#define FIO_CONFIGURE_SPAN_SIGNALING_ARGS (ftdm_span_t *span, fio_signal_cb_t sig_cb, ftdm_conf_parameter_t *ftdm_parameters)
|
||||
#define FIO_SIG_UNLOAD_ARGS (void)
|
||||
#define FIO_API_ARGS (ftdm_stream_handle_t *stream, const char *data)
|
||||
|
||||
typedef ftdm_status_t (*fio_channel_request_t) FIO_CHANNEL_REQUEST_ARGS ;
|
||||
typedef ftdm_status_t (*fio_channel_outgoing_call_t) FIO_CHANNEL_OUTGOING_CALL_ARGS ;
|
||||
typedef ftdm_status_t (*fio_channel_set_sig_status_t) FIO_CHANNEL_SET_SIG_STATUS_ARGS;
|
||||
typedef ftdm_status_t (*fio_channel_get_sig_status_t) FIO_CHANNEL_GET_SIG_STATUS_ARGS;
|
||||
typedef ftdm_status_t (*fio_span_set_sig_status_t) FIO_SPAN_SET_SIG_STATUS_ARGS;
|
||||
typedef ftdm_status_t (*fio_span_get_sig_status_t) FIO_SPAN_GET_SIG_STATUS_ARGS;
|
||||
typedef ftdm_status_t (*fio_span_poll_event_t) FIO_SPAN_POLL_EVENT_ARGS ;
|
||||
typedef ftdm_status_t (*fio_span_next_event_t) FIO_SPAN_NEXT_EVENT_ARGS ;
|
||||
typedef ftdm_status_t (*fio_signal_cb_t) FIO_SIGNAL_CB_ARGS ;
|
||||
typedef ftdm_status_t (*fio_event_cb_t) FIO_EVENT_CB_ARGS ;
|
||||
typedef ftdm_status_t (*fio_codec_t) FIO_CODEC_ARGS ;
|
||||
typedef ftdm_status_t (*fio_configure_span_t) FIO_CONFIGURE_SPAN_ARGS ;
|
||||
typedef ftdm_status_t (*fio_configure_t) FIO_CONFIGURE_ARGS ;
|
||||
typedef ftdm_status_t (*fio_open_t) FIO_OPEN_ARGS ;
|
||||
typedef ftdm_status_t (*fio_close_t) FIO_CLOSE_ARGS ;
|
||||
typedef ftdm_status_t (*fio_channel_destroy_t) FIO_CHANNEL_DESTROY_ARGS ;
|
||||
typedef ftdm_status_t (*fio_span_destroy_t) FIO_SPAN_DESTROY_ARGS ;
|
||||
typedef ftdm_status_t (*fio_get_alarms_t) FIO_GET_ALARMS_ARGS ;
|
||||
typedef ftdm_status_t (*fio_command_t) FIO_COMMAND_ARGS ;
|
||||
typedef ftdm_status_t (*fio_wait_t) FIO_WAIT_ARGS ;
|
||||
typedef ftdm_status_t (*fio_read_t) FIO_READ_ARGS ;
|
||||
typedef ftdm_status_t (*fio_write_t) FIO_WRITE_ARGS ;
|
||||
typedef ftdm_status_t (*fio_io_load_t) FIO_IO_LOAD_ARGS ;
|
||||
typedef ftdm_status_t (*fio_sig_load_t) FIO_SIG_LOAD_ARGS ;
|
||||
typedef ftdm_status_t (*fio_sig_configure_t) FIO_SIG_CONFIGURE_ARGS ;
|
||||
typedef ftdm_status_t (*fio_configure_span_signaling_t) FIO_CONFIGURE_SPAN_SIGNALING_ARGS ;
|
||||
typedef ftdm_status_t (*fio_io_unload_t) FIO_IO_UNLOAD_ARGS ;
|
||||
typedef ftdm_status_t (*fio_sig_unload_t) FIO_SIG_UNLOAD_ARGS ;
|
||||
typedef ftdm_status_t (*fio_api_t) FIO_API_ARGS ;
|
||||
|
||||
|
||||
#define FIO_CHANNEL_REQUEST_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_REQUEST_ARGS
|
||||
#define FIO_CHANNEL_OUTGOING_CALL_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_OUTGOING_CALL_ARGS
|
||||
#define FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_SET_SIG_STATUS_ARGS
|
||||
#define FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_GET_SIG_STATUS_ARGS
|
||||
#define FIO_SPAN_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_SET_SIG_STATUS_ARGS
|
||||
#define FIO_SPAN_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_GET_SIG_STATUS_ARGS
|
||||
#define FIO_SPAN_POLL_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_POLL_EVENT_ARGS
|
||||
#define FIO_SPAN_NEXT_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_NEXT_EVENT_ARGS
|
||||
#define FIO_SIGNAL_CB_FUNCTION(name) ftdm_status_t name FIO_SIGNAL_CB_ARGS
|
||||
#define FIO_EVENT_CB_FUNCTION(name) ftdm_status_t name FIO_EVENT_CB_ARGS
|
||||
#define FIO_CODEC_FUNCTION(name) FT_DECLARE_NONSTD(ftdm_status_t) name FIO_CODEC_ARGS
|
||||
#define FIO_CONFIGURE_SPAN_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_SPAN_ARGS
|
||||
#define FIO_CONFIGURE_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_ARGS
|
||||
#define FIO_OPEN_FUNCTION(name) ftdm_status_t name FIO_OPEN_ARGS
|
||||
#define FIO_CLOSE_FUNCTION(name) ftdm_status_t name FIO_CLOSE_ARGS
|
||||
#define FIO_CHANNEL_DESTROY_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_DESTROY_ARGS
|
||||
#define FIO_SPAN_DESTROY_FUNCTION(name) ftdm_status_t name FIO_SPAN_DESTROY_ARGS
|
||||
#define FIO_GET_ALARMS_FUNCTION(name) ftdm_status_t name FIO_GET_ALARMS_ARGS
|
||||
#define FIO_COMMAND_FUNCTION(name) ftdm_status_t name FIO_COMMAND_ARGS
|
||||
#define FIO_WAIT_FUNCTION(name) ftdm_status_t name FIO_WAIT_ARGS
|
||||
#define FIO_READ_FUNCTION(name) ftdm_status_t name FIO_READ_ARGS
|
||||
#define FIO_WRITE_FUNCTION(name) ftdm_status_t name FIO_WRITE_ARGS
|
||||
#define FIO_IO_LOAD_FUNCTION(name) ftdm_status_t name FIO_IO_LOAD_ARGS
|
||||
#define FIO_SIG_LOAD_FUNCTION(name) ftdm_status_t name FIO_SIG_LOAD_ARGS
|
||||
#define FIO_SIG_CONFIGURE_FUNCTION(name) ftdm_status_t name FIO_SIG_CONFIGURE_ARGS
|
||||
#define FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_SPAN_SIGNALING_ARGS
|
||||
#define FIO_IO_UNLOAD_FUNCTION(name) ftdm_status_t name FIO_IO_UNLOAD_ARGS
|
||||
#define FIO_SIG_UNLOAD_FUNCTION(name) ftdm_status_t name FIO_SIG_UNLOAD_ARGS
|
||||
#define FIO_API_FUNCTION(name) ftdm_status_t name FIO_API_ARGS
|
||||
|
||||
#include "ftdm_dso.h"
|
||||
|
||||
typedef struct {
|
||||
char name[256];
|
||||
fio_io_load_t io_load;
|
||||
fio_io_unload_t io_unload;
|
||||
fio_sig_load_t sig_load;
|
||||
fio_sig_configure_t sig_configure;
|
||||
fio_sig_unload_t sig_unload;
|
||||
/*!
|
||||
\brief configure a given span signaling
|
||||
\see sig_configure
|
||||
This is just like sig_configure but receives
|
||||
an array of paramters instead of va_list
|
||||
I'd like to deprecate sig_configure and move
|
||||
all modules to use sigparam_configure
|
||||
*/
|
||||
fio_configure_span_signaling_t configure_span_signaling;
|
||||
ftdm_dso_lib_t lib;
|
||||
char path[256];
|
||||
} ftdm_module_t;
|
||||
|
||||
#ifndef __FUNCTION__
|
||||
#define __FUNCTION__ (const char *)__func__
|
||||
#endif
|
||||
|
||||
#define FTDM_PRE __FILE__, __FUNCTION__, __LINE__
|
||||
#define FTDM_LOG_LEVEL_DEBUG 7
|
||||
#define FTDM_LOG_LEVEL_INFO 6
|
||||
#define FTDM_LOG_LEVEL_NOTICE 5
|
||||
#define FTDM_LOG_LEVEL_WARNING 4
|
||||
#define FTDM_LOG_LEVEL_ERROR 3
|
||||
#define FTDM_LOG_LEVEL_CRIT 2
|
||||
#define FTDM_LOG_LEVEL_ALERT 1
|
||||
#define FTDM_LOG_LEVEL_EMERG 0
|
||||
|
||||
#define FTDM_LOG_DEBUG FTDM_PRE, FTDM_LOG_LEVEL_DEBUG
|
||||
#define FTDM_LOG_INFO FTDM_PRE, FTDM_LOG_LEVEL_INFO
|
||||
#define FTDM_LOG_NOTICE FTDM_PRE, FTDM_LOG_LEVEL_NOTICE
|
||||
#define FTDM_LOG_WARNING FTDM_PRE, FTDM_LOG_LEVEL_WARNING
|
||||
#define FTDM_LOG_ERROR FTDM_PRE, FTDM_LOG_LEVEL_ERROR
|
||||
#define FTDM_LOG_CRIT FTDM_PRE, FTDM_LOG_LEVEL_CRIT
|
||||
#define FTDM_LOG_ALERT FTDM_PRE, FTDM_LOG_LEVEL_ALERT
|
||||
#define FTDM_LOG_EMERG FTDM_PRE, FTDM_LOG_LEVEL_EMERG
|
||||
|
||||
typedef struct ftdm_fsk_data_state ftdm_fsk_data_state_t;
|
||||
typedef int (*ftdm_fsk_data_decoder_t)(ftdm_fsk_data_state_t *state);
|
||||
typedef ftdm_status_t (*ftdm_fsk_write_sample_t)(int16_t *buf, ftdm_size_t buflen, void *user_data);
|
||||
typedef void (*ftdm_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...);
|
||||
typedef struct hashtable ftdm_hash_t;
|
||||
typedef struct hashtable_iterator ftdm_hash_iterator_t;
|
||||
typedef struct key ftdm_hash_key_t;
|
||||
typedef struct value ftdm_hash_val_t;
|
||||
typedef struct ftdm_bitstream ftdm_bitstream_t;
|
||||
typedef struct ftdm_fsk_modulator ftdm_fsk_modulator_t;
|
||||
typedef ftdm_status_t (*ftdm_span_start_t)(ftdm_span_t *span);
|
||||
typedef ftdm_status_t (*ftdm_span_stop_t)(ftdm_span_t *span);
|
||||
|
||||
typedef enum {
|
||||
FTDM_CAUSE_NONE = 0,
|
||||
FTDM_CAUSE_UNALLOCATED = 1,
|
||||
FTDM_CAUSE_NO_ROUTE_TRANSIT_NET = 2,
|
||||
FTDM_CAUSE_NO_ROUTE_DESTINATION = 3,
|
||||
FTDM_CAUSE_CHANNEL_UNACCEPTABLE = 6,
|
||||
FTDM_CAUSE_CALL_AWARDED_DELIVERED = 7,
|
||||
FTDM_CAUSE_NORMAL_CLEARING = 16,
|
||||
FTDM_CAUSE_USER_BUSY = 17,
|
||||
FTDM_CAUSE_NO_USER_RESPONSE = 18,
|
||||
FTDM_CAUSE_NO_ANSWER = 19,
|
||||
FTDM_CAUSE_SUBSCRIBER_ABSENT = 20,
|
||||
FTDM_CAUSE_CALL_REJECTED = 21,
|
||||
FTDM_CAUSE_NUMBER_CHANGED = 22,
|
||||
FTDM_CAUSE_REDIRECTION_TO_NEW_DESTINATION = 23,
|
||||
FTDM_CAUSE_EXCHANGE_ROUTING_ERROR = 25,
|
||||
FTDM_CAUSE_DESTINATION_OUT_OF_ORDER = 27,
|
||||
FTDM_CAUSE_INVALID_NUMBER_FORMAT = 28,
|
||||
FTDM_CAUSE_FACILITY_REJECTED = 29,
|
||||
FTDM_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30,
|
||||
FTDM_CAUSE_NORMAL_UNSPECIFIED = 31,
|
||||
FTDM_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34,
|
||||
FTDM_CAUSE_NETWORK_OUT_OF_ORDER = 38,
|
||||
FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE = 41,
|
||||
FTDM_CAUSE_SWITCH_CONGESTION = 42,
|
||||
FTDM_CAUSE_ACCESS_INFO_DISCARDED = 43,
|
||||
FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL = 44,
|
||||
FTDM_CAUSE_PRE_EMPTED = 45,
|
||||
FTDM_CAUSE_FACILITY_NOT_SUBSCRIBED = 50,
|
||||
FTDM_CAUSE_OUTGOING_CALL_BARRED = 52,
|
||||
FTDM_CAUSE_INCOMING_CALL_BARRED = 54,
|
||||
FTDM_CAUSE_BEARERCAPABILITY_NOTAUTH = 57,
|
||||
FTDM_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58,
|
||||
FTDM_CAUSE_SERVICE_UNAVAILABLE = 63,
|
||||
FTDM_CAUSE_BEARERCAPABILITY_NOTIMPL = 65,
|
||||
FTDM_CAUSE_CHAN_NOT_IMPLEMENTED = 66,
|
||||
FTDM_CAUSE_FACILITY_NOT_IMPLEMENTED = 69,
|
||||
FTDM_CAUSE_SERVICE_NOT_IMPLEMENTED = 79,
|
||||
FTDM_CAUSE_INVALID_CALL_REFERENCE = 81,
|
||||
FTDM_CAUSE_INCOMPATIBLE_DESTINATION = 88,
|
||||
FTDM_CAUSE_INVALID_MSG_UNSPECIFIED = 95,
|
||||
FTDM_CAUSE_MANDATORY_IE_MISSING = 96,
|
||||
FTDM_CAUSE_MESSAGE_TYPE_NONEXIST = 97,
|
||||
FTDM_CAUSE_WRONG_MESSAGE = 98,
|
||||
FTDM_CAUSE_IE_NONEXIST = 99,
|
||||
FTDM_CAUSE_INVALID_IE_CONTENTS = 100,
|
||||
FTDM_CAUSE_WRONG_CALL_STATE = 101,
|
||||
FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102,
|
||||
FTDM_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103,
|
||||
FTDM_CAUSE_PROTOCOL_ERROR = 111,
|
||||
FTDM_CAUSE_INTERWORKING = 127,
|
||||
FTDM_CAUSE_SUCCESS = 142,
|
||||
FTDM_CAUSE_ORIGINATOR_CANCEL = 487,
|
||||
FTDM_CAUSE_CRASH = 500,
|
||||
FTDM_CAUSE_SYSTEM_SHUTDOWN = 501,
|
||||
FTDM_CAUSE_LOSE_RACE = 502,
|
||||
FTDM_CAUSE_MANAGER_REQUEST = 503,
|
||||
FTDM_CAUSE_BLIND_TRANSFER = 600,
|
||||
FTDM_CAUSE_ATTENDED_TRANSFER = 601,
|
||||
FTDM_CAUSE_ALLOTTED_TIMEOUT = 602,
|
||||
FTDM_CAUSE_USER_CHALLENGE = 603,
|
||||
FTDM_CAUSE_MEDIA_TIMEOUT = 604
|
||||
} ftdm_call_cause_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
||||
|
395
libs/freetdm/src/include/g711.h
Normal file
395
libs/freetdm/src/include/g711.h
Normal file
@ -0,0 +1,395 @@
|
||||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* g711.h - In line A-law and u-law conversion routines
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2001 Steve Underwood
|
||||
*
|
||||
* Despite my general liking of the GPL, I place this code in the
|
||||
* public domain for the benefit of all mankind - even the slimy
|
||||
* ones who might try to proprietize my work and use it to my
|
||||
* detriment.
|
||||
*
|
||||
* $Id: g711.h,v 1.1 2006/06/07 15:46:39 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
/*! \page g711_page A-law and mu-law handling
|
||||
Lookup tables for A-law and u-law look attractive, until you consider the impact
|
||||
on the CPU cache. If it causes a substantial area of your processor cache to get
|
||||
hit too often, cache sloshing will severely slow things down. The main reason
|
||||
these routines are slow in C, is the lack of direct access to the CPU's "find
|
||||
the first 1" instruction. A little in-line assembler fixes that, and the
|
||||
conversion routines can be faster than lookup tables, in most real world usage.
|
||||
A "find the first 1" instruction is available on most modern CPUs, and is a
|
||||
much underused feature.
|
||||
|
||||
If an assembly language method of bit searching is not available, these routines
|
||||
revert to a method that can be a little slow, so the cache thrashing might not
|
||||
seem so bad :(
|
||||
|
||||
Feel free to submit patches to add fast "find the first 1" support for your own
|
||||
favourite processor.
|
||||
|
||||
Look up tables are used for transcoding between A-law and u-law, since it is
|
||||
difficult to achieve the precise transcoding procedure laid down in the G.711
|
||||
specification by other means.
|
||||
*/
|
||||
|
||||
#if !defined(_G711_H_)
|
||||
#define _G711_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
/*! \brief Find the bit position of the highest set bit in a word
|
||||
\param bits The word to be searched
|
||||
\return The bit number of the highest set bit, or -1 if the word is zero. */
|
||||
static __inline__ int top_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movl $-1,%%edx;\n"
|
||||
" bsrl %%eax,%%edx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*! \brief Find the bit position of the lowest set bit in a word
|
||||
\param bits The word to be searched
|
||||
\return The bit number of the lowest set bit, or -1 if the word is zero. */
|
||||
static __inline__ int bottom_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movl $-1,%%edx;\n"
|
||||
" bsfl %%eax,%%edx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#elif defined(__x86_64__)
|
||||
static __inline__ int top_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movq $-1,%%rdx;\n"
|
||||
" bsrq %%rax,%%rdx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ int bottom_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movq $-1,%%rdx;\n"
|
||||
" bsfq %%rax,%%rdx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#else
|
||||
static __inline__ int top_bit(unsigned int bits)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (bits == 0)
|
||||
return -1;
|
||||
i = 0;
|
||||
if (bits & 0xFFFF0000)
|
||||
{
|
||||
bits &= 0xFFFF0000;
|
||||
i += 16;
|
||||
}
|
||||
if (bits & 0xFF00FF00)
|
||||
{
|
||||
bits &= 0xFF00FF00;
|
||||
i += 8;
|
||||
}
|
||||
if (bits & 0xF0F0F0F0)
|
||||
{
|
||||
bits &= 0xF0F0F0F0;
|
||||
i += 4;
|
||||
}
|
||||
if (bits & 0xCCCCCCCC)
|
||||
{
|
||||
bits &= 0xCCCCCCCC;
|
||||
i += 2;
|
||||
}
|
||||
if (bits & 0xAAAAAAAA)
|
||||
{
|
||||
bits &= 0xAAAAAAAA;
|
||||
i += 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ int bottom_bit(unsigned int bits)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (bits == 0)
|
||||
return -1;
|
||||
i = 32;
|
||||
if (bits & 0x0000FFFF)
|
||||
{
|
||||
bits &= 0x0000FFFF;
|
||||
i -= 16;
|
||||
}
|
||||
if (bits & 0x00FF00FF)
|
||||
{
|
||||
bits &= 0x00FF00FF;
|
||||
i -= 8;
|
||||
}
|
||||
if (bits & 0x0F0F0F0F)
|
||||
{
|
||||
bits &= 0x0F0F0F0F;
|
||||
i -= 4;
|
||||
}
|
||||
if (bits & 0x33333333)
|
||||
{
|
||||
bits &= 0x33333333;
|
||||
i -= 2;
|
||||
}
|
||||
if (bits & 0x55555555)
|
||||
{
|
||||
bits &= 0x55555555;
|
||||
i -= 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
/* N.B. It is tempting to use look-up tables for A-law and u-law conversion.
|
||||
* However, you should consider the cache footprint.
|
||||
*
|
||||
* A 64K byte table for linear to x-law and a 512 byte table for x-law to
|
||||
* linear sound like peanuts these days, and shouldn't an array lookup be
|
||||
* real fast? No! When the cache sloshes as badly as this one will, a tight
|
||||
* calculation may be better. The messiest part is normally finding the
|
||||
* segment, but a little inline assembly can fix that on an i386, x86_64 and
|
||||
* many other modern processors.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mu-law is basically as follows:
|
||||
*
|
||||
* Biased Linear Input Code Compressed Code
|
||||
* ------------------------ ---------------
|
||||
* 00000001wxyza 000wxyz
|
||||
* 0000001wxyzab 001wxyz
|
||||
* 000001wxyzabc 010wxyz
|
||||
* 00001wxyzabcd 011wxyz
|
||||
* 0001wxyzabcde 100wxyz
|
||||
* 001wxyzabcdef 101wxyz
|
||||
* 01wxyzabcdefg 110wxyz
|
||||
* 1wxyzabcdefgh 111wxyz
|
||||
*
|
||||
* Each biased linear code has a leading 1 which identifies the segment
|
||||
* number. The value of the segment number is equal to 7 minus the number
|
||||
* of leading 0's. The quantization interval is directly available as the
|
||||
* four bits wxyz. * The trailing bits (a - h) are ignored.
|
||||
*
|
||||
* Ordinarily the complement of the resulting code word is used for
|
||||
* transmission, and so the code word is complemented before it is returned.
|
||||
*
|
||||
* For further information see John C. Bellamy's Digital Telephony, 1982,
|
||||
* John Wiley & Sons, pps 98-111 and 472-476.
|
||||
*/
|
||||
|
||||
/*#define ULAW_ZEROTRAP*/ /* turn on the trap as per the MIL-STD */
|
||||
#define ULAW_BIAS 0x84 /* Bias for linear code. */
|
||||
|
||||
/*! \brief Encode a linear sample to u-law
|
||||
\param linear The sample to encode.
|
||||
\return The u-law value.
|
||||
*/
|
||||
static __inline__ uint8_t linear_to_ulaw(int linear)
|
||||
{
|
||||
uint8_t u_val;
|
||||
int mask;
|
||||
int seg;
|
||||
|
||||
/* Get the sign and the magnitude of the value. */
|
||||
if (linear < 0)
|
||||
{
|
||||
linear = ULAW_BIAS - linear;
|
||||
mask = 0x7F;
|
||||
}
|
||||
else
|
||||
{
|
||||
linear = ULAW_BIAS + linear;
|
||||
mask = 0xFF;
|
||||
}
|
||||
|
||||
seg = top_bit(linear | 0xFF) - 7;
|
||||
|
||||
/*
|
||||
* Combine the sign, segment, quantization bits,
|
||||
* and complement the code word.
|
||||
*/
|
||||
if (seg >= 8)
|
||||
u_val = (uint8_t) (0x7F ^ mask);
|
||||
else
|
||||
u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
|
||||
#ifdef ULAW_ZEROTRAP
|
||||
/* Optional ITU trap */
|
||||
if (u_val == 0)
|
||||
u_val = 0x02;
|
||||
#endif
|
||||
return u_val;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*! \brief Decode an u-law sample to a linear value.
|
||||
\param ulaw The u-law sample to decode.
|
||||
\return The linear value.
|
||||
*/
|
||||
static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
|
||||
{
|
||||
int t;
|
||||
|
||||
/* Complement to obtain normal u-law value. */
|
||||
ulaw = ~ulaw;
|
||||
/*
|
||||
* Extract and bias the quantization bits. Then
|
||||
* shift up by the segment number and subtract out the bias.
|
||||
*/
|
||||
t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
|
||||
return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* A-law is basically as follows:
|
||||
*
|
||||
* Linear Input Code Compressed Code
|
||||
* ----------------- ---------------
|
||||
* 0000000wxyza 000wxyz
|
||||
* 0000001wxyza 001wxyz
|
||||
* 000001wxyzab 010wxyz
|
||||
* 00001wxyzabc 011wxyz
|
||||
* 0001wxyzabcd 100wxyz
|
||||
* 001wxyzabcde 101wxyz
|
||||
* 01wxyzabcdef 110wxyz
|
||||
* 1wxyzabcdefg 111wxyz
|
||||
*
|
||||
* For further information see John C. Bellamy's Digital Telephony, 1982,
|
||||
* John Wiley & Sons, pps 98-111 and 472-476.
|
||||
*/
|
||||
|
||||
#define ALAW_AMI_MASK 0x55
|
||||
|
||||
/*! \brief Encode a linear sample to A-law
|
||||
\param linear The sample to encode.
|
||||
\return The A-law value.
|
||||
*/
|
||||
static __inline__ uint8_t linear_to_alaw(int linear)
|
||||
{
|
||||
int mask;
|
||||
int seg;
|
||||
|
||||
if (linear >= 0)
|
||||
{
|
||||
/* Sign (bit 7) bit = 1 */
|
||||
mask = ALAW_AMI_MASK | 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Sign (bit 7) bit = 0 */
|
||||
mask = ALAW_AMI_MASK;
|
||||
linear = -linear - 8;
|
||||
}
|
||||
|
||||
/* Convert the scaled magnitude to segment number. */
|
||||
seg = top_bit(linear | 0xFF) - 7;
|
||||
if (seg >= 8)
|
||||
{
|
||||
if (linear >= 0)
|
||||
{
|
||||
/* Out of range. Return maximum value. */
|
||||
return (uint8_t) (0x7F ^ mask);
|
||||
}
|
||||
/* We must be just a tiny step below zero */
|
||||
return (uint8_t) (0x00 ^ mask);
|
||||
}
|
||||
/* Combine the sign, segment, and quantization bits. */
|
||||
return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*! \brief Decode an A-law sample to a linear value.
|
||||
\param alaw The A-law sample to decode.
|
||||
\return The linear value.
|
||||
*/
|
||||
static __inline__ int16_t alaw_to_linear(uint8_t alaw)
|
||||
{
|
||||
int i;
|
||||
int seg;
|
||||
|
||||
alaw ^= ALAW_AMI_MASK;
|
||||
i = ((alaw & 0x0F) << 4);
|
||||
seg = (((int) alaw & 0x70) >> 4);
|
||||
if (seg)
|
||||
i = (i + 0x108) << (seg - 1);
|
||||
else
|
||||
i += 8;
|
||||
return (int16_t) ((alaw & 0x80) ? i : -i);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
|
||||
\param alaw The A-law sample to transcode.
|
||||
\return The best matching u-law value.
|
||||
*/
|
||||
uint8_t alaw_to_ulaw(uint8_t alaw);
|
||||
|
||||
/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
|
||||
\param alaw The u-law sample to transcode.
|
||||
\return The best matching A-law value.
|
||||
*/
|
||||
uint8_t ulaw_to_alaw(uint8_t ulaw);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
||||
*/
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user