wanpipe-3.5.19.tgz
This commit is contained in:
parent
c4e2ca6eb6
commit
05f167d7bf
|
@ -1 +1 @@
|
|||
wanpipe-3.5.18
|
||||
wanpipe-3.5.19
|
||||
|
|
|
@ -3,12 +3,36 @@ WANPIPE TDM VOICE - IP/WAN Package
|
|||
|
||||
------------------------------------------------------------------------------
|
||||
Author: Nenad Corbic <ncorbic@sangoma.com>
|
||||
Copyright (c) 1995-2010 Sangoma Technologies Inc.
|
||||
Copyright (c) 1995-2011 Sangoma Technologies Inc.
|
||||
|
||||
For more info visit: http://wiki.sangoma.com
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
* Fri Mar 1 2011 Nenad Corbic <ncorbic@sangoma.com> - 3.5.19
|
||||
==================================================================
|
||||
|
||||
- Fixed scripts for Ubuntu
|
||||
- TDM API updated Tone Event API to include tone type
|
||||
DTMF, FAX_1100, FAX_2100, FAX_2100_WSPR
|
||||
- Fixes for latest 2.6.36 linux kernel
|
||||
- Fixes for TTY Driver for 2.6.32 linux kernel
|
||||
- BRI default idle set to 0xFF so it does not interfere
|
||||
with multi-port mode.
|
||||
- BRI NT & TE activation/deactivation logic update.
|
||||
- Dahdi Yellow alarm reporting fix
|
||||
Wanpipe driver did not report yellow alarms properly to dahdi
|
||||
- T1 Automatic AIS on LOS option now optional
|
||||
Previoulsy the T1 code enabled automatic AIS on LOS by default.
|
||||
This is now an option TE_AIS_AUTO_ON_LOS=YES|NO
|
||||
Default behaviour is to send Yellow alarm on link down.
|
||||
- Fixed a TE1 startup race condition bug.
|
||||
It was possible for T1/E1 interrupt to occour before
|
||||
configuration was completel
|
||||
- Fixed wanpipe.spec for dahdi RPM build
|
||||
- Added serial clock recovery feature
|
||||
|
||||
|
||||
* Fri Nov 22 2010 Nenad Corbic <ncorbic@sangoma.com> - 3.5.18
|
||||
==================================================================
|
||||
|
||||
|
|
41
Makefile
41
Makefile
|
@ -124,7 +124,7 @@ else
|
|||
ifneq (,$(wildcard $(ZAPDIR)/kernel/zaptel.h))
|
||||
ZAPDIR_PRIV=$(ZAPDIR)
|
||||
ENABLE_WANPIPEMON_ZAP=YES
|
||||
DHADI_CFLAGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I$(ZAPDIR)/kernel
|
||||
DAHDI_CFLAGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -I$(ZAPDIR)/kernel
|
||||
ZAP_OPTS= --zaptel-path=$(ZAPDIR)
|
||||
ZAP_PROT=TDM
|
||||
PROTS=DEF-TDM
|
||||
|
@ -165,39 +165,35 @@ else
|
|||
#This will check for zaptel, kenrel source and build utilites and kernel modules
|
||||
#within local directory structure
|
||||
|
||||
all: freetdm
|
||||
all: freetdm
|
||||
|
||||
all_wan: cleanup_local _checkzap _checksrc all_bin_kmod all_util
|
||||
all_wan: cleanup_local _checkzap _checksrc all_bin_kmod all_util all_lib
|
||||
|
||||
all_src_dahdi: cleanup_local _checkzap _checksrc all_kmod_dahdi all_util
|
||||
all_src_dahdi: cleanup_local _checkzap _checksrc all_kmod_dahdi all_util all_lib
|
||||
|
||||
all_src: cleanup_local _checksrc all_kmod all_util
|
||||
all_src: cleanup_local _checksrc all_kmod all_util all_lib
|
||||
|
||||
all_src_ss7: cleanup_local _checkzap _checksrc all_kmod_ss7 all_util
|
||||
all_src_ss7: cleanup_local _checkzap _checksrc all_kmod_ss7 all_util all_lib
|
||||
|
||||
dahdi: all_src_dahdi
|
||||
|
||||
zaptel: dahdi
|
||||
|
||||
freetdm: all_src all_lib
|
||||
@touch .all_lib .freetdm
|
||||
freetdm: all_src
|
||||
@touch .no_legacy_smg
|
||||
|
||||
openzap:freetdm
|
||||
smg: freetdm
|
||||
fs: freetdm
|
||||
|
||||
g3ti: all_src all_lib
|
||||
@touch .all_lib .freetdm
|
||||
g3ti: freetdm
|
||||
|
||||
openzap_ss7: all_src_ss7 all_lib
|
||||
@touch .all_lib
|
||||
|
||||
tdmapi: all_src all_lib
|
||||
@touch .all_lib
|
||||
|
||||
cleanup_local:
|
||||
@rm -f .all* 2> /dev/null;
|
||||
@rm -f .freetdm 2> /dev/null;
|
||||
@rm -f .no_legacy_smg 2> /dev/null;
|
||||
|
||||
|
||||
|
||||
|
@ -231,8 +227,8 @@ clean: cleanup_local clean_util _cleanoldwanpipe
|
|||
$(MAKE) -C api SUBDIRS=$(WAN_DIR) clean
|
||||
@find patches/kdrivers -name '.*.cmd' | xargs rm -f
|
||||
@find . -name 'Module.symver*' | xargs rm -f
|
||||
@if [ -e .freetdm ]; then \
|
||||
rm -f .freetdm; \
|
||||
@if [ -e .no_legacy_smg ]; then \
|
||||
rm -f .no_legacy_smg; \
|
||||
fi
|
||||
|
||||
|
||||
|
@ -315,7 +311,7 @@ _checkzap:
|
|||
@sleep 2;
|
||||
|
||||
#Install all utilities etc and modules
|
||||
install: install_util install_etc install_kmod install_inc
|
||||
install: install_etc install_util install_kmod install_inc
|
||||
@if [ -e .all_lib ] ; then \
|
||||
$(MAKE) -C api/libsangoma install DESTDIR=$(INSTALLPREFIX); \
|
||||
$(MAKE) -C api/libstelephony install DESTDIR=$(INSTALLPREFIX); \
|
||||
|
@ -354,8 +350,8 @@ endif
|
|||
all_util: install_inc
|
||||
$(MAKE) -C util all EXTRA_FLAGS="$(EXTRA_UTIL_FLAGS)" SYSINC="$(PWD)/$(WINCLUDE) -I $(PWD)/api/libsangoma/include" CC=$(CC) \
|
||||
PREFIX=$(INSTALLPREFIX) HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" ARCH=$(WARCH)
|
||||
$(MAKE) -C util all_wancfg EXTRA_FLAGS="$(EXTRA_UTIL_FLAGS)" SYSINC="$(PWD)/$(WINCLUDE) -I$(PWD)/api/libsangoma/include" CC=$(CC) \
|
||||
PREFIX=$(INSTALLPREFIX) HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" ARCH=$(WARCH)
|
||||
$(MAKE) -C util all_wancfg EXTRA_FLAGS="$(EXTRA_UTIL_FLAGS)" SYSINC="$(PWD)/$(WINCLUDE) -I$(PWD)/api/libsangoma/include" CC=$(CC) \
|
||||
PREFIX=$(INSTALLPREFIX) HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" ARCH=$(WARCH) 2> /dev/null
|
||||
|
||||
all_lib:
|
||||
$(shell cd api/libsangoma; ./init-automake.sh >> $(PWD)/.cfg_log; ./configure --prefix=$(LIBPREFIX) >> $(PWD)/.cfg_log;)
|
||||
|
@ -364,6 +360,7 @@ all_lib:
|
|||
$(shell cd api/libstelephony; ./init-automake.sh >> $(PWD)/.cfg_log; ./configure --prefix=$(LIBPREFIX) >> $(PWD)/.cfg_log;)
|
||||
$(MAKE) -C api/libstelephony clean
|
||||
$(MAKE) -C api/libstelephony all
|
||||
@touch .all_lib
|
||||
|
||||
install_lib:
|
||||
$(MAKE) -C api/libsangoma install DESTDIR=$(INSTALLPREFIX)
|
||||
|
@ -387,7 +384,7 @@ install_bri:
|
|||
|
||||
install_smgpri:
|
||||
$(MAKE) -C ssmg/sangoma_pri/ install SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) DESTDIR=$(INSTALLPREFIX)
|
||||
@if [ ! -e .freetdm ]; then \
|
||||
@if [ ! -e .no_legacy_smg ]; then \
|
||||
@echo "Installing Sangoma MGD"; \
|
||||
$(MAKE) -C ssmg/sangoma_mgd.trunk/ install SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PRI=YES DESTDIR=$(INSTALLPREFIX) ; \
|
||||
fi
|
||||
|
@ -412,6 +409,7 @@ install_pri_update:
|
|||
install_etc:
|
||||
@if [ ! -e $(INSTALLPREFIX)/etc/wanpipe ]; then \
|
||||
mkdir -p $(INSTALLPREFIX)/etc/wanpipe; \
|
||||
mkdir -p $(INSTALLPREFIX)/etc/wanpipe/util; \
|
||||
fi
|
||||
@if [ ! -e $(INSTALLPREFIX)/etc/wanpipe/wanrouter.rc ]; then \
|
||||
install -D -m 644 samples/wanrouter.rc $(INSTALLPREFIX)/etc/wanpipe/wanrouter.rc; \
|
||||
|
@ -429,6 +427,9 @@ install_etc:
|
|||
mkdir -p $(INSTALLPREFIX)/etc/wanpipe/scripts; \
|
||||
fi
|
||||
@\cp -rf wan_ec $(INSTALLPREFIX)/etc/wanpipe/
|
||||
@\cp -rf api $(INSTALLPREFIX)/etc/wanpipe/
|
||||
@\cp -rf util/wan_aftup $(INSTALLPREFIX)/etc/wanpipe/util/
|
||||
@\cp -rf util/wanec_apilib $(INSTALLPREFIX)/etc/wanpipe/util/
|
||||
@install -D -m 755 samples/wanrouter $(INSTALLPREFIX)/usr/sbin/wanrouter
|
||||
@echo
|
||||
@echo "Wanpipe etc installed in $(INSTALLPREFIX)/etc/wanpipe";
|
||||
|
|
23
Setup
23
Setup
|
@ -1456,7 +1456,7 @@ create_mataconf()
|
|||
# Select directory for the log file.
|
||||
if [ -d /var/log ]; then
|
||||
LOG_FILE=/var/log/$PROD
|
||||
elif [ -d /var/adm wanpipe1]; then
|
||||
elif [ -d /var/adm ]; then
|
||||
LOG_FILE=/var/adm/$PROD
|
||||
else
|
||||
LOG_FILE=/etc/wanpipe/$PROD.log
|
||||
|
@ -1903,7 +1903,7 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
|
|||
wanpipe utilities (ex: make menuconfig and make dep)."
|
||||
echo
|
||||
pause
|
||||
return 0
|
||||
#return 0
|
||||
fi
|
||||
|
||||
if [ ! -e $SOURCEDIR/include/linux/version.h ]; then
|
||||
|
@ -1913,7 +1913,7 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
|
|||
wanpipe utilities (ex: make menuconfig and make dep)."
|
||||
echo
|
||||
pause
|
||||
return 0
|
||||
#return 0
|
||||
fi
|
||||
|
||||
|
||||
|
@ -2157,7 +2157,6 @@ clean_up ()
|
|||
|
||||
[ -f "/etc/router.rc" ] && rm -f /etc/router.rc
|
||||
|
||||
eval "./patches/restore_wanrouter.sh"
|
||||
}
|
||||
|
||||
get_distrib()
|
||||
|
@ -7283,7 +7282,7 @@ KERNEL_UNAME=`uname -r`
|
|||
PKG_NAME=wanpipe
|
||||
DISTR_NAME="WANPIPE"
|
||||
PROD=wanrouter
|
||||
PROD_VER=3.5.18
|
||||
PROD_VER=3.5.19
|
||||
PROD_HOME=`pwd`
|
||||
META_CONF=$PROD_HOME/$PROD.rc
|
||||
WAN_INTR_DIR=$PROD_HOME/interfaces
|
||||
|
@ -7545,11 +7544,6 @@ if [ "$setup_cmd" = "install_init" ]; then
|
|||
exit;
|
||||
fi
|
||||
|
||||
if [ "$setup_cmd" = "uninstall" ] || [ "$setup_cmd" = "remove" ]; then
|
||||
remove;
|
||||
uninstall_all
|
||||
exit;
|
||||
fi
|
||||
|
||||
if [ "$setup_cmd" = "zaptel" ] || [ "$setup_cmd" = "dahdi" ] ; then
|
||||
zaptel_auto_install="YES"
|
||||
|
@ -7835,7 +7829,7 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then
|
|||
--arch*)
|
||||
ARCH=`echo $arg | cut -d'=' -f2`;
|
||||
|
||||
if [ $ARCH != "i686" ] && [ $ARCH != "i586" ] && [ $ARCH != "i486" ] && [ $ARCH != "i386" ] && [$ARCH !="x86_64" ]; then
|
||||
if [ $ARCH != "i686" ] && [ $ARCH != "i586" ] && [ $ARCH != "i486" ] && [ $ARCH != "i386" ] && [ $ARCH != "x86_64" ]; then
|
||||
echo "Error: Invalid Architecture [i686|i586|i486|i386|x86_64]\n"
|
||||
exit 1;
|
||||
fi
|
||||
|
@ -8231,6 +8225,13 @@ ENDOFTEXT
|
|||
fi
|
||||
|
||||
|
||||
if [ "$setup_cmd" = "uninstall" ] || [ "$setup_cmd" = "remove" ]; then
|
||||
remove;
|
||||
uninstall_all
|
||||
exit;
|
||||
fi
|
||||
|
||||
|
||||
if [ "$setup_cmd" != "install" ] && [ "$setup_cmd" != "upgrade" ]; then
|
||||
usage
|
||||
exit 1
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
# define wan_inline __inline
|
||||
|
|
|
@ -1,257 +1,257 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 34
|
||||
/svn/libsangoma/!svn/ver/322/trunk
|
||||
V 66
|
||||
/svn/libsangoma/!svn/ver/333/branches/unified_rlease_Win6.0_Lnx3.5
|
||||
END
|
||||
init-automake.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 51
|
||||
/svn/libsangoma/!svn/ver/222/trunk/init-automake.sh
|
||||
V 83
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/init-automake.sh
|
||||
END
|
||||
configure
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 44
|
||||
/svn/libsangoma/!svn/ver/316/trunk/configure
|
||||
V 76
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/configure
|
||||
END
|
||||
Makefile.in
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/311/trunk/Makefile.in
|
||||
V 78
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/Makefile.in
|
||||
END
|
||||
libsangoma_config.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 54
|
||||
/svn/libsangoma/!svn/ver/314/trunk/libsangoma_config.c
|
||||
V 86
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma_config.c
|
||||
END
|
||||
sources
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 42
|
||||
/svn/libsangoma/!svn/ver/314/trunk/sources
|
||||
END
|
||||
AUTHORS
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/AUTHORS
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sources
|
||||
END
|
||||
libhpsangoma_priv.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 54
|
||||
/svn/libsangoma/!svn/ver/222/trunk/libhpsangoma_priv.c
|
||||
V 86
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libhpsangoma_priv.c
|
||||
END
|
||||
AUTHORS
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/AUTHORS
|
||||
END
|
||||
depcomp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/depcomp
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/depcomp
|
||||
END
|
||||
compile
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/compile
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/compile
|
||||
END
|
||||
libhpsangoma_priv.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 54
|
||||
/svn/libsangoma/!svn/ver/222/trunk/libhpsangoma_priv.h
|
||||
V 86
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libhpsangoma_priv.h
|
||||
END
|
||||
libsangoma-doxygen.config
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 60
|
||||
/svn/libsangoma/!svn/ver/135/trunk/libsangoma-doxygen.config
|
||||
END
|
||||
libsangoma.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 47
|
||||
/svn/libsangoma/!svn/ver/322/trunk/libsangoma.c
|
||||
V 92
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma-doxygen.config
|
||||
END
|
||||
compile.bat
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/libsangoma/!svn/ver/32/trunk/compile.bat
|
||||
V 78
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/compile.bat
|
||||
END
|
||||
libsangoma.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 79
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma.c
|
||||
END
|
||||
cleanup.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/libsangoma/!svn/ver/244/trunk/cleanup.sh
|
||||
V 77
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/cleanup.sh
|
||||
END
|
||||
libsangoma.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 47
|
||||
/svn/libsangoma/!svn/ver/311/trunk/libsangoma.h
|
||||
V 79
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma.h
|
||||
END
|
||||
libsangoma_hwec.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 52
|
||||
/svn/libsangoma/!svn/ver/279/trunk/libsangoma_hwec.c
|
||||
V 84
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma_hwec.c
|
||||
END
|
||||
g711.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 41
|
||||
/svn/libsangoma/!svn/ver/222/trunk/g711.h
|
||||
V 73
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/g711.h
|
||||
END
|
||||
INSTALL
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/INSTALL
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/INSTALL
|
||||
END
|
||||
build.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/libsangoma/!svn/ver/222/trunk/build.sh
|
||||
V 75
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/build.sh
|
||||
END
|
||||
COPYING
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/COPYING
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/COPYING
|
||||
END
|
||||
NEWS
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 37
|
||||
/svn/libsangoma/!svn/ver/1/trunk/NEWS
|
||||
V 71
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/NEWS
|
||||
END
|
||||
bootstrap
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 44
|
||||
/svn/libsangoma/!svn/ver/199/trunk/bootstrap
|
||||
V 76
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/bootstrap
|
||||
END
|
||||
libsangoma.rc
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/libsangoma/!svn/ver/146/trunk/libsangoma.rc
|
||||
END
|
||||
sangoma_pri.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/libsangoma/!svn/ver/222/trunk/sangoma_pri.c
|
||||
V 80
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma.rc
|
||||
END
|
||||
libsangoma.so.conf
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 51
|
||||
/svn/libsangoma/!svn/ver/1/trunk/libsangoma.so.conf
|
||||
V 85
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma.so.conf
|
||||
END
|
||||
sangoma_pri.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 80
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sangoma_pri.c
|
||||
END
|
||||
libhpsangoma-doxygen.config
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 61
|
||||
/svn/libsangoma/!svn/ver/50/trunk/libhpsangoma-doxygen.config
|
||||
END
|
||||
sangoma_pri.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/libsangoma/!svn/ver/222/trunk/sangoma_pri.h
|
||||
V 94
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libhpsangoma-doxygen.config
|
||||
END
|
||||
version
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/version
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/version
|
||||
END
|
||||
sangoma_pri.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 80
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sangoma_pri.h
|
||||
END
|
||||
libhpsangoma.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 49
|
||||
/svn/libsangoma/!svn/ver/222/trunk/libhpsangoma.c
|
||||
V 81
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libhpsangoma.c
|
||||
END
|
||||
configure.in
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 47
|
||||
/svn/libsangoma/!svn/ver/316/trunk/configure.in
|
||||
V 79
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/configure.in
|
||||
END
|
||||
ChangeLog
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 42
|
||||
/svn/libsangoma/!svn/ver/1/trunk/ChangeLog
|
||||
V 76
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/ChangeLog
|
||||
END
|
||||
libhpsangoma.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 49
|
||||
/svn/libsangoma/!svn/ver/222/trunk/libhpsangoma.h
|
||||
V 81
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libhpsangoma.h
|
||||
END
|
||||
README
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 39
|
||||
/svn/libsangoma/!svn/ver/1/trunk/README
|
||||
V 73
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/README
|
||||
END
|
||||
config.h.in
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/222/trunk/config.h.in
|
||||
V 78
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/config.h.in
|
||||
END
|
||||
libsangoma.sln
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 49
|
||||
/svn/libsangoma/!svn/ver/235/trunk/libsangoma.sln
|
||||
END
|
||||
Makefile.am
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/311/trunk/Makefile.am
|
||||
END
|
||||
missing
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/missing
|
||||
END
|
||||
libsangoma.def
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 49
|
||||
/svn/libsangoma/!svn/ver/322/trunk/libsangoma.def
|
||||
V 81
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma.sln
|
||||
END
|
||||
libsangoma-pvt.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 51
|
||||
/svn/libsangoma/!svn/ver/314/trunk/libsangoma-pvt.h
|
||||
V 83
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma-pvt.h
|
||||
END
|
||||
libsangoma.def
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 81
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma.def
|
||||
END
|
||||
Makefile.am
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 78
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/Makefile.am
|
||||
END
|
||||
missing
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 74
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/missing
|
||||
END
|
||||
libsangoma_utils.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/307/trunk/libsangoma_utils.c
|
||||
END
|
||||
install-sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/libsangoma/!svn/ver/1/trunk/install-sh
|
||||
V 85
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma_utils.c
|
||||
END
|
||||
libsangoma.vcproj
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 52
|
||||
/svn/libsangoma/!svn/ver/322/trunk/libsangoma.vcproj
|
||||
V 84
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/libsangoma.vcproj
|
||||
END
|
||||
install-sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 77
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/install-sh
|
||||
END
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
2010-11-11T19:01:32.713267Z
|
||||
322
|
||||
2011-01-19T21:27:38.629735Z
|
||||
333
|
||||
davidr
|
||||
has-props
|
||||
|
||||
|
@ -32,7 +32,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
3accc8de43673675a4464508f1b14a6a
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
|
@ -45,7 +45,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-10-08T20:01:04.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
26519856dd60c05ce26bcad1c142f37c
|
||||
2010-10-08T21:37:17.977975Z
|
||||
316
|
||||
|
@ -58,7 +58,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-10-08T20:01:03.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
5ae53af68fd79b1265e8dd17d417a0a1
|
||||
2010-09-27T18:07:21.223585Z
|
||||
311
|
||||
|
@ -70,7 +70,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-10-01T21:04:29.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
de99c99d999b3c9d39337397856a839f
|
||||
2010-09-28T19:41:22.543877Z
|
||||
314
|
||||
|
@ -85,73 +85,73 @@ file
|
|||
|
||||
|
||||
|
||||
2010-10-01T21:04:29.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
84884475da0ed63ae785369108234305
|
||||
2010-09-28T19:41:22.543877Z
|
||||
314
|
||||
davidr
|
||||
|
||||
AUTHORS
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
libhpsangoma_priv.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
6311c0e89812fa88c9a1f2ef7784a3f3
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
AUTHORS
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
depcomp
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
e181e2c8720c60522c4c4c981108e367
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
compile
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
a7ecc032b527a0d578545f19d3418073
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
docs
|
||||
dir
|
||||
|
||||
compile
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
a7ecc032b527a0d578545f19d3418073
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
libhpsangoma_priv.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
53f977038b3fb8b3a679e9fbd43e620e
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
|
@ -164,44 +164,44 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
fd2f056fa00d98b918d141f218a000f8
|
||||
2009-04-01T21:38:17.305658Z
|
||||
135
|
||||
ncorbic
|
||||
|
||||
compile.bat
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
5b82f62f87e4700af9b7e48c658b2cfc
|
||||
2008-11-28T23:21:04.815499Z
|
||||
32
|
||||
davidr
|
||||
|
||||
libsangoma.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-11-16T17:51:09.000000Z
|
||||
559385f94244193b33ee08804b1025ec
|
||||
2010-11-11T19:01:32.713267Z
|
||||
322
|
||||
2011-01-28T17:40:50.000000Z
|
||||
31ccff782c4a26dd5da47661a6d08573
|
||||
2011-01-06T17:30:24.762134Z
|
||||
329
|
||||
davidr
|
||||
has-props
|
||||
|
||||
compile.bat
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
5b82f62f87e4700af9b7e48c658b2cfc
|
||||
2008-11-28T23:21:04.815499Z
|
||||
32
|
||||
davidr
|
||||
|
||||
cleanup.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-01-11T23:26:54.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
692904ce7758fc035273cbe52fb10127
|
||||
2010-01-12T01:27:55.842408Z
|
||||
244
|
||||
|
@ -214,11 +214,11 @@ file
|
|||
|
||||
|
||||
|
||||
2010-09-27T20:07:44.000000Z
|
||||
a411c1867d91f266792ae40429c57416
|
||||
2010-09-27T18:07:21.223585Z
|
||||
311
|
||||
ncorbic
|
||||
2011-01-28T17:40:50.000000Z
|
||||
20fe03549343f6c4cc937be854da7328
|
||||
2011-01-06T17:30:24.762134Z
|
||||
329
|
||||
davidr
|
||||
has-props
|
||||
|
||||
libsangoma_hwec.c
|
||||
|
@ -227,7 +227,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-06-04T16:18:07.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
59eb5313edc41327b1bcef36b70bb9d4
|
||||
2010-05-28T23:22:41.955986Z
|
||||
279
|
||||
|
@ -239,7 +239,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
0f725f95ced42af15dcaef21f3a1722b
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
|
@ -252,7 +252,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
40539bd3eff06e4b82f380103145415b
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
|
@ -264,7 +264,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
f9109b55d1a9940209c4430121564f71
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
|
@ -277,7 +277,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
|
@ -289,7 +289,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
|
@ -301,7 +301,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
9fb7603b06c96163344636bf36410d64
|
||||
2009-06-26T19:39:04.828119Z
|
||||
199
|
||||
|
@ -313,72 +313,59 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
5f46b82087b742e186dea4a23a18fc88
|
||||
2009-04-22T20:41:57.677943Z
|
||||
146
|
||||
davidr
|
||||
|
||||
sangoma_pri.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
59210eaa3523ca8fdc605f5651fe2533
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
libsangoma.so.conf
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
bcdcb23c5d5fb460cee2ce315ef7bd32
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
sangoma_pri.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
59210eaa3523ca8fdc605f5651fe2533
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
sample_c
|
||||
dir
|
||||
|
||||
libhpsangoma-doxygen.config
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
85429a0c83986ff69262848d5a5d453f
|
||||
2008-12-10T01:33:45.806759Z
|
||||
50
|
||||
ncorbic
|
||||
|
||||
sample_c
|
||||
dir
|
||||
|
||||
libhpsangoma.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
f487a2c347c2ff3e6633ea7022b649e3
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
sangoma_pri.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
7e23f30d22f5d2542866f5b9a81bcc80
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
|
@ -391,19 +378,32 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
35f672d1fb01b542f667952c9dbb26fe
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
libhpsangoma.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
f487a2c347c2ff3e6633ea7022b649e3
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
configure.in
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-10-08T20:00:58.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
75141da81ea6073c199e7ee14bafd972
|
||||
2010-10-08T21:37:17.977975Z
|
||||
316
|
||||
|
@ -415,7 +415,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
|
@ -427,7 +427,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
9e95e25bbf705718d18c5c00cc7c8efe
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
|
@ -440,7 +440,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
e8a0abce86211364eb60bbe6e07d4b05
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
|
@ -452,7 +452,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-10-08T20:01:10.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
1a4d975497bfcde75e3cbf4a54f1d72e
|
||||
2009-08-12T18:36:20.606028Z
|
||||
222
|
||||
|
@ -464,69 +464,69 @@ file
|
|||
|
||||
|
||||
|
||||
2009-12-04T21:21:35.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
fe647b1212e15d68672bbc21737980b8
|
||||
2009-12-01T20:38:57.462038Z
|
||||
235
|
||||
davidr
|
||||
|
||||
missing
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
fd5dd60aa8cefab9462677280ea74a61
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
Makefile.am
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-09-27T20:07:44.000000Z
|
||||
1bbbf5b7de6b78b3533af596815351ba
|
||||
2010-09-27T18:07:21.223585Z
|
||||
311
|
||||
ncorbic
|
||||
|
||||
libsangoma.def
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-11-16T17:51:09.000000Z
|
||||
3af0e52d20c13e18c41c19abb41138a3
|
||||
2010-11-11T19:01:32.713267Z
|
||||
322
|
||||
davidr
|
||||
|
||||
libsangoma-pvt.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-10-01T21:04:29.000000Z
|
||||
40bd58c5c94df8e3af7cb755afda81c5
|
||||
2010-09-28T19:41:22.543877Z
|
||||
314
|
||||
2011-01-28T17:40:50.000000Z
|
||||
c165482dbdeef534dc6baa6b719cb50d
|
||||
2011-01-06T17:30:24.762134Z
|
||||
329
|
||||
davidr
|
||||
has-props
|
||||
|
||||
libsangoma.def
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
3af0e52d20c13e18c41c19abb41138a3
|
||||
2010-11-11T19:01:32.713267Z
|
||||
322
|
||||
davidr
|
||||
|
||||
Makefile.am
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
1bbbf5b7de6b78b3533af596815351ba
|
||||
2010-09-27T18:07:21.223585Z
|
||||
311
|
||||
ncorbic
|
||||
|
||||
missing
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
fd5dd60aa8cefab9462677280ea74a61
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
libsangoma_utils.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-08-19T22:39:57.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
4e6cc58c45255d7146cfd349385a7f51
|
||||
2010-08-18T18:12:26.768369Z
|
||||
307
|
||||
|
@ -535,28 +535,28 @@ jpatel
|
|||
examples
|
||||
dir
|
||||
|
||||
install-sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
92067666ddce97609bd0ec67d36460cd
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
libsangoma.vcproj
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-11-16T17:51:09.000000Z
|
||||
f4e0fca1a12c0420233dbf18b29034fc
|
||||
2010-11-11T19:01:32.713267Z
|
||||
322
|
||||
2011-01-28T17:40:50.000000Z
|
||||
c914564e42c778d099839a48c17a317b
|
||||
2010-12-17T23:39:12.255685Z
|
||||
327
|
||||
davidr
|
||||
|
||||
install-sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
92067666ddce97609bd0ec67d36460cd
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
|
|
|
@ -147,7 +147,6 @@ extern int libsng_dbg_level;
|
|||
#define DBG_INIT if(libsng_dbg_level)libsng_dbg
|
||||
|
||||
/**** Prototypes of Function used internally by libsangoma ****/
|
||||
sng_fd_t sangoma_open_dev_by_name(const char *dev_name);
|
||||
#if defined(__WINDOWS__)
|
||||
int UdpManagementCommand(sng_fd_t fd, wan_udp_hdr_t* wan_udp);
|
||||
LONG registry_set_integer_value(HKEY hkey, LPTSTR szKeyname, IN int iValue);
|
||||
|
|
|
@ -1702,7 +1702,7 @@ sng_fd_t _LIBSNG_CALL sangoma_open_api_span_chan(int span, int chan)
|
|||
return fd;
|
||||
}
|
||||
|
||||
sng_fd_t sangoma_open_dev_by_name(const char *dev_name)
|
||||
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name)
|
||||
{
|
||||
char fname[FNAME_LEN];
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
* sangoma_get_cpld_version functions,sangoma_get_stats,sangoma_flush_stats
|
||||
*/
|
||||
|
||||
#ifndef _LIBSNAGOMA_H
|
||||
#define _LIBSNAGOMA_H
|
||||
#ifndef _LIBSANGOMA_H
|
||||
#define _LIBSANGOMA_H
|
||||
|
||||
#ifdef __linux__
|
||||
#ifndef __LINUX__
|
||||
|
@ -268,7 +268,8 @@ typedef pthread_mutex_t CRITICAL_SECTION;
|
|||
typedef unsigned int UINT;
|
||||
|
||||
#define EnterCriticalSection(arg) pthread_mutex_lock(arg)
|
||||
#define TryEnterCriticalSection(arg) pthread_mutex_trylock(arg)
|
||||
/* On success, pthread_mutex_trylock() returns 0. On error, non-zero value is returned. */
|
||||
#define TryEnterCriticalSection(arg) (pthread_mutex_trylock(arg)==0 ? 1 : 0)
|
||||
#define LeaveCriticalSection(arg) pthread_mutex_unlock(arg)
|
||||
#define InitializeCriticalSection(arg) pthread_mutex_init(arg, NULL);
|
||||
|
||||
|
@ -426,6 +427,14 @@ sng_fd_t _LIBSNG_CALL __sangoma_open_api_span_chan(int span, int chan);
|
|||
*/
|
||||
sng_fd_t _LIBSNG_CALL sangoma_open_api_span(int span);
|
||||
|
||||
/*!
|
||||
\fn sng_fd_t sangoma_open_dev_by_name(const char *dev_name)
|
||||
\brief Open API device using it's name. For example: Linux: w1g1, Windows wanpipe1_if1.
|
||||
\param dev_name API device name
|
||||
\return File Descriptor: -1 error, 0 or positive integer: valid file descriptor
|
||||
*/
|
||||
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name);
|
||||
|
||||
|
||||
/*!
|
||||
\def sangoma_create_socket_intr
|
||||
|
@ -1528,7 +1537,7 @@ int _LIBSNG_CALL sangoma_set_tx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, float
|
|||
\brief set driver rx gain for this tdm device
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param value txgain (0.0 - 10.0) db
|
||||
\param value rxgain (0.0 - 10.0) db
|
||||
\return non-zero = error, 0 = ok
|
||||
*/
|
||||
int _LIBSNG_CALL sangoma_set_rx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, float gain_val);
|
||||
|
@ -2160,5 +2169,5 @@ sangoma_status_t _LIBSNG_CALL sangoma_set_driver_mode_of_all_hw_devices(int driv
|
|||
#define sangoma_create_socket_intr sangoma_open_api_span_chan
|
||||
#endif
|
||||
|
||||
#endif /* _LIBSNAGOMA_H */
|
||||
#endif /* _LIBSANGOMA_H */
|
||||
|
||||
|
|
|
@ -214,6 +214,10 @@
|
|||
RelativePath=".\libsangoma_hwec.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libsangoma_utils.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,58 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
PWD=$(pwd)
|
||||
|
||||
eval "autoheader"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
eval "libtoolize --force"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
eval "aclocal"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
<<<<<<< .mine
|
||||
eval "automake"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
eval "autoconf"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
=======
|
||||
eval "automake --add-missing"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
eval "autoconf"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
>>>>>>> .r196
|
||||
|
||||
cd sample_c
|
||||
if [ -f Makefile ]; then
|
||||
rm -f Makefile
|
||||
fi
|
||||
ln -s Makefile.Linux Makefile
|
||||
|
||||
cd ..
|
||||
|
||||
cd sample_cpp
|
||||
if [ -f Makefile ]; then
|
||||
rm -f Makefile
|
||||
fi
|
||||
ln -s Makefile.Linux Makefile
|
||||
|
||||
echo "Automake Init Done"
|
||||
echo
|
||||
|
||||
echo "Please run "
|
||||
echo " -> ./configure --prefix=/usr"
|
||||
echo " -> make "
|
||||
echo " -> make install"
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Package and LT (libtool) versions are not the same (they can match sometimes though)
|
||||
# see http://sources.redhat.com/autobook/autobook/autobook_91.html for details
|
||||
# more info on versioning: http://www.nondot.org/sabre/Mirrored/libtool-2.1a/libtool_6.html#SEC33
|
||||
|
||||
# before libsangoma 3.0.0 we really did not follow libtool versioning mechanism
|
||||
# starting with 3.0.0 package and LT version of libsangoma we should NOT increment
|
||||
# both the package version (specified in AC_INIT) and the libtool (LIBSANGOMA_LT_*) versions
|
||||
# together just to have them match, they are not meant to match (but may do so by coincidence).
|
||||
# Libtool version must be incremented just when there are library interface changes or bug fixes
|
||||
# according to the libtool rules (read the document mentioned at the top of this file)
|
||||
# the package version changes more feely as we wish (we put the rules there about when to change)
|
||||
# for example, if we ever fix a bug in priserver.c and we want to make a release we can do so
|
||||
# without incrementing libsangoma LT version
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([libsangoma],[3.0.0],[ncorbic@sangoma.com])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
LIBSANGOMA_LT_CURRENT=3 # interface 3
|
||||
LIBSANGOMA_LT_REVISION=0 # first revision of this interface
|
||||
LIBSANGOMA_LT_AGE=0 #not backwards compatible (0 previous interfaces are compatible)
|
||||
|
||||
<<<<<<< .mine
|
||||
|
||||
=======
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
>>>>>>> .r196
|
||||
AC_SUBST(LIBSANGOMA_LT_CURRENT)
|
||||
AC_SUBST(LIBSANGOMA_LT_REVISION)
|
||||
AC_SUBST(LIBSANGOMA_LT_AGE)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
AC_CHECK_PROG(AR, ar, ar, no)
|
||||
|
||||
|
||||
# Checks for library headers
|
||||
AC_CHECK_HEADERS(fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h math.h)
|
||||
|
||||
# Checks for libpri support
|
||||
AC_ARG_WITH(libpri,
|
||||
[ --with-libpri=<path> enable pri support],[LIBPRI_PATH="$withval"])
|
||||
AM_CONDITIONAL([LIBPRI],[test -d "$LIBPRI_PATH" ])
|
||||
AC_SUBST([LIBPRI_PATH])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_TIME
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_CHECK_FUNCS([gettimeofday memset select socket])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,55 +0,0 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Package and LT (libtool) versions are not the same (they can match sometimes though)
|
||||
# see http://sources.redhat.com/autobook/autobook/autobook_91.html for details
|
||||
# more info on versioning: http://www.nondot.org/sabre/Mirrored/libtool-2.1a/libtool_6.html#SEC33
|
||||
|
||||
# before libsangoma 3.0.0 we really did not follow libtool versioning mechanism
|
||||
# starting with 3.0.0 package and LT version of libsangoma we should NOT increment
|
||||
# both the package version (specified in AC_INIT) and the libtool (LIBSANGOMA_LT_*) versions
|
||||
# together just to have them match, they are not meant to match (but may do so by coincidence).
|
||||
# Libtool version must be incremented just when there are library interface changes or bug fixes
|
||||
# according to the libtool rules (read the document mentioned at the top of this file)
|
||||
# the package version changes more feely as we wish (we put the rules there about when to change)
|
||||
# for example, if we ever fix a bug in priserver.c and we want to make a release we can do so
|
||||
# without incrementing libsangoma LT version
|
||||
|
||||
AC_INIT([libsangoma],[3.0.1],[ncorbic@sangoma.com])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
LIBSANGOMA_LT_CURRENT=3 # interface 3
|
||||
LIBSANGOMA_LT_REVISION=0 # first revision of this interface
|
||||
LIBSANGOMA_LT_AGE=1 #not backwards compatible (0 previous interfaces are compatible)
|
||||
|
||||
#AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_SUBST(LIBSANGOMA_LT_CURRENT)
|
||||
AC_SUBST(LIBSANGOMA_LT_REVISION)
|
||||
AC_SUBST(LIBSANGOMA_LT_AGE)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
AC_CHECK_PROG(AR, ar, ar, no)
|
||||
|
||||
|
||||
# Checks for library headers
|
||||
AC_CHECK_HEADERS(fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h math.h)
|
||||
|
||||
# Checks for libpri support
|
||||
AC_ARG_WITH(libpri,
|
||||
[ --with-libpri=<path> enable pri support],[LIBPRI_PATH="$withval"])
|
||||
AM_CONDITIONAL([LIBPRI],[test -d "$LIBPRI_PATH" ])
|
||||
AC_SUBST([LIBPRI_PATH])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_TIME
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_CHECK_FUNCS([gettimeofday memset select socket])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,234 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* libsangoma.c AFT T1/E1: HDLC API Code Library
|
||||
*
|
||||
* Author(s): Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2005 Anthony Minessale II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#ifndef _LIBSNAGOMA_H
|
||||
#define _LIBSNAGOMA_H
|
||||
#include <stdio.h>
|
||||
|
||||
#define WANPIPE_TDM_API 1
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef __WINDOWS__
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
#include <conio.h>
|
||||
iinclude <stddef.h> //for offsetof()
|
||||
typedef unsigned __int16 u_int16_t;
|
||||
typedef unsigned __int32 u_int32_t;
|
||||
#include <wanpipe_defines.h> //for 'wan_udp_hdr_t'
|
||||
#include <wanpipe_cfg.h>
|
||||
#ifdef WANPIPE_TDM_API
|
||||
#include <wanpipe_tdm_api.h> //for TDMV API
|
||||
#endif
|
||||
#include <sang_status_defines.h>//return codes
|
||||
#include <sang_api.h> //for IOCTL codes
|
||||
#include <sdla_te1_pmc.h> //RBS definitions
|
||||
#include <sdla_te1.h> //TE1 macros
|
||||
#include <sdla_56k.h> //56k macros
|
||||
#include <sdla_remora.h> //Analog card
|
||||
#include <sdla_te3.h> //T3 card
|
||||
#include <sdla_front_end.h> //front-end (T1/E1/56k) commands
|
||||
#include <sdla_aft_te1.h> //for Wanpipe API
|
||||
|
||||
#define _MYDEBUG
|
||||
#define PROGRAM_NAME "LIBSANGOMA: "
|
||||
#include <DebugOut.h>
|
||||
|
||||
typedef HANDLE sng_fd_t;
|
||||
#else
|
||||
/* L I N U X */
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
#include <netinet/in.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/if.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
|
||||
//typedef int sng_fd_t;
|
||||
#include <linux/wanpipe_defines.h>
|
||||
#include <linux/wanpipe_cfg.h>
|
||||
#include <linux/wanpipe.h>
|
||||
#ifdef WANPIPE_TDM_API
|
||||
# include <linux/wanpipe_tdm_api.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define FNAME_LEN 50
|
||||
#define FUNC_DBG(x) if(0)printf("%s:%d\n", x, __LINE__)
|
||||
#define DBG_PRINT if(1)printf
|
||||
|
||||
typedef wp_tdm_api_rx_hdr_t sangoma_api_hdr_t;
|
||||
|
||||
/* Decodec Span/Chan from interface name */
|
||||
int sangoma_span_chan_toif(int span, int chan, char *interface_name);
|
||||
int sangoma_span_chan_fromif(char *interface_name, int *span, int *chan);
|
||||
int sangoma_interface_toi(char *interface_name, int *span, int *chan);
|
||||
|
||||
sng_fd_t sangoma_create_socket_by_name(char *device, char *card);
|
||||
|
||||
/* Open Span/Chan devices
|
||||
* open_tdmapi_span_chan: open device based on span chan values
|
||||
* sangoma_open_tdmapi_span: open first available device on span
|
||||
*/
|
||||
|
||||
sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan);
|
||||
sng_fd_t sangoma_open_tdmapi_span(int span);
|
||||
|
||||
#define sangoma_create_socket_intr sangoma_open_tdmapi_span_chan
|
||||
|
||||
/* Device Rx/Tx functions
|
||||
* writemsg_tdm: tx header + data from separate buffers
|
||||
* readmsg_tdm: rx header + data to separate buffers
|
||||
*/
|
||||
int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen,
|
||||
void *databuf, unsigned short datalen, int flag);
|
||||
int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen,
|
||||
void *databuf, int datalen, int flag);
|
||||
|
||||
#define sangoma_readmsg_socket sangoma_readmsg_tdm
|
||||
#define sangoma_sendmsg_socket sangoma_writemsg_tdm
|
||||
|
||||
#ifdef WANPIPE_TDM_API
|
||||
|
||||
void sangoma_socket_close(sng_fd_t *sp);
|
||||
int sangoma_socket_waitfor(sng_fd_t fd, int timeout, int flags);
|
||||
|
||||
/* Get Full TDM API configuration per chan */
|
||||
int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Get/Set TDM Codec per chan */
|
||||
int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int codec);
|
||||
int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Get/Set USR Tx/Rx Period in milliseconds */
|
||||
int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int period);
|
||||
int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Get user MTU/MRU values in bytes */
|
||||
int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Not supported yet */
|
||||
int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int power);
|
||||
int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Flush buffers from current channel */
|
||||
int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int poll_in_sec);
|
||||
int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char rbs);
|
||||
|
||||
int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* DTMF Detection on Octasic chip */
|
||||
int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* DTMF Detection on A200 (SLIC) chip */
|
||||
int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* On/Off hook events on A200 (Analog) card */
|
||||
int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Enable/Disable Ring events on A200 (Analog) card */
|
||||
int sangoma_tdm_enable_ring_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_disable_ring_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Enable/Disable Ring Detect events on A200 (Analog) card */
|
||||
int sangoma_tdm_enable_ring_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_disable_ring_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Enable/Disable Ring Trip events on A200 (Analog) card */
|
||||
int sangoma_tdm_enable_ring_trip_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_disable_ring_trip_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Enable/Disable tone events on A200 (Analog) card */
|
||||
int sangoma_tdm_enable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int tone_id);
|
||||
int sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
int sangoma_tdm_txsig_onhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_txsig_offhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_txsig_start(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_txsig_kewl(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* get current Line Connection state - Connected/Disconnected */
|
||||
#ifdef WP_TDM_FEATURE_LINK_STATUS
|
||||
# ifndef LIBSANGOMA_GET_LINKSTATUS
|
||||
# define LIBSANGOMA_GET_LINKSTATUS 1
|
||||
# endif
|
||||
int sangoma_tdm_get_link_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status);
|
||||
#endif
|
||||
|
||||
/* set current Line Connection state - Connected/Disconnected */
|
||||
#ifndef LIBSANGOMA_GET_FESTATUS
|
||||
#define LIBSANGOMA_GET_FESTATUS 1
|
||||
#endif
|
||||
int sangoma_tdm_set_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char new_status);
|
||||
|
||||
<<<<<<< .mine
|
||||
=======
|
||||
#ifndef LIBSANGOMA_SET_FESTATUS
|
||||
#define LIBSANGOMA_SET_FESTATUS 1
|
||||
#endif
|
||||
/* get current Line Connection state - Connected/Disconnected */
|
||||
int sangoma_tdm_get_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status);
|
||||
|
||||
>>>>>>> .r10
|
||||
/* Get hw configuration Alaw Ulaw based on T1/E1 */
|
||||
#ifndef LIBSANGOMA_GET_HWCODING
|
||||
#define LIBSANGOMA_GET_HWCODING 1
|
||||
#endif
|
||||
int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/* Get hw dtmf support: enabled or disabled */
|
||||
#ifndef LIBSANGOMA_GET_HWDTMF
|
||||
#define LIBSANGOMA_GET_HWDTMF 1
|
||||
#endif
|
||||
int sangoma_tdm_get_hw_dtmf(int fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
#endif /* WANPIPE_TDM_API */
|
||||
|
||||
<<<<<<< .mine
|
||||
int sangoma_tdm_get_hw_dtmf(int fd, wanpipe_tdm_api_t *tdm_api);
|
||||
int sangoma_open_tdmapi_ctrl(void);
|
||||
|
||||
#endif
|
||||
=======
|
||||
#endif /* _LIBSNAGOMA_H */
|
||||
>>>>>>> .r10
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,992 +0,0 @@
|
|||
/*******************************************************************************//**
|
||||
* \file libsangoma.h
|
||||
* \brief Wanpipe API Library header for Sangoma AFT T1/E1/Analog/BRI/Serial Hardware -
|
||||
* \brief Provides User a Unified/OS Agnostic API to Wanpipe/Sangoma Drivers and Hardware
|
||||
*
|
||||
* Author(s): Nenad Corbic <ncorbic@sangoma.com>
|
||||
* David Rokhvarg <davidr@sangoma.com>
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* Copyright: (c) 2005-2008 Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* * 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 Sangoma Technologies 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 Sangoma Technologies ``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 Sangoma Technologies 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
|
||||
* ===============================================================================
|
||||
*/
|
||||
|
||||
#ifndef _LIBSNAGOMA_H
|
||||
#define _LIBSNAGOMA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* for C++ users */
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*!
|
||||
\def WANPIPE_TDM_API
|
||||
\brief Used by compiler and driver to enable TDM API
|
||||
*/
|
||||
#define WANPIPE_TDM_API 1
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef __WINDOWS__
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
#include <conio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <wanpipe_api.h>
|
||||
|
||||
#define _MYDEBUG
|
||||
#define PROGRAM_NAME "LIBSANGOMA: "
|
||||
#include <DebugOut.h>
|
||||
|
||||
/*!
|
||||
\def _SAPI_CALL
|
||||
\brief Windows WINAPI export function for DLL
|
||||
*/
|
||||
#define _SAPI_CALL WINAPI
|
||||
#define SANGOMA_INFINITE_API_POLL_WAIT INFINITE
|
||||
|
||||
/*!
|
||||
\def sangoma_msleep(x)
|
||||
\brief milisecond sleep function
|
||||
*/
|
||||
#define sangoma_msleep(x) Sleep(x)
|
||||
|
||||
#else
|
||||
/* L I N U X */
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
#include <netinet/in.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "wanpipe_api.h"
|
||||
|
||||
/*!
|
||||
\def _SAPI_CALL
|
||||
\brief Not used in Linux
|
||||
*/
|
||||
#define _SAPI_CALL
|
||||
|
||||
/*!
|
||||
\def INVALID_HANDLE_VALUE
|
||||
\brief Invalid file handle value -1, Ported from Windows
|
||||
*/
|
||||
#define INVALID_HANDLE_VALUE -1
|
||||
|
||||
/*!
|
||||
\def SANGOMA_INFINITE_API_POLL_WAIT
|
||||
\brief Infinite poll timeout value 0, Ported from Windows
|
||||
*/
|
||||
#define SANGOMA_INFINITE_API_POLL_WAIT 0
|
||||
|
||||
/*!
|
||||
\def __cdecl
|
||||
\brief Ported from Windows
|
||||
\def BOOL
|
||||
\brief Boolean type int, Ported from Windows
|
||||
\def DWORD
|
||||
\brief DWORD type is int, Ported from Windows
|
||||
\def FALSE
|
||||
\brief FALSE value is 0, Ported from Windows
|
||||
\def TRUE
|
||||
\brief TRUE value is 1, Ported from Windows
|
||||
\def sangoma_msleep(x)
|
||||
\brief milisecond sleep function
|
||||
\def _getch
|
||||
\brief get character, Ported from Windows
|
||||
\def Sleep
|
||||
\brief milisecond sleep function
|
||||
\def HANDLE
|
||||
\brief file handle type int, Ported from Windows
|
||||
\def TCHAR
|
||||
\brief TCHAN type mapped to char, Ported from Windows
|
||||
\def ULONG
|
||||
\brief ULONG type mapped to unsigned long, Ported from Windows
|
||||
\def UCHAR
|
||||
\brief ULONG type mapped to unsigned char, Ported from Windows
|
||||
\def USHORT
|
||||
\brief USHORT type mapped to unsigned short, Ported from Windows
|
||||
\def LPSTR
|
||||
\brief LPSTR type mapped to unsigned char *, Ported from Windows
|
||||
\def PUCHAR
|
||||
\brief PUCHAR type mapped to unsigned char *, Ported from Windows
|
||||
\def LPTHREAD_START_ROUTINE
|
||||
\brief LPTHREAD_START_ROUTINE type mapped to unsigned char *, Ported from Windows
|
||||
\def _stricmp
|
||||
\brief _stricmp type mapped to _stricmp, Ported from Windows
|
||||
\def _snprintf
|
||||
\brief _snprintf type mapped to snprintf, Ported from Windows
|
||||
*/
|
||||
#define __cdecl
|
||||
#define BOOL int
|
||||
#define DWORD int
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define sangoma_msleep(x) usleep(x*1000)
|
||||
#define _getch getchar
|
||||
#define Sleep sangoma_msleep
|
||||
#define HANDLE int
|
||||
#define TCHAR char
|
||||
#define ULONG unsigned long
|
||||
#define UCHAR unsigned char
|
||||
#define USHORT unsigned short
|
||||
#define LPSTR unsigned char *
|
||||
#define PUCHAR unsigned char *
|
||||
#define LPTHREAD_START_ROUTINE void *
|
||||
#define _stricmp strcmp
|
||||
#define _snprintf snprintf
|
||||
|
||||
|
||||
|
||||
#endif/* WIN32 */
|
||||
|
||||
/*!
|
||||
\def FNAME_LEN
|
||||
\brief string length of a file name
|
||||
\def FUNC_DBG(x)
|
||||
\brief function debug print function
|
||||
\def DBG_PRINT
|
||||
\brief debug print function
|
||||
*/
|
||||
#define FNAME_LEN 100
|
||||
#define FUNC_DBG(x) if(0)printf("%s():%d\n", x, __LINE__)
|
||||
#define DBG_PRINT if(1)printf
|
||||
|
||||
/*!
|
||||
\typedef sangoma_api_hdr_t
|
||||
\brief Backward comaptible define of wp_api_hdr_t
|
||||
*/
|
||||
typedef wp_api_hdr_t sangoma_api_hdr_t;
|
||||
|
||||
/*!
|
||||
\struct sangoma_wait_obj
|
||||
\brief Sangoma wait object structure. Used to setup a poll on a specific device
|
||||
|
||||
This structure is used by sangoma_socket_waitfor_many() function.
|
||||
This structure is initialized by sangoma_init_wait_obj() function.
|
||||
|
||||
\typedef sangoma_wait_obj_t
|
||||
\brief Sangoma wait object structure. Used to setup a poll on a specific device
|
||||
*/
|
||||
typedef struct sangoma_wait_obj
|
||||
{
|
||||
|
||||
/***************************************//**
|
||||
* Private Variables
|
||||
*******************************************/
|
||||
|
||||
/*! file descriptor of a device */
|
||||
sng_fd_t fd;
|
||||
/*! poll flags use to configure system for polling on read/write/event */
|
||||
uint32_t flags_in;
|
||||
/*! timeout in miliseconds in case of no event */
|
||||
uint32_t timeout;
|
||||
|
||||
#if defined(WIN32)
|
||||
/*! WINDOWS: overlapped device used for overlap IO */
|
||||
OVERLAPPED OverlappedApiPoll;
|
||||
/*! WINDOWS: api structure used by windows poll system call */
|
||||
API_POLL_STRUCT api_poll;
|
||||
#endif
|
||||
|
||||
/*! type of the object to wait on. can be one of two: UNKNOWN_WAIT_OBJ and SANGOMA_WAIT_OBJ */
|
||||
uint32_t object_type;
|
||||
|
||||
/***************************************//**
|
||||
* Public Status Variables
|
||||
*******************************************/
|
||||
|
||||
/*! poll flags returned to user indicating what event occoured read/write/event */
|
||||
uint32_t flags_out;
|
||||
/*! span number used for debugging, when printing span associated with event */
|
||||
uint32_t span;
|
||||
/*! chan number used for debugging, when printing chan associated with event */
|
||||
uint32_t chan;
|
||||
|
||||
}sangoma_wait_obj_t;
|
||||
|
||||
/*!
|
||||
\enum _sangoma_object_type
|
||||
\brief Wait object type definition
|
||||
\typedef sangoma_object_type_t
|
||||
\brief Wait object type definition
|
||||
*/
|
||||
typedef enum _sangoma_object_type
|
||||
{
|
||||
UNKNOWN_WAIT_OBJ,
|
||||
SANGOMA_WAIT_OBJ
|
||||
}sangoma_object_type_t;
|
||||
|
||||
/************************************************************//**
|
||||
* Device OPEN / CLOSE Functions
|
||||
***************************************************************/
|
||||
|
||||
/*!
|
||||
\fn sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan)
|
||||
\brief Open a Device based on Span/Chan values
|
||||
\param span span number starting from 1 to 255
|
||||
\param chan chan number starting from 1 to 32
|
||||
\return File Descriptor: -1 error, 0 or positive integer: valid file descriptor
|
||||
|
||||
Restriced open, device will allowed to be open only once.
|
||||
*/
|
||||
sng_fd_t _SAPI_CALL sangoma_open_tdmapi_span_chan(int span, int chan);
|
||||
|
||||
/*!
|
||||
\fn sng_fd_t __sangoma_open_tdmapi_span_chan(int span, int chan)
|
||||
\brief Open a Device based on Span/Chan values
|
||||
\param span span number starting from 1 to 255
|
||||
\param chan chan number starting from 1 to 32
|
||||
\return File Descriptor: -1 error, 0 or positive integer: valid file descriptor
|
||||
|
||||
Unrestriced open, allows mutiple open calls on a single device
|
||||
*/
|
||||
sng_fd_t _SAPI_CALL __sangoma_open_tdmapi_span_chan(int span, int chan);
|
||||
|
||||
/*!
|
||||
\fn sng_fd_t sangoma_open_tdmapi_span(int span)
|
||||
\brief Open a first available device on a Span
|
||||
\param span span number starting from 1 to 255
|
||||
\return File Descriptor: -1 error, 0 or positive integer: valid file descriptor
|
||||
|
||||
Unrestriced open, allows mutiple open calls on a single device
|
||||
*/
|
||||
sng_fd_t _SAPI_CALL sangoma_open_tdmapi_span(int span);
|
||||
|
||||
|
||||
/*!
|
||||
\def sangoma_create_socket_intr
|
||||
\brief Backward compatible open span chan call
|
||||
*/
|
||||
#define sangoma_create_socket_intr sangoma_open_tdmapi_span_chan
|
||||
|
||||
|
||||
/*!
|
||||
\def LIBSANGOMA_TDMAPI_CTRL
|
||||
\brief Global control device feature
|
||||
*/
|
||||
#ifndef LIBSANGOMA_TDMAPI_CTRL
|
||||
#define LIBSANGOMA_TDMAPI_CTRL 1
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn sng_fd_t sangoma_open_tdmapi_ctrl(void)
|
||||
\brief Open a Global Control Device
|
||||
\return File Descriptor - negative=error 0 or greater = fd
|
||||
|
||||
The global control device receives events for all devices
|
||||
configured.
|
||||
*/
|
||||
sng_fd_t sangoma_open_tdmapi_ctrl(void);
|
||||
|
||||
|
||||
/*!
|
||||
\fn void sangoma_socket_close(sng_fd_t *fd)
|
||||
\brief Close device file descriptor
|
||||
\param fd device file descriptor
|
||||
\return void
|
||||
|
||||
*/
|
||||
void _SAPI_CALL sangoma_socket_close(sng_fd_t *fd);
|
||||
|
||||
|
||||
/************************************************************//**
|
||||
* Device READ / WRITE Functions
|
||||
***************************************************************/
|
||||
|
||||
/*!
|
||||
\fn int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag)
|
||||
\brief Write Data to device
|
||||
\param fd device file descriptor
|
||||
\param hdrbuf pointer to header structure wp_api_hdr_t
|
||||
\param hdrlen size of wp_api_hdr_t
|
||||
\param databuf pointer to data buffer to be transmitted
|
||||
\param datalen length of data buffer
|
||||
\param flag currently not used, set to 0
|
||||
\return transmit size, must be equal to datalen, anything else is error
|
||||
|
||||
In case of error return code, one must check the header operation_status
|
||||
variable to identify the reason of an error. Please refer to the error codes.
|
||||
*/
|
||||
|
||||
int _SAPI_CALL sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen,
|
||||
void *databuf, unsigned short datalen, int flag);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
|
||||
\brief Read Data from device
|
||||
\param fd device file descriptor
|
||||
\param hdrbuf pointer to header structure wp_api_hdr_t
|
||||
\param hdrlen size of wp_api_hdr_t
|
||||
\param databuf pointer to data buffer to be received
|
||||
\param datalen length of data buffer
|
||||
\param flag currently not used, set to 0
|
||||
\return received size, must be equal to datalen, anything else is error or busy
|
||||
|
||||
In case of error return code, one must check the header operation_status
|
||||
variable to identify the reason of error. Please refer to the error codes.
|
||||
*/
|
||||
int _SAPI_CALL sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen,
|
||||
void *databuf, int datalen, int flag);
|
||||
|
||||
#define sangoma_readmsg_socket sangoma_readmsg_tdm
|
||||
#define sangoma_sendmsg_socket sangoma_writemsg_tdm
|
||||
|
||||
|
||||
/************************************************************//**
|
||||
* Device POLL Functions
|
||||
***************************************************************/
|
||||
|
||||
/*!
|
||||
\fn int sangoma_socket_waitfor(sng_fd_t fd, int timeout, int flags_in, unsigned int *flags_out)
|
||||
\brief Wait for a single file descriptor - poll()
|
||||
\param fd device file descriptor
|
||||
\param timeout timeout in miliseconds in case of no event
|
||||
\param flags_in events to wait for (read/write/event)
|
||||
\param flags_out events that occured (read/write/event)
|
||||
\return negative: error, 0: timeout, positive: event occured check in *flags_out
|
||||
*/
|
||||
int _SAPI_CALL sangoma_socket_waitfor(sng_fd_t fd, int timeout, int flags_in, unsigned int *flags_out);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_socket_waitfor_many(sangoma_wait_obj_t sangoma_wait_objects[], int number_of_sangoma_wait_objects, uint32_t system_wait_timeout)
|
||||
\brief Wait for multiple file descriptors - poll()
|
||||
\param sangoma_wait_objects pointer to array of file descriptors to wait for
|
||||
\param number_of_sangoma_wait_objects size of the array of file descriptors
|
||||
\param system_wait_timeout timeout in miliseconds in case of no event
|
||||
\return negative: error, 0: timeout, positive: event occured check in sangoma_wait_objects
|
||||
*/
|
||||
int _SAPI_CALL sangoma_socket_waitfor_many(sangoma_wait_obj_t sangoma_wait_objects[],
|
||||
int number_of_sangoma_wait_objects,
|
||||
uint32_t system_wait_timeout);
|
||||
|
||||
/*!
|
||||
\fn void sangoma_init_wait_obj(sangoma_wait_obj_t *sng_wait_obj, sng_fd_t fd, int span, int chan, int timeout, int flags_in, int object_type)
|
||||
\brief Initialize a wait object that will be used in sangoma_socket_waitfor_many() function
|
||||
\param sng_wait_obj pointer a single device object
|
||||
\param fd device file descriptor
|
||||
\param span span number starting from 1 to 255
|
||||
\param chan chan number starting from 1 to 32
|
||||
\param timeout timeout in miliseconds in case of no event
|
||||
\param flags_in events to wait for (read/write/event)
|
||||
\param object_type type of the wait object. currently can be one of two: SANGOMA_WAIT_OBJ and UNKNOWN_WAIT_OBJ
|
||||
\return void
|
||||
*/
|
||||
void _SAPI_CALL sangoma_init_wait_obj(sangoma_wait_obj_t *sng_wait_obj, sng_fd_t fd, int span, int chan, int timeout, int flags_in, int object_type);
|
||||
|
||||
|
||||
/*!
|
||||
\fn void sangoma_release_wait_obj(sangoma_wait_obj_t *sng_wait_obj)
|
||||
\brief De-allocate all resources in a wait object
|
||||
\param sng_wait_obj pointer a single device object
|
||||
\return void
|
||||
*/
|
||||
void _SAPI_CALL sangoma_release_wait_obj(sangoma_wait_obj_t *sng_wait_obj);
|
||||
|
||||
/*!
|
||||
\fn void sangoma_signal_wait_obj(sangoma_wait_obj_t *sng_wait_obj)
|
||||
\brief Set wait object to a signalled state
|
||||
\param sng_wait_obj pointer a single device object
|
||||
\return void
|
||||
*/
|
||||
void _SAPI_CALL sangoma_signal_wait_obj(sangoma_wait_obj_t *sng_wait_obj);
|
||||
|
||||
|
||||
/************************************************************//**
|
||||
* Device EVENT/MANAGEMENT Functions
|
||||
***************************************************************/
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Read API Events
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
The TDM API structure will be populated with a TDM API or WAN Event.
|
||||
This function usually used after wait() function indicated that event
|
||||
has occured.
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t* wan_udp)
|
||||
\brief Execute Sangoma Management Command
|
||||
\param fd device file descriptor
|
||||
\param wan_udp management command structure
|
||||
\return non-zero: error, 0: ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t* wan_udp);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Execute Sangoma TDM API Command
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Read tdm api device configuration
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int period)
|
||||
\brief Set Tx/Rx Period in Milliseconds
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param period value in miliseconds (1,2,5,10)
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Only valid in CHAN Operation Mode
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int period);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Get Tx/Rx Period in Milliseconds
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return negative: error or configured period value
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Get Tx/Rx MTU/MRU in bytes
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return negative: error or configured mtu/mru in bytes
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Flush buffers from current channel
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int poll_in_sec)
|
||||
\brief Enable RBS Events on a device
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param poll_in_sec driver poll period for rbs events
|
||||
\return non-zero: error, 0: ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int poll_in_sec);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable RBS Events for a device
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char rbs)
|
||||
\brief Write RBS Bits on a device
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param rbs rbs bits (ABCD)
|
||||
\return non-zero: error, 0: ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char rbs);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable DTMF Detection on Octasic chip (if hw supports it)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on cards that have HWEC
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable DTMF Detection on Octasic chip (if hw supports it)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on cards that have HWEC
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable DTMF Detection on Analog/Remora SLIC Chip
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable DTMF Detection on Analog/Remora SLIC Chip
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable RX HOOK Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable RX HOOK Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_ring_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable RING Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_ring_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_ring_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable RING Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_ring_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_ring_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable RING DETECT Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_ring_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_ring_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable RING DETECT Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_ring_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_ring_trip_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable RING TRIP Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_ring_trip_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_ring_trip_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable RING TRIP Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_ring_trip_detect_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, uint16_t tone_id)
|
||||
\brief Transmit a TONE on this device (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param tone_id tone type to transmit
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, uint16_t tone_id);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable TONE Events (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_txsig_onhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Tranmsmit TX SIG ON HOOK (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_txsig_onhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_txsig_offhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Tranmsmit TX SIG OFF HOOK (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_txsig_offhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_txsig_start(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Tranmsmit TX SIG START (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_txsig_start(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_txsig_kewl(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Tranmsmit TX SIG KEWL START (Analog Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on Analog Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_txsig_kewl(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Enable HWEC on this channel
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on cards that have HWEC
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Disable HWEC on this channel
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on cards that have HWEC
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Get Front End Alarms (T1/E1 Only)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Supported only on T1/E1 Cards
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
|
||||
#ifdef WP_TDM_FEATURE_LINK_STATUS
|
||||
# ifndef LIBSANGOMA_GET_LINKSTATUS
|
||||
/*!
|
||||
\def LIBSANGOMA_GET_LINKSTATUS
|
||||
\brief Get Link Status feature
|
||||
*/
|
||||
# define LIBSANGOMA_GET_LINKSTATUS 1
|
||||
# endif
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_link_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status)
|
||||
\brief Get Device Link Status (Connected/Disconnected)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param current_status pointer where result will be filled: 0=Link UP 1=Link Down
|
||||
\return non-zero: error, 0: ok -> check current_status
|
||||
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_link_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status);
|
||||
#endif
|
||||
|
||||
/* set current Line Connection state - Connected/Disconnected */
|
||||
#ifndef LIBSANGOMA_GET_FESTATUS
|
||||
/*!
|
||||
\def LIBSANGOMA_GET_FESTATUS
|
||||
\brief Get Front End Status feature
|
||||
*/
|
||||
#define LIBSANGOMA_GET_FESTATUS 1
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_set_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char new_status)
|
||||
\brief Set Device Link Status (Connected/Disconnected)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param new_status new status 0=Link UP 1=Link Down
|
||||
\return non-zero: error, 0: ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_set_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char new_status);
|
||||
|
||||
#ifndef LIBSANGOMA_GET_HWCODING
|
||||
/*!
|
||||
\def LIBSANGOMA_GET_HWCODING
|
||||
\brief Get HW Coding Feature
|
||||
*/
|
||||
#define LIBSANGOMA_GET_HWCODING 1
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_hw_coding(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Get HW Voice Coding (ulaw/alaw)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
This function will return the low level voice coding
|
||||
depending on configuration. (ulaw or alaw)
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_hw_coding(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
#ifndef LIBSANGOMA_GET_HWDTMF
|
||||
/*!
|
||||
\def LIBSANGOMA_GET_HWDTMF
|
||||
\brief HW DTMF Feature
|
||||
*/
|
||||
#define LIBSANGOMA_GET_HWDTMF 1
|
||||
#endif
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_hw_dtmf(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Check if hwdtmf support is available
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
This function will check if hw supports HW DTMF.
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_hw_dtmf(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_span_chan_toif(int span, int chan, char *interface_name)
|
||||
\brief Convert Span & Chan to interface name
|
||||
\param span span number starting from 1 to 255
|
||||
\param chan chan number starting from 1 to 32
|
||||
\param interface_name pointer to string where interface name will be written
|
||||
\return non-zero = error, 0 = ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_span_chan_toif(int span, int chan, char *interface_name);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_span_chan_fromif(char *interface_name, int *span, int *chan)
|
||||
\brief Convert Interace Name to Span & Chan
|
||||
\param interface_name pointer to string containing interface name
|
||||
\param span integer pointer where to write span value
|
||||
\param chan integer pointer where to write chan value
|
||||
\return non-zero = error, 0 = ok
|
||||
*/
|
||||
int _SAPI_CALL sangoma_span_chan_fromif(char *interface_name, int *span, int *chan);
|
||||
|
||||
|
||||
|
||||
/*================================================================
|
||||
* DEPRECATED Function Calls - Not to be used any more
|
||||
* Here for backward compatibility
|
||||
*================================================================*/
|
||||
|
||||
|
||||
#ifndef LIBSANGOMA_SET_FESTATUS
|
||||
/*!
|
||||
\def LIBSANGOMA_SET_FESTATUS
|
||||
\brief Set Front End Status Feature
|
||||
*/
|
||||
#define LIBSANGOMA_SET_FESTATUS 1
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status)
|
||||
\brief Get Device Link Status (Connected/Disconnected)
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param current_status pointer where result will be filled: 0=Link UP 1=Link Down
|
||||
\return non-zero: error, 0: ok -> check current_status
|
||||
|
||||
Deprecated - replaced by sangoma_tdm_get_link_status function
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int codec)
|
||||
\brief Set TDM Codec per chan
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param codec codec to set (ulaw/alaw/slinear)
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Deprecated Function - Here for backward compatibility
|
||||
Only valid in CHAN Operation Mode
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int codec);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Get Configured TDM Codec per chan
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return negative: error or configured codec value
|
||||
|
||||
Deprecated Function - Here for backward compatibility
|
||||
Only valid in CHAN Operation Mode
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
|
||||
/*!
|
||||
\fn sng_fd_t sangoma_create_socket_by_name(char *device, char *card)
|
||||
\brief Open a device based on a interface and card name
|
||||
\param device interface name
|
||||
\param card card name
|
||||
\return File Descriptor: -1 error, 0 or positive integer: valid file descriptor
|
||||
|
||||
Deprecated - here for backward compatibility
|
||||
*/
|
||||
sng_fd_t _SAPI_CALL sangoma_create_socket_by_name(char *device, char *card);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_interface_toi(char *interface_name, int *span, int *chan)
|
||||
\brief Convert Span & Chan to interface name
|
||||
\param interface_name pointer to string where interface name will be written
|
||||
\param span span number starting from 1 to 255
|
||||
\param chan chan number starting from 1 to 32
|
||||
\return non-zero = error, 0 = ok
|
||||
Deprecated - here for backward compatibility
|
||||
*/
|
||||
int _SAPI_CALL sangoma_interface_toi(char *interface_name, int *span, int *chan);
|
||||
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int power)
|
||||
\brief Set Power Level - so only data matching the power level would be passed up.
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param power value of power
|
||||
\return non-zero: error, 0: ok
|
||||
|
||||
Deprecated - not used/implemented
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int power);
|
||||
|
||||
/*!
|
||||
\fn int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
|
||||
\brief Get Configured Power Level
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\return negative: error or configured power level
|
||||
|
||||
Deprecated - not used/implemented
|
||||
*/
|
||||
int _SAPI_CALL sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LIBSNAGOMA_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 38
|
||||
/svn/libsangoma/!svn/ver/49/trunk/docs
|
||||
V 71
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/docs
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/docs
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/docs
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/49/trunk/docs/doxygen
|
||||
V 79
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/docs/doxygen
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/docs/doxygen
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/docs/doxygen
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/libsangoma/!svn/ver/206/trunk/examples
|
||||
V 75
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/examples
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/examples
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/206/trunk/examples/hptdm_api
|
||||
V 85
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api
|
||||
END
|
||||
rebuild.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 63
|
||||
/svn/libsangoma/!svn/ver/17/trunk/examples/hptdm_api/rebuild.sh
|
||||
V 96
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/rebuild.sh
|
||||
END
|
||||
doxygen.config
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 67
|
||||
/svn/libsangoma/!svn/ver/17/trunk/examples/hptdm_api/doxygen.config
|
||||
V 100
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/doxygen.config
|
||||
END
|
||||
aft_tdm_hp.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 65
|
||||
/svn/libsangoma/!svn/ver/22/trunk/examples/hptdm_api/aft_tdm_hp.c
|
||||
V 98
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/aft_tdm_hp.c
|
||||
END
|
||||
aft_tdm_hp.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 65
|
||||
/svn/libsangoma/!svn/ver/17/trunk/examples/hptdm_api/aft_tdm_hp.h
|
||||
V 98
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/aft_tdm_hp.h
|
||||
END
|
||||
Makefile
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 61
|
||||
/svn/libsangoma/!svn/ver/22/trunk/examples/hptdm_api/Makefile
|
||||
V 94
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/Makefile
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/examples/hptdm_api
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
81a3f7cc906c1a95c63c8bbb05655f30
|
||||
2008-08-18T04:26:05.260169Z
|
||||
17
|
||||
|
@ -45,7 +45,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
f71df7ce5278594373b87a592d826719
|
||||
2008-08-18T04:26:05.260169Z
|
||||
17
|
||||
|
@ -57,7 +57,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
b8ef9830437ad25ebd95d62434ed9530
|
||||
2008-09-17T21:25:40.156211Z
|
||||
22
|
||||
|
@ -72,7 +72,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
7f0a6424997adf454bbb3c88fb608622
|
||||
2008-08-18T04:26:05.260169Z
|
||||
17
|
||||
|
@ -84,7 +84,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-09-13T22:45:16.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
1432ab687de350b6a988bdbc553bdbe7
|
||||
2008-09-17T21:25:40.156211Z
|
||||
22
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 58
|
||||
/svn/libsangoma/!svn/ver/206/trunk/examples/hptdm_api/docs
|
||||
V 90
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/docs
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/examples/hptdm_api/docs
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/docs
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 66
|
||||
/svn/libsangoma/!svn/ver/206/trunk/examples/hptdm_api/docs/doxygen
|
||||
V 98
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/docs/doxygen
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/examples/hptdm_api/docs/doxygen
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/examples/hptdm_api/docs/doxygen
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/182/trunk/examples/priserver
|
||||
V 85
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/priserver
|
||||
END
|
||||
sound.raw
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 62
|
||||
/svn/libsangoma/!svn/ver/17/trunk/examples/priserver/sound.raw
|
||||
V 95
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/priserver/sound.raw
|
||||
END
|
||||
priserver.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 65
|
||||
/svn/libsangoma/!svn/ver/182/trunk/examples/priserver/priserver.c
|
||||
V 97
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/priserver/priserver.c
|
||||
END
|
||||
librc
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 58
|
||||
/svn/libsangoma/!svn/ver/17/trunk/examples/priserver/librc
|
||||
V 91
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/priserver/librc
|
||||
END
|
||||
Makefile
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 62
|
||||
/svn/libsangoma/!svn/ver/182/trunk/examples/priserver/Makefile
|
||||
V 94
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/priserver/Makefile
|
||||
END
|
||||
README
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 59
|
||||
/svn/libsangoma/!svn/ver/17/trunk/examples/priserver/README
|
||||
V 92
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/examples/priserver/README
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/examples/priserver
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/examples/priserver
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
da36acc78b83d5047481df0cca63d969
|
||||
2008-08-18T04:26:05.260169Z
|
||||
17
|
||||
|
@ -45,7 +45,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
f30671b0a55df63396f6290c31af2fcb
|
||||
2009-06-17T15:37:24.869927Z
|
||||
182
|
||||
|
@ -57,7 +57,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
5c222b74d68b1c7df3f937a9d6321d40
|
||||
2008-08-18T04:26:05.260169Z
|
||||
17
|
||||
|
@ -69,7 +69,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-09-13T22:45:16.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
5afcd0bf7821144218b895150a7951bd
|
||||
2009-06-17T15:37:24.869927Z
|
||||
182
|
||||
|
@ -81,7 +81,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
40538792592cd766e4941d9b37dbaf56
|
||||
2008-08-18T04:26:05.260169Z
|
||||
17
|
||||
|
|
|
@ -147,7 +147,6 @@ extern int libsng_dbg_level;
|
|||
#define DBG_INIT if(libsng_dbg_level)libsng_dbg
|
||||
|
||||
/**** Prototypes of Function used internally by libsangoma ****/
|
||||
sng_fd_t sangoma_open_dev_by_name(const char *dev_name);
|
||||
#if defined(__WINDOWS__)
|
||||
int UdpManagementCommand(sng_fd_t fd, wan_udp_hdr_t* wan_udp);
|
||||
LONG registry_set_integer_value(HKEY hkey, LPTSTR szKeyname, IN int iValue);
|
||||
|
|
|
@ -1702,7 +1702,7 @@ sng_fd_t _LIBSNG_CALL sangoma_open_api_span_chan(int span, int chan)
|
|||
return fd;
|
||||
}
|
||||
|
||||
sng_fd_t sangoma_open_dev_by_name(const char *dev_name)
|
||||
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name)
|
||||
{
|
||||
char fname[FNAME_LEN];
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
* sangoma_get_cpld_version functions,sangoma_get_stats,sangoma_flush_stats
|
||||
*/
|
||||
|
||||
#ifndef _LIBSNAGOMA_H
|
||||
#define _LIBSNAGOMA_H
|
||||
#ifndef _LIBSANGOMA_H
|
||||
#define _LIBSANGOMA_H
|
||||
|
||||
#ifdef __linux__
|
||||
#ifndef __LINUX__
|
||||
|
@ -268,7 +268,8 @@ typedef pthread_mutex_t CRITICAL_SECTION;
|
|||
typedef unsigned int UINT;
|
||||
|
||||
#define EnterCriticalSection(arg) pthread_mutex_lock(arg)
|
||||
#define TryEnterCriticalSection(arg) pthread_mutex_trylock(arg)
|
||||
/* On success, pthread_mutex_trylock() returns 0. On error, non-zero value is returned. */
|
||||
#define TryEnterCriticalSection(arg) (pthread_mutex_trylock(arg)==0 ? 1 : 0)
|
||||
#define LeaveCriticalSection(arg) pthread_mutex_unlock(arg)
|
||||
#define InitializeCriticalSection(arg) pthread_mutex_init(arg, NULL);
|
||||
|
||||
|
@ -426,6 +427,14 @@ sng_fd_t _LIBSNG_CALL __sangoma_open_api_span_chan(int span, int chan);
|
|||
*/
|
||||
sng_fd_t _LIBSNG_CALL sangoma_open_api_span(int span);
|
||||
|
||||
/*!
|
||||
\fn sng_fd_t sangoma_open_dev_by_name(const char *dev_name)
|
||||
\brief Open API device using it's name. For example: Linux: w1g1, Windows wanpipe1_if1.
|
||||
\param dev_name API device name
|
||||
\return File Descriptor: -1 error, 0 or positive integer: valid file descriptor
|
||||
*/
|
||||
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name);
|
||||
|
||||
|
||||
/*!
|
||||
\def sangoma_create_socket_intr
|
||||
|
@ -1528,7 +1537,7 @@ int _LIBSNG_CALL sangoma_set_tx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, float
|
|||
\brief set driver rx gain for this tdm device
|
||||
\param fd device file descriptor
|
||||
\param tdm_api tdm api command structure
|
||||
\param value txgain (0.0 - 10.0) db
|
||||
\param value rxgain (0.0 - 10.0) db
|
||||
\return non-zero = error, 0 = ok
|
||||
*/
|
||||
int _LIBSNG_CALL sangoma_set_rx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, float gain_val);
|
||||
|
@ -2160,5 +2169,5 @@ sangoma_status_t _LIBSNG_CALL sangoma_set_driver_mode_of_all_hw_devices(int driv
|
|||
#define sangoma_create_socket_intr sangoma_open_api_span_chan
|
||||
#endif
|
||||
|
||||
#endif /* _LIBSNAGOMA_H */
|
||||
#endif /* _LIBSANGOMA_H */
|
||||
|
||||
|
|
|
@ -214,6 +214,10 @@
|
|||
RelativePath=".\libsangoma_hwec.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libsangoma_utils.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/libsangoma/!svn/ver/299/trunk/sample_c
|
||||
END
|
||||
lib_api.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/299/trunk/sample_c/lib_api.c
|
||||
V 75
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c
|
||||
END
|
||||
sample-doxygen.config
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 64
|
||||
/svn/libsangoma/!svn/ver/57/trunk/sample_c/sample-doxygen.config
|
||||
V 97
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c/sample-doxygen.config
|
||||
END
|
||||
lib_api.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 85
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c/lib_api.c
|
||||
END
|
||||
sample.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 52
|
||||
/svn/libsangoma/!svn/ver/299/trunk/sample_c/sample.c
|
||||
V 84
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c/sample.c
|
||||
END
|
||||
sources
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 51
|
||||
/svn/libsangoma/!svn/ver/146/trunk/sample_c/sources
|
||||
V 83
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c/sources
|
||||
END
|
||||
lib_api.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/299/trunk/sample_c/lib_api.h
|
||||
V 85
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c/lib_api.h
|
||||
END
|
||||
Makefile.Linux
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 58
|
||||
/svn/libsangoma/!svn/ver/141/trunk/sample_c/Makefile.Linux
|
||||
V 90
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c/Makefile.Linux
|
||||
END
|
||||
compile.bat
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 54
|
||||
/svn/libsangoma/!svn/ver/32/trunk/sample_c/compile.bat
|
||||
V 87
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_c/compile.bat
|
||||
END
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/sample_c
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/sample_c
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
|
@ -26,37 +26,37 @@ svn:special svn:externals svn:needs-lock
|
|||
|
||||
8fe45b59-3c47-0410-bdf9-e5d932a076a6
|
||||
|
||||
lib_api.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-08-13T21:40:10.000000Z
|
||||
59948395132a296c50cbb7ff1e14da23
|
||||
2010-08-13T22:34:32.754036Z
|
||||
299
|
||||
ncorbic
|
||||
|
||||
sample-doxygen.config
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
dbd3173073165a3786ec4e0ef1234db6
|
||||
2008-12-17T22:14:25.604781Z
|
||||
57
|
||||
ncorbic
|
||||
|
||||
lib_api.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
59948395132a296c50cbb7ff1e14da23
|
||||
2010-08-13T22:34:32.754036Z
|
||||
299
|
||||
ncorbic
|
||||
|
||||
sample.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-08-13T21:40:10.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
9a26d40d7a66a72f05e24e068fa9f982
|
||||
2010-08-13T22:34:32.754036Z
|
||||
299
|
||||
|
@ -68,7 +68,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
9c0fe43fbf63eb82e89e4aceb96f9bfc
|
||||
2009-04-22T20:41:57.677943Z
|
||||
146
|
||||
|
@ -80,7 +80,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-08-13T21:40:10.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
9aa9d412a59978edf49a9e1287629af9
|
||||
2010-08-13T22:34:32.754036Z
|
||||
299
|
||||
|
@ -92,7 +92,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-09-13T22:45:16.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
ba64d71a9d128b0eb31f6663ae763a68
|
||||
2009-04-08T00:23:42.359135Z
|
||||
141
|
||||
|
@ -104,7 +104,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
5b82f62f87e4700af9b7e48c658b2cfc
|
||||
2008-11-28T23:21:04.815499Z
|
||||
32
|
||||
|
|
|
@ -1,913 +0,0 @@
|
|||
/******************************************************************************//**
|
||||
* \file sample.c
|
||||
* \brief WANPIPE(tm) API C Sample Code
|
||||
*
|
||||
* Authors: David Rokhvarg <davidr@sangoma.com>
|
||||
* 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 Sangoma Technologies 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 Sangoma Technologies ``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 Sangoma Technologies 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
|
||||
* ===============================================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libsangoma.h"
|
||||
#include "lib_api.h"
|
||||
|
||||
static u_int32_t poll_events_bitmap = 0;
|
||||
|
||||
/*!
|
||||
\def TEST_NUMBER_OF_OBJECTS
|
||||
\brief Number of wait objects to define in object array.
|
||||
|
||||
Objects are used to wait on file descripotrs.
|
||||
Usually there is one wait object per file descriptor.
|
||||
|
||||
In this example there is a single file descriptor and a
|
||||
single wait object.
|
||||
*/
|
||||
#define TEST_NUMBER_OF_OBJECTS 1
|
||||
|
||||
static sangoma_wait_obj_t *sangoma_wait_objects[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
/* This example application has only a single execution thread - it is safe
|
||||
* to use a global buffer for received data and for data to be transmitted. */
|
||||
static unsigned char rxdata[MAX_NO_DATA_BYTES_IN_FRAME];
|
||||
static unsigned char txdata[MAX_NO_DATA_BYTES_IN_FRAME];
|
||||
|
||||
typedef struct sangoma_chan {
|
||||
int spanno;
|
||||
int channo;
|
||||
} sangoma_chan_t;
|
||||
sangoma_chan_t sangoma_channels[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
/* Warning: non-thread safe globals. Ok for this single-thread example but not in production. */
|
||||
unsigned char rx_rbs_bits = WAN_RBS_SIG_A;
|
||||
FILE *pRxFile;
|
||||
int application_termination_flag = 0;
|
||||
|
||||
/*****************************************************************
|
||||
* Prototypes
|
||||
*****************************************************************/
|
||||
|
||||
int __cdecl main(int argc, char* argv[]);
|
||||
int open_sangoma_device(void);
|
||||
void handle_span_chan(int open_device_counter);
|
||||
int handle_tdm_event(uint32_t dev_index);
|
||||
int handle_data(uint32_t dev_index, int flags_out);
|
||||
int read_data(uint32_t dev_index, wp_api_hdr_t *rx_hdr, void *rx_buffer, int rx_buffer_length);
|
||||
int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_buffer, int tx_len);
|
||||
int dtmf_event(sng_fd_t fd,unsigned char digit,unsigned char type,unsigned char port);
|
||||
int rbs_event(sng_fd_t fd,unsigned char rbs_bits);
|
||||
int rxhook_event(sng_fd_t fd,unsigned char hook_state);
|
||||
int rxring_event(sng_fd_t fd,unsigned char ring_state);
|
||||
int ringtrip_event (sng_fd_t fd, unsigned char ring_state);
|
||||
int write_data_to_file(unsigned char *data, unsigned int data_length);
|
||||
int sangoma_print_stats(sng_fd_t sangoma_dev);
|
||||
void cleanup(void);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
BOOL WINAPI TerminateHandler(DWORD dwCtrlType);
|
||||
#else
|
||||
void TerminateHandler(int);
|
||||
#endif
|
||||
|
||||
/*****************************************************************
|
||||
* General Functions
|
||||
*****************************************************************/
|
||||
|
||||
/*!
|
||||
\fn void print_rx_data(unsigned char *data, int datalen)
|
||||
\brief Prints the contents of data packet
|
||||
\param data pointer to data buffer
|
||||
\param datalen size of data buffer
|
||||
\return void
|
||||
*/
|
||||
void print_rxdata(unsigned char *data, int datalen, wp_api_hdr_t *hdr); /* dont remove prototype, gcc complains */
|
||||
void print_rxdata(unsigned char *data, int datalen, wp_api_hdr_t *hdr)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("Data: (Len=%i,Errs=%i)\n",datalen,hdr->wp_api_rx_hdr_errors);
|
||||
for(i = 0; i < datalen; i++) {
|
||||
if((i % 20 == 0)){
|
||||
if(i){
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("%02X ", data[i]);
|
||||
#if 0
|
||||
/* don't print too much!! */
|
||||
if(i > 100){
|
||||
printf("...\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
int sangoma_print_stats(sng_fd_t sangoma_dev)
|
||||
{
|
||||
int err;
|
||||
unsigned char firm_ver, cpld_ver;
|
||||
wanpipe_api_t wp_api;
|
||||
wanpipe_chan_stats_t stats_str;
|
||||
wanpipe_chan_stats_t *stats=&stats_str;
|
||||
memset(&wp_api,0,sizeof(wp_api));
|
||||
|
||||
|
||||
err=sangoma_get_stats(sangoma_dev, &wp_api, stats);
|
||||
if (err) {
|
||||
printf("sangoma_get_stats(() failed (err: %d (0x%X))!\n", err, err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf( "******* OPERATIONAL_STATS *******\n");
|
||||
|
||||
printf("\trx_packets\t: %u\n", stats->rx_packets);
|
||||
printf("\ttx_packets\t: %u\n", stats->tx_packets);
|
||||
printf("\trx_bytes\t: %u\n", stats->rx_bytes);
|
||||
printf("\ttx_bytes\t: %u\n", stats->tx_bytes);
|
||||
printf("\trx_errors\t: %u\n", stats->rx_errors); //Total number of Rx errors
|
||||
printf("\ttx_errors\t: %u\n", stats->tx_errors); //Total number of Tx errors
|
||||
printf("\trx_dropped\t: %u\n", stats->rx_dropped);
|
||||
printf("\ttx_dropped\t: %u\n", stats->tx_dropped);
|
||||
printf("\tmulticast\t: %u\n", stats->multicast);
|
||||
printf("\tcollisions\t: %u\n", stats->collisions);
|
||||
|
||||
printf("\trx_length_errors: %u\n", stats->rx_length_errors);
|
||||
printf("\trx_over_errors\t: %u\n", stats->rx_over_errors);
|
||||
printf("\trx_crc_errors\t: %u\n", stats->rx_crc_errors); //HDLC CRC mismatch
|
||||
printf("\trx_frame_errors\t: %u\n", stats->rx_frame_errors);//HDLC "abort" occured
|
||||
printf("\trx_fifo_errors\t: %u\n", stats->rx_fifo_errors);
|
||||
printf("\trx_missed_errors: %u\n", stats->rx_missed_errors);
|
||||
|
||||
printf("\ttx_aborted_errors: %u\n", stats->tx_aborted_errors);
|
||||
printf("\tTx Idle Data\t: %u\n", stats->tx_carrier_errors);
|
||||
|
||||
printf("\ttx_fifo_errors\t: %u\n", stats->tx_fifo_errors);
|
||||
printf("\ttx_heartbeat_errors: %u\n", stats->tx_heartbeat_errors);
|
||||
printf("\ttx_window_errors: %u\n", stats->tx_window_errors);
|
||||
|
||||
printf("\n\ttx_packets_in_q: %u\n", stats->current_number_of_frames_in_tx_queue);
|
||||
printf("\ttx_queue_size: %u\n", stats->max_tx_queue_length);
|
||||
|
||||
printf("\n\trx_packets_in_q: %u\n", stats->current_number_of_frames_in_rx_queue);
|
||||
printf("\trx_queue_size: %u\n", stats->max_rx_queue_length);
|
||||
|
||||
printf("\n\trx_events_in_q: %u\n", stats->current_number_of_events_in_event_queue);
|
||||
printf("\trx_event_queue_size: %u\n", stats->max_event_queue_length);
|
||||
printf("\trx_events: %u\n", stats->rx_events);
|
||||
printf("\trx_events_dropped: %u\n", stats->rx_events_dropped);
|
||||
|
||||
printf("\tHWEC tone (DTMF) events counter: %u\n", stats->rx_events_tone);
|
||||
printf( "*********************************\n");
|
||||
|
||||
SANGOMA_INIT_TDM_API_CMD(wp_api);
|
||||
err=sangoma_get_driver_version(sangoma_dev,&wp_api, NULL);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
printf("\tDriver Version: %u.%u.%u.%u\n",
|
||||
wp_api.wp_cmd.version.major,
|
||||
wp_api.wp_cmd.version.minor,
|
||||
wp_api.wp_cmd.version.minor1,
|
||||
wp_api.wp_cmd.version.minor2);
|
||||
|
||||
SANGOMA_INIT_TDM_API_CMD(wp_api);
|
||||
err=sangoma_get_firmware_version(sangoma_dev, &wp_api, &firm_ver);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
printf("\tFirmware Version: %X\n",
|
||||
firm_ver);
|
||||
|
||||
SANGOMA_INIT_TDM_API_CMD(wp_api);
|
||||
err=sangoma_get_cpld_version(sangoma_dev, &wp_api, &cpld_ver);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
printf("\tCPLD Version: %X\n",
|
||||
cpld_ver);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int read_data(uint32_t dev_index)
|
||||
\brief Read data buffer from a device
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\param rx_hdr pointer to api header
|
||||
\param rx_buffer pointer to a buffer where recived data will be stored
|
||||
\param rx_buffer_length maximum length of rx_buffer
|
||||
\return 0 - Ok otherwise Error
|
||||
*/
|
||||
int read_data(uint32_t dev_index, wp_api_hdr_t *rx_hdr, void *rx_buffer, int rx_buffer_length)
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
sangoma_chan_t *chan = sangoma_wait_obj_get_context(sangoma_wait_objects[dev_index]);
|
||||
int Rx_lgth = 0;
|
||||
static int Rx_count= 0;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
memset(rx_hdr, 0, sizeof(wp_api_hdr_t));
|
||||
|
||||
/* read the message */
|
||||
Rx_lgth = sangoma_readmsg(
|
||||
dev_fd,
|
||||
rx_hdr, /* header buffer */
|
||||
sizeof(wp_api_hdr_t), /* header size */
|
||||
rx_buffer, /* data buffer */
|
||||
rx_buffer_length, /* data BUFFER size */
|
||||
0);
|
||||
if(Rx_lgth <= 0) {
|
||||
printf("Span: %d, Chan: %d: Error receiving data!\n",
|
||||
chan->spanno, chan->channo);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map) {
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_FIFO_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx fifo error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_CRC_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx crc error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_ABORT_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx abort error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_FRAME_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx framing error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_DMA_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx dma error\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Rx_count++;
|
||||
|
||||
if (verbose){
|
||||
print_rxdata(rx_buffer, Rx_lgth,rx_hdr);
|
||||
}
|
||||
|
||||
if (stats_period && Rx_count % stats_period == 0) {
|
||||
sangoma_print_stats(dev_fd);
|
||||
}
|
||||
|
||||
/* use Rx_counter as "write" events trigger: */
|
||||
if(rbs_events == 1 && (Rx_count % 400) == 0){
|
||||
/* bitmap - set as needed: WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D;
|
||||
|
||||
In this example make bits A and B to change each time,
|
||||
so it's easy to see the change on the receiving side.
|
||||
*/
|
||||
if(rx_rbs_bits == WAN_RBS_SIG_A){
|
||||
rx_rbs_bits = WAN_RBS_SIG_B;
|
||||
}else{
|
||||
rx_rbs_bits = WAN_RBS_SIG_A;
|
||||
}
|
||||
printf("Writing RBS bits (0x%X)...\n", rx_rbs_bits);
|
||||
sangoma_tdm_write_rbs(dev_fd, &tdm_api,
|
||||
chan->channo,
|
||||
rx_rbs_bits);
|
||||
}
|
||||
|
||||
/* if user needs Rx data to be written into a file: */
|
||||
if(files_used & RX_FILE_USED){
|
||||
write_data_to_file(rx_buffer, Rx_lgth);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_data, int tx_len)
|
||||
\brief Transmit a data buffer to a device.
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\param tx_hdr pointer to a wp_api_hdr_t
|
||||
\param tx_data pointer to a data buffer
|
||||
\param tx_len tx data buffer len
|
||||
\return 0 - Ok otherwise Error
|
||||
*/
|
||||
int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_buffer, int tx_len)
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
sangoma_chan_t *chan = sangoma_wait_obj_get_context(sangoma_wait_objects[dev_index]);
|
||||
int err;
|
||||
static int Tx_count = 0;
|
||||
|
||||
if (hdlc_repeat) {
|
||||
tx_hdr->wp_api_tx_hdr_hdlc_rpt_len=4;
|
||||
memset(tx_hdr->wp_api_tx_hdr_hdlc_rpt_data,Tx_count,4);
|
||||
}
|
||||
|
||||
/* write a message */
|
||||
err = sangoma_writemsg(
|
||||
dev_fd,
|
||||
tx_hdr, /* header buffer */
|
||||
sizeof(wp_api_hdr_t), /* header size */
|
||||
tx_buffer, /* data buffer */
|
||||
tx_len, /* DATA size */
|
||||
0);
|
||||
|
||||
if (err <= 0){
|
||||
printf("Span: %d, Chan: %d: Failed to send!\n",
|
||||
chan->spanno,
|
||||
chan->channo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Tx_count++;
|
||||
if (verbose){
|
||||
printf("Packet sent: counter: %i, len: %i, errors %i\n", Tx_count, err, tx_hdr->wp_api_tx_hdr_errors);
|
||||
}else{
|
||||
if(Tx_count && (!(Tx_count % 1000))){
|
||||
printf("Packet sent: counter: %i, len: %i\n", Tx_count, err);
|
||||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
if(tx_cnt && Tx_count >= tx_cnt){
|
||||
write_enable=0;
|
||||
printf("Disabling POLLOUT...\n");
|
||||
/* No need for POLLOUT, turn it off!! If not turned off, and we
|
||||
* have nothing for transmission, sangoma_socket_waitfor() will return
|
||||
* immediately, creating a busy loop. */
|
||||
//sangoma_wait_objects[dev_index].flags_in &= (~POLLOUT);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int handle_data(uint32_t dev_index, int flags_out)
|
||||
\brief Read data buffer from the device and transmit it back down.
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\return 0 - Ok otherwise Error
|
||||
|
||||
Read data buffer from a device.
|
||||
*/
|
||||
int handle_data(uint32_t dev_index, int flags_out)
|
||||
{
|
||||
wp_api_hdr_t rxhdr;
|
||||
int err=0;
|
||||
|
||||
memset(&rxhdr, 0, sizeof(rxhdr));
|
||||
|
||||
#if 0
|
||||
printf("%s(): span: %d, chan: %d\n", __FUNCTION__,
|
||||
sangoma_wait_objects[dev_index].span, sangoma_wait_objects[dev_index].chan);
|
||||
#endif
|
||||
|
||||
if(flags_out & POLLIN){
|
||||
if(read_data(dev_index, &rxhdr, rxdata, MAX_NO_DATA_BYTES_IN_FRAME) == 0){
|
||||
if(rx2tx){
|
||||
/* Send back received data (create a "software loopback"), just a test. */
|
||||
return write_data(dev_index, &rxhdr, rxdata,rxhdr.data_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( (flags_out & POLLOUT) && write_enable ){
|
||||
|
||||
wp_api_hdr_t txhdr;
|
||||
static unsigned char tx_test_byte = 0;
|
||||
|
||||
memset(&txhdr, 0, sizeof(txhdr));
|
||||
txhdr.data_length = (unsigned short)tx_size;/* use '-txsize' command line option to change 'tx_size' */
|
||||
|
||||
/* set data which will be transmitted */
|
||||
memset(txdata, tx_test_byte, txhdr.data_length);
|
||||
|
||||
err = write_data(dev_index, &txhdr, txdata, tx_size);
|
||||
if (err== 0) {
|
||||
tx_test_byte++;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int decode_api_event (wp_api_event_t *wp_tdm_api_event)
|
||||
\brief Handle API Event
|
||||
\param wp_tdm_api_event
|
||||
*/
|
||||
static void decode_api_event(wp_api_event_t *wp_tdm_api_event)
|
||||
{
|
||||
printf("%s(): span: %d, chan: %d\n", __FUNCTION__,
|
||||
wp_tdm_api_event->span, wp_tdm_api_event->channel);
|
||||
|
||||
switch(wp_tdm_api_event->wp_api_event_type)
|
||||
{
|
||||
case WP_API_EVENT_DTMF:/* DTMF detected by Hardware */
|
||||
printf("DTMF Event: Channel: %d, Digit: %c (Port: %s, Type:%s)!\n",
|
||||
wp_tdm_api_event->channel,
|
||||
wp_tdm_api_event->wp_api_event_dtmf_digit,
|
||||
(wp_tdm_api_event->wp_api_event_dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT",
|
||||
(wp_tdm_api_event->wp_api_event_dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP");
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RXHOOK:
|
||||
printf("RXHOOK Event: Channel: %d, %s! (0x%X)\n",
|
||||
wp_tdm_api_event->channel,
|
||||
WAN_EVENT_RXHOOK_DECODE(wp_tdm_api_event->wp_api_event_hook_state),
|
||||
wp_tdm_api_event->wp_api_event_hook_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RING_DETECT:
|
||||
printf("RING Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_RING_DECODE(wp_tdm_api_event->wp_api_event_ring_state),
|
||||
wp_tdm_api_event->wp_api_event_ring_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RING_TRIP_DETECT:
|
||||
printf("RING TRIP Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_RING_TRIP_DECODE(wp_tdm_api_event->wp_api_event_ring_state),
|
||||
wp_tdm_api_event->wp_api_event_ring_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RBS:
|
||||
printf("RBS Event: Channel: %d, 0x%X!\n",
|
||||
wp_tdm_api_event->channel,
|
||||
wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
printf( "RX RBS: A:%1d B:%1d C:%1d D:%1d\n",
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_A) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_B) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_C) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_D) ? 1 : 0);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_LINK_STATUS:
|
||||
printf("Link Status Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_LINK_STATUS_DECODE(wp_tdm_api_event->wp_api_event_link_status),
|
||||
wp_tdm_api_event->wp_api_event_link_status);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_ALARM:
|
||||
printf("New Alarm State: %s! (0x%X)\n", (wp_tdm_api_event->wp_api_event_alarm == 0?"Off":"On"),
|
||||
wp_tdm_api_event->wp_api_event_alarm);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_POLARITY_REVERSE:
|
||||
printf("Polarity Reversal Event : %s! (0x%X)\n",
|
||||
WP_API_EVENT_POLARITY_REVERSE_DECODE(wp_tdm_api_event->wp_api_event_polarity_reverse),
|
||||
wp_tdm_api_event->wp_api_event_polarity_reverse);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown TDM API Event: %d\n", wp_tdm_api_event->wp_api_event_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int handle_tdm_event(uint32_t dev_index)
|
||||
\brief Read Event buffer from the device
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\return 0 - Ok otherwise Error
|
||||
|
||||
An EVENT has occoured. Execute a system call to read the EVENT
|
||||
on a device.
|
||||
*/
|
||||
int handle_tdm_event(uint32_t dev_index)
|
||||
{
|
||||
wanpipe_api_t tdm_api;
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
|
||||
#if 0
|
||||
printf("%s(): dev_index: %d, dev_fd: 0x%p\n", __FUNCTION__, dev_index, dev_fd);
|
||||
#endif
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
if(sangoma_read_event(dev_fd, &tdm_api)){
|
||||
return 1;
|
||||
}
|
||||
|
||||
decode_api_event(&tdm_api.wp_cmd.event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void handle_span_chan(int open_device_counter)
|
||||
\brief Write data buffer into a file
|
||||
\param open_device_counter number of opened devices
|
||||
\return void
|
||||
|
||||
This function will wait on all opened devices.
|
||||
This example will wait for RX and EVENT signals.
|
||||
In case of POLLIN - rx data available
|
||||
In case of POLLPRI - event is available
|
||||
*/
|
||||
void handle_span_chan(int open_device_counter)
|
||||
{
|
||||
int iResult, i;
|
||||
u_int32_t input_flags[TEST_NUMBER_OF_OBJECTS];
|
||||
u_int32_t output_flags[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
printf("\n\nSpan/Chan Handler: RxEnable=%s, TxEnable=%s, TxCnt=%i, TxLen=%i, rx2tx=%s\n",
|
||||
(read_enable? "Yes":"No"), (write_enable?"Yes":"No"),tx_cnt,tx_size, (rx2tx?"Yes":"No"));
|
||||
|
||||
for (i = 0; i < open_device_counter; i++) {
|
||||
input_flags[i] = poll_events_bitmap;
|
||||
}
|
||||
|
||||
/* Main Rx/Tx/Event loop */
|
||||
while(!application_termination_flag)
|
||||
{
|
||||
iResult = sangoma_waitfor_many(sangoma_wait_objects,
|
||||
input_flags,
|
||||
output_flags,
|
||||
open_device_counter /* number of wait objects */,
|
||||
5000 /* wait timeout, in milliseconds */);
|
||||
switch(iResult)
|
||||
{
|
||||
case SANG_STATUS_APIPOLL_TIMEOUT:
|
||||
/* timeout (not an error) */
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[0]);
|
||||
sangoma_print_stats(dev_fd);
|
||||
}
|
||||
printf("Timeout\n");
|
||||
continue;
|
||||
|
||||
case SANG_STATUS_SUCCESS:
|
||||
for(i = 0; i < open_device_counter; i++){
|
||||
|
||||
/* a wait object was signaled */
|
||||
if(output_flags[i] & POLLPRI){
|
||||
/* got tdm api event */
|
||||
if(handle_tdm_event(i)){
|
||||
printf("Error in handle_tdm_event()!\n");
|
||||
application_termination_flag=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(output_flags[i] & (POLLIN | POLLOUT)){
|
||||
/* rx data OR a free tx buffer available */
|
||||
if(handle_data(i, output_flags[i])){
|
||||
printf("Error in handle_data()!\n");
|
||||
//application_termination_flag=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}/* for() */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* error */
|
||||
printf("Error: iResult: %s (%d)\n", SDLA_DECODE_SANG_STATUS(iResult), iResult);
|
||||
return;
|
||||
}
|
||||
|
||||
}/* while() */
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int write_data_to_file(unsigned char *data, unsigned int data_length)
|
||||
\brief Write data buffer into a file
|
||||
\param data data buffer
|
||||
\param data_length length of a data buffer
|
||||
\return data_length = ok otherwise error
|
||||
|
||||
*/
|
||||
int write_data_to_file(unsigned char *data, unsigned int data_length)
|
||||
{
|
||||
if(pRxFile == NULL){
|
||||
return 1;
|
||||
}
|
||||
|
||||
return fwrite(data, 1, data_length, pRxFile);
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
/*
|
||||
* TerminateHandler() - this handler is called by the system whenever user tries to terminate
|
||||
* the process with Ctrl+C, Ctrl+Break or closes the console window.
|
||||
* Perform a clean-up here.
|
||||
*/
|
||||
BOOL TerminateHandler(DWORD dwCtrlType)
|
||||
{
|
||||
printf("\nProcess terminated by user request.\n");
|
||||
application_termination_flag = 1;
|
||||
/* do the cleanup before exiting: */
|
||||
cleanup();
|
||||
/* return FALSE so the system will call the dafult handler which will terminate the process. */
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
/*!
|
||||
\fn void TerminateHandler (int sig)
|
||||
\brief Signal handler for graceful shutdown
|
||||
\param sig signal
|
||||
*/
|
||||
void TerminateHandler (int sig)
|
||||
{
|
||||
printf("\nProcess terminated by user request.\n");
|
||||
application_termination_flag = 1;
|
||||
/* do the cleanup before exiting: */
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void cleanup()
|
||||
\brief Protperly shutdown single device
|
||||
\param dev_no device index number
|
||||
\return void
|
||||
|
||||
*/
|
||||
void cleanup()
|
||||
{
|
||||
int dev_no;
|
||||
sng_fd_t fd;
|
||||
sangoma_chan_t *chan;
|
||||
sangoma_wait_obj_t *sng_wait_object;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
/* do the cleanup before exiting: */
|
||||
for(dev_no = 0; dev_no < TEST_NUMBER_OF_OBJECTS; dev_no++){
|
||||
|
||||
sng_wait_object = sangoma_wait_objects[dev_no];
|
||||
if(!sng_wait_object){
|
||||
continue;
|
||||
}
|
||||
chan = sangoma_wait_obj_get_context(sng_wait_object);
|
||||
printf("%s(): span: %d, chan: %d ...\n", __FUNCTION__,
|
||||
chan->channo,
|
||||
chan->spanno);
|
||||
|
||||
fd = sangoma_wait_obj_get_fd(sng_wait_object);
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
if(dtmf_enable_octasic == 1){
|
||||
/* Disable dtmf detection on Octasic chip */
|
||||
sangoma_tdm_disable_dtmf_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(dtmf_enable_remora == 1){
|
||||
/* Disable dtmf detection on Sangoma's Remora SLIC chip */
|
||||
sangoma_tdm_disable_rm_dtmf_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(remora_hook == 1){
|
||||
sangoma_tdm_disable_rxhook_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(rbs_events == 1){
|
||||
sangoma_tdm_disable_rbs_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
sangoma_wait_obj_delete(&sng_wait_object);
|
||||
|
||||
sangoma_close(&fd);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\fn int open_sangoma_device()
|
||||
\brief Open a single span chan device
|
||||
\return 0 ok otherise error.
|
||||
|
||||
This function will open a single span chan.
|
||||
|
||||
However it can be rewritten to iterate for all spans and chans and try to
|
||||
open all existing wanpipe devices.
|
||||
|
||||
For each opened device, a wait object will be initialized.
|
||||
For each device, configure the chunk size for tx/rx
|
||||
enable events such as DTMF/RBS ...etc
|
||||
*/
|
||||
int open_sangoma_device()
|
||||
{
|
||||
int span, chan, err = 0, open_dev_cnt = 0;
|
||||
sangoma_status_t status;
|
||||
sng_fd_t dev_fd = INVALID_HANDLE_VALUE;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
span = wanpipe_port_no;
|
||||
chan = wanpipe_if_no;
|
||||
|
||||
/* span and chan are 1-based */
|
||||
dev_fd = sangoma_open_api_span_chan(span, chan);
|
||||
if( dev_fd == INVALID_HANDLE_VALUE){
|
||||
printf("Warning: Failed to open span %d, chan %d\n", span , chan);
|
||||
return 1;
|
||||
}else{
|
||||
printf("Successfuly opened span %d, chan %d\n", span , chan);
|
||||
}
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
status = sangoma_wait_obj_create(&sangoma_wait_objects[open_dev_cnt], dev_fd, SANGOMA_DEVICE_WAIT_OBJ);
|
||||
if(status != SANG_STATUS_SUCCESS){
|
||||
printf("Error: Failed to create 'sangoma_wait_object'!\n");
|
||||
return 1;
|
||||
}
|
||||
sangoma_channels[open_dev_cnt].channo = chan;
|
||||
sangoma_channels[open_dev_cnt].spanno = span;
|
||||
sangoma_wait_obj_set_context(sangoma_wait_objects[open_dev_cnt], &sangoma_channels[open_dev_cnt]);
|
||||
/* open_dev_cnt++; */
|
||||
|
||||
if((err = sangoma_get_full_cfg(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(set_codec_slinear){
|
||||
printf("Setting SLINEAR codec\n");
|
||||
if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_SLINEAR))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(set_codec_none){
|
||||
printf("Disabling codec\n");
|
||||
if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_NONE))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(usr_period){
|
||||
printf("Setting user period: %d\n", usr_period);
|
||||
if((err=sangoma_tdm_set_usr_period(dev_fd, &tdm_api, usr_period))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(set_codec_slinear || usr_period || set_codec_none){
|
||||
/* display new configuration AFTER it was changed */
|
||||
if((err=sangoma_get_full_cfg(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(dtmf_enable_octasic == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
/* enable dtmf detection on Octasic chip */
|
||||
if((err=sangoma_tdm_enable_dtmf_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(dtmf_enable_remora == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
/* enable dtmf detection on Sangoma's Remora SLIC chip (A200 ONLY) */
|
||||
if((err=sangoma_tdm_enable_rm_dtmf_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(remora_hook == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
if((err=sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(rbs_events == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
if((err=sangoma_tdm_enable_rbs_events(dev_fd, &tdm_api, 20))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (buffer_multiplier) {
|
||||
printf("Setting buffer multiplier to %i\n",buffer_multiplier);
|
||||
err=sangoma_tdm_set_buffer_multiplier(dev_fd,&tdm_api,buffer_multiplier);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Device Config RxQ=%i TxQ=%i \n",
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api),
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api));
|
||||
|
||||
sangoma_set_rx_queue_sz(dev_fd,&tdm_api,20);
|
||||
sangoma_set_tx_queue_sz(dev_fd,&tdm_api,30);
|
||||
|
||||
printf("Device Config RxQ=%i TxQ=%i \n",
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api),
|
||||
sangoma_get_tx_queue_sz(dev_fd,&tdm_api));
|
||||
|
||||
sangoma_flush_bufs(dev_fd,&tdm_api);
|
||||
|
||||
sangoma_print_stats(dev_fd);
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int __cdecl main(int argc, char* argv[])
|
||||
\brief Main function that starts the sample code
|
||||
\param argc number of arguments
|
||||
\param argv argument list
|
||||
*/
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
int proceed, i;
|
||||
|
||||
proceed=init_args(argc,argv);
|
||||
if (proceed != WAN_TRUE){
|
||||
usage(argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* register Ctrl+C handler - we want a clean termination */
|
||||
#if defined(__WINDOWS__)
|
||||
if (!SetConsoleCtrlHandler(TerminateHandler, TRUE)) {
|
||||
printf("ERROR : Unable to register terminate handler ( %d ).\nProcess terminated.\n",
|
||||
GetLastError());
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
signal(SIGHUP,TerminateHandler);
|
||||
signal(SIGTERM,TerminateHandler);
|
||||
#endif
|
||||
|
||||
for(i = 0; i < TEST_NUMBER_OF_OBJECTS; i++){
|
||||
sangoma_wait_objects[i] = NULL;
|
||||
}
|
||||
|
||||
poll_events_bitmap = 0;
|
||||
if(read_enable == 1){
|
||||
poll_events_bitmap |= POLLIN;
|
||||
}
|
||||
|
||||
if(write_enable == 1 && rx2tx == 1){
|
||||
/* These two options are mutually exclusive because 'rx2tx' option
|
||||
* indicates "use Reciever as the timing source for Transmitter". */
|
||||
write_enable = 0;
|
||||
}
|
||||
|
||||
if(write_enable == 1){
|
||||
poll_events_bitmap |= POLLOUT;
|
||||
}
|
||||
|
||||
/* Front End connect/disconnect, and other events, such as DTMF... */
|
||||
poll_events_bitmap |= (POLLHUP | POLLPRI);
|
||||
#if defined(__WINDOWS__)
|
||||
printf("Enabling Poll Events:\n");
|
||||
print_poll_event_bitmap(poll_events_bitmap);
|
||||
#endif
|
||||
printf("Connecting to Port/Span: %d, Interface/Chan: %d\n",
|
||||
wanpipe_port_no, wanpipe_if_no);
|
||||
|
||||
|
||||
if(open_sangoma_device()){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("********************************\n");
|
||||
printf("files_used: 0x%x\n", files_used);
|
||||
printf("********************************\n");
|
||||
if(files_used & RX_FILE_USED){
|
||||
pRxFile = fopen( (const char*)&rx_file[0], "wb" );
|
||||
if(pRxFile == NULL){
|
||||
printf("Can't open Rx file: [%s]!!\n", rx_file);
|
||||
}else{
|
||||
printf("Open Rx file: %s. OK.\n", rx_file);
|
||||
}
|
||||
}
|
||||
|
||||
handle_span_chan(1 /* handle a single device */);
|
||||
|
||||
/* returned from main loop, do the cleanup before exiting: */
|
||||
cleanup();
|
||||
|
||||
printf("\nSample application exiting.(press any key)\n");
|
||||
_getch();
|
||||
return 0;
|
||||
}
|
|
@ -1,945 +0,0 @@
|
|||
/******************************************************************************//**
|
||||
* \file sample.c
|
||||
* \brief WANPIPE(tm) API C Sample Code
|
||||
*
|
||||
* Authors: David Rokhvarg <davidr@sangoma.com>
|
||||
* 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 Sangoma Technologies 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 Sangoma Technologies ``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 Sangoma Technologies 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
|
||||
* ===============================================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libsangoma.h"
|
||||
#include "lib_api.h"
|
||||
|
||||
static u_int32_t poll_events_bitmap = 0;
|
||||
|
||||
/*!
|
||||
\def TEST_NUMBER_OF_OBJECTS
|
||||
\brief Number of wait objects to define in object array.
|
||||
|
||||
Objects are used to wait on file descripotrs.
|
||||
Usually there is one wait object per file descriptor.
|
||||
|
||||
In this example there is a single file descriptor and a
|
||||
single wait object.
|
||||
*/
|
||||
#define TEST_NUMBER_OF_OBJECTS 1
|
||||
|
||||
static sangoma_wait_obj_t *sangoma_wait_objects[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
/* This example application has only a single execution thread - it is safe
|
||||
* to use a global buffer for received data and for data to be transmitted. */
|
||||
static unsigned char rxdata[MAX_NO_DATA_BYTES_IN_FRAME];
|
||||
static unsigned char txdata[MAX_NO_DATA_BYTES_IN_FRAME];
|
||||
|
||||
typedef struct sangoma_chan {
|
||||
int spanno;
|
||||
int channo;
|
||||
} sangoma_chan_t;
|
||||
sangoma_chan_t sangoma_channels[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
/* Warning: non-thread safe globals. Ok for this single-thread example but not in production. */
|
||||
unsigned char rx_rbs_bits = WAN_RBS_SIG_A;
|
||||
FILE *pRxFile;
|
||||
int application_termination_flag = 0;
|
||||
|
||||
/*****************************************************************
|
||||
* Prototypes
|
||||
*****************************************************************/
|
||||
|
||||
int __cdecl main(int argc, char* argv[]);
|
||||
int open_sangoma_device(void);
|
||||
void handle_span_chan(int open_device_counter);
|
||||
int handle_tdm_event(uint32_t dev_index);
|
||||
int handle_data(uint32_t dev_index, int flags_out);
|
||||
int read_data(uint32_t dev_index, wp_api_hdr_t *rx_hdr, void *rx_buffer, int rx_buffer_length);
|
||||
int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_buffer, int tx_len);
|
||||
int dtmf_event(sng_fd_t fd,unsigned char digit,unsigned char type,unsigned char port);
|
||||
int rbs_event(sng_fd_t fd,unsigned char rbs_bits);
|
||||
int rxhook_event(sng_fd_t fd,unsigned char hook_state);
|
||||
int rxring_event(sng_fd_t fd,unsigned char ring_state);
|
||||
int ringtrip_event (sng_fd_t fd, unsigned char ring_state);
|
||||
int write_data_to_file(unsigned char *data, unsigned int data_length);
|
||||
int sangoma_print_stats(sng_fd_t sangoma_dev);
|
||||
void cleanup(void);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
BOOL WINAPI TerminateHandler(DWORD dwCtrlType);
|
||||
#else
|
||||
void TerminateHandler(int);
|
||||
#endif
|
||||
|
||||
/*****************************************************************
|
||||
* General Functions
|
||||
*****************************************************************/
|
||||
|
||||
/*!
|
||||
\fn void print_rx_data(unsigned char *data, int datalen)
|
||||
\brief Prints the contents of data packet
|
||||
\param data pointer to data buffer
|
||||
\param datalen size of data buffer
|
||||
\return void
|
||||
*/
|
||||
void print_rxdata(unsigned char *data, int datalen, wp_api_hdr_t *hdr); /* dont remove prototype, gcc complains */
|
||||
void print_rxdata(unsigned char *data, int datalen, wp_api_hdr_t *hdr)
|
||||
{
|
||||
int i;
|
||||
int err=0;
|
||||
|
||||
<<<<<<< .mine
|
||||
printf("Data: (Len=%i,Errs=%i)\n",datalen,hdr->wp_api_rx_hdr_errors);
|
||||
=======
|
||||
#ifdef WP_API_FEATURE_RX_TX_ERRS
|
||||
err=hdr->wp_api_rx_hdr_errors;
|
||||
#endif
|
||||
printf("Data: (Len=%i,Errs=%i)\n",datalen,err);
|
||||
>>>>>>> .r292
|
||||
for(i = 0; i < datalen; i++) {
|
||||
if((i % 20 == 0)){
|
||||
if(i){
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("%02X ", data[i]);
|
||||
#if 0
|
||||
/* don't print too much!! */
|
||||
if(i > 100){
|
||||
printf("...\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
int sangoma_print_stats(sng_fd_t sangoma_dev)
|
||||
{
|
||||
int err;
|
||||
unsigned char firm_ver, cpld_ver;
|
||||
wanpipe_api_t wp_api;
|
||||
wanpipe_chan_stats_t stats_str;
|
||||
wanpipe_chan_stats_t *stats=&stats_str;
|
||||
memset(&wp_api,0,sizeof(wp_api));
|
||||
|
||||
|
||||
err=sangoma_get_stats(sangoma_dev, &wp_api, stats);
|
||||
if (err) {
|
||||
printf("sangoma_get_stats(() failed (err: %d (0x%X))!\n", err, err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf( "******* OPERATIONAL_STATS *******\n");
|
||||
|
||||
printf("\trx_packets\t: %u\n", stats->rx_packets);
|
||||
printf("\ttx_packets\t: %u\n", stats->tx_packets);
|
||||
printf("\trx_bytes\t: %u\n", stats->rx_bytes);
|
||||
printf("\ttx_bytes\t: %u\n", stats->tx_bytes);
|
||||
printf("\trx_errors\t: %u\n", stats->rx_errors); //Total number of Rx errors
|
||||
printf("\ttx_errors\t: %u\n", stats->tx_errors); //Total number of Tx errors
|
||||
printf("\trx_dropped\t: %u\n", stats->rx_dropped);
|
||||
printf("\ttx_dropped\t: %u\n", stats->tx_dropped);
|
||||
printf("\tmulticast\t: %u\n", stats->multicast);
|
||||
printf("\tcollisions\t: %u\n", stats->collisions);
|
||||
|
||||
printf("\trx_length_errors: %u\n", stats->rx_length_errors);
|
||||
printf("\trx_over_errors\t: %u\n", stats->rx_over_errors);
|
||||
printf("\trx_crc_errors\t: %u\n", stats->rx_crc_errors); //HDLC CRC mismatch
|
||||
printf("\trx_frame_errors\t: %u\n", stats->rx_frame_errors);//HDLC "abort" occured
|
||||
printf("\trx_fifo_errors\t: %u\n", stats->rx_fifo_errors);
|
||||
printf("\trx_missed_errors: %u\n", stats->rx_missed_errors);
|
||||
|
||||
printf("\ttx_aborted_errors: %u\n", stats->tx_aborted_errors);
|
||||
printf("\tTx Idle Data\t: %u\n", stats->tx_carrier_errors);
|
||||
|
||||
printf("\ttx_fifo_errors\t: %u\n", stats->tx_fifo_errors);
|
||||
printf("\ttx_heartbeat_errors: %u\n", stats->tx_heartbeat_errors);
|
||||
printf("\ttx_window_errors: %u\n", stats->tx_window_errors);
|
||||
|
||||
printf("\n\ttx_packets_in_q: %u\n", stats->current_number_of_frames_in_tx_queue);
|
||||
printf("\ttx_queue_size: %u\n", stats->max_tx_queue_length);
|
||||
|
||||
printf("\n\trx_packets_in_q: %u\n", stats->current_number_of_frames_in_rx_queue);
|
||||
printf("\trx_queue_size: %u\n", stats->max_rx_queue_length);
|
||||
|
||||
printf("\n\trx_events_in_q: %u\n", stats->current_number_of_events_in_event_queue);
|
||||
printf("\trx_event_queue_size: %u\n", stats->max_event_queue_length);
|
||||
printf("\trx_events: %u\n", stats->rx_events);
|
||||
printf("\trx_events_dropped: %u\n", stats->rx_events_dropped);
|
||||
|
||||
printf("\tHWEC tone (DTMF) events counter: %u\n", stats->rx_events_tone);
|
||||
printf( "*********************************\n");
|
||||
|
||||
SANGOMA_INIT_TDM_API_CMD(wp_api);
|
||||
err=sangoma_get_driver_version(sangoma_dev,&wp_api, NULL);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
printf("\tDriver Version: %u.%u.%u.%u\n",
|
||||
wp_api.wp_cmd.version.major,
|
||||
wp_api.wp_cmd.version.minor,
|
||||
wp_api.wp_cmd.version.minor1,
|
||||
wp_api.wp_cmd.version.minor2);
|
||||
|
||||
SANGOMA_INIT_TDM_API_CMD(wp_api);
|
||||
err=sangoma_get_firmware_version(sangoma_dev, &wp_api, &firm_ver);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
printf("\tFirmware Version: %X\n",
|
||||
firm_ver);
|
||||
|
||||
SANGOMA_INIT_TDM_API_CMD(wp_api);
|
||||
err=sangoma_get_cpld_version(sangoma_dev, &wp_api, &cpld_ver);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
printf("\tCPLD Version: %X\n",
|
||||
cpld_ver);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int read_data(uint32_t dev_index)
|
||||
\brief Read data buffer from a device
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\param rx_hdr pointer to api header
|
||||
\param rx_buffer pointer to a buffer where recived data will be stored
|
||||
\param rx_buffer_length maximum length of rx_buffer
|
||||
\return 0 - Ok otherwise Error
|
||||
*/
|
||||
int read_data(uint32_t dev_index, wp_api_hdr_t *rx_hdr, void *rx_buffer, int rx_buffer_length)
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
sangoma_chan_t *chan = sangoma_wait_obj_get_context(sangoma_wait_objects[dev_index]);
|
||||
int Rx_lgth = 0;
|
||||
static int Rx_count= 0;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
memset(rx_hdr, 0, sizeof(wp_api_hdr_t));
|
||||
|
||||
/* read the message */
|
||||
Rx_lgth = sangoma_readmsg(
|
||||
dev_fd,
|
||||
rx_hdr, /* header buffer */
|
||||
sizeof(wp_api_hdr_t), /* header size */
|
||||
rx_buffer, /* data buffer */
|
||||
rx_buffer_length, /* data BUFFER size */
|
||||
0);
|
||||
if(Rx_lgth <= 0) {
|
||||
printf("Span: %d, Chan: %d: Error receiving data!\n",
|
||||
chan->spanno, chan->channo);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
<<<<<<< .mine
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map) {
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_FIFO_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx fifo error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_CRC_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx crc error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_ABORT_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx abort error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_FRAME_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx framing error\n");
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_DMA_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx dma error\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
=======
|
||||
#ifdef WP_API_FEATURE_RX_TX_ERRS
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map) {
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_FIFO_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx fifo error 0x%02X\n",chan->spanno,chan->channo,rx_hdr->wp_api_rx_hdr_error_map);
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_CRC_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx crc error 0x%02X\n",chan->spanno,chan->channo,rx_hdr->wp_api_rx_hdr_error_map);
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_ABORT_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx abort error 0x%02X\n",chan->spanno,chan->channo,rx_hdr->wp_api_rx_hdr_error_map);
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_FRAME_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx framing error 0x%02X\n",chan->spanno,chan->channo,rx_hdr->wp_api_rx_hdr_error_map);
|
||||
}
|
||||
if (rx_hdr->wp_api_rx_hdr_error_map & 1<<WP_DMA_ERROR_BIT) {
|
||||
printf("Span: %d, Chan: %d rx dma error 0x%02X\n",chan->spanno,chan->channo,rx_hdr->wp_api_rx_hdr_error_map);
|
||||
}
|
||||
//return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
>>>>>>> .r292
|
||||
Rx_count++;
|
||||
|
||||
if (verbose){
|
||||
print_rxdata(rx_buffer, Rx_lgth,rx_hdr);
|
||||
}
|
||||
|
||||
if (stats_period && Rx_count % stats_period == 0) {
|
||||
sangoma_print_stats(dev_fd);
|
||||
}
|
||||
|
||||
/* use Rx_counter as "write" events trigger: */
|
||||
if(rbs_events == 1 && (Rx_count % 400) == 0){
|
||||
/* bitmap - set as needed: WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D;
|
||||
|
||||
In this example make bits A and B to change each time,
|
||||
so it's easy to see the change on the receiving side.
|
||||
*/
|
||||
if(rx_rbs_bits == WAN_RBS_SIG_A){
|
||||
rx_rbs_bits = WAN_RBS_SIG_B;
|
||||
}else{
|
||||
rx_rbs_bits = WAN_RBS_SIG_A;
|
||||
}
|
||||
printf("Writing RBS bits (0x%X)...\n", rx_rbs_bits);
|
||||
sangoma_tdm_write_rbs(dev_fd, &tdm_api,
|
||||
chan->channo,
|
||||
rx_rbs_bits);
|
||||
}
|
||||
|
||||
/* if user needs Rx data to be written into a file: */
|
||||
if(files_used & RX_FILE_USED){
|
||||
write_data_to_file(rx_buffer, Rx_lgth);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_data, int tx_len)
|
||||
\brief Transmit a data buffer to a device.
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\param tx_hdr pointer to a wp_api_hdr_t
|
||||
\param tx_data pointer to a data buffer
|
||||
\param tx_len tx data buffer len
|
||||
\return 0 - Ok otherwise Error
|
||||
*/
|
||||
int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_buffer, int tx_len)
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
sangoma_chan_t *chan = sangoma_wait_obj_get_context(sangoma_wait_objects[dev_index]);
|
||||
int err;
|
||||
static int Tx_count = 0;
|
||||
|
||||
if (hdlc_repeat) {
|
||||
tx_hdr->wp_api_tx_hdr_hdlc_rpt_len=4;
|
||||
memset(tx_hdr->wp_api_tx_hdr_hdlc_rpt_data,Tx_count,4);
|
||||
}
|
||||
|
||||
/* write a message */
|
||||
err = sangoma_writemsg(
|
||||
dev_fd,
|
||||
tx_hdr, /* header buffer */
|
||||
sizeof(wp_api_hdr_t), /* header size */
|
||||
tx_buffer, /* data buffer */
|
||||
tx_len, /* DATA size */
|
||||
0);
|
||||
|
||||
if (err <= 0){
|
||||
printf("Span: %d, Chan: %d: Failed to send!\n",
|
||||
chan->spanno,
|
||||
chan->channo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Tx_count++;
|
||||
if (verbose){
|
||||
printf("Packet sent: counter: %i, len: %i, errors %i\n", Tx_count, err, tx_hdr->wp_api_tx_hdr_errors);
|
||||
}else{
|
||||
if(Tx_count && (!(Tx_count % 1000))){
|
||||
printf("Packet sent: counter: %i, len: %i\n", Tx_count, err);
|
||||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
if(tx_cnt && Tx_count >= tx_cnt){
|
||||
write_enable=0;
|
||||
printf("Disabling POLLOUT...\n");
|
||||
/* No need for POLLOUT, turn it off!! If not turned off, and we
|
||||
* have nothing for transmission, sangoma_socket_waitfor() will return
|
||||
* immediately, creating a busy loop. */
|
||||
//sangoma_wait_objects[dev_index].flags_in &= (~POLLOUT);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int handle_data(uint32_t dev_index, int flags_out)
|
||||
\brief Read data buffer from the device and transmit it back down.
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\return 0 - Ok otherwise Error
|
||||
|
||||
Read data buffer from a device.
|
||||
*/
|
||||
int handle_data(uint32_t dev_index, int flags_out)
|
||||
{
|
||||
wp_api_hdr_t rxhdr;
|
||||
int err=0;
|
||||
|
||||
memset(&rxhdr, 0, sizeof(rxhdr));
|
||||
|
||||
#if 0
|
||||
printf("%s(): span: %d, chan: %d\n", __FUNCTION__,
|
||||
sangoma_wait_objects[dev_index].span, sangoma_wait_objects[dev_index].chan);
|
||||
#endif
|
||||
|
||||
if(flags_out & POLLIN){
|
||||
if(read_data(dev_index, &rxhdr, rxdata, MAX_NO_DATA_BYTES_IN_FRAME) == 0){
|
||||
if(rx2tx){
|
||||
/* Send back received data (create a "software loopback"), just a test. */
|
||||
return write_data(dev_index, &rxhdr, rxdata,rxhdr.data_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( (flags_out & POLLOUT) && write_enable ){
|
||||
|
||||
wp_api_hdr_t txhdr;
|
||||
static unsigned char tx_test_byte = 0;
|
||||
|
||||
memset(&txhdr, 0, sizeof(txhdr));
|
||||
txhdr.data_length = (unsigned short)tx_size;/* use '-txsize' command line option to change 'tx_size' */
|
||||
|
||||
/* set data which will be transmitted */
|
||||
memset(txdata, tx_test_byte, txhdr.data_length);
|
||||
|
||||
err = write_data(dev_index, &txhdr, txdata, tx_size);
|
||||
if (err== 0) {
|
||||
tx_test_byte++;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int decode_api_event (wp_api_event_t *wp_tdm_api_event)
|
||||
\brief Handle API Event
|
||||
\param wp_tdm_api_event
|
||||
*/
|
||||
static void decode_api_event(wp_api_event_t *wp_tdm_api_event)
|
||||
{
|
||||
printf("%s(): span: %d, chan: %d\n", __FUNCTION__,
|
||||
wp_tdm_api_event->span, wp_tdm_api_event->channel);
|
||||
|
||||
switch(wp_tdm_api_event->wp_api_event_type)
|
||||
{
|
||||
case WP_API_EVENT_DTMF:/* DTMF detected by Hardware */
|
||||
printf("DTMF Event: Channel: %d, Digit: %c (Port: %s, Type:%s)!\n",
|
||||
wp_tdm_api_event->channel,
|
||||
wp_tdm_api_event->wp_api_event_dtmf_digit,
|
||||
(wp_tdm_api_event->wp_api_event_dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT",
|
||||
(wp_tdm_api_event->wp_api_event_dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP");
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RXHOOK:
|
||||
printf("RXHOOK Event: Channel: %d, %s! (0x%X)\n",
|
||||
wp_tdm_api_event->channel,
|
||||
WAN_EVENT_RXHOOK_DECODE(wp_tdm_api_event->wp_api_event_hook_state),
|
||||
wp_tdm_api_event->wp_api_event_hook_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RING_DETECT:
|
||||
printf("RING Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_RING_DECODE(wp_tdm_api_event->wp_api_event_ring_state),
|
||||
wp_tdm_api_event->wp_api_event_ring_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RING_TRIP_DETECT:
|
||||
printf("RING TRIP Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_RING_TRIP_DECODE(wp_tdm_api_event->wp_api_event_ring_state),
|
||||
wp_tdm_api_event->wp_api_event_ring_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RBS:
|
||||
printf("RBS Event: Channel: %d, 0x%X!\n",
|
||||
wp_tdm_api_event->channel,
|
||||
wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
printf( "RX RBS: A:%1d B:%1d C:%1d D:%1d\n",
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_A) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_B) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_C) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_D) ? 1 : 0);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_LINK_STATUS:
|
||||
printf("Link Status Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_LINK_STATUS_DECODE(wp_tdm_api_event->wp_api_event_link_status),
|
||||
wp_tdm_api_event->wp_api_event_link_status);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_ALARM:
|
||||
printf("New Alarm State: %s! (0x%X)\n", (wp_tdm_api_event->wp_api_event_alarm == 0?"Off":"On"),
|
||||
wp_tdm_api_event->wp_api_event_alarm);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_POLARITY_REVERSE:
|
||||
printf("Polarity Reversal Event : %s! (0x%X)\n",
|
||||
WP_API_EVENT_POLARITY_REVERSE_DECODE(wp_tdm_api_event->wp_api_event_polarity_reverse),
|
||||
wp_tdm_api_event->wp_api_event_polarity_reverse);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown TDM API Event: %d\n", wp_tdm_api_event->wp_api_event_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int handle_tdm_event(uint32_t dev_index)
|
||||
\brief Read Event buffer from the device
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\return 0 - Ok otherwise Error
|
||||
|
||||
An EVENT has occoured. Execute a system call to read the EVENT
|
||||
on a device.
|
||||
*/
|
||||
int handle_tdm_event(uint32_t dev_index)
|
||||
{
|
||||
wanpipe_api_t tdm_api;
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
|
||||
#if 0
|
||||
printf("%s(): dev_index: %d, dev_fd: 0x%p\n", __FUNCTION__, dev_index, dev_fd);
|
||||
#endif
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
if(sangoma_read_event(dev_fd, &tdm_api)){
|
||||
return 1;
|
||||
}
|
||||
|
||||
decode_api_event(&tdm_api.wp_cmd.event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void handle_span_chan(int open_device_counter)
|
||||
\brief Write data buffer into a file
|
||||
\param open_device_counter number of opened devices
|
||||
\return void
|
||||
|
||||
This function will wait on all opened devices.
|
||||
This example will wait for RX and EVENT signals.
|
||||
In case of POLLIN - rx data available
|
||||
In case of POLLPRI - event is available
|
||||
*/
|
||||
void handle_span_chan(int open_device_counter)
|
||||
{
|
||||
int iResult, i;
|
||||
u_int32_t input_flags[TEST_NUMBER_OF_OBJECTS];
|
||||
u_int32_t output_flags[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
printf("\n\nSpan/Chan Handler: RxEnable=%s, TxEnable=%s, TxCnt=%i, TxLen=%i, rx2tx=%s\n",
|
||||
(read_enable? "Yes":"No"), (write_enable?"Yes":"No"),tx_cnt,tx_size, (rx2tx?"Yes":"No"));
|
||||
|
||||
for (i = 0; i < open_device_counter; i++) {
|
||||
input_flags[i] = poll_events_bitmap;
|
||||
}
|
||||
|
||||
/* Main Rx/Tx/Event loop */
|
||||
while(!application_termination_flag)
|
||||
{
|
||||
iResult = sangoma_waitfor_many(sangoma_wait_objects,
|
||||
input_flags,
|
||||
output_flags,
|
||||
open_device_counter /* number of wait objects */,
|
||||
5000 /* wait timeout, in milliseconds */);
|
||||
switch(iResult)
|
||||
{
|
||||
case SANG_STATUS_APIPOLL_TIMEOUT:
|
||||
/* timeout (not an error) */
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[0]);
|
||||
sangoma_print_stats(dev_fd);
|
||||
}
|
||||
printf("Timeout\n");
|
||||
continue;
|
||||
|
||||
case SANG_STATUS_SUCCESS:
|
||||
for(i = 0; i < open_device_counter; i++){
|
||||
|
||||
/* a wait object was signaled */
|
||||
if(output_flags[i] & POLLPRI){
|
||||
/* got tdm api event */
|
||||
if(handle_tdm_event(i)){
|
||||
printf("Error in handle_tdm_event()!\n");
|
||||
application_termination_flag=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(output_flags[i] & (POLLIN | POLLOUT)){
|
||||
/* rx data OR a free tx buffer available */
|
||||
if(handle_data(i, output_flags[i])){
|
||||
printf("Error in handle_data()!\n");
|
||||
//application_termination_flag=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}/* for() */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* error */
|
||||
printf("Error: iResult: %s (%d)\n", SDLA_DECODE_SANG_STATUS(iResult), iResult);
|
||||
return;
|
||||
}
|
||||
|
||||
}/* while() */
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int write_data_to_file(unsigned char *data, unsigned int data_length)
|
||||
\brief Write data buffer into a file
|
||||
\param data data buffer
|
||||
\param data_length length of a data buffer
|
||||
\return data_length = ok otherwise error
|
||||
|
||||
*/
|
||||
int write_data_to_file(unsigned char *data, unsigned int data_length)
|
||||
{
|
||||
if(pRxFile == NULL){
|
||||
return 1;
|
||||
}
|
||||
|
||||
return fwrite(data, 1, data_length, pRxFile);
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
/*
|
||||
* TerminateHandler() - this handler is called by the system whenever user tries to terminate
|
||||
* the process with Ctrl+C, Ctrl+Break or closes the console window.
|
||||
* Perform a clean-up here.
|
||||
*/
|
||||
BOOL TerminateHandler(DWORD dwCtrlType)
|
||||
{
|
||||
printf("\nProcess terminated by user request.\n");
|
||||
application_termination_flag = 1;
|
||||
/* do the cleanup before exiting: */
|
||||
cleanup();
|
||||
/* return FALSE so the system will call the dafult handler which will terminate the process. */
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
/*!
|
||||
\fn void TerminateHandler (int sig)
|
||||
\brief Signal handler for graceful shutdown
|
||||
\param sig signal
|
||||
*/
|
||||
void TerminateHandler (int sig)
|
||||
{
|
||||
printf("\nProcess terminated by user request.\n");
|
||||
application_termination_flag = 1;
|
||||
/* do the cleanup before exiting: */
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void cleanup()
|
||||
\brief Protperly shutdown single device
|
||||
\param dev_no device index number
|
||||
\return void
|
||||
|
||||
*/
|
||||
void cleanup()
|
||||
{
|
||||
int dev_no;
|
||||
sng_fd_t fd;
|
||||
sangoma_chan_t *chan;
|
||||
sangoma_wait_obj_t *sng_wait_object;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
/* do the cleanup before exiting: */
|
||||
for(dev_no = 0; dev_no < TEST_NUMBER_OF_OBJECTS; dev_no++){
|
||||
|
||||
sng_wait_object = sangoma_wait_objects[dev_no];
|
||||
if(!sng_wait_object){
|
||||
continue;
|
||||
}
|
||||
chan = sangoma_wait_obj_get_context(sng_wait_object);
|
||||
printf("%s(): span: %d, chan: %d ...\n", __FUNCTION__,
|
||||
chan->channo,
|
||||
chan->spanno);
|
||||
|
||||
fd = sangoma_wait_obj_get_fd(sng_wait_object);
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
if(dtmf_enable_octasic == 1){
|
||||
/* Disable dtmf detection on Octasic chip */
|
||||
sangoma_tdm_disable_dtmf_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(dtmf_enable_remora == 1){
|
||||
/* Disable dtmf detection on Sangoma's Remora SLIC chip */
|
||||
sangoma_tdm_disable_rm_dtmf_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(remora_hook == 1){
|
||||
sangoma_tdm_disable_rxhook_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(rbs_events == 1){
|
||||
sangoma_tdm_disable_rbs_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
sangoma_wait_obj_delete(&sng_wait_object);
|
||||
|
||||
sangoma_close(&fd);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\fn int open_sangoma_device()
|
||||
\brief Open a single span chan device
|
||||
\return 0 ok otherise error.
|
||||
|
||||
This function will open a single span chan.
|
||||
|
||||
However it can be rewritten to iterate for all spans and chans and try to
|
||||
open all existing wanpipe devices.
|
||||
|
||||
For each opened device, a wait object will be initialized.
|
||||
For each device, configure the chunk size for tx/rx
|
||||
enable events such as DTMF/RBS ...etc
|
||||
*/
|
||||
int open_sangoma_device()
|
||||
{
|
||||
int span, chan, err = 0, open_dev_cnt = 0;
|
||||
sangoma_status_t status;
|
||||
sng_fd_t dev_fd = INVALID_HANDLE_VALUE;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
span = wanpipe_port_no;
|
||||
chan = wanpipe_if_no;
|
||||
|
||||
/* span and chan are 1-based */
|
||||
dev_fd = sangoma_open_api_span_chan(span, chan);
|
||||
if( dev_fd == INVALID_HANDLE_VALUE){
|
||||
printf("Warning: Failed to open span %d, chan %d\n", span , chan);
|
||||
return 1;
|
||||
}else{
|
||||
printf("Successfuly opened span %d, chan %d\n", span , chan);
|
||||
}
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
status = sangoma_wait_obj_create(&sangoma_wait_objects[open_dev_cnt], dev_fd, SANGOMA_DEVICE_WAIT_OBJ);
|
||||
if(status != SANG_STATUS_SUCCESS){
|
||||
printf("Error: Failed to create 'sangoma_wait_object'!\n");
|
||||
return 1;
|
||||
}
|
||||
sangoma_channels[open_dev_cnt].channo = chan;
|
||||
sangoma_channels[open_dev_cnt].spanno = span;
|
||||
sangoma_wait_obj_set_context(sangoma_wait_objects[open_dev_cnt], &sangoma_channels[open_dev_cnt]);
|
||||
/* open_dev_cnt++; */
|
||||
|
||||
if((err = sangoma_get_full_cfg(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(set_codec_slinear){
|
||||
printf("Setting SLINEAR codec\n");
|
||||
if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_SLINEAR))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(set_codec_none){
|
||||
printf("Disabling codec\n");
|
||||
if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_NONE))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(usr_period){
|
||||
printf("Setting user period: %d\n", usr_period);
|
||||
if((err=sangoma_tdm_set_usr_period(dev_fd, &tdm_api, usr_period))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(set_codec_slinear || usr_period || set_codec_none){
|
||||
/* display new configuration AFTER it was changed */
|
||||
if((err=sangoma_get_full_cfg(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(dtmf_enable_octasic == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
/* enable dtmf detection on Octasic chip */
|
||||
if((err=sangoma_tdm_enable_dtmf_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(dtmf_enable_remora == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
/* enable dtmf detection on Sangoma's Remora SLIC chip (A200 ONLY) */
|
||||
if((err=sangoma_tdm_enable_rm_dtmf_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(remora_hook == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
if((err=sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(rbs_events == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
if((err=sangoma_tdm_enable_rbs_events(dev_fd, &tdm_api, 20))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (buffer_multiplier) {
|
||||
printf("Setting buffer multiplier to %i\n",buffer_multiplier);
|
||||
err=sangoma_tdm_set_buffer_multiplier(dev_fd,&tdm_api,buffer_multiplier);
|
||||
if (err) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Device Config RxQ=%i TxQ=%i \n",
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api),
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api));
|
||||
|
||||
sangoma_set_rx_queue_sz(dev_fd,&tdm_api,20);
|
||||
sangoma_set_tx_queue_sz(dev_fd,&tdm_api,30);
|
||||
|
||||
printf("Device Config RxQ=%i TxQ=%i \n",
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api),
|
||||
sangoma_get_tx_queue_sz(dev_fd,&tdm_api));
|
||||
|
||||
sangoma_flush_bufs(dev_fd,&tdm_api);
|
||||
|
||||
sangoma_print_stats(dev_fd);
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int __cdecl main(int argc, char* argv[])
|
||||
\brief Main function that starts the sample code
|
||||
\param argc number of arguments
|
||||
\param argv argument list
|
||||
*/
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
int proceed, i;
|
||||
|
||||
proceed=init_args(argc,argv);
|
||||
if (proceed != WAN_TRUE){
|
||||
usage(argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* register Ctrl+C handler - we want a clean termination */
|
||||
#if defined(__WINDOWS__)
|
||||
if (!SetConsoleCtrlHandler(TerminateHandler, TRUE)) {
|
||||
printf("ERROR : Unable to register terminate handler ( %d ).\nProcess terminated.\n",
|
||||
GetLastError());
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
signal(SIGHUP,TerminateHandler);
|
||||
signal(SIGTERM,TerminateHandler);
|
||||
#endif
|
||||
|
||||
for(i = 0; i < TEST_NUMBER_OF_OBJECTS; i++){
|
||||
sangoma_wait_objects[i] = NULL;
|
||||
}
|
||||
|
||||
poll_events_bitmap = 0;
|
||||
if(read_enable == 1){
|
||||
poll_events_bitmap |= POLLIN;
|
||||
}
|
||||
|
||||
if(write_enable == 1 && rx2tx == 1){
|
||||
/* These two options are mutually exclusive because 'rx2tx' option
|
||||
* indicates "use Reciever as the timing source for Transmitter". */
|
||||
write_enable = 0;
|
||||
}
|
||||
|
||||
if(write_enable == 1){
|
||||
poll_events_bitmap |= POLLOUT;
|
||||
}
|
||||
|
||||
/* Front End connect/disconnect, and other events, such as DTMF... */
|
||||
poll_events_bitmap |= (POLLHUP | POLLPRI);
|
||||
#if defined(__WINDOWS__)
|
||||
printf("Enabling Poll Events:\n");
|
||||
print_poll_event_bitmap(poll_events_bitmap);
|
||||
#endif
|
||||
printf("Connecting to Port/Span: %d, Interface/Chan: %d\n",
|
||||
wanpipe_port_no, wanpipe_if_no);
|
||||
|
||||
|
||||
if(open_sangoma_device()){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("********************************\n");
|
||||
printf("files_used: 0x%x\n", files_used);
|
||||
printf("********************************\n");
|
||||
if(files_used & RX_FILE_USED){
|
||||
pRxFile = fopen( (const char*)&rx_file[0], "wb" );
|
||||
if(pRxFile == NULL){
|
||||
printf("Can't open Rx file: [%s]!!\n", rx_file);
|
||||
}else{
|
||||
printf("Open Rx file: %s. OK.\n", rx_file);
|
||||
}
|
||||
}
|
||||
|
||||
handle_span_chan(1 /* handle a single device */);
|
||||
|
||||
/* returned from main loop, do the cleanup before exiting: */
|
||||
cleanup();
|
||||
|
||||
printf("\nSample application exiting.(press any key)\n");
|
||||
_getch();
|
||||
return 0;
|
||||
}
|
|
@ -1,775 +0,0 @@
|
|||
/******************************************************************************//**
|
||||
* \file sample.c
|
||||
* \brief WANPIPE(tm) API C Sample Code
|
||||
*
|
||||
* Authors: David Rokhvarg <davidr@sangoma.com>
|
||||
* 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 Sangoma Technologies 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 Sangoma Technologies ``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 Sangoma Technologies 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
|
||||
* ===============================================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libsangoma.h"
|
||||
#include "lib_api.h"
|
||||
|
||||
static u_int32_t poll_events_bitmap = 0;
|
||||
|
||||
/*!
|
||||
\def TEST_NUMBER_OF_OBJECTS
|
||||
\brief Number of wait objects to define in object array.
|
||||
|
||||
Objects are used to wait on file descripotrs.
|
||||
Usually there is one wait object per file descriptor.
|
||||
|
||||
In this example there is a single file descriptor and a
|
||||
single wait object.
|
||||
*/
|
||||
#define TEST_NUMBER_OF_OBJECTS 1
|
||||
|
||||
static void *sangoma_wait_objects[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
/* This example application has only a single execution thread - it is safe
|
||||
* to use a global buffer for received data and for data to be transmitted. */
|
||||
static unsigned char rxdata[MAX_NO_DATA_BYTES_IN_FRAME];
|
||||
static unsigned char txdata[MAX_NO_DATA_BYTES_IN_FRAME];
|
||||
|
||||
typedef struct sangoma_chan {
|
||||
int spanno;
|
||||
int channo;
|
||||
} sangoma_chan_t;
|
||||
sangoma_chan_t sangoma_channels[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
/* Warning: non-thread safe globals. Ok for this single-thread example but not in production. */
|
||||
unsigned char rx_rbs_bits = WAN_RBS_SIG_A;
|
||||
FILE *pRxFile;
|
||||
int application_termination_flag = 0;
|
||||
|
||||
/*****************************************************************
|
||||
* Prototypes
|
||||
*****************************************************************/
|
||||
|
||||
int __cdecl main(int argc, char* argv[]);
|
||||
int open_sangoma_device(void);
|
||||
void handle_span_chan(int open_device_counter);
|
||||
int handle_tdm_event(uint32_t dev_index);
|
||||
int handle_data(uint32_t dev_index, int flags_out);
|
||||
int read_data(uint32_t dev_index, wp_api_hdr_t *rx_hdr, void *rx_buffer, int rx_buffer_length);
|
||||
int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_buffer);
|
||||
int dtmf_event(sng_fd_t fd,unsigned char digit,unsigned char type,unsigned char port);
|
||||
int rbs_event(sng_fd_t fd,unsigned char rbs_bits);
|
||||
int rxhook_event(sng_fd_t fd,unsigned char hook_state);
|
||||
int rxring_event(sng_fd_t fd,unsigned char ring_state);
|
||||
int ringtrip_event (sng_fd_t fd, unsigned char ring_state);
|
||||
int write_data_to_file(unsigned char *data, unsigned int data_length);
|
||||
void cleanup(void);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
BOOL TerminateHandler(DWORD dwCtrlType);
|
||||
#else
|
||||
void TerminateHandler(int);
|
||||
#endif
|
||||
|
||||
/*****************************************************************
|
||||
* General Functions
|
||||
*****************************************************************/
|
||||
|
||||
/*!
|
||||
\fn void print_rx_data(unsigned char *data, int datalen)
|
||||
\brief Prints the contents of data packet
|
||||
\param data pointer to data buffer
|
||||
\param datalen size of data buffer
|
||||
\return void
|
||||
*/
|
||||
void print_rxdata(unsigned char *data, int datalen); /* dont remove prototype, gcc complains */
|
||||
void print_rxdata(unsigned char *data, int datalen)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("Data: (Len=%i)\n",datalen);
|
||||
for(i = 0; i < datalen; i++) {
|
||||
if((i % 20 == 0)){
|
||||
if(i){
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("%02X ", data[i]);
|
||||
#if 0
|
||||
/* don't print too much!! */
|
||||
if(i > 100){
|
||||
printf("...\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int read_data(uint32_t dev_index)
|
||||
\brief Read data buffer from a device
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\param rx_hdr pointer to api header
|
||||
\param rx_buffer pointer to a buffer where recived data will be stored
|
||||
\param rx_buffer_length maximum length of rx_buffer
|
||||
\return 0 - Ok otherwise Error
|
||||
*/
|
||||
int read_data(uint32_t dev_index, wp_api_hdr_t *rx_hdr, void *rx_buffer, int rx_buffer_length)
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
sangoma_chan_t *chan = sangoma_wait_obj_get_context(sangoma_wait_objects[dev_index]);
|
||||
int Rx_lgth = 0;
|
||||
static int Rx_count= 0;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
memset(rx_hdr, 0, sizeof(wp_api_hdr_t));
|
||||
|
||||
/* read the message */
|
||||
Rx_lgth = sangoma_readmsg(
|
||||
dev_fd,
|
||||
rx_hdr, /* header buffer */
|
||||
sizeof(wp_api_hdr_t), /* header size */
|
||||
rx_buffer, /* data buffer */
|
||||
rx_buffer_length, /* data BUFFER size */
|
||||
0);
|
||||
if(Rx_lgth <= 0) {
|
||||
printf("Span: %d, Chan: %d: Error receiving data!\n",
|
||||
chan->spanno, chan->channo);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (verbose){
|
||||
print_rxdata(rx_buffer, Rx_lgth);
|
||||
}
|
||||
|
||||
/* use Rx_counter as "write" events trigger: */
|
||||
if(rbs_events == 1 && (Rx_count % 400) == 0){
|
||||
/* bitmap - set as needed: WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D;
|
||||
|
||||
In this example make bits A and B to change each time,
|
||||
so it's easy to see the change on the receiving side.
|
||||
*/
|
||||
if(rx_rbs_bits == WAN_RBS_SIG_A){
|
||||
rx_rbs_bits = WAN_RBS_SIG_B;
|
||||
}else{
|
||||
rx_rbs_bits = WAN_RBS_SIG_A;
|
||||
}
|
||||
printf("Writing RBS bits (0x%X)...\n", rx_rbs_bits);
|
||||
sangoma_tdm_write_rbs(dev_fd, &tdm_api,
|
||||
chan->channo,
|
||||
rx_rbs_bits);
|
||||
}
|
||||
|
||||
/* if user needs Rx data to be written into a file: */
|
||||
if(files_used & RX_FILE_USED){
|
||||
write_data_to_file(rx_buffer, Rx_lgth);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_data)
|
||||
\brief Transmit a data buffer to a device.
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\param tx_hdr pointer to a wp_api_hdr_t
|
||||
\param tx_data pointer to a data buffer
|
||||
\return 0 - Ok otherwise Error
|
||||
*/
|
||||
int write_data(uint32_t dev_index, wp_api_hdr_t *tx_hdr, void *tx_buffer)
|
||||
{
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
sangoma_chan_t *chan = sangoma_wait_obj_get_context(sangoma_wait_objects[dev_index]);
|
||||
int err;
|
||||
static int Tx_count = 0;
|
||||
|
||||
/* write a message */
|
||||
err = sangoma_writemsg(
|
||||
dev_fd,
|
||||
tx_hdr, /* header buffer */
|
||||
sizeof(wp_api_hdr_t), /* header size */
|
||||
tx_buffer, /* data buffer */
|
||||
tx_hdr->data_length, /* DATA size */
|
||||
0);
|
||||
|
||||
if (err <= 0){
|
||||
printf("Span: %d, Chan: %d: Failed to send!\n",
|
||||
chan->spanno,
|
||||
chan->channo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Tx_count++;
|
||||
if (verbose){
|
||||
printf("Packet sent: counter: %i, len: %i\n", Tx_count, err);
|
||||
}else{
|
||||
if(Tx_count && (!(Tx_count % 1000))){
|
||||
printf("Packet sent: counter: %i, len: %i\n", Tx_count, err);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(Tx_count >= tx_cnt){
|
||||
write_enable=0;
|
||||
printf("Disabling POLLOUT...\n");
|
||||
/* No need for POLLOUT, turn it off!! If not turned off, and we
|
||||
* have nothing for transmission, sangoma_socket_waitfor() will return
|
||||
* immediately, creating a busy loop. */
|
||||
sangoma_wait_objects[dev_index].flags_in &= (~POLLOUT);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int handle_data(uint32_t dev_index, int flags_out)
|
||||
\brief Read data buffer from the device and transmit it back down.
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\return 0 - Ok otherwise Error
|
||||
|
||||
Read data buffer from a device.
|
||||
*/
|
||||
int handle_data(uint32_t dev_index, int flags_out)
|
||||
{
|
||||
wp_api_hdr_t rxhdr;
|
||||
|
||||
memset(&rxhdr, 0, sizeof(rxhdr));
|
||||
|
||||
#if 0
|
||||
printf("%s(): span: %d, chan: %d\n", __FUNCTION__,
|
||||
sangoma_wait_objects[dev_index].span, sangoma_wait_objects[dev_index].chan);
|
||||
#endif
|
||||
|
||||
if(flags_out & POLLIN){
|
||||
if(read_data(dev_index, &rxhdr, rxdata, MAX_NO_DATA_BYTES_IN_FRAME) == 0){
|
||||
if(rx2tx){
|
||||
/* Send back received data (create a "software loopback"), just a test. */
|
||||
return write_data(dev_index, &rxhdr, rxdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( (flags_out & POLLOUT) && write_enable ){
|
||||
|
||||
wp_api_hdr_t txhdr;
|
||||
static unsigned char tx_test_byte = 0;
|
||||
|
||||
memset(&txhdr, 0, sizeof(txhdr));
|
||||
txhdr.data_length = (unsigned short)tx_size;/* use '-txsize' command line option to change 'tx_size' */
|
||||
|
||||
/* set data which will be transmitted */
|
||||
memset(txdata, tx_test_byte, txhdr.data_length);
|
||||
|
||||
if(write_data(dev_index, &txhdr, txdata) == 0){
|
||||
tx_test_byte++;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int decode_api_event (wp_api_event_t *wp_tdm_api_event)
|
||||
\brief Handle API Event
|
||||
\param wp_tdm_api_event
|
||||
*/
|
||||
static void decode_api_event(wp_api_event_t *wp_tdm_api_event)
|
||||
{
|
||||
printf("%s(): span: %d, chan: %d\n", __FUNCTION__,
|
||||
wp_tdm_api_event->span, wp_tdm_api_event->channel);
|
||||
|
||||
switch(wp_tdm_api_event->wp_api_event_type)
|
||||
{
|
||||
case WP_API_EVENT_DTMF:/* DTMF detected by Hardware */
|
||||
printf("DTMF Event: Channel: %d, Digit: %c (Port: %s, Type:%s)!\n",
|
||||
wp_tdm_api_event->channel,
|
||||
wp_tdm_api_event->wp_api_event_dtmf_digit,
|
||||
(wp_tdm_api_event->wp_api_event_dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT",
|
||||
(wp_tdm_api_event->wp_api_event_dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP");
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RXHOOK:
|
||||
printf("RXHOOK Event: Channel: %d, %s! (0x%X)\n",
|
||||
wp_tdm_api_event->channel,
|
||||
WAN_EVENT_RXHOOK_DECODE(wp_tdm_api_event->wp_api_event_hook_state),
|
||||
wp_tdm_api_event->wp_api_event_hook_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RING_DETECT:
|
||||
printf("RING Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_RING_DECODE(wp_tdm_api_event->wp_api_event_ring_state),
|
||||
wp_tdm_api_event->wp_api_event_ring_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RING_TRIP_DETECT:
|
||||
printf("RING TRIP Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_RING_TRIP_DECODE(wp_tdm_api_event->wp_api_event_ring_state),
|
||||
wp_tdm_api_event->wp_api_event_ring_state);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_RBS:
|
||||
printf("RBS Event: Channel: %d, 0x%X!\n",
|
||||
wp_tdm_api_event->channel,
|
||||
wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
printf( "RX RBS: A:%1d B:%1d C:%1d D:%1d\n",
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_A) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_B) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_C) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_D) ? 1 : 0);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_LINK_STATUS:
|
||||
printf("Link Status Event: %s! (0x%X)\n",
|
||||
WAN_EVENT_LINK_STATUS_DECODE(wp_tdm_api_event->wp_api_event_link_status),
|
||||
wp_tdm_api_event->wp_api_event_link_status);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_ALARM:
|
||||
printf("New Alarm State: %s! (0x%X)\n", (wp_tdm_api_event->wp_api_event_alarm == 0?"Off":"On"),
|
||||
wp_tdm_api_event->wp_api_event_alarm);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_POLARITY_REVERSE:
|
||||
printf("Polarity Reversal Event : %s! (0x%X)\n",
|
||||
WP_API_EVENT_POLARITY_REVERSE_DECODE(wp_tdm_api_event->wp_api_event_polarity_reverse),
|
||||
wp_tdm_api_event->wp_api_event_polarity_reverse);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown TDM API Event: %d\n", wp_tdm_api_event->wp_api_event_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int handle_tdm_event(uint32_t dev_index)
|
||||
\brief Read Event buffer from the device
|
||||
\param dev_index device index number associated with device file descriptor
|
||||
\return 0 - Ok otherwise Error
|
||||
|
||||
An EVENT has occoured. Execute a system call to read the EVENT
|
||||
on a device.
|
||||
*/
|
||||
int handle_tdm_event(uint32_t dev_index)
|
||||
{
|
||||
wanpipe_api_t tdm_api;
|
||||
sng_fd_t dev_fd = sangoma_wait_obj_get_fd(sangoma_wait_objects[dev_index]);
|
||||
|
||||
#if 0
|
||||
printf("%s(): dev_index: %d, dev_fd: 0x%p\n", __FUNCTION__, dev_index, dev_fd);
|
||||
#endif
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
if(sangoma_read_event(dev_fd, &tdm_api)){
|
||||
return 1;
|
||||
}
|
||||
|
||||
decode_api_event(&tdm_api.wp_cmd.event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void handle_span_chan(int open_device_counter)
|
||||
\brief Write data buffer into a file
|
||||
\param open_device_counter number of opened devices
|
||||
\return void
|
||||
|
||||
This function will wait on all opened devices.
|
||||
This example will wait for RX and EVENT signals.
|
||||
In case of POLLIN - rx data available
|
||||
In case of POLLPRI - event is available
|
||||
*/
|
||||
void handle_span_chan(int open_device_counter)
|
||||
{
|
||||
int iResult, i;
|
||||
u_int32_t input_flags[TEST_NUMBER_OF_OBJECTS];
|
||||
u_int32_t output_flags[TEST_NUMBER_OF_OBJECTS];
|
||||
|
||||
printf("\n\nSpan/Chan Handler: RxEnable=%s, TxEnable=%s, TxCnt=%i, TxLen=%i, rx2tx=%s\n",
|
||||
(read_enable? "Yes":"No"), (write_enable?"Yes":"No"),tx_cnt,tx_size, (rx2tx?"Yes":"No"));
|
||||
|
||||
for (i = 0; i < open_device_counter; i++) {
|
||||
input_flags[i] = poll_events_bitmap;
|
||||
}
|
||||
|
||||
/* Main Rx/Tx/Event loop */
|
||||
while(!application_termination_flag)
|
||||
{
|
||||
iResult = sangoma_waitfor_many(sangoma_wait_objects,
|
||||
input_flags,
|
||||
output_flags,
|
||||
open_device_counter /* number of wait objects */,
|
||||
2000 /* wait timeout, in milliseconds */);
|
||||
switch(iResult)
|
||||
{
|
||||
case SANG_STATUS_APIPOLL_TIMEOUT:
|
||||
/* timeout (not an error) */
|
||||
printf("Timeout\n");
|
||||
continue;
|
||||
|
||||
case SANG_STATUS_SUCCESS:
|
||||
for(i = 0; i < open_device_counter; i++){
|
||||
|
||||
/* a wait object was signaled */
|
||||
if(output_flags[i] & POLLPRI){
|
||||
/* got tdm api event */
|
||||
if(handle_tdm_event(i)){
|
||||
printf("Error in handle_tdm_event()!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if(output_flags[i] & (POLLIN | POLLOUT)){
|
||||
/* rx data OR a free tx buffer available */
|
||||
if(handle_data(i, output_flags[i])){
|
||||
printf("Error in handle_data()!\n");
|
||||
}
|
||||
}
|
||||
}/* for() */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* error */
|
||||
printf("Error: iResult: %s (%d)\n", SDLA_DECODE_SANG_STATUS(iResult), iResult);
|
||||
return;
|
||||
}
|
||||
|
||||
}/* while() */
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int write_data_to_file(unsigned char *data, unsigned int data_length)
|
||||
\brief Write data buffer into a file
|
||||
\param data data buffer
|
||||
\param data_length length of a data buffer
|
||||
\return data_length = ok otherwise error
|
||||
|
||||
*/
|
||||
int write_data_to_file(unsigned char *data, unsigned int data_length)
|
||||
{
|
||||
if(pRxFile == NULL){
|
||||
return 1;
|
||||
}
|
||||
|
||||
return fwrite(data, 1, data_length, pRxFile);
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
/*
|
||||
* TerminateHandler() - this handler is called by the system whenever user tries to terminate
|
||||
* the process with Ctrl+C, Ctrl+Break or closes the console window.
|
||||
* Perform a clean-up here.
|
||||
*/
|
||||
BOOL TerminateHandler(DWORD dwCtrlType)
|
||||
{
|
||||
printf("\nProcess terminated by user request.\n");
|
||||
application_termination_flag = 1;
|
||||
/* do the cleanup before exiting: */
|
||||
cleanup();
|
||||
/* return FALSE so the system will call the dafult handler which will terminate the process. */
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
/*!
|
||||
\fn void TerminateHandler (int sig)
|
||||
\brief Signal handler for graceful shutdown
|
||||
\param sig signal
|
||||
*/
|
||||
void TerminateHandler (int sig)
|
||||
{
|
||||
printf("\nProcess terminated by user request.\n");
|
||||
application_termination_flag = 1;
|
||||
/* do the cleanup before exiting: */
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void cleanup()
|
||||
\brief Protperly shutdown single device
|
||||
\param dev_no device index number
|
||||
\return void
|
||||
|
||||
*/
|
||||
void cleanup()
|
||||
{
|
||||
int dev_no;
|
||||
sng_fd_t fd;
|
||||
sangoma_chan_t *chan;
|
||||
sangoma_wait_obj_t *sng_wait_object;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
/* do the cleanup before exiting: */
|
||||
for(dev_no = 0; dev_no < TEST_NUMBER_OF_OBJECTS; dev_no++){
|
||||
|
||||
sng_wait_object = sangoma_wait_objects[dev_no];
|
||||
if(!sng_wait_object){
|
||||
continue;
|
||||
}
|
||||
chan = sangoma_wait_obj_get_context(sng_wait_object);
|
||||
printf("%s(): span: %d, chan: %d ...\n", __FUNCTION__,
|
||||
chan->channo,
|
||||
chan->spanno);
|
||||
|
||||
fd = sangoma_wait_obj_get_fd(sng_wait_object);
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
if(dtmf_enable_octasic == 1){
|
||||
/* Disable dtmf detection on Octasic chip */
|
||||
sangoma_tdm_disable_dtmf_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(dtmf_enable_remora == 1){
|
||||
/* Disable dtmf detection on Sangoma's Remora SLIC chip */
|
||||
sangoma_tdm_disable_rm_dtmf_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(remora_hook == 1){
|
||||
sangoma_tdm_disable_rxhook_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
if(rbs_events == 1){
|
||||
sangoma_tdm_disable_rbs_events(fd, &tdm_api);
|
||||
}
|
||||
|
||||
sangoma_wait_obj_delete(&sng_wait_object);
|
||||
|
||||
sangoma_close(&fd);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\fn int open_sangoma_device()
|
||||
\brief Open a single span chan device
|
||||
\return 0 ok otherise error.
|
||||
|
||||
This function will open a single span chan.
|
||||
|
||||
However it can be rewritten to iterate for all spans and chans and try to
|
||||
open all existing wanpipe devices.
|
||||
|
||||
For each opened device, a wait object will be initialized.
|
||||
For each device, configure the chunk size for tx/rx
|
||||
enable events such as DTMF/RBS ...etc
|
||||
*/
|
||||
int open_sangoma_device()
|
||||
{
|
||||
int span, chan, err = 0, open_dev_cnt = 0;
|
||||
sangoma_status_t status;
|
||||
sng_fd_t dev_fd = INVALID_HANDLE_VALUE;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
span = wanpipe_port_no;
|
||||
chan = wanpipe_if_no;
|
||||
|
||||
/* span and chan are 1-based */
|
||||
dev_fd = sangoma_open_api_span_chan(span, chan);
|
||||
if( dev_fd == INVALID_HANDLE_VALUE){
|
||||
printf("Warning: Failed to open span %d, chan %d\n", span , chan);
|
||||
return 1;
|
||||
}else{
|
||||
printf("Successfuly opened span %d, chan %d\n", span , chan);
|
||||
}
|
||||
|
||||
memset(&tdm_api, 0x00, sizeof(tdm_api));
|
||||
|
||||
status = sangoma_wait_obj_create(&sangoma_wait_objects[open_dev_cnt], dev_fd, SANGOMA_DEVICE_WAIT_OBJ);
|
||||
if(status != SANG_STATUS_SUCCESS){
|
||||
printf("Error: Failed to create 'sangoma_wait_object'!\n");
|
||||
return 1;
|
||||
}
|
||||
sangoma_channels[open_dev_cnt].channo = chan;
|
||||
sangoma_channels[open_dev_cnt].spanno = span;
|
||||
sangoma_wait_obj_set_context(sangoma_wait_objects[open_dev_cnt], &sangoma_channels[open_dev_cnt]);
|
||||
/* open_dev_cnt++; */
|
||||
|
||||
if((err = sangoma_get_full_cfg(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(set_codec_slinear){
|
||||
printf("Setting SLINEAR codec\n");
|
||||
if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_SLINEAR))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(set_codec_none){
|
||||
printf("Disabling codec\n");
|
||||
if((err=sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_NONE))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(usr_period){
|
||||
printf("Setting user period: %d\n", usr_period);
|
||||
if((err=sangoma_tdm_set_usr_period(dev_fd, &tdm_api, usr_period))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(set_codec_slinear || usr_period || set_codec_none){
|
||||
/* display new configuration AFTER it was changed */
|
||||
if((err=sangoma_get_full_cfg(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(dtmf_enable_octasic == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
/* enable dtmf detection on Octasic chip */
|
||||
if((err=sangoma_tdm_enable_dtmf_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(dtmf_enable_remora == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
/* enable dtmf detection on Sangoma's Remora SLIC chip (A200 ONLY) */
|
||||
if((err=sangoma_tdm_enable_rm_dtmf_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(remora_hook == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
if((err=sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(rbs_events == 1){
|
||||
poll_events_bitmap |= POLLPRI;
|
||||
if((err=sangoma_tdm_enable_rbs_events(dev_fd, &tdm_api, 20))){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Device Config RxQ=%i TxQ=%i \n",
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api),
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api));
|
||||
|
||||
sangoma_set_rx_queue_sz(dev_fd,&tdm_api,20);
|
||||
sangoma_set_tx_queue_sz(dev_fd,&tdm_api,30);
|
||||
|
||||
printf("Device Config RxQ=%i TxQ=%i \n",
|
||||
sangoma_get_rx_queue_sz(dev_fd,&tdm_api),
|
||||
sangoma_get_tx_queue_sz(dev_fd,&tdm_api));
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn int __cdecl main(int argc, char* argv[])
|
||||
\brief Main function that starts the sample code
|
||||
\param argc number of arguments
|
||||
\param argv argument list
|
||||
*/
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
{
|
||||
int proceed, i;
|
||||
|
||||
proceed=init_args(argc,argv);
|
||||
if (proceed != WAN_TRUE){
|
||||
usage(argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* register Ctrl+C handler - we want a clean termination */
|
||||
#if defined(__WINDOWS__)
|
||||
if (!SetConsoleCtrlHandler(TerminateHandler, TRUE)) {
|
||||
printf("ERROR : Unable to register terminate handler ( %d ).\nProcess terminated.\n",
|
||||
GetLastError());
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
signal(SIGHUP,TerminateHandler);
|
||||
signal(SIGTERM,TerminateHandler);
|
||||
#endif
|
||||
|
||||
for(i = 0; i < TEST_NUMBER_OF_OBJECTS; i++){
|
||||
sangoma_wait_objects[i] = NULL;
|
||||
}
|
||||
|
||||
poll_events_bitmap = 0;
|
||||
if(read_enable == 1){
|
||||
poll_events_bitmap |= POLLIN;
|
||||
}
|
||||
|
||||
if(write_enable == 1 && rx2tx == 1){
|
||||
/* These two options are mutually exclusive because 'rx2tx' option
|
||||
* indicates "use Reciever as the timing source for Transmitter". */
|
||||
write_enable = 0;
|
||||
}
|
||||
|
||||
if(write_enable == 1){
|
||||
poll_events_bitmap |= POLLOUT;
|
||||
}
|
||||
|
||||
/* Front End connect/disconnect, and other events, such as DTMF... */
|
||||
poll_events_bitmap |= (POLLHUP | POLLPRI);
|
||||
#if defined(__WINDOWS__)
|
||||
printf("Enabling Poll Events:\n");
|
||||
#ifdef WIN32
|
||||
print_poll_event_bitmap(poll_events_bitmap);
|
||||
<<<<<<< .mine
|
||||
#endif
|
||||
|
||||
=======
|
||||
#endif
|
||||
>>>>>>> .r194
|
||||
printf("Connecting to Port/Span: %d, Interface/Chan: %d\n",
|
||||
wanpipe_port_no, wanpipe_if_no);
|
||||
|
||||
|
||||
if(open_sangoma_device()){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("********************************\n");
|
||||
printf("files_used: 0x%x\n", files_used);
|
||||
printf("********************************\n");
|
||||
if(files_used & RX_FILE_USED){
|
||||
pRxFile = fopen( (const char*)&rx_file[0], "wb" );
|
||||
if(pRxFile == NULL){
|
||||
printf("Can't open Rx file: [%s]!!\n", rx_file);
|
||||
}else{
|
||||
printf("Open Rx file: %s. OK.\n", rx_file);
|
||||
}
|
||||
}
|
||||
|
||||
handle_span_chan(1 /* handle a single device */);
|
||||
|
||||
/* returned from main loop, do the cleanup before exiting: */
|
||||
cleanup();
|
||||
|
||||
printf("\nSample application exiting.(press any key)\n");
|
||||
_getch();
|
||||
return 0;
|
||||
}
|
|
@ -1,101 +1,101 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/libsangoma/!svn/ver/294/trunk/sample_cpp
|
||||
V 77
|
||||
/svn/libsangoma/!svn/ver/333/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp
|
||||
END
|
||||
sangoma_port.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 60
|
||||
/svn/libsangoma/!svn/ver/278/trunk/sample_cpp/sangoma_port.h
|
||||
V 92
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_port.h
|
||||
END
|
||||
sample.vcproj
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 59
|
||||
/svn/libsangoma/!svn/ver/248/trunk/sample_cpp/sample.vcproj
|
||||
V 91
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sample.vcproj
|
||||
END
|
||||
sources
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/291/trunk/sample_cpp/sources
|
||||
V 85
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sources
|
||||
END
|
||||
sangoma_interface.cpp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 67
|
||||
/svn/libsangoma/!svn/ver/294/trunk/sample_cpp/sangoma_interface.cpp
|
||||
V 99
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_interface.cpp
|
||||
END
|
||||
sample_linux_compat.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 67
|
||||
/svn/libsangoma/!svn/ver/109/trunk/sample_cpp/sample_linux_compat.h
|
||||
V 99
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sample_linux_compat.h
|
||||
END
|
||||
sangoma_interface.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 65
|
||||
/svn/libsangoma/!svn/ver/278/trunk/sample_cpp/sangoma_interface.h
|
||||
V 97
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_interface.h
|
||||
END
|
||||
sangoma_port_configurator.cpp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 75
|
||||
/svn/libsangoma/!svn/ver/279/trunk/sample_cpp/sangoma_port_configurator.cpp
|
||||
V 107
|
||||
/svn/libsangoma/!svn/ver/333/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_port_configurator.cpp
|
||||
END
|
||||
compile.bat
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 57
|
||||
/svn/libsangoma/!svn/ver/120/trunk/sample_cpp/compile.bat
|
||||
V 89
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/compile.bat
|
||||
END
|
||||
sangoma_cthread.cpp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 65
|
||||
/svn/libsangoma/!svn/ver/133/trunk/sample_cpp/sangoma_cthread.cpp
|
||||
V 97
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_cthread.cpp
|
||||
END
|
||||
sangoma_port_configurator.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 73
|
||||
/svn/libsangoma/!svn/ver/275/trunk/sample_cpp/sangoma_port_configurator.h
|
||||
V 105
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_port_configurator.h
|
||||
END
|
||||
sample.cpp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 56
|
||||
/svn/libsangoma/!svn/ver/288/trunk/sample_cpp/sample.cpp
|
||||
V 88
|
||||
/svn/libsangoma/!svn/ver/332/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sample.cpp
|
||||
END
|
||||
sangoma_cthread.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 63
|
||||
/svn/libsangoma/!svn/ver/133/trunk/sample_cpp/sangoma_cthread.h
|
||||
V 95
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_cthread.h
|
||||
END
|
||||
sample.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 54
|
||||
/svn/libsangoma/!svn/ver/288/trunk/sample_cpp/sample.h
|
||||
V 86
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sample.h
|
||||
END
|
||||
sangoma_port.cpp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 62
|
||||
/svn/libsangoma/!svn/ver/286/trunk/sample_cpp/sangoma_port.cpp
|
||||
V 94
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sangoma_port.cpp
|
||||
END
|
||||
Makefile.Linux
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 60
|
||||
/svn/libsangoma/!svn/ver/105/trunk/sample_cpp/Makefile.Linux
|
||||
V 92
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/Makefile.Linux
|
||||
END
|
||||
sample.sln
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 56
|
||||
/svn/libsangoma/!svn/ver/235/trunk/sample_cpp/sample.sln
|
||||
V 88
|
||||
/svn/libsangoma/!svn/ver/331/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp/sample.sln
|
||||
END
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
8
|
||||
|
||||
dir
|
||||
322
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk/sample_cpp
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
342
|
||||
http://192.168.1.168/svn/libsangoma/branches/unified_rlease_Win6.0_Lnx3.5/sample_cpp
|
||||
http://192.168.1.168/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
2010-07-07T16:06:03.386686Z
|
||||
294
|
||||
2011-01-19T21:27:38.629735Z
|
||||
333
|
||||
davidr
|
||||
has-props
|
||||
|
||||
|
@ -32,44 +32,44 @@ file
|
|||
|
||||
|
||||
|
||||
2010-05-18T21:27:49.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
f3310f38d215e71ef19ee59d33c0c458
|
||||
2010-05-14T20:03:16.936101Z
|
||||
278
|
||||
davidr
|
||||
|
||||
sources
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2011-01-28T17:40:50.000000Z
|
||||
1b8b6c522d904f33d986cb1c667d37e6
|
||||
2010-06-16T16:45:22.358768Z
|
||||
291
|
||||
davidr
|
||||
|
||||
sample.vcproj
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-02-10T23:05:43.000000Z
|
||||
3c2655474848e163999341285dc2412e
|
||||
2010-01-22T21:30:47.609627Z
|
||||
248
|
||||
2011-01-28T17:40:50.000000Z
|
||||
c98a585e5023eb0b363e445b0931bd1a
|
||||
2010-11-23T23:17:58.432692Z
|
||||
324
|
||||
davidr
|
||||
has-props
|
||||
|
||||
sources
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-06-17T04:11:26.000000Z
|
||||
1b8b6c522d904f33d986cb1c667d37e6
|
||||
2010-06-16T16:45:22.358768Z
|
||||
291
|
||||
davidr
|
||||
|
||||
sangoma_interface.cpp
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-08-12T23:16:44.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
4a1150aa704318ece5224e3411b6847a
|
||||
2010-07-07T16:06:03.386686Z
|
||||
294
|
||||
|
@ -81,7 +81,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
46ae76a473c75513d3b253bd96524f17
|
||||
2009-03-04T17:25:18.587182Z
|
||||
109
|
||||
|
@ -93,7 +93,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-05-18T21:27:49.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
6bd775531d9264b8c89af6956f133ca9
|
||||
2010-05-14T20:03:16.936101Z
|
||||
278
|
||||
|
@ -105,10 +105,10 @@ file
|
|||
|
||||
|
||||
|
||||
2010-06-04T16:18:07.000000Z
|
||||
7b4b0e298f916258cbd2ef3e6c5b2e74
|
||||
2010-05-28T23:22:41.955986Z
|
||||
279
|
||||
2011-01-28T17:40:50.000000Z
|
||||
37b915820d8b328ce51cb310fba82438
|
||||
2011-01-19T21:27:38.629735Z
|
||||
333
|
||||
davidr
|
||||
|
||||
compile.bat
|
||||
|
@ -117,7 +117,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
6e4285eeda3d888a8e689516b028327a
|
||||
2009-03-06T22:48:37.915855Z
|
||||
120
|
||||
|
@ -129,7 +129,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
f6d802e64eba57d4a2eed52a86ed6749
|
||||
2009-03-31T20:38:44.891800Z
|
||||
133
|
||||
|
@ -141,11 +141,11 @@ file
|
|||
|
||||
|
||||
|
||||
2010-05-18T21:27:49.000000Z
|
||||
468db72af14d384b25eb30ec91ca2841
|
||||
2010-05-03T20:57:12.906314Z
|
||||
275
|
||||
jpatel
|
||||
2011-01-28T17:40:50.000000Z
|
||||
def89abe5019414c1e5afebec7a3a000
|
||||
2010-12-17T23:39:12.255685Z
|
||||
327
|
||||
davidr
|
||||
|
||||
sample.cpp
|
||||
file
|
||||
|
@ -153,10 +153,10 @@ file
|
|||
|
||||
|
||||
|
||||
2010-06-15T17:24:48.000000Z
|
||||
b7c6eb4619987ebdd5f00ef8fb3f1a53
|
||||
2010-06-14T19:08:36.321535Z
|
||||
288
|
||||
2011-01-28T17:40:50.000000Z
|
||||
3d714ef42f58bdbde2a553585b91dde7
|
||||
2011-01-14T00:17:27.006384Z
|
||||
332
|
||||
davidr
|
||||
|
||||
sangoma_cthread.h
|
||||
|
@ -165,7 +165,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-08-25T20:44:41.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
0f69bcec99210ad26c7391e53a88255e
|
||||
2009-03-31T20:38:44.891800Z
|
||||
133
|
||||
|
@ -177,10 +177,10 @@ file
|
|||
|
||||
|
||||
|
||||
2010-06-15T17:24:48.000000Z
|
||||
10d072dd323da3f8db2b123f08751ce2
|
||||
2010-06-14T19:08:36.321535Z
|
||||
288
|
||||
2011-01-28T17:40:50.000000Z
|
||||
2b33d6358d66892fbf792b2618591317
|
||||
2010-12-17T23:39:12.255685Z
|
||||
327
|
||||
davidr
|
||||
|
||||
sangoma_port.cpp
|
||||
|
@ -189,7 +189,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-06-14T16:38:14.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
9d6b5a506886857fc50242ed6514f07d
|
||||
2010-06-10T21:10:51.668331Z
|
||||
286
|
||||
|
@ -201,7 +201,7 @@ file
|
|||
|
||||
|
||||
|
||||
2010-09-13T22:45:16.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
93f1e9c6d533615e6b2dfc7aba2fd0a2
|
||||
2009-02-27T23:27:29.300080Z
|
||||
105
|
||||
|
@ -213,7 +213,7 @@ file
|
|||
|
||||
|
||||
|
||||
2009-12-04T21:21:35.000000Z
|
||||
2011-01-28T17:40:50.000000Z
|
||||
2f4e833b9fd409d8f1c07dded92a32de
|
||||
2009-12-01T20:38:57.462038Z
|
||||
235
|
||||
|
|
|
@ -314,12 +314,9 @@ static void got_tdm_api_event(void *sang_if_ptr, void *event_data)
|
|||
break;
|
||||
|
||||
case WP_API_EVENT_RBS:
|
||||
DBG_MAIN("RBS Event: New bits: 0x%X!\n", wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
DBG_MAIN( "RX RBS: A:%1d B:%1d C:%1d D:%1d\n",
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_A) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_B) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_C) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_D) ? 1 : 0);
|
||||
DBG_MAIN("RBS Event: New bits: 0x%X!\n", wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
DBG_MAIN("RX RBS/CAS: ");
|
||||
wp_print_rbs_cas_bits(wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_LINK_STATUS:
|
||||
|
@ -922,10 +919,21 @@ int __cdecl main(int argc, char* argv[])
|
|||
|
||||
INFO_MAIN("Type Channel number and press <Enter>:\n");
|
||||
rbs_management_struct.channel = get_user_decimal_number();//channels (Time Slots). Valid values: 1 to 24.
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid RBS Channel number!\n");
|
||||
break;
|
||||
|
||||
if(WAN_MEDIA_T1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid T1 RBS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(WAN_MEDIA_E1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 31){
|
||||
INFO_MAIN("Invalid E1 CAS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sang_if->get_rbs(&rbs_management_struct);
|
||||
}
|
||||
break;
|
||||
|
@ -941,15 +949,27 @@ int __cdecl main(int argc, char* argv[])
|
|||
case WAN_MEDIA_E1:
|
||||
{
|
||||
static rbs_management_t rbs_management_struct = {0,0};
|
||||
int chan_no;
|
||||
|
||||
sang_if->enable_rbs_monitoring();
|
||||
|
||||
INFO_MAIN("Type Channel number and press <Enter>:\n");
|
||||
rbs_management_struct.channel = get_user_decimal_number();//channels (Time Slots). Valid values: 1 to 24.
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid RBS Channel number!\n");
|
||||
break;
|
||||
rbs_management_struct.channel = chan_no = get_user_decimal_number();//channels (Time Slots). Valid values: T1: 1 to 24; E1: 1-15 and 17-31.
|
||||
|
||||
if(WAN_MEDIA_T1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid T1 RBS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(WAN_MEDIA_E1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 31){
|
||||
INFO_MAIN("Invalid E1 CAS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* bitmap - set as needed: WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D;
|
||||
|
||||
In this example make bits A and B to change each time,
|
||||
|
@ -961,6 +981,51 @@ int __cdecl main(int argc, char* argv[])
|
|||
rbs_management_struct.ABCD_bits = WAN_RBS_SIG_A;
|
||||
}
|
||||
sang_if->set_rbs(&rbs_management_struct);
|
||||
|
||||
#if 0
|
||||
#define RBS_CAS_TX_AND_WAIT(chan, abcd) \
|
||||
{ \
|
||||
rbs_management_struct.channel = chan; \
|
||||
rbs_management_struct.ABCD_bits = abcd; \
|
||||
INFO_MAIN("Press any key to transmit bits:"); \
|
||||
wp_print_rbs_cas_bits(abcd); \
|
||||
_getch(); \
|
||||
sang_if->set_rbs(&rbs_management_struct); \
|
||||
}
|
||||
|
||||
//for ESF lines test all all combinations of 4 bits
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, 0x00);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B | WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
#endif
|
||||
}
|
||||
default:
|
||||
INFO_MAIN("Command invalid for card type\n");
|
||||
|
@ -1141,7 +1206,7 @@ user_retry_ring_e_d:
|
|||
default:
|
||||
sang_if->fxo_go_on_hook();
|
||||
}
|
||||
}else if(sang_if->get_sub_media()==MOD_TYPE_FXS ) {
|
||||
}else if(sang_if->get_sub_media() == MOD_TYPE_FXS) {
|
||||
INFO_MAIN("Press 'f' for forward, 'r' to for reverse.\n");
|
||||
INFO_MAIN("\n");
|
||||
switch(tolower(_getch()))
|
||||
|
@ -1153,10 +1218,42 @@ user_retry_ring_e_d:
|
|||
sang_if->tdm_set_rm_polarity(1);
|
||||
break;
|
||||
default:
|
||||
//toggle it
|
||||
sang_if->tdm_set_rm_polarity(1);
|
||||
sang_if->tdm_set_rm_polarity(0);
|
||||
}
|
||||
//toggle polarity
|
||||
int polarity_wait, two_second_ring_repetion_counter;
|
||||
|
||||
INFO_MAIN("Type Polarity Reverse/Forward delay and press <Enter>:\n");
|
||||
polarity_wait = get_user_decimal_number();
|
||||
/* polarity_wait of 30 ms will ring Analog phone or FXO
|
||||
* polarity_wait of 400 ms will cause Polarity reversal event on FXO */
|
||||
INFO_MAIN("User specified Polarity Reverse/Forward delay: %d. Press <Enter> to continue.\n", polarity_wait);
|
||||
_getch();
|
||||
|
||||
two_second_ring_repetion_counter = 2000 / (polarity_wait * 2);
|
||||
INFO_MAIN("two_second_ring_repetion_counter: %d. Press <Enter> to continue.\n", two_second_ring_repetion_counter);
|
||||
_getch();
|
||||
|
||||
for (int ii = 0; ii < two_second_ring_repetion_counter; ii++) {
|
||||
INFO_MAIN("Reversing polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(1);
|
||||
sangoma_msleep(polarity_wait);
|
||||
INFO_MAIN("Forwarding polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(0);
|
||||
sangoma_msleep(polarity_wait);
|
||||
}
|
||||
|
||||
//sleep 4 seconds between the rings
|
||||
INFO_MAIN("4 seconds between the rings...\n");
|
||||
sangoma_msleep(4000);
|
||||
|
||||
for (int ii = 0; ii < two_second_ring_repetion_counter; ii++) {
|
||||
INFO_MAIN("Reversing polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(1);
|
||||
sangoma_msleep(polarity_wait);
|
||||
INFO_MAIN("Forwarding polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(0);
|
||||
sangoma_msleep(polarity_wait);
|
||||
}//for()
|
||||
}//switch()
|
||||
}
|
||||
break;
|
||||
case 'k':
|
||||
|
@ -1174,9 +1271,11 @@ user_retry_ring_e_d:
|
|||
}
|
||||
}else if(sang_if->get_adapter_type()== WAN_MEDIA_FXOFXS) {
|
||||
if(sang_if->get_sub_media()==MOD_TYPE_FXS) {
|
||||
printf("calling tdm_txsig_kewl()...\n");
|
||||
sang_if->tdm_txsig_kewl();
|
||||
sangoma_msleep(5000);
|
||||
//to restore line current after txsig kewl
|
||||
printf("restoring line current after txsig kewl...\n");
|
||||
sang_if->tdm_txsig_offhook();
|
||||
}
|
||||
}
|
||||
|
@ -1289,7 +1388,11 @@ user_retry_ring_e_d:
|
|||
static int set_port_configuration()
|
||||
{
|
||||
int rc = 0, user_selection;
|
||||
int is_te1_card = 0, is_analog_card = 0;
|
||||
/* On hybrid cards such as B700, ports can be of different types -
|
||||
* some are Analog some Digital.
|
||||
* On non-hybrid cards such as A108, all ports are of the same
|
||||
* type - T1/E1. */
|
||||
int is_te1_port = 0, is_analog_port = 0, is_bri_port = 0, is_serial_port = 0;
|
||||
hardware_info_t hardware_info;
|
||||
port_cfg_t port_cfg;
|
||||
|
||||
|
@ -1305,7 +1408,7 @@ static int set_port_configuration()
|
|||
|
||||
if(rc == SANG_STATUS_SUCCESS){
|
||||
|
||||
INFO_MAIN("card_model : %s (0x%08X)\n",
|
||||
INFO_MAIN("card_model : %s (%d)\n",
|
||||
SDLA_ADPTR_NAME(hardware_info.card_model), hardware_info.card_model);
|
||||
INFO_MAIN("firmware_version\t: 0x%02X\n", hardware_info.firmware_version);
|
||||
INFO_MAIN("pci_bus_number\t\t: %d\n", hardware_info.pci_bus_number);
|
||||
|
@ -1319,6 +1422,7 @@ static int set_port_configuration()
|
|||
return 3;
|
||||
}
|
||||
|
||||
// very important to zero out the configuration structure
|
||||
memset(&port_cfg, 0x00, sizeof(port_cfg_t));
|
||||
|
||||
switch(hardware_info.card_model)
|
||||
|
@ -1327,18 +1431,45 @@ static int set_port_configuration()
|
|||
case A101_ADPTR_2TE1:
|
||||
case A104_ADPTR_4TE1:
|
||||
case A108_ADPTR_8TE1:
|
||||
is_te1_card = 1;
|
||||
is_te1_port = 1;
|
||||
INFO_MAIN("T1/E1 Port on non-Hybrid Card (A10[1/2/4/8]).\n");
|
||||
break;
|
||||
case A200_ADPTR_ANALOG:
|
||||
case A400_ADPTR_ANALOG:
|
||||
is_analog_card = 1;
|
||||
case AFT_ADPTR_A600: //B600
|
||||
is_analog_port = 1;
|
||||
INFO_MAIN("Analog Port on non-Hybrid Card (A200/A400).\n");
|
||||
break;
|
||||
case AFT_ADPTR_ISDN:
|
||||
is_bri_port = 1;
|
||||
INFO_MAIN("BRI Port on non-Hybrid Card (A500).\n");
|
||||
break;
|
||||
case AFT_ADPTR_FLEXBRI:
|
||||
//B700, a hybrid card - may have both ISDN BRI and Analog ports
|
||||
if (hardware_info.bri_modtype == MOD_TYPE_NT ||
|
||||
hardware_info.bri_modtype == MOD_TYPE_TE) {
|
||||
is_bri_port = 1;
|
||||
INFO_MAIN("BRI Port on Hybrid Card.\n");
|
||||
} else {
|
||||
is_analog_port = 1;
|
||||
INFO_MAIN("Analog Port on Hybrid Card.\n");
|
||||
}
|
||||
break;
|
||||
case AFT_ADPTR_2SERIAL_V35X21: /* AFT-A142 2 Port V.35/X.21 board */
|
||||
case AFT_ADPTR_4SERIAL_V35X21: /* AFT-A144 4 Port V.35/X.21 board */
|
||||
case AFT_ADPTR_2SERIAL_RS232: /* AFT-A142 2 Port RS232 board */
|
||||
case AFT_ADPTR_4SERIAL_RS232: /* AFT-A144 4 Port RS232 board */
|
||||
is_serial_port = 1;
|
||||
INFO_MAIN("Serial Port on non-Hybrid Card (A14[2/4]).\n");
|
||||
break;
|
||||
default:
|
||||
INFO_MAIN("Warning: configuration of card model 0x%08X can not be changed!\n",
|
||||
hardware_info.card_model);
|
||||
break;
|
||||
}
|
||||
|
||||
if(is_te1_card){
|
||||
|
||||
if (is_te1_port) {
|
||||
INFO_MAIN("\n");
|
||||
INFO_MAIN("Press 't' to set T1 configration.\n");
|
||||
INFO_MAIN("Press 'e' to set E1 configration.\n");
|
||||
|
@ -1361,17 +1492,20 @@ try_again:
|
|||
default:
|
||||
INFO_MAIN("Invalid command %c.\n",user_selection);
|
||||
goto try_again;
|
||||
break;
|
||||
}//switch(user_selection)
|
||||
}//if(is_te1_card)
|
||||
|
||||
if(is_analog_card){
|
||||
}//switch(user_selection)
|
||||
}//if(is_te1_port)
|
||||
|
||||
if (is_analog_port) {
|
||||
//read current configuration:
|
||||
if(sng_port_cfg_obj->get_configration(&port_cfg)){
|
||||
rc = 1;
|
||||
}else{
|
||||
//print the current configuration:
|
||||
sng_port_cfg_obj->print_port_cfg_structure(&port_cfg);
|
||||
#if 0
|
||||
sng_port_cfg_obj->initialize_interface_mtu_mru(&port_cfg, 16, 16);
|
||||
#endif
|
||||
#if 0
|
||||
//as an EXAMPLE, enable Loop Current Monitoring for Analog FXO:
|
||||
rc=sng_port_cfg_obj->control_analog_rm_lcm(&port_cfg, 1);
|
||||
|
@ -1381,9 +1515,17 @@ try_again:
|
|||
rc=sng_port_cfg_obj->set_analog_opermode(&port_cfg, "TBR21");
|
||||
#endif
|
||||
}
|
||||
}//if(is_analog_card)
|
||||
|
||||
if(!is_te1_card && !is_analog_card){
|
||||
}//if(is_analog_port)
|
||||
|
||||
if (is_bri_port) {
|
||||
rc=sng_port_cfg_obj->initialize_bri_tdm_span_voice_api_configration_structure(&port_cfg,&hardware_info,program_settings.wanpipe_number);
|
||||
}
|
||||
|
||||
if (is_serial_port) {
|
||||
rc=sng_port_cfg_obj->initialize_serial_api_configration_structure(&port_cfg,&hardware_info,program_settings.wanpipe_number);
|
||||
}
|
||||
|
||||
if(!is_te1_port && !is_analog_port && !is_bri_port && !is_serial_port){
|
||||
INFO_MAIN("Unsupported Card %d\n", hardware_info.card_model);
|
||||
rc = 1;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,15 @@ typedef struct{
|
|||
|
||||
}callback_functions_t;
|
||||
|
||||
static void wp_print_rbs_cas_bits(unsigned int abcd)
|
||||
{
|
||||
printf("A:%1d B:%1d C:%1d D:%1d\n",
|
||||
(abcd & WAN_RBS_SIG_A) ? 1 : 0,
|
||||
(abcd & WAN_RBS_SIG_B) ? 1 : 0,
|
||||
(abcd & WAN_RBS_SIG_C) ? 1 : 0,
|
||||
(abcd & WAN_RBS_SIG_D) ? 1 : 0);
|
||||
}
|
||||
|
||||
#if defined (__WINDOWS__)
|
||||
static void DecodeLastError(LPSTR lpszFunction)
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SANG_WP_DEVEL)\libsangoma";"$(SANG_WP_DEVEL)\wanpipe_common\include";"$(SANG_WP_DEVEL)\wanpipe_common\include\aft_core";"$(SANG_WP_DEVEL)\wanpipe_windows\include";"$(SANG_WP_DEVEL)\stelephony";"$(SANG_WP_DEVEL)\wanpipe_windows\HighResolutionTimer\include""
|
||||
AdditionalIncludeDirectories=""$(SANG_WP_DEVEL)\libsangoma";"$(SANG_WP_DEVEL)\wanpipe_common\include";"$(SANG_WP_DEVEL)\wanpipe_common\include\aft_core";"$(SANG_WP_DEVEL)\wanpipe_windows\include";"$(SANG_WP_DEVEL)\stelephony";"$(SANG_WP_DEVEL)\wanpipe_windows\HighResolutionTimer\include";"$(SANG_WP_DEVEL)\wanpipe_common\wantools\wanec_apilib""
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;__WINDOWS__;_WIN32_WINNT=0x0500;NOMINMAX;USE_SANGOMA_ERRNO"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define INFO_CFG if(1)printf("PORTCFG:");if(1)printf
|
||||
#define _INFO_CFG if(1)printf
|
||||
|
||||
#define ERR_CFG if(1)printf("PORTCFG:");if(1)printf
|
||||
#define ERR_CFG if(1)printf("%s():line:%d Error: ", __FUNCTION__, __LINE__);if(1)printf
|
||||
#define _ERR_CFG if(1)printf
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -350,9 +350,11 @@ int sangoma_port_configurator::set_volatile_configration(port_cfg_t *port_cfg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* optional optimization - single interrupt for both Rx and Tx audio streams */
|
||||
#define SPAN_TX_ONLY_IRQ 0
|
||||
|
||||
/*!
|
||||
\brief Brief port description
|
||||
\brief Example initialization for T1
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -363,6 +365,7 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
//sdla_te_cfg_t *te_cfg = &sdla_fe_cfg->cfg.te_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
wan_xilinx_conf_t *aft_cfg = &wandev_conf->u.aft;
|
||||
|
||||
// T1 parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_T1;
|
||||
|
@ -385,6 +388,7 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
FE_CLK(sdla_fe_cfg) = WAN_MASTER_CLK;
|
||||
#endif
|
||||
|
||||
// API parameters
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_TE1;
|
||||
|
@ -395,6 +399,12 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
#if SPAN_TX_ONLY_IRQ
|
||||
aft_cfg->span_tx_only_irq = 1;
|
||||
#else
|
||||
aft_cfg->span_tx_only_irq = 0;
|
||||
#endif
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
wanif_cfg->active_ch = 0x00FFFFFF;//channels 1-24 (starting from bit zero)
|
||||
sprintf(wanif_cfg->usedby,"TDM_SPAN_VOICE_API");
|
||||
|
@ -429,15 +439,16 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define BUILD_FOR_PRI 1
|
||||
int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
wan_xilinx_conf_t *aft_cfg = &wandev_conf->u.aft;
|
||||
|
||||
// Load media parameters in the registry
|
||||
// E1 parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_E1;
|
||||
FE_LCODE(sdla_fe_cfg) = WAN_LCODE_HDB3;
|
||||
FE_FRAME(sdla_fe_cfg) = WAN_FR_CRC4;
|
||||
|
@ -458,6 +469,7 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
FE_CLK(sdla_fe_cfg) = WAN_MASTER_CLK;
|
||||
#endif
|
||||
|
||||
// API parameters
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_TE1;
|
||||
|
@ -468,8 +480,21 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
#if SPAN_TX_ONLY_IRQ
|
||||
aft_cfg->span_tx_only_irq = 1;
|
||||
#else
|
||||
aft_cfg->span_tx_only_irq = 0;
|
||||
#endif
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
#if BUILD_FOR_PRI
|
||||
//PRI Signaling on chan 16
|
||||
wanif_cfg->active_ch = 0x7FFFFFFF;// channels 1-31 (starting from bit zero)
|
||||
#else
|
||||
//CAS
|
||||
wanif_cfg->active_ch = 0xFFFF7FFF;// channels 1-15.17-31 -> Active Ch Map :0xFFFEFFFE (in message log)
|
||||
#endif
|
||||
|
||||
sprintf(wanif_cfg->usedby,"TDM_SPAN_VOICE_API");
|
||||
wanif_cfg->u.aft.idle_flag=0xFF;
|
||||
wanif_cfg->mtu = 160;
|
||||
|
@ -486,6 +511,7 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
|
||||
tdmv_cfg->span_no = (unsigned char)span;
|
||||
|
||||
#if BUILD_FOR_PRI
|
||||
/* DCHAN Configuration */
|
||||
switch(FE_MEDIA(sdla_fe_cfg))
|
||||
{
|
||||
|
@ -496,11 +522,141 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
printf("%s(): Error: invalid media type!\n", __FUNCTION__);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("E1: tdmv_cfg->dchan bitmap: 0x%X\n", tdmv_cfg->dchan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangoma_port_configurator::initialize_bri_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
|
||||
// BRI parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_BRI;
|
||||
FE_LINENO(sdla_fe_cfg) = hardware_info->port_number;
|
||||
FE_TDMV_LAW(sdla_fe_cfg) = WAN_TDMV_ALAW;
|
||||
FE_NETWORK_SYNC(sdla_fe_cfg) = 0;
|
||||
|
||||
FE_REFCLK(sdla_fe_cfg) = 0;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* TE Module: WAN_NORMAL_CLK is the default.
|
||||
* Clock recovered from the line will be used by this module and
|
||||
* will be routed to ALL other BRI modules on the card which
|
||||
* become "connected" after this module. That means at any
|
||||
* time there is a single BRI line where the clock is recovered from
|
||||
* and this clock is used for all other BRI lines.
|
||||
*
|
||||
* NT Module: always runs on internal oscillator clock.
|
||||
*/
|
||||
BRI_FE_CLK((*sdla_fe_cfg)) = WAN_NORMAL_CLK;
|
||||
#else
|
||||
/*
|
||||
* TE Module: if WAN_MASTER_CLK, clock recovered from
|
||||
* the line will be NOT be used by this module and
|
||||
* will NOT be routed to ALL other BRI modules on the card.
|
||||
* Instead, the module will use clock from internal oscillator.
|
||||
*
|
||||
* NT Module: WAN_MASTER_CLK will be ignored because NT should not
|
||||
* recover clock from the line, it always runs on clock from
|
||||
* internal oscillator.
|
||||
*/
|
||||
BRI_FE_CLK((*sdla_fe_cfg)) = WAN_MASTER_CLK;
|
||||
#endif
|
||||
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_ISDN_BRI;
|
||||
wandev_conf->magic = ROUTER_MAGIC;
|
||||
|
||||
wandev_conf->mtu = 2048;
|
||||
wandev_conf->PCI_slot_no = hardware_info->pci_slot_number;
|
||||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
wanif_cfg->active_ch = 0xFFFFFFFF;
|
||||
sprintf(wanif_cfg->usedby,"TDM_SPAN_VOICE_API");
|
||||
wanif_cfg->u.aft.idle_flag=0xFF;
|
||||
wanif_cfg->mtu = 160;
|
||||
wanif_cfg->u.aft.mtu = 160;
|
||||
wanif_cfg->u.aft.mru = 160;
|
||||
sprintf(wanif_cfg->name,"w%dg1",span);
|
||||
|
||||
if (hardware_info->max_hw_ec_chans) {
|
||||
/* wan_hwec_conf_t - HWEC configuration for Port */
|
||||
/*wandev_conf->hwec_conf.dtmf = 1;*/
|
||||
/* wan_hwec_if_conf_t - HWEC configuration for Interface */
|
||||
wanif_cfg->hwec.enable = 1;
|
||||
}
|
||||
|
||||
tdmv_cfg->span_no = (unsigned char)span;
|
||||
|
||||
/* There is no DCHAN Configuration on BRI because it is
|
||||
* configured automatically by the driver. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangoma_port_configurator::initialize_serial_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
|
||||
// Serial parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_SERIAL;
|
||||
FE_LINENO(sdla_fe_cfg) = hardware_info->port_number;
|
||||
|
||||
wandev_conf->line_coding = WANOPT_NRZ;
|
||||
/* WANOPT_V35/WANOPT_X21 are valid for card models:
|
||||
* AFT_ADPTR_2SERIAL_V35X21 and AFT_ADPTR_4SERIAL_V35X21.
|
||||
* WANOPT_RS232 valid for card models:
|
||||
* AFT_ADPTR_2SERIAL_RS232 and AFT_ADPTR_4SERIAL_RS232.
|
||||
*/
|
||||
wandev_conf->electrical_interface = WANOPT_V35;
|
||||
#if 1
|
||||
wandev_conf->clocking = WANOPT_EXTERNAL;
|
||||
wandev_conf->bps = 0;
|
||||
#else
|
||||
wandev_conf->clocking = WANOPT_INTERNAL;
|
||||
wandev_conf->bps = 56000;
|
||||
#endif
|
||||
|
||||
wandev_conf->connection = WANOPT_PERMANENT;//or WANOPT_SWITCHED
|
||||
wandev_conf->line_idle = WANOPT_IDLE_FLAG;
|
||||
|
||||
// API parameters
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_SERIAL;
|
||||
wandev_conf->magic = ROUTER_MAGIC;
|
||||
|
||||
wandev_conf->mtu = 2048;
|
||||
wandev_conf->PCI_slot_no = hardware_info->pci_slot_number;
|
||||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
wanif_cfg->active_ch = 0xFFFFFFFF;
|
||||
sprintf(wanif_cfg->usedby,"API");
|
||||
wanif_cfg->u.aft.idle_flag=0xFF;
|
||||
wanif_cfg->mtu = 1600;
|
||||
wanif_cfg->u.aft.mtu = 1600;
|
||||
wanif_cfg->u.aft.mru = 1600;
|
||||
sprintf(wanif_cfg->name,"w%dg1",span);
|
||||
|
||||
wanif_cfg->hdlc_streaming = WANOPT_YES;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangoma_port_configurator::write_configration_on_persistent_storage(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
//all the work is done by libsangoma
|
||||
|
@ -511,17 +667,20 @@ int sangoma_port_configurator::control_analog_rm_lcm(port_cfg_t *port_cfg, int c
|
|||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
if(wandev_conf->card_type == WANOPT_AFT_ANALOG){ //Only valid for Analog cards
|
||||
if(control_val == 1){
|
||||
if (wandev_conf->card_type == WANOPT_AFT_ANALOG) { //Only valid for Analog cards
|
||||
if (control_val == 1) {
|
||||
INFO_CFG("%s(): enabling FXO Loop Current Monitoring.\n", __FUNCTION__);
|
||||
sdla_fe_cfg->cfg.remora.rm_lcm = 1;
|
||||
}else if(control_val == 0){
|
||||
} else if(control_val == 0) {
|
||||
INFO_CFG("%s(): disabling FXO Loop Current Monitoring.\n", __FUNCTION__);
|
||||
sdla_fe_cfg->cfg.remora.rm_lcm = 0;
|
||||
}else{
|
||||
printf("%s(): Error: invalid parameter!\n", __FUNCTION__);
|
||||
} else {
|
||||
ERR_CFG("invalid parameter!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
} else{
|
||||
return -EINVAL;
|
||||
} else {
|
||||
ERR_CFG("invalid card type: %d!\n", wandev_conf->card_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -604,3 +763,14 @@ int sangoma_port_configurator::set_analog_opermode(port_cfg_t *port_cfg, char *o
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sangoma_port_configurator::initialize_interface_mtu_mru(port_cfg_t *port_cfg, unsigned int mtu, unsigned int mru)
|
||||
{
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
|
||||
INFO_CFG("%s(): new MTU: %d, new MRU: %d.\n", __FUNCTION__, mtu, mru);
|
||||
|
||||
wanif_cfg->mtu = mtu;
|
||||
wanif_cfg->u.aft.mtu = mtu;
|
||||
wanif_cfg->u.aft.mru = mru;
|
||||
}
|
|
@ -104,8 +104,12 @@ public:
|
|||
|
||||
int initialize_t1_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
int initialize_e1_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
int initialize_bri_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
int initialize_serial_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
|
||||
int write_configration_on_persistent_storage(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
|
||||
void initialize_interface_mtu_mru(port_cfg_t *port_cfg, unsigned int mtu, unsigned int mru);
|
||||
};
|
||||
|
||||
#endif // !defined(_SANGOMA_PORT_CONFIGURATOR_H)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,282 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
// sangoma_interface.h: interface for Sangoma API driver.
|
||||
//
|
||||
// Author : David Rokhvarg <davidr@sangoma.com>
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
//There is at least one communications Interface (represented by sangoma_interface class)
|
||||
//running on a Port.
|
||||
|
||||
#ifndef SANGOMA_INTERFACE_H
|
||||
#define SANGOMA_INTERFACE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h> //for offsetof()
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
# include <windows.h>
|
||||
# include <winioctl.h>
|
||||
# include <conio.h>
|
||||
# include "bit_win.h"
|
||||
|
||||
#elif defined(__LINUX__)
|
||||
|
||||
/* Include headers */
|
||||
# include <stddef.h>
|
||||
# include <errno.h>
|
||||
# include <fcntl.h>
|
||||
# include <string.h>
|
||||
# include <ctype.h>
|
||||
# include <sys/stat.h>
|
||||
# include <sys/ioctl.h>
|
||||
# include <sys/types.h>
|
||||
# include <dirent.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/socket.h>
|
||||
# include <netdb.h>
|
||||
# include <sys/un.h>
|
||||
# include <sys/wait.h>
|
||||
# include <unistd.h>
|
||||
# include <signal.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# error "sangoma_interface.h: undefined OS type"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FSK CallerID and DTMF detection note:
|
||||
* Stelephony.dll expects input BitStream (aLaw or uLaw audio) from a SINGLE timeslot.
|
||||
* It is always the case for Analog cards, but not for the Digital cards, where
|
||||
* API may provide input from a SINGLE or from MULTIPLE timeslots.
|
||||
*/
|
||||
# define USE_STELEPHONY_API 1
|
||||
|
||||
#include "libsangoma.h"
|
||||
#include "wanpipe_api.h"
|
||||
#include "sangoma_cthread.h"
|
||||
#include "sample.h"
|
||||
|
||||
# if USE_STELEPHONY_API
|
||||
# include <StelephonyApi.h>
|
||||
# endif
|
||||
|
||||
/**
|
||||
*@author David Rokhvarg
|
||||
*/
|
||||
|
||||
class sangoma_interface : public sangoma_cthread
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
sangoma_wait_obj_t sangoma_wait_obj;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//receive stuff
|
||||
ULONG rx_frames_count;
|
||||
ULONG rx_bytes_count;
|
||||
//for counting frames with CRC/Abort errors
|
||||
ULONG bad_rx_frames_count;
|
||||
DWORD dwRxThreadId;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//transmit stuff
|
||||
ULONG tx_bytes_count;
|
||||
ULONG tx_frames_count;
|
||||
UCHAR tx_test_byte;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//IOCTL management structures and variables
|
||||
wan_udp_hdr_t wan_udp;
|
||||
int protocol_cb_size;
|
||||
int wan_protocol;
|
||||
unsigned char adapter_type;
|
||||
|
||||
wanpipe_api_cmd_t tdm_api_cmd;
|
||||
wanpipe_api_t wp_api;
|
||||
|
||||
void RxThreadFunc();
|
||||
int read_data();
|
||||
int read_event();
|
||||
|
||||
void PrintRxData(wp_api_element_t *pRx);
|
||||
void PrintTdmApiEvent(wp_api_element_t *pRx);
|
||||
void cleanup();
|
||||
|
||||
wan_cmd_api_t wanpipe_api_cmd;
|
||||
wanpipe_api_t tdm_api;
|
||||
|
||||
int get_wan_config();
|
||||
int get_interface_configuration(if_cfg_t *wanif_conf_ptr);
|
||||
unsigned char get_wan_udphdr_data_byte(unsigned char off);
|
||||
unsigned char *get_wan_udphdr_data_ptr(unsigned char off);
|
||||
unsigned char set_wan_udphdr_data_byte(unsigned char off, unsigned char data);
|
||||
int get_fe_type(unsigned char* adapter_type);
|
||||
|
||||
int wanpipe_api_ioctl(wan_cmd_api_t *api_cmd);
|
||||
|
||||
int DoReadCommand(sng_fd_t drv, wp_api_element_t * pRx);
|
||||
int DoWriteCommand(sng_fd_t drv, wp_api_element_t * pTx);
|
||||
UCHAR DoSetIdleTxBufferCommand(sng_fd_t drv, wp_api_element_t *pTx);
|
||||
|
||||
unsigned char wp_brt[256];
|
||||
void generate_bit_rev_table();
|
||||
|
||||
char is_rbs_monitoring_enabled;
|
||||
|
||||
#if USE_STELEPHONY_API
|
||||
stelephony_callback_functions_t scf;
|
||||
void *stelObj;
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//data
|
||||
char terminate_tx_rx_threads;
|
||||
|
||||
wp_api_element_t rx_data;
|
||||
wp_api_element_t tx_data;
|
||||
|
||||
callback_functions_t callback_functions;
|
||||
if_cfg_t wanif_conf_struct;
|
||||
|
||||
int WanpipeNumber, InterfaceNumber;
|
||||
|
||||
protected:
|
||||
virtual unsigned long threadFunction(void* parameter);
|
||||
|
||||
public:
|
||||
char device_name[DEV_NAME_LEN];
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//methods
|
||||
sangoma_interface(int wanpipe_number, int interface_number);
|
||||
~sangoma_interface();
|
||||
|
||||
int DoManagementCommand(sng_fd_t drv, wan_udp_hdr_t* packet);
|
||||
|
||||
int init(callback_functions_t *callback_functions_ptr);
|
||||
int run();
|
||||
int stop();
|
||||
|
||||
void bit_swap_a_buffer(unsigned char *data, int len);
|
||||
|
||||
void get_te1_56k_stat(void);
|
||||
void set_lb_modes(unsigned char type, unsigned char mode);
|
||||
int loopback_command(u_int8_t type, u_int8_t mode, u_int32_t chan_map);
|
||||
|
||||
int get_operational_stats(wanpipe_chan_stats_t *stats);
|
||||
int flush_operational_stats (void);
|
||||
|
||||
int enable_rbs_monitoring();
|
||||
char get_rbs(rbs_management_t *rbs_management_ptr);
|
||||
char set_rbs(rbs_management_t *rbs_management_ptr);
|
||||
|
||||
int sangoma_tdm_enable_rbs_events(int polls_per_second);
|
||||
int sangoma_tdm_disable_rbs_events();
|
||||
|
||||
void set_idle_tx_data_buffer(unsigned char idle_tx_test_byte);
|
||||
int get_open_handles_counter();
|
||||
|
||||
//remove all data from API driver's transmit queue
|
||||
int flush_tx_buffers (void);
|
||||
|
||||
sng_fd_t open_api_device();
|
||||
|
||||
unsigned char get_adapter_type();
|
||||
unsigned int get_sub_media();
|
||||
|
||||
void get_api_driver_version(PDRIVER_VERSION version);
|
||||
|
||||
void get_card_customer_id(u_int8_t *customer_id);
|
||||
|
||||
int transmit(wp_api_element_t *pTx);
|
||||
int receive (wp_api_element_t *pRx);
|
||||
|
||||
int sendCallerID(LPCTSTR name, LPCTSTR number);
|
||||
int sendSwDTMF(char dtmf_char);
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//TDM API calls
|
||||
int sangoma_tdm_enable_rxhook_events();
|
||||
int sangoma_tdm_disable_rxhook_events();
|
||||
|
||||
/* DTMF Detection on A200 Analog card (SLIC) chip */
|
||||
int sangoma_tdm_enable_rm_dtmf_events();
|
||||
int sangoma_tdm_disable_rm_dtmf_events();
|
||||
|
||||
/* DTMF Detection on Octasic chip */
|
||||
int sangoma_tdm_enable_dtmf_events(uint8_t channel);
|
||||
int sangoma_tdm_disable_dtmf_events(uint8_t channel);
|
||||
|
||||
int sangoma_tdm_enable_ring_detect_events();
|
||||
int sangoma_tdm_disable_ring_detect_events();
|
||||
|
||||
int sangoma_tdm_enable_ring_trip_detect_events();
|
||||
int sangoma_tdm_disable_ring_trip_detect_events();
|
||||
|
||||
int sangoma_tdm_enable_ring_events();
|
||||
int sangoma_tdm_disable_ring_events();
|
||||
|
||||
int sangoma_tdm_txsig_onhook();
|
||||
int sangoma_tdm_txsig_offhook();
|
||||
|
||||
int sangoma_tdm_enable_tone_events(uint16_t tone_id);
|
||||
int sangoma_tdm_disable_tone_events();
|
||||
|
||||
int sangoma_tdm_front_end_activate();
|
||||
int sangoma_tdm_front_end_deactivate();
|
||||
|
||||
int sangoma_tdm_control_wink_flash_events(int rxflashtime);
|
||||
|
||||
/* get current state of the line - is it Connected or Disconnected */
|
||||
int sangoma_tdm_get_front_end_status(unsigned char *status);
|
||||
|
||||
int sangoma_tdm_set_user_period(unsigned int usr_period);
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
int tdmv_api_ioctl(wanpipe_api_cmd_t *api_cmd);
|
||||
|
||||
int reset_interface_state();
|
||||
|
||||
int start_ring_tone();
|
||||
int stop_ring_tone();
|
||||
|
||||
int start_congestion_tone();
|
||||
int stop_congestion_tone();
|
||||
|
||||
int start_busy_tone();
|
||||
int stop_busy_tone();
|
||||
|
||||
int stop_all_tones();
|
||||
|
||||
int start_dial_tone();
|
||||
int stop_dial_tone();
|
||||
|
||||
int start_ringing_phone();
|
||||
int stop_ringing_phone();
|
||||
|
||||
int fxo_go_off_hook();
|
||||
int fxo_go_on_hook();
|
||||
|
||||
//BRI only:
|
||||
int sangoma_tdm_enable_bri_bchan_loopback(u_int8_t channel);
|
||||
int sangoma_tdm_disable_bri_bchan_loopback(u_int8_t channel);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
|
||||
#define HANDLE_DEVICE_IOCTL_RESULT(bResult)\
|
||||
{ \
|
||||
if(bResult == 0){ \
|
||||
/* check message log */ \
|
||||
printf("%s(): Line: %d: Error!!\n", __FUNCTION__, __LINE__); \
|
||||
DecodeLastError(__FUNCTION__); \
|
||||
return 1; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /*__WINDOWS__*/
|
||||
|
||||
#endif//SANGOMA_INTERFACE_H
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -314,12 +314,9 @@ static void got_tdm_api_event(void *sang_if_ptr, void *event_data)
|
|||
break;
|
||||
|
||||
case WP_API_EVENT_RBS:
|
||||
DBG_MAIN("RBS Event: New bits: 0x%X!\n", wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
DBG_MAIN( "RX RBS: A:%1d B:%1d C:%1d D:%1d\n",
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_A) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_B) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_C) ? 1 : 0,
|
||||
(wp_tdm_api_event->wp_api_event_rbs_bits & WAN_RBS_SIG_D) ? 1 : 0);
|
||||
DBG_MAIN("RBS Event: New bits: 0x%X!\n", wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
DBG_MAIN("RX RBS/CAS: ");
|
||||
wp_print_rbs_cas_bits(wp_tdm_api_event->wp_api_event_rbs_bits);
|
||||
break;
|
||||
|
||||
case WP_API_EVENT_LINK_STATUS:
|
||||
|
@ -922,10 +919,21 @@ int __cdecl main(int argc, char* argv[])
|
|||
|
||||
INFO_MAIN("Type Channel number and press <Enter>:\n");
|
||||
rbs_management_struct.channel = get_user_decimal_number();//channels (Time Slots). Valid values: 1 to 24.
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid RBS Channel number!\n");
|
||||
break;
|
||||
|
||||
if(WAN_MEDIA_T1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid T1 RBS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(WAN_MEDIA_E1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 31){
|
||||
INFO_MAIN("Invalid E1 CAS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sang_if->get_rbs(&rbs_management_struct);
|
||||
}
|
||||
break;
|
||||
|
@ -941,15 +949,27 @@ int __cdecl main(int argc, char* argv[])
|
|||
case WAN_MEDIA_E1:
|
||||
{
|
||||
static rbs_management_t rbs_management_struct = {0,0};
|
||||
int chan_no;
|
||||
|
||||
sang_if->enable_rbs_monitoring();
|
||||
|
||||
INFO_MAIN("Type Channel number and press <Enter>:\n");
|
||||
rbs_management_struct.channel = get_user_decimal_number();//channels (Time Slots). Valid values: 1 to 24.
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid RBS Channel number!\n");
|
||||
break;
|
||||
rbs_management_struct.channel = chan_no = get_user_decimal_number();//channels (Time Slots). Valid values: T1: 1 to 24; E1: 1-15 and 17-31.
|
||||
|
||||
if(WAN_MEDIA_T1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 24){
|
||||
INFO_MAIN("Invalid T1 RBS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(WAN_MEDIA_E1 == sang_if->get_adapter_type()){
|
||||
if(rbs_management_struct.channel < 1 || rbs_management_struct.channel > 31){
|
||||
INFO_MAIN("Invalid E1 CAS Channel number!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* bitmap - set as needed: WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D;
|
||||
|
||||
In this example make bits A and B to change each time,
|
||||
|
@ -961,6 +981,51 @@ int __cdecl main(int argc, char* argv[])
|
|||
rbs_management_struct.ABCD_bits = WAN_RBS_SIG_A;
|
||||
}
|
||||
sang_if->set_rbs(&rbs_management_struct);
|
||||
|
||||
#if 0
|
||||
#define RBS_CAS_TX_AND_WAIT(chan, abcd) \
|
||||
{ \
|
||||
rbs_management_struct.channel = chan; \
|
||||
rbs_management_struct.ABCD_bits = abcd; \
|
||||
INFO_MAIN("Press any key to transmit bits:"); \
|
||||
wp_print_rbs_cas_bits(abcd); \
|
||||
_getch(); \
|
||||
sang_if->set_rbs(&rbs_management_struct); \
|
||||
}
|
||||
|
||||
//for ESF lines test all all combinations of 4 bits
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, 0x00);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B | WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
|
||||
RBS_CAS_TX_AND_WAIT(chan_no, WAN_RBS_SIG_A | WAN_RBS_SIG_B | WAN_RBS_SIG_C | WAN_RBS_SIG_D);
|
||||
#endif
|
||||
}
|
||||
default:
|
||||
INFO_MAIN("Command invalid for card type\n");
|
||||
|
@ -1141,7 +1206,7 @@ user_retry_ring_e_d:
|
|||
default:
|
||||
sang_if->fxo_go_on_hook();
|
||||
}
|
||||
}else if(sang_if->get_sub_media()==MOD_TYPE_FXS ) {
|
||||
}else if(sang_if->get_sub_media() == MOD_TYPE_FXS) {
|
||||
INFO_MAIN("Press 'f' for forward, 'r' to for reverse.\n");
|
||||
INFO_MAIN("\n");
|
||||
switch(tolower(_getch()))
|
||||
|
@ -1153,10 +1218,42 @@ user_retry_ring_e_d:
|
|||
sang_if->tdm_set_rm_polarity(1);
|
||||
break;
|
||||
default:
|
||||
//toggle it
|
||||
sang_if->tdm_set_rm_polarity(1);
|
||||
sang_if->tdm_set_rm_polarity(0);
|
||||
}
|
||||
//toggle polarity
|
||||
int polarity_wait, two_second_ring_repetion_counter;
|
||||
|
||||
INFO_MAIN("Type Polarity Reverse/Forward delay and press <Enter>:\n");
|
||||
polarity_wait = get_user_decimal_number();
|
||||
/* polarity_wait of 30 ms will ring Analog phone or FXO
|
||||
* polarity_wait of 400 ms will cause Polarity reversal event on FXO */
|
||||
INFO_MAIN("User specified Polarity Reverse/Forward delay: %d. Press <Enter> to continue.\n", polarity_wait);
|
||||
_getch();
|
||||
|
||||
two_second_ring_repetion_counter = 2000 / (polarity_wait * 2);
|
||||
INFO_MAIN("two_second_ring_repetion_counter: %d. Press <Enter> to continue.\n", two_second_ring_repetion_counter);
|
||||
_getch();
|
||||
|
||||
for (int ii = 0; ii < two_second_ring_repetion_counter; ii++) {
|
||||
INFO_MAIN("Reversing polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(1);
|
||||
sangoma_msleep(polarity_wait);
|
||||
INFO_MAIN("Forwarding polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(0);
|
||||
sangoma_msleep(polarity_wait);
|
||||
}
|
||||
|
||||
//sleep 4 seconds between the rings
|
||||
INFO_MAIN("4 seconds between the rings...\n");
|
||||
sangoma_msleep(4000);
|
||||
|
||||
for (int ii = 0; ii < two_second_ring_repetion_counter; ii++) {
|
||||
INFO_MAIN("Reversing polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(1);
|
||||
sangoma_msleep(polarity_wait);
|
||||
INFO_MAIN("Forwarding polarity %d...\n", ii);
|
||||
sang_if->tdm_set_rm_polarity(0);
|
||||
sangoma_msleep(polarity_wait);
|
||||
}//for()
|
||||
}//switch()
|
||||
}
|
||||
break;
|
||||
case 'k':
|
||||
|
@ -1174,9 +1271,11 @@ user_retry_ring_e_d:
|
|||
}
|
||||
}else if(sang_if->get_adapter_type()== WAN_MEDIA_FXOFXS) {
|
||||
if(sang_if->get_sub_media()==MOD_TYPE_FXS) {
|
||||
printf("calling tdm_txsig_kewl()...\n");
|
||||
sang_if->tdm_txsig_kewl();
|
||||
sangoma_msleep(5000);
|
||||
//to restore line current after txsig kewl
|
||||
printf("restoring line current after txsig kewl...\n");
|
||||
sang_if->tdm_txsig_offhook();
|
||||
}
|
||||
}
|
||||
|
@ -1289,7 +1388,11 @@ user_retry_ring_e_d:
|
|||
static int set_port_configuration()
|
||||
{
|
||||
int rc = 0, user_selection;
|
||||
int is_te1_card = 0, is_analog_card = 0;
|
||||
/* On hybrid cards such as B700, ports can be of different types -
|
||||
* some are Analog some Digital.
|
||||
* On non-hybrid cards such as A108, all ports are of the same
|
||||
* type - T1/E1. */
|
||||
int is_te1_port = 0, is_analog_port = 0, is_bri_port = 0, is_serial_port = 0;
|
||||
hardware_info_t hardware_info;
|
||||
port_cfg_t port_cfg;
|
||||
|
||||
|
@ -1305,7 +1408,7 @@ static int set_port_configuration()
|
|||
|
||||
if(rc == SANG_STATUS_SUCCESS){
|
||||
|
||||
INFO_MAIN("card_model : %s (0x%08X)\n",
|
||||
INFO_MAIN("card_model : %s (%d)\n",
|
||||
SDLA_ADPTR_NAME(hardware_info.card_model), hardware_info.card_model);
|
||||
INFO_MAIN("firmware_version\t: 0x%02X\n", hardware_info.firmware_version);
|
||||
INFO_MAIN("pci_bus_number\t\t: %d\n", hardware_info.pci_bus_number);
|
||||
|
@ -1319,6 +1422,7 @@ static int set_port_configuration()
|
|||
return 3;
|
||||
}
|
||||
|
||||
// very important to zero out the configuration structure
|
||||
memset(&port_cfg, 0x00, sizeof(port_cfg_t));
|
||||
|
||||
switch(hardware_info.card_model)
|
||||
|
@ -1327,18 +1431,45 @@ static int set_port_configuration()
|
|||
case A101_ADPTR_2TE1:
|
||||
case A104_ADPTR_4TE1:
|
||||
case A108_ADPTR_8TE1:
|
||||
is_te1_card = 1;
|
||||
is_te1_port = 1;
|
||||
INFO_MAIN("T1/E1 Port on non-Hybrid Card (A10[1/2/4/8]).\n");
|
||||
break;
|
||||
case A200_ADPTR_ANALOG:
|
||||
case A400_ADPTR_ANALOG:
|
||||
is_analog_card = 1;
|
||||
case AFT_ADPTR_A600: //B600
|
||||
is_analog_port = 1;
|
||||
INFO_MAIN("Analog Port on non-Hybrid Card (A200/A400).\n");
|
||||
break;
|
||||
case AFT_ADPTR_ISDN:
|
||||
is_bri_port = 1;
|
||||
INFO_MAIN("BRI Port on non-Hybrid Card (A500).\n");
|
||||
break;
|
||||
case AFT_ADPTR_FLEXBRI:
|
||||
//B700, a hybrid card - may have both ISDN BRI and Analog ports
|
||||
if (hardware_info.bri_modtype == MOD_TYPE_NT ||
|
||||
hardware_info.bri_modtype == MOD_TYPE_TE) {
|
||||
is_bri_port = 1;
|
||||
INFO_MAIN("BRI Port on Hybrid Card.\n");
|
||||
} else {
|
||||
is_analog_port = 1;
|
||||
INFO_MAIN("Analog Port on Hybrid Card.\n");
|
||||
}
|
||||
break;
|
||||
case AFT_ADPTR_2SERIAL_V35X21: /* AFT-A142 2 Port V.35/X.21 board */
|
||||
case AFT_ADPTR_4SERIAL_V35X21: /* AFT-A144 4 Port V.35/X.21 board */
|
||||
case AFT_ADPTR_2SERIAL_RS232: /* AFT-A142 2 Port RS232 board */
|
||||
case AFT_ADPTR_4SERIAL_RS232: /* AFT-A144 4 Port RS232 board */
|
||||
is_serial_port = 1;
|
||||
INFO_MAIN("Serial Port on non-Hybrid Card (A14[2/4]).\n");
|
||||
break;
|
||||
default:
|
||||
INFO_MAIN("Warning: configuration of card model 0x%08X can not be changed!\n",
|
||||
hardware_info.card_model);
|
||||
break;
|
||||
}
|
||||
|
||||
if(is_te1_card){
|
||||
|
||||
if (is_te1_port) {
|
||||
INFO_MAIN("\n");
|
||||
INFO_MAIN("Press 't' to set T1 configration.\n");
|
||||
INFO_MAIN("Press 'e' to set E1 configration.\n");
|
||||
|
@ -1361,17 +1492,20 @@ try_again:
|
|||
default:
|
||||
INFO_MAIN("Invalid command %c.\n",user_selection);
|
||||
goto try_again;
|
||||
break;
|
||||
}//switch(user_selection)
|
||||
}//if(is_te1_card)
|
||||
|
||||
if(is_analog_card){
|
||||
}//switch(user_selection)
|
||||
}//if(is_te1_port)
|
||||
|
||||
if (is_analog_port) {
|
||||
//read current configuration:
|
||||
if(sng_port_cfg_obj->get_configration(&port_cfg)){
|
||||
rc = 1;
|
||||
}else{
|
||||
//print the current configuration:
|
||||
sng_port_cfg_obj->print_port_cfg_structure(&port_cfg);
|
||||
#if 0
|
||||
sng_port_cfg_obj->initialize_interface_mtu_mru(&port_cfg, 16, 16);
|
||||
#endif
|
||||
#if 0
|
||||
//as an EXAMPLE, enable Loop Current Monitoring for Analog FXO:
|
||||
rc=sng_port_cfg_obj->control_analog_rm_lcm(&port_cfg, 1);
|
||||
|
@ -1381,9 +1515,17 @@ try_again:
|
|||
rc=sng_port_cfg_obj->set_analog_opermode(&port_cfg, "TBR21");
|
||||
#endif
|
||||
}
|
||||
}//if(is_analog_card)
|
||||
|
||||
if(!is_te1_card && !is_analog_card){
|
||||
}//if(is_analog_port)
|
||||
|
||||
if (is_bri_port) {
|
||||
rc=sng_port_cfg_obj->initialize_bri_tdm_span_voice_api_configration_structure(&port_cfg,&hardware_info,program_settings.wanpipe_number);
|
||||
}
|
||||
|
||||
if (is_serial_port) {
|
||||
rc=sng_port_cfg_obj->initialize_serial_api_configration_structure(&port_cfg,&hardware_info,program_settings.wanpipe_number);
|
||||
}
|
||||
|
||||
if(!is_te1_port && !is_analog_port && !is_bri_port && !is_serial_port){
|
||||
INFO_MAIN("Unsupported Card %d\n", hardware_info.card_model);
|
||||
rc = 1;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,15 @@ typedef struct{
|
|||
|
||||
}callback_functions_t;
|
||||
|
||||
static void wp_print_rbs_cas_bits(unsigned int abcd)
|
||||
{
|
||||
printf("A:%1d B:%1d C:%1d D:%1d\n",
|
||||
(abcd & WAN_RBS_SIG_A) ? 1 : 0,
|
||||
(abcd & WAN_RBS_SIG_B) ? 1 : 0,
|
||||
(abcd & WAN_RBS_SIG_C) ? 1 : 0,
|
||||
(abcd & WAN_RBS_SIG_D) ? 1 : 0);
|
||||
}
|
||||
|
||||
#if defined (__WINDOWS__)
|
||||
static void DecodeLastError(LPSTR lpszFunction)
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SANG_WP_DEVEL)\libsangoma";"$(SANG_WP_DEVEL)\wanpipe_common\include";"$(SANG_WP_DEVEL)\wanpipe_common\include\aft_core";"$(SANG_WP_DEVEL)\wanpipe_windows\include";"$(SANG_WP_DEVEL)\stelephony";"$(SANG_WP_DEVEL)\wanpipe_windows\HighResolutionTimer\include""
|
||||
AdditionalIncludeDirectories=""$(SANG_WP_DEVEL)\libsangoma";"$(SANG_WP_DEVEL)\wanpipe_common\include";"$(SANG_WP_DEVEL)\wanpipe_common\include\aft_core";"$(SANG_WP_DEVEL)\wanpipe_windows\include";"$(SANG_WP_DEVEL)\stelephony";"$(SANG_WP_DEVEL)\wanpipe_windows\HighResolutionTimer\include";"$(SANG_WP_DEVEL)\wanpipe_common\wantools\wanec_apilib""
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;__WINDOWS__;_WIN32_WINNT=0x0500;NOMINMAX;USE_SANGOMA_ERRNO"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define INFO_CFG if(1)printf("PORTCFG:");if(1)printf
|
||||
#define _INFO_CFG if(1)printf
|
||||
|
||||
#define ERR_CFG if(1)printf("PORTCFG:");if(1)printf
|
||||
#define ERR_CFG if(1)printf("%s():line:%d Error: ", __FUNCTION__, __LINE__);if(1)printf
|
||||
#define _ERR_CFG if(1)printf
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -350,9 +350,11 @@ int sangoma_port_configurator::set_volatile_configration(port_cfg_t *port_cfg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* optional optimization - single interrupt for both Rx and Tx audio streams */
|
||||
#define SPAN_TX_ONLY_IRQ 0
|
||||
|
||||
/*!
|
||||
\brief Brief port description
|
||||
\brief Example initialization for T1
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -363,6 +365,7 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
//sdla_te_cfg_t *te_cfg = &sdla_fe_cfg->cfg.te_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
wan_xilinx_conf_t *aft_cfg = &wandev_conf->u.aft;
|
||||
|
||||
// T1 parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_T1;
|
||||
|
@ -385,6 +388,7 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
FE_CLK(sdla_fe_cfg) = WAN_MASTER_CLK;
|
||||
#endif
|
||||
|
||||
// API parameters
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_TE1;
|
||||
|
@ -395,6 +399,12 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
#if SPAN_TX_ONLY_IRQ
|
||||
aft_cfg->span_tx_only_irq = 1;
|
||||
#else
|
||||
aft_cfg->span_tx_only_irq = 0;
|
||||
#endif
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
wanif_cfg->active_ch = 0x00FFFFFF;//channels 1-24 (starting from bit zero)
|
||||
sprintf(wanif_cfg->usedby,"TDM_SPAN_VOICE_API");
|
||||
|
@ -429,15 +439,16 @@ int sangoma_port_configurator::initialize_t1_tdm_span_voice_api_configration_str
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define BUILD_FOR_PRI 1
|
||||
int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
wan_xilinx_conf_t *aft_cfg = &wandev_conf->u.aft;
|
||||
|
||||
// Load media parameters in the registry
|
||||
// E1 parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_E1;
|
||||
FE_LCODE(sdla_fe_cfg) = WAN_LCODE_HDB3;
|
||||
FE_FRAME(sdla_fe_cfg) = WAN_FR_CRC4;
|
||||
|
@ -458,6 +469,7 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
FE_CLK(sdla_fe_cfg) = WAN_MASTER_CLK;
|
||||
#endif
|
||||
|
||||
// API parameters
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_TE1;
|
||||
|
@ -468,8 +480,21 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
#if SPAN_TX_ONLY_IRQ
|
||||
aft_cfg->span_tx_only_irq = 1;
|
||||
#else
|
||||
aft_cfg->span_tx_only_irq = 0;
|
||||
#endif
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
#if BUILD_FOR_PRI
|
||||
//PRI Signaling on chan 16
|
||||
wanif_cfg->active_ch = 0x7FFFFFFF;// channels 1-31 (starting from bit zero)
|
||||
#else
|
||||
//CAS
|
||||
wanif_cfg->active_ch = 0xFFFF7FFF;// channels 1-15.17-31 -> Active Ch Map :0xFFFEFFFE (in message log)
|
||||
#endif
|
||||
|
||||
sprintf(wanif_cfg->usedby,"TDM_SPAN_VOICE_API");
|
||||
wanif_cfg->u.aft.idle_flag=0xFF;
|
||||
wanif_cfg->mtu = 160;
|
||||
|
@ -486,6 +511,7 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
|
||||
tdmv_cfg->span_no = (unsigned char)span;
|
||||
|
||||
#if BUILD_FOR_PRI
|
||||
/* DCHAN Configuration */
|
||||
switch(FE_MEDIA(sdla_fe_cfg))
|
||||
{
|
||||
|
@ -496,11 +522,141 @@ int sangoma_port_configurator::initialize_e1_tdm_span_voice_api_configration_str
|
|||
printf("%s(): Error: invalid media type!\n", __FUNCTION__);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
printf("E1: tdmv_cfg->dchan bitmap: 0x%X\n", tdmv_cfg->dchan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangoma_port_configurator::initialize_bri_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
|
||||
// BRI parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_BRI;
|
||||
FE_LINENO(sdla_fe_cfg) = hardware_info->port_number;
|
||||
FE_TDMV_LAW(sdla_fe_cfg) = WAN_TDMV_ALAW;
|
||||
FE_NETWORK_SYNC(sdla_fe_cfg) = 0;
|
||||
|
||||
FE_REFCLK(sdla_fe_cfg) = 0;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* TE Module: WAN_NORMAL_CLK is the default.
|
||||
* Clock recovered from the line will be used by this module and
|
||||
* will be routed to ALL other BRI modules on the card which
|
||||
* become "connected" after this module. That means at any
|
||||
* time there is a single BRI line where the clock is recovered from
|
||||
* and this clock is used for all other BRI lines.
|
||||
*
|
||||
* NT Module: always runs on internal oscillator clock.
|
||||
*/
|
||||
BRI_FE_CLK((*sdla_fe_cfg)) = WAN_NORMAL_CLK;
|
||||
#else
|
||||
/*
|
||||
* TE Module: if WAN_MASTER_CLK, clock recovered from
|
||||
* the line will be NOT be used by this module and
|
||||
* will NOT be routed to ALL other BRI modules on the card.
|
||||
* Instead, the module will use clock from internal oscillator.
|
||||
*
|
||||
* NT Module: WAN_MASTER_CLK will be ignored because NT should not
|
||||
* recover clock from the line, it always runs on clock from
|
||||
* internal oscillator.
|
||||
*/
|
||||
BRI_FE_CLK((*sdla_fe_cfg)) = WAN_MASTER_CLK;
|
||||
#endif
|
||||
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_ISDN_BRI;
|
||||
wandev_conf->magic = ROUTER_MAGIC;
|
||||
|
||||
wandev_conf->mtu = 2048;
|
||||
wandev_conf->PCI_slot_no = hardware_info->pci_slot_number;
|
||||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
wanif_cfg->active_ch = 0xFFFFFFFF;
|
||||
sprintf(wanif_cfg->usedby,"TDM_SPAN_VOICE_API");
|
||||
wanif_cfg->u.aft.idle_flag=0xFF;
|
||||
wanif_cfg->mtu = 160;
|
||||
wanif_cfg->u.aft.mtu = 160;
|
||||
wanif_cfg->u.aft.mru = 160;
|
||||
sprintf(wanif_cfg->name,"w%dg1",span);
|
||||
|
||||
if (hardware_info->max_hw_ec_chans) {
|
||||
/* wan_hwec_conf_t - HWEC configuration for Port */
|
||||
/*wandev_conf->hwec_conf.dtmf = 1;*/
|
||||
/* wan_hwec_if_conf_t - HWEC configuration for Interface */
|
||||
wanif_cfg->hwec.enable = 1;
|
||||
}
|
||||
|
||||
tdmv_cfg->span_no = (unsigned char)span;
|
||||
|
||||
/* There is no DCHAN Configuration on BRI because it is
|
||||
* configured automatically by the driver. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangoma_port_configurator::initialize_serial_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
wan_tdmv_conf_t *tdmv_cfg = &wandev_conf->tdmv_conf;
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
|
||||
// Serial parameters
|
||||
FE_MEDIA(sdla_fe_cfg) = WAN_MEDIA_SERIAL;
|
||||
FE_LINENO(sdla_fe_cfg) = hardware_info->port_number;
|
||||
|
||||
wandev_conf->line_coding = WANOPT_NRZ;
|
||||
/* WANOPT_V35/WANOPT_X21 are valid for card models:
|
||||
* AFT_ADPTR_2SERIAL_V35X21 and AFT_ADPTR_4SERIAL_V35X21.
|
||||
* WANOPT_RS232 valid for card models:
|
||||
* AFT_ADPTR_2SERIAL_RS232 and AFT_ADPTR_4SERIAL_RS232.
|
||||
*/
|
||||
wandev_conf->electrical_interface = WANOPT_V35;
|
||||
#if 1
|
||||
wandev_conf->clocking = WANOPT_EXTERNAL;
|
||||
wandev_conf->bps = 0;
|
||||
#else
|
||||
wandev_conf->clocking = WANOPT_INTERNAL;
|
||||
wandev_conf->bps = 56000;
|
||||
#endif
|
||||
|
||||
wandev_conf->connection = WANOPT_PERMANENT;//or WANOPT_SWITCHED
|
||||
wandev_conf->line_idle = WANOPT_IDLE_FLAG;
|
||||
|
||||
// API parameters
|
||||
port_cfg->num_of_ifs = 1;
|
||||
|
||||
wandev_conf->config_id = WANCONFIG_AFT_SERIAL;
|
||||
wandev_conf->magic = ROUTER_MAGIC;
|
||||
|
||||
wandev_conf->mtu = 2048;
|
||||
wandev_conf->PCI_slot_no = hardware_info->pci_slot_number;
|
||||
wandev_conf->pci_bus_no = hardware_info->pci_bus_number;
|
||||
wandev_conf->card_type = WANOPT_AFT; //m_DeviceInfoData.card_model;
|
||||
|
||||
wanif_cfg->magic = ROUTER_MAGIC;
|
||||
wanif_cfg->active_ch = 0xFFFFFFFF;
|
||||
sprintf(wanif_cfg->usedby,"API");
|
||||
wanif_cfg->u.aft.idle_flag=0xFF;
|
||||
wanif_cfg->mtu = 1600;
|
||||
wanif_cfg->u.aft.mtu = 1600;
|
||||
wanif_cfg->u.aft.mru = 1600;
|
||||
sprintf(wanif_cfg->name,"w%dg1",span);
|
||||
|
||||
wanif_cfg->hdlc_streaming = WANOPT_YES;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sangoma_port_configurator::write_configration_on_persistent_storage(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span)
|
||||
{
|
||||
//all the work is done by libsangoma
|
||||
|
@ -511,17 +667,20 @@ int sangoma_port_configurator::control_analog_rm_lcm(port_cfg_t *port_cfg, int c
|
|||
{
|
||||
wandev_conf_t *wandev_conf = &port_cfg->wandev_conf;
|
||||
sdla_fe_cfg_t *sdla_fe_cfg = &wandev_conf->fe_cfg;
|
||||
if(wandev_conf->card_type == WANOPT_AFT_ANALOG){ //Only valid for Analog cards
|
||||
if(control_val == 1){
|
||||
if (wandev_conf->card_type == WANOPT_AFT_ANALOG) { //Only valid for Analog cards
|
||||
if (control_val == 1) {
|
||||
INFO_CFG("%s(): enabling FXO Loop Current Monitoring.\n", __FUNCTION__);
|
||||
sdla_fe_cfg->cfg.remora.rm_lcm = 1;
|
||||
}else if(control_val == 0){
|
||||
} else if(control_val == 0) {
|
||||
INFO_CFG("%s(): disabling FXO Loop Current Monitoring.\n", __FUNCTION__);
|
||||
sdla_fe_cfg->cfg.remora.rm_lcm = 0;
|
||||
}else{
|
||||
printf("%s(): Error: invalid parameter!\n", __FUNCTION__);
|
||||
} else {
|
||||
ERR_CFG("invalid parameter!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
} else{
|
||||
return -EINVAL;
|
||||
} else {
|
||||
ERR_CFG("invalid card type: %d!\n", wandev_conf->card_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -604,3 +763,14 @@ int sangoma_port_configurator::set_analog_opermode(port_cfg_t *port_cfg, char *o
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sangoma_port_configurator::initialize_interface_mtu_mru(port_cfg_t *port_cfg, unsigned int mtu, unsigned int mru)
|
||||
{
|
||||
wanif_conf_t *wanif_cfg = &port_cfg->if_cfg[0];
|
||||
|
||||
INFO_CFG("%s(): new MTU: %d, new MRU: %d.\n", __FUNCTION__, mtu, mru);
|
||||
|
||||
wanif_cfg->mtu = mtu;
|
||||
wanif_cfg->u.aft.mtu = mtu;
|
||||
wanif_cfg->u.aft.mru = mru;
|
||||
}
|
|
@ -104,8 +104,12 @@ public:
|
|||
|
||||
int initialize_t1_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
int initialize_e1_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
int initialize_bri_tdm_span_voice_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
int initialize_serial_api_configration_structure(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
|
||||
int write_configration_on_persistent_storage(port_cfg_t *port_cfg, hardware_info_t *hardware_info, int span);
|
||||
|
||||
void initialize_interface_mtu_mru(port_cfg_t *port_cfg, unsigned int mtu, unsigned int mru);
|
||||
};
|
||||
|
||||
#endif // !defined(_SANGOMA_PORT_CONFIGURATOR_H)
|
||||
|
|
|
@ -93,18 +93,18 @@ svn:wc:ra_dav:version-url
|
|||
V 49
|
||||
/svn/stelephony/!svn/ver/59/trunk/libstelephony.h
|
||||
END
|
||||
COPYING
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 41
|
||||
/svn/stelephony/!svn/ver/13/trunk/COPYING
|
||||
END
|
||||
build.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 42
|
||||
/svn/stelephony/!svn/ver/28/trunk/build.sh
|
||||
END
|
||||
COPYING
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 41
|
||||
/svn/stelephony/!svn/ver/13/trunk/COPYING
|
||||
END
|
||||
StelephonyApi.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
|
@ -117,72 +117,72 @@ svn:wc:ra_dav:version-url
|
|||
V 48
|
||||
/svn/stelephony/!svn/ver/55/trunk/stelephony.cpp
|
||||
END
|
||||
NEWS
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 38
|
||||
/svn/stelephony/!svn/ver/13/trunk/NEWS
|
||||
END
|
||||
stelephony.aps
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/stelephony/!svn/ver/43/trunk/stelephony.aps
|
||||
END
|
||||
NEWS
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 38
|
||||
/svn/stelephony/!svn/ver/13/trunk/NEWS
|
||||
END
|
||||
resource.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/stelephony/!svn/ver/1/trunk/resource.h
|
||||
END
|
||||
version
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 41
|
||||
/svn/stelephony/!svn/ver/13/trunk/version
|
||||
END
|
||||
stelephony.sln
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/stelephony/!svn/ver/59/trunk/stelephony.sln
|
||||
END
|
||||
version
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 41
|
||||
/svn/stelephony/!svn/ver/13/trunk/version
|
||||
END
|
||||
configure.in
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/stelephony/!svn/ver/48/trunk/configure.in
|
||||
END
|
||||
stelephony.def
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/stelephony/!svn/ver/59/trunk/stelephony.def
|
||||
END
|
||||
ChangeLog
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/stelephony/!svn/ver/13/trunk/ChangeLog
|
||||
END
|
||||
stelephony.def
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/stelephony/!svn/ver/59/trunk/stelephony.def
|
||||
END
|
||||
libstelephony_linux_compat.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 62
|
||||
/svn/stelephony/!svn/ver/43/trunk/libstelephony_linux_compat.h
|
||||
END
|
||||
stelephony.vcproj
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 51
|
||||
/svn/stelephony/!svn/ver/59/trunk/stelephony.vcproj
|
||||
END
|
||||
PToneDecoder.cpp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 50
|
||||
/svn/stelephony/!svn/ver/60/trunk/PToneDecoder.cpp
|
||||
END
|
||||
stelephony.vcproj
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 51
|
||||
/svn/stelephony/!svn/ver/59/trunk/stelephony.vcproj
|
||||
END
|
||||
README
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
|
|
|
@ -213,18 +213,6 @@ file
|
|||
59
|
||||
davidr
|
||||
|
||||
COPYING
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
build.sh
|
||||
file
|
||||
|
||||
|
@ -238,6 +226,18 @@ db35df946eb4c300bbc065dbf844c6aa
|
|||
ncorbic
|
||||
has-props
|
||||
|
||||
COPYING
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
StelephonyApi.h
|
||||
file
|
||||
|
||||
|
@ -262,18 +262,6 @@ d39810d5fd7763003fbd609890934180
|
|||
55
|
||||
davidy
|
||||
|
||||
NEWS
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
stelephony.aps
|
||||
file
|
||||
|
||||
|
@ -287,6 +275,18 @@ b08bdecd7dd0fc40b801c042ce2470a8
|
|||
davidr
|
||||
has-props
|
||||
|
||||
NEWS
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
resource.h
|
||||
file
|
||||
|
||||
|
@ -299,18 +299,6 @@ ca1cc8cc040b1c8d1f14b5fef8aef16c
|
|||
1
|
||||
root
|
||||
|
||||
version
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
dc404f5aa6012bc608dd48d9f6c43a77
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
stelephony.sln
|
||||
file
|
||||
|
||||
|
@ -323,6 +311,18 @@ file
|
|||
59
|
||||
davidr
|
||||
|
||||
version
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
dc404f5aa6012bc608dd48d9f6c43a77
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
configure.in
|
||||
file
|
||||
|
||||
|
@ -335,6 +335,18 @@ file
|
|||
48
|
||||
ncorbic
|
||||
|
||||
ChangeLog
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
stelephony.def
|
||||
file
|
||||
|
||||
|
@ -347,18 +359,6 @@ file
|
|||
59
|
||||
davidr
|
||||
|
||||
ChangeLog
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2009-06-26T20:54:03.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2009-02-27T21:14:16.818013Z
|
||||
13
|
||||
ncorbic
|
||||
|
||||
libstelephony_linux_compat.h
|
||||
file
|
||||
|
||||
|
@ -371,18 +371,6 @@ ff39032d8b88b49cfb53a514bd52f27f
|
|||
43
|
||||
davidr
|
||||
|
||||
stelephony.vcproj
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-03-23T16:15:02.000000Z
|
||||
4a6dbf857cbeaa06e00069bcc011da43
|
||||
2010-03-15T22:33:02.724320Z
|
||||
59
|
||||
davidr
|
||||
|
||||
PToneDecoder.cpp
|
||||
file
|
||||
|
||||
|
@ -395,6 +383,18 @@ file
|
|||
60
|
||||
davidy
|
||||
|
||||
stelephony.vcproj
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-03-23T16:15:02.000000Z
|
||||
4a6dbf857cbeaa06e00069bcc011da43
|
||||
2010-03-15T22:33:02.724320Z
|
||||
59
|
||||
davidr
|
||||
|
||||
README
|
||||
file
|
||||
|
||||
|
|
|
@ -125,8 +125,13 @@ int MakeConnection(timeslot_t *slot, char *router_name )
|
|||
{
|
||||
|
||||
int span,chan;
|
||||
int err;
|
||||
int period=40;
|
||||
wanpipe_api_t tdm_api;
|
||||
sangoma_span_chan_fromif(slot->if_name,&span,&chan);
|
||||
|
||||
memset(&tdm_api,0,sizeof(tdm_api));
|
||||
|
||||
if (span > 0 && chan > 0) {
|
||||
wanpipe_tdm_api_t tdm_api;
|
||||
slot->sock = sangoma_open_tdmapi_span_chan(span,chan);
|
||||
|
@ -135,12 +140,21 @@ int MakeConnection(timeslot_t *slot, char *router_name )
|
|||
return( FALSE );
|
||||
}
|
||||
|
||||
sangoma_tdm_set_codec(slot->sock,&tdm_api,WP_NONE);
|
||||
|
||||
|
||||
sangoma_tdm_set_codec(slot->sock,&tdm_api,WP_NONE);
|
||||
|
||||
|
||||
#if 0
|
||||
err=sangoma_tdm_set_usr_period(slot->sock,&tdm_api,period);
|
||||
if (err) {
|
||||
printf("Error: Failed to set period\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("Socket bound to Span=%i Chan=%i\n\n",span,chan);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ void handle_span_chan(void)
|
|||
Rx_data,
|
||||
sizeof(wp_tdm_api_rx_hdr_t),
|
||||
&Rx_data[sizeof(wp_tdm_api_rx_hdr_t)],
|
||||
70, 0);
|
||||
MAX_RX_DATA, 0);
|
||||
|
||||
if (!read_enable){
|
||||
goto bitstrm_skip_read;
|
||||
|
@ -285,7 +285,7 @@ void handle_span_chan(void)
|
|||
|
||||
/* err indicates bytes received */
|
||||
if(err <= 0) {
|
||||
printf("\nError receiving data\n");
|
||||
printf("\nError receiving data %s\n",strerror(errno));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
dev_fd = sangoma_open_tdmapi_span_chan(atoi(card_name),atoi(if_name));
|
||||
if( dev_fd < 0){
|
||||
printf("Failed to open span chan\n");
|
||||
printf("Failed to open span chan %i %i\n",atoi(card_name),atoi(if_name));
|
||||
exit (1);
|
||||
}
|
||||
printf("HANDLING SPAN %i CHAN %i FD=%i\n",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Package: wanpipe
|
||||
Version: 3.5.18-0
|
||||
Version: 3.5.19-0
|
||||
Section: networking
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "aft_analog.h"
|
||||
#include "aft_bri.h"
|
||||
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
# include <sdladrv_private.h>
|
||||
# define AFT_MAX_CHIP_SECURITY_CNT 100
|
||||
|
@ -1041,7 +1042,8 @@ aft_dmachain_enable_tdmv_and_mtu_size(u32 *reg, int size)
|
|||
#define AFT_SERIAL_LCFG_CTRL_BIT_MASK 0x0F
|
||||
|
||||
#define AFT_SERIAL_LCFG_BAUD_SHIFT 8
|
||||
#define AFT_SERIAL_LCFG_BAUD_MASK 0xFFFF
|
||||
#define AFT_SERIAL_LCFG_BAUD_ORIG_MASK 0xFFFF
|
||||
#define AFT_SERIAL_LCFG_BAUD_MASK 0xFFF
|
||||
|
||||
#define AFT_SERIAL_LCFG_CLK_OSC_SEL_BIT 23
|
||||
#define AFT_SERIAL_LCFG_CLK_SRC_BIT 24
|
||||
|
@ -1054,6 +1056,9 @@ aft_dmachain_enable_tdmv_and_mtu_size(u32 *reg, int size)
|
|||
|
||||
#define AFT_SERIAL_LCFG_IFACE_TYPE_BIT 31
|
||||
|
||||
//This aft_serial_set_baud_rate wzs the original one before the implementation of RECOVERY CLOCK
|
||||
//We are keeping it here just to be safe, in case of complaints from customers
|
||||
#if 0
|
||||
static __inline void
|
||||
aft_serial_set_baud_rate(u32 *reg, u32 rate)
|
||||
{
|
||||
|
@ -1062,9 +1067,22 @@ aft_serial_set_baud_rate(u32 *reg, u32 rate)
|
|||
if (!remain || (remain/2 > rate)) {
|
||||
div=div-1;
|
||||
}
|
||||
}
|
||||
if (div > 0) {
|
||||
div=div-1;
|
||||
}
|
||||
|
||||
if (div==0) {
|
||||
DEBUG_EVENT("wanpipe: Error: Baud Rate Requested %i too high! Cannot be generated by hardware!\n",rate);
|
||||
return -1;
|
||||
}
|
||||
*reg&=~(AFT_SERIAL_LCFG_BAUD_MASK<<AFT_SERIAL_LCFG_BAUD_SHIFT);
|
||||
*reg|= ((div)&AFT_SERIAL_LCFG_BAUD_MASK)<<AFT_SERIAL_LCFG_BAUD_SHIFT;
|
||||
|
||||
wan_clear_bit(AFT_SERIAL_LCFG_CLK_OSC_SEL_BIT,®);
|
||||
}
|
||||
#endif
|
||||
|
||||
static __inline void
|
||||
aft_serial_set_lcoding(u32 *reg, u32 coding)
|
||||
{
|
||||
|
@ -1072,8 +1090,137 @@ aft_serial_set_lcoding(u32 *reg, u32 coding)
|
|||
*reg|= (coding&AFT_SERIAL_LCFG_LCODING_MASK)<<AFT_SERIAL_LCFG_LCODING_SHIFT;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
aft_serial_set_legacy_baud_rate(u32 *reg, u32 rate)
|
||||
{
|
||||
u32 div,remain;
|
||||
div=14745600/(2*rate);
|
||||
remain=14745600%(2*rate);
|
||||
if (remain > rate) {
|
||||
div=div+1;
|
||||
}
|
||||
if (div > 0) {
|
||||
div=div-1;
|
||||
}
|
||||
|
||||
if (div==0) {
|
||||
DEBUG_ERROR("wanpipe: Error: Baud Rate Requested %i too high! Cannot be generated by hardware!\n",rate);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*reg&=~(AFT_SERIAL_LCFG_BAUD_ORIG_MASK<<AFT_SERIAL_LCFG_BAUD_SHIFT);
|
||||
*reg|= ((div)&AFT_SERIAL_LCFG_BAUD_ORIG_MASK)<<AFT_SERIAL_LCFG_BAUD_SHIFT;
|
||||
|
||||
wan_clear_bit(AFT_SERIAL_LCFG_CLK_OSC_SEL_BIT,reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
aft_serial_set_baud_rate(u32 *reg, u32 rate, u32 recovery)
|
||||
{
|
||||
u32 div,remain,freq,percent;
|
||||
u32 acc1,acc2,div1,div2,round1,round2;
|
||||
|
||||
round1=round2=0;
|
||||
|
||||
if (rate == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
div=14745600/(2*rate);
|
||||
remain=14745600%(2*rate);
|
||||
DEBUG_TEST("DIV=%u REMAIN1 %u rate=%u\n",div,remain,rate);
|
||||
if (remain > rate) {
|
||||
div=div+1;
|
||||
round1=1;
|
||||
}
|
||||
if (div > 0) {
|
||||
div=div-1;
|
||||
}
|
||||
div1=div;
|
||||
|
||||
if (remain > rate) {
|
||||
acc1= 2*rate - remain;
|
||||
} else {
|
||||
acc1=remain;
|
||||
}
|
||||
|
||||
div=(12352000)/(2*rate);
|
||||
remain=(12352000)%(2*rate);
|
||||
DEBUG_TEST("DIV=%u REMAIN2 %u rate=%u\n",div,remain,rate);
|
||||
if (remain > rate) {
|
||||
div=div+1;
|
||||
round2=1;
|
||||
}
|
||||
|
||||
if (div > 0) {
|
||||
div=div-1;
|
||||
}
|
||||
div2=div;
|
||||
|
||||
if (remain > rate) {
|
||||
acc2= 2*rate - remain;
|
||||
} else {
|
||||
acc2=remain;
|
||||
}
|
||||
|
||||
if (acc1 > acc2) {
|
||||
wan_set_bit(AFT_SERIAL_LCFG_CLK_OSC_SEL_BIT,reg);
|
||||
div=div2;
|
||||
|
||||
if (div == 0) {
|
||||
DEBUG_ERROR("wanpipe: Error: Baud Rate Requested %i too high! Cannot be generated by hardware!\n", recovery?rate/32:rate);
|
||||
return -1;
|
||||
}
|
||||
|
||||
DEBUG_EVENT("NEW OSC: DIV=%i (DIV1=%i DIV2=%i) (ACC1=%i ACC2=%i)\n",div,div1,div2,acc1,acc2);
|
||||
freq=12352000/(2*(div+round2+1));
|
||||
percent=abs(freq-rate)*100/rate;
|
||||
|
||||
if (recovery) {
|
||||
freq=freq/32;
|
||||
rate=rate/32;
|
||||
}
|
||||
|
||||
if (percent > 2) {
|
||||
DEBUG_ERROR("wanpipe: Error: Baud Rate Requested %i cannot be generated by hardware! Actual=%i Tolerance=%i\n", rate,freq,percent);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
DEBUG_EVENT("wanpipe: Baud Rate Requested %i, Baud Rate Generated %i, Tolerance=%i\n",rate,freq,percent);
|
||||
} else {
|
||||
wan_clear_bit(AFT_SERIAL_LCFG_CLK_OSC_SEL_BIT,reg);
|
||||
div=div1;
|
||||
|
||||
if (div == 0) {
|
||||
DEBUG_ERROR("wanpipe: Error: Baud Rate Requested %i too high! Cannot be generated by hardware!\n", recovery?rate/32:rate);
|
||||
return -1;
|
||||
}
|
||||
|
||||
DEBUG_EVENT("ORIG OSC: DIV=%i (DIV1=%i DIV2=%i) (ACC1=%i ACC2=%i)\n",div,div1,div2,acc1,acc2);
|
||||
freq=14745600/(2*(div+round1+1));
|
||||
percent=abs(freq-rate)*100/rate;
|
||||
|
||||
if (recovery) {
|
||||
freq=freq/32;
|
||||
rate=rate/32;
|
||||
}
|
||||
|
||||
if (percent > 2) {
|
||||
DEBUG_ERROR("wanpipe: Error: Baud Rate Requested %i cannot be generated by hardware! Actual=%i Tolerance=%i\n", rate,freq,percent);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
DEBUG_EVENT("wanpipe: Baud Rate Requested %i, Baud Rate Generated %i, Tolerance=%i\n", rate,freq,percent);
|
||||
}
|
||||
|
||||
*reg&=~(AFT_SERIAL_LCFG_BAUD_MASK<<AFT_SERIAL_LCFG_BAUD_SHIFT);
|
||||
*reg|= ((div)&AFT_SERIAL_LCFG_BAUD_MASK)<<AFT_SERIAL_LCFG_BAUD_SHIFT;
|
||||
DEBUG_EVENT(" OSC: DIV=%i REG=0x%08X \n",div,*reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*======================================================
|
||||
* FREE RUNNING TIMER
|
||||
*
|
||||
|
|
|
@ -206,7 +206,7 @@ typedef struct wp_rx_element
|
|||
unsigned int reg;
|
||||
unsigned int align;
|
||||
unsigned short len;
|
||||
unsigned short pkt_error;
|
||||
wan_bitmap_t pkt_error;
|
||||
}wp_rx_element_t;
|
||||
|
||||
|
||||
|
@ -315,7 +315,7 @@ typedef struct private_area
|
|||
unsigned char num_of_time_slots;
|
||||
int logic_ch_num;
|
||||
|
||||
unsigned char interface_down;
|
||||
wan_bitmap_t interface_down;
|
||||
unsigned char channelized_cfg;
|
||||
unsigned char tdmv_zaptel_cfg;
|
||||
|
||||
|
@ -344,9 +344,9 @@ typedef struct private_area
|
|||
|
||||
u8 idle_flag;
|
||||
u16 max_idle_size;
|
||||
u8 idle_start;
|
||||
wan_bitmap_t idle_start;
|
||||
|
||||
u8 pkt_error;
|
||||
wan_bitmap_t pkt_error;
|
||||
u8 rx_fifo_err_cnt;
|
||||
|
||||
int first_time_slot;
|
||||
|
|
|
@ -154,6 +154,7 @@
|
|||
/* TE timer flags. bits 1-8 */
|
||||
#define T3_TIMER_ACTIVE 1
|
||||
#define T4_TIMER_ACTIVE 2
|
||||
#define T3_TIMER_EXPIRED 3
|
||||
/* NT timer flags. bits 9-16 */
|
||||
#define T1_TIMER_ACTIVE 9
|
||||
#define T1_TIMER_EXPIRED 10
|
||||
|
@ -329,7 +330,7 @@ typedef struct sdla_bri_param {
|
|||
u_int32_t module_map[2]; /* Map of available module */
|
||||
u_int16_t max_fe_channels; /* Number of available modules */
|
||||
|
||||
u_int8_t critical;
|
||||
wan_bitmap_t critical;
|
||||
|
||||
/*
|
||||
Flag indicating if this logical 'card' (sdla_t) which represents a BRI line,
|
||||
|
|
|
@ -485,7 +485,7 @@ typedef struct {
|
|||
sdla_fe_cfg_t fe_cfg;
|
||||
/* FIXME: Remove the following parameters from wandev_t */
|
||||
unsigned char fe_status;
|
||||
/* unsigned int fe_alarm; */
|
||||
unsigned int fe_prev_alarm;
|
||||
unsigned char fe_chip_id;
|
||||
unsigned char fe_max_ports;
|
||||
unsigned char fe_debug;
|
||||
|
|
|
@ -29,6 +29,14 @@
|
|||
# include "wanpipe_events.h"
|
||||
|
||||
|
||||
#define DBG_FALSE_RING1 0
|
||||
#define DBG_FALSE_RING2 0
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
# define DEBUG_FALSE_RING if(0)DbgPrint
|
||||
#else
|
||||
# define DEBUG_FALSE_RING if(0)DEBUG_EVENT
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
** DEFINES and MACROS
|
||||
|
@ -456,6 +464,13 @@ typedef struct sdla_remora_param {
|
|||
int battthresh; /* global for FXO */
|
||||
int wp_rm_chunk_size; /* TDM API set as MTU for Zaptel set as ZT_CHUNK_SIZE */
|
||||
|
||||
#if DBG_FALSE_RING1
|
||||
u32 last_system_ticks;
|
||||
u32 last_intcount;
|
||||
u32 ticks_diff;
|
||||
u32 int_diff;
|
||||
#endif
|
||||
|
||||
} sdla_remora_param_t;
|
||||
|
||||
|
||||
|
|
|
@ -455,6 +455,7 @@ typedef struct sdla_te_cfg {
|
|||
u_int8_t sig_mode;
|
||||
u_int8_t ignore_yel_alarm;
|
||||
u_int8_t ais_maintenance;
|
||||
u_int8_t ais_auto_on_los;
|
||||
} sdla_te_cfg_t;
|
||||
|
||||
/* Performamce monitor counters */
|
||||
|
|
|
@ -982,7 +982,7 @@ typedef struct wp_rx_element
|
|||
unsigned int dma_addr;
|
||||
unsigned int reg;
|
||||
unsigned int align;
|
||||
unsigned char pkt_error;
|
||||
wan_bitmap_t pkt_error;
|
||||
}wp_rx_element_t;
|
||||
|
||||
|
||||
|
|
|
@ -538,10 +538,7 @@ typedef struct sdlahw_card {
|
|||
#define u_usb u_hwif.usb
|
||||
|
||||
wan_mutexlock_t pcard_ec_lock; /* lock per physical card for EC */
|
||||
#if 0
|
||||
/* moved to cpu, type */
|
||||
wan_smp_flag_t fe_rw_flag;
|
||||
#endif
|
||||
|
||||
unsigned char adptr_security; /* Adapter security (AFT cards) */
|
||||
u16 hwec_chan_no; /* max hwec channels number */
|
||||
int hwec_ind; /* hwec index */
|
||||
|
@ -560,7 +557,7 @@ typedef struct {
|
|||
int total_line_no;
|
||||
u_int32_t line_map;
|
||||
|
||||
wan_smp_flag_t fe_rw_flag;
|
||||
wan_bitmap_t fe_rw_bitmap;
|
||||
wan_mutexlock_t pcard_lock; /* lock per physical card for FE */
|
||||
} sdlahw_info_t;
|
||||
|
||||
|
|
|
@ -622,7 +622,7 @@ typedef struct
|
|||
unsigned long fifo_addr_map_l2;
|
||||
wan_timer_t bg_timer;
|
||||
unsigned int bg_timer_cmd;
|
||||
unsigned char tdmv_sync;
|
||||
wan_bitmap_t tdmv_sync;
|
||||
unsigned int chip_cfg_status;
|
||||
wan_taskq_t port_task;
|
||||
unsigned int port_task_cmd;
|
||||
|
@ -651,7 +651,7 @@ typedef struct
|
|||
|
||||
unsigned char tdmv_hw_tone;
|
||||
|
||||
unsigned char led_ctrl;
|
||||
wan_bitmap_t led_ctrl;
|
||||
unsigned int tdm_intr_status;
|
||||
sdla_mem_handle_t bar_virt;
|
||||
unsigned char tdm_rx_dma_toggle[32];
|
||||
|
@ -819,7 +819,7 @@ typedef struct sdla
|
|||
|
||||
sdla_fe_t fe; /* front end structures */
|
||||
u8 fe_no_intr; /* set to 0x01 if not FE interrupt should enabled */
|
||||
u8 fe_ignore_intr; /* Set to 0x01 if all FE interrupts should be ignored */
|
||||
wan_bitmap_t fe_ignore_intr; /* Set to 0x01 if all FE interrupts should be ignored */
|
||||
|
||||
unsigned int rCount;
|
||||
|
||||
|
@ -931,6 +931,8 @@ typedef struct sdla
|
|||
aft_driver_performance_stats_t aft_perf_stats;
|
||||
#endif
|
||||
|
||||
unsigned int wdt_timeout;
|
||||
|
||||
} sdla_t;
|
||||
|
||||
|
||||
|
|
|
@ -208,4 +208,11 @@ extern unsigned char wpabs_get_last_trace_direction(void *trace_ptr);
|
|||
|
||||
extern int wpabs_bpf_report(void *dev, void *skb, int,int);
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
# if WP_USE_INTERLOCKED_LIST_FUNCTIONS
|
||||
# pragma deprecated(wpabs_skb_append)
|
||||
# pragma deprecated(wpabs_skb_unlink)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef long long_t;
|
|||
typedef unsigned long ulong_t;
|
||||
#define wan_timeval timeval
|
||||
#define wan_timeval_t struct timeval
|
||||
typedef unsigned int wan_bitmap_t; /* 32 bit-wide on both 32 and 64 bit systems */
|
||||
#elif defined(__WINDOWS__)
|
||||
/******************* W I N D O W S ******************************/
|
||||
|
||||
|
@ -146,6 +147,8 @@ typedef u32 dma_addr_t;
|
|||
|
||||
typedef char* caddr_t;
|
||||
typedef struct { long_t counter; } atomic_t; /* Interlocked functions require LONG parameter */
|
||||
typedef ulong_t wan_bitmap_t; /* atomic bit-manupulation require LONG.
|
||||
* 32 bit-wide on both 32 and 64 bit systems */
|
||||
|
||||
/******** End of Basic data types ********/
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ typedef int sng_fd_t;
|
|||
#define WP_API_FEATURE_DRIVER_GAIN 1
|
||||
#define WP_API_FEATURE_FE_RW 1
|
||||
#define WP_API_FEATURE_HWEC_PERSIST 1
|
||||
#define WP_API_FEATURE_FAX_TYPE_EVENTS 1
|
||||
|
||||
/*!
|
||||
\enum WANPIPE_IOCTL_CODE
|
||||
|
@ -312,7 +313,7 @@ enum wanpipe_cdev_ctrl_cmds
|
|||
enum wanpipe_api_events
|
||||
{
|
||||
WP_API_EVENT_NONE, /*!< */
|
||||
WP_API_EVENT_RBS, /*!< Enable Disable RBS Opertaion Mode (T1: RBS E1: CAS) */
|
||||
WP_API_EVENT_RBS, /*!< Tx: Enable Disable RBS Opertaion Mode (T1: RBS E1: CAS) */
|
||||
WP_API_EVENT_ALARM, /*!< */
|
||||
WP_API_EVENT_DTMF, /*!< Enable Disable HW DTMF Detection */
|
||||
WP_API_EVENT_RM_DTMF, /*!< */
|
||||
|
@ -334,6 +335,9 @@ enum wanpipe_api_events
|
|||
WP_API_EVENT_FAX_DETECT, /*!< Enable Disable HW Fax Detection */
|
||||
WP_API_EVENT_SET_RM_TX_GAIN, /*!< Set Tx Gain for FXO/FXS */
|
||||
WP_API_EVENT_SET_RM_RX_GAIN, /*!< Set Rx Gain for FXO/FXS */
|
||||
WP_API_EVENT_FAX_1100, /*!< IN: FAX 1100 Tone event */
|
||||
WP_API_EVENT_FAX_2100, /*!< IN: FAX 2100 Tone event */
|
||||
WP_API_EVENT_FAX_2100_WSPR, /*!< IN: FAX 2100 WSPR Tone event */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ enum {
|
|||
|
||||
typedef struct wanpipe_cdev
|
||||
{
|
||||
u_int8_t init;
|
||||
u_int8_t used;
|
||||
wan_bitmap_t init;
|
||||
wan_bitmap_t used;
|
||||
|
||||
int32_t span;
|
||||
int32_t chan;
|
||||
|
|
|
@ -351,6 +351,7 @@ typedef struct wan_xilinx_conf
|
|||
unsigned int rbs; /* Robbit signalling support */
|
||||
unsigned int data_mux_map; /* Data mux map */
|
||||
unsigned int rx_crc_bytes;
|
||||
unsigned char span_tx_only_irq; /* SPAN mode API to use rx irq only */
|
||||
} wan_xilinx_conf_t;
|
||||
|
||||
typedef struct wan_xilinx_conf_if
|
||||
|
|
|
@ -138,6 +138,8 @@ enum {
|
|||
/* clocking options */
|
||||
#define WANOPT_EXTERNAL 0
|
||||
#define WANOPT_INTERNAL 1
|
||||
#define WANOPT_RECOVERY 2 /*Uses another oscillator(to be put by hw guys) to */
|
||||
/*generate almost exactly baud rate 64333 and dividor 2*/
|
||||
|
||||
/* station options */
|
||||
#define WANOPT_DTE 0
|
||||
|
|
|
@ -215,11 +215,6 @@ static __inline void WP_MDELAY (u32 ms) {
|
|||
((SYSTEM_TICKS - (start)) > ((timeout) * HZ))
|
||||
|
||||
|
||||
#define WP_MICROSECONDS_IN_A_TICK() (1000000 / HZ)
|
||||
#define WP_TICKS_IN_LAST_SECOND() (SYSTEM_TICKS % HZ)
|
||||
|
||||
#define WAN_TICKS_TO_MICROSECONDS() \
|
||||
WP_TICKS_IN_LAST_SECOND() * WP_MICROSECONDS_IN_A_TICK()
|
||||
|
||||
#if defined(__LINUX__)
|
||||
# define WAN_COPY_FROM_USER(k,u,l) copy_from_user(k,u,l)
|
||||
|
@ -1030,6 +1025,15 @@ static __inline int wan_getcurrenttime(wan_time_t *sec, wan_suseconds_t *usec)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Obtain the number of seconds elapsed since midnight (00:00:00),
|
||||
* January 1, 1970.
|
||||
* Equivalent to "time()" and "_time64()" in user-space.
|
||||
* User-mode applications can call "ctime()" and "_ctime64()" or
|
||||
* sangoma_ctime() for interpretation of this timestamp.
|
||||
*
|
||||
*/
|
||||
|
||||
static __inline int wan_get_timestamp(wan_time_t *sec, wan_suseconds_t *usec)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
|
@ -1046,8 +1050,9 @@ static __inline int wan_get_timestamp(wan_time_t *sec, wan_suseconds_t *usec)
|
|||
return 0;
|
||||
#elif defined(__WINDOWS__)
|
||||
struct timeval tv;
|
||||
wp_time(&tv.tv_sec);/* number of seconds elapsed since midnight (00:00:00), January 1, 1970 */
|
||||
tv.tv_usec = WAN_TICKS_TO_MICROSECONDS();
|
||||
wp_time(&tv.tv_sec); /* number of seconds elapsed since
|
||||
* midnight (00:00:00), January 1, 1970 */
|
||||
tv.tv_usec = get_milliseconds_in_current_second() * 1000;
|
||||
if (sec) *sec = tv.tv_sec;
|
||||
if (usec) *usec = tv.tv_usec;
|
||||
return 0;
|
||||
|
@ -1157,20 +1162,28 @@ wan_add_timer(wan_timer_t* wan_timer, unsigned long delay)
|
|||
wan_timer->timer_func,
|
||||
wan_timer->timer_arg);
|
||||
#elif defined(__WINDOWS__)
|
||||
LARGE_INTEGER CurrentTime;
|
||||
LARGE_INTEGER DueTime;
|
||||
|
||||
/* The 'delay' is in SYSTEM TICKS! */
|
||||
/**********************************
|
||||
The 'delay' is in SYSTEM TICKS!
|
||||
***********************************/
|
||||
|
||||
/* 10 000 000
|
||||
* System time is a count of 100-nanosecond intervals
|
||||
* since January 1, 1601. System time is typically
|
||||
* updated approximately every ten milliseconds. (on Intel 32bit) */
|
||||
KeQuerySystemTime(&CurrentTime);
|
||||
|
||||
CurrentTime.QuadPart = CurrentTime.QuadPart + delay * KeQueryTimeIncrement();
|
||||
|
||||
KeSetTimer(&wan_timer->timer_info.Timer, CurrentTime, &wan_timer->timer_info.TimerDpcObject);
|
||||
/* KeSetTimer(): the expiration time is expressed in system
|
||||
* time units (100-nanosecond intervals).
|
||||
*
|
||||
* KeQueryTimeIncrement(): returns the number of
|
||||
* 100-nanosecond units that are added to the system time
|
||||
* each time the interval clock interrupts.
|
||||
*
|
||||
* If the value of the DueTime parameter is negative,
|
||||
* the expiration time is relative to the current system time.
|
||||
*
|
||||
* Relative expiration times are NOT affected by system time changes.
|
||||
*/
|
||||
DueTime.QuadPart = -1 * ((LONGLONG) (delay * KeQueryTimeIncrement()));
|
||||
|
||||
KeSetTimer(&wan_timer->timer_info.Timer, DueTime,
|
||||
&wan_timer->timer_info.TimerDpcObject);
|
||||
#else
|
||||
# error "wan_add_timer() function is not supported yet!"
|
||||
#endif /* linux */
|
||||
|
@ -1231,7 +1244,13 @@ static __inline void wan_skb_append(void* skbprev, void *skb, void *list)
|
|||
#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
m_cat (skbprev, skb);
|
||||
#elif defined(__WINDOWS__)
|
||||
# if WP_USE_INTERLOCKED_LIST_FUNCTIONS
|
||||
/* Interlocked function do NOT allow to insert in the middle
|
||||
* of list. */
|
||||
skb_queue_tail(skb, list);
|
||||
# else
|
||||
skb_append(skbprev,skb);
|
||||
# endif
|
||||
#else
|
||||
# error "wan_skb_append() function is not supported yet!"
|
||||
#endif
|
||||
|
@ -2893,7 +2912,11 @@ static __inline void wan_spin_unlock(void *lock, wan_smp_flag_t *flag)
|
|||
static __inline void wan_mutex_lock_init(void *lock, char *name)
|
||||
{
|
||||
#if defined(__LINUX__)
|
||||
#ifdef DEFINE_MUTEX
|
||||
mutex_init(((wan_mutexlock_t*)lock));
|
||||
#else
|
||||
spin_lock_init(((spinlock_t*)lock));
|
||||
#endif
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
/*(*(wan_smp_flag_t*)flag) = 0;*/
|
||||
#if defined(SPINLOCK_OLD)
|
||||
|
@ -2912,7 +2935,11 @@ static __inline void wan_mutex_lock(void *mutex, wan_smp_flag_t *flag /* FIXME:
|
|||
#if defined(__WINDOWS__)
|
||||
wp_mutex_lock(mutex);
|
||||
#else
|
||||
#ifdef DEFINE_MUTEX
|
||||
mutex_lock(mutex);
|
||||
#else
|
||||
spin_lock(((spinlock_t*)mutex));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2921,7 +2948,11 @@ static __inline void wan_mutex_unlock(void *mutex, wan_smp_flag_t *flag /* FIXME
|
|||
#if defined(__WINDOWS__)
|
||||
wp_mutex_unlock(mutex);
|
||||
#else
|
||||
#ifdef DEFINE_MUTEX
|
||||
mutex_unlock(mutex);
|
||||
#else
|
||||
spin_unlock(((spinlock_t*)mutex));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2930,7 +2961,11 @@ static __inline int wan_mutex_trylock(void *mutex, wan_smp_flag_t *flag /* FIXME
|
|||
#if defined(__WINDOWS__)
|
||||
return wp_mutex_trylock(mutex);
|
||||
#else
|
||||
#ifdef DEFINE_MUTEX
|
||||
return mutex_trylock(mutex);
|
||||
#else
|
||||
return spin_trylock(((spinlock_t*)mutex));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2938,7 +2973,11 @@ static __inline int wan_mutex_trylock(void *mutex, wan_smp_flag_t *flag /* FIXME
|
|||
static __inline int wan_mutex_is_locked(void *lock)
|
||||
{
|
||||
#if defined(__LINUX__)
|
||||
#ifdef DEFINE_MUTEX
|
||||
return mutex_is_locked(((wan_mutexlock_t*)lock));
|
||||
#else
|
||||
return spin_is_locked(((spinlock_t*)lock));
|
||||
#endif
|
||||
#elif defined(__WINDOWS__)
|
||||
return wp_mutex_is_locked(((wan_mutexlock_t*)lock));
|
||||
#else
|
||||
|
@ -3013,7 +3052,12 @@ static __inline void wan_write_bus_4(void *phw, void *virt, int offset, unsigned
|
|||
#define WAN_IFQ_DMA_PURGE(ifq) wan_skb_queue_purge(ifq)
|
||||
#define WAN_IFQ_ENQUEUE(ifq, skb, arg, err) wan_skb_queue_tail((ifq), (skb))
|
||||
|
||||
#if WP_USE_INTERLOCKED_LIST_FUNCTIONS
|
||||
# pragma deprecated(wan_skb_append)
|
||||
# pragma deprecated(wan_skb_unlink)
|
||||
#endif
|
||||
|
||||
#endif /* __WINDOWS__ */
|
||||
|
||||
#endif /* WAN_KERNEL */
|
||||
#endif /* __WANPIPE_COMMON_H */
|
||||
|
|
|
@ -86,6 +86,15 @@ extern void OutputLogString(const char *fmt, ...); /* Print to wanpipelog.txt (N
|
|||
# define _DEBUG_PRINT(...) printk(## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
# define DBG_BATTERY_REMOVAL DEBUG_TEST
|
||||
#else
|
||||
# if defined (__WINDOWS__)
|
||||
# define DBG_BATTERY_REMOVAL if(1)DbgPrint
|
||||
# else
|
||||
# define DBG_BATTERY_REMOVAL if(1)DEBUG_EVENT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*========================================================
|
||||
COMMON CODE
|
||||
|
@ -282,6 +291,8 @@ extern void OutputLogString(const char *fmt, ...); /* Print to wanpipelog.txt (N
|
|||
WP_DEBUG(WAN_LOGGER_BRI, SANG_LOGGER_BRI_DEFAULT, ## __VA_ARGS__)
|
||||
#define DEBUG_HFC_S0_STATES(...) \
|
||||
WP_DEBUG(WAN_LOGGER_BRI, SANG_LOGGER_BRI_HFC_S0_STATES, ## __VA_ARGS__)
|
||||
#define DEBUG_L2_TO_L1_ACTIVATION(...) \
|
||||
WP_DEBUG(WAN_LOGGER_BRI, SANG_LOGGER_BRI_L2_TO_L1_ACTIVATION, ## __VA_ARGS__)
|
||||
|
||||
/*==== End of Wanpipe Logger macro definitions ====*/
|
||||
/*=================================================*/
|
||||
|
|
|
@ -538,11 +538,15 @@ typedef void (*wan_taskq_func_t)(struct work_struct *);
|
|||
* as work queue in wanpipe_kernel.h */
|
||||
typedef struct tq_struct wan_taskq_t;
|
||||
|
||||
typedef void* virt_addr_t;
|
||||
typedef void* virt_addr_t;
|
||||
typedef unsigned long wp_phys_addr_t;
|
||||
typedef spinlock_t wan_spinlock_t;
|
||||
typedef spinlock_t wan_spinlock_t;
|
||||
#ifdef DEFINE_MUTEX
|
||||
typedef struct mutex wan_mutexlock_t;
|
||||
typedef rwlock_t wan_rwlock_t;
|
||||
#else
|
||||
typedef spinlock_t wan_mutexlock_t;
|
||||
#endif
|
||||
typedef rwlock_t wan_rwlock_t;
|
||||
typedef unsigned long wan_smp_flag_t;
|
||||
typedef unsigned long wan_rwlock_flag_t;
|
||||
|
||||
|
@ -674,6 +678,8 @@ typedef void (wan_pci_ifunc_t)(void*);
|
|||
|
||||
typedef wan_spinlock_t wan_mutexlock_t;
|
||||
|
||||
#define WAN_IOCTL_RET_TYPE int
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -94,30 +94,35 @@
|
|||
"(Unknown mode)"
|
||||
|
||||
/* Event type list */
|
||||
#define WAN_EVENT_EC_DTMF 0x0001 /* WAN_EVENT_EC_TONE_DTMF */
|
||||
#define WAN_EVENT_RM_POWER 0x0002
|
||||
#define WAN_EVENT_RM_LC 0x0003
|
||||
#define WAN_EVENT_RM_RING_TRIP 0x0004
|
||||
#define WAN_EVENT_RM_DTMF 0x0005
|
||||
#define WAN_EVENT_TE_RBS 0x0006
|
||||
#define WAN_EVENT_RM_RING 0x0007
|
||||
#define WAN_EVENT_RM_TONE 0x0008
|
||||
#define WAN_EVENT_RM_RING_DETECT 0x0009
|
||||
#define WAN_EVENT_RM_TXSIG_START 0x000A
|
||||
#define WAN_EVENT_RM_TXSIG_OFFHOOK 0x000B
|
||||
#define WAN_EVENT_RM_TXSIG_ONHOOK 0x000C
|
||||
#define WAN_EVENT_RM_TXSIG_KEWL 0x000D
|
||||
#define WAN_EVENT_RM_ONHOOKTRANSFER 0x000E
|
||||
#define WAN_EVENT_RM_SETPOLARITY 0x000F
|
||||
#define WAN_EVENT_RM_SET_ECHOTUNE 0x0010
|
||||
#define WAN_EVENT_EC_CHAN_MODIFY 0x0011
|
||||
#define WAN_EVENT_EC_H100_REPORT 0x0012
|
||||
#define WAN_EVENT_BRI_CHAN_LOOPBACK 0x0013
|
||||
#define WAN_EVENT_LINK_STATUS 0x0014
|
||||
#define WAN_EVENT_RM_POLARITY_REVERSE 0x0016
|
||||
#define WAN_EVENT_EC_FAX_DETECT 0x0017
|
||||
#define WAN_EVENT_RM_SET_TX_GAIN 0x0018
|
||||
#define WAN_EVENT_RM_SET_RX_GAIN 0x0019
|
||||
enum {
|
||||
WAN_EVENT_EC_DTMF = 1, /* WAN_EVENT_EC_TONE_DTMF */
|
||||
WAN_EVENT_RM_POWER ,
|
||||
WAN_EVENT_RM_LC ,
|
||||
WAN_EVENT_RM_RING_TRIP ,
|
||||
WAN_EVENT_RM_DTMF ,
|
||||
WAN_EVENT_TE_RBS ,
|
||||
WAN_EVENT_RM_RING ,
|
||||
WAN_EVENT_RM_TONE ,
|
||||
WAN_EVENT_RM_RING_DETECT ,
|
||||
WAN_EVENT_RM_TXSIG_START ,
|
||||
WAN_EVENT_RM_TXSIG_OFFHOOK ,
|
||||
WAN_EVENT_RM_TXSIG_ONHOOK ,
|
||||
WAN_EVENT_RM_TXSIG_KEWL ,
|
||||
WAN_EVENT_RM_ONHOOKTRANSFER ,
|
||||
WAN_EVENT_RM_SETPOLARITY ,
|
||||
WAN_EVENT_RM_SET_ECHOTUNE ,
|
||||
WAN_EVENT_EC_CHAN_MODIFY ,
|
||||
WAN_EVENT_EC_H100_REPORT ,
|
||||
WAN_EVENT_BRI_CHAN_LOOPBACK ,
|
||||
WAN_EVENT_LINK_STATUS ,
|
||||
WAN_EVENT_RM_POLARITY_REVERSE,
|
||||
WAN_EVENT_EC_FAX_DETECT ,
|
||||
WAN_EVENT_RM_SET_TX_GAIN ,
|
||||
WAN_EVENT_RM_SET_RX_GAIN ,
|
||||
WAN_EVENT_EC_FAX_1100 ,
|
||||
WAN_EVENT_EC_FAX_2100 ,
|
||||
WAN_EVENT_EC_FAX_2100_WSPR
|
||||
};
|
||||
|
||||
|
||||
#define WAN_EVENT_TYPE_DECODE(type) \
|
||||
|
@ -144,6 +149,9 @@
|
|||
((type) == WAN_EVENT_EC_FAX_DETECT) ? "EC FAX Detect" : \
|
||||
((type) == WAN_EVENT_RM_SET_TX_GAIN) ? "RM Set Tx Gain" : \
|
||||
((type) == WAN_EVENT_RM_SET_TX_GAIN) ? "RM Set Rx Gain" : \
|
||||
((type) == WAN_EVENT_EC_FAX_1100) ? "EC FAX 1100" : \
|
||||
((type) == WAN_EVENT_EC_FAX_2100) ? "EC FAX 2100" : \
|
||||
((type) == WAN_EVENT_EC_FAX_2100_WSPR) ? "EC FAX 2100 WSPR" : \
|
||||
"(Unknown type)"
|
||||
|
||||
/* tone type list */
|
||||
|
|
|
@ -67,6 +67,18 @@
|
|||
#define WAN_DEV_NAME(device) device->dev.bus_id
|
||||
#endif
|
||||
|
||||
/////////////2.6.36/////////////////////////////
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
#define WAN_IOCTL unlocked_ioctl
|
||||
#define WAN_IOCTL_RET_TYPE long
|
||||
#define WANDEF_IOCTL_FUNC(function, struct_ptr_file, cmd, data) function(struct_ptr_file, cmd, data)
|
||||
#else
|
||||
#define WAN_IOCTL ioctl
|
||||
#define WAN_IOCTL_RET_TYPE int
|
||||
#define WANDEF_IOCTL_FUNC(function, struct_ptr_file, cmd, data) function(struct inode *inode, struct_ptr_file, cmd, data)
|
||||
#endif
|
||||
////////////////////////////////////////////////
|
||||
|
||||
/////////////2.6.35//////////////////////////////
|
||||
#ifndef netdev_mc_count
|
||||
# define netdev_mc_count(dev) dev->mc_count
|
||||
|
@ -220,12 +232,9 @@ typedef int (wan_get_info_t)(char *, char **, off_t, int);
|
|||
#endif
|
||||
}
|
||||
|
||||
#if 1
|
||||
#ifndef MOD_INC_USE_COUNT
|
||||
#define MOD_INC_USE_COUNT try_module_get(THIS_MODULE)
|
||||
#define MOD_DEC_USE_COUNT module_put(THIS_MODULE)
|
||||
#else
|
||||
#define MOD_INC_USE_COUNT
|
||||
#define MOD_DEC_USE_COUNT
|
||||
#endif
|
||||
|
||||
#define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) {\
|
||||
|
|
|
@ -292,7 +292,7 @@ typedef struct wplip_dev{
|
|||
unsigned long magic;
|
||||
WAN_LIST_ENTRY(wplip_dev) list_entry;
|
||||
|
||||
unsigned short critical;
|
||||
wan_bitmap_t critical;
|
||||
|
||||
/* Internal control information */
|
||||
wan_skb_queue_t tx_queue;
|
||||
|
@ -427,7 +427,7 @@ typedef struct wplip_prot_iface
|
|||
/* Function Prototypes */
|
||||
|
||||
/* wanpipe_lip_iface.c */
|
||||
extern unsigned char wplip_link_num[];
|
||||
extern wan_bitmap_t wplip_link_num[];
|
||||
extern wan_rwlock_t wplip_link_lock;
|
||||
extern struct wplip_link_list list_head_link;
|
||||
extern int wplip_data_rx_up(wplip_dev_t* lip_dev, void *skb);
|
||||
|
|
|
@ -138,13 +138,15 @@ enum wp_fe_logger_level{
|
|||
/* BRI */
|
||||
enum wp_bri_logger_level{
|
||||
SANG_LOGGER_BRI_DEFAULT = (1),
|
||||
SANG_LOGGER_BRI_HFC_S0_STATES = (1 << 1)
|
||||
SANG_LOGGER_BRI_HFC_S0_STATES = (1 << 1),
|
||||
SANG_LOGGER_BRI_L2_TO_L1_ACTIVATION = (1 << 2)
|
||||
};
|
||||
|
||||
#define SANG_DECODE_BRI_LOGGER_EVENT_TYPE(bit) \
|
||||
(bit & SANG_LOGGER_BRI_DEFAULT) ? "SANG_LOGGER_BRI_DEFAULT": \
|
||||
(bit & SANG_LOGGER_BRI_HFC_S0_STATES) ? "SANG_LOGGER_BRI_HFC_S0_STATES": \
|
||||
"Invalid Bit for TE1 Logger"
|
||||
(bit & SANG_LOGGER_BRI_L2_TO_L1_ACTIVATION) ? "SANG_LOGGER_BRI_L2_TO_L1_ACTIVATION": \
|
||||
"Invalid Bit for BRI Logger"
|
||||
|
||||
|
||||
static __inline const char* wp_decode_logger_event_type(u_int32_t logger_type, u_int32_t evt_type)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define WANPIPE_COMPANY "Sangoma Technologies Inc"
|
||||
|
||||
/********** LINUX **********/
|
||||
#define WANPIPE_VERSION "3.5.18"
|
||||
#define WANPIPE_VERSION "3.5.19"
|
||||
#define WANPIPE_SUB_VERSION "0"
|
||||
#define WANPIPE_LITE_VERSION "1.1.1"
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
# define WANPIPE_VERSION_MAJOR 6 /* major upgrade */
|
||||
# define WANPIPE_VERSION_MINOR 0
|
||||
# define WANPIPE_VERSION_MINOR1 31 /* frozen feature number */
|
||||
# define WANPIPE_VERSION_MINOR1 39 /* frozen feature number */
|
||||
# define WANPIPE_VERSION_MINOR2 0 /* patch number for WANPIPE_VERSION_MINOR1 */
|
||||
|
||||
# undef VER_PRODUCTVERSION
|
||||
|
@ -50,12 +50,12 @@
|
|||
# undef VER_PRODUCTNAME_STR
|
||||
# undef VER_COMPANYNAME_STR
|
||||
|
||||
# define VER_PRODUCTVERSION 6,0,31,0
|
||||
# define VER_PRODUCTVERSION_STR "6.0.31.0"
|
||||
# define __BUILDDATE__ July 6, 2010
|
||||
# define VER_PRODUCTVERSION 6,0,39,0
|
||||
# define VER_PRODUCTVERSION_STR "6.0.39.0"
|
||||
# define __BUILDDATE__ February 11, 2011
|
||||
|
||||
# define VER_COMPANYNAME_STR "Sangoma Technologies Corporation"
|
||||
# define VER_LEGALCOPYRIGHT_YEARS "1984-2010"
|
||||
# define VER_LEGALCOPYRIGHT_YEARS "1984-2011"
|
||||
# define VER_LEGALCOPYRIGHT_STR "Copyright (c) Sangoma Technologies Corp."
|
||||
# define VER_PRODUCTNAME_STR "Sangoma WANPIPE (TM)"
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
|||
# undef WANPIPE_VERSION_BETA
|
||||
# undef WANPIPE_SUB_VERSION
|
||||
|
||||
# define WANPIPE_VERSION_Windows "6.0.31"
|
||||
# define WANPIPE_VERSION_Windows "6.0.39"
|
||||
# define WANPIPE_SUB_VERSION_Windows "0"
|
||||
# define WANPIPE_VERSION_BETA_Windows 0
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ extern int wanpipe_lip_get_if_status(void *chan, void *m);
|
|||
unsigned short wanrouter_type_trans(struct sk_buff *skb, netdevice_t *dev);
|
||||
int wanrouter_encapsulate(struct sk_buff *skb, netdevice_t *dev,unsigned short type);
|
||||
|
||||
extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
|
||||
extern WAN_IOCTL_RET_TYPE WANDEF_IOCTL_FUNC(wanrouter_ioctl, struct file *file, unsigned int cmd, unsigned long arg);
|
||||
/* Proc interface functions. These must not be called by the drivers! */
|
||||
extern int wanrouter_proc_init(void);
|
||||
extern void wanrouter_proc_cleanup(void);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue