From 4f3c0f3604de100c5902cbdbfc9cbe6ac9a22022 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 29 Dec 2021 18:29:00 +0100 Subject: [PATCH] wanpipe-3.4.7.tgz --- ChangeLog.3.4 | 36 +- Makefile | 18 + Setup | 6 +- api/libsangoma/stats.out | 51 - api/tdmapi/stats.out | 85 - deb_control/wanpipe.deb | 2 +- make.out | 2492 ------- patches/kdrivers/include/sdla_aft_te1.h | 22 +- patches/kdrivers/include/sdla_front_end.h | 58 +- patches/kdrivers/include/sdla_te1.h | 237 +- patches/kdrivers/include/sdla_te1_ds.h | 40 +- patches/kdrivers/include/wanpipe.h | 2 + patches/kdrivers/include/wanpipe_version.h | 2 +- patches/kdrivers/src/net/Module.markers | 30 - patches/kdrivers/src/net/sdla_8te1.c | 2024 ++++-- patches/kdrivers/src/net/sdla_aft_te1.c | 496 +- patches/kdrivers/src/net/sdla_tdmv.c | 83 +- patches/kdrivers/src/net/sdla_te1.c | 319 +- patches/kdrivers/src/net/wanpipe_tdm_api.c | 4 +- patches/kdrivers/wanec/Module.markers | 30 - rpmspec/wanpipe-mod.spec | 38 +- rpmspec/wanpipe-util.spec | 38 +- rpmspec/wanpipe.spec | 38 +- samples/wanrouter | 2 +- scripts/Compile.sh | 2 +- ssmg/sangoma_mgd.trunk/.svn/all-wcprops | 26 +- ssmg/sangoma_mgd.trunk/.svn/entries | 124 +- .../.svn/text-base/Makefile.svn-base | 19 +- .../.svn/text-base/call_signal.c.svn-base | 7 +- .../.svn/text-base/install.svn-base | 73 +- .../.svn/text-base/safe_sangoma.svn-base | 78 +- .../.svn/text-base/sangoma_mgd.c.svn-base | 332 +- .../sangoma_mgd.conf.sample.svn-base | 32 +- .../.svn/text-base/sangoma_mgd.h.svn-base | 58 +- .../sangoma_mgd_ip_bridge.c.svn-base | 376 + .../.svn/text-base/sigboost.h.svn-base | 1 + .../.svn/text-base/smg_ctrl.svn-base | 179 +- .../sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp | 5953 ++++++++++++++++ .../sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp | 6046 +++++++++++++++++ ssmg/sangoma_mgd.trunk/Makefile | 21 +- ssmg/sangoma_mgd.trunk/app/.svn/entries | 2 +- ssmg/sangoma_mgd.trunk/call_signal.c | 7 +- .../chan_woomera.trunk/.ast14_check | 2 +- .../chan_woomera.trunk/.ast16_check | 2 +- .../chan_woomera.trunk/.ast_src_check | 2 +- .../sangoma_mgd.trunk/chan_woomera.trunk/.log | 690 +- .../chan_woomera.trunk/.pbxdir | 2 +- .../chan_woomera.trunk/.svn/all-wcprops | 8 +- .../chan_woomera.trunk/.svn/entries | 36 +- .../.svn/text-base/Makefile.svn-base | 60 +- .../.svn/text-base/chan_woomera.c.svn-base | 325 +- .../.svn/text-base/woomera.conf.svn-base | 4 +- .../.svn/tmp/tempfile.2.tmp | 5676 ++++++++++++++++ .../chan_woomera.trunk/Makefile | 60 +- .../chan_woomera.trunk/chan_woomera.c | 327 +- .../chan_woomera.trunk/chan_woomera.so | Bin 0 -> 291509 bytes .../chan_woomera.trunk/woomera.conf | 4 +- ssmg/sangoma_mgd.trunk/conf/.svn/entries | 2 +- ssmg/sangoma_mgd.trunk/conf_bri/.svn/entries | 2 +- ssmg/sangoma_mgd.trunk/install | 73 +- ssmg/sangoma_mgd.trunk/lib/.svn/entries | 2 +- .../lib/libteletone/.svn/entries | 2 +- .../lib/libteletone/src/.svn/entries | 2 +- ssmg/sangoma_mgd.trunk/rc/.svn/all-wcprops | 16 +- ssmg/sangoma_mgd.trunk/rc/.svn/entries | 38 +- .../.svn/text-base/safe_sangoma.rc.svn-base | 18 + .../rc/.svn/text-base/smg.rc.isupd.svn-base | 1 + .../.svn/text-base/smg.rc.isupd_only.svn-base | 10 + ssmg/sangoma_mgd.trunk/rc/safe_sangoma.rc | 18 + ssmg/sangoma_mgd.trunk/rc/smg.rc.isupd | 1 + ssmg/sangoma_mgd.trunk/rc/smg.rc.isupd_only | 10 + ssmg/sangoma_mgd.trunk/safe_sangoma | 78 +- ssmg/sangoma_mgd.trunk/sangoma_mgd.c | 332 +- .../sangoma_mgd.trunk/sangoma_mgd.conf.sample | 32 +- ssmg/sangoma_mgd.trunk/sangoma_mgd.h | 58 +- .../sangoma_mgd.trunk/sangoma_mgd_ip_bridge.c | 376 + .../scripts/.svn/all-wcprops | 14 +- ssmg/sangoma_mgd.trunk/scripts/.svn/entries | 32 +- .../.svn/prop-base/sig_state.sh.svn-base | 5 + .../scripts/.svn/prop-base/stats.sh.svn-base | 5 + .../.svn/text-base/sig_state.sh.svn-base | 70 + .../scripts/.svn/text-base/stats.sh.svn-base | 18 + .../scripts/callgen/.svn/entries | 2 +- .../scripts/init.d/.svn/all-wcprops | 4 +- .../scripts/init.d/.svn/entries | 14 +- .../.svn/text-base/smgss7_init_ctrl.svn-base | 74 +- .../scripts/init.d/smgss7_init_ctrl | 74 +- ssmg/sangoma_mgd.trunk/scripts/sig_state.sh | 70 + .../scripts/ss7/.svn/entries | 2 +- ssmg/sangoma_mgd.trunk/scripts/stats.sh | 18 + ssmg/sangoma_mgd.trunk/sigboost.h | 1 + ssmg/sangoma_mgd.trunk/smg_ctrl | 168 +- ssmg/sangoma_mgd.trunk/unit/.svn/entries | 2 +- ssmg/sangoma_mgd.trunk/unit/core/.svn/entries | 2 +- .../sangoma_mgd.trunk/unit/tests/.svn/entries | 2 +- .../unit/tests/1_loop/.svn/entries | 2 +- .../unit/tests/1_loop/tmp/.svn/entries | 2 +- .../unit/tests/2_loop_call/.svn/entries | 2 +- .../unit/tests/2_loop_call/tmp/.svn/entries | 2 +- util/wan_aftup/A108dm_0100_V38.BIN | Bin 402936 -> 0 bytes util/wan_aftup/A108dm_0100_V39.BIN | Bin 0 -> 402936 bytes util/wan_aftup/A200_0040_V11.BIN | Bin 212392 -> 0 bytes util/wan_aftup/A200_0040_V12.BIN | Bin 0 -> 212392 bytes util/wanpipemon/Makefile | 2 +- util/wanpipemon/aftpipemon.c | 2 +- util/wanpipemon/fe_lib.c | 198 +- util/wanpipemon/fe_lib.h | 2 +- util/wanpipemon/fe_lib.orig | 1983 ++++++ util/wanpipemon/wanpipemon.h | 4 +- 109 files changed, 25423 insertions(+), 5111 deletions(-) delete mode 100644 api/libsangoma/stats.out delete mode 100644 api/tdmapi/stats.out delete mode 100644 make.out create mode 100644 ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd_ip_bridge.c.svn-base create mode 100644 ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp create mode 100644 ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp create mode 100644 ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.2.tmp create mode 100755 ssmg/sangoma_mgd.trunk/chan_woomera.trunk/chan_woomera.so create mode 100644 ssmg/sangoma_mgd.trunk/rc/.svn/text-base/safe_sangoma.rc.svn-base create mode 100644 ssmg/sangoma_mgd.trunk/rc/.svn/text-base/smg.rc.isupd_only.svn-base create mode 100644 ssmg/sangoma_mgd.trunk/rc/safe_sangoma.rc create mode 100644 ssmg/sangoma_mgd.trunk/rc/smg.rc.isupd_only create mode 100644 ssmg/sangoma_mgd.trunk/sangoma_mgd_ip_bridge.c create mode 100644 ssmg/sangoma_mgd.trunk/scripts/.svn/prop-base/sig_state.sh.svn-base create mode 100644 ssmg/sangoma_mgd.trunk/scripts/.svn/prop-base/stats.sh.svn-base create mode 100644 ssmg/sangoma_mgd.trunk/scripts/.svn/text-base/sig_state.sh.svn-base create mode 100644 ssmg/sangoma_mgd.trunk/scripts/.svn/text-base/stats.sh.svn-base create mode 100755 ssmg/sangoma_mgd.trunk/scripts/sig_state.sh create mode 100755 ssmg/sangoma_mgd.trunk/scripts/stats.sh delete mode 100644 util/wan_aftup/A108dm_0100_V38.BIN create mode 100644 util/wan_aftup/A108dm_0100_V39.BIN delete mode 100644 util/wan_aftup/A200_0040_V11.BIN create mode 100644 util/wan_aftup/A200_0040_V12.BIN create mode 100644 util/wanpipemon/fe_lib.orig diff --git a/ChangeLog.3.4 b/ChangeLog.3.4 index 6a1fa26..70b9c5f 100644 --- a/ChangeLog.3.4 +++ b/ChangeLog.3.4 @@ -8,15 +8,37 @@ For more info visit: http://wiki.sangoma.com ------------------------------------------------------------------------------ -* Tue Sep 18 2009 Nenad Corbic - Stable - 3.4.6 -===================================================================== +* Wed Nov 05 2009 Nenad Corbic - Feature Frozen - 3.4.7 +================================================================================ + +- New A200 Firmware V12 + Fixes the fifo reporting in firmware. + +- Updated driver fifo handling so that if customer is running + older version of A200 firmware (less than V12) the fifo interrupt handling + would still work correctly. + +- Dahdi 2.2 broke Sangoma RBS support +- Fixed the free run interrupt supported on V38 firmware +- Fixed chan_woomera inbound calls on second profile +- Fixed sangoma_mgd for multiple profiles +- Updated smg +- Fixed wanpipemon LIU alarm statistics +- Updates SMG for 32T1/E1 Support +- Backporte front end OOF alarm update. + A OOF alarm counter was added so that link does not + drop on a single OOF alarm as per T1/E1 spec. + + +* Tue Sep 18 2009 Nenad Corbic - Feature Frozen - 3.4.6 +=============================================================================== - Fund a bug in Sangoma_mgd causing channel 31 in each span to fail. This bug was introduced in 3.4.5 release. -* Tue Sep 16 2009 Nenad Corbic - Stable - 3.4.5 -===================================================================== +* Tue Sep 16 2009 Nenad Corbic - Feature Frozen - 3.4.5 +=============================================================================== - New firmawre feature for A101/2/5/8: Free Run Timer Interrupt The AFT T1/E1 cards will now provide perfect timing to zatpel/dahdi @@ -35,14 +57,14 @@ For more info visit: http://wiki.sangoma.com - Updated for 2.6.30 kernel -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.4 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.4 ===================================================================== - Latest smg update in 3.4.3 broke BRI support - This is now fixed. -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.3 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.3 ===================================================================== - New firmware @@ -108,7 +130,7 @@ For more info visit: http://wiki.sangoma.com Added Asterisk Load balancing using extension information. -* Fri Apr 30 2009 Nenad Corbic - Stable - 3.4.1 +* Fri Apr 30 2009 Nenad Corbic - Feature Frozen - 3.4.1 ======================================================================= - Updated wancfg_zaptel configuration utility diff --git a/Makefile b/Makefile index 369e054..057aa09 100644 --- a/Makefile +++ b/Makefile @@ -155,6 +155,8 @@ all: cleanup_local _checkzap _checksrc all_bin_kmod all_util all_src: cleanup_local _checkzap _checksrc all_kmod all_util +all_src_ss7: cleanup_local _checkzap _checksrc all_kmod_ss7 all_util + dahdi: all_src zaptel: all_src @@ -162,6 +164,9 @@ zaptel: all_src openzap: all_src all_lib @touch .all_lib +openzap_ss7: all_src_ss7 all_lib + @touch .all_lib + tdmapi: all_src all_lib @touch .all_lib @@ -174,6 +179,14 @@ cleanup_local: all_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(WAN_DIR) EXTRA_FLAGS="$(EXTRA_CFLAGS) $(shell cat ./patches/kfeatures)" ZAPDIR=$(ZAPDIR_PRIV) ZAPHDLC=$(ZAPHDLC_PRIV) HOMEDIR=$(PWD) modules +all_kmod_ss7: _checkzap _checksrc _cleanoldwanpipe _check_kver + @if [ -e $(PWD)/ss7_build_dir ]; then \ + rm -rf $(PWD)/ss7_build_dir; \ + fi + @mkdir -p $(PWD)/ss7_build_dir + ./Setup drivers --builddir=$(PWD)/ss7_build_dir --with-linux=$(KDIR) $(ZAP_OPTS) --usr-cc=$(CC) --protocol=AFT_TE1-XMTP2 --no-zaptel-compile --noautostart --arch=$(ARCH) --silent + @eval "./patches/copy_modules.sh $(PWD)/ss7_build_dir $(WAN_DIR)" + all_bin_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver @if [ -e $(PWD)/ast_build_dir ]; then \ rm -rf $(PWD)/ast_build_dir; \ @@ -293,6 +306,11 @@ install_kmod: echo "install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}"; \ install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}; \ fi + @rm -f $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/xmtp2km.${MODTYPE} + @if [ -f $(WAN_DIR)/xmtp2km.${MODTYPE} ]; then \ + echo "install -D -m 644 $(WAN_DIR)/xmtp2km.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/xmtp2km.${MODTYPE}"; \ + install -D -m 644 $(WAN_DIR)/xmtp2km.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/xmtp2km.${MODTYPE};\ + fi @eval "./patches/rundepmod.sh" endif diff --git a/Setup b/Setup index 2a24b35..27bc98a 100755 --- a/Setup +++ b/Setup @@ -5019,7 +5019,7 @@ function install_smg_samples_ss7() if [ -f $ROOT/etc/asterisk/extensions.conf ]; then eval "grep -i outb-ss7 $ROOT/etc/asterisk/extensions.conf 2> /dev/null > /dev/null" if [ $? -ne 0 ]; then - cat $ROOT/etc/asterisk/extensions.conf ./conf_ss7/woomera_ext.conf > conf.$$ + cat $ROOT/etc/asterisk/extensions.conf ./conf/woomera_ext.conf > conf.$$ mv conf.$$ $ROOT/etc/asterisk/extensions.conf echo "Asterisk extensions.conf file updated with woomera config" else @@ -5031,7 +5031,7 @@ function install_smg_samples_ss7() if [ -f $ROOT/etc/asterisk/iax.conf ]; then eval "grep -i outb-ss7 $ROOT/etc/asterisk/iax.conf 2> /dev/null > /dev/null" if [ $? -ne 0 ]; then - cat $ROOT/etc/asterisk/iax.conf ./conf_ss7/woomera_iax.conf > conf.$$ + cat $ROOT/etc/asterisk/iax.conf ./conf/woomera_iax.conf > conf.$$ mv conf.$$ $ROOT/etc/asterisk/iax.conf echo "Asterisk iax.conf file updated with ss7 guest config" else @@ -7327,7 +7327,7 @@ KERNEL_UNAME=`uname -r` PKG_NAME=wanpipe DISTR_NAME="WANPIPE" PROD=wanrouter -PROD_VER=3.4.6 +PROD_VER=3.4.7 PROD_HOME=`pwd` META_CONF=$PROD_HOME/$PROD.rc WAN_INTR_DIR=$PROD_HOME/interfaces diff --git a/api/libsangoma/stats.out b/api/libsangoma/stats.out deleted file mode 100644 index 5a80501..0000000 --- a/api/libsangoma/stats.out +++ /dev/null @@ -1,51 +0,0 @@ -Tue Jul 21 17:44:15 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 0 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 0 -IF => w16g1 Number of receiver overrun errors: 0 -Wed Jul 22 15:50:00 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 0 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 0 -IF => w16g1 Number of receiver overrun errors: 0 -Wed Jul 22 15:50:11 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 0 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 0 -IF => w16g1 Number of receiver overrun errors: 0 diff --git a/api/tdmapi/stats.out b/api/tdmapi/stats.out deleted file mode 100644 index 29513c2..0000000 --- a/api/tdmapi/stats.out +++ /dev/null @@ -1,85 +0,0 @@ -Tue Jul 21 17:45:57 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 0 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 0 -IF => w16g1 Number of receiver overrun errors: 0 -Wed Jul 22 15:52:40 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 1 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 1 -IF => w16g1 Number of receiver overrun errors: 0 -Wed Jul 22 15:52:43 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 0 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 0 -IF => w16g1 Number of receiver overrun errors: 0 -Wed Jul 22 15:53:38 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 0 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 0 -IF => w16g1 Number of receiver overrun errors: 0 -Wed Jul 22 15:54:36 EDT 2009 -IF => w1g1 Number of receiver overrun errors: 0 -IF => w2g1 Number of receiver overrun errors: 0 -IF => w3g1 Number of receiver overrun errors: 0 -IF => w4g1 Number of receiver overrun errors: 0 -IF => w5g1 Number of receiver overrun errors: 0 -IF => w6g1 Number of receiver overrun errors: 0 -IF => w7g1 Number of receiver overrun errors: 0 -IF => w8g1 Number of receiver overrun errors: 0 -IF => w9g1 Number of receiver overrun errors: 0 -IF => w10g1 Number of receiver overrun errors: 0 -IF => w11g1 Number of receiver overrun errors: 0 -IF => w12g1 Number of receiver overrun errors: 0 -IF => w13g1 Number of receiver overrun errors: 0 -IF => w14g1 Number of receiver overrun errors: 0 -IF => w15g1 Number of receiver overrun errors: 0 -IF => w16g1 Number of receiver overrun errors: 0 diff --git a/deb_control/wanpipe.deb b/deb_control/wanpipe.deb index f2805cd..d6428b4 100644 --- a/deb_control/wanpipe.deb +++ b/deb_control/wanpipe.deb @@ -1,5 +1,5 @@ Package: wanpipe -Version: 3.4.6-0 +Version: 3.4.7-0 Section: networking Priority: optional Architecture: all diff --git a/make.out b/make.out deleted file mode 100644 index a1756bb..0000000 --- a/make.out +++ /dev/null @@ -1,2492 +0,0 @@ - - +--------- Wanpipe Build Info --------------+ - - ZAPTEL/DAHDI Support: Disabled - - +-------------------------------------------+ - -Done -make KBUILD_VERBOSE=0 -C /lib/modules/2.6.29.5-191.fc11.i586/build SUBDIRS=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net EXTRA_FLAGS=" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include/annexg -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -I/lib/modules/2.6.29.5-191.fc11.i586/build/include/linux -I/usr/src/dahdi -DWANPIPE_USE_I_PRIVATE " ZAPDIR= ZAPHDLC=/etc/wanpipe/.zaphdlc HOMEDIR=/usr/src/wanpipe-3.4.2.16 modules -make[1]: Entering directory `/usr/src/kernels/2.6.29.5-191.fc11.i586' - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../wanrouter/af_wanpipe_src.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../wanrouter/af_wanpipe_datascope.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdladrv_src.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdladrv_fe.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdladrv_utils.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../wan_aften/wan_aften_src.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../wan_aften/wanpipe_linux_iface.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/wanec_iface.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/wanec_cmd.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/wanec_utils.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/wanec_dev.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/apilib/bt/octapi_bt0.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/apilib/largmath/octapi_largmath.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/apilib/llman/octapi_llman.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../../wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_user.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdlamain.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_ft1.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_te1.o -/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_te1.c:5357: warning: ‘SetLoopBackChannel’ defined but not used - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_te3.o -/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_te3.c:1033: warning: ‘sdla_te3_set_intr’ defined but not used - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_56k.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_8te1.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_tdm_api.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_xilinx.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_aft_te1.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/aft_a104.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/aft_analog.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_aft_te3.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_utils.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_abstr.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_linux_iface.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_remora.o -/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_remora.c:475: warning: ‘wp_remora_reset_spi’ defined but not used - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_bri.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/aft_bri.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdla_serial.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_codec.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_codec_law.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_multppp.o -/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_multppp.c:3455: warning: ‘chdlc_get_config_info’ defined but not used -/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_multppp.c:3474: warning: ‘chdlc_get_status_info’ defined but not used -/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_multppp.c:3499: warning: ‘chdlc_set_dev_config’ defined but not used -/usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_multppp.c:3527: warning: ‘chdlc_set_if_info’ defined but not used - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../wanrouter/wanmain.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../wanrouter/wanproc.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/../wanrouter/waniface.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdladrv.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanrouter.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe.o - CC [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_syncppp.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/af_wanpipe.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanec.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wan_aften.o - Building modules, stage 2. - MODPOST 7 modules - CC /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/af_wanpipe.mod.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/af_wanpipe.ko - CC /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdladrv.mod.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/sdladrv.ko - CC /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wan_aften.mod.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wan_aften.ko - CC /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanec.mod.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanec.ko - CC /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe.mod.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe.ko - CC /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_syncppp.mod.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanpipe_syncppp.ko - CC /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanrouter.mod.o - LD [M] /usr/src/wanpipe-3.4.2.16/patches/kdrivers/src/net/wanrouter.ko -make[1]: Leaving directory `/usr/src/kernels/2.6.29.5-191.fc11.i586' -make -C util all EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" SYSINC="/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include" CC=cc \ - PREFIX= HOSTCFLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[1]: Entering directory `/usr/src/wanpipe-3.4.2.16/util' -make -C ft1 all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/ft1' -cc -D__LINUX__ -Wall -O2 -D_GNUC_ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -D_LINUX_ -D_DEBUG_=2 -o wanpipe_ft1exec ft1_config.c unixio.c -chmod 755 wanpipe_ft1exec -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/ft1' -make -C lxdialog all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/lxdialog' -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o lxdialog.o lxdialog.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o checklist.o checklist.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o menubox.o menubox.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o textbox.o textbox.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o yesno.o yesno.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o inputbox.o inputbox.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o util.o util.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o msgbox.o msgbox.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o text_yesno.o text_yesno.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o menubox_back.o menubox_back.c -cc -D__LINUX__ -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -O2 -fomit-frame-pointer -DLOCALE -I/include -DCURSES_LOC="" -c -o menu_text.o menu_text.c -cc -s -L . lxdialog.o checklist.o menubox.o textbox.o yesno.o inputbox.o util.o msgbox.o text_yesno.o menubox_back.o menu_text.o -lncurses -o lxdialog -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/lxdialog' -make -C sdladump all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/sdladump' -cc -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -Wall -O2 -D_DEBUG_=2 -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -o sdladump sdladump.c -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/sdladump' -make -C lib/hdlc all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/api/lib/hdlc' -cc -Wall -O2 -D__LINUX__ -D_DEBUG_=2 -D_GNUC_ -I. -c -o wanpipe_hdlc.o wanpipe_hdlc.c -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/api/lib/hdlc' -make -C wanconfig all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/wanconfig' -cc -Wall -O2 -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -D_DEBUG_=2 -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWAN_HWEC -o wanconfig wanconfig.c -wanconfig.c: In function ‘start_daemon’: -wanconfig.c:4714: warning: dereferencing type-punned pointer will break strict-aliasing rules -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/wanconfig' -make -C wanec_client all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include WANINCDIR=/usr/include/wanpipe EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/wanec_client' -bison -d -o wan_ec_argy.c wan_ec_arg.y -lex -owan_ec_argl.c wan_ec_arg.l -cc -Wall -O2 -D__LINUX__ -DCONFIG_PRODUCT_WANPIPE_TDMV_EC -D_DEBUG_=2 -D_GNUC_ -I../../patches/kdrivers/wanec -I../../patches/kdrivers/include -I../../patches/kdrivers/wanec/oct6100_api/include -I/usr/include/wanpipe -I../../patches/kdrivers/wanec/oct6100_api -I../wanec_apilib -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -o wan_ec_client wan_ecmain.c wan_ec_argy.c wan_ec_argl.c ../wanec_apilib/wanec_api.c ../wanec_apilib/wanec_api_lib.c -wan_ec_argl.c:1202: warning: ‘yyunput’ defined but not used -wan_ec_argl.c:1243: warning: ‘input’ defined but not used -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/wanec_client' -make -C wan_plxctrl all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/wan_plxctrl' -cc -Wall -O2 -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -D_DEBUG_=2 -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -o wan_plxup wan_plxup.c wan_plxctrl.c -wan_plxup.c: In function ‘exec_read_cmd’: -wan_plxup.c:152: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_plxup.c: In function ‘exec_write_cmd’: -wan_plxup.c:177: warning: dereferencing type-punned pointer will break strict-aliasing rules -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/wan_plxctrl' -make -C wan_aftup all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/wan_aftup' -cc -Wall -O2 -D__LINUX__ -D_DEBUG_=2 -lstdc++ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -o wan_aftup wan_aftup.c wan_aft_prg.c wan_aft_flash.c wan_aft_flash_shark.c wan_aft_flash_shark_ds.c wan_aft_flash_a600.c wan_pcie_ctrl.c wan_pcie_ctrl_tundra.c wan_pcie_ctrl_plx.c -wan_aftup.c: In function ‘exec_read_cmd’: -wan_aftup.c:1253: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_aftup.c:1255: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_aftup.c: In function ‘exec_write_cmd’: -wan_aftup.c:1282: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_aftup.c:1284: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_aftup.c: In function ‘exec_bridge_read_cmd’: -wan_aftup.c:1324: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_aftup.c:1326: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_aftup.c: In function ‘exec_bridge_write_cmd’: -wan_aftup.c:1353: warning: dereferencing type-punned pointer will break strict-aliasing rules -wan_aftup.c:1355: warning: dereferencing type-punned pointer will break strict-aliasing rules -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/wan_aftup' -make -C wanpipemon all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include PROTOCOL_DEFS= ENABLE_WANPIPEMON_ZAP= EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/wanpipemon' -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o wanpipemon.o wanpipemon.c -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o fpipemon.o fpipemon.c -fpipemon.c: In function ‘error_stats’: -fpipemon.c:534: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:558: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c: In function ‘list_configured_dlcis’: -fpipemon.c:687: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c: In function ‘list_active_dlcis’: -fpipemon.c:721: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c: In function ‘read_dlci_stat’: -fpipemon.c:768: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:790: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:802: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:824: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c: In function ‘list_configured_dlcis’: -fpipemon.c:695: warning: dereferencing pointer ‘wan_fr_dlci_ptr’ does break strict-aliasing rules -fpipemon.c:696: warning: dereferencing pointer ‘wan_fr_dlci_ptr’ does break strict-aliasing rules -fpipemon.c:697: warning: dereferencing pointer ‘wan_fr_dlci_ptr’ does break strict-aliasing rules -fpipemon.c:688: note: initialized from here -fpipemon.c:699: note: initialized from here -fpipemon.c: In function ‘global_stats’: -fpipemon.c:491: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:489: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:487: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:485: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:483: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:480: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:478: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:476: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:474: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:470: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:468: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:466: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:464: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:454: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:452: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:450: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:448: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:446: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:443: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:441: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:439: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:437: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:433: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:431: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:429: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:427: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:420: note: initialized from here -fpipemon.c: In function ‘FRMain’: -fpipemon.c:725: warning: dereferencing pointer ‘wan_fr_dlci_ptr’ does break strict-aliasing rules -fpipemon.c:728: warning: dereferencing pointer ‘wan_fr_dlci_ptr’ does break strict-aliasing rules -fpipemon.c:722: note: initialized from here -fpipemon.c:731: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o cpipemon.o cpipemon.c -cpipemon.c: In function ‘chdlc_router_up_time’: -cpipemon.c:1363: warning: dereferencing type-punned pointer will break strict-aliasing rules -cpipemon.c: In function ‘slarp_stats’: -cpipemon.c:805: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:804: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:801: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:800: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:798: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:797: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:796: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:792: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:790: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:788: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:786: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:784: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:782: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:779: note: initialized from here -cpipemon.c: In function ‘operational_stats’: -cpipemon.c:695: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:696: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:697: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:698: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:700: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:701: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:702: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:703: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:704: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:705: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:709: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:710: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:711: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:712: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:713: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:716: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:717: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:718: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:719: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:693: note: initialized from here -cpipemon.c: In function ‘comm_err’: -cpipemon.c:495: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:497: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:499: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:501: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:503: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:505: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:507: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:509: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:511: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -cpipemon.c:492: note: initialized from here -cpipemon.c: In function ‘CHDLCMain’: -cpipemon.c:643: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -cpipemon.c:653: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -cpipemon.c:656: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -cpipemon.c:640: note: initialized from here -cpipemon.c:594: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:596: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:597: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:599: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:590: note: initialized from here -cpipemon.c:1551: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1552: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1553: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1554: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1555: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1556: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1559: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1563: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1567: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1571: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1575: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1575: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1576: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1576: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1581: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1581: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1582: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1582: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1587: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1587: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1588: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1588: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1595: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1524: note: initialized from here -cpipemon.c:1640: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1641: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1642: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1643: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1644: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1645: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1638: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o ppipemon.o ppipemon.c -ppipemon.c: In function ‘data_packet_stats’: -ppipemon.c:885: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:885: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:883: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:883: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:881: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:881: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:879: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:879: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:877: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:877: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:875: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:875: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:873: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:873: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:871: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:871: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:868: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:866: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:864: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:857: note: initialized from here -ppipemon.c: In function ‘lcp’: -ppipemon.c:627: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:627: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:625: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:625: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:623: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:623: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:621: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:621: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:619: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:619: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:617: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:617: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:615: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:615: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:613: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:613: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:611: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:611: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:609: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:609: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:606: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:606: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:602: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:600: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:598: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:596: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:594: warning: dereferencing pointer ‘lcp_stats’ does break strict-aliasing rules -ppipemon.c:583: note: initialized from here -ppipemon.c: In function ‘ipcp’: -ppipemon.c:678: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:678: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:676: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:676: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:674: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:674: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:672: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:672: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:670: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:670: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:668: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:668: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:666: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:666: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:662: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:661: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:660: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:659: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:658: warning: dereferencing pointer ‘ipcp_stats’ does break strict-aliasing rules -ppipemon.c:647: note: initialized from here -ppipemon.c: In function ‘chap’: -ppipemon.c:831: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:831: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:830: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:830: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:829: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:829: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:828: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:828: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:825: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:824: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:823: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:822: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:821: warning: dereferencing pointer ‘chap_stats’ does break strict-aliasing rules -ppipemon.c:818: note: initialized from here -ppipemon.c: In function ‘PPPMain’: -ppipemon.c:376: warning: dereferencing pointer ‘auth’ does break strict-aliasing rules -ppipemon.c:383: warning: dereferencing pointer ‘auth’ does break strict-aliasing rules -ppipemon.c:391: warning: dereferencing pointer ‘auth’ does break strict-aliasing rules -ppipemon.c:365: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o xpipemon.o xpipemon.c -xpipemon.c: In function ‘read_x25_statistics’: -xpipemon.c:804: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:803: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:802: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:801: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:800: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:799: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:798: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:797: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:796: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:795: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:794: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:793: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:792: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:791: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:790: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:789: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:788: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:787: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:786: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:785: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:784: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:783: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:782: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:781: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:780: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:779: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:778: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:777: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:776: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:775: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:774: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:773: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:771: note: initialized from here -xpipemon.c: In function ‘x25_driver_stat_gen’: -xpipemon.c:713: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:711: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:709: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:707: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:705: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:703: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:701: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:699: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:697: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:695: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:691: note: initialized from here -xpipemon.c: In function ‘x25_driver_stat_intr’: -xpipemon.c:667: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:665: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:663: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:660: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:658: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:656: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:654: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:652: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:650: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:648: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:646: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:641: note: initialized from here -xpipemon.c:675: warning: dereferencing pointer ‘rx_int_stat’ does break strict-aliasing rules -xpipemon.c:673: warning: dereferencing pointer ‘rx_int_stat’ does break strict-aliasing rules -xpipemon.c:671: warning: dereferencing pointer ‘rx_int_stat’ does break strict-aliasing rules -xpipemon.c:642: note: initialized from here -xpipemon.c: In function ‘x25_driver_stat_ifsend’: -xpipemon.c:627: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:625: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:623: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:621: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:619: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:617: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:615: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:613: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:611: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:609: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:607: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:605: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:601: note: initialized from here -xpipemon.c: In function ‘comm_err’: -xpipemon.c:338: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:336: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:334: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:332: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:330: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:328: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:326: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:324: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:322: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:315: note: initialized from here -xpipemon.c: In function ‘read_hdlc_stat’: -xpipemon.c:275: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:273: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:271: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:269: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:267: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:265: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:263: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:261: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:259: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:257: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:255: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:253: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:251: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:249: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:247: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:245: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:243: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:236: note: initialized from here -xpipemon.c: In function ‘line_trace’: -xpipemon.c:552: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:548: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:546: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:545: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:544: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:543: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:539: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:528: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o atmpipemon.o atmpipemon.c -atmpipemon.c: In function ‘atm_router_up_time’: -atmpipemon.c:1075: warning: dereferencing type-punned pointer will break strict-aliasing rules -atmpipemon.c: In function ‘operational_stats’: -atmpipemon.c:655: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:655: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:651: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:651: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:647: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:647: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:643: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:643: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:639: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:639: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:635: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:635: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:631: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:631: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:626: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:626: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:622: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:622: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:618: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:618: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:615: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:614: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:613: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:611: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:610: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:609: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:608: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:606: note: initialized from here -atmpipemon.c: In function ‘global_stats’: -atmpipemon.c:411: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -atmpipemon.c:409: note: initialized from here -atmpipemon.c: In function ‘comm_stats’: -atmpipemon.c:463: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -atmpipemon.c:462: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -atmpipemon.c:461: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -atmpipemon.c:459: note: initialized from here -atmpipemon.c: In function ‘ATMMain’: -atmpipemon.c:1075: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -atmpipemon.c:1075: note: initialized from here -atmpipemon.c:514: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:511: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:520: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:519: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:524: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:523: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:529: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:528: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:533: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:532: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:537: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:536: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:541: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:540: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:546: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:545: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:550: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:549: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:554: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:553: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:558: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:557: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:562: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:561: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:565: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:505: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o aftpipemon.o aftpipemon.c -aftpipemon.c: In function ‘aft_read_hwec_status’: -aftpipemon.c:947: warning: dereferencing type-punned pointer will break strict-aliasing rules -aftpipemon.c: In function ‘aft_router_up_time’: -aftpipemon.c:1256: warning: dereferencing type-punned pointer will break strict-aliasing rules -aftpipemon.c: In function ‘AFTMain’: -aftpipemon.c:1379: warning: implicit declaration of function ‘get_lb_modes’ -aftpipemon.c:317: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:319: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:321: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:323: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:325: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:327: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:330: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:331: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:334: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:335: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:313: note: initialized from here -aftpipemon.c:408: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:410: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:412: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:414: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:416: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:420: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:422: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:424: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:426: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:428: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:430: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:435: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:436: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:437: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:438: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:406: note: initialized from here -aftpipemon.c:1055: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1054: note: initialized from here -aftpipemon.c:1067: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1067: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1067: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1068: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1070: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1078: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1086: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1087: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1088: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1089: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1093: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1082: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1074: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1066: note: initialized from here -aftpipemon.c:1108: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1107: note: initialized from here -aftpipemon.c:1120: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1121: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1121: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1121: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1122: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1124: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1125: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1126: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1127: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1128: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1129: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1129: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1129: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1130: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1137: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1137: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1137: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1138: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1140: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1140: warning: dereferencing pointer ‘rm_udp’ does break strict-aliasing rules -aftpipemon.c:1119: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o dslpipemon.o dslpipemon.c -dslpipemon.c: In function ‘last_failed_status’: -dslpipemon.c:364: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘router_up_time’: -dslpipemon.c:677: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘interleave_status’: -dslpipemon.c:782: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘adsl_baud_rate’: -dslpipemon.c:826: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘adsl_atm_config’: -dslpipemon.c:846: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘ADSLMain’: -dslpipemon.c:704: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:706: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:708: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:710: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:711: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:713: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:715: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:717: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:718: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:720: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:723: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:724: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:725: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:726: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:729: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:730: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:731: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:732: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:734: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:700: note: initialized from here -dslpipemon.c:638: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:638: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:642: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:642: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:634: note: initialized from here -dslpipemon.c:798: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:799: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:803: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:804: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:805: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:806: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:807: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:808: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:809: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:813: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:794: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o prot_trace.o prot_trace.c -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o ss7pipemon.o ss7pipemon.c -ss7pipemon.c: In function ‘ss7_router_up_time’: -ss7pipemon.c:822: warning: dereferencing type-punned pointer will break strict-aliasing rules -ss7pipemon.c: In function ‘global_stats’: -ss7pipemon.c:384: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -ss7pipemon.c:382: note: initialized from here -ss7pipemon.c: In function ‘comm_stats’: -ss7pipemon.c:439: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:438: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:437: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:436: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:435: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:434: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:432: note: initialized from here -ss7pipemon.c: In function ‘SS7Main’: -ss7pipemon.c:530: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -ss7pipemon.c:541: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -ss7pipemon.c:544: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -ss7pipemon.c:527: note: initialized from here -ss7pipemon.c:822: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -ss7pipemon.c:822: note: initialized from here -ss7pipemon.c:485: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:488: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:498: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:501: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:504: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:507: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:482: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o bpipemon.o bpipemon.c -bpipemon.c: In function ‘bitstrm_router_up_time’: -bpipemon.c:463: warning: dereferencing type-punned pointer will break strict-aliasing rules -bpipemon.c: In function ‘operational_stats’: -bpipemon.c:385: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:384: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:383: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:382: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:381: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:380: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:379: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:378: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:377: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:374: note: initialized from here -bpipemon.c: In function ‘global_stats’: -bpipemon.c:233: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -bpipemon.c:231: note: initialized from here -bpipemon.c: In function ‘comm_stats’: -bpipemon.c:289: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:288: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:287: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:286: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:285: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:284: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:283: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:281: note: initialized from here -bpipemon.c: In function ‘BITSTRMMain’: -bpipemon.c:339: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:344: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:348: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:351: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:356: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:336: note: initialized from here -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o fe_lib.o fe_lib.c -fe_lib.c:1563: warning: function declaration isn’t a prototype -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o xml_lib.o xml_lib.c -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o ../ft1/unixio.o ../ft1/unixio.c -cc -Wall -Wstrict-prototypes -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DWANPIPEMON_GUI -DLOCALE -DCURSES_LOC="" -DWANPIPEMON_HDLC_TRACE -I../wan_hdlc_eng/ -c -o wangui.o wangui.c -cc wanpipemon.o fpipemon.o cpipemon.o ppipemon.o xpipemon.o atmpipemon.o aftpipemon.o dslpipemon.o prot_trace.o ss7pipemon.o bpipemon.o fe_lib.o xml_lib.o ../ft1/unixio.o wangui.o ../wan_hdlc_eng/wanpipe_hdlc.o ../lxdialog/checklist.o ../lxdialog/menubox.o ../lxdialog/inputbox.o ../lxdialog/util.o -lncurses -o wanpipemon -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/wanpipemon' -make -C wanpipemon_legacy all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include PROTOCOL_DEFS= EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/wanpipemon_legacy' -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o wanpipemon_legacy.o wanpipemon_legacy.c -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o fpipemon.o fpipemon.c -fpipemon.c: In function ‘error_stats’: -fpipemon.c:654: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:678: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c: In function ‘read_dlci_stat’: -fpipemon.c:1016: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:1032: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:1042: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c:1058: warning: dereferencing type-punned pointer will break strict-aliasing rules -fpipemon.c: In function ‘fr_driver_stat_intr’: -fpipemon.c:1285: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1283: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1281: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1279: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1277: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1275: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1273: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1271: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1269: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1267: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1249: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1247: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1245: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1243: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1241: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1239: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1237: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1235: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1233: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1231: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1222: note: initialized from here -fpipemon.c:1295: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1293: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1291: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1289: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1287: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1259: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1257: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1255: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1253: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1251: warning: dereferencing pointer ‘rx_intr_stats’ does break strict-aliasing rules -fpipemon.c:1223: note: initialized from here -fpipemon.c: In function ‘fr_driver_stat_gen’: -fpipemon.c:1384: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1382: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1380: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1378: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1376: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1374: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1372: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1370: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1368: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1362: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1346: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1344: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1342: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1340: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1338: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1336: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1334: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1332: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1330: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1324: warning: dereferencing pointer ‘pipe_mgmt_stats’ does break strict-aliasing rules -fpipemon.c:1314: note: initialized from here -fpipemon.c:1392: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1390: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1388: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1386: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1354: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1352: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1350: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1348: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -fpipemon.c:1315: note: initialized from here -fpipemon.c: In function ‘read_dlci_stat’: -fpipemon.c:1016: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1016: note: initialized from here -fpipemon.c:1017: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1017: note: initialized from here -fpipemon.c:1018: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1018: note: initialized from here -fpipemon.c:1019: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1019: note: initialized from here -fpipemon.c:1020: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1020: note: initialized from here -fpipemon.c:1021: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1021: note: initialized from here -fpipemon.c:1042: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1042: note: initialized from here -fpipemon.c:1043: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1043: note: initialized from here -fpipemon.c:1044: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1044: note: initialized from here -fpipemon.c:1045: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1045: note: initialized from here -fpipemon.c:1046: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1046: note: initialized from here -fpipemon.c:1047: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -fpipemon.c:1047: note: initialized from here -fpipemon.c: In function ‘global_stats’: -fpipemon.c:613: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:611: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:609: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:607: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:605: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:602: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:600: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:598: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:596: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:592: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:590: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:588: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:586: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:576: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:574: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:572: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:570: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:568: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:565: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:563: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:561: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:559: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:555: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:553: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:551: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:549: warning: dereferencing pointer ‘link_stats’ does break strict-aliasing rules -fpipemon.c:542: note: initialized from here -fpipemon.c: In function ‘FRMain’: -fpipemon.c:1128: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1131: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1137: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1139: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1141: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1143: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1145: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1147: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1149: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1151: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1153: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1155: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1157: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1159: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1161: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1169: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1172: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1178: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1180: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1182: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1184: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1186: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1188: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1190: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1192: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1194: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1196: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1198: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1200: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1202: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -fpipemon.c:1121: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o cpipemon.o cpipemon.c -cpipemon.c: In function ‘chdlc_router_up_time’: -cpipemon.c:1023: warning: dereferencing type-punned pointer will break strict-aliasing rules -cpipemon.c: In function ‘operational_stats’: -cpipemon.c:664: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:663: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:662: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:661: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:658: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:657: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:656: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:655: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:654: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:650: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:649: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:648: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:647: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:646: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:645: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:643: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:642: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:641: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:640: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:638: note: initialized from here -cpipemon.c: In function ‘slarp_stats’: -cpipemon.c:720: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:719: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:716: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:715: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:713: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:712: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:711: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:707: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:705: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:703: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:701: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:699: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:697: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -cpipemon.c:694: note: initialized from here -cpipemon.c: In function ‘global_stats’: -cpipemon.c:390: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -cpipemon.c:388: note: initialized from here -cpipemon.c: In function ‘comm_stats’: -cpipemon.c:448: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:447: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:446: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:445: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:444: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:443: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:442: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:441: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:440: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -cpipemon.c:438: note: initialized from here -cpipemon.c: In function ‘CHDLCMain’: -cpipemon.c:606: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -cpipemon.c:616: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -cpipemon.c:619: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -cpipemon.c:603: note: initialized from here -cpipemon.c:494: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:497: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:507: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:512: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:517: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:523: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:526: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:529: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:532: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:535: warning: dereferencing pointer ‘chdlc_cfg’ does break strict-aliasing rules -cpipemon.c:491: note: initialized from here -cpipemon.c:1214: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1215: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1216: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1217: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1218: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1219: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1222: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1226: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1230: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1234: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1238: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1238: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1239: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1239: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1244: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1244: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1245: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1245: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1250: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1250: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1251: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1251: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1258: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1187: note: initialized from here -cpipemon.c:1303: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1304: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1305: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1306: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1307: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1308: warning: dereferencing pointer ‘ft1_config’ does break strict-aliasing rules -cpipemon.c:1301: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o ppipemon.o ppipemon.c -ppipemon.c: In function ‘ppp_router_up_time’: -ppipemon.c:1831: warning: dereferencing type-punned pointer will break strict-aliasing rules -ppipemon.c: In function ‘ppp_driver_stat_gen’: -ppipemon.c:1797: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1795: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1793: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1791: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1789: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1787: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1785: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1779: warning: dereferencing pointer ‘p_stat’ does break strict-aliasing rules -ppipemon.c:1775: note: initialized from here -ppipemon.c:1805: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1803: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1801: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1799: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1776: note: initialized from here -ppipemon.c: In function ‘packet’: -ppipemon.c:911: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:911: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:909: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:909: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:907: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:907: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:905: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:905: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:903: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:903: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:901: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:901: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:899: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:899: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:897: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:897: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:894: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:892: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:890: warning: dereferencing pointer ‘packet_stats’ does break strict-aliasing rules -ppipemon.c:883: note: initialized from here -ppipemon.c: In function ‘PPPMain’: -ppipemon.c:1831: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -ppipemon.c:1831: note: initialized from here -ppipemon.c:1683: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1686: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1692: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1694: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1696: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1698: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1700: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1702: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1704: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1706: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1708: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1710: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1712: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1714: warning: dereferencing pointer ‘if_stats’ does break strict-aliasing rules -ppipemon.c:1680: note: initialized from here -ppipemon.c:1734: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1736: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1738: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1740: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1742: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1744: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1746: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1748: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1758: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1760: warning: dereferencing pointer ‘g_stat’ does break strict-aliasing rules -ppipemon.c:1730: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o xpipemon.o xpipemon.c -xpipemon.c: In function ‘read_x25_statistics’: -xpipemon.c:804: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:803: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:802: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:801: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:800: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:799: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:798: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:797: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:796: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:795: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:794: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:793: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:792: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:791: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:790: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:789: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:788: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:787: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:786: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:785: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:784: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:783: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:782: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:781: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:780: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:779: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:778: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:777: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:776: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:775: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:774: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:773: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -xpipemon.c:771: note: initialized from here -xpipemon.c: In function ‘x25_driver_stat_gen’: -xpipemon.c:713: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:711: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:709: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:707: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:705: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:703: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:701: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:699: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:697: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:695: warning: dereferencing pointer ‘pipe_mgmt_stat’ does break strict-aliasing rules -xpipemon.c:691: note: initialized from here -xpipemon.c: In function ‘x25_driver_stat_intr’: -xpipemon.c:667: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:665: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:663: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:660: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:658: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:656: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:654: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:652: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:650: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:648: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:646: warning: dereferencing pointer ‘global_stat’ does break strict-aliasing rules -xpipemon.c:641: note: initialized from here -xpipemon.c:675: warning: dereferencing pointer ‘rx_int_stat’ does break strict-aliasing rules -xpipemon.c:673: warning: dereferencing pointer ‘rx_int_stat’ does break strict-aliasing rules -xpipemon.c:671: warning: dereferencing pointer ‘rx_int_stat’ does break strict-aliasing rules -xpipemon.c:642: note: initialized from here -xpipemon.c: In function ‘x25_driver_stat_ifsend’: -xpipemon.c:627: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:625: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:623: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:621: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:619: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:617: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:615: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:613: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:611: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:609: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:607: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:605: warning: dereferencing pointer ‘if_snd_stat’ does break strict-aliasing rules -xpipemon.c:601: note: initialized from here -xpipemon.c: In function ‘comm_err’: -xpipemon.c:338: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:336: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:334: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:332: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:330: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:328: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:326: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:324: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:322: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:315: note: initialized from here -xpipemon.c: In function ‘read_hdlc_stat’: -xpipemon.c:275: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:273: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:271: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:269: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:267: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:265: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:263: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:261: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:259: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:257: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:255: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:253: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:251: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:249: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:247: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:245: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:243: warning: dereferencing pointer ‘stat’ does break strict-aliasing rules -xpipemon.c:236: note: initialized from here -xpipemon.c: In function ‘line_trace’: -xpipemon.c:552: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:548: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:546: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:545: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:544: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:543: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:539: warning: dereferencing pointer ‘trace_info’ does break strict-aliasing rules -xpipemon.c:528: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o atmpipemon.o atmpipemon.c -atmpipemon.c: In function ‘atm_router_up_time’: -atmpipemon.c:1075: warning: dereferencing type-punned pointer will break strict-aliasing rules -atmpipemon.c: In function ‘operational_stats’: -atmpipemon.c:655: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:655: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:651: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:651: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:647: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:647: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:643: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:643: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:639: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:639: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:635: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:635: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:631: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:631: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:626: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:626: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:622: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:622: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:618: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:618: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:615: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:614: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:613: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:611: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:610: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:609: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:608: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -atmpipemon.c:606: note: initialized from here -atmpipemon.c: In function ‘global_stats’: -atmpipemon.c:411: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -atmpipemon.c:409: note: initialized from here -atmpipemon.c: In function ‘comm_stats’: -atmpipemon.c:463: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -atmpipemon.c:462: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -atmpipemon.c:461: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -atmpipemon.c:459: note: initialized from here -atmpipemon.c: In function ‘ATMMain’: -atmpipemon.c:1075: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -atmpipemon.c:1075: note: initialized from here -atmpipemon.c:514: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:511: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:520: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:519: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:524: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:523: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:529: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:528: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:533: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:532: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:537: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:536: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:541: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:540: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:546: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:545: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:550: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:549: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:554: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:553: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:558: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:557: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:562: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:561: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:565: warning: dereferencing pointer ‘cfg’ does break strict-aliasing rules -atmpipemon.c:505: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o aftpipemon.o aftpipemon.c -aftpipemon.c: In function ‘aft_router_up_time’: -aftpipemon.c:642: warning: dereferencing type-punned pointer will break strict-aliasing rules -aftpipemon.c: In function ‘operational_stats’: -aftpipemon.c:405: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:404: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:403: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:402: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:397: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:395: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:393: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:391: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:389: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:387: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:383: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:381: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:379: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:377: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:375: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -aftpipemon.c:373: note: initialized from here -aftpipemon.c: In function ‘comm_err_stats’: -aftpipemon.c:302: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:300: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:298: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:296: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:293: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:291: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:289: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:287: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:285: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:283: warning: dereferencing pointer ‘comm_err_stats’ does break strict-aliasing rules -aftpipemon.c:280: note: initialized from here -aftpipemon.c: In function ‘AFTMain’: -aftpipemon.c:642: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -aftpipemon.c:642: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o dslpipemon.o dslpipemon.c -dslpipemon.c: In function ‘last_failed_status’: -dslpipemon.c:361: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘router_up_time’: -dslpipemon.c:671: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘interleave_status’: -dslpipemon.c:776: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘adsl_baud_rate’: -dslpipemon.c:820: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘adsl_atm_config’: -dslpipemon.c:840: warning: dereferencing type-punned pointer will break strict-aliasing rules -dslpipemon.c: In function ‘ADSLMain’: -dslpipemon.c:698: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:700: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:702: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:704: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:705: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:707: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:709: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:711: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:712: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:714: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:717: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:718: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:719: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:720: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:723: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:724: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:725: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:726: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:728: warning: dereferencing pointer ‘adsl_cfg’ does break strict-aliasing rules -dslpipemon.c:694: note: initialized from here -dslpipemon.c:632: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:632: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:636: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:636: warning: dereferencing pointer ‘adsl_failures’ does break strict-aliasing rules -dslpipemon.c:628: note: initialized from here -dslpipemon.c:792: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:793: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:797: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:798: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:799: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:800: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:801: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:802: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:803: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:807: warning: dereferencing pointer ‘atm_stats’ does break strict-aliasing rules -dslpipemon.c:788: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o prot_trace.o prot_trace.c -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o ss7pipemon.o ss7pipemon.c -ss7pipemon.c: In function ‘ss7_router_up_time’: -ss7pipemon.c:824: warning: dereferencing type-punned pointer will break strict-aliasing rules -ss7pipemon.c: In function ‘global_stats’: -ss7pipemon.c:384: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -ss7pipemon.c:382: note: initialized from here -ss7pipemon.c: In function ‘comm_stats’: -ss7pipemon.c:439: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:438: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:437: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:436: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:435: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:434: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -ss7pipemon.c:432: note: initialized from here -ss7pipemon.c: In function ‘SS7Main’: -ss7pipemon.c:530: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -ss7pipemon.c:541: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -ss7pipemon.c:544: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -ss7pipemon.c:527: note: initialized from here -ss7pipemon.c:824: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -ss7pipemon.c:824: note: initialized from here -ss7pipemon.c:485: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:488: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:498: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:501: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:504: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:507: warning: dereferencing pointer ‘ss7_cfg’ does break strict-aliasing rules -ss7pipemon.c:482: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o bpipemon.o bpipemon.c -bpipemon.c: In function ‘bitstrm_router_up_time’: -bpipemon.c:463: warning: dereferencing type-punned pointer will break strict-aliasing rules -bpipemon.c: In function ‘operational_stats’: -bpipemon.c:385: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:384: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:383: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:382: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:381: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:380: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:379: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:378: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:377: warning: dereferencing pointer ‘stats’ does break strict-aliasing rules -bpipemon.c:374: note: initialized from here -bpipemon.c: In function ‘global_stats’: -bpipemon.c:233: warning: dereferencing pointer ‘global_stats’ does break strict-aliasing rules -bpipemon.c:231: note: initialized from here -bpipemon.c: In function ‘comm_stats’: -bpipemon.c:289: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:288: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:287: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:286: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:285: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:284: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:283: warning: dereferencing pointer ‘comm_stats’ does break strict-aliasing rules -bpipemon.c:281: note: initialized from here -bpipemon.c: In function ‘BITSTRMMain’: -bpipemon.c:339: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:344: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:348: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:351: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:356: warning: dereferencing pointer ‘status’ does break strict-aliasing rules -bpipemon.c:336: note: initialized from here -bpipemon.c:463: warning: dereferencing pointer ‘({anonymous})’ does break strict-aliasing rules -bpipemon.c:463: note: initialized from here -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o fe_lib.o fe_lib.c -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o xml_lib.o xml_lib.c -cc -Wall -Wstrict-prototypes -D__LINUX__ -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I../ft1 -O2 -fomit-frame-pointer -DLOCALE -D_DEBUG_=2 -DCURSES_LOC="" -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -DWANPIPEMON_GUI -DLOCALE -c -o wangui.o wangui.c -cc wanpipemon_legacy.o fpipemon.o cpipemon.o ppipemon.o xpipemon.o atmpipemon.o aftpipemon.o dslpipemon.o prot_trace.o ss7pipemon.o bpipemon.o fe_lib.o xml_lib.o ../ft1/unixio.o wangui.o ../lxdialog/checklist.o ../lxdialog/menubox.o ../lxdialog/inputbox.o ../lxdialog/util.o -lncurses -o wanpipemon_legacy -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/wanpipemon_legacy' -make -C bwm all SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I /usr/src/wanpipe-3.4.2.16/api/libsangoma/include CC=cc PROTOCOL_DEFS= EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/bwm' -cc -O2 -Wall bwm.c -o wpbwm -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/bwm' -make[1]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util' -make -C util all_wancfg EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" SYSINC="/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/usr/src/wanpipe-3.4.2.16/api/libsangoma/include" CC=cc \ - PREFIX= HOSTCFLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" HOSTCFLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[1]: Entering directory `/usr/src/wanpipe-3.4.2.16/util' -make -C wancfg all CC=cc SYSINC=/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/usr/src/wanpipe-3.4.2.16/api/libsangoma/include PROTOCOL_DEFS= EXTRA_FLAGS="-I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include" ARCH=i686 -make[2]: Entering directory `/usr/src/wanpipe-3.4.2.16/util/wancfg' -cc cpp_string.cpp conf_file_reader.cpp text_box_yes_no.cpp dialog_yes_no.cpp text_box.cpp menu_base.cpp input_box.cpp dialog_base.cpp menu_main_configuration_options.cpp menu_list_existing_wanpipes.cpp menu_list_all_wanpipes.cpp menu_new_device_configuration.cpp menu_hardware_setup.cpp menu_hardware_card_type.cpp menu_select_card_type_manualy.cpp menu_hardware_serial_card_advanced_options.cpp menu_hardware_select_serial_clock_source.cpp menu_hardware_te1_card_advanced_options.cpp menu_hardware_te3_card_advanced_options.cpp menu_hardware_select_comms_port.cpp menu_te1_select_media.cpp menu_te3_select_media.cpp menu_hardware_serial_select_medium.cpp menu_s508_io_port_select.cpp menu_s508_irq_select.cpp menu_s508_memory_addr.cpp menu_te_select_line_decoding.cpp menu_te_select_framing.cpp menu_t1_lbo.cpp input_box_active_channels.cpp menu_te1_clock_mode.cpp menu_hardware_probe.cpp menu_aft_logical_channels_list.cpp input_box_number_of_logical_channels.cpp menu_aft_logical_channel_cfg.cpp net_interface_file_reader.cpp menu_advanced_pci_configuration.cpp menu_hardware_cpu_number.cpp menu_wan_channel_cfg.cpp menu_frame_relay_basic_cfg.cpp menu_frame_relay_signalling.cpp input_box_number_of_dlcis.cpp menu_frame_relay_dlci_configuration.cpp menu_frame_relay_advanced_dlci_configuration.cpp menu_frame_relay_cir_configuration.cpp menu_frame_relay_arp.cpp menu_frame_relay_manual_or_auto_dlci_cfg.cpp input_box_frame_relay_dlci_number.cpp menu_frame_relay_dlci_list.cpp menu_frame_relay_advanced_global_configuration.cpp menu_select_protocol.cpp menu_ppp_basic_cfg.cpp menu_ppp_ip_mode.cpp menu_ppp_select_authentication_protocol.cpp menu_net_interfaces_list.cpp menu_net_interface_setup.cpp menu_net_interface_ip_configuration.cpp menu_net_interface_operation_mode.cpp menu_net_interface_miscellaneous_options.cpp menu_chdlc_basic_cfg.cpp menu_chdlc_advanced_cfg.cpp menu_device_miscellaneous_options.cpp conf_file_writer.cpp menu_adsl_encapsulation.cpp menu_adsl_advanced_cfg.cpp menu_adsl_standard.cpp menu_adsl_trellis.cpp menu_adsl_coding_gain.cpp menu_adsl_rx_bin_adjust.cpp menu_adsl_framing_struct.cpp menu_adsl_exchange_type.cpp menu_adsl_clock_type.cpp wanrouter_rc_file_reader.cpp menu_wan_channel_cfg_v1.cpp menu_lapb_basic_cfg.cpp menu_atm_basic_cfg.cpp menu_atm_interface_configuration.cpp message_box.cpp menu_tdmv_law.cpp menu_e1_lbo.cpp main.cpp -Wall -O2 -D__LINUX__ -D_DEBUG_=2 -D_GNUC_ -I. -D__LINUX__ -DCONFIG_PRODUCT_WANPIPE_LIP_ATM -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/include -I/include -I/usr/include -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec -I/usr/src/wanpipe-3.4.2.16/patches/kdrivers/wanec/oct6100_api/include -lstdc++ -lncurses -o wancfg -lfl -lm -In file included from conf_file_reader.cpp:20: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp: At global scope: -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:151: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:205: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:236: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:246: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:246: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:246: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:246: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:246: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:277: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:293: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:305: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:305: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:305: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:305: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:305: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:305: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:305: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:313: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:313: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:313: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:373: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:389: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:425: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:479: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:531: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:545: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:621: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp: In member function ‘int conf_file_reader::read_devices_section(FILE*)’: -conf_file_reader.cpp:1196: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp: In member function ‘int conf_file_reader::read_interfaces_section(FILE*, objects_list*, char*, int*)’: -conf_file_reader.cpp:1581: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp: In function ‘int tokenize(char*, char**)’: -conf_file_reader.cpp:2580: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:2583: warning: deprecated conversion from string constant to ‘char*’ -conf_file_reader.cpp:2589: warning: deprecated conversion from string constant to ‘char*’ -text_box.cpp: In member function ‘void text_box::show_error_message(char*, int, char*, ...)’: -text_box.cpp:108: warning: deprecated conversion from string constant to ‘char*’ -text_box.cpp:109: warning: deprecated conversion from string constant to ‘char*’ -text_box.cpp: In member function ‘void text_box::show_help_message(char*, int, char*, ...)’: -text_box.cpp:142: warning: deprecated conversion from string constant to ‘char*’ -text_box.cpp:143: warning: deprecated conversion from string constant to ‘char*’ -menu_base.cpp: In member function ‘int menu_base::handle_selection()’: -menu_base.cpp:204: warning: deprecated conversion from string constant to ‘char*’ -input_box.cpp: In member function ‘int input_box::show(int*)’: -input_box.cpp:79: warning: deprecated conversion from string constant to ‘char*’ -menu_main_configuration_options.cpp:35: warning: deprecated conversion from string constant to ‘char*’ -menu_main_configuration_options.cpp: In member function ‘int menu_main_configuration_options::run(int*)’: -menu_main_configuration_options.cpp:73: warning: deprecated conversion from string constant to ‘char*’ -menu_main_configuration_options.cpp:73: warning: deprecated conversion from string constant to ‘char*’ -menu_list_existing_wanpipes.cpp:27: warning: deprecated conversion from string constant to ‘char*’ -menu_list_existing_wanpipes.cpp: In member function ‘int menu_list_existing_wanpipes::run(int*)’: -menu_list_existing_wanpipes.cpp:100: warning: deprecated conversion from string constant to ‘char*’ -menu_list_existing_wanpipes.cpp:125: warning: deprecated conversion from string constant to ‘char*’ -menu_list_existing_wanpipes.cpp:125: warning: deprecated conversion from string constant to ‘char*’ -menu_list_existing_wanpipes.cpp:157: warning: deprecated conversion from string constant to ‘char*’ -menu_list_all_wanpipes.cpp:31: warning: deprecated conversion from string constant to ‘char*’ -menu_list_all_wanpipes.cpp:38: warning: deprecated conversion from string constant to ‘char*’ -menu_list_all_wanpipes.cpp:39: warning: deprecated conversion from string constant to ‘char*’ -menu_list_all_wanpipes.cpp:45: warning: deprecated conversion from string constant to ‘char*’ -menu_list_all_wanpipes.cpp: In member function ‘int menu_list_all_wanpipes::run(int*)’: -menu_list_all_wanpipes.cpp:137: warning: deprecated conversion from string constant to ‘char*’ -menu_list_all_wanpipes.cpp:137: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_new_device_configuration.cpp:18: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_new_device_configuration.cpp: At global scope: -menu_new_device_configuration.cpp:56: warning: deprecated conversion from string constant to ‘char*’ -menu_new_device_configuration.cpp:62: warning: deprecated conversion from string constant to ‘char*’ -menu_new_device_configuration.cpp: In member function ‘int menu_new_device_configuration::run(int*)’: -menu_new_device_configuration.cpp:278: warning: deprecated conversion from string constant to ‘char*’ -menu_new_device_configuration.cpp:278: warning: deprecated conversion from string constant to ‘char*’ -menu_new_device_configuration.cpp:415: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_hardware_setup.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp: At global scope: -menu_hardware_setup.cpp:62: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:83: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:93: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:102: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:111: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:118: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:145: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp: In member function ‘int menu_hardware_setup::run(int*)’: -menu_hardware_setup.cpp:509: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:581: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:581: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp: In member function ‘int menu_hardware_serial_connection_type::run(int*)’: -menu_hardware_setup.cpp:1302: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:1302: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:1351: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp: In member function ‘int menu_hardware_serial_line_coding::run(int*)’: -menu_hardware_setup.cpp:1460: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:1460: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:1509: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp: In member function ‘int menu_hardware_serial_line_idle::run(int*)’: -menu_hardware_setup.cpp:1617: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:1617: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_setup.cpp:1666: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_hardware_card_type.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_card_type.cpp: At global scope: -menu_hardware_card_type.cpp:47: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_card_type.cpp: In member function ‘int menu_hardware_card_type::run(int*)’: -menu_hardware_card_type.cpp:206: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_card_type.cpp:206: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_select_card_type_manualy.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_select_card_type_manualy.cpp: At global scope: -menu_select_card_type_manualy.cpp:27: warning: deprecated conversion from string constant to ‘char*’ -menu_select_card_type_manualy.cpp: In member function ‘int menu_select_card_type_manualy::run(int*)’: -menu_select_card_type_manualy.cpp:232: warning: deprecated conversion from string constant to ‘char*’ -menu_select_card_type_manualy.cpp:232: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_card_advanced_options.cpp: In member function ‘int menu_hardware_serial_card_advanced_options::run(int*)’: -menu_hardware_serial_card_advanced_options.cpp:122: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_card_advanced_options.cpp:122: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_card_advanced_options.cpp:181: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_card_advanced_options.cpp:192: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_card_advanced_options.cpp:217: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_select_serial_clock_source.cpp: In member function ‘int menu_hardware_select_serial_clock_source::run(int*)’: -menu_hardware_select_serial_clock_source.cpp:98: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_select_serial_clock_source.cpp:98: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_select_serial_clock_source.cpp:148: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:45: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:126: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:137: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp: In member function ‘int menu_hardware_te1_card_advanced_options::run(int*)’: -menu_hardware_te1_card_advanced_options.cpp:454: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:454: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:659: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp: In member function ‘int menu_hardware_analog_card_advanced_options::run(int*)’: -menu_hardware_te1_card_advanced_options.cpp:873: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:873: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:916: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:952: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp: In member function ‘int menu_rx_slevel::run(int*)’: -menu_hardware_te1_card_advanced_options.cpp:1116: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te1_card_advanced_options.cpp:1116: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te3_card_advanced_options.cpp: In member function ‘int menu_hardware_te3_card_advanced_options::run(int*)’: -menu_hardware_te3_card_advanced_options.cpp:199: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te3_card_advanced_options.cpp:199: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te3_card_advanced_options.cpp:255: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_te3_card_advanced_options.cpp:278: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_select_comms_port.cpp: In member function ‘int menu_hardware_select_comms_port::run(int*)’: -menu_hardware_select_comms_port.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_select_comms_port.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_select_comms_port.cpp:158: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_te1_select_media.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_te1_select_media.cpp: At global scope: -menu_te1_select_media.cpp:24: warning: deprecated conversion from string constant to ‘char*’ -menu_te1_select_media.cpp: In member function ‘int menu_te1_select_media::run(int*)’: -menu_te1_select_media.cpp:103: warning: deprecated conversion from string constant to ‘char*’ -menu_te1_select_media.cpp:103: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_te3_select_media.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_te3_select_media.cpp: At global scope: -menu_te3_select_media.cpp:24: warning: deprecated conversion from string constant to ‘char*’ -menu_te3_select_media.cpp: In member function ‘int menu_te3_select_media::run(int*)’: -menu_te3_select_media.cpp:103: warning: deprecated conversion from string constant to ‘char*’ -menu_te3_select_media.cpp:103: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_select_medium.cpp: In member function ‘int menu_hardware_serial_select_medium::run(int*)’: -menu_hardware_serial_select_medium.cpp:98: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_select_medium.cpp:98: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_serial_select_medium.cpp:145: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_io_port_select.cpp: In member function ‘int menu_s508_io_port_select::run(int*)’: -menu_s508_io_port_select.cpp:75: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_io_port_select.cpp:122: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_io_port_select.cpp:122: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_irq_select.cpp: In member function ‘int menu_s508_irq_select::run(int*)’: -menu_s508_irq_select.cpp:72: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_irq_select.cpp:114: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_irq_select.cpp:114: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_memory_addr.cpp: In member function ‘int menu_s508_memory_addr::run(int*)’: -menu_s508_memory_addr.cpp:86: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_memory_addr.cpp:118: warning: deprecated conversion from string constant to ‘char*’ -menu_s508_memory_addr.cpp:118: warning: deprecated conversion from string constant to ‘char*’ -menu_te_select_line_decoding.cpp: In member function ‘int menu_te_select_line_decoding::run(int*)’: -menu_te_select_line_decoding.cpp:119: warning: deprecated conversion from string constant to ‘char*’ -menu_te_select_line_decoding.cpp:119: warning: deprecated conversion from string constant to ‘char*’ -menu_te_select_framing.cpp: In member function ‘int menu_te_select_framing::run(int*)’: -menu_te_select_framing.cpp:153: warning: deprecated conversion from string constant to ‘char*’ -menu_te_select_framing.cpp:153: warning: deprecated conversion from string constant to ‘char*’ -menu_t1_lbo.cpp: In member function ‘int menu_t1_lbo::run(int*)’: -menu_t1_lbo.cpp:136: warning: deprecated conversion from string constant to ‘char*’ -menu_t1_lbo.cpp:136: warning: deprecated conversion from string constant to ‘char*’ -input_box_active_channels.cpp: In member function ‘int input_box_active_channels::show(char*, int, char*, int*, unsigned char)’: -input_box_active_channels.cpp:59: warning: deprecated conversion from string constant to ‘char*’ -input_box_active_channels.cpp:82: warning: deprecated conversion from string constant to ‘char*’ -menu_te1_clock_mode.cpp: In member function ‘int menu_te1_clock_mode::run(int*)’: -menu_te1_clock_mode.cpp:74: warning: deprecated conversion from string constant to ‘char*’ -menu_te1_clock_mode.cpp:96: warning: deprecated conversion from string constant to ‘char*’ -menu_te1_clock_mode.cpp:96: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_hardware_probe.cpp:128: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp: At global scope: -menu_hardware_probe.cpp:130: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp:133: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp: In member function ‘int menu_hardware_probe::run(int*)’: -menu_hardware_probe.cpp:233: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp:233: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp: In member function ‘int menu_hardware_probe::hardware_probe()’: -menu_hardware_probe.cpp:308: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp:358: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp: In member function ‘int menu_hardware_probe::get_card_location_from_hwprobe_line(wandev_conf_t*, link_def_t*, char*)’: -menu_hardware_probe.cpp:722: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp: In member function ‘int menu_hardware_probe::verify_hwprobe_command_is_successfull()’: -menu_hardware_probe.cpp:898: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_probe.cpp:901: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channels_list.cpp:35: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channels_list.cpp:42: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channels_list.cpp: In member function ‘int menu_aft_logical_channels_list::run(int*)’: -menu_aft_logical_channels_list.cpp:137: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channels_list.cpp:137: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channels_list.cpp: In member function ‘int menu_aft_logical_channels_list::adjust_number_of_groups_of_channels(objects_list*, unsigned int)’: -menu_aft_logical_channels_list.cpp:347: warning: deprecated conversion from string constant to ‘char*’ -input_box_number_of_logical_channels.cpp: In member function ‘int input_box_number_of_logical_channels::show(char*, int, char*, int*)’: -input_box_number_of_logical_channels.cpp:76: warning: deprecated conversion from string constant to ‘char*’ -input_box_number_of_logical_channels.cpp:104: warning: deprecated conversion from string constant to ‘char*’ -input_box_number_of_logical_channels.cpp:110: warning: deprecated conversion from string constant to ‘char*’ -input_box_number_of_logical_channels.cpp:120: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channel_cfg.cpp:50: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channel_cfg.cpp: In member function ‘int menu_aft_logical_channel_cfg::run(int, int*, int)’: -menu_aft_logical_channel_cfg.cpp:194: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channel_cfg.cpp:249: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channel_cfg.cpp:255: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channel_cfg.cpp:323: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channel_cfg.cpp:363: warning: deprecated conversion from string constant to ‘char*’ -menu_aft_logical_channel_cfg.cpp:401: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_advanced_pci_configuration.cpp:20: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp: At global scope: -menu_advanced_pci_configuration.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:52: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp: In member function ‘int menu_advanced_pci_configuration::run(int*)’: -menu_advanced_pci_configuration.cpp:142: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:142: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:228: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:238: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:273: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:283: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:329: warning: deprecated conversion from string constant to ‘char*’ -menu_advanced_pci_configuration.cpp:339: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_hardware_cpu_number.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_cpu_number.cpp: At global scope: -menu_hardware_cpu_number.cpp:26: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_cpu_number.cpp: In member function ‘int menu_hardware_cpu_number::run(int*)’: -menu_hardware_cpu_number.cpp:108: warning: deprecated conversion from string constant to ‘char*’ -menu_hardware_cpu_number.cpp:108: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_wan_channel_cfg.cpp:29: -menu_lapb_basic_cfg.h: In member function ‘int menu_lapb_station_type::run(int)’: -menu_lapb_basic_cfg.h:101: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.h:101: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg.cpp: At global scope: -menu_wan_channel_cfg.cpp:43: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg.cpp: In member function ‘int menu_wan_channel_cfg::run(int, int*, int)’: -menu_wan_channel_cfg.cpp:265: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg.cpp:265: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg.cpp:307: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg.cpp:473: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:42: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:55: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:65: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:76: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:80: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp: In function ‘char* get_fr_signalling_str(unsigned int)’: -menu_frame_relay_basic_cfg.cpp:121: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:124: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:127: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:130: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:134: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp: In member function ‘int menu_frame_relay_basic_cfg::run(int*)’: -menu_frame_relay_basic_cfg.cpp:252: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:252: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_basic_cfg.cpp:368: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_signalling.cpp: In member function ‘int menu_frame_relay_signalling::run(int*)’: -menu_frame_relay_signalling.cpp:94: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_signalling.cpp:94: warning: deprecated conversion from string constant to ‘char*’ -input_box_number_of_dlcis.cpp: In member function ‘int input_box_number_of_dlcis::show(char*, int, char*, int*)’: -input_box_number_of_dlcis.cpp:60: warning: deprecated conversion from string constant to ‘char*’ -input_box_number_of_dlcis.cpp:86: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_configuration.cpp: In member function ‘int menu_frame_relay_DLCI_configuration::run(int*, char*)’: -menu_frame_relay_dlci_configuration.cpp:94: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_configuration.cpp:94: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_configuration.cpp:117: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_configuration.cpp:169: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_configuration.cpp:181: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_configuration.cpp:190: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_configuration.cpp: In member function ‘int menu_frame_relay_DLCI_configuration::set_dlci_number(int*, char*)’: -menu_frame_relay_dlci_configuration.cpp:272: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_dlci_configuration.cpp:38: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_dlci_configuration.cpp:47: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_dlci_configuration.cpp:66: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_dlci_configuration.cpp: In member function ‘int menu_frame_relay_advanced_dlci_configuration::run(int*)’: -menu_frame_relay_advanced_dlci_configuration.cpp:189: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_dlci_configuration.cpp:189: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_dlci_configuration.cpp:240: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_dlci_configuration.cpp:283: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_cir_configuration.cpp: In member function ‘int menu_frame_relay_cir_configuration::run(int*)’: -menu_frame_relay_cir_configuration.cpp:118: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_cir_configuration.cpp:118: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_cir_configuration.cpp:155: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_cir_configuration.cpp:164: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_arp.cpp:28: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_arp.cpp: In member function ‘int menu_frame_relay_arp::run(int*)’: -menu_frame_relay_arp.cpp:125: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_arp.cpp:125: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_arp.cpp:162: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_frame_relay_manual_or_auto_dlci_cfg.cpp:20: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_manual_or_auto_dlci_cfg.cpp: In member function ‘int menu_frame_relay_manual_or_auto_dlci_cfg::run(int*, int*, int*)’: -menu_frame_relay_manual_or_auto_dlci_cfg.cpp:81: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_manual_or_auto_dlci_cfg.cpp:81: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_manual_or_auto_dlci_cfg.cpp:105: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_manual_or_auto_dlci_cfg.cpp:143: warning: deprecated conversion from string constant to ‘char*’ -In file included from input_box_frame_relay_dlci_number.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -input_box_frame_relay_dlci_number.cpp: In member function ‘int input_box_frame_relay_DLCI_number::show(char*, int, char*, int*)’: -input_box_frame_relay_dlci_number.cpp:60: warning: deprecated conversion from string constant to ‘char*’ -input_box_frame_relay_dlci_number.cpp:86: warning: deprecated conversion from string constant to ‘char*’ -input_box_frame_relay_dlci_number.cpp:99: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_list.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_list.cpp:48: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_list.cpp: In member function ‘int menu_frame_relay_dlci_list::run(int*)’: -menu_frame_relay_dlci_list.cpp:196: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_list.cpp:196: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_dlci_list.cpp:281: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_frame_relay_advanced_global_configuration.cpp:20: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp: At global scope: -menu_frame_relay_advanced_global_configuration.cpp:37: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:44: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:51: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:58: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:65: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:72: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp: In member function ‘int menu_frame_relay_advanced_global_configuration::run(int*)’: -menu_frame_relay_advanced_global_configuration.cpp:221: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:221: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:271: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:319: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:362: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:405: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:448: warning: deprecated conversion from string constant to ‘char*’ -menu_frame_relay_advanced_global_configuration.cpp:491: warning: deprecated conversion from string constant to ‘char*’ -menu_select_protocol.cpp: In member function ‘int menu_select_protocol::run(int*)’: -menu_select_protocol.cpp:93: warning: deprecated conversion from string constant to ‘char*’ -menu_select_protocol.cpp:93: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_basic_cfg.cpp:50: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_basic_cfg.cpp:54: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_basic_cfg.cpp:73: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_basic_cfg.cpp:96: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_basic_cfg.cpp:107: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_basic_cfg.cpp: In member function ‘int menu_ppp_basic_cfg::run(int*)’: -menu_ppp_basic_cfg.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_basic_cfg.cpp:264: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_ip_mode.cpp: In member function ‘int menu_ppp_ip_mode::run(unsigned char*)’: -menu_ppp_ip_mode.cpp:57: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_ip_mode.cpp:83: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_ip_mode.cpp:83: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_select_authentication_protocol.cpp: In member function ‘int menu_ppp_select_authentication_protocol::run(int*)’: -menu_ppp_select_authentication_protocol.cpp:68: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_select_authentication_protocol.cpp:94: warning: deprecated conversion from string constant to ‘char*’ -menu_ppp_select_authentication_protocol.cpp:94: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_net_interfaces_list.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interfaces_list.cpp: At global scope: -menu_net_interfaces_list.cpp:29: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interfaces_list.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interfaces_list.cpp: In member function ‘int menu_net_interfaces_list::run(int*)’: -menu_net_interfaces_list.cpp:175: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interfaces_list.cpp:175: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_net_interface_setup.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp: At global scope: -menu_net_interface_setup.cpp:63: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:110: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:117: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:127: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:156: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp: In member function ‘int menu_net_interface_setup::run(int*)’: -menu_net_interface_setup.cpp:234: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:393: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:393: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:447: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:533: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:543: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:577: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:587: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:624: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:633: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:648: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_setup.cpp:838: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_net_interface_ip_configuration.cpp:19: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_ip_configuration.cpp: At global scope: -menu_net_interface_ip_configuration.cpp:36: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_ip_configuration.cpp:47: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_ip_configuration.cpp:64: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_ip_configuration.cpp:91: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_ip_configuration.cpp:108: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_ip_configuration.cpp: In member function ‘int menu_net_interface_ip_configuration::run(int*, net_interface_file_reader&)’: -menu_net_interface_ip_configuration.cpp:227: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_ip_configuration.cpp:227: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_operation_mode.cpp:93: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_operation_mode.cpp: In member function ‘int menu_net_interface_operation_mode::run(int*)’: -menu_net_interface_operation_mode.cpp:157: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_operation_mode.cpp:157: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_net_interface_miscellaneous_options.cpp:22: -text_box_help.h: In member function ‘int text_box_help::run()’: -text_box_help.h:70: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp: At global scope: -menu_net_interface_miscellaneous_options.cpp:39: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp:44: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp:57: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp:60: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp:84: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp: In member function ‘int menu_net_interface_miscellaneous_options::run(int*)’: -menu_net_interface_miscellaneous_options.cpp:245: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp:245: warning: deprecated conversion from string constant to ‘char*’ -menu_net_interface_miscellaneous_options.cpp:365: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_basic_cfg.cpp:36: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_basic_cfg.cpp:46: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_basic_cfg.cpp: In member function ‘int menu_chdlc_basic_cfg::run(int*)’: -menu_chdlc_basic_cfg.cpp:147: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_basic_cfg.cpp:147: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:35: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:48: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:61: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:72: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:82: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:93: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp: In member function ‘int menu_chdlc_advanced_cfg::run(int*)’: -menu_chdlc_advanced_cfg.cpp:249: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:249: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:478: warning: deprecated conversion from string constant to ‘char*’ -menu_chdlc_advanced_cfg.cpp:518: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:40: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:58: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:67: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:93: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:101: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:113: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:119: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp: In member function ‘int menu_device_miscellaneous_options::run(int*)’: -menu_device_miscellaneous_options.cpp:269: warning: deprecated conversion from string constant to ‘char*’ -menu_device_miscellaneous_options.cpp:269: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp: In member function ‘char* conf_file_writer::get_aft_lip_layer_protocol(int)’: -conf_file_writer.cpp:2864: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp:2867: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp:2870: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp:2873: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp:2876: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp:2879: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp:2883: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp: In member function ‘int conf_file_writer::form_profile_str(cpp_string&, list_element_chan_def*)’: -conf_file_writer.cpp:2891: warning: deprecated conversion from string constant to ‘char*’ -conf_file_writer.cpp:2892: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_encapsulation.cpp: In member function ‘int menu_adsl_encapsulation::run(int*)’: -menu_adsl_encapsulation.cpp:42: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_encapsulation.cpp:110: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_encapsulation.cpp:110: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:33: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:50: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:55: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:60: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp: In member function ‘int menu_adsl_advanced_cfg::run(int*)’: -menu_adsl_advanced_cfg.cpp:107: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:248: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:248: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:273: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:281: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:310: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:312: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:333: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:335: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:345: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:353: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:361: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:370: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_advanced_cfg.cpp:418: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_standard.cpp: In member function ‘int menu_adsl_standard::run(int*)’: -menu_adsl_standard.cpp:42: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_standard.cpp:122: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_standard.cpp:122: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_trellis.cpp: In member function ‘int menu_adsl_trellis::run(int*)’: -menu_adsl_trellis.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_trellis.cpp:91: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_trellis.cpp:91: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_coding_gain.cpp: In member function ‘int menu_adsl_coding_gain::run(int*)’: -menu_adsl_coding_gain.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_coding_gain.cpp:127: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_coding_gain.cpp:127: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_rx_bin_adjust.cpp: In member function ‘int menu_adsl_rx_bin_adjust::run(int*)’: -menu_adsl_rx_bin_adjust.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_rx_bin_adjust.cpp:85: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_rx_bin_adjust.cpp:85: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_framing_struct.cpp: In member function ‘int menu_adsl_framing_struct::run(int*)’: -menu_adsl_framing_struct.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_framing_struct.cpp:96: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_framing_struct.cpp:96: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_exchange_type.cpp: In member function ‘int menu_adsl_exchange_type::run(int*)’: -menu_adsl_exchange_type.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_exchange_type.cpp:85: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_exchange_type.cpp:85: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_clock_type.cpp: In member function ‘int menu_adsl_clock_type::run(int*)’: -menu_adsl_clock_type.cpp:41: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_clock_type.cpp:85: warning: deprecated conversion from string constant to ‘char*’ -menu_adsl_clock_type.cpp:85: warning: deprecated conversion from string constant to ‘char*’ -wanrouter_rc_file_reader.cpp: In constructor ‘wanrouter_rc_file_reader::wanrouter_rc_file_reader(int)’: -wanrouter_rc_file_reader.cpp:28: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg_v1.cpp: In member function ‘int menu_wan_channel_cfg_v1::run(int, int*, int)’: -menu_wan_channel_cfg_v1.cpp:209: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg_v1.cpp:209: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg_v1.cpp:249: warning: deprecated conversion from string constant to ‘char*’ -menu_wan_channel_cfg_v1.cpp:326: warning: deprecated conversion from string constant to ‘char*’ -In file included from menu_lapb_basic_cfg.cpp:21: -menu_lapb_basic_cfg.h: In member function ‘int menu_lapb_station_type::run(int)’: -menu_lapb_basic_cfg.h:101: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.h:101: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp: At global scope: -menu_lapb_basic_cfg.cpp:50: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:52: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:56: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:64: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:83: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:95: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp: In member function ‘int menu_lapb_basic_cfg::run(int*)’: -menu_lapb_basic_cfg.cpp:222: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:222: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:274: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:312: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:350: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:416: warning: deprecated conversion from string constant to ‘char*’ -menu_lapb_basic_cfg.cpp:454: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_basic_cfg.cpp:56: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_basic_cfg.cpp: In member function ‘int menu_atm_basic_cfg::run(int*)’: -menu_atm_basic_cfg.cpp:148: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_basic_cfg.cpp:148: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_basic_cfg.cpp: In member function ‘int menu_atm_basic_cfg::check_duplicate_vpi_vci_combination(objects_list*)’: -menu_atm_basic_cfg.cpp:254: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_basic_cfg.cpp:261: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_basic_cfg.cpp: In member function ‘int menu_atm_basic_cfg::get_new_number_of_interfaces(int*, int*)’: -menu_atm_basic_cfg.cpp:376: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_interface_configuration.cpp: In member function ‘int menu_atm_interface_configuration::run(int*, char*)’: -menu_atm_interface_configuration.cpp:174: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_interface_configuration.cpp:174: warning: deprecated conversion from string constant to ‘char*’ -menu_atm_interface_configuration.cpp: In member function ‘int menu_atm_interface_configuration::get_user_numeric_input(void*, char*, int, int, void*, int)’: -menu_atm_interface_configuration.cpp:457: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:97: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp: In member function ‘int menu_tdmv_law::run(int*)’: -menu_tdmv_law.cpp:148: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:170: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:170: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp: In member function ‘int menu_tdmv_opermode::run(int*)’: -menu_tdmv_law.cpp:287: warning: deprecated conversion from string constant to ‘char*’ -menu_tdmv_law.cpp:287: warning: deprecated conversion from string constant to ‘char*’ -menu_e1_lbo.cpp: In member function ‘int menu_e1_lbo::run(int*)’: -menu_e1_lbo.cpp:96: warning: deprecated conversion from string constant to ‘char*’ -menu_e1_lbo.cpp:96: warning: deprecated conversion from string constant to ‘char*’ -menu_e1_lbo.cpp: In member function ‘int menu_e1_signalling_mode::run(int*)’: -menu_e1_lbo.cpp:215: warning: deprecated conversion from string constant to ‘char*’ -menu_e1_lbo.cpp:215: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:55: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:60: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:62: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:77: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:86: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:89: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:92: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:103: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:124: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:125: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘char* get_S514_card_version_string(char)’: -main.cpp:778: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:781: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:784: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:787: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘int is_console_size_valid()’: -main.cpp:821: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘int yes_no_question(int*, char*, int, char*, ...)’: -main.cpp:1450: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘char* get_used_by_string(int)’: -main.cpp:1592: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1595: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1598: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1601: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1604: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1607: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1610: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1613: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1616: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1619: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1622: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1625: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1628: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1631: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘char* get_date_and_time()’: -main.cpp:1701: warning: deprecated conversion from string constant to ‘char*’ -main.cpp:1708: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘int read_wanrouter_rc_file()’: -main.cpp:2128: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘int main(int, char**)’: -main.cpp:2187: warning: deprecated conversion from string constant to ‘char*’ -main.cpp: In function ‘int main_loop()’: -main.cpp:2232: warning: deprecated conversion from string constant to ‘char*’ -Ok. -make[2]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util/wancfg' -make[1]: Leaving directory `/usr/src/wanpipe-3.4.2.16/util' diff --git a/patches/kdrivers/include/sdla_aft_te1.h b/patches/kdrivers/include/sdla_aft_te1.h index 5bf9f45..ce0c12c 100644 --- a/patches/kdrivers/include/sdla_aft_te1.h +++ b/patches/kdrivers/include/sdla_aft_te1.h @@ -1941,7 +1941,7 @@ typedef struct private_area aft_dma_chain_t rx_dma_chain_table; unsigned char tx_chain_indx,tx_pending_chain_indx; #else - unsigned char tx_chain_indx,tx_pending_chain_indx; + unsigned char tx_chain_indx,tx_pending_chain_indx,tx_chain_data_sz,tx_chain_sz; wan_dma_descr_t/*aft_dma_chain_t*/ tx_dma_chain_table[MAX_AFT_DMA_CHAINS]; unsigned char rx_chain_indx,rx_pending_chain_indx; @@ -2009,26 +2009,6 @@ typedef struct private_area }private_area_t; -static __inline int -aft_tx_dma_chain_chain_len(private_area_t *chan) -{ - int pending_indx=chan->tx_pending_chain_indx; - int chain_diff=0; - - if (chan->tx_chain_indx == pending_indx){ - return chain_diff; - } - - if (chan->tx_chain_indx > pending_indx){ - chain_diff = chan->tx_chain_indx - pending_indx; - }else{ - chain_diff = MAX_AFT_DMA_CHAINS-(pending_indx - chan->tx_chain_indx); - } - - return chain_diff; -} - - #if defined WANPIPE_PERFORMANCE_DEBUG #warning "WANPIPE_PERFORMANCE_DEBUG Enabled" static __inline int aft_calc_elapsed(struct timeval *started, struct timeval *ended) diff --git a/patches/kdrivers/include/sdla_front_end.h b/patches/kdrivers/include/sdla_front_end.h index 3845cdf..f549fe6 100644 --- a/patches/kdrivers/include/sdla_front_end.h +++ b/patches/kdrivers/include/sdla_front_end.h @@ -9,6 +9,13 @@ #define _SDLA_FRONT_END_H_ +# include "sdla_56k.h" +# include "sdla_te1.h" +# include "sdla_te3.h" +# include "sdla_remora.h" +# include "sdla_bri.h" +# include "sdla_serial.h" + /* ************************************************************************* * DEFINES AND MACROS * @@ -259,9 +266,18 @@ typedef struct { #define WAN_FE_LBMODE_CMD_SET 0x01 #define WAN_FE_LBMODE_CMD_GET 0x02 -#define WAN_FE_LBMODE_RC_SUCCESS 0x00 -#define WAN_FE_LBMODE_RC_PENDING 0x01 -#define WAN_FE_LBMODE_RC_FAILED 0x02 +#define WAN_FE_LBMODE_RC_SUCCESS 0x00 +#define WAN_FE_LBMODE_RC_PENDING 0x01 +#define WAN_FE_LBMODE_RC_FAILED 0x02 +#define WAN_FE_LBMODE_RC_LINKDOWN 0x03 +#define WAN_FE_LBMODE_RC_TXBUSY 0x04 +#define WAN_FE_LBMODE_RC_DECODE(rc) \ + ((rc) == WAN_FE_LBMODE_RC_SUCCESS) ? "Done" : \ + ((rc) == WAN_FE_LBMODE_RC_PENDING) ? "In progress" : \ + ((rc) == WAN_FE_LBMODE_RC_FAILED) ? "Failed" : \ + ((rc) == WAN_FE_LBMODE_RC_LINKDOWN) ? "Failed (Link Down)" : \ + ((rc) == WAN_FE_LBMODE_RC_TXBUSY) ? "Failed (Busy)" : "Internal Error" + typedef struct { u_int8_t cmd; @@ -273,11 +289,11 @@ typedef struct } sdla_fe_lbmode_t; - /* Front-End status */ -#define FE_STATUS_DECODE(fe_status) \ - (fe_status == FE_DISCONNECTED) ? "disconnected" :\ - (fe_status == FE_CONNECTED) ? "connected" : \ +#define FE_STATUS_DECODE(fe_status) \ + (fe_status == FE_UNITIALIZED) ? "unitialized" : \ + (fe_status == FE_DISCONNECTED) ? "disconnected": \ + (fe_status == FE_CONNECTED) ? "connected" : \ "unknown" #define WAN_FE_STATUS_DECODE(fe) FE_STATUS_DECODE((fe)->fe_status) @@ -308,7 +324,8 @@ typedef struct #define WAN_FE_LINENO(fe) FE_LINENO(&((fe)->fe_cfg)) #define WAN_FE_TXTRISTATE(fe) FE_TXTRISTATE(&((fe)->fe_cfg)) #define WAN_FE_TDMV_LAW(fe) FE_TDMV_LAW(&((fe)->fe_cfg)) -#define WAN_FE_NETWORK_SYNC(fe) FE_NETWORK_SYNC(&((fe)->fe_cfg)) + +#define WAN_FE_NETWORK_SYNC(fe) FE_NETWORK_SYNC(&((fe)->fe_cfg)) #define FE_MEDIA_DECODE(fe) MEDIA_DECODE(&((fe)->fe_cfg)) #define FE_LCODE_DECODE(fe) LCODE_DECODE(&((fe)->fe_cfg)) @@ -438,10 +455,18 @@ enum { AFT_LED_TOGGLE }; +typedef struct sdla_fe_swirq_ { + unsigned int pending; + unsigned char subtype; + int delay; + wan_ticks_t start; +} sdla_fe_swirq_t; + typedef struct sdla_fe_timer_event_ { unsigned char type; u_int8_t mode; int delay; + wan_ticks_t start; union{ #define te_event u_fe.te #define rm_event u_fe.rm @@ -485,6 +510,9 @@ typedef struct { WAN_LIST_HEAD(, sdla_fe_timer_event_) event; #endif unsigned int event_map; + + sdla_fe_swirq_t *swirq; + unsigned int swirq_map; int (*write_cpld)(void*, unsigned short, unsigned char); int (*read_cpld)(void*, unsigned short, unsigned char); @@ -493,13 +521,9 @@ typedef struct { int (*write_framer)(void*,unsigned short,unsigned short); unsigned int (*read_framer)(void*,unsigned short); void (*reset_fe)(void*); - WRITE_FRONT_END_REG_T *write_fe_reg; READ_FRONT_END_REG_T *read_fe_reg; READ_FRONT_END_REG_T *__read_fe_reg; -#if defined(__WINDOWS__) - int remora_modules_counter;/* set in wp_remora_config() */ -#endif } sdla_fe_t; /* @@ -520,11 +544,7 @@ typedef struct { } sdla_fe_iface_t; #endif -#if defined(__LINUX__) -# include -#elif defined(__WINDOWS__) -# include /* for wan_event_ctrl_t */ -#endif +#include "wanpipe_events.h" /* ** Sangoma Front-End interface structure (new version) @@ -568,7 +588,7 @@ typedef struct { /* Get front end media type string */ char* (*get_fe_media_string)(void); /* Set Line-loopback modes */ - int (*set_fe_lbmode)(sdla_fe_t*, unsigned char, unsigned char); + int (*set_fe_lbmode)(sdla_fe_t*, u_int8_t, u_int8_t, u_int32_t); /* Update Alarm Status for proc file system */ int (*update_alarm_info)(sdla_fe_t*, struct seq_file*, int*); /* Update PMON Status for proc file system */ @@ -599,7 +619,7 @@ typedef struct { /* Event Control */ int (*event_ctrl)(sdla_fe_t*, wan_event_ctrl_t*); /* Front-End watchdog */ - int (*watchdog)(sdla_fe_t*); + int (*watchdog)(sdla_fe_t *fe); /* Transmit ISDN BRI D-chan data */ int (*isdn_bri_dchan_tx)(sdla_fe_t*, void*, unsigned int); /* Receive ISDN BRI D-chan data */ diff --git a/patches/kdrivers/include/sdla_te1.h b/patches/kdrivers/include/sdla_te1.h index bd8179c..af1b3f8 100644 --- a/patches/kdrivers/include/sdla_te1.h +++ b/patches/kdrivers/include/sdla_te1.h @@ -75,38 +75,72 @@ #define WAN_TE_SIG_INTR 0x02 /* Framer Alarm bit mask */ -#define WAN_TE_BIT_FRAMER_ALARM_MASK 0x0000FFFF -#define WAN_TE_BIT_LIU_ALARM_MASK 0x00F00000 -#define WAN_TE_BIT_ALOS_ALARM 0x00000001 -#define WAN_TE_BIT_LOS_ALARM 0x00000002 -#define WAN_TE_BIT_ALTLOS_ALARM 0x00000004 -#define WAN_TE_BIT_OOF_ALARM 0x00000008 -#define WAN_TE_BIT_RED_ALARM 0x00000010 -#define WAN_TE_BIT_AIS_ALARM 0x00000020 -#define WAN_TE_BIT_OOSMF_ALARM 0x00000040 -#define WAN_TE_BIT_OOCMF_ALARM 0x00000080 -#define WAN_TE_BIT_OOOF_ALARM 0x00000100 -#define WAN_TE_BIT_RAI_ALARM 0x00000200 -#define WAN_TE_BIT_YEL_ALARM 0x00000400 -#define WAN_TE_BIT_LOOPUP_CODE 0x00002000 -#define WAN_TE_BIT_LOOPDOWN_CODE 0x00004000 -#define WAN_TE_BIT_LIU_ALARM 0x00100000 -#define WAN_TE_BIT_LIU_ALARM_SC 0x00200000 -#define WAN_TE_BIT_LIU_ALARM_OC 0x00400000 -#define WAN_TE_BIT_LIU_ALARM_LOS 0x00800000 +#define WAN_TE_ALARM_LIU 0x80000000 + +#define WAN_TE_ALARM_FRAMER_MASK 0x0000FFFF +#define WAN_TE_ALARM_LIU_MASK 0x00F00000 +#define WAN_TE_BIT_ALARM_ALOS 0x00000001 +#define WAN_TE_BIT_ALARM_LOS 0x00000002 +#define WAN_TE_BIT_ALARM_ALTLOS 0x00000004 +#define WAN_TE_BIT_ALARM_OOF 0x00000008 +#define WAN_TE_BIT_ALARM_RED 0x00000010 +#define WAN_TE_BIT_ALARM_AIS 0x00000020 +#define WAN_TE_BIT_ALARM_OOSMF 0x00000040 +#define WAN_TE_BIT_ALARM_OOCMF 0x00000080 +#define WAN_TE_BIT_ALARM_OOOF 0x00000100 +#define WAN_TE_BIT_ALARM_RAI 0x00000200 +#define WAN_TE_BIT_ALARM_YEL 0x00000400 +#define WAN_TE_BIT_ALARM_LOF 0x00000800 +#define WAN_TE_BIT_LOOPUP_CODE 0x00002000 +#define WAN_TE_BIT_LOOPDOWN_CODE 0x00004000 +#define WAN_TE_BIT_ALARM_LIU 0x00100000 +#define WAN_TE_BIT_ALARM_LIU_SC 0x00100000 +#define WAN_TE_BIT_ALARM_LIU_OC 0x00200000 +#define WAN_TE_BIT_ALARM_LIU_LOS 0x00400000 -#define WAN_TE_BIT_TE1_ALARM 0x8000 /* for Windows only */ #define IS_TE_ALARM(alarm, mask) (alarm & mask) -#define IS_TE_ALOS_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALOS_ALARM) -#define IS_TE_LOS_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_LOS_ALARM) -#define IS_TE_OOF_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_OOF_ALARM) -#define IS_TE_RED_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_RED_ALARM) -#define IS_TE_AIS_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_AIS_ALARM) -#define IS_TE_OOSMF_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_OOSMF_ALARM) -#define IS_TE_OOCMF_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_OOCMF_ALARM) -#define IS_TE_OOOF_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_OOOF_ALARM) -#define IS_TE_RAI_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_RAI_ALARM) -#define IS_TE_YEL_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_YEL_ALARM) +#define IS_TE_ALARM_ALOS(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_ALOS) +#define IS_TE_ALARM_LOS(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_LOS) +#define IS_TE_ALARM_OOF(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_OOF) +#define IS_TE_ALARM_LOF(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_LOF) +#define IS_TE_ALARM_RED(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_RED) +#define IS_TE_ALARM_AIS(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_AIS) +#define IS_TE_ALARM_OOSMF(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_OOSMF) +#define IS_TE_ALARM_OOCMF(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_OOCMF) +#define IS_TE_ALARM_OOOF(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_OOOF) +#define IS_TE_ALARM_RAI(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_RAI) +#define IS_TE_ALARM_YEL(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALARM_YEL) + +/* Needed for backward compatibility */ +#ifndef IS_TE_ALOS_ALARM +#define IS_TE_ALOS_ALARM IS_TE_ALARM_ALOS +#endif + +#ifndef IS_TE_LOS_ALARM +#define IS_TE_LOS_ALARM IS_TE_ALARM_LOS +#endif + +#ifndef IS_TE_RED_ALARM +#define IS_TE_RED_ALARM IS_TE_ALARM_RED +#endif + +#ifndef IS_TE_AIS_ALARM +#define IS_TE_AIS_ALARM IS_TE_ALARM_AIS +#endif + + +#ifndef IS_TE_RAI_ALARM +#define IS_TE_RAI_ALARM IS_TE_ALARM_RAI +#endif + + +#ifndef IS_TE_YEL_ALARM +#define IS_TE_YEL_ALARM IS_TE_ALARM_YEL +#endif + +#ifndef IS_TE_OOF_ALARM +#define IS_TE_OOF_ALARM IS_TE_ALARM_OOF +#endif /* Performance monitor counters bit mask */ #define WAN_TE_BIT_PMON_LCV 0x01 /* line code violation counter */ @@ -147,7 +181,7 @@ #define WAN_TE1_RX_SLEVEL_NONE 0 #define WAN_TE1_RX_SLEVEL_43_DB 430 /* 43 dB E1, RMONEN=0 */ #define WAN_TE1_RX_SLEVEL_36_DB 360 /* 36 dB T1, RMONEN=0 */ -#define WAN_TE1_RX_SLEVEL_30_DB 300 /* 30 dB RMONEN=0 | 1 */ +#define WAN_TE1_RX_SLEVEL_30_DB 300 /* 30 dB RMONEN=0 | 1 */ #define WAN_TE1_RX_SLEVEL_225_DB 225 /* 22.5 dB RMONEN=1 */ #define WAN_TE1_RX_SLEVEL_18_DB 180 /* 18 dB RMONEN=0 */ #define WAN_TE1_RX_SLEVEL_175_DB 175 /* 17.5 dB RMONEN=1 */ @@ -226,16 +260,62 @@ "Unsupported BOC" /* Interrupt polling delay */ -#define POLLING_TE1_TIMER 1000 /* 1 sec */ +#define POLLING_TE1_TIMER 1 /* 1 sec */ +#define WAN_T1_ALARM_THRESHOLD_LOF_ON (3) /* 2-3 sec */ +#define WAN_T1_ALARM_THRESHOLD_LOF_OFF (10) /* 10 sec */ +#define WAN_T1_ALARM_THRESHOLD_AIS_ON (3) // must be 2.5s +#define WAN_T1_ALARM_THRESHOLD_AIS_OFF (10) // must be 10s +#define WAN_T1_ALARM_THRESHOLD_LOS_ON (3) // must be 2.5s +#define WAN_T1_ALARM_THRESHOLD_LOS_OFF (10) // must be 10s /* TE1 critical flag */ -#define TE_TIMER_RUNNING 0x01 -#define TE_TIMER_KILL 0x02 -#define LINELB_WAITING 0x03 -#define LINELB_CODE_BIT 0x04 -#define LINELB_CHANNEL_BIT 0x05 -#define TE_CONFIGURED 0x06 -#define TE_TIMER_EVENT_PENDING 0x07 +#define TE_TIMER_RUNNING 0x01 +#define TE_TIMER_KILL 0x02 +#define LINELB_WAITING 0x03 +#define LINELB_CODE_BIT 0x04 +#define LINELB_CHANNEL_BIT 0x05 +#define TE_CONFIGURED 0x06 +#define TE_TIMER_EVENT_PENDING 0x07 +#define TE_TIMER_EVENT_INPROGRESS 0x08 + +/* TE1 sw irq types */ +enum { + WAN_TE1_SWIRQ_TYPE_NONE = 0, + + WAN_TE1_SWIRQ_TYPE_LINK, + WAN_TE1_SWIRQ_TYPE_ALARM_AIS, + WAN_TE1_SWIRQ_TYPE_ALARM_LOS, + WAN_TE1_SWIRQ_TYPE_ALARM_LOF, + + WAN_TE1_SWIRQ_MAX +}; +#define WAN_TE1_SWIRQ_TYPE_DECODE(type) \ + ((type) == WAN_TE1_SWIRQ_TYPE_LINK) ? "T1/E1 Link" : \ + ((type) == WAN_TE1_SWIRQ_TYPE_ALARM_AIS) ? "T1/E1 Alarm (AIS)" :\ + ((type) == WAN_TE1_SWIRQ_TYPE_ALARM_LOS) ? "T1/E1 Alarm (LOS)" :\ + ((type) == WAN_TE1_SWIRQ_TYPE_ALARM_LOF) ? "T1/E1 Alarm (LOF)" :\ + "Unknown" + +enum { + WAN_TE1_SWIRQ_SUBTYPE_NONE = 0, + + WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN, + WAN_TE1_SWIRQ_SUBTYPE_LINKREADY, + WAN_TE1_SWIRQ_SUBTYPE_LINKCRIT, + WAN_TE1_SWIRQ_SUBTYPE_LINKUP, + + WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF +}; +#define WAN_TE1_SWIRQ_SUBTYPE_DECODE(subtype) \ + ((subtype) == WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN) ? "Down" : \ + ((subtype) == WAN_TE1_SWIRQ_SUBTYPE_LINKREADY) ? "Ready" : \ + ((subtype) == WAN_TE1_SWIRQ_SUBTYPE_LINKCRIT) ? "Crit" : \ + ((subtype) == WAN_TE1_SWIRQ_SUBTYPE_LINKUP) ? "UP" : \ + ((subtype) == WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON) ? "activating" : \ + ((subtype) == WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF) ? "deactivating" : \ + "Unknown" + /* TE1 timer flags (polling) */ #define TE_LINELB_TIMER 0x01 @@ -255,6 +335,7 @@ #define TE_LINKCRIT_TIMER 0x0F #define WAN_TE_POLL_LINKREADY 0x10 #define WAN_TE_POLL_BERT 0x11 +#define WAN_TE_POLL_ALARM_PENDING 0x12 /* TE1 T1/E1 interrupt setting delay */ #define INTR_TE1_TIMER 150 /* 50 ms */ @@ -286,22 +367,23 @@ IS_E1_FEMEDIA(fe) ? NUM_OF_E1_CHANNELS :0) -#define WAN_TE_ALARM(alarm, bit) ((alarm) & (bit)) ? "ON" : "OFF" +#define WAN_TE_PRN_ALARM(alarm, bit) ((alarm) & (bit)) ? "ON" : "OFF" -#define WAN_TE_ALOS_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_ALOS_ALARM) -#define WAN_TE_LOS_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LOS_ALARM) -#define WAN_TE_OOF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOF_ALARM) -#define WAN_TE_RED_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_RED_ALARM) -#define WAN_TE_AIS_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_AIS_ALARM) -#define WAN_TE_OOSMF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOSMF_ALARM) -#define WAN_TE_OOCMF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOCMF_ALARM) -#define WAN_TE_OOOF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOOF_ALARM) -#define WAN_TE_RAI_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_RAI_ALARM) -#define WAN_TE_YEL_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_YEL_ALARM) +#define WAN_TE_PRN_ALARM_ALOS(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_ALOS) +#define WAN_TE_PRN_ALARM_LOS(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_LOS) +#define WAN_TE_PRN_ALARM_OOF(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_OOF) +#define WAN_TE_PRN_ALARM_LOF(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_LOF) +#define WAN_TE_PRN_ALARM_RED(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_RED) +#define WAN_TE_PRN_ALARM_AIS(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_AIS) +#define WAN_TE_PRN_ALARM_OOSMF(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_OOSMF) +#define WAN_TE_PRN_ALARM_OOCMF(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_OOCMF) +#define WAN_TE_PRN_ALARM_OOOF(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_OOOF) +#define WAN_TE_PRN_ALARM_RAI(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_RAI) +#define WAN_TE_PRN_ALARM_YEL(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_YEL) -#define WAN_TE_LIU_ALARM_SC(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LIU_ALARM_SC) -#define WAN_TE_LIU_ALARM_OC(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LIU_ALARM_OC) -#define WAN_TE_LIU_ALARM_LOS(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LIU_ALARM_LOS) +#define WAN_TE_PRN_ALARM_LIU_SC(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_LIU_SC) +#define WAN_TE_PRN_ALARM_LIU_OC(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_LIU_OC) +#define WAN_TE_PRN_ALARM_LIU_LOS(alarm) WAN_TE_PRN_ALARM(alarm, WAN_TE_BIT_ALARM_LIU_LOS) #define TECLK_DECODE(fe_cfg) \ (FE_CLK(fe_cfg) == WAN_NORMAL_CLK) ? "Normal" : \ @@ -337,6 +419,9 @@ "Unknown" /* Front-End UDP command */ + +#define WAN_FE_SET_LB_MODE WAN_FE_LB_MODE + #define WAN_FE_GET_STAT (WAN_FE_UDP_CMD_START + 0) #define WAN_FE_LB_MODE (WAN_FE_UDP_CMD_START + 1) #define WAN_FE_FLUSH_PMON (WAN_FE_UDP_CMD_START + 2) @@ -353,6 +438,7 @@ #define WAN_TE_INTR_FXS_DTMF 0x08 #define WAN_TE_INTR_PMON 0x10 + /*---------------------------------------------------------------------------- * T1/E1 configuration structures. */ @@ -394,9 +480,6 @@ typedef struct { char rxlevel[WAN_TE_RXLEVEL_LEN]; } sdla_te_stats_t; -/****************************************************************************** -** BERT definitions -**/ #define WAN_TE_BERT_CMD_NONE 0x00 #define WAN_TE_BERT_CMD_STOP 0x01 #define WAN_TE_BERT_CMD_START 0x02 @@ -539,7 +622,9 @@ typedef struct #ifdef WAN_KERNEL /* Connection status threshold */ -#define WAN_TE1_STATUS_THRESHOLD 5 +/* Original 5 +** Note (May 7 2009: We are waiting at least 10 sec anyway for other alarms */ +#define WAN_TE1_STATUS_THRESHOLD 1 #define WAN_TE1_LBO(fe) FE_LBO(&((fe)->fe_cfg)) #define WAN_TE1_CLK(fe) FE_CLK(&((fe)->fe_cfg)) @@ -640,7 +725,7 @@ typedef struct { unsigned char lb_tx_mode; unsigned char lb_tx_code; unsigned long lb_tx_cnt; - + unsigned long critical; //unsigned char timer_cmd; @@ -716,4 +801,40 @@ EXTERN int sdla_ds_te1_iface_init(void *p_fe, void *p_fe_iface); #undef EXTERN +/* Deprecated defines */ +#define WAN_TE_ALARM_MASK_FRAMER WAN_TE_ALARM_FRAMER_MASK +#define WAN_TE_ALARM_MASK_LIU WAN_TE_ALARM_LIU_MASK +#define WAN_TE_BIT_ALOS_ALARM WAN_TE_BIT_ALARM_ALOS +#define WAN_TE_BIT_LOS_ALARM WAN_TE_BIT_ALARM_LOS +#define WAN_TE_BIT_ALTLOS_ALARM WAN_TE_BIT_ALARM_ALTLOS +#define WAN_TE_BIT_OOF_ALARM WAN_TE_BIT_ALARM_OOF +#define WAN_TE_BIT_RED_ALARM WAN_TE_BIT_ALARM_RED +#define WAN_TE_BIT_AIS_ALARM WAN_TE_BIT_ALARM_AIS +#define WAN_TE_BIT_OOSMF_ALARM WAN_TE_BIT_ALARM_OOSMF +#define WAN_TE_BIT_OOCMF_ALARM WAN_TE_BIT_ALARM_OOCMF +#define WAN_TE_BIT_OOOF_ALARM WAN_TE_BIT_ALARM_OOOF +#define WAN_TE_BIT_RAI_ALARM WAN_TE_BIT_ALARM_RAI +#define WAN_TE_BIT_YEL_ALARM WAN_TE_BIT_ALARM_YEL +#define WAN_TE_BIT_LIU_ALARM WAN_TE_BIT_ALARM_LIU +#define WAN_TE_BIT_LIU_ALARM_SC WAN_TE_BIT_ALARM_LIU_SC +#define WAN_TE_BIT_LIU_ALARM_OC WAN_TE_BIT_ALARM_LIU_OC +#define WAN_TE_BIT_LIU_ALARM_LOS WAN_TE_BIT_ALARM_LIU_LOS + +#define WAN_TE_ALARM(alarm, bit) ((alarm) & (bit)) ? "ON" : "OFF" + +#define WAN_TE_ALOS_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_ALOS_ALARM) +#define WAN_TE_LOS_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LOS_ALARM) +#define WAN_TE_OOF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOF_ALARM) +#define WAN_TE_RED_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_RED_ALARM) +#define WAN_TE_AIS_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_AIS_ALARM) +#define WAN_TE_OOSMF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOSMF_ALARM) +#define WAN_TE_OOCMF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOCMF_ALARM) +#define WAN_TE_OOOF_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_OOOF_ALARM) +#define WAN_TE_RAI_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_RAI_ALARM) +#define WAN_TE_YEL_ALARM(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_YEL_ALARM) +#define WAN_TE_LIU_ALARM_SC(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LIU_ALARM_SC) +#define WAN_TE_LIU_ALARM_OC(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LIU_ALARM_OC) +#define WAN_TE_LIU_ALARM_LOS(alarm) WAN_TE_ALARM(alarm, WAN_TE_BIT_LIU_ALARM_LOS) + + #endif /* _SDLA_TE1_H */ diff --git a/patches/kdrivers/include/sdla_te1_ds.h b/patches/kdrivers/include/sdla_te1_ds.h index a393d2c..d90d4be 100644 --- a/patches/kdrivers/include/sdla_te1_ds.h +++ b/patches/kdrivers/include/sdla_te1_ds.h @@ -102,6 +102,13 @@ #define BIT_T1RCR2_RAIIE 0x02 #define BIT_T1RCR2_RD4RM 0x01 +#define REG_E1RSAIMR 0x14 +#define BIT_E1RSAIMR_Rsa4IM 0x10 +#define BIT_E1RSAIMR_Rsa5IM 0x08 +#define BIT_E1RSAIMR_Rsa6IM 0x04 +#define BIT_E1RSAIMR_Rsa7IM 0x02 +#define BIT_E1RSAIMR_Rsa8IM 0x01 + #define REG_T1RBOCC 0x15 #define BIT_T1RBOCC_RBR 0x80 #define BIT_T1RBOCC_RBD1 0x02 @@ -147,6 +154,15 @@ #define REG_E1RNAF 0x65 #define BIT_E1RNAF_A 0x20 +#define REG_SaBITS 0x6E +#define BIT_SaBITS_Sa4 0x10 +#define BIT_SaBITS_Sa5 0x08 +#define BIT_SaBITS_Sa6 0x04 +#define BIT_SaBITS_Sa7 0x02 +#define BIT_SaBITS_Sa8 0x01 + +#define REG_Sa6CODE 0x6F + #define REG_RMMR 0x80 #define BIT_RMMR_FRM_EN 0x80 #define BIT_RMMR_INIT_DONE 0x40 @@ -275,12 +291,14 @@ #define REG_RLS6 0x95 #define REG_RLS7 0x96 -#define BIT_RLS7_RRAI_CI 0x20 -#define BIT_RLS7_RAIS_CI 0x10 -#define BIT_RLS7_RSLC96 0x08 -#define BIT_RLS7_RFDLF 0x04 -#define BIT_RLS7_BC 0x02 -#define BIT_RLS7_BD 0x01 +#define BIT_RLS7_T1_RRAI_CI 0x20 +#define BIT_RLS7_T1_RAIS_CI 0x10 +#define BIT_RLS7_T1_RSLC96 0x08 +#define BIT_RLS7_T1_RFDLF 0x04 +#define BIT_RLS7_T1_BC 0x02 +#define BIT_RLS7_T1_BD 0x01 +#define BIT_RLS7_E1_Sa6CD 0x02 +#define BIT_RLS7_E1_SaXCD 0x01 #define REG_RSS1 0x98 #define BIT_RSS1_CH1 0x80 @@ -322,6 +340,9 @@ #define BIT_RSS4_CH31 0x02 #define BIT_RSS4_CH32 0x01 +#define REG_T1RSCD1 0x9C +#define REG_T1RSCD2 0x9D + #define REG_RIIR 0x9F #define BIT_RIIR_RLS7 0x40 #define BIT_RIIR_RLS6 0x20 @@ -381,8 +402,8 @@ #define BIT_RIM5_RNES 0x01 #define REG_RIM7 0xA6 -#define BIT_RIM7_RSLC96 0x08 -#define BIT_RIM7_RFDLF 0x04 +#define BIT_RIM7_T1_RSLC96 0x08 +#define BIT_RIM7_T1_RFDLF 0x04 #define BIT_RIM7_T1_BC 0x02 #define BIT_RIM7_T1_BD 0x01 @@ -636,6 +657,9 @@ ((len)==7) ? BIT_TCR4_TC1 : \ ((len)==5) ? 0x00 : (BIT_TCR4_TC1|BIT_TCR4_TC0) + + + #define REG_TXPC 0x18A #define BIT_TXPC_TBPDIR 0x04 #define BIT_TXPC_TBPFUS 0x02 diff --git a/patches/kdrivers/include/wanpipe.h b/patches/kdrivers/include/wanpipe.h index a799051..3134fdb 100644 --- a/patches/kdrivers/include/wanpipe.h +++ b/patches/kdrivers/include/wanpipe.h @@ -354,6 +354,7 @@ typedef struct { ((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'f')||\ ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'F'))?1:0) +#define AFT_A600_CARD(card) ((card)->adptr_type == AFT_ADPTR_A600) /****** Data Structures *****************************************************/ @@ -985,6 +986,7 @@ typedef struct sdla #endif unsigned char wp_debug_chan_seq; + unsigned int wp_gen_fifo_err; #if defined(WANPIPE_PERFORMANCE_DEBUG) wan_ticks_t debug_timeout; diff --git a/patches/kdrivers/include/wanpipe_version.h b/patches/kdrivers/include/wanpipe_version.h index 2bbc4ef..2461c67 100644 --- a/patches/kdrivers/include/wanpipe_version.h +++ b/patches/kdrivers/include/wanpipe_version.h @@ -6,7 +6,7 @@ #define WANPIPE_COMPANY "Sangoma Technologies Inc" /********** LINUX **********/ -#define WANPIPE_VERSION "3.4.6" +#define WANPIPE_VERSION "3.4.7" #define WANPIPE_SUB_VERSION "0" #define WANPIPE_VERSION_BETA 0 #define WANPIPE_LITE_VERSION "1.1.1" diff --git a/patches/kdrivers/src/net/Module.markers b/patches/kdrivers/src/net/Module.markers index dde2c60..e69de29 100644 --- a/patches/kdrivers/src/net/Module.markers +++ b/patches/kdrivers/src/net/Module.markers @@ -1,30 +0,0 @@ -core_marker_format vmlinux name %s format %s -ext4_allocate_blocks vmlinux dev %s block %llu flags %u len %u ino %lu logical %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu -ext4_allocate_inode vmlinux dev %s ino %lu dir %lu mode %d -ext4_da_write_begin vmlinux dev %s ino %lu pos %llu len %u flags %u -ext4_da_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -ext4_da_writepage vmlinux dev %s ino %lu page_index %lu -ext4_da_writepage_result vmlinux dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d -ext4_da_writepages vmlinux dev %s ino %lu nr_t_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d for_writepages %d range_cyclic %d -ext4_discard_blocks vmlinux dev %s blk %llu count %u -ext4_discard_preallocations vmlinux dev %s ino %lu -ext4_free_blocks vmlinux dev %s block %llu count %lu metadata %d ino %lu -ext4_free_inode vmlinux dev %s ino %lu mode %d uid %lu gid %lu bocks %llu -ext4_journalled_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -ext4_journalled_writepage vmlinux dev %s ino %lu page_index %lu -ext4_mb_discard_preallocations vmlinux dev %s needed %d -ext4_mb_new_group_pa vmlinux dev %s pstart %llu len %u lstart %u -ext4_mb_new_inode_pa vmlinux dev %s ino %lu pstart %llu len %u lstart %u -ext4_mb_release_group_pa vmlinux dev %s pstart %llu len %d -ext4_mb_release_inode_pa vmlinux dev %s ino %lu block %llu count %u -ext4_normal_writepage vmlinux dev %s ino %lu page_index %lu -ext4_ordered_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -ext4_request_blocks vmlinux dev %s flags %u len %u ino %lu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu -ext4_request_inode vmlinux dev %s dir %lu mode %d -ext4_sync_file vmlinux dev %s datasync %d ino %ld parent %ld -ext4_sync_fs vmlinux dev %s wait %d -ext4_write_begin vmlinux dev %s ino %lu pos %llu len %u flags %u -ext4_writeback_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -jbd2_checkpoint vmlinux dev %s need_checkpoint %d -jbd2_end_commit vmlinux dev %s transaction %d head %d -jbd2_start_commit vmlinux dev %s transaction %d diff --git a/patches/kdrivers/src/net/sdla_8te1.c b/patches/kdrivers/src/net/sdla_8te1.c index 41230a3..c50a8b3 100644 --- a/patches/kdrivers/src/net/sdla_8te1.c +++ b/patches/kdrivers/src/net/sdla_8te1.c @@ -69,7 +69,6 @@ /****************************************************************************** * DEFINES AND MACROS ******************************************************************************/ - #define WAN_TE1_DEVICE_ID DEVICE_ID_DS(READ_REG_LINE(0, REG_IDR)) #define CLEAR_REG(sreg,ereg) { \ @@ -128,28 +127,30 @@ (int)fe_line_no, \ (int)sdla_ds_te1_address(fe,fe_line_no,(reg))) -#define WAN_TE1_FRAMED_ALARMS (WAN_TE_BIT_RED_ALARM | WAN_TE_BIT_OOF_ALARM) +#define WAN_T1_FRAMED_ALARMS (WAN_TE_BIT_ALARM_RED | WAN_TE_BIT_ALARM_LOF) +#define WAN_E1_FRAMED_ALARMS (WAN_TE_BIT_ALARM_RED | WAN_TE_BIT_ALARM_LOF) // | WAN_TE_BIT_ALARM_LIU_LOS) /*Nov 23, 2007 UNFRM */ -#define WAN_TE1_UNFRAMED_ALARMS (WAN_TE_BIT_RED_ALARM | WAN_TE_BIT_LOS_ALARM) +#define WAN_TE1_UNFRAMED_ALARMS (WAN_TE_BIT_ALARM_RED | \ + WAN_TE_BIT_ALARM_LOS) #define IS_T1_ALARM(alarm) \ (alarm & \ ( \ - WAN_TE_BIT_RED_ALARM | \ - WAN_TE_BIT_AIS_ALARM | \ - WAN_TE_BIT_OOF_ALARM | \ - WAN_TE_BIT_LOS_ALARM | \ - WAN_TE_BIT_ALOS_ALARM \ + WAN_TE_BIT_ALARM_RED | \ + WAN_TE_BIT_ALARM_AIS | \ + WAN_TE_BIT_ALARM_LOF | \ + WAN_TE_BIT_ALARM_LOS | \ + WAN_TE_BIT_ALARM_ALOS \ )) #define IS_E1_ALARM(alarm) \ (alarm & \ ( \ - WAN_TE_BIT_RED_ALARM | \ - WAN_TE_BIT_AIS_ALARM | \ - WAN_TE_BIT_OOF_ALARM | \ - WAN_TE_BIT_LOS_ALARM | \ - WAN_TE_BIT_ALOS_ALARM \ + WAN_TE_BIT_ALARM_RED | \ + WAN_TE_BIT_ALARM_AIS | \ + WAN_TE_BIT_ALARM_OOF | \ + WAN_TE_BIT_ALARM_LOS | \ + WAN_TE_BIT_ALARM_ALOS \ )) @@ -226,12 +227,14 @@ static int sdla_ds_te1_flush_pmon(sdla_fe_t *fe); static int sdla_ds_te1_pmon(sdla_fe_t *fe, int action); static int sdla_ds_te1_rxlevel(sdla_fe_t* fe); static int sdla_ds_te1_polling(sdla_fe_t* fe); +static int sdla_ds_te1_update_alarms(sdla_fe_t*, u_int32_t); static unsigned int sdla_ds_te1_read_alarms(sdla_fe_t *fe, int read); static int sdla_ds_te1_set_alarms(sdla_fe_t* fe, u_int32_t alarms); static int sdla_ds_te1_clear_alarms(sdla_fe_t* fe, u_int32_t alarms); -static void sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms); +static int sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms); static int sdla_ds_te1_print_alarms(sdla_fe_t*, unsigned int); -static int sdla_ds_te1_set_lb(sdla_fe_t*, u_int8_t,u_int8_t); +static int sdla_ds_te1_set_lb(sdla_fe_t*, u_int8_t, u_int8_t, u_int32_t); +static int sdla_ds_te1_rbs_init(sdla_fe_t* fe); static int sdla_ds_te1_rbs_update(sdla_fe_t* fe, int, unsigned char); static int sdla_ds_te1_set_rbsbits(sdla_fe_t *fe, int, unsigned char); static int sdla_ds_te1_rbs_report(sdla_fe_t* fe); @@ -251,6 +254,11 @@ static void sdla_ds_te1_timer(IN PKDPC Dpc, void* pfe, void* arg2, void* arg3); static void sdla_ds_te1_timer(unsigned long pfe); #endif +static int sdla_ds_te1_swirq_trigger(sdla_fe_t* fe, int type, int subtype, int delay); +static int sdla_ds_te1_swirq_link(sdla_fe_t* fe); +static int sdla_ds_te1_swirq_alarm(sdla_fe_t* fe, int type); +static int sdla_ds_te1_swirq(sdla_fe_t* fe); + static int sdla_ds_te1_update_alarm_info(sdla_fe_t*, struct seq_file*, int*); static int sdla_ds_te1_update_pmon_info(sdla_fe_t*, struct seq_file*, int*); @@ -259,10 +267,14 @@ static int sdla_ds_te1_txlbcode_done(sdla_fe_t *fe); static int sdla_ds_te1_boc(sdla_fe_t *fe, int mode); static int sdla_ds_te1_liu_rlb(sdla_fe_t* fe, unsigned char cmd); static int sdla_ds_te1_fr_plb(sdla_fe_t* fe, unsigned char cmd); +static int sdla_ds_te1_pclb(sdla_fe_t*, u_int8_t, u_int32_t); static int sdla_ds_te1_bert_read_status(sdla_fe_t *fe); static int sdla_ds_te1_bert_status(sdla_fe_t *fe, sdla_te_bert_stats_t *); +static int sdla_ds_e1_sa6code(sdla_fe_t* fe); +static int sdla_ds_e1_sabits(sdla_fe_t* fe); + /****************************************************************************** * FUNCTION DEFINITIONS ******************************************************************************/ @@ -913,10 +925,8 @@ static int sdla_ds_te1_chip_config(void* pfe) WRITE_REG(REG_TMMR, 0x00); /* Enable Rx Framer */ WRITE_REG(REG_RMMR, BIT_RMMR_FRM_EN); - /* Enable Tx Framer */ WRITE_REG(REG_TMMR, BIT_TMMR_FRM_EN); - }else{ /* Clear Rx Framer soft reset */ WRITE_REG(REG_RMMR, BIT_RMMR_T1E1); @@ -924,7 +934,6 @@ static int sdla_ds_te1_chip_config(void* pfe) WRITE_REG(REG_TMMR, BIT_TMMR_T1E1); /* Enable Rx Framer */ WRITE_REG(REG_RMMR, (BIT_RMMR_FRM_EN | BIT_RMMR_T1E1)); - /* Enable Tx Framer */ WRITE_REG(REG_TMMR, (BIT_TMMR_FRM_EN | BIT_TMMR_T1E1)); } @@ -1087,26 +1096,19 @@ static int sdla_ds_te1_chip_config(void* pfe) WRITE_REG(REG_E1TSa8, 0xFF); WRITE_REG(REG_E1TSACR, 0x1F); } + + /* Enable Rx Sabit detection */ + WRITE_REG(REG_E1RSAIMR, 0x00); } // FIXME: BOC if (IS_T1_FEMEDIA(fe)){ WRITE_REG(REG_T1RBOCC, BIT_T1RBOCC_RBD0 | BIT_T1RBOCC_RBF1 | BIT_T1RBOCC_RBF0); - - WRITE_REG(REG_T1RIBCC, BIT_T1RIBCC_RUP2 | BIT_T1RIBCC_RDN1); - WRITE_REG(REG_T1RUPCD1, 0x80); - WRITE_REG(REG_T1RDNCD1, 0x80); + WRITE_REG(REG_T1RIBCC, BIT_T1RIBCC_RUP2 | BIT_T1RIBCC_RDN1); + WRITE_REG(REG_T1RUPCD1, 0x80); + WRITE_REG(REG_T1RDNCD1, 0x80); } - - - if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ - /* Set INIT_DONE (for not unframed mode) */ - value = READ_REG(REG_RMMR); - WRITE_REG(REG_RMMR, value | BIT_RMMR_INIT_DONE); - value = READ_REG(REG_TMMR); - WRITE_REG(REG_TMMR, value | BIT_TMMR_INIT_DONE); - } - + /* T1/J1 or E1 */ if (IS_T1_FEMEDIA(fe)){ WRITE_REG(REG_LTRCR, BIT_LTRCR_T1J1E1S); @@ -1270,27 +1272,25 @@ static int sdla_ds_te1_chip_config(void* pfe) } #endif + if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ + /* Set INIT_DONE (for not unframed mode) */ + value = READ_REG(REG_RMMR); + WRITE_REG(REG_RMMR, value | BIT_RMMR_INIT_DONE); + value = READ_REG(REG_TMMR); + WRITE_REG(REG_TMMR, value | BIT_TMMR_INIT_DONE); + } + /* Turn on LIU output */ if (IS_FE_TXTRISTATE(fe)){ - DEBUG_EVENT("%s: TriState Tx Mode Enabled\n", + DEBUG_EVENT("%s: Disable TX (tri-state mode)\n", fe->name); - }else{ - WRITE_REG(REG_LMCR, BIT_LMCR_TE); - } - - /* Initialize RBS bits to 1 */ - if (IS_E1_FEMEDIA(fe)) { - int i; - for (i=1; i < 16; i++) { - WRITE_REG(REG_TS1 + i, 0xFF); - } - } else { - int i; - for (i=0; i < 12; i++) { - WRITE_REG(REG_TS1 + i, 0xFF); - } + }else{ + /* Sep 17, 2009 - Auto AIS transmition (experimental) */ + WRITE_REG(REG_LMCR, BIT_LMCR_ATAIS | BIT_LMCR_TE); } + /* INIT RBS bits to 1 */ + sdla_ds_te1_rbs_init(fe); return 0; } @@ -1464,7 +1464,13 @@ static int sdla_ds_te1_config(void* pfe) sdla_ds_te1_flush_pmon(fe); - fe->fe_alarm = WAN_TE_BIT_LIU_ALARM; + fe->swirq = wan_malloc(WAN_TE1_SWIRQ_MAX*sizeof(sdla_fe_swirq_t)); + if (fe->swirq == NULL){ + DEBUG_EVENT("%s: Failed to allocate memory (%s:%d)!\n", + fe->name, __FUNCTION__, __LINE__); + return -EINVAL; + } + memset(fe->swirq, 0, WAN_TE1_SWIRQ_MAX*sizeof(sdla_fe_swirq_t)); wan_set_bit(TE_CONFIGURED,(void*)&fe->te_param.critical); @@ -1488,24 +1494,21 @@ static int sdla_ds_te1_config(void* pfe) static int sdla_ds_te1_post_init(void* pfe) { sdla_fe_t *fe = (sdla_fe_t*)pfe; - sdla_fe_timer_event_t event; /* Initialize and start T1/E1 timer */ wan_set_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical); - wan_init_timer( - &fe->timer, - sdla_ds_te1_timer, - (wan_timer_arg_t)fe); + wan_init_timer(&fe->timer, sdla_ds_te1_timer, (wan_timer_arg_t)fe); /* Initialize T1/E1 timer */ wan_clear_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical); /* Start T1/E1 timer */ - - event.type = TE_LINKDOWN_TIMER; - event.delay = POLLING_TE1_TIMER; - sdla_ds_te1_add_event(fe, &event); + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_LINK, + WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN, + POLLING_TE1_TIMER); sdla_ds_te1_add_timer(fe, POLLING_TE1_TIMER); return 0; } @@ -1545,6 +1548,11 @@ static int sdla_ds_te1_pre_release(void* pfe) if (fe_event) wan_free(fe_event); fe_event = NULL; }while(!empty); + + if (fe->swirq){ + wan_free(fe->swirq); + fe->swirq = NULL; + } return 0; } @@ -1568,15 +1576,8 @@ static int sdla_ds_te1_unconfig(void* pfe) return -EINVAL; } - if (!wan_test_bit(TE_CONFIGURED,(void*)&fe->te_param.critical)){ - DEBUG_EVENT("%s: Skipping Front End unconfig\n", fe->name); - return 0; - } - - DEBUG_EVENT("%s: %s Front End unconfigation!\n", fe->name, FE_MEDIA_DECODE(fe)); - /* FIXME: Alex to disable interrupts here */ sdla_ds_te1_disable_irq(fe); @@ -1584,8 +1585,8 @@ static int sdla_ds_te1_unconfig(void* pfe) /* Set Rx Framer soft reset */ WRITE_REG(REG_RMMR, BIT_RMMR_SFTRST); /* Set Tx Framer soft reset */ - WRITE_REG(REG_TMMR, BIT_TMMR_SFTRST); - + WRITE_REG(REG_TMMR, BIT_RMMR_SFTRST); + /* Clear configuration flag */ wan_clear_bit(TE_CONFIGURED,(void*)&fe->te_param.critical); @@ -1671,7 +1672,7 @@ sdla_ds_te1_sigctrl(sdla_fe_t *fe, int sig_mode, unsigned long ch_map, int mode) ******************************************************************************/ static u_int32_t sdla_ds_t1_is_alarm(sdla_fe_t *fe, u_int32_t alarms) { - u_int32_t alarm_mask = WAN_TE1_FRAMED_ALARMS; + u_int32_t alarm_mask = WAN_T1_FRAMED_ALARMS; /* Alex Feb 27, 2008 ** Special case for customer that uses @@ -1679,6 +1680,7 @@ static u_int32_t sdla_ds_t1_is_alarm(sdla_fe_t *fe, u_int32_t alarms) if (fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ alarm_mask |= WAN_TE_BIT_RAI_ALARM; } + return (alarms & alarm_mask); } @@ -1697,13 +1699,21 @@ static u_int32_t sdla_ds_e1_is_alarm(sdla_fe_t *fe, u_int32_t alarms) if (WAN_FE_FRAME(fe) == WAN_FR_UNFRAMED){ alarm_mask = WAN_TE1_UNFRAMED_ALARMS; if (!fe->te_param.lb_mode_map){ - alarm_mask |= ( WAN_TE_BIT_LIU_ALARM_OC | - WAN_TE_BIT_LIU_ALARM_SC | - WAN_TE_BIT_LIU_ALARM_LOS); + alarm_mask |= ( WAN_TE_BIT_ALARM_LIU_OC | + WAN_TE_BIT_ALARM_LIU_SC | + WAN_TE_BIT_ALARM_LIU_LOS); } }else{ - alarm_mask = WAN_TE1_FRAMED_ALARMS; + alarm_mask = WAN_E1_FRAMED_ALARMS; } + + /* Alex Feb 27, 2008 + ** Special case for customer that uses + ** YEL alarm for protocol control */ + if (fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ + alarm_mask |= WAN_TE_BIT_RAI_ALARM; + } + return (alarms & alarm_mask); } @@ -1715,10 +1725,10 @@ static u_int32_t sdla_ds_e1_is_alarm(sdla_fe_t *fe, u_int32_t alarms) ** Arguments: ** Returns: ******************************************************************************/ -static void sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms) +static int sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms) { sdla_t *card = (sdla_t*)fe->card; - unsigned char curr_fe_status = fe->fe_status; + unsigned char new_fe_status = fe->fe_status; u_int32_t valid_rx_alarms = 0x00; if (IS_T1_FEMEDIA(fe)){ @@ -1729,89 +1739,78 @@ static void sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms) if (valid_rx_alarms){ if (fe->fe_status != FE_DISCONNECTED){ - if (!(valid_rx_alarms & WAN_TE_BIT_RAI_ALARM)){ - sdla_ds_te1_set_alarms(fe, WAN_TE_BIT_YEL_ALARM); - } - fe->fe_status = FE_DISCONNECTED; - }else if (fe->te_param.tx_yel_alarm && valid_rx_alarms == WAN_TE_BIT_RAI_ALARM){ - /* Special case for loopback */ + new_fe_status = FE_DISCONNECTED; + } + }else{ + if (fe->fe_status != FE_CONNECTED){ + new_fe_status = FE_CONNECTED; + } + } + + if (fe->fe_status == new_fe_status){ + + if (fe->te_param.tx_yel_alarm && valid_rx_alarms == WAN_TE_BIT_RAI_ALARM){ sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); - } - }else{ - if (fe->fe_status != FE_CONNECTED){ - if (fe->te_param.tx_yel_alarm){ - sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); - } - fe->fe_status = FE_CONNECTED; - } - } + } -#if 0 - if ((IS_T1_FEMEDIA(fe) && sdla_ds_t1_is_alarm(fe, alarms)) || - (IS_E1_FEMEDIA(fe) && sdla_ds_e1_is_alarm(fe, alarms))){ - if (fe->fe_status != FE_DISCONNECTED){ - if (!(alarms & WAN_TE_BIT_RAI_ALARM)){ - /* Send YEL alarm only if our state is not - ** connected*/ - sdla_ds_te1_set_alarms(fe, WAN_TE_BIT_YEL_ALARM); - } - fe->fe_status = FE_DISCONNECTED; - } - }else{ - if (fe->fe_status != FE_CONNECTED){ - if (fe->te_param.tx_yel_alarm){ - sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); - } - fe->fe_status = FE_CONNECTED; - } - } -#endif - - if (curr_fe_status != fe->fe_status){ - if (fe->fe_status == FE_CONNECTED){ - if (fe->te_param.status_cnt > WAN_TE1_STATUS_THRESHOLD){ - DEBUG_EVENT("%s: %s connected!\n", - fe->name, - FE_MEDIA_DECODE(fe)); - if (card->wandev.te_report_alarms){ - card->wandev.te_report_alarms( - card, - fe->fe_alarm); - } - }else{ - if (!fe->te_param.status_cnt){ - DEBUG_TEST("%s: %s connecting...\n", - fe->name, - FE_MEDIA_DECODE(fe)); - } - fe->te_param.status_cnt ++; - fe->fe_status = FE_DISCONNECTED; - DEBUG_TEST("%s: %s connecting...%d\n", - fe->name, - FE_MEDIA_DECODE(fe), - fe->te_param.status_cnt); - } - }else{ - DEBUG_EVENT("%s: %s disconnected!\n", - fe->name, - FE_MEDIA_DECODE(fe)); - fe->fe_status = FE_DISCONNECTED; - fe->te_param.status_cnt = 0; - if (card->wandev.te_report_alarms){ - card->wandev.te_report_alarms(card, fe->fe_alarm); - } - } - - }else{ fe->te_param.status_cnt = 0; - DEBUG_TEST("%s: %s %s...%d\n", + DEBUG_TE1("%s: %s %s...%d\n", fe->name, FE_MEDIA_DECODE(fe), WAN_FE_STATUS_DECODE(fe), fe->te_param.status_cnt); + return 0; } + if (new_fe_status == FE_CONNECTED){ + if (fe->te_param.status_cnt > WAN_TE1_STATUS_THRESHOLD){ + if (fe->te_param.tx_yel_alarm){ + sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_ALARM_YEL); + } + DEBUG_EVENT("%s: %s connected!\n", + fe->name, + FE_MEDIA_DECODE(fe)); + fe->fe_status = FE_CONNECTED; + if (card->wandev.te_report_alarms){ + card->wandev.te_report_alarms( + card, + fe->fe_alarm); + } + }else{ + if (!fe->te_param.status_cnt){ + DEBUG_TE1("%s: %s connecting...\n", + fe->name, + FE_MEDIA_DECODE(fe)); + } + fe->te_param.status_cnt ++; + fe->fe_status = FE_DISCONNECTED; + DEBUG_TE1("%s: %s connecting...%d\n", + fe->name, + FE_MEDIA_DECODE(fe), + fe->te_param.status_cnt); + } + }else{ + DEBUG_EVENT("%s: %s disconnected!\n", + fe->name, + FE_MEDIA_DECODE(fe)); + fe->fe_status = FE_DISCONNECTED; - return; + /* Special case, if remote alarms is ONLY RAI, then do not transmit yellow */ + if (!fe->te_param.tx_yel_alarm && !(valid_rx_alarms == WAN_TE_BIT_RAI_ALARM)){ + sdla_ds_te1_set_alarms(fe, WAN_TE_BIT_ALARM_YEL); + } + + /* Special case, loopback if only valid alarm is RAI and we already transmitted yellow, + then we must clear yellow */ + if (fe->te_param.tx_yel_alarm && valid_rx_alarms == WAN_TE_BIT_RAI_ALARM){ + sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); + } + + fe->te_param.status_cnt = 0; + if (card->wandev.te_report_alarms){ + card->wandev.te_report_alarms(card, fe->fe_alarm); + } + } + return 1; } @@ -1825,9 +1824,6 @@ static void sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms) */ static int sdla_ds_te1_print_alarms(sdla_fe_t* fe, unsigned int alarms) { - if (!alarms){ - alarms = fe->fe_alarm; - } if (!alarms){ DEBUG_EVENT("%s: %s Alarms status: No alarms detected!\n", @@ -1835,35 +1831,35 @@ static int sdla_ds_te1_print_alarms(sdla_fe_t* fe, unsigned int alarms) FE_MEDIA_DECODE(fe)); return 0; } - DEBUG_EVENT("%s: %s Framer Alarms status (%X):\n", + DEBUG_EVENT("%s: %s Framer Alarms status (%08X):\n", fe->name, FE_MEDIA_DECODE(fe), - alarms); - if (alarms & WAN_TE_BIT_RAI_ALARM){ + alarms & WAN_TE_ALARM_FRAMER_MASK); + if (alarms & WAN_TE_BIT_ALARM_RAI){ DEBUG_EVENT("%s: RAI : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_LOS_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_LOS){ DEBUG_EVENT("%s: LOS : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_OOF_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_OOF){ DEBUG_EVENT("%s: OOF : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_RED_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_RED){ DEBUG_EVENT("%s: RED : ON\n", fe->name); } - DEBUG_EVENT("%s: %s LIU Alarms status (%X):\n", + DEBUG_EVENT("%s: %s LIU Alarms status (%08X):\n", fe->name, FE_MEDIA_DECODE(fe), - alarms); - if (alarms & WAN_TE_BIT_LIU_ALARM_OC){ + alarms & WAN_TE_ALARM_LIU_MASK); + if (alarms & WAN_TE_BIT_ALARM_LIU_OC){ DEBUG_EVENT("%s: Open Circuit is detected!\n", fe->name); } - if (alarms & WAN_TE_BIT_LIU_ALARM_SC){ - DEBUG_EVENT("%s: Short Circuit is detected!(%i)\n", - fe->name, __LINE__); + if (alarms & WAN_TE_BIT_ALARM_LIU_SC){ + DEBUG_EVENT("%s: Short Circuit is detected!\n", + fe->name); } - if (alarms & WAN_TE_BIT_LIU_ALARM_LOS){ + if (alarms & WAN_TE_BIT_ALARM_LIU_LOS){ DEBUG_EVENT("%s: Lost of Signal is detected!\n", fe->name); } @@ -1871,94 +1867,111 @@ static int sdla_ds_te1_print_alarms(sdla_fe_t* fe, unsigned int alarms) return 0; } -/* -******************************************************************************* + +/****************************************************************************** ** sdla_te_read_alarms() ** ** Description: ** Arguments: ** Returns: -*/ +******************************************************************************/ static u_int32_t sdla_ds_te1_read_frame_alarms(sdla_fe_t *fe) { - u_int32_t alarm = fe->fe_alarm; - unsigned char rrts1 = READ_REG(REG_RRTS1); + u_int32_t alarm = fe->fe_alarm; + unsigned char rrts1 = READ_REG(REG_RRTS1); - alarm &= WAN_TE_BIT_FRAMER_ALARM_MASK; - DEBUG_TE1("%s: Framer Alarm status = %02X (%X)\n", - fe->name, rrts1, alarm); + alarm &= WAN_TE_ALARM_FRAMER_MASK; + DEBUG_TE1("%s: Reading %s Framer status (Old:%08X,%02X)\n", + fe->name, FE_MEDIA_DECODE(fe), + rrts1, alarm); + /* Framer alarms */ //if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (rrts1 & BIT_RRTS1_RRAI){ - if (!(alarm & WAN_TE_BIT_RAI_ALARM)){ + if (!(alarm & WAN_TE_BIT_ALARM_RAI)){ DEBUG_EVENT("%s: RAI : ON\n", fe->name); } - alarm |= WAN_TE_BIT_RAI_ALARM; + alarm |= WAN_TE_BIT_ALARM_RAI; }else{ - if (alarm & WAN_TE_BIT_RAI_ALARM){ + if (alarm & WAN_TE_BIT_ALARM_RAI){ DEBUG_EVENT("%s: RAI : OFF\n", fe->name); } - alarm &= ~WAN_TE_BIT_RAI_ALARM; + alarm &= ~WAN_TE_BIT_ALARM_RAI; } //} + if (rrts1 & BIT_RRTS1_RAIS){ - if (!(alarm & WAN_TE_BIT_AIS_ALARM)){ - DEBUG_EVENT("%s: AIS : ON\n", - fe->name); + if (!IS_TE_ALARM_AIS(alarm)){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_AIS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON, + WAN_T1_ALARM_THRESHOLD_AIS_ON); } - alarm |= WAN_TE_BIT_AIS_ALARM; }else{ - if (alarm & WAN_TE_BIT_AIS_ALARM){ - DEBUG_EVENT("%s: AIS : OFF\n", - fe->name); + if (IS_TE_ALARM_AIS(alarm)){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_AIS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF, + WAN_T1_ALARM_THRESHOLD_AIS_OFF); } - alarm &= ~WAN_TE_BIT_AIS_ALARM; } + if (rrts1 & BIT_RRTS1_RLOS){ - if (!(alarm & WAN_TE_BIT_LOS_ALARM)){ - DEBUG_EVENT("%s: LOS : ON\n", - fe->name); + if (!IS_TE_ALARM_LOS(alarm)){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON, + WAN_T1_ALARM_THRESHOLD_LOS_ON); } - alarm |= WAN_TE_BIT_LOS_ALARM; }else{ - if (alarm & WAN_TE_BIT_LOS_ALARM){ - DEBUG_EVENT("%s: LOS : OFF\n", - fe->name); + if (IS_TE_ALARM_LOS(alarm)){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF, + WAN_T1_ALARM_THRESHOLD_LOS_OFF); } - alarm &= ~WAN_TE_BIT_LOS_ALARM; } + if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (rrts1 & BIT_RRTS1_RLOF){ - if (!(alarm & WAN_TE_BIT_OOF_ALARM)){ - DEBUG_EVENT("%s: OOF : ON\n", - fe->name); + if (!IS_TE_ALARM_LOF(alarm)){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOF, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON, + WAN_T1_ALARM_THRESHOLD_LOF_ON); } - alarm |= WAN_TE_BIT_OOF_ALARM; }else{ - if (alarm & WAN_TE_BIT_OOF_ALARM){ - DEBUG_EVENT("%s: OOF : OFF\n", - fe->name); + if (IS_TE_ALARM_LOF(alarm)){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOF, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF, + WAN_T1_ALARM_THRESHOLD_LOF_OFF); } - alarm &= ~WAN_TE_BIT_OOF_ALARM; - } + } } /* Aug 30, 2006 ** Red alarm is either LOS or OOF alarms */ - if (IS_TE_OOF_ALARM(alarm) || - IS_TE_LOS_ALARM(alarm)){ - if (!(alarm & WAN_TE_BIT_RED_ALARM)){ + if (IS_TE_ALARM_LOF(alarm) || + IS_TE_ALARM_LOS(alarm)){ + if (!IS_TE_ALARM_RED(alarm)){ DEBUG_EVENT("%s: RED : ON\n", fe->name); } - alarm |= WAN_TE_BIT_RED_ALARM; + alarm |= WAN_TE_BIT_ALARM_RED; }else{ - if (alarm & WAN_TE_BIT_RED_ALARM){ + if (IS_TE_ALARM_RED(alarm)){ DEBUG_EVENT("%s: RED : OFF\n", fe->name); } - alarm &= ~WAN_TE_BIT_RED_ALARM; + alarm &= ~WAN_TE_BIT_ALARM_RED; } return alarm; } @@ -1968,49 +1981,50 @@ static unsigned int sdla_ds_te1_read_liu_alarms(sdla_fe_t *fe) unsigned int alarm = fe->fe_alarm; unsigned char lrsr = READ_REG(REG_LRSR); - alarm &= WAN_TE_BIT_LIU_ALARM_MASK; - DEBUG_TE1("%s: LIU Alarm status = %02X (%X)\n", - fe->name, lrsr, alarm); + alarm &= WAN_TE_ALARM_LIU_MASK; + DEBUG_TE1("%s: Reading %s LIU status (Old:%08X,%02X)\n", + fe->name, FE_MEDIA_DECODE(fe), + lrsr, alarm); /* LIU alarms */ if (lrsr & BIT_LRSR_OCS){ - if (!(alarm & WAN_TE_BIT_LIU_ALARM_OC)){ + if (!(alarm & WAN_TE_BIT_ALARM_LIU_OC)){ DEBUG_EVENT("%s: Open Circuit is detected!\n", fe->name); } - alarm |= WAN_TE_BIT_LIU_ALARM_OC; + alarm |= WAN_TE_BIT_ALARM_LIU_OC; }else{ - if (alarm & WAN_TE_BIT_LIU_ALARM_OC){ + if (alarm & WAN_TE_BIT_ALARM_LIU_OC){ DEBUG_EVENT("%s: Open Circuit is cleared!\n", fe->name); } - alarm &= ~WAN_TE_BIT_LIU_ALARM_OC; + alarm &= ~WAN_TE_BIT_ALARM_LIU_OC; } if (lrsr & BIT_LRSR_SCS){ - if (!(alarm & WAN_TE_BIT_LIU_ALARM_SC)){ + if (!(alarm & WAN_TE_BIT_ALARM_LIU_SC)){ DEBUG_EVENT("%s: Short Circuit is detected!(%i)\n", fe->name, __LINE__); } - alarm |= WAN_TE_BIT_LIU_ALARM_SC; + alarm |= WAN_TE_BIT_ALARM_LIU_SC; }else{ - if (alarm & WAN_TE_BIT_LIU_ALARM_SC){ + if (alarm & WAN_TE_BIT_ALARM_LIU_SC){ DEBUG_EVENT("%s: Short Circuit is cleared!(%i)\n", fe->name, __LINE__); } - alarm &= ~WAN_TE_BIT_LIU_ALARM_SC; + alarm &= ~WAN_TE_BIT_ALARM_LIU_SC; } if (lrsr & BIT_LRSR_LOSS){ - if (!(alarm & WAN_TE_BIT_LIU_ALARM_LOS)){ + if (!(alarm & WAN_TE_BIT_ALARM_LIU_LOS)){ DEBUG_EVENT("%s: Lost of Signal is detected!\n", fe->name); } - alarm |= WAN_TE_BIT_LIU_ALARM_LOS; + alarm |= WAN_TE_BIT_ALARM_LIU_LOS; }else{ - if (alarm & WAN_TE_BIT_LIU_ALARM_LOS){ + if (alarm & WAN_TE_BIT_ALARM_LIU_LOS){ DEBUG_EVENT("%s: Lost of Signal is cleared!\n", fe->name); } - alarm &= ~WAN_TE_BIT_LIU_ALARM_LOS; + alarm &= ~WAN_TE_BIT_ALARM_LIU_LOS; } return alarm; @@ -2034,6 +2048,77 @@ static u_int32_t sdla_ds_te1_read_alarms(sdla_fe_t *fe, int action) return fe->fe_alarm; } +/****************************************************************************** +** sdla_ds_te1_update_alarm() +** +** Description: +** Arguments: +** Returns: +******************************************************************************/ +static int +sdla_ds_te1_update_alarms(sdla_fe_t *fe, u_int32_t alarms) +{ + + if (!IS_TE_ALARM_AIS(fe->fe_alarm)){ + if (IS_TE_ALARM_AIS(alarms)){ + DEBUG_EVENT("%s: AIS : ON\n", + fe->name); + fe->fe_alarm |= WAN_TE_BIT_ALARM_AIS; + } + }else{ + if (!IS_TE_ALARM_AIS(alarms)){ + DEBUG_EVENT("%s: AIS : OFF\n", + fe->name); + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_AIS; + } + } + + if (!IS_TE_ALARM_LOF(fe->fe_alarm)){ + if (IS_TE_ALARM_LOF(alarms)){ + DEBUG_EVENT("%s: LOF : ON\n", + fe->name); + fe->fe_alarm |= WAN_TE_BIT_ALARM_LOF; + } + }else{ + if (!IS_TE_ALARM_LOF(alarms)){ + DEBUG_EVENT("%s: LOF : OFF\n", + fe->name); + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_LOF; + } + } + + if (!IS_TE_ALARM_LOS(fe->fe_alarm)){ + if (IS_TE_ALARM_LOS(alarms)){ + DEBUG_EVENT("%s: LOS : ON\n", + fe->name); + fe->fe_alarm |= WAN_TE_BIT_ALARM_LOS; + } + }else{ + if (!IS_TE_ALARM_LOS(alarms)){ + DEBUG_EVENT("%s: LOS : OFF\n", + fe->name); + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_LOS; + } + } + + if (IS_T1_FEMEDIA(fe)){ + if (IS_TE_ALARM_LOF(fe->fe_alarm) || + IS_TE_ALARM_LOS(fe->fe_alarm)){ + if (!IS_TE_ALARM_RED(fe->fe_alarm)){ + DEBUG_EVENT("%s: RED : ON\n", + fe->name); + } + fe->fe_alarm |= WAN_TE_BIT_ALARM_RED; + }else{ + if (IS_TE_ALARM_RED(fe->fe_alarm)){ + DEBUG_EVENT("%s: RED : OFF\n", + fe->name); + } + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_RED; + } + } + return 0; +} #define WAN_TE_CRIT_ALARM_TIMEOUT 30 /* 30 sec */ static int sdla_ds_te1_read_crit_alarms(sdla_fe_t *fe) @@ -2041,7 +2126,7 @@ static int sdla_ds_te1_read_crit_alarms(sdla_fe_t *fe) u_int32_t liu_alarms = 0x00; liu_alarms = sdla_ds_te1_read_liu_alarms(fe); - if (liu_alarms & WAN_TE_BIT_LIU_ALARM_SC){ + if (liu_alarms & WAN_TE_BIT_ALARM_LIU_SC){ fe->te_param.crit_alarm_start = SYSTEM_TICKS; }else{ if (WAN_STIMEOUT(fe->te_param.crit_alarm_start, WAN_TE_CRIT_ALARM_TIMEOUT)){ @@ -2063,12 +2148,14 @@ static int sdla_ds_te1_read_crit_alarms(sdla_fe_t *fe) static int sdla_ds_te1_set_alarms(sdla_fe_t* fe, u_int32_t alarms) { u8 value; - - if (alarms & WAN_TE_BIT_YEL_ALARM) { + + /* NC: Always set yellow alarm no need to check whether + * yellow alarm is ignored */ + if (alarms & WAN_TE_BIT_ALARM_YEL){ if (IS_T1_FEMEDIA(fe)){ value = READ_REG(REG_TCR1); if (!(value & BIT_TCR1_T1_TRAI)){ - DEBUG_TE1("%s: Enable transmit RAI alarm\n", + DEBUG_EVENT("%s: Enable transmit RAI alarm\n", fe->name); WRITE_REG(REG_TCR1, value | BIT_TCR1_T1_TRAI); fe->te_param.tx_yel_alarm = 1; @@ -2097,11 +2184,13 @@ static int sdla_ds_te1_clear_alarms(sdla_fe_t* fe, u_int32_t alarms) { u8 value; - if (alarms & WAN_TE_BIT_YEL_ALARM) { + /* NC: Always set yellow alarm no need to check whether + * yellow alarm is ignored */ + if (alarms & WAN_TE_BIT_ALARM_YEL){ if (IS_T1_FEMEDIA(fe)){ value = READ_REG(REG_TCR1); if (value & BIT_TCR1_T1_TRAI){ - DEBUG_TE1("%s: Disable transmit RAI alarm\n", + DEBUG_EVENT("%s: Disable transmit RAI alarm\n", fe->name); WRITE_REG(REG_TCR1, value & ~BIT_TCR1_T1_TRAI); fe->te_param.tx_yel_alarm = 0; @@ -2120,15 +2209,89 @@ static int sdla_ds_te1_clear_alarms(sdla_fe_t* fe, u_int32_t alarms) return 0; } -/* - ****************************************************************************** - * sdla_ds_te1_rbs_report() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ +/****************************************************************************** +** sdla_ds_te1_clear_alarms() +** +** Description: +** Arguments: +** Returns: +*/ +static int sdla_ds_te1_rbs_init(sdla_fe_t* fe) +{ + int i; + + if (IS_E1_FEMEDIA(fe)){ + for(i = 1; i < 16; i++){ + WRITE_REG(REG_TS1+i, 0xFF); + } + }else{ + for(i = 0; i < 12; i++){ + WRITE_REG(REG_TS1+i, 0xFF); + } + } + return 0; +} + +/****************************************************************************** +** sdla_ds_te1_clear_alarms() +** +** Description: +** Arguments: +** Returns: +*/ +static int sdla_ds_te1_rbs_ctrl(sdla_fe_t* fe, u_int32_t ch_map, int enable) +{ + u_int8_t value; + unsigned int ch, bit, off; + + value = READ_REG(REG_TCR1); + if (IS_T1_FEMEDIA(fe)){ + if (enable == WAN_TRUE){ + value |= BIT_TCR1_T1_TSSE; + }else{ + value &= ~BIT_TCR1_T1_TSSE; + } + }else{ + if (enable == WAN_TRUE){ + value |= BIT_TCR1_E1_T16S; + }else{ + value &= ~BIT_TCR1_E1_T16S; + } + } + WRITE_REG(REG_TCR1, value); + + for(ch = 1; ch <= fe->te_param.max_channels; ch++){ + if (!wan_test_bit(ch, &ch_map)){ + continue; + } + if (IS_T1_FEMEDIA(fe)){ + bit = (ch-1) % 8; + off = (ch-1) / 8; + }else{ + if (ch == 16) continue; + bit = ch % 8; + off = ch / 8; + } + value = READ_REG(REG_SSIE1+off); + if (enable == WAN_TRUE){ + value |= (1<name, ch, REG_SSIE1+off, value); + WRITE_REG(REG_SSIE1+off, value); + } + return 0; +} + +/****************************************************************************** +** sdla_ds_te1_rbs_report() +** +** Description: +** Arguments: +** Returns: +******************************************************************************/ static int sdla_ds_te1_rbs_report(sdla_fe_t* fe) { sdla_t* card = (sdla_t*)fe->card; @@ -2166,6 +2329,12 @@ static unsigned char sdla_ds_te1_read_rbsbits(sdla_fe_t* fe, int channo, int mod sdla_t* card = (sdla_t*)fe->card; int rs_offset = 0, range = 0; unsigned char rbsbits = 0x00, status = 0x00; + + if (wan_test_bit(WAN_TE1_SWIRQ_TYPE_ALARM_LOS, (void*)&fe->swirq_map) || + wan_test_bit(WAN_TE1_SWIRQ_TYPE_ALARM_LOF, (void*)&fe->swirq_map)){ + /* Keep the original values */ + return 0; + } if (IS_E1_FEMEDIA(fe)){ rs_offset = channo % 16; @@ -2199,68 +2368,6 @@ static unsigned char sdla_ds_te1_read_rbsbits(sdla_fe_t* fe, int channo, int mod return status; } -/* - ****************************************************************************** - * sdla_te_rbs_update() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int -sdla_ds_te1_rbs_update(sdla_fe_t* fe, int channo, unsigned char status) -{ - - if (fe->fe_debug & WAN_FE_DEBUG_RBS_RX_ENABLE && - fe->te_param.rx_rbs[channo] != status){ - DEBUG_EVENT( - "%s: %s:%-3d RX RBS A:%1d B:%1d C:%1d D:%1d\n", - fe->name, - FE_MEDIA_DECODE(fe), - channo, - (status & WAN_RBS_SIG_A) ? 1 : 0, - (status & WAN_RBS_SIG_B) ? 1 : 0, - (status & WAN_RBS_SIG_C) ? 1 : 0, - (status & WAN_RBS_SIG_D) ? 1 : 0); - } - - /* Update rbs value in private structures */ - wan_set_bit(channo, &fe->te_param.rx_rbs_status); - fe->te_param.rx_rbs[channo] = status; - - if (status & WAN_RBS_SIG_A){ - wan_set_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_A); - }else{ - wan_clear_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_A); - } - if (status & WAN_RBS_SIG_B){ - wan_set_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_B); - }else{ - wan_clear_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_B); - } - if (status & WAN_RBS_SIG_C){ - wan_set_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_C); - }else{ - wan_clear_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_C); - } - if (status & WAN_RBS_SIG_D){ - wan_set_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_D); - }else{ - wan_clear_bit(channo, - (unsigned long*)&fe->te_param.rx_rbs_D); - } - - return 0; -} - /* ****************************************************************************** * sdla_ds_te1_check_rbsbits() @@ -2278,6 +2385,12 @@ sdla_ds_te1_check_rbsbits(sdla_fe_t* fe, int ch_base, unsigned int ts_map, int r int rs_reg = 0, rs_offset = 0; int i = 0, channel, range = 12; + if (wan_test_bit(WAN_TE1_SWIRQ_TYPE_ALARM_LOS, (void*)&fe->swirq_map) || + wan_test_bit(WAN_TE1_SWIRQ_TYPE_ALARM_LOF, (void*)&fe->swirq_map)){ + /* Keep the original values */ + return 0; + } + switch(ch_base){ case 1: rs_reg = REG_RSS1; @@ -2436,6 +2549,69 @@ sdla_ds_te1_set_rbsbits(sdla_fe_t *fe, int channel, unsigned char status) WRITE_REG(REG_TS1 + ts_off, ts_org | rbsbits); return 0; } + +/* + ****************************************************************************** + * sdla_te_rbs_update() + * + * Description: + * Arguments: + * Returns: + ****************************************************************************** + */ +static int +sdla_ds_te1_rbs_update(sdla_fe_t* fe, int channo, unsigned char status) +{ + + if (fe->fe_debug & WAN_FE_DEBUG_RBS_RX_ENABLE && + fe->te_param.rx_rbs[channo] != status){ + DEBUG_EVENT( + "%s: %s:%-3d RX RBS A:%1d B:%1d C:%1d D:%1d\n", + fe->name, + FE_MEDIA_DECODE(fe), + channo, + (status & WAN_RBS_SIG_A) ? 1 : 0, + (status & WAN_RBS_SIG_B) ? 1 : 0, + (status & WAN_RBS_SIG_C) ? 1 : 0, + (status & WAN_RBS_SIG_D) ? 1 : 0); + } + + /* Update rbs value in private structures */ + wan_set_bit(channo, &fe->te_param.rx_rbs_status); + fe->te_param.rx_rbs[channo] = status; + + if (status & WAN_RBS_SIG_A){ + wan_set_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_A); + }else{ + wan_clear_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_A); + } + if (status & WAN_RBS_SIG_B){ + wan_set_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_B); + }else{ + wan_clear_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_B); + } + if (status & WAN_RBS_SIG_C){ + wan_set_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_C); + }else{ + wan_clear_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_C); + } + if (status & WAN_RBS_SIG_D){ + wan_set_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_D); + }else{ + wan_clear_bit(channo, + (unsigned long*)&fe->te_param.rx_rbs_D); + } + + return 0; +} + /* ****************************************************************************** * sdla_te_rbs_print_banner() @@ -2624,11 +2800,11 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, u_int8_t type, u_int8_t mode, un /* In-band loop codes */ if (IS_T1_FEMEDIA(fe)){ - mask = BIT_RIM3_T1_LDNC|BIT_RIM3_T1_LDND | + mask = BIT_RIM3_T1_LDNC|BIT_RIM3_T1_LDND | BIT_RIM3_T1_LUPC|BIT_RIM3_T1_LUPD; WRITE_REG(REG_RIM3, mask); - WRITE_REG(REG_RLS3, 0xFF); - } + WRITE_REG(REG_RLS3, 0xFF); + } //WRITE_REG(REG_RIM4, BIT_RIM4_TIMER); WRITE_REG(REG_RLS4, 0xFF); @@ -2681,7 +2857,7 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, u_int8_t type, u_int8_t mode, un }else{ rscse &= ~(1<name, ch, REG_RSCSE1+off, rscse); WRITE_REG(REG_RSCSE1+off, rscse); } @@ -2707,86 +2883,110 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, u_int8_t type, u_int8_t mode, un return 0; } -static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe, int silent) + +static int sdla_ds_te1_fr_rxintr_rls1(sdla_fe_t *fe, int silent) +{ + unsigned char rim1 = READ_REG(REG_RIM1); + unsigned char rls1 = READ_REG(REG_RLS1); + unsigned char rrts1 = READ_REG(REG_RRTS1); + + //if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ + if (rls1 & (BIT_RLS1_RRAIC|BIT_RLS1_RRAID)){ + if (rrts1 & BIT_RRTS1_RRAI){ + fe->fe_alarm |= WAN_TE_BIT_ALARM_RAI; + if (!silent) DEBUG_EVENT("%s: RAI alarm is ON\n", + fe->name); + }else{ + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_RAI; + if (!silent) DEBUG_EVENT("%s: RAI alarm is OFF\n", + fe->name); + } + } + //} + if (rim1 & (BIT_RIM1_RAISC|BIT_RIM1_RAISD)){ + if (rls1 & (BIT_RLS1_RAISC|BIT_RLS1_RAISD)){ + if (rrts1 & BIT_RRTS1_RAIS){ + + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_AIS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON, + WAN_T1_ALARM_THRESHOLD_AIS_ON); + }else{ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_AIS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF, + WAN_T1_ALARM_THRESHOLD_AIS_OFF); + } + } + } + + if (rim1 & (BIT_RIM1_RLOSC|BIT_RIM1_RLOSD)){ + if (rls1 & (BIT_RLS1_RLOSC|BIT_RLS1_RLOSD)){ + if (rrts1 & BIT_RRTS1_RLOS){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON, + WAN_T1_ALARM_THRESHOLD_LOS_ON); + }else{ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOS, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF, + WAN_T1_ALARM_THRESHOLD_LOS_OFF); + } + } + } + if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ + if (rim1 & (BIT_RIM1_RLOFC | BIT_RIM1_RLOFD)){ + if (rls1 & (BIT_RLS1_RLOFC|BIT_RLS1_RLOFD)){ + if (rrts1 & BIT_RRTS1_RLOF){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOF, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON, + WAN_T1_ALARM_THRESHOLD_LOF_ON); + }else{ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_ALARM_LOF, + WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF, + WAN_T1_ALARM_THRESHOLD_LOF_OFF); + } + } + } + } + WRITE_REG(REG_RLS1, rls1); + return 0; +} + +static int sdla_ds_te1_fr_rx_intr(sdla_fe_t *fe, int silent) { unsigned char istatus; istatus = READ_REG(REG_RIIR); - if (istatus & BIT_RIIR_RLS1){ - unsigned char rls1 = READ_REG(REG_RLS1); - unsigned char rrts1 = READ_REG(REG_RRTS1); - //if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ - if (rls1 & (BIT_RLS1_RRAIC|BIT_RLS1_RRAID)){ - if (rrts1 & BIT_RRTS1_RRAI){ - fe->fe_alarm |= WAN_TE_BIT_RAI_ALARM; - if (!silent) DEBUG_EVENT("%s: RAI alarm is ON\n", - fe->name); - }else{ - fe->fe_alarm &= ~WAN_TE_BIT_RAI_ALARM; - if (!silent) DEBUG_EVENT("%s: RAI alarm is OFF\n", - fe->name); - } - } - //} - if (rls1 & (BIT_RLS1_RAISC|BIT_RLS1_RAISD)){ - if (rrts1 & BIT_RRTS1_RAIS){ - fe->fe_alarm |= WAN_TE_BIT_AIS_ALARM; - if (!silent) DEBUG_EVENT("%s: AIS alarm is ON\n", - fe->name); - }else{ - fe->fe_alarm &= ~WAN_TE_BIT_AIS_ALARM; - if (!silent) DEBUG_EVENT("%s: AIS alarm is OFF\n", - fe->name); - } - } - if (rls1 & (BIT_RLS1_RLOSC|BIT_RLS1_RLOSD)){ - if (rrts1 & BIT_RRTS1_RLOS){ - fe->fe_alarm |= WAN_TE_BIT_LOS_ALARM; - if (!silent) DEBUG_EVENT("%s: LOS alarm is ON\n", - fe->name); - }else{ - fe->fe_alarm &= ~WAN_TE_BIT_LOS_ALARM; - if (!silent) DEBUG_EVENT("%s: LOS alarm is OFF\n", - fe->name); - } - } - if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ - if (rls1 & (BIT_RLS1_RLOFC|BIT_RLS1_RLOFD)){ - if (rrts1 & BIT_RRTS1_RLOF){ - fe->fe_alarm |= WAN_TE_BIT_OOF_ALARM; - if (!silent) DEBUG_EVENT("%s: OOF alarm is ON\n", - fe->name); - }else{ - fe->fe_alarm &= ~WAN_TE_BIT_OOF_ALARM; - if (!silent) DEBUG_EVENT("%s: OOF alarm is OFF\n", - fe->name); - } - } - } - WRITE_REG(REG_RLS1, rls1); - if (IS_T1_FEMEDIA(fe)){ - if (IS_TE_OOF_ALARM(fe->fe_alarm) && - IS_TE_LOS_ALARM(fe->fe_alarm)){ - if (!(fe->fe_alarm & WAN_TE_BIT_RED_ALARM)){ - if (!silent) DEBUG_EVENT("%s: RED alarm is ON\n", - fe->name); - fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; - } - }else{ - if (fe->fe_alarm & WAN_TE_BIT_RED_ALARM){ - if (!silent) DEBUG_EVENT("%s: RED alarm is OFF\n", - fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; - } - } - } + if (istatus & BIT_RIIR_RLS1){ + sdla_ds_te1_fr_rxintr_rls1(fe, silent); } if (istatus & BIT_RIIR_RLS2){ unsigned char rls2 = READ_REG(REG_RLS2); - if (IS_E1_FEMEDIA(fe)){ - if (!silent) DEBUG_TE1("%s: E1 RX Latched Status Register 2 %02X\n", - fe->name, rls2); + if (!silent) DEBUG_TE1("%s: E1 RX Latched Status Register 2 %02X\n", + fe->name, rls2); + if (IS_T1_FEMEDIA(fe)){ + if (rls2 & BIT_RLS2_T1_SEFE){ + if (!silent) DEBUG_EVENT( + "%s: Receive Errored Framing Bits (2/6)!\n", + fe->name); + } + if (rls2 & BIT_RLS2_T1_FBE){ + if (!silent) DEBUG_EVENT( + "%s: Receive Framing Bit error!\n", + fe->name); + } + }else{ if (rls2 & BIT_RLS2_E1_RSA1){ if (!silent) DEBUG_EVENT( "%s: Receive Signalling All Ones Event!\n", @@ -2809,11 +3009,11 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe, int silent) "%s: Receive Align Frame Event!\n", fe->name); if (rnaf & BIT_E1RNAF_A){ - fe->fe_alarm |= WAN_TE_BIT_RAI_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_RAI; if (!silent) DEBUG_EVENT("%s: RAI alarm is ON\n", fe->name); }else{ - fe->fe_alarm &= ~WAN_TE_BIT_RAI_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_RAI; if (!silent) DEBUG_EVENT("%s: RAI alarm is OFF\n", fe->name); } @@ -2844,7 +3044,9 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe, int silent) "%s: Loop-Up Code Detected Condition Detect!\n", fe->name); sdla_ds_te1_set_lb( - fe, WAN_TE1_LINELB_MODE,WAN_TE1_LB_ENABLE); + fe, + WAN_TE1_LINELB_MODE,WAN_TE1_LB_ENABLE, + ENABLE_ALL_CHANNELS); }else{ if (!silent) DEBUG_TE1( @@ -2858,7 +3060,9 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe, int silent) "%s: Loop-Down Code Detected Condition Detect!\n", fe->name); sdla_ds_te1_set_lb( - fe, WAN_TE1_LINELB_MODE,WAN_TE1_LB_DISABLE); + fe, + WAN_TE1_LINELB_MODE,WAN_TE1_LB_DISABLE, + ENABLE_ALL_CHANNELS); }else{ if (!silent) DEBUG_TE1( "%s: Loop-Down Code Detected Condition Clear!\n", @@ -2938,33 +3142,47 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe, int silent) #endif if (istatus & BIT_RIIR_RLS7){ unsigned char rls7 = READ_REG(REG_RLS7); - if (!silent) DEBUG_TE1("%s: RX Latched Status Register 7 %02X\n", - fe->name, rls7); - if (rls7 & BIT_RLS7_RRAI_CI){ - if (!silent) DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", - fe->name); - } - if (rls7 & BIT_RLS7_RAIS_CI){ - if (!silent) DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", - fe->name); - } - if (rls7 & BIT_RLS7_RSLC96){ - if (!silent) DEBUG_EVENT("%s: Receive SLC-96 Alignment Event!\n", - fe->name); - } - if (rls7 & BIT_RLS7_RFDLF){ - if (!silent) DEBUG_TE1("%s: Receive FDL Register Full Event!\n", - fe->name); - } - if (rls7 & BIT_RLS7_BC){ - if (!silent) DEBUG_TE1("%s: BOC Clear Event!\n", - fe->name); - sdla_ds_te1_boc(fe, 0); - } - if (rls7 & BIT_RLS7_BD){ - if (!silent) DEBUG_TE1("%s: BOC Detect Event!\n", - fe->name); - sdla_ds_te1_boc(fe, 1); + + if (IS_T1_FEMEDIA(fe)){ + if (!silent) DEBUG_TE1("%s: RX Latched Status Register 7 %02X\n", + fe->name, rls7); + if (rls7 & BIT_RLS7_T1_RRAI_CI){ + if (!silent) DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", + fe->name); + } + if (rls7 & BIT_RLS7_T1_RAIS_CI){ + if (!silent) DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", + fe->name); + } + if (rls7 & BIT_RLS7_T1_RSLC96){ + if (!silent) DEBUG_EVENT("%s: Receive SLC-96 Alignment Event!\n", + fe->name); + } + if (rls7 & BIT_RLS7_T1_RFDLF){ + if (!silent) DEBUG_TE1("%s: Receive FDL Register Full Event!\n", + fe->name); + } + if (rls7 & BIT_RLS7_T1_BC){ + if (!silent) DEBUG_TE1("%s: BOC Clear Event!\n", + fe->name); + sdla_ds_te1_boc(fe, 0); + } + if (rls7 & BIT_RLS7_T1_BD){ + if (!silent) DEBUG_TE1("%s: BOC Detect Event!\n", + fe->name); + sdla_ds_te1_boc(fe, 1); + } + }else{ + if (rls7 & BIT_RLS7_E1_Sa6CD){ + if (!silent) DEBUG_EVENT("%s: Sa6 Codeword detect!\n", + fe->name); + sdla_ds_e1_sa6code(fe); + } + if (rls7 & BIT_RLS7_E1_SaXCD){ + if (!silent) DEBUG_EVENT("%s: SaX bit change detect!\n", + fe->name); + sdla_ds_e1_sabits(fe); + } } WRITE_REG(REG_RLS7, rls7); } @@ -2972,7 +3190,7 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe, int silent) return 0; } -static int sdla_ds_te1_framer_tx_intr(sdla_fe_t *fe, int silent) +static int sdla_ds_te1_fr_tx_intr(sdla_fe_t *fe, int silent) { unsigned char istatus; unsigned char status; @@ -3003,6 +3221,76 @@ static int sdla_ds_te1_framer_tx_intr(sdla_fe_t *fe, int silent) return 0; } +static int sdla_ds_te1_liu_intr(sdla_fe_t *fe, int silent) +{ + unsigned char lsimr = READ_REG(REG_LSIMR); + unsigned char llsr = READ_REG(REG_LLSR); + unsigned char lrsr = READ_REG(REG_LRSR); + + if (llsr & BIT_LLSR_JALTC && lsimr & BIT_LSIMR_JALTCIM){ + if (!silent) DEBUG_TE1("%s: Jitter Attenuator Limit Trip Clear!\n", + fe->name); + } + if (llsr & BIT_LLSR_JALTS && lsimr & BIT_LSIMR_JALTSIM){ + if (!silent) DEBUG_TE1("%s: Jitter Attenuator Limit Trip Set!\n", + fe->name); + } + if (llsr & (BIT_LLSR_OCC | BIT_LLSR_OCD)){ +#if 0 + if (IS_T1_FEMEDIA(fe) && WAN_TE1_LBO(fe) == LBO 5/6/7){ + /* Use LRSR register to get real value. LLSR is not + ** valid for these modes */ + } +#endif + if (lrsr & BIT_LRSR_OCS){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_OC)){ + if (!silent) DEBUG_TE1("%s: Open Circuit is detected!\n", + fe->name); + fe->fe_alarm |= WAN_TE_BIT_ALARM_LIU_OC; + } + }else{ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_OC){ + if (!silent) DEBUG_TE1("%s: Open Circuit is cleared!\n", + fe->name); + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_LIU_OC; + } + } + } + if (llsr & (BIT_LLSR_SCC | BIT_LLSR_SCD)){ + if (lrsr & BIT_LRSR_SCS){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_SC)){ + if (!silent) DEBUG_EVENT("%s: Short Circuit is detected!(%i)\n", + fe->name, __LINE__); + fe->fe_alarm |= WAN_TE_BIT_ALARM_LIU_SC; + } + }else{ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_SC){ + if (!silent) DEBUG_EVENT("%s: Short Circuit is cleared!(%i)\n", + fe->name, __LINE__); + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_LIU_SC; + } + } + } + if (lsimr & (BIT_LSIMR_LOSDIM|BIT_LSIMR_LOSCIM)){ + if (llsr & (BIT_LLSR_LOSC | BIT_LLSR_LOSD)){ + if (lrsr & BIT_LRSR_LOSS){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_LOS)){ + if (!silent) DEBUG_EVENT("%s: Lost of Signal is detected!\n", + fe->name); + fe->fe_alarm |= WAN_TE_BIT_ALARM_LIU_LOS; + } + }else{ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_LOS){ + if (!silent) DEBUG_EVENT("%s: Lost of Signal is cleared!\n", + fe->name); + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_LIU_LOS; + } + } + } + } + WRITE_REG(REG_LLSR, llsr); + return 0; +} static int sdla_ds_te1_bert_intr(sdla_fe_t *fe, int silent) { @@ -3047,74 +3335,6 @@ static int sdla_ds_te1_bert_intr(sdla_fe_t *fe, int silent) return 0; } -static int sdla_ds_te1_liu_intr(sdla_fe_t *fe, int silent) -{ - unsigned char llsr = READ_REG(REG_LLSR); - unsigned char lrsr = READ_REG(REG_LRSR); - - if (llsr & BIT_LLSR_JALTC){ - if (!silent) DEBUG_TE1("%s: Jitter Attenuator Limit Trip Clear!\n", - fe->name); - } - if (llsr & BIT_LLSR_JALTS){ - if (!silent) DEBUG_TE1("%s: Jitter Attenuator Limit Trip Set!\n", - fe->name); - } - if (llsr & (BIT_LLSR_OCC | BIT_LLSR_OCD)){ -#if 0 - if (IS_T1_FEMEDIA(fe) && WAN_TE1_LBO(fe) == LBO 5/6/7){ - /* Use LRSR register to get real value. LLSR is not - ** valid for these modes */ - } -#endif - if (lrsr & BIT_LRSR_OCS){ - if (!(fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_OC)){ - if (!silent) DEBUG_TE1("%s: Open Circuit is detected!\n", - fe->name); - fe->fe_alarm |= WAN_TE_BIT_LIU_ALARM_OC; - } - }else{ - if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_OC){ - if (!silent) DEBUG_TE1("%s: Open Circuit is cleared!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_LIU_ALARM_OC; - } - } - } - if (llsr & (BIT_LLSR_SCC | BIT_LLSR_SCD)){ - if (lrsr & BIT_LRSR_SCS){ - if (!(fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC)){ - if (!silent) DEBUG_EVENT("%s: Short Circuit is detected!(%i)\n", - fe->name, __LINE__); - fe->fe_alarm |= WAN_TE_BIT_LIU_ALARM_SC; - } - }else{ - if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ - if (!silent) DEBUG_EVENT("%s: Short Circuit is cleared!(%i)\n", - fe->name, __LINE__); - fe->fe_alarm &= ~WAN_TE_BIT_LIU_ALARM_SC; - } - } - } - if (llsr & (BIT_LLSR_LOSC | BIT_LLSR_LOSD)){ - if (lrsr & BIT_LRSR_LOSS){ - if (!(fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_LOS)){ - if (!silent) DEBUG_EVENT("%s: Lost of Signal is detected!\n", - fe->name); - fe->fe_alarm |= WAN_TE_BIT_LIU_ALARM_LOS; - } - }else{ - if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_LOS){ - if (!silent) DEBUG_EVENT("%s: Lost of Signal is cleared!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_LIU_ALARM_LOS; - } - } - } - WRITE_REG(REG_LLSR, llsr); - return 0; -} - static int sdla_ds_te1_check_intr(sdla_fe_t *fe) { unsigned char framer_istatus, framer_imask; @@ -3126,20 +3346,17 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe) WAN_ASSERT(fe->fe_cfg.poll_mode == WANOPT_YES); framer_istatus = __READ_REG(REG_GFISR); - liu_istatus = __READ_REG(REG_GLISR); - bert_istatus = __READ_REG(REG_GBISR); - framer_imask = __READ_REG(REG_GFIMR); - liu_imask = __READ_REG(REG_GLIMR); - bert_imask = __READ_REG(REG_GBIMR); //if (framer_istatus & (1 << WAN_FE_LINENO(fe))){ if ((framer_istatus & (1 << WAN_DS_REGBITMAP(fe))) && (framer_imask & (1 << WAN_DS_REGBITMAP(fe)))) { - DEBUG_ISR("%s: Interrupt for line %d (FRAMER) status=0x%02X\n", - fe->name, WAN_FE_LINENO(fe),framer_istatus); + DEBUG_ISR("%s: Interrupt for line %d (FRAMER)\n", + fe->name, WAN_FE_LINENO(fe)); return 1; } + liu_istatus = __READ_REG(REG_GLISR); + liu_imask = __READ_REG(REG_GLIMR); //if (liu_istatus & (1 << WAN_FE_LINENO(fe))){ if ((liu_istatus & (1 << WAN_DS_REGBITMAP(fe))) && (liu_imask & (1 << WAN_DS_REGBITMAP(fe)))) { @@ -3147,6 +3364,8 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe) fe->name, WAN_FE_LINENO(fe)); return 1; } + bert_istatus = __READ_REG(REG_GBISR); + bert_imask = __READ_REG(REG_GBIMR); //if (bert_istatus & (1 << WAN_FE_LINENO(fe))){ if ((bert_istatus & (1 << WAN_DS_REGBITMAP(fe))) && (bert_imask & (1 << WAN_DS_REGBITMAP(fe)))) { @@ -3154,8 +3373,7 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe) fe->name, WAN_FE_LINENO(fe)); return 1; } - - DEBUG_TE1("%s: This interrupt not for this port %d\n", + DEBUG_ISR("%s: This interrupt not for this port %d\n", fe->name, WAN_FE_LINENO(fe)+1); return 0; @@ -3163,7 +3381,6 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe) static int sdla_ds_te1_intr(sdla_fe_t *fe) { - u_int8_t status = fe->fe_status; u_int8_t framer_istatus, liu_istatus, bert_istatus; u_int8_t device_id; int silent = 0; @@ -3184,8 +3401,8 @@ static int sdla_ds_te1_intr(sdla_fe_t *fe) //if (framer_istatus & (1 << WAN_FE_LINENO(fe))){ if (framer_istatus & (1 << WAN_DS_REGBITMAP(fe))){ - sdla_ds_te1_framer_rx_intr(fe, silent); - sdla_ds_te1_framer_tx_intr(fe, silent); + sdla_ds_te1_fr_rx_intr(fe, silent); + sdla_ds_te1_fr_tx_intr(fe, silent); //WRITE_REG(REG_GFISR, (1<name,fe->fe_alarm); #if 1 - if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ - sdla_fe_timer_event_t event; + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_SC){ /* AL: March 1, 2006 ** 1. Mask global FE intr ** 2. Disable automatic update */ @@ -3217,18 +3433,17 @@ static int sdla_ds_te1_intr(sdla_fe_t *fe) WAN_FE_INTR_MASK, 0x00); /* Start LINKDOWN poll */ - event.type = TE_LINKCRIT_TIMER; - event.delay = POLLING_TE1_TIMER*5; - sdla_ds_te1_add_event(fe, &event); - + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_LINK, + WAN_TE1_SWIRQ_SUBTYPE_LINKCRIT, + POLLING_TE1_TIMER*5); return 0; } #endif - sdla_ds_te1_set_status(fe, fe->fe_alarm); - if (status != fe->fe_status){ + if (sdla_ds_te1_set_status(fe, fe->fe_alarm)){ if (fe->fe_status != FE_CONNECTED){ - sdla_fe_timer_event_t event; /* AL: March 1, 2006 ** 1. Mask global FE intr ** 2. Disable automatic update */ @@ -3238,9 +3453,11 @@ static int sdla_ds_te1_intr(sdla_fe_t *fe) WAN_FE_INTR_MASK, 0x00); /* Start LINKDOWN poll */ - event.type = TE_LINKDOWN_TIMER; - event.delay = POLLING_TE1_TIMER*5; - sdla_ds_te1_add_event(fe, &event); + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_LINK, + WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN, + POLLING_TE1_TIMER*5); } } return 0; @@ -3269,7 +3486,6 @@ static void sdla_ds_te1_timer(unsigned long pfe) wan_smp_flag_t smp_flags; int empty = 1; - DEBUG_TEST("[TE1] %s: TE1 timer!\n", fe->name); if (wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical)){ wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); return; @@ -3287,9 +3503,10 @@ static void sdla_ds_te1_timer(unsigned long pfe) empty = WAN_LIST_EMPTY(&fe->event); wan_spin_unlock_irq(&fe->lockirq,&smp_flags); - if (!empty){ + if (!empty || fe->swirq_map){ + DEBUG_TEST("%s: TE1 timer!\n", fe->name); if (wan_test_and_set_bit(TE_TIMER_EVENT_PENDING,(void*)&fe->te_param.critical)){ - DEBUG_EVENT("%s: RM timer event is pending!\n", fe->name); + DEBUG_EVENT("%s: TE1 timer event is pending!\n", fe->name); return; } if (wandev->fe_enable_timer){ @@ -3308,7 +3525,7 @@ static void sdla_ds_te1_timer(unsigned long pfe) * sdla_ds_te1_add_timer() * * Description: Enable software timer interrupt in delay ms. - * Arguments: + * Arguments: delay - (in ms) * Returns: ****************************************************************************** */ @@ -3321,12 +3538,8 @@ static int sdla_ds_te1_add_timer(sdla_fe_t* fe, unsigned long delay) return 0; } -#if defined(__WINDOWS__) - /* delay is in MS, so it can be used directly by wan_add_timer() */ - err = wan_add_timer(&fe->timer, delay); -#else - err = wan_add_timer(&fe->timer, delay * HZ / 1000); -#endif + //err = wan_add_timer(&fe->timer, delay * HZ / 1000); + err = wan_add_timer(&fe->timer, delay * HZ ); if (err){ /* Failed to add timer */ @@ -3353,10 +3566,12 @@ sdla_ds_te1_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *event) wan_smp_flag_t smp_flags; WAN_ASSERT_RC(card == NULL, -EINVAL); - - DEBUG_TE1("%s: Add new DS Event=0x%X\n", - fe->name, event->type); + if (wan_test_bit(TE_TIMER_EVENT_INPROGRESS,(void*)&fe->te_param.critical)){ + DEBUG_EVENT("ADBG> %s: Event in progress...\n", fe->name); + return -EINVAL; + } + /* Creating event timer */ tevent = wan_malloc(sizeof(sdla_fe_timer_event_t)); if (tevent == NULL){ @@ -3365,7 +3580,6 @@ sdla_ds_te1_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *event) fe->name); return -EINVAL; } - memcpy(tevent, event, sizeof(sdla_fe_timer_event_t)); #if 0 @@ -3378,12 +3592,13 @@ sdla_ds_te1_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *event) wan_spin_lock_irq(&fe->lockirq,&smp_flags); /* Set event from pending event map */ if (wan_test_and_set_bit(event->type,(void*)&fe->event_map)){ - DEBUG_EVENT("%s: WARNING: Event type %d is already pending!\n", + DEBUG_TE1("%s: WARNING: Event type %d is already pending!\n", fe->name, event->type); wan_spin_unlock_irq(&fe->lockirq, &smp_flags); wan_free(tevent); return -EINVAL; } + tevent->start = SYSTEM_TICKS; if (WAN_LIST_EMPTY(&fe->event)){ WAN_LIST_INSERT_HEAD(&fe->event, tevent, next); }else{ @@ -3411,92 +3626,65 @@ sdla_ds_te1_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *event) } WAN_LIST_INSERT_AFTER(tmp, tevent, next); } + DEBUG_TEST("%s: Add new DS Event=0x%X (%d sec)\n", + fe->name, event->type,event->delay); wan_spin_unlock_irq(&fe->lockirq, &smp_flags); return 0; } - /****************************************************************************** -** sdla_ds_te1_polling() +** sdla_ds_te1_swirq_link() ** ** Description: ** Arguments: ** Returns: 0 - There are no more event. Do not need to schedule sw timer ** number - delay to schedule next event. ******************************************************************************/ -static int sdla_ds_te1_polling(sdla_fe_t* fe) +static int sdla_ds_te1_swirq_link(sdla_fe_t* fe) { - sdla_t *card = (sdla_t*)fe->card; - sdla_fe_timer_event_t *event; - wan_smp_flag_t smp_flags; - u_int8_t pending = 0; - unsigned char value; - unsigned int ch, bit, off; -#if 0 - unsigned int reg; -#endif + sdla_t *card = (sdla_t*)fe->card; + sdla_fe_swirq_t *swirq; + int subtype = 0, delay = 0; - WAN_ASSERT_RC(fe->write_fe_reg == NULL, 0); - WAN_ASSERT_RC(fe->read_fe_reg == NULL, 0); + WAN_ASSERT(fe->swirq == NULL); + swirq = &fe->swirq[WAN_TE1_SWIRQ_TYPE_LINK]; -#if 0 - DEBUG_EVENT("%s: %s:%d: ---------------START ----------------------\n", - fe->name, __FUNCTION__,__LINE__); - WARN_ON(1); - DEBUG_EVENT("%s: %s:%d: ---------------STOP ----------------------\n", - fe->name, __FUNCTION__,__LINE__); -#endif - wan_spin_lock_irq(&fe->lockirq,&smp_flags); - if (WAN_LIST_EMPTY(&fe->event)){ - wan_clear_bit(TE_TIMER_EVENT_PENDING,(void*)&fe->te_param.critical); - wan_spin_unlock_irq(&fe->lockirq,&smp_flags); - DEBUG_EVENT("%s: WARNING: No FE events in a queue!\n", - fe->name); - sdla_ds_te1_add_timer(fe, POLLING_TE1_TIMER); - return 0; + if (!WAN_STIMEOUT(swirq->start, swirq->delay)){ + /* Timeout is not expired yet */ + DEBUG_TEST("%s: T1/E1 link swirq (%s) is not ready (%ld:%ld:%d)...\n", + fe->name, WAN_TE1_SWIRQ_SUBTYPE_DECODE(swirq->subtype), + swirq->start,SYSTEM_TICKS,swirq->delay*HZ); + wan_set_bit(WAN_TE1_SWIRQ_TYPE_LINK, (void*)&fe->swirq_map); + return 1; } - event = WAN_LIST_FIRST(&fe->event); - WAN_LIST_REMOVE(event, next); - /* Clear event from pending event map */ - wan_clear_bit(event->type,(void*)&fe->event_map); - wan_spin_unlock_irq(&fe->lockirq,&smp_flags); - - DEBUG_TE1("%s: TE1 Polling State=%s Event=%X!\n", - fe->name, WAN_FE_STATUS_DECODE(fe), event->type); - switch(event->type){ - case TE_LINKCRIT_TIMER: - if (!sdla_ds_te1_read_crit_alarms(fe)){ - event->type = TE_LINKDOWN_TIMER; - }else{ - event->type = TE_LINKCRIT_TIMER; - } - event->delay = POLLING_TE1_TIMER; - pending = 1; - break; - - case TE_LINKDOWN_TIMER: + DEBUG_TE1("%s: T1/E1 link swirq (%s)\n", + fe->name, WAN_TE1_SWIRQ_SUBTYPE_DECODE(swirq->subtype)); + subtype = swirq->subtype; + switch(subtype){ + case WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN: sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); - if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_SC){ /* Short circuit detected, go to LINKCRIT state */ - event->type = TE_LINKCRIT_TIMER; - event->delay = POLLING_TE1_TIMER; - pending = 1; + subtype = WAN_TE1_SWIRQ_SUBTYPE_LINKCRIT; + delay = POLLING_TE1_TIMER; break; } sdla_ds_te1_pmon(fe, WAN_FE_PMON_UPDATE|WAN_FE_PMON_READ); sdla_ds_te1_set_status(fe, fe->fe_alarm); if (fe->fe_status == FE_CONNECTED){ - event->type = TE_LINKUP_TIMER; - event->delay = POLLING_TE1_TIMER; - pending = 1; - }else{ - event->type = TE_LINKDOWN_TIMER; - event->delay = POLLING_TE1_TIMER; - pending = 1; + subtype = WAN_TE1_SWIRQ_SUBTYPE_LINKUP; } + delay = POLLING_TE1_TIMER; break; - case TE_LINKUP_TIMER: + case WAN_TE1_SWIRQ_SUBTYPE_LINKCRIT: + if (!sdla_ds_te1_read_crit_alarms(fe)){ + subtype = WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN; + } + delay = POLLING_TE1_TIMER; + break; + + case WAN_TE1_SWIRQ_SUBTYPE_LINKUP: /* ALEX: ** Do not update protocol front end state from TE_LINKDOWN_TIMER ** because it cause to stay longer in interrupt handler @@ -3506,10 +3694,11 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) card->wandev.te_link_state(card); } if (fe->fe_cfg.poll_mode == WANOPT_YES){ - event->type = WAN_TE_POLL_LINKREADY; - event->delay = POLLING_TE1_TIMER; - pending = 1; + subtype = WAN_TE1_SWIRQ_SUBTYPE_LINKREADY; + delay = POLLING_TE1_TIMER; }else{ + /* Read alarm status before enabling fe interrupt */ + sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); /* Enable Basic Interrupt ** Enable automatic update pmon counters */ sdla_ds_te1_intr_ctrl( @@ -3517,35 +3706,234 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) (WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON), WAN_FE_INTR_ENABLE, 0x00); + return 0; } }else{ - event->type = TE_LINKDOWN_TIMER; - event->delay = POLLING_TE1_TIMER; - pending = 1; + subtype = WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN; + delay = POLLING_TE1_TIMER; } break; - case WAN_TE_POLL_LINKREADY: + case WAN_TE1_SWIRQ_SUBTYPE_LINKREADY: /* Only used in no interrupt driven front-end mode */ sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); - if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LIU_SC){ /* Short circuit detected, go to LINKCRIT state */ - event->type = TE_LINKCRIT_TIMER; - event->delay = POLLING_TE1_TIMER; - pending = 1; + subtype = WAN_TE1_SWIRQ_SUBTYPE_LINKCRIT; + delay = POLLING_TE1_TIMER; break; } sdla_ds_te1_set_status(fe, fe->fe_alarm); - if (fe->fe_status == FE_CONNECTED){ - pending = 1; - }else{ - event->type = TE_LINKDOWN_TIMER; - event->delay = POLLING_TE1_TIMER; - pending = 1; - break; + if (fe->fe_status != FE_CONNECTED){ + subtype = WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN; } + delay = POLLING_TE1_TIMER; break; + + default: + return -EINVAL; + } + /* SW irq is pending */ + wan_clear_bit(1, (void*)&swirq->pending); + sdla_ds_te1_swirq_trigger(fe, WAN_TE1_SWIRQ_TYPE_LINK, subtype, delay); + return 1; +} +/****************************************************************************** +** sdla_ds_te1_swirq_alarm() +** +** Description: +** Arguments: +** Returns: 0 - There are no more event. Do not need to schedule sw timer +** number - delay to schedule next event. +******************************************************************************/ +static int sdla_ds_te1_swirq_alarm(sdla_fe_t* fe, int type) +{ + sdla_fe_swirq_t *swirq; + u_int32_t alarms = fe->fe_alarm; + int update = WAN_FALSE; + + WAN_ASSERT(fe->swirq == NULL); + swirq = &fe->swirq[type]; + + DEBUG_TEST("%s: %s swirq (%s)\n", + fe->name, + WAN_TE1_SWIRQ_TYPE_DECODE(type), + WAN_TE1_SWIRQ_SUBTYPE_DECODE(swirq->subtype)); + + if (swirq->subtype == WAN_TE1_SWIRQ_SUBTYPE_ALARM_ON){ + + if (WAN_STIMEOUT(swirq->start, swirq->delay)){ + /* Got real LOS alarm */ + if (type == WAN_TE1_SWIRQ_TYPE_ALARM_AIS){ + alarms |= WAN_TE_BIT_ALARM_AIS; + }else if (type == WAN_TE1_SWIRQ_TYPE_ALARM_LOS){ + alarms |= WAN_TE_BIT_ALARM_LOS; + }else if (type == WAN_TE1_SWIRQ_TYPE_ALARM_LOF){ + alarms |= WAN_TE_BIT_ALARM_LOF; + } + wan_clear_bit(1, (void*)&swirq->pending); + update = WAN_TRUE; + }else{ + DEBUG_TEST("%s: %s swirq (%s) is not ready (%ld:%ld:%d)...\n", + fe->name, + WAN_TE1_SWIRQ_TYPE_DECODE(type), + WAN_TE1_SWIRQ_SUBTYPE_DECODE(swirq->subtype), + swirq->start,SYSTEM_TICKS,swirq->delay*HZ); + wan_set_bit(WAN_TE1_SWIRQ_TYPE_LINK, (void*)&fe->swirq_map); + return 1; + } + + }else if (swirq->subtype == WAN_TE1_SWIRQ_SUBTYPE_ALARM_OFF){ + + if (WAN_STIMEOUT(swirq->start, swirq->delay)){ + /* Clearing LOS alarm */ + if (type == WAN_TE1_SWIRQ_TYPE_ALARM_AIS){ + alarms &= ~WAN_TE_BIT_ALARM_AIS; + }else if (type == WAN_TE1_SWIRQ_TYPE_ALARM_LOS){ + alarms &= ~WAN_TE_BIT_ALARM_LOS; + }else if (type == WAN_TE1_SWIRQ_TYPE_ALARM_LOF){ + alarms &= ~WAN_TE_BIT_ALARM_LOF; + } + wan_clear_bit(1, (void*)&swirq->pending); + update = WAN_TRUE; + }else{ + DEBUG_TEST("%s: %s swirq (%s) is not ready (%ld:%ld:%d)...\n", + fe->name, + WAN_TE1_SWIRQ_TYPE_DECODE(type), + WAN_TE1_SWIRQ_SUBTYPE_DECODE(swirq->subtype), + swirq->start,SYSTEM_TICKS,swirq->delay*HZ); + wan_set_bit(WAN_TE1_SWIRQ_TYPE_LINK, (void*)&fe->swirq_map); + return 1; + } + } + + if (update == WAN_TRUE){ + DEBUG_TEST("%s: %s swirq (%s) updating state ...\n", + fe->name, + WAN_TE1_SWIRQ_TYPE_DECODE(type), + WAN_TE1_SWIRQ_SUBTYPE_DECODE(swirq->subtype)); + sdla_ds_te1_update_alarms(fe, alarms); + if (sdla_ds_te1_set_status(fe, fe->fe_alarm)){ + if (fe->fe_status == FE_CONNECTED){ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_LINK, + WAN_TE1_SWIRQ_SUBTYPE_LINKUP, + POLLING_TE1_TIMER); + }else{ + sdla_ds_te1_swirq_trigger( + fe, + WAN_TE1_SWIRQ_TYPE_LINK, + WAN_TE1_SWIRQ_SUBTYPE_LINKDOWN, + POLLING_TE1_TIMER); + } + return 1; + } + } + return 0; +} + +/****************************************************************************** +** sdla_ds_te1_swirq_trigger() +** +** Description: +** Arguments: +** Returns: 0 - There are no more event. Do not need to schedule sw timer +** number - delay to schedule next event. +******************************************************************************/ +static int sdla_ds_te1_swirq_trigger(sdla_fe_t* fe, int type, int subtype, int delay) +{ + + WAN_ASSERT(fe == NULL); + WAN_ASSERT(fe->swirq == NULL); + + DEBUG_TE1("%s: Trigger %s swirq (%s) (%d:%d) ...\n", + fe->name, + WAN_TE1_SWIRQ_TYPE_DECODE(type), + WAN_TE1_SWIRQ_SUBTYPE_DECODE(subtype), + wan_test_bit(1, (void*)&fe->swirq[type].pending), + fe->swirq[type].subtype); + if (!wan_test_and_set_bit(1, (void*)&fe->swirq[type].pending)){ + /* new swirq */ + fe->swirq[type].subtype = (u8)subtype; + fe->swirq[type].start = SYSTEM_TICKS; + }else{ + /* already in a process */ + if (fe->swirq[type].subtype != subtype){ + fe->swirq[type].subtype = (u8)subtype; + fe->swirq[type].start = SYSTEM_TICKS; + } + } + + fe->swirq[type].delay = delay; + wan_set_bit(type, (void*)&fe->swirq_map); + return 0; +} + +/****************************************************************************** +** sdla_ds_te1_swirq() +** +** Description: +** Arguments: +** Returns: 0 - There are no more event. Do not need to schedule sw timer +** number - delay to schedule next event. +******************************************************************************/ +static int sdla_ds_te1_swirq(sdla_fe_t* fe) +{ + + WAN_ASSERT(fe->swirq == NULL); + fe->swirq_map = 0; + if (wan_test_bit(1, (void*)&fe->swirq[WAN_TE1_SWIRQ_TYPE_LINK].pending)){ + sdla_ds_te1_swirq_link(fe); + } + + if (wan_test_bit(1, (void*)&fe->swirq[WAN_TE1_SWIRQ_TYPE_ALARM_AIS].pending)){ + sdla_ds_te1_swirq_alarm(fe, WAN_TE1_SWIRQ_TYPE_ALARM_AIS); + } + + if (wan_test_bit(1, (void*)&fe->swirq[WAN_TE1_SWIRQ_TYPE_ALARM_LOS].pending)){ + sdla_ds_te1_swirq_alarm(fe, WAN_TE1_SWIRQ_TYPE_ALARM_LOS); + } + + if (wan_test_bit(1, (void*)&fe->swirq[WAN_TE1_SWIRQ_TYPE_ALARM_LOF].pending)){ + sdla_ds_te1_swirq_alarm(fe, WAN_TE1_SWIRQ_TYPE_ALARM_LOF); + } + return 0; +} + +/****************************************************************************** +** sdla_ds_te1_polling() +** +** Description: +** Arguments: +** Returns: 0 - There are no more event. Do not need to schedule sw timer +** number - delay to schedule next event. +******************************************************************************/ +static int sdla_ds_te1_poll_events(sdla_fe_t* fe) +{ + sdla_fe_timer_event_t *event; + wan_smp_flag_t smp_flags; + u_int8_t pending = 0; + + wan_spin_lock_irq(&fe->lockirq,&smp_flags); + if (WAN_LIST_EMPTY(&fe->event)){ + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); + DEBUG_EVENT("%s: WARNING: No FE events in a queue!\n", + fe->name); + sdla_ds_te1_add_timer(fe, POLLING_TE1_TIMER); + return 0; + } + + event = WAN_LIST_FIRST(&fe->event); + WAN_LIST_REMOVE(event, next); + /* Clear event from pending event map */ + wan_clear_bit(event->type,(void*)&fe->event_map); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); + + DEBUG_TE1("%s: TE1 Polling event:0x%02X State=%s!\n", + fe->name, event->type, WAN_FE_STATUS_DECODE(fe)); + switch(event->type){ case TE_RBS_READ: /* Physically read RBS status and print */ sdla_ds_te1_rbs_print(fe, 0); @@ -3564,48 +3952,15 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) case TE_RBS_ENABLE: case TE_RBS_DISABLE: - value = READ_REG(REG_TCR1); - if (IS_T1_FEMEDIA(fe)){ - if (event->type == TE_RBS_ENABLE){ - value |= BIT_TCR1_T1_TSSE; - }else{ - value &= ~BIT_TCR1_T1_TSSE; - } - }else{ - if (event->type == TE_RBS_ENABLE){ - value |= BIT_TCR1_E1_T16S; - }else{ - value &= ~BIT_TCR1_E1_T16S; - } - } - WRITE_REG(REG_TCR1, value); - - for(ch = 1; ch <= fe->te_param.max_channels; ch++){ - if (!wan_test_bit(ch, &event->te_event.ch_map)){ - continue; - } - if (IS_T1_FEMEDIA(fe)){ - bit = (ch-1) % 8; - off = (ch-1) / 8; - }else{ - if (ch == 16) continue; - bit = ch % 8; - off = ch / 8; - } - value = READ_REG(REG_SSIE1+off); - if (event->type == TE_RBS_ENABLE){ - value |= (1<name, ch, REG_SSIE1+off, value); - WRITE_REG(REG_SSIE1+off, value); - } + if (event->type == TE_RBS_ENABLE){ + sdla_ds_te1_rbs_ctrl(fe, event->te_event.ch_map, WAN_TRUE); + }else{ + sdla_ds_te1_rbs_ctrl(fe, event->te_event.ch_map, WAN_FALSE); + } break; case TE_SET_LB_MODE: - sdla_ds_te1_set_lb(fe, event->te_event.lb_type, event->mode); + sdla_ds_te1_set_lb(fe, event->te_event.lb_type, event->mode, ENABLE_ALL_CHANNELS); break; case TE_POLL_CONFIG: @@ -3692,13 +4047,41 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) wan_clear_bit(TE_TIMER_EVENT_PENDING,(void*)&fe->te_param.critical); if (event) wan_free(event); - /* Add fe timer */ - event = WAN_LIST_FIRST(&fe->event); - if (event){ - sdla_ds_te1_add_timer(fe, event->delay); - }else{ - sdla_ds_te1_add_timer(fe, POLLING_TE1_TIMER); + return 0; +} + +/****************************************************************************** +** sdla_ds_te1_polling() +** +** Description: +** Arguments: +** Returns: 0 - There are no more event. Do not need to schedule sw timer +** number - delay to schedule next event. +******************************************************************************/ +static int sdla_ds_te1_polling(sdla_fe_t* fe) +{ + + WAN_ASSERT_RC(fe->write_fe_reg == NULL, 0); + WAN_ASSERT_RC(fe->read_fe_reg == NULL, 0); + +#if 0 + DEBUG_EVENT("%s: %s:%d: ---------------START ----------------------\n", + fe->name, __FUNCTION__,__LINE__); + WARN_ON(1); + DEBUG_EVENT("%s: %s:%d: ---------------STOP ----------------------\n", + fe->name, __FUNCTION__,__LINE__); +#endif + + if (fe->swirq_map){ + sdla_ds_te1_swirq(fe); } + + if (!WAN_LIST_EMPTY(&fe->event)){ + sdla_ds_te1_poll_events(fe); + } + + wan_clear_bit(TE_TIMER_EVENT_PENDING,(void*)&fe->te_param.critical); + sdla_ds_te1_add_timer(fe, POLLING_TE1_TIMER); return 0; } @@ -3725,14 +4108,10 @@ static int sdla_ds_te1_txlbcode_done(sdla_fe_t *fe) return -EINVAL; } + wan_clear_bit(fe->te_param.lb_tx_mode, &fe->te_param.lb_mode_map); DEBUG_TE1("%s: T1 %s loopback code sent.\n", fe->name, WAN_TE1_BOC_LB_CODE_DECODE(fe->te_param.lb_tx_code)); - if (fe->te_param.lb_tx_cmd == WAN_TE1_LB_ENABLE){ - wan_set_bit(fe->te_param.lb_tx_mode, &fe->te_param.lb_mode_map); - }else{ - wan_clear_bit(fe->te_param.lb_tx_mode, &fe->te_param.lb_mode_map); - } fe->te_param.lb_tx_cmd = 0x00; fe->te_param.lb_tx_code = 0x00; wan_clear_bit(LINELB_WAITING,(void*)&fe->te_param.critical); @@ -3852,7 +4231,7 @@ static int sdla_ds_te1_pmon(sdla_fe_t *fe, int action) ******************************************************************************/ static int sdla_ds_te1_boc(sdla_fe_t *fe, int mode) { - unsigned char boc, lb_mode, lb_cmd; + unsigned char boc, lb_type, lb_mode; boc = READ_REG(REG_T1RBOC); if (!mode){ @@ -3869,30 +4248,38 @@ static int sdla_ds_te1_boc(sdla_fe_t *fe, int mode) case PAYLB_ACTIVATE_CODE: case PAYLB_DEACTIVATE_CODE: if (boc == LINELB_ACTIVATE_CODE || boc == LINELB_DEACTIVATE_CODE){ - lb_mode = WAN_TE1_LINELB_MODE; + lb_type = WAN_TE1_LINELB_MODE; + if (wan_test_bit(WAN_TE1_TX_LINELB_MODE, &fe->te_param.lb_mode_map)){ + return 0; /* skip ack */ + } }else{ - lb_mode = WAN_TE1_PAYLB_MODE; - } + lb_type = WAN_TE1_PAYLB_MODE; + if (wan_test_bit(WAN_TE1_TX_PAYLB_MODE, &fe->te_param.lb_mode_map)){ + return 0; /* skip ack */ + } + } if (boc == LINELB_ACTIVATE_CODE || boc == PAYLB_ACTIVATE_CODE){ - lb_cmd = WAN_TE1_LB_ENABLE; + lb_mode = WAN_TE1_LB_ENABLE; }else{ - lb_cmd = WAN_TE1_LB_DISABLE; - } - sdla_ds_te1_set_lb(fe, lb_mode, lb_cmd); + lb_mode = WAN_TE1_LB_DISABLE; + } + + + sdla_ds_te1_set_lb(fe, lb_type, lb_mode, ENABLE_ALL_CHANNELS); DEBUG_TE1("%s: Received T1 %s %s code from far end.\n", fe->name, - WAN_TE1_LB_ACTION_DECODE(lb_cmd), - WAN_TE1_LB_MODE_DECODE(lb_mode)); + WAN_TE1_LB_ACTION_DECODE(lb_mode), + WAN_TE1_LB_MODE_DECODE(lb_type)); break; case UNIVLB_DEACTIVATE_CODE: - DEBUG_TE1("%s: Received T1 %s code from far end.(%08X)\n", + DEBUG_EVENT("%s: Received T1 %s code from far end.(%08X)\n", fe->name, WAN_TE1_BOC_LB_CODE_DECODE(boc),fe->te_param.lb_mode_map); if (wan_test_bit(WAN_TE1_LINELB_MODE, &fe->te_param.lb_mode_map)){ - sdla_ds_te1_set_lb(fe, WAN_TE1_LINELB_MODE, WAN_TE1_LB_DISABLE); + sdla_ds_te1_set_lb(fe, WAN_TE1_LINELB_MODE, WAN_TE1_LB_DISABLE, ENABLE_ALL_CHANNELS); } if (wan_test_bit(WAN_TE1_PAYLB_MODE, &fe->te_param.lb_mode_map)){ - sdla_ds_te1_set_lb(fe, WAN_TE1_PAYLB_MODE, WAN_TE1_LB_DISABLE); + sdla_ds_te1_set_lb(fe, WAN_TE1_PAYLB_MODE, WAN_TE1_LB_DISABLE, ENABLE_ALL_CHANNELS); } break; @@ -3904,15 +4291,75 @@ static int sdla_ds_te1_boc(sdla_fe_t *fe, int mode) return 0; } -/* - ****************************************************************************** - * sdla_ds_te1_rxlevel() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ +/****************************************************************************** +* sdla_ds_e1_sabits() +* +* Description: +* Arguments: +* Returns: +******************************************************************************/ +static int sdla_ds_e1_sabits(sdla_fe_t* fe) +{ + u_int8_t sabits = READ_REG(REG_SaBITS); + + DEBUG_EVENT("%s: Sa Bits: %d:%d:%d:%d:%d\n", + fe->name, + (sabits & BIT_SaBITS_Sa4) ? 1 : 0, + (sabits & BIT_SaBITS_Sa5) ? 1 : 0, + (sabits & BIT_SaBITS_Sa6) ? 1 : 0, + (sabits & BIT_SaBITS_Sa7) ? 1 : 0, + (sabits & BIT_SaBITS_Sa8) ? 1 : 0); + return 0; +} + +/****************************************************************************** +* sdla_ds_e1_sa6code() +* +* Description: +* Arguments: +* Returns: +******************************************************************************/ +static int sdla_ds_e1_sa6code(sdla_fe_t* fe) +{ + u_int8_t sa6code = READ_REG(REG_Sa6CODE); + + switch(sa6code){ + case 0x08: case 0x04: case 0x02: case 0x01: + DEBUG_EVENT("%s: Received Sa6_8 Sa6 codeword\n", fe->name); + break; + case 0x0A: case 0x05: + DEBUG_EVENT("%s: Received Sa6_C Sa6 codeword\n", fe->name); + break; + case 0x06: case 0x03: case 0x09: + DEBUG_EVENT("%s: Received Sa6_C Sa6 codeword\n", fe->name); + break; + case 0x0E: case 0x07: case 0x0B: case 0x0D: + DEBUG_EVENT("%s: Received Sa6_E Sa6 codeword\n", fe->name); + break; + case 0x0F: + DEBUG_EVENT("%s: Received Sa6_F Sa6 codeword\n", fe->name); + break; + default: + DEBUG_EVENT("%s: Received unknown Sa6 codeword\n", fe->name); + break; + } + DEBUG_EVENT("%s: Sa Bits: %d:%d:%d:%d:%d\n", + fe->name, + (sa6code & BIT_SaBITS_Sa4) ? 1 : 0, + (sa6code & BIT_SaBITS_Sa5) ? 1 : 0, + (sa6code & BIT_SaBITS_Sa6) ? 1 : 0, + (sa6code & BIT_SaBITS_Sa7) ? 1 : 0, + (sa6code & BIT_SaBITS_Sa8) ? 1 : 0); + return 0; +} + +/****************************************************************************** +* sdla_ds_te1_rxlevel() +* +* Description: +* Arguments: +* Returns: +******************************************************************************/ static int sdla_ds_te1_rxlevel(sdla_fe_t* fe) { int index = 0; @@ -3946,15 +4393,20 @@ static int sdla_ds_te1_rxlevel(sdla_fe_t* fe) * Returns: ****************************************************************************** */ -static int sdla_ds_te1_liu_alb(sdla_fe_t* fe, unsigned char mode) +static int sdla_ds_te1_liu_alb(sdla_fe_t* fe, unsigned char cmd) { unsigned char value; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); + if (cmd == WAN_TE1_LB_ENABLE && WAN_TE1_CLK(fe) != WAN_MASTER_CLK){ + DEBUG_EVENT("%s: ERROR: You must be configured to Master Clock to execute this Loopback type!\n", + fe->name); + return -EINVAL; + } value = READ_REG(REG_LMCR); - if (mode == WAN_TE1_LB_ENABLE){ + if (cmd == WAN_TE1_LB_ENABLE){ value |= BIT_LMCR_ALB; }else{ value &= ~BIT_LMCR_ALB; @@ -3972,15 +4424,20 @@ static int sdla_ds_te1_liu_alb(sdla_fe_t* fe, unsigned char mode) * Returns: ****************************************************************************** */ -static int sdla_ds_te1_liu_llb(sdla_fe_t* fe, unsigned char mode) +static int sdla_ds_te1_liu_llb(sdla_fe_t* fe, unsigned char cmd) { unsigned char value; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); + if (cmd == WAN_TE1_LB_ENABLE && WAN_TE1_CLK(fe) != WAN_MASTER_CLK){ + DEBUG_EVENT("%s: ERROR: You must be configured to Master Clock to execute this Loopback type!\n", + fe->name); + return -EINVAL; + } value = READ_REG(REG_LMCR); - if (mode == WAN_TE1_LB_ENABLE){ + if (cmd == WAN_TE1_LB_ENABLE){ value |= BIT_LMCR_LLB; }else{ value &= ~BIT_LMCR_LLB; @@ -3998,7 +4455,7 @@ static int sdla_ds_te1_liu_llb(sdla_fe_t* fe, unsigned char mode) * Returns: ****************************************************************************** */ -static int sdla_ds_te1_liu_rlb(sdla_fe_t* fe, unsigned char mode) +static int sdla_ds_te1_liu_rlb(sdla_fe_t* fe, unsigned char cmd) { unsigned char value; @@ -4006,7 +4463,7 @@ static int sdla_ds_te1_liu_rlb(sdla_fe_t* fe, unsigned char mode) WAN_ASSERT(fe->read_fe_reg == NULL); value = READ_REG(REG_LMCR); - if (mode == WAN_TE1_LB_ENABLE){ + if (cmd == WAN_TE1_LB_ENABLE){ value |= BIT_LMCR_RLB; }else{ value &= ~BIT_LMCR_RLB; @@ -4024,15 +4481,21 @@ static int sdla_ds_te1_liu_rlb(sdla_fe_t* fe, unsigned char mode) * Returns: ****************************************************************************** */ -static int sdla_ds_te1_fr_flb(sdla_fe_t* fe, unsigned char mode) +static int sdla_ds_te1_fr_flb(sdla_fe_t* fe, unsigned char cmd) { unsigned char value; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); + if (cmd == WAN_TE1_LB_ENABLE && WAN_TE1_CLK(fe) != WAN_MASTER_CLK){ + DEBUG_EVENT("%s: ERROR: You must be configured to Master Clock to execute this Loopback type!\n", + fe->name); + return -EINVAL; + } + value = READ_REG(REG_RCR3); - if (mode == WAN_TE1_LB_ENABLE){ + if (cmd == WAN_TE1_LB_ENABLE){ value |= BIT_RCR3_FLB; }else{ value &= ~BIT_RCR3_FLB; @@ -4050,7 +4513,7 @@ static int sdla_ds_te1_fr_flb(sdla_fe_t* fe, unsigned char mode) * Returns: ****************************************************************************** */ -static int sdla_ds_te1_fr_plb(sdla_fe_t* fe, unsigned char mode) +static int sdla_ds_te1_fr_plb(sdla_fe_t* fe, unsigned char cmd) { unsigned char value; @@ -4058,7 +4521,7 @@ static int sdla_ds_te1_fr_plb(sdla_fe_t* fe, unsigned char mode) WAN_ASSERT(fe->read_fe_reg == NULL); value = READ_REG(REG_RCR3); - if (mode == WAN_TE1_LB_ENABLE){ + if (cmd == WAN_TE1_LB_ENABLE){ value |= BIT_RCR3_PLB; }else{ value &= ~BIT_RCR3_PLB; @@ -4075,42 +4538,48 @@ static int sdla_ds_te1_fr_plb(sdla_fe_t* fe, unsigned char mode) * Returns: ******************************************************************************/ static int -sdla_ds_te1_tx_lb(sdla_fe_t* fe, u_int8_t mode, u_int8_t cmd) +sdla_ds_te1_tx_lb(sdla_fe_t* fe, u_int8_t type, u_int8_t mode) { sdla_fe_timer_event_t fe_event; - int delay; + int delay = 0; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - if (!IS_T1_FEMEDIA(fe) || (fe->fe_status != FE_CONNECTED)){ - return -EINVAL; + if (!IS_T1_FEMEDIA(fe)){ + DEBUG_TE1("%s: ERROR: Unsupported Loopback type %s!\n", + fe->name, WAN_TE1_LB_MODE_DECODE(type)); + return WAN_FE_LBMODE_RC_FAILED; } if (wan_test_bit(LINELB_WAITING,(void*)&fe->te_param.critical)){ DEBUG_TE1("%s: Still waiting for far end to send loopback signal back!\n", fe->name); - return -EBUSY; + return WAN_FE_LBMODE_RC_TXBUSY; } - fe->te_param.lb_tx_mode = mode; - fe->te_param.lb_tx_cmd = cmd; - if (mode == WAN_TE1_TX_LINELB_MODE){ - if (cmd == WAN_TE1_LB_ENABLE){ + + if (WAN_TE1_CLK(fe) != WAN_MASTER_CLK){ + DEBUG_EVENT("%s: ERROR: You must be configured to Master Clock to execute this Loopback type!\n", + fe->name); + return WAN_FE_LBMODE_RC_FAILED; + } + fe->te_param.lb_tx_mode = type; + fe->te_param.lb_tx_cmd = mode; + if (type == WAN_TE1_TX_LINELB_MODE){ + if (mode == WAN_TE1_LB_ENABLE){ fe->te_param.lb_tx_code = LINELB_ACTIVATE_CODE; }else{ fe->te_param.lb_tx_code = LINELB_DEACTIVATE_CODE; } - }else if (mode == WAN_TE1_TX_PAYLB_MODE){ - if (cmd == WAN_TE1_LB_ENABLE){ + }else if (type == WAN_TE1_TX_PAYLB_MODE){ + if (mode == WAN_TE1_LB_ENABLE){ fe->te_param.lb_tx_code = PAYLB_ACTIVATE_CODE; }else{ fe->te_param.lb_tx_code = PAYLB_DEACTIVATE_CODE; } } - DEBUG_TE1("%s: Sending T1 %s loopback code...\n", fe->name, WAN_TE1_BOC_LB_CODE_DECODE(fe->te_param.lb_tx_code)); - - delay = (WAN_T1_FDL_MSG_TIME * (WAN_T1_ESF_LINELB_TX_CNT + 1)) / 1000; + wan_set_bit(type, &fe->te_param.lb_mode_map); if (WAN_FE_FRAME(fe) == WAN_FR_ESF){ @@ -4142,72 +4611,99 @@ sdla_ds_te1_tx_lb(sdla_fe_t* fe, u_int8_t mode, u_int8_t cmd) fe_event.type = TE_LINELB_TIMER; fe_event.delay = delay + 1; sdla_ds_te1_add_event(fe, &fe_event); + return WAN_FE_LBMODE_RC_PENDING; +} + +/****************************************************************************** +* sdla_ds_te1_pclb() +* +* Description: +* Arguments: +* Returns: +******************************************************************************/ +static int sdla_ds_te1_pclb(sdla_fe_t *fe, u_int8_t cmd, u_int32_t chan_map) +{ + int off, shift, chan; + int channel_range = (IS_T1_FEMEDIA(fe)) ? + NUM_OF_T1_CHANNELS : + NUM_OF_E1_TIMESLOTS; + unsigned char val; + + for(chan = 1; chan <= channel_range; chan++){ + + if (wan_test_bit(chan, &chan_map)){ + + off = (chan-1) / 8; + shift = (chan-1) % 8; + val = READ_REG(REG_PCL1+off); + WRITE_REG(REG_PCL1+off, val | (0x01 << shift)); + } + } return 0; } -/* - ****************************************************************************** - * sdla_ds_te1_set_lb() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ +/****************************************************************************** +* sdla_ds_te1_set_lb() +* +* Description: +* Arguments: +* Returns: +******************************************************************************/ static int -sdla_ds_te1_set_lb(sdla_fe_t *fe, u_int8_t mode, u_int8_t cmd) +sdla_ds_te1_set_lb(sdla_fe_t *fe, u_int8_t type, u_int8_t mode, u_int32_t chan_map) { int err = 0; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - switch(mode){ + if (!chan_map) chan_map = WAN_TE1_ACTIVE_CH(fe); + switch(type){ case WAN_TE1_LIU_ALB_MODE: - err = sdla_ds_te1_liu_alb(fe, cmd); + err = sdla_ds_te1_liu_alb(fe, mode); break; case WAN_TE1_LIU_LLB_MODE: - err = sdla_ds_te1_liu_llb(fe, cmd); + err = sdla_ds_te1_liu_llb(fe, mode); break; //case WAN_TE1_LIU_RLB_MODE: - // err = sdla_ds_te1_liu_rlb(fe, cmd); + // err = sdla_ds_te1_liu_rlb(fe, mode); // break; case WAN_TE1_LIU_DLB_MODE: - if (!sdla_ds_te1_liu_llb(fe, cmd)){ - err = sdla_ds_te1_liu_rlb(fe, cmd); + if (!(err = sdla_ds_te1_liu_llb(fe, mode))){ + err = sdla_ds_te1_liu_rlb(fe, mode); } break; case WAN_TE1_LIU_RLB_MODE: case WAN_TE1_LINELB_MODE: - err = sdla_ds_te1_liu_rlb(fe, cmd); + err = sdla_ds_te1_liu_rlb(fe, mode); break; case WAN_TE1_PAYLB_MODE: - err = sdla_ds_te1_fr_plb(fe, cmd); + err = sdla_ds_te1_fr_plb(fe, mode); break; case WAN_TE1_DDLB_MODE: - err = sdla_ds_te1_fr_flb(fe, cmd); + err = sdla_ds_te1_fr_flb(fe, mode); break; - case WAN_TE1_TX_LINELB_MODE: - case WAN_TE1_TX_PAYLB_MODE: - return sdla_ds_te1_tx_lb(fe, mode, cmd); + case WAN_TE1_PCLB_MODE: + err = sdla_ds_te1_pclb(fe, mode, chan_map); break; default: - DEBUG_EVENT("%s: Unsupported loopback mode (%s)!\n", + DEBUG_EVENT("%s: Unsupported loopback type (%s) type=%d mode=%d!\n", fe->name, - WAN_TE1_LB_MODE_DECODE(mode)); + WAN_TE1_LB_MODE_DECODE(type),type,mode); return -EINVAL; } - if (!err){ - if (cmd == WAN_TE1_LB_ENABLE){ - wan_set_bit(mode, &fe->te_param.lb_mode_map); + if (err == WAN_FE_LBMODE_RC_SUCCESS){ + if (mode == WAN_TE1_LB_ENABLE){ + wan_set_bit(type, &fe->te_param.lb_mode_map); }else{ - wan_clear_bit(mode, &fe->te_param.lb_mode_map); + wan_clear_bit(type, &fe->te_param.lb_mode_map); } } - DEBUG_EVENT("%s: %s %s mode... %s\n", - fe->name, - WAN_TE1_LB_ACTION_DECODE(cmd), - WAN_TE1_LB_MODE_DECODE(mode), - (!err) ? "Done" : "Failed"); + + DEBUG_EVENT("%s: %s %s mode ... %s\n", + fe->name, + WAN_TE1_LB_ACTION_DECODE(mode), + WAN_TE1_LB_MODE_DECODE(type), + (!err) ? "Done" : "Failed"); return err; } @@ -4260,20 +4756,53 @@ static u32 sdla_ds_te1_get_lbmode(sdla_fe_t *fe) static int sdla_ds_te1_udp_lb(sdla_fe_t *fe, char *data) { sdla_fe_lbmode_t *lb = (sdla_fe_lbmode_t*)data; + int err = 0; + lb->rc = WAN_FE_LBMODE_RC_SUCCESS; if (lb->cmd == WAN_FE_LBMODE_CMD_SET){ - if (sdla_ds_te1_set_lb(fe, lb->type, lb->mode)){ - lb->rc = WAN_FE_LBMODE_RC_FAILED; - return 0; + switch(lb->type){ + case WAN_TE1_TX_LINELB_MODE: + case WAN_TE1_TX_PAYLB_MODE: + lb->rc = (u8)sdla_ds_te1_tx_lb(fe, lb->type, lb->mode); + return 0; + break; + default: + err = sdla_ds_te1_set_lb(fe, lb->type, lb->mode, lb->chan_map); + break; } }else if (lb->cmd == WAN_FE_LBMODE_CMD_GET){ lb->type_map = sdla_ds_te1_get_lbmode(fe); } - if (wan_test_bit(LINELB_WAITING,(void*)&fe->te_param.critical)){ - lb->rc = WAN_FE_LBMODE_RC_PENDING; - return 0; + if (err) lb->rc = WAN_FE_LBMODE_RC_FAILED; + return 0; +} + +/****************************************************************************** +* sdla_ds_te1_udp_get_stats() +* +* Description: +* Arguments: +* Returns: +******************************************************************************/ +static int +sdla_ds_te1_udp_get_stats(sdla_fe_t *fe, char *data,int force) +{ + sdla_fe_stats_t *stats = (sdla_fe_stats_t*)&data[0]; + + /* TE1 Update T1/E1 perfomance counters */ + sdla_ds_te1_pmon(fe, WAN_FE_PMON_UPDATE|WAN_FE_PMON_READ); + sdla_ds_te1_rxlevel(fe); + memcpy(stats, &fe->fe_stats, sizeof(sdla_fe_stats_t)); + + if (force){ + /* force to read FE alarms */ + DEBUG_EVENT("%s: Force to read Front-End alarms\n", + fe->name); + stats->alarms = + sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ); } - lb->rc = WAN_FE_LBMODE_RC_SUCCESS; + /* Display Liu alarms */ + stats->alarms |= WAN_TE_ALARM_LIU; return 0; } @@ -4770,18 +5299,7 @@ static int sdla_ds_te1_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) break; case WAN_FE_GET_STAT: - /* TE1 Update T1/E1 perfomance counters */ - sdla_ds_te1_pmon(fe, WAN_FE_PMON_UPDATE|WAN_FE_PMON_READ); - sdla_ds_te1_rxlevel(fe); - memcpy(&data[0], &fe->fe_stats, sizeof(sdla_fe_stats_t)); - if (udp_cmd->wan_cmd_fe_force){ - sdla_fe_stats_t *fe_stats = (sdla_fe_stats_t*)&data[0]; - /* force to read FE alarms */ - DEBUG_EVENT("%s: Force to read Front-End alarms\n", - fe->name); - fe_stats->alarms = - sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ); - } + sdla_ds_te1_udp_get_stats(fe, data, udp_cmd->wan_cmd_fe_force); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; udp_cmd->wan_cmd_data_len = sizeof(sdla_fe_stats_t); break; @@ -4924,15 +5442,15 @@ static int sdla_ds_te1_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) fe_debug = (sdla_fe_debug_t*)&data[0]; switch(fe_debug->mode){ case WAN_FE_TXMODE_ENABLE: - DEBUG_EVENT("%s: FE Transmitter Enabled! (tx tri-state mode OFF)\n", + DEBUG_EVENT("%s: Enable Transmitter!\n", fe->name); - WRITE_REG(REG_LMCR, (READ_REG(REG_LMCR) | BIT_LMCR_TE)); + WRITE_REG(REG_LMCR, READ_REG(REG_LMCR) | BIT_LMCR_TE); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; break; case WAN_FE_TXMODE_DISABLE: - DEBUG_EVENT("%s: FE Transmitter Disabled! (tx tri-state mode ON)!\n", + DEBUG_EVENT("%s: Disable Transmitter (tx tri-state mode)!\n", fe->name); - WRITE_REG(REG_LMCR, (READ_REG(REG_LMCR) & ~BIT_LMCR_TE)); + WRITE_REG(REG_LMCR, READ_REG(REG_LMCR) & ~BIT_LMCR_TE); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; break; default: @@ -4966,22 +5484,22 @@ sdla_ds_te1_update_alarm_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt) FE_MEDIA_DECODE(fe)); PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "ALOS", WAN_TE_ALOS_ALARM(fe->fe_alarm), - "LOS", WAN_TE_LOS_ALARM(fe->fe_alarm)); + "ALOS", WAN_TE_PRN_ALARM_ALOS(fe->fe_alarm), + "LOS", WAN_TE_PRN_ALARM_LOS(fe->fe_alarm)); PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "RED", WAN_TE_RED_ALARM(fe->fe_alarm), - "AIS", WAN_TE_AIS_ALARM(fe->fe_alarm)); + "RED", WAN_TE_PRN_ALARM_RED(fe->fe_alarm), + "AIS", WAN_TE_PRN_ALARM_AIS(fe->fe_alarm)); if (IS_T1_FEMEDIA(fe)){ PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "RAI", WAN_TE_RAI_ALARM(fe->fe_alarm), - "OOF", WAN_TE_OOF_ALARM(fe->fe_alarm)); + "RAI", WAN_TE_PRN_ALARM_RAI(fe->fe_alarm), + "LOF", WAN_TE_PRN_ALARM_LOF(fe->fe_alarm)); }else{ PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "OOF", WAN_TE_OOF_ALARM(fe->fe_alarm), - "RAI", WAN_TE_RAI_ALARM(fe->fe_alarm)); + "LOF", WAN_TE_PRN_ALARM_LOF(fe->fe_alarm), + "RAI", WAN_TE_PRN_ALARM_RAI(fe->fe_alarm)); } return m->count; #endif diff --git a/patches/kdrivers/src/net/sdla_aft_te1.c b/patches/kdrivers/src/net/sdla_aft_te1.c index 357fb4e..1a6b24d 100644 --- a/patches/kdrivers/src/net/sdla_aft_te1.c +++ b/patches/kdrivers/src/net/sdla_aft_te1.c @@ -145,6 +145,13 @@ # undef AFT_CLOCK_SYNC #endif +#if 1 +#undef AFT_FIFO_GEN_DEBUG +#else +#warning "AFT_FIFO_GEN_DEBUG Enabled" +#define AFT_FIFO_GEN_DEBUG +#endif + #if 0 # warning "AFT_SERIAL_DEBUGGING is enabled" # define AFT_SINGLE_DMA_CHAIN 1 @@ -365,7 +372,7 @@ static void disable_comm (sdla_t *card); static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card); static void wp_aft_dma_per_port_isr(sdla_t *card); static void wp_aft_tdmv_per_port_isr(sdla_t *card); -static void wp_aft_fifo_per_port_isr(sdla_t *card); +static int wp_aft_fifo_per_port_isr(sdla_t *card); static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr); static void wp_aft_serial_status_isr(sdla_t *card, u32 status); static void wp_aft_free_timer_status_isr(sdla_t *g_card, u32 free_run_intr_status); @@ -3684,11 +3691,12 @@ static void if_tx_timeout (netdevice_t *dev) card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); cur_dma_ptr=aft_dmachain_get_tx_dma_addr(reg); - DEBUG_EVENT("%s: Chain TxPend=%d, TxCur=%d, TxPend=%d HwCur=%d TxA=%d TxC=%ld\n", - chan->if_name, + DEBUG_EVENT("%s: Chain TxPend=%d, TxCur=%d, TxPend=%d TxSize=%i HwCur=%d TxA=%d TxC=%ld\n", + chan->if_name, wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status), chan->tx_chain_indx, chan->tx_pending_chain_indx, + chan->tx_chain_sz, cur_dma_ptr, chan->tx_attempts, WAN_NETIF_STATS_TX_PACKETS(&chan->common)); @@ -4721,8 +4729,10 @@ static void aft_dma_tx_complete (sdla_t *card, private_area_t *chan, int wdt, in if (reset){ return; } - - aft_dma_tx(card,chan); + + if (!wdt) { + aft_dma_tx(card,chan); + } if (WAN_NETIF_QUEUE_STOPPED(chan->common.dev)){ /* Wakeup stack also wakes up DCHAN, @@ -4730,7 +4740,6 @@ static void aft_dma_tx_complete (sdla_t *card, private_area_t *chan, int wdt, in call the upper layer and let it decide what to do */ wanpipe_wake_stack(chan); - } if (chan->common.usedby == TDM_VOICE_DCHAN){ @@ -5507,9 +5516,9 @@ static void wp_bh_rx(private_area_t* chan, netskb_t *new_skb, u8 pkt_error, int wan_skb_free(new_skb); - wan_skb_queue_tail(&chan->wp_tx_pending_list,tskb); - + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + wan_skb_queue_tail(&chan->wp_tx_pending_list,tskb); aft_dma_tx(card,chan); wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); #endif @@ -5691,132 +5700,153 @@ static void wp_bh (void *data, int pending) * **********************************************************/ - - -static void __wp_aft_fifo_per_port_isr(sdla_t *card, u32 rx_status, u32 tx_status) +static int __wp_aft_fifo_per_port_isr(sdla_t *card, u32 rx_status, u32 tx_status) { int num_of_logic_ch; u32 tmp_fifo_reg; - private_area_t *chan, *top_chan=NULL; - int i,fifo=0; + private_area_t *chan=NULL, *top_chan=NULL; + int i,tx_fifo=0,rx_fifo=0; + u8 chan_valid=0; + u16 skip_tx_top_chan=0,skip_rx_top_chan=0; + int irq_handled=0; tx_status&=card->u.aft.active_ch_map; + tx_status&=card->u.aft.logic_ch_map; + rx_status&=card->u.aft.active_ch_map; + rx_status&=card->u.aft.logic_ch_map; num_of_logic_ch=card->u.aft.num_of_time_slots; +#ifdef WANPIPE_PERFORMANCE_DEBUG + if (rx_status) { + AFT_PERF_STAT_INC(card,isr,fifo_rx); + } + + if (tx_status) { + AFT_PERF_STAT_INC(card,isr,fifo_tx); + } +#endif + + if (!tx_status && !rx_status) { + return irq_handled; + } + + /* At this point we know that fifo interrupt is real */ + irq_handled=1; + if (!wan_test_bit(0,&card->u.aft.comm_enabled)){ if (tx_status){ card->wandev.stats.tx_aborted_errors++; + WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(&chan->common); //++chan->if_stats.tx_fifo_errors; } if (rx_status){ card->wandev.stats.rx_over_errors++; + } - return; + return irq_handled; } - - if (tx_status != 0){ - for (i=0;iu.aft.logic_ch_map)){ - - chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; - if (!chan){ - DEBUG_EVENT("Warning: ignoring tx fifo intr: no dev!\n"); - continue; - } - if (wan_test_bit(0,&chan->interface_down)){ - continue; - } -#if 1 - if (!chan->hdlc_eng && !wan_test_bit(0,&chan->idle_start)){ - DEBUG_TEST("%s: Warning: ignoring tx fifo: dev idle start!\n", - chan->if_name); - continue; - } -#endif - if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ - continue; - } - DEBUG_TEST("%s:%s: Warning TX Fifo Error on LogicCh=%ld Slot=%d!\n", - card->devname,chan->if_name,chan->logic_ch_num,i); -#if 0 + for (i=0;iu.aft.dev_to_ch_map[i]; + if (!chan){ + DEBUG_EVENT("Warning: ignoring tx fifo intr: no dev!\n"); + continue; + } + chan_valid=1; + + if (wan_test_bit(0,&chan->interface_down)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + + DEBUG_TEST("%s:%s: Warning TX Fifo Error on LogicCh=%ld Slot=%d!\n", + card->devname,chan->if_name,chan->logic_ch_num,i); + +#if 0 { - u32 dma_descr,tmp_reg; - dma_descr=(chan->logic_ch_num<<4) + - AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + u32 dma_descr,tmp_reg; + dma_descr=(chan->logic_ch_num<<4) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); - card->hw_iface.bus_read_4(card->hw,dma_descr, &tmp_reg); + card->hw_iface.bus_read_4(card->hw,dma_descr, &tmp_reg); - DEBUG_EVENT("%s:%s: Warning TX Fifo Error on LogicCh=%ld Slot=%d Reg=0x%X!\n", - card->devname,chan->if_name,chan->logic_ch_num,i,tmp_reg); + DEBUG_EVENT("%s:%s: Warning TX Fifo Error on LogicCh=%ld Slot=%d Reg=0x%X!\n", + card->devname,chan->if_name,chan->logic_ch_num,i,tmp_reg); #if 1 aft_list_tx_descriptors(chan); - aft_critical_shutdown(card); + aft_critical_trigger(card); break; - + #endif } #endif - fifo++; - top_chan=wan_netif_priv(chan->common.dev); - aft_tx_fifo_under_recover(card,chan); - WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(&chan->common); //++chan->if_stats.tx_fifo_errors; - card->wandev.stats.tx_aborted_errors++; - __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tmp_fifo_reg); + top_chan=wan_netif_priv(chan->common.dev); + if (top_chan == chan) { + skip_tx_top_chan++; } + + /* We must handle every fifo error otherwise + we could go into an infinite loop */ + aft_tx_fifo_under_recover(card,chan); + + tx_fifo++; + + + WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(&chan->common); //++chan->if_stats.tx_fifo_errors; + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tmp_fifo_reg); } - if (fifo) { - if (card->u.aft.global_tdm_irq) { - if (top_chan) { - WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(&top_chan->common); //++chan->if_stats.tx_fifo_errors; - } - } - } - } + if (wan_test_bit(i,&rx_status)){ - fifo = 0; - - if (rx_status != 0){ - for (i=0;iu.aft.logic_ch_map)){ + if (!chan_valid) { chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; if (!chan){ continue; } + chan_valid=1; if (wan_test_bit(0,&chan->interface_down)){ continue; } - + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ continue; } + } -#ifdef AFT_RX_FIFO_DEBUG -{ +#ifdef AFT_RX_FIFO_DEBUG + if (0){ u32 dma_descr,tmp1_reg,tmp_reg,cur_dma_ptr; - u32 dma_ram_desc=chan->logic_ch_num*4 + + u32 dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); - + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,&tmp_reg); cur_dma_ptr=aft_dmachain_get_rx_dma_addr(tmp_reg); - - dma_descr=(chan->logic_ch_num<<4) + cur_dma_ptr*AFT_DMA_INDEX_OFFSET + - AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); - - card->hw_iface.bus_read_4(card->hw,dma_descr, &tmp_reg); - card->hw_iface.bus_read_4(card->hw,(dma_descr-4), &tmp1_reg); - - + + dma_descr=(chan->logic_ch_num<<4) + cur_dma_ptr*AFT_DMA_INDEX_OFFSET + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr, &tmp_reg); + card->hw_iface.bus_read_4(card->hw,(dma_descr-4), &tmp1_reg); + + if (wan_test_bit(AFT_RXDMA_HI_GO_BIT,&tmp_reg)){ DEBUG_EVENT("%s: Rx Fifo Go Bit Set DMA=%d Addr=0x%X : HI=0x%08X LO=0x%08X OLO=0x%08X Cfg=0x%08X!\n", card->devname, @@ -5826,57 +5856,65 @@ static void __wp_aft_fifo_per_port_isr(sdla_t *card, u32 rx_status, u32 tx_statu chan->rx_dma_chain_table[chan->rx_chain_indx].dma_addr, 0); } - + DEBUG_EVENT("%s:%s: Warning RX Fifo Error on Ch=%ld End=%d Cur=%d: Reg=0x%X Addr=0x%X!\n", - card->devname,chan->if_name,chan->logic_ch_num, + card->devname,chan->if_name,chan->logic_ch_num, chan->rx_chain_indx,cur_dma_ptr,tmp_reg,dma_descr); - -} -#if 0 - aft_display_chain_history(chan); - aft_list_descriptors(chan); -#endif -#endif - WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(&chan->common); //++chan->if_stats.rx_fifo_errors; - WAN_NETIF_STATS_INC_RX_OVER_ERRORS(&chan->common); //++chan->if_stats.rx_over_errors; - chan->errstats.Rx_overrun_err_count++; - card->wandev.stats.rx_over_errors++; - fifo++; - top_chan=wan_netif_priv(chan->common.dev); - - aft_rx_fifo_over_recover(card,chan); - wan_set_bit(WP_FIFO_ERROR_BIT, &chan->pkt_error); - - __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG),&tmp_fifo_reg); -#if 0 - /* Debuging Code used to stop the line in - * case of fifo errors */ - aft_list_descriptors(chan); - - aft_critical_shutdown(card); -#endif } - } +#if 0 + if (0) { + aft_display_chain_history(chan); + aft_list_descriptors(chan); + } +#endif +#endif + rx_fifo++; + top_chan=wan_netif_priv(chan->common.dev); + if (top_chan == chan) { + skip_rx_top_chan++; + } - if (fifo) { - if (card->u.aft.global_tdm_irq) { - if (top_chan) { + WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(&chan->common); //++chan->if_stats.rx_fifo_errors; + WAN_NETIF_STATS_INC_RX_OVER_ERRORS(&chan->common); //++chan->if_stats.rx_over_errors; + chan->errstats.Rx_overrun_err_count++; + card->wandev.stats.rx_over_errors++; + + aft_rx_fifo_over_recover(card,chan); + wan_set_bit(WP_FIFO_ERROR_BIT, &chan->pkt_error); + + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG),&tmp_fifo_reg); +#if 0 + /* Debuging Code used to stop the line in + * case of fifo errors */ + aft_list_descriptors(chan); + + aft_critical_trigger(card); +#endif + } + } + + if (tx_fifo || rx_fifo) { + if (card->u.aft.global_tdm_irq) { + if (top_chan) { + if (tx_fifo && !skip_tx_top_chan) { + WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(&top_chan->common); //++chan->if_stats.tx_fifo_errors; + } else if (rx_fifo && !skip_rx_top_chan) { WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(&top_chan->common); //++chan->if_stats.rx_fifo_errors; WAN_NETIF_STATS_INC_RX_OVER_ERRORS(&top_chan->common); //++chan->if_stats.rx_over_errors; } } } + } - } - - return; + return irq_handled; } -static void wp_aft_fifo_per_port_isr(sdla_t *card) +static int wp_aft_fifo_per_port_isr(sdla_t *card) { - u32 rx_status=0, tx_status=0; + u32 rx_status=0, tx_status=0; u32 i; + int irq=0; /* Clear HDLC pending registers */ __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tx_status); @@ -5890,14 +5928,14 @@ static void wp_aft_fifo_per_port_isr(sdla_t *card) tmp_card=(sdla_t*)card_list[i]; if (tmp_card && !wan_test_bit(CARD_DOWN,&tmp_card->wandev.critical)) { - __wp_aft_fifo_per_port_isr(tmp_card,rx_status,tx_status); + irq+=__wp_aft_fifo_per_port_isr(tmp_card,rx_status,tx_status); } } } else { - __wp_aft_fifo_per_port_isr(card,rx_status,tx_status); + irq=__wp_aft_fifo_per_port_isr(card,rx_status,tx_status); } - return; + return irq; } @@ -6218,20 +6256,23 @@ if (serial_reg) { if (wan_test_bit(AFT_LCFG_FIFO_INTR_BIT,&card->u.aft.lcfg_reg) && wan_test_bit(card->wandev.comm_port,&fifo_port_intr)){ + int irq; #ifdef AFT_IRQ_STAT_DEBUG card->wandev.stats.multicast++; #endif - - wp_aft_fifo_per_port_isr(card); - wan_set_bit(card->wandev.comm_port,&dma_port_intr); - - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + irq=wp_aft_fifo_per_port_isr(card); + if (irq) { + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + } } #if 1 if (wan_test_bit(AFT_LCFG_DMA_INTR_BIT,&card->u.aft.lcfg_reg) && wan_test_bit(card->wandev.comm_port,&dma_port_intr)){ int handle_dma=1; + + /* This is our interrupt ack it */ + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); #if !defined(__WINDOWS__) /* Skip the dma per port and run it in loop below */ @@ -6241,13 +6282,9 @@ if (serial_reg) { #endif if (handle_dma) { - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); wp_aft_dma_per_port_isr(card); } } - - - #else #warning "NCDEBUG DMA IGNORED" #endif @@ -6396,10 +6433,12 @@ if (serial_reg) { } if (status_port_intr) { + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); wp_aft_serial_status_isr(card, status_port_intr); } if (free_port_intr) { + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); wp_aft_free_timer_status_isr(card, free_port_intr); } @@ -6762,20 +6801,40 @@ static void wp_aft_serial_status_isr(sdla_t *top_card, u32 serial_intr_status) static void __wp_aft_per_per_port_isr(sdla_t *card, u32 dma_rx_reg, u32 dma_tx_reg) { - private_area_t *chan; - u32 dma_tx_voice=0; - int i; - + private_area_t *chan=NULL; + int i, chan_valid=0; +#if 0 + int timer_wakeup=0; +#endif + dma_rx_reg &= card->u.aft.active_ch_map; dma_rx_reg &= card->u.aft.logic_ch_map; dma_rx_reg &= ~(card->u.aft.tdm_logic_ch_map); - if (!dma_rx_reg) { - goto isr_skb_rx; + dma_tx_reg &= card->u.aft.active_ch_map; + dma_tx_reg &= card->u.aft.logic_ch_map; + dma_tx_reg &= ~(card->u.aft.tdm_logic_ch_map); + + if (!dma_rx_reg && !dma_tx_reg) { + return; } +#ifdef WANPIPE_PERFORMANCE_DEBUG + if (dma_rx_reg) { + AFT_PERF_STAT_INC(card,isr,dma_rx); + AFT_PERFT_TIMING_STOP_AND_CALC(card,kernel_isr_latency); + AFT_PERFT_TIMING_START(card,kernel_isr_latency); + } + + if (dma_tx_reg) { + AFT_PERF_STAT_INC(card,isr,dma_tx); + } +#endif + for (i=0; iu.aft.num_of_time_slots;i++){ + chan_valid=0; + if (wan_test_bit(i,&dma_rx_reg)) { chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; if (!chan){ @@ -6783,13 +6842,13 @@ static void __wp_aft_per_per_port_isr(sdla_t *card, u32 dma_rx_reg, u32 dma_tx_r card->devname,i); continue; } + chan_valid=1; if (!wan_test_bit(0,&chan->up)){ continue; } if (chan->channelized_cfg && !chan->hdlc_eng){ - wan_set_bit(i,&dma_tx_voice); continue; } @@ -6797,74 +6856,57 @@ static void __wp_aft_per_per_port_isr(sdla_t *card, u32 dma_rx_reg, u32 dma_tx_r continue; } -#if 0 - WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; -#endif DEBUG_TEST("%s: RX Interrupt pend. \n", card->devname); - - aft_dma_rx_complete(card,chan,0); - - if (chan->tdm_span_voice_api) { - wan_set_bit(i,&dma_tx_voice); - aft_dma_tx_complete(card,chan,0,0); - } - - #if 0 - if (chan->cfg.tdmv_master_if && !chan->tdmv_irq_cfg){ - aft_channel_rxintr_ctrl(card,chan,1); - DEBUG_EVENT("%s: Master dev %s Synched to master irq\n", - card->devname,chan->if_name); - chan->tdmv_irq_cfg=1; + wan_debug_update_timediff(&card->wan_debug_rx_interrupt_timing, __FUNCTION__); +#endif + aft_dma_rx_complete(card,chan,0); + +#ifdef AFT_SPAN_SINGLE_IRQ + if (chan->wp_api_op_mode && !chan->hdlc_eng) { + wan_clear_bit(i,&dma_tx_reg); + aft_dma_tx_complete(card,chan,0,0); } #endif } - } -isr_skb_rx: - - dma_tx_reg&=card->u.aft.active_ch_map; - dma_tx_reg&=~dma_tx_voice; - dma_tx_reg &= card->u.aft.logic_ch_map; - dma_tx_reg &= ~(card->u.aft.tdm_logic_ch_map); - - if (dma_tx_reg == 0){ - goto isr_skb_tx; - } - - - for (i=0; iu.aft.num_of_time_slots ;i++){ if (wan_test_bit(i,&dma_tx_reg)) { - chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; - if (!chan){ - DEBUG_EVENT("%s: Error: No Dev for Tx logical ch=%d\n", - card->devname,i); - continue; - } - - if (chan->channelized_cfg && !chan->hdlc_eng){ - continue; - } - - if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ - continue; + if (!chan_valid) { + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + DEBUG_EVENT("%s: Error: No Dev for Rx logical ch=%d\n", + card->devname,i); + continue; + } + chan_valid=1; + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + if (chan->channelized_cfg && !chan->hdlc_eng){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } } DEBUG_ISR("---- TX Interrupt pend. --\n"); +#if 0 + wan_debug_update_timediff(&card->wan_debug_tx_interrupt_timing, __FUNCTION__); +#endif aft_dma_tx_complete(card,chan,0,0); } } -isr_skb_tx: - DEBUG_ISR("---- ISR SKB TX end.-------------------\n"); - return; } - static void wp_aft_dma_per_port_isr(sdla_t *card) { int i; @@ -7495,6 +7537,10 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, chan->router_up_time; wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); wan_udp_pkt->wan_udp_return_code = 0; + +#ifdef AFT_FIFO_GEN_DEBUG + card->wp_gen_fifo_err=1; +#endif break; #if 0 @@ -8630,8 +8676,16 @@ static void aft_rx_fifo_over_recover(sdla_t *card, private_area_t *chan) wanpipe_wake_stack(chan); } + static void aft_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) -{ +{ +#ifdef AFT_FIFO_GEN_DEBUG + if (card->wp_gen_fifo_err) { + DEBUG_EVENT("%s: TX FIFO ERROR\n", card->devname); + card->wp_gen_fifo_err=0; + } +#endif + /* Igore fifo errors in transpared mode. There is nothing that we can do to make it better. */ if (!chan->hdlc_eng && chan->channelized_cfg){ @@ -8641,6 +8695,7 @@ static void aft_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) /* Stream re-synchronization is not necessary when running on single time slot bitstreaming. Equivalent to channelized mode. */ if (!chan->hdlc_eng && chan->num_of_time_slots == 1) { + wan_clear_bit(0,&chan->idle_start); aft_dma_tx_complete(card,chan,0, 1); aft_free_tx_descriptors(chan); aft_dma_tx(card,chan); @@ -9163,6 +9218,7 @@ static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset) sdla_t *card = chan->card; u32 reg,dma_descr; wan_dma_descr_t *dma_chain; + int idle=0; if (wan_test_and_set_bit(TX_HANDLER_BUSY,&chan->dma_status)){ DEBUG_EVENT("%s: SMP Critical in %s\n", @@ -9174,6 +9230,8 @@ static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset) for (;;){ + idle=0; + /* If the current DMA chain is in use,then * all chains are busy */ if (!wan_test_bit(0,&dma_chain->init)){ @@ -9228,11 +9286,22 @@ static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset) aft_tx_dma_skb_init(chan,dma_chain->skb); dma_chain->skb=NULL; + } else { + idle=1; } } aft_tx_dma_chain_init(chan,dma_chain); + + if (!idle && chan->tx_chain_data_sz > 0) { + chan->tx_chain_data_sz--; + } + + if (chan->tx_chain_sz > 0) { + chan->tx_chain_sz--; + } + if (chan->dma_chain_opmode == WAN_AFT_DMA_CHAIN_SINGLE){ break; } @@ -9572,11 +9641,23 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) wan_dma_descr_t *dma_chain; int tx_data_cnt=0; netskb_t *skb=NULL; + int idle=0; + if (chan->channelized_cfg && !chan->hdlc_eng){ return aft_dma_voice_tx(card,chan); } - + +#ifdef AFT_FIFO_GEN_DEBUG + if (card->wp_gen_fifo_err) { + card->wp_gen_fifo_err++; + if (card->wp_gen_fifo_err < 3) { + DEBUG_EVENT("%s: Causing TX FIFO ERROR\n", card->devname); + } + return; + } +#endif + if (wan_test_and_set_bit(TX_DMA_BUSY,&chan->dma_status)){ DEBUG_EVENT("%s: SMP Critical in %s\n", chan->if_name,__FUNCTION__); @@ -9614,12 +9695,13 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) skb=atm_tx_skb_dequeue(&chan->wp_tx_pending_list, chan->tx_idle_skb, chan->if_name); } + idle=0; + if (!skb){ if (!chan->hdlc_eng){ if (chan->dma_chain_opmode == WAN_AFT_DMA_CHAIN_IRQ_ALL){ - int chain_diff=aft_tx_dma_chain_chain_len(chan); - if (chain_diff >= 2 || tx_data_cnt) { + if (chan->tx_chain_sz > 0 || tx_data_cnt) { wan_clear_bit(0,&dma_chain->init); wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); break; @@ -9627,6 +9709,7 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) tx_data_cnt++; } + idle=1; skb=chan->tx_idle_skb; if (!skb){ @@ -9761,6 +9844,11 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) wan_capture_trace_packet(card, &chan->trace_info, skb, TRC_OUTGOING_FRM); } + if (!idle) { + chan->tx_chain_data_sz++; + } + chan->tx_chain_sz++; + if (chan->dma_chain_opmode == WAN_AFT_DMA_CHAIN_SINGLE){ break; }else{ @@ -10685,13 +10773,13 @@ static void aft_reset_tx_chain_cnt(private_area_t *chan) card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); cur_dma_ptr=aft_dmachain_get_tx_dma_addr(reg); chan->tx_pending_chain_indx = chan->tx_chain_indx = cur_dma_ptr; + chan->tx_chain_data_sz=0; + chan->tx_chain_sz=0; DEBUG_TEST("%s: Setting Tx Index to %d\n", chan->if_name,cur_dma_ptr); } - - static void aft_free_tx_descriptors(private_area_t *chan) { u32 reg,dma_descr; @@ -10700,6 +10788,8 @@ static void aft_free_tx_descriptors(private_area_t *chan) int i; void *skb; unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; + int limit=2; + int q_size; if (chan->dma_chain_opmode == WAN_AFT_DMA_CHAIN_SINGLE){ dma_cnt=1; @@ -10731,7 +10821,7 @@ static void aft_free_tx_descriptors(private_area_t *chan) aft_tx_dma_chain_init(chan, dma_chain); } - chan->tx_chain_indx = chan->tx_pending_chain_indx; + aft_reset_tx_chain_cnt(chan); while((skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ if (!chan->hdlc_eng) { @@ -10740,6 +10830,32 @@ static void aft_free_tx_descriptors(private_area_t *chan) wan_skb_free(skb); } } + + if (chan->common.usedby == XMTP2_API) { + limit=4; + } + + q_size=wan_skb_queue_len(&chan->wp_tx_pending_list); + + if (q_size > limit) { + while((skb=wan_skb_dequeue(&chan->wp_tx_pending_list)) != NULL){ + if (!chan->hdlc_eng) { + aft_tx_dma_skb_init(chan,skb); + } else { + wan_skb_free(skb); + } + q_size--; + if (q_size <= limit) { + break; + } + } + } + + DEBUG_TEST("%s:%s: Tx: Freeing Descripors: Comp=%i Pend=%i Chain=%i\n", + card->devname,chan->if_name, + wan_skb_queue_len(&chan->wp_tx_complete_list), + wan_skb_queue_len(&chan->wp_tx_pending_list), + chan->tx_chain_sz); } diff --git a/patches/kdrivers/src/net/sdla_tdmv.c b/patches/kdrivers/src/net/sdla_tdmv.c index 62b28b1..3ddbe13 100644 --- a/patches/kdrivers/src/net/sdla_tdmv.c +++ b/patches/kdrivers/src/net/sdla_tdmv.c @@ -657,12 +657,17 @@ static int wp_tdmv_state(void* pcard, int state) switch(state){ case WAN_CONNECTED: + wp->rbs_rx_pending = wp->sig_timeslot_map; + wp->rbs_tx_status = 0; + wp->rbs_tx1_status = 0; wan_set_bit(WP_TDMV_UP, &wp->flags); break; case WAN_DISCONNECTED: wan_clear_bit(WP_TDMV_UP, &wp->flags); wp->rbs_rx_pending = wp->sig_timeslot_map; + wp->rbs_tx_status = 0; + wp->rbs_tx1_status = 0; break; } return 0; @@ -817,11 +822,11 @@ static void wp_tdmv_report_alarms(void* pcard, unsigned long te_alarm) card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_DDLB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE,ENABLE_ALL_CHANNELS); card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_LINELB_MODE, - WAN_TE1_LB_ENABLE); + WAN_TE1_LB_ENABLE,ENABLE_ALL_CHANNELS); wp->span.maintstat = ZT_MAINT_REMOTELOOP; } }else{ @@ -834,11 +839,11 @@ static void wp_tdmv_report_alarms(void* pcard, unsigned long te_alarm) card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_DDLB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE,ENABLE_ALL_CHANNELS); card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_LINELB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE,ENABLE_ALL_CHANNELS); wp->span.maintstat = ZT_MAINT_NONE; } }else{ @@ -1357,11 +1362,11 @@ static int wp_tdmv_maint(struct zt_span *span, int cmd) card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_DDLB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE,ENABLE_ALL_CHANNELS); card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_LINELB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE,ENABLE_ALL_CHANNELS); break; case ZT_MAINT_LOCALLOOP: DEBUG_EVENT("%s: T1: Set to local loopback mode (local/no remote loop)\n", @@ -1369,11 +1374,11 @@ static int wp_tdmv_maint(struct zt_span *span, int cmd) card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_LINELB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE, ENABLE_ALL_CHANNELS); card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_DDLB_MODE, - WAN_TE1_LB_ENABLE); + WAN_TE1_LB_ENABLE, ENABLE_ALL_CHANNELS); break; case ZT_MAINT_REMOTELOOP: DEBUG_EVENT("%s: T1: Set to remote loopback mode (no local/remote loop)\n", @@ -1381,11 +1386,11 @@ static int wp_tdmv_maint(struct zt_span *span, int cmd) card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_LINELB_MODE, - WAN_TE1_LB_ENABLE); + WAN_TE1_LB_ENABLE, ENABLE_ALL_CHANNELS); card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_LINELB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE, ENABLE_ALL_CHANNELS); break; case ZT_MAINT_LOOPUP: DEBUG_EVENT("%s: T1: Send loopup code\n", @@ -1393,7 +1398,7 @@ static int wp_tdmv_maint(struct zt_span *span, int cmd) card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_TX_LINELB_MODE, - WAN_TE1_LB_ENABLE); + WAN_TE1_LB_ENABLE, ENABLE_ALL_CHANNELS); break; case ZT_MAINT_LOOPDOWN: DEBUG_EVENT("%s: T1: Send loopdown code\n", @@ -1401,7 +1406,7 @@ static int wp_tdmv_maint(struct zt_span *span, int cmd) card->wandev.fe_iface.set_fe_lbmode( &wp->card->fe, WAN_TE1_TX_LINELB_MODE, - WAN_TE1_LB_DISABLE); + WAN_TE1_LB_DISABLE, ENABLE_ALL_CHANNELS); break; case ZT_MAINT_LOOPSTOP: DEBUG_EVENT("%s: T1: Stop sending loop code\n", @@ -1631,22 +1636,18 @@ static int wp_tdmv_rbsbits(struct zt_chan *chan, int bits) wp_tdmv_softc_t *wp = NULL; sdla_t *card = NULL; unsigned char ABCD_bits = 0x00; - wan_smp_flag_t smp_flags; /* Byte offset */ WAN_ASSERT2(chan == NULL, 0); if ((wp = chan->pvt) == NULL) return 0; WAN_ASSERT2(wp->card == NULL, 0); card = (sdla_t*)wp->card; - if (!wan_test_bit(chan->chanpos-1, &wp->timeslot_map)){ return 0; } - - if (!wan_test_bit(WP_TDMV_SIG_ENABLE, &wp->flags)){ + if (!wan_test_bit(WP_TDMV_SIG_ENABLE, &wp->flags)){ return 0; - } - + } if (bits & ZT_ABIT) ABCD_bits |= WAN_RBS_SIG_A; if (bits & ZT_BBIT) ABCD_bits |= WAN_RBS_SIG_B; if (bits & ZT_CBIT) ABCD_bits |= WAN_RBS_SIG_C; @@ -1665,20 +1666,44 @@ static int wp_tdmv_rbsbits(struct zt_chan *chan, int bits) (ABCD_bits & WAN_RBS_SIG_C) ? 1 : 0, (ABCD_bits & WAN_RBS_SIG_D) ? 1 : 0); - - card->hw_iface.hw_lock(card->hw,&smp_flags); - if (card->wandev.fe_iface.set_rbsbits) { - card->wandev.fe_iface.set_rbsbits( - &wp->card->fe, - chan->chanpos, - ABCD_bits); - } - card->hw_iface.hw_unlock(card->hw,&smp_flags); - + if (wan_test_and_set_bit(chan->chanpos-1, &wp->rbs_tx_status)){ + if (ABCD_bits == wp->rbs_tx[chan->chanpos-1]){ + return 0; + } + if (wan_test_and_set_bit(chan->chanpos-1, &wp->rbs_tx1_status)){ + if (ABCD_bits == wp->rbs_tx1[chan->chanpos-1]){ + return 0; + } + DEBUG_EVENT("%s: Critical Error: TX RBS overrun for channel %d\n", + wp->devname, + chan->chanpos); + } + wp->rbs_tx1[chan->chanpos-1] = ABCD_bits; + }else{ + wp->rbs_tx[chan->chanpos-1] = ABCD_bits; + } +#if 0 + wan_set_bit(7, &ABCD_bits); + if (wan_test_and_set_bit(7, &wp->rbs_tx[chan->chanpos-1])){ + if (ABCD_bits == wp->rbs_tx[chan->chanpos-1]){ + return 0; + } + if (wan_test_and_set_bit(7, &wp->rbs_tx1[chan->chanpos-1])){ + if (ABCD_bits == wp->rbs_tx1[chan->chanpos-1]){ + return 0; + } + DEBUG_EVENT("%s: Critical Error: TX RBS for channel %d\n", + wp->devname, + chan->chanpos); + } + wp->rbs_tx1[chan->chanpos-1] = ABCD_bits; + }else{ + wp->rbs_tx[chan->chanpos-1] = ABCD_bits; + } +#endif return 0; } - /****************************************************************************** ** wp_tdmv_is_rbsbits() - ** diff --git a/patches/kdrivers/src/net/sdla_te1.c b/patches/kdrivers/src/net/sdla_te1.c index c052cfc..89ec097 100644 --- a/patches/kdrivers/src/net/sdla_te1.c +++ b/patches/kdrivers/src/net/sdla_te1.c @@ -54,34 +54,20 @@ /****************************************************************************** * INCLUDE FILES ******************************************************************************/ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# include -# if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) -# include -# endif -# include -# include /* WANPIPE common user API definitions */ -# include -#elif (defined __WINDOWS__) -# include -# include /* WANPIPE common user API definitions */ -# include -# include -#define _DEBUG_EVENT DEBUG_EVENT -#elif (defined __LINUX__) || (defined __KERNEL__) -# include -# include -# include -# include + +# include "wanpipe_includes.h" +# include "wanpipe_defines.h" +# include "wanpipe_debug.h" +# include "wanproc.h" + # if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) -# include +# include "wanpipe_snmp.h" # endif -# include -# include /* WANPIPE common user API definitions */ -#else -# error "No OS Defined" -#endif + +# include "sdla_te1_pmc.h" +# include "wanpipe.h" /* WANPIPE common user API definitions */ + /****************************************************************************** * DEFINES AND MACROS @@ -209,21 +195,21 @@ static int te_reg_verify = 0; #endif -#define WAN_TE1_FRAMED_ALARMS (WAN_TE_BIT_RED_ALARM | WAN_TE_BIT_OOF_ALARM) +#define WAN_TE1_FRAMED_ALARMS (WAN_TE_BIT_ALARM_RED | WAN_TE_BIT_ALARM_OOF) /* Nov 21, 2007 AF */ -#define WAN_TE1_UNFRAMED_ALARMS (WAN_TE_BIT_RED_ALARM|WAN_TE_BIT_LOS_ALARM) +#define WAN_TE1_UNFRAMED_ALARMS (WAN_TE_BIT_ALARM_RED | WAN_TE_BIT_ALARM_LOS) #if 0 #define TE1_FRAME_ALARM (\ - WAN_TE_BIT_RED_ALARM | \ - WAN_TE_BIT_AIS_ALARM | \ - WAN_TE_BIT_OOF_ALARM | \ - WAN_TE_BIT_LOS_ALARM) + WAN_TE_BIT_ALARM_RED | \ + WAN_TE_BIT_ALARM_AIS | \ + WAN_TE_BIT_ALARM_OOF | \ + WAN_TE_BIT_ALARM_LOS) #define TE1_UNFRAME_ALARM (\ - WAN_TE_BIT_RED_ALARM | \ - WAN_TE_BIT_AIS_ALARM | \ - WAN_TE_BIT_LOS_ALARM) + WAN_TE_BIT_ALARM_RED | \ + WAN_TE_BIT_ALARM_AIS | \ + WAN_TE_BIT_ALARM_LOS) #endif /****************************************************************************** @@ -2306,13 +2292,13 @@ static int sdla_te_polling(sdla_fe_t*); static int sdla_te_udp(sdla_fe_t*, void*, unsigned char*); static void sdla_te_set_status(sdla_fe_t*, u_int32_t ); static int sdla_te_get_snmp_data(sdla_fe_t* fe, void* pdev, void* data); -static int sdla_te_set_lbmode(sdla_fe_t*, u_int8_t, u_int8_t); +static int sdla_te_set_lbmode(sdla_fe_t*, u_int8_t, u_int8_t, u_int32_t); static int sdla_t1_boc(sdla_fe_t *fe, u_int8_t boc_status); static int sdla_te_linelb(sdla_fe_t*, unsigned char); static int sdla_te_paylb(sdla_fe_t*, unsigned char); static int sdla_te_ddlb(sdla_fe_t*, unsigned char); -static int sdla_te_tx_lb(sdla_fe_t*, u_int8_t, u_int8_t); +static int sdla_te_tx_lb(sdla_fe_t*, unsigned char, unsigned char); static int sdla_te_txlbcode_done(sdla_fe_t *fe); #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) static void sdla_te_timer(void*); @@ -3463,11 +3449,11 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) /* Global Configuration (Reg 0x00) */ value = READ_REG(REG_GLOBAL_CFG); if (IS_E1_FEMEDIA(fe)){ - if (adapter_type & A101_ADPTR_TE1_MASK){ + if (adapter_type == A101_ADPTR_1TE1 || adapter_type == A101_ADPTR_2TE1){ value |= BIT_GLOBAL_TRKEN; } }else{ - if (adapter_type & A101_ADPTR_TE1_MASK){ + if (adapter_type == A101_ADPTR_1TE1 || adapter_type == A101_ADPTR_2TE1){ value |= BIT_GLOBAL_TRKEN; } } @@ -3584,7 +3570,7 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) if (IS_E1_FEMEDIA(fe)){ value |= BIT_BTIF_RATE0; } - if (!(adapter_type & A101_ADPTR_TE1_MASK)){ + if (!(adapter_type == A101_ADPTR_1TE1 || adapter_type == A101_ADPTR_2TE1)){ if (WAN_FE_LCODE(fe) == WAN_LCODE_AMI){ value |= BIT_BTIF_NXDS0_0; } @@ -3592,7 +3578,7 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ value |= BIT_BTIF_NXDS0_1; } - if (adapter_type & A101_ADPTR_TE1_MASK){ + if (adapter_type == A101_ADPTR_1TE1 || adapter_type == A101_ADPTR_2TE1){ value |= (BIT_BTIF_CMODE | BIT_BTIF_DE | BIT_BTIF_FE); } WRITE_REG(REG_BTIF_CFG, value); @@ -3605,7 +3591,7 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) if (IS_E1_FEMEDIA(fe)){ value |= BIT_BRIF_RATE0; } - if (!(adapter_type & A101_ADPTR_TE1_MASK)){ + if (!(adapter_type == A101_ADPTR_1TE1 || adapter_type == A101_ADPTR_2TE1)){ if (WAN_FE_LCODE(fe) == WAN_LCODE_AMI){ value |= BIT_BRIF_NXDS0_0; } @@ -3613,14 +3599,14 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ value |= BIT_BRIF_NXDS0_1; } - if (adapter_type & A101_ADPTR_TE1_MASK){ + if (adapter_type == A101_ADPTR_1TE1 || adapter_type == A101_ADPTR_2TE1){ value |= BIT_BRIF_CMODE; } WRITE_REG(REG_BRIF_CFG, value); /* BRIF Frame Pulse Configuration (Reg. 0x31) */ value = 0x00; - if (adapter_type & A101_ADPTR_TE1_MASK){ + if (adapter_type == A101_ADPTR_1TE1 || adapter_type == A101_ADPTR_2TE1){ value |= BIT_BRIF_FPMODE; } WRITE_REG(REG_BRIF_FR_PULSE_CFG, value); @@ -4316,6 +4302,7 @@ static int sdla_te_chip_config(sdla_fe_t *fe) card->hw_iface.getcfg(card->hw, SDLA_ADAPTERTYPE, &adapter_type); fe->te_param.max_channels = (IS_E1_FEMEDIA(fe)) ? NUM_OF_E1_TIMESLOTS: NUM_OF_T1_CHANNELS; + //fe->te_param.lb_rx_code = LINELB_DS1LINE_DISABLE; switch(fe->fe_chip_id){ case CHIP_ID_COMET: sdla_pmc4351_te_config(fe, adapter_type); @@ -4534,6 +4521,9 @@ static int sdla_te_post_init(void *pfe) wan_clear_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical); wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); + /* Jan 6, 2009 Always enable BOC detection */ + WRITE_REG(REG_T1_RBOC_ENABLE, READ_REG(REG_T1_RBOC_ENABLE) | BIT_T1_RBOC_ENABLE_BOCE); + fe_event.type = TE_LINKDOWN_TIMER; fe_event.delay = POLLING_TE1_TIMER; sdla_te_add_event(fe, &fe_event); @@ -4664,8 +4654,8 @@ static void sdla_te_clear_intr(sdla_fe_t* fe) /* Enable RBOC interrupt */ WRITE_REG(REG_T1_RBOC_ENABLE, READ_REG(REG_T1_RBOC_ENABLE) & - ~(BIT_T1_RBOC_ENABLE_IDLE | - BIT_T1_RBOC_ENABLE_BOCE)); + ~(BIT_T1_RBOC_ENABLE_IDLE/* | + BIT_T1_RBOC_ENABLE_BOCE*/)); /* Enable interrupt on RED, AIS, YEL alarms */ WRITE_REG(REG_T1_ALMI_INT_EN, READ_REG(REG_T1_ALMI_INT_EN) & @@ -4863,7 +4853,7 @@ static u_int32_t sdla_te_is_t1_alarm(sdla_fe_t *fe, u_int32_t alarms) u_int32_t alarm_mask = WAN_TE1_FRAMED_ALARMS; if (fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ - alarm_mask |= WAN_TE_BIT_RAI_ALARM; + alarm_mask |= WAN_TE_BIT_ALARM_RAI; } return (alarms & alarm_mask); } @@ -4904,18 +4894,18 @@ static void sdla_te_set_status(sdla_fe_t* fe, u_int32_t alarms) if (valid_rx_alarms){ if (fe->fe_status != FE_DISCONNECTED){ - if (!(valid_rx_alarms & WAN_TE_BIT_RAI_ALARM)){ - sdla_te_set_alarms(fe, WAN_TE_BIT_YEL_ALARM); + if (!(valid_rx_alarms & WAN_TE_BIT_ALARM_RAI)){ + sdla_te_set_alarms(fe, WAN_TE_BIT_ALARM_YEL); } fe->fe_status = FE_DISCONNECTED; - }else if (fe->te_param.tx_yel_alarm && valid_rx_alarms == WAN_TE_BIT_RAI_ALARM){ + }else if (fe->te_param.tx_yel_alarm && valid_rx_alarms == WAN_TE_BIT_ALARM_RAI){ /* Special case for loopback */ - sdla_te_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); + sdla_te_clear_alarms(fe, WAN_TE_BIT_ALARM_YEL); } }else{ if (fe->fe_status != FE_CONNECTED){ if (fe->te_param.tx_yel_alarm){ - sdla_te_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); + sdla_te_clear_alarms(fe, WAN_TE_BIT_ALARM_YEL); } fe->fe_status = FE_CONNECTED; } @@ -5067,19 +5057,19 @@ static u_int32_t sdla_te_read_alarms(sdla_fe_t *fe, int action) ** Reg 0xF8 (ALOSI = 1) */ if (READ_REG(REG_RLPS_ALOS_DET_PER) && (READ_REG(REG_RLPS_CFG_STATUS) & BIT_RLPS_CFG_STATUS_ALOSV)){ - new_alarms |= WAN_TE_BIT_ALOS_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_ALOS; } /* 2. LOS alarm ** Reg 0x12 */ if (READ_REG(REG_CDRC_INT_STATUS) & BIT_CDRC_INT_STATUS_LOSV){ - new_alarms |= WAN_TE_BIT_LOS_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_LOS; } /* 3. ALTLOS alarm ?????????????????? ** Reg 0x13 */ if (READ_REG(REG_ALTLOS_STATUS) & BIT_ALTLOS_STATUS_ALTLOS){ - new_alarms |= WAN_TE_BIT_ALTLOS_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_ALTLOS; } /* Check specific E1 and T1 alarms */ @@ -5091,36 +5081,36 @@ static u_int32_t sdla_te_read_alarms(sdla_fe_t *fe, int action) /* 4. OOF alarm */ if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (e1_status & BIT_E1_FRMR_FR_STATUS_OOFV){ - new_alarms |= WAN_TE_BIT_OOF_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_OOF; } } /* 5. OOSMF alarm */ if (e1_status & BIT_E1_FRMR_FR_STATUS_OOSMFV){ - new_alarms |= WAN_TE_BIT_OOSMF_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_OOSMF; } /* 6. OOCMF alarm */ if (e1_status & BIT_E1_FRMR_FR_STATUS_OOCMFV){ - new_alarms |= WAN_TE_BIT_OOCMF_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_OOCMF; } /* 7. OOOF alarm */ if (e1_status & BIT_E1_FRMR_FR_STATUS_OOOFV){ - new_alarms |= WAN_TE_BIT_OOOF_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_OOOF; } /* 8. RAI alarm */ if (e1_mnt_status & BIT_E1_FRMR_MAINT_STATUS_RAIV){ - new_alarms |= WAN_TE_BIT_RAI_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_RAI; } /* 9. RED alarm ** Reg 0x97 (REDD) */ if (e1_mnt_status & BIT_E1_FRMR_MAINT_STATUS_RED){ - new_alarms |= WAN_TE_BIT_RED_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_RED; } /* 10. AIS alarm ** Reg 0x91 (AISC) ** Reg 0x97 (AIS) */ if ((READ_REG(REG_E1_FRMR_MAINT_OPT) & BIT_E1_FRMR_MAINT_OPT_AISC) && (e1_mnt_status & BIT_E1_FRMR_MAINT_STATUS_AIS)){ - new_alarms |= WAN_TE_BIT_AIS_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_AIS; } } else { u_int8_t t1_status = 0x00, t1_alm_status = 0x00; @@ -5128,7 +5118,7 @@ static u_int32_t sdla_te_read_alarms(sdla_fe_t *fe, int action) /* 4. OOF alarm ** Reg 0x4A (INFR=0 T1 mode) */ if (!(READ_REG(REG_T1_FRMR_INT_STATUS) & BIT_T1_FRMR_INT_STATUS_INFR)){ - new_alarms |= WAN_TE_BIT_OOF_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_OOF; } t1_alm_status = READ_REG(REG_T1_ALMI_INT_STATUS); t1_status = READ_REG(REG_T1_ALMI_DET_STATUS); @@ -5137,19 +5127,19 @@ static u_int32_t sdla_te_read_alarms(sdla_fe_t *fe, int action) ** Reg 0x62 (AIS) ** Reg 0x63 (AISD) */ if (t1_status & BIT_T1_ALMI_DET_STATUS_AISD){ - new_alarms |= WAN_TE_BIT_AIS_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_AIS; } /* 6. RED alarm ** Reg 0x63 (REDD) */ if ((t1_status & BIT_T1_ALMI_DET_STATUS_REDD) || (t1_alm_status & BIT_T1_ALMI_INT_STATUS_RED)){ - new_alarms |= WAN_TE_BIT_RED_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_RED; } /* 7. YEL alarm ** Reg 0x62 (YEL) ** Reg 0x63 (YELD) */ if (t1_status & BIT_T1_ALMI_DET_STATUS_YELD){ - new_alarms |= WAN_TE_BIT_RAI_ALARM; //WAN_TE_BIT_YEL_ALARM; + new_alarms |= WAN_TE_BIT_ALARM_RAI; //WAN_TE_BIT_ALARM_YEL; } } } @@ -5187,28 +5177,28 @@ static int sdla_te_print_alarms(sdla_fe_t* fe, u_int32_t alarms) fe->name, FE_MEDIA_DECODE(fe)); - if (alarms & WAN_TE_BIT_ALOS_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_ALOS){ DEBUG_EVENT("%s: ALOS : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_LOS_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_LOS){ DEBUG_EVENT("%s: LOS : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_ALTLOS_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_ALTLOS){ DEBUG_EVENT("%s: ALTLOS : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_OOF_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_OOF){ DEBUG_EVENT("%s: OOF : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_RAI_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_RAI){ DEBUG_EVENT("%s: RAI : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_RED_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_RED){ DEBUG_EVENT("%s: RED : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_AIS_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_AIS){ DEBUG_EVENT("%s: AIS : ON\n", fe->name); } - if (alarms & WAN_TE_BIT_YEL_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_YEL){ DEBUG_EVENT("%s: YEL : ON\n", fe->name); } return 0; @@ -5226,7 +5216,7 @@ static int sdla_te_set_alarms(sdla_fe_t* fe, u_int32_t alarms) { unsigned char value = 0x00; - if (alarms & WAN_TE_BIT_YEL_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_YEL){ if (IS_T1_FEMEDIA(fe)) { value = READ_REG(REG_T1_XBAS_ALARM_TX); if (!(value & BIT_T1_XBAS_ALARM_TX_XYEL)){ @@ -5252,7 +5242,7 @@ static int sdla_te_clear_alarms(sdla_fe_t* fe, u_int32_t alarms) { unsigned char value = 0x00; - if (alarms & WAN_TE_BIT_YEL_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_YEL){ if (IS_T1_FEMEDIA(fe)) { value = READ_REG(REG_T1_XBAS_ALARM_TX); if (value & BIT_T1_XBAS_ALARM_TX_XYEL){ @@ -5592,46 +5582,46 @@ static void sdla_t1_rx_intr(sdla_fe_t* fe) status = READ_REG(REG_T1_ALMI_INT_STATUS); if (status & BIT_T1_ALMI_INT_STATUS_YELI){ if (status & BIT_T1_ALMI_INT_STATUS_YEL){ - if (!(fe->fe_alarm & WAN_TE_BIT_YEL_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_YEL)){ DEBUG_EVENT("%s: RAI alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_RAI_ALARM; //WAN_TE_BIT_YEL_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_RAI; //WAN_TE_BIT_ALARM_YEL; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_YEL_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_YEL){ DEBUG_EVENT("%s: RAI alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_RAI_ALARM; //~WAN_TE_BIT_YEL_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_RAI; //~WAN_TE_BIT_ALARM_YEL; } } } if (status & BIT_T1_ALMI_INT_STATUS_REDI){ if (status & BIT_T1_ALMI_INT_STATUS_RED){ - if (!(fe->fe_alarm & WAN_TE_BIT_RED_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_RED)){ DEBUG_EVENT("%s: RED alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_RED; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_RED_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_RED){ DEBUG_EVENT("%s: RED alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_RED; } } } if (status & BIT_T1_ALMI_INT_STATUS_AISI){ if (status & BIT_T1_ALMI_INT_STATUS_AIS){ - if (!(fe->fe_alarm & WAN_TE_BIT_AIS_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_AIS)){ DEBUG_EVENT("%s: AIS alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_AIS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_AIS; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_AIS_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_AIS){ DEBUG_EVENT("%s: AIS alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_AIS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_AIS; } } } @@ -5641,7 +5631,9 @@ static void sdla_t1_rx_intr(sdla_fe_t* fe) if (fe->te_param.intr_src3 & BIT_INT_SRC_3_RBOC){ status = READ_REG(REG_T1_RBOC_CODE_STATUS); if (status & BIT_T1_RBOC_CODE_STATUS_BOCI){ + sdla_t1_boc(fe, status); + } } @@ -5651,16 +5643,16 @@ static void sdla_t1_rx_intr(sdla_fe_t* fe) if ((READ_REG(REG_T1_FRMR_INT_EN) & BIT_T1_FRMR_INT_EN_INFRE) && (status & BIT_T1_FRMR_INT_STATUS_INFRI)){ if (status & BIT_T1_FRMR_INT_STATUS_INFR){ - if (!(fe->fe_alarm & WAN_TE_BIT_OOF_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_OOF)){ DEBUG_EVENT("%s: OOF alarm is ON!\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_OOF_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_OOF; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_OOF_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_OOF){ DEBUG_EVENT("%s: OOF alarm is OFF!\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_OOF_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_OOF; } } } @@ -5671,20 +5663,20 @@ static void sdla_t1_rx_intr(sdla_fe_t* fe) status = READ_REG(REG_RLPS_CFG_STATUS); if ((status & BIT_RLPS_CFG_STATUS_ALOSE) && (status & BIT_RLPS_CFG_STATUS_ALOSI)){ if (status & BIT_RLPS_CFG_STATUS_ALOSV){ - if (!(fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_ALOS)){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: ALOS alarm is ON\n", fe->name); } - fe->fe_alarm |= WAN_TE_BIT_ALOS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_ALOS; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_ALOS){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: ALOS alarm is OFF\n", fe->name); } - fe->fe_alarm &= ~WAN_TE_BIT_ALOS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_ALOS; } } } @@ -5696,20 +5688,20 @@ static void sdla_t1_rx_intr(sdla_fe_t* fe) if ((READ_REG(REG_CDRC_INT_EN) & BIT_CDRC_INT_EN_LOSE) && (status & BIT_CDRC_INT_STATUS_LOSI)){ if (status & BIT_CDRC_INT_STATUS_LOSV){ - if (!(fe->fe_alarm & WAN_TE_BIT_LOS_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_LOS)){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: LOS alarm is ON\n", fe->name); } - fe->fe_alarm |= WAN_TE_BIT_LOS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_LOS; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_LOS_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LOS){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: LOS alarm is OFF\n", fe->name); } - fe->fe_alarm &= ~WAN_TE_BIT_LOS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_LOS; } } } @@ -5731,16 +5723,16 @@ static void sdla_t1_rx_intr(sdla_fe_t* fe) status = READ_REG(REG_ALTLOS_STATUS); if ((status & BIT_ALTLOS_STATUS_ALTLOSI) && (status & BIT_ALTLOS_STATUS_ALTLOSE)){ if (status & BIT_ALTLOS_STATUS_ALTLOS){ - if (!(fe->fe_alarm & WAN_TE_BIT_ALTLOS_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_ALTLOS)){ DEBUG_EVENT("%s: ALTLOS alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_ALTLOS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_ALTLOS; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_ALTLOS_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_ALTLOS){ DEBUG_EVENT("%s: ALTLOS alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_ALTLOS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_ALTLOS; } } } @@ -5874,16 +5866,16 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) /* Always ignore OOF alarm (even it is ON) */ if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (status & BIT_E1_FRMR_FR_STATUS_OOFV){ - if (!(fe->fe_alarm & WAN_TE_BIT_OOF_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_OOF)){ DEBUG_EVENT("%s: OOF alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_OOF_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_OOF; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_OOF_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_OOF){ DEBUG_EVENT("%s: OOF alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_OOF_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_OOF; } } } @@ -5894,11 +5886,11 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if (status & BIT_E1_FRMR_FR_STATUS_OOSMFV){ DEBUG_EVENT("%s: OOSMF alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_OOSMF_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_OOSMF; }else{ DEBUG_EVENT("%s: OOSMF alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_OOSMF_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_OOSMF; } } @@ -5907,11 +5899,11 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if (status & BIT_E1_FRMR_FR_STATUS_OOCMFV){ DEBUG_EVENT("%s: OOCMF alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_OOCMF_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_OOCMF; }else{ DEBUG_EVENT("%s: OOCMF alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_OOCMF_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_OOCMF; } } @@ -5922,11 +5914,11 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if (READ_REG(REG_E1_FRMR_FR_STATUS) & BIT_E1_FRMR_FR_STATUS_OOOFV){ DEBUG_EVENT("%s: OOOF alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_OOOF_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_OOOF; }else{ DEBUG_EVENT("%s: OOOF alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_OOOF_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_OOOF; } } @@ -5941,17 +5933,17 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) (int_status & BIT_E1_FRMR_M_A_INT_IND_REDI)){ if (status & BIT_E1_FRMR_MAINT_STATUS_RED){ DEBUG_EVENT("%s: RED alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_RED; }else{ DEBUG_EVENT("%s: RED alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_RED; } } if ((int_en & BIT_E1_FRMR_M_A_INT_EN_AISE) && (int_status & BIT_E1_FRMR_M_A_INT_IND_AISI)){ if (status & BIT_E1_FRMR_MAINT_STATUS_AIS){ DEBUG_EVENT("%s: AIS alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_AIS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_AIS; /* AS/ACIF S016 Clause 5.2.3 */ WRITE_REG(REG_E1_TRAN_TX_ALARM_CTRL, READ_REG(REG_E1_TRAN_TX_ALARM_CTRL) | @@ -5961,7 +5953,7 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) } }else{ DEBUG_EVENT("%s: AIS alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_AIS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_AIS; /* AS/ACIF S016 Clause 5.2.3 */ WRITE_REG(REG_E1_TRAN_TX_ALARM_CTRL, READ_REG(REG_E1_TRAN_TX_ALARM_CTRL) & @@ -5975,10 +5967,10 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) (int_status & BIT_E1_FRMR_M_A_INT_IND_RAII)){ if (status & BIT_E1_FRMR_MAINT_STATUS_RAIV){ DEBUG_EVENT("%s: RAI alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_RAI_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_RAI; }else{ DEBUG_EVENT("%s: RAI alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_RAI_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_RAI; } } } @@ -5990,20 +5982,20 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((status & BIT_RLPS_CFG_STATUS_ALOSE) && (status & BIT_RLPS_CFG_STATUS_ALOSI)){ if (status & BIT_RLPS_CFG_STATUS_ALOSV){ - if (!(fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_ALOS)){ DEBUG_EVENT("%s: ALOS alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_ALOS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_ALOS; /* AS/ACIF S016 Clause 5.2.3 */ WRITE_REG(REG_E1_TRAN_TX_ALARM_CTRL, READ_REG(REG_E1_TRAN_TX_ALARM_CTRL) | BIT_E1_TRAN_TX_ALARM_RAI); } }else{ - if (fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_ALOS){ DEBUG_EVENT("%s: ALOS alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_ALOS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_ALOS; /* AS/ACIF S016 Clause 5.2.3 */ WRITE_REG(REG_E1_TRAN_TX_ALARM_CTRL, READ_REG(REG_E1_TRAN_TX_ALARM_CTRL) & @@ -6019,14 +6011,14 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((READ_REG(REG_CDRC_INT_EN) & BIT_CDRC_INT_EN_LOSE) && (status & BIT_CDRC_INT_STATUS_LOSI)){ if (status & BIT_CDRC_INT_STATUS_LOSV){ - if (!(fe->fe_alarm & WAN_TE_BIT_LOS_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_LOS)){ DEBUG_EVENT("%s: LOS alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_LOS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_LOS; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_LOS_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_LOS){ DEBUG_EVENT("%s: LOS alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_LOS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_LOS; } } } @@ -6046,16 +6038,16 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((status & BIT_ALTLOS_STATUS_ALTLOSI) && (status & BIT_ALTLOS_STATUS_ALTLOSE)){ if (status & BIT_ALTLOS_STATUS_ALTLOS){ - if (!(fe->fe_alarm & WAN_TE_BIT_ALTLOS_ALARM)){ + if (!(fe->fe_alarm & WAN_TE_BIT_ALARM_ALTLOS)){ DEBUG_EVENT("%s: E1 Alternate Loss of Signal alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_ALTLOS_ALARM; + fe->fe_alarm |= WAN_TE_BIT_ALARM_ALTLOS; } }else{ - if (fe->fe_alarm & WAN_TE_BIT_ALTLOS_ALARM){ + if (fe->fe_alarm & WAN_TE_BIT_ALARM_ALTLOS){ DEBUG_EVENT("%s: E1 Alternate Loss of Signal alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_ALTLOS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_ALTLOS; } } } @@ -6091,11 +6083,12 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) } #endif if (!(READ_REG(REG_RLPS_CFG_STATUS) & BIT_RLPS_CFG_STATUS_ALOSV)){ - fe->fe_alarm &= ~WAN_TE_BIT_ALOS_ALARM; + fe->fe_alarm &= ~WAN_TE_BIT_ALARM_ALOS; } return; } + /****************************************************************************** * sdla_t1_boc() * @@ -6143,14 +6136,14 @@ static int sdla_t1_boc(sdla_fe_t *fe, u_int8_t boc_value) fe->name, WAN_TE1_LB_ACTION_DECODE(lb_cmd), WAN_TE1_LB_MODE_DECODE(lb_mode)); - sdla_te_set_lbmode(fe, lb_mode, lb_cmd); + sdla_te_set_lbmode(fe, lb_mode, lb_cmd, ENABLE_ALL_CHANNELS); break; case UNIVLB_DEACTIVATE_CODE: DEBUG_TE1("%s: Received T1 %s code from far end.\n", fe->name, WAN_TE1_BOC_LB_CODE_DECODE(boc_value)); - sdla_te_set_lbmode(fe, WAN_TE1_LINELB_MODE, WAN_TE1_LB_DISABLE); - sdla_te_set_lbmode(fe, WAN_TE1_PAYLB_MODE, WAN_TE1_LB_DISABLE); + sdla_te_set_lbmode(fe, WAN_TE1_LINELB_MODE, WAN_TE1_LB_DISABLE, ENABLE_ALL_CHANNELS); + sdla_te_set_lbmode(fe, WAN_TE1_PAYLB_MODE, WAN_TE1_LB_DISABLE, ENABLE_ALL_CHANNELS); break; case BITS_T1_XBOC_DISABLE: @@ -6171,6 +6164,7 @@ static int sdla_t1_boc(sdla_fe_t *fe, u_int8_t boc_value) return 0; } + /* ****************************************************************************** * sdla_te_set_lbmode() @@ -6181,7 +6175,7 @@ static int sdla_t1_boc(sdla_fe_t *fe, u_int8_t boc_value) ****************************************************************************** */ static int -sdla_te_set_lbmode(sdla_fe_t *fe, u_int8_t mode, u_int8_t enable) +sdla_te_set_lbmode(sdla_fe_t *fe, u_int8_t mode, u_int8_t enable, u_int32_t chan_map) { int err = 1; @@ -6295,7 +6289,7 @@ static int sdla_te_ddlb(sdla_fe_t* fe, unsigned char mode) *****************************************************************************/ static u32 sdla_te_get_lbmode(sdla_fe_t *fe) { - u32 mode = 0x00; + u32 type_map = 0x00; u8 master = 0x00; WAN_ASSERT(fe->write_fe_reg == NULL); @@ -6303,15 +6297,15 @@ static u32 sdla_te_get_lbmode(sdla_fe_t *fe) master = READ_REG(REG_MASTER_DIAG); if (master & BIT_MASTER_DIAG_LINELB){ - wan_set_bit(WAN_TE1_LINELB_MODE, &mode); + wan_set_bit(WAN_TE1_LINELB_MODE, &type_map); } if (master & BIT_MASTER_DIAG_PAYLB){ - wan_set_bit(WAN_TE1_PAYLB_MODE, &mode); + wan_set_bit(WAN_TE1_PAYLB_MODE, &type_map); } if (master & BIT_MASTER_DIAG_DDLB){ - wan_set_bit(WAN_TE1_DDLB_MODE, &mode); + wan_set_bit(WAN_TE1_DDLB_MODE, &type_map); } - return mode; + return type_map; } /* @@ -6337,12 +6331,10 @@ static void sdla_te_timer(unsigned long pfe) wan_smp_flag_t smp_flags; int empty = 1; - DEBUG_TIMER("%s: %s timer!\n", + DEBUG_TE1("%s: %s timer!\n", fe->name, FE_MEDIA_DECODE(fe)); - DEBUG_TE1("%s(): line: %d\n", __FUNCTION__, __LINE__); - if (wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical)){ wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); @@ -6446,12 +6438,7 @@ static int sdla_te_add_timer(sdla_fe_t* fe, unsigned long delay) return 0; } -#if defined(__WINDOWS__) - /* delay is in MS, so it can be used directly by wan_add_timer() */ - err = wan_add_timer(&fe->timer, delay); -#else - err = wan_add_timer(&fe->timer, delay * HZ / 1000); -#endif + err = wan_add_timer(&fe->timer, delay * HZ); if (err){ /* Failed to add timer */ return -EINVAL; @@ -6502,10 +6489,8 @@ static int sdla_te_polling(sdla_fe_t* fe) switch(fe_event->type){ case TE_LINELB_TIMER: - if (IS_T1_FEMEDIA(fe)){ sdla_te_txlbcode_done(fe); - break; } break; @@ -6621,9 +6606,9 @@ static int sdla_te_txlbcode_done(sdla_fe_t *fe) WRITE_REG(REG_T1_XBOC_CODE, BITS_T1_XBOC_DISABLE); DEBUG_EVENT("%s: T1 loopback %s %s code sent.\n", - fe->name, - WAN_TE1_LB_ACTION_DECODE(fe->te_param.lb_tx_cmd), - WAN_TE1_LB_MODE_DECODE(fe->te_param.lb_tx_mode)); + fe->name, + WAN_TE1_LB_ACTION_DECODE(fe->te_param.lb_tx_cmd), + WAN_TE1_LB_MODE_DECODE(fe->te_param.lb_tx_mode)); wan_clear_bit(LINELB_WAITING,(void*)&fe->te_param.critical); fe->te_param.lb_tx_cmd = 0x00; return 0; @@ -6705,7 +6690,7 @@ static int sdla_te_udp_lbmode(sdla_fe_t *fe, unsigned char* data) sdla_fe_lbmode_t *lbmode = (sdla_fe_lbmode_t*)data; if (lbmode->cmd == WAN_FE_LBMODE_CMD_SET){ - sdla_te_set_lbmode(fe, lbmode->type, lbmode->mode); + sdla_te_set_lbmode(fe, lbmode->type, lbmode->mode, ENABLE_ALL_CHANNELS); }else if (lbmode->cmd == WAN_FE_LBMODE_CMD_GET){ lbmode->type_map = sdla_te_get_lbmode(fe); } @@ -7578,16 +7563,16 @@ static int sdla_te_get_snmp_data(sdla_fe_t* fe, void* pdev, void* data) case DSX1LINESTATUS: alarms = fe->fe_alarm; snmp->snmp_val = 0; - if (alarms & WAN_TE_BIT_YEL_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_YEL){ snmp->snmp_val |= SNMP_DSX1_RCVFARENDLOF; } - if (alarms & WAN_TE_BIT_AIS_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_AIS){ snmp->snmp_val |= SNMP_DSX1_RCVAIS; } - if (alarms & WAN_TE_BIT_RED_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_RED){ snmp->snmp_val |= SNMP_DSX1_LOSSOFFRAME; } - if (alarms & WAN_TE_BIT_LOS_ALARM){ + if (alarms & WAN_TE_BIT_ALARM_LOS){ snmp->snmp_val |= SNMP_DSX1_LOSSOFSIGNAL; } @@ -7668,21 +7653,21 @@ sdla_te_update_alarm_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt) FE_MEDIA_DECODE(fe)); PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "ALOS", WAN_TE_ALOS_ALARM(fe->fe_alarm), - "LOS", WAN_TE_LOS_ALARM(fe->fe_alarm)); + "ALOS", WAN_TE_PRN_ALARM_ALOS(fe->fe_alarm), + "LOS", WAN_TE_PRN_ALARM_LOS(fe->fe_alarm)); PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "RED", WAN_TE_RED_ALARM(fe->fe_alarm), - "AIS", WAN_TE_AIS_ALARM(fe->fe_alarm)); + "RED", WAN_TE_PRN_ALARM_RED(fe->fe_alarm), + "AIS", WAN_TE_PRN_ALARM_AIS(fe->fe_alarm)); if (IS_T1_FEMEDIA(fe)){ PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "YEL", WAN_TE_YEL_ALARM(fe->fe_alarm), - "OOF", WAN_TE_OOF_ALARM(fe->fe_alarm)); + "YEL", WAN_TE_PRN_ALARM_YEL(fe->fe_alarm), + "OOF", WAN_TE_PRN_ALARM_OOF(fe->fe_alarm)); }else{ PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, - "OOF", WAN_TE_OOF_ALARM(fe->fe_alarm), + "OOF", WAN_TE_PRN_ALARM_OOF(fe->fe_alarm), "", ""); } return m->count; diff --git a/patches/kdrivers/src/net/wanpipe_tdm_api.c b/patches/kdrivers/src/net/wanpipe_tdm_api.c index 8e814b6..f33a223 100644 --- a/patches/kdrivers/src/net/wanpipe_tdm_api.c +++ b/patches/kdrivers/src/net/wanpipe_tdm_api.c @@ -1491,7 +1491,7 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) case SIOC_WP_TDM_ENABLE_HWEC: - if (card && card->wandev.ec_enable) { + if (card && card->wandev.ec_enable && card->wandev.ec_dev) { wan_smp_flag_t smp_flags1; card->hw_iface.hw_lock(card->hw,&smp_flags1); card->wandev.ec_enable(card, 1, tdm_api->tdm_chan); @@ -1500,7 +1500,7 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) break; case SIOC_WP_TDM_DISABLE_HWEC: - if (card && card->wandev.ec_enable) { + if (card && card->wandev.ec_enable && card->wandev.ec_dev) { wan_smp_flag_t smp_flags1; card->hw_iface.hw_lock(card->hw,&smp_flags1); card->wandev.ec_enable(card, 0, tdm_api->tdm_chan); diff --git a/patches/kdrivers/wanec/Module.markers b/patches/kdrivers/wanec/Module.markers index dde2c60..e69de29 100644 --- a/patches/kdrivers/wanec/Module.markers +++ b/patches/kdrivers/wanec/Module.markers @@ -1,30 +0,0 @@ -core_marker_format vmlinux name %s format %s -ext4_allocate_blocks vmlinux dev %s block %llu flags %u len %u ino %lu logical %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu -ext4_allocate_inode vmlinux dev %s ino %lu dir %lu mode %d -ext4_da_write_begin vmlinux dev %s ino %lu pos %llu len %u flags %u -ext4_da_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -ext4_da_writepage vmlinux dev %s ino %lu page_index %lu -ext4_da_writepage_result vmlinux dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d -ext4_da_writepages vmlinux dev %s ino %lu nr_t_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d for_writepages %d range_cyclic %d -ext4_discard_blocks vmlinux dev %s blk %llu count %u -ext4_discard_preallocations vmlinux dev %s ino %lu -ext4_free_blocks vmlinux dev %s block %llu count %lu metadata %d ino %lu -ext4_free_inode vmlinux dev %s ino %lu mode %d uid %lu gid %lu bocks %llu -ext4_journalled_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -ext4_journalled_writepage vmlinux dev %s ino %lu page_index %lu -ext4_mb_discard_preallocations vmlinux dev %s needed %d -ext4_mb_new_group_pa vmlinux dev %s pstart %llu len %u lstart %u -ext4_mb_new_inode_pa vmlinux dev %s ino %lu pstart %llu len %u lstart %u -ext4_mb_release_group_pa vmlinux dev %s pstart %llu len %d -ext4_mb_release_inode_pa vmlinux dev %s ino %lu block %llu count %u -ext4_normal_writepage vmlinux dev %s ino %lu page_index %lu -ext4_ordered_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -ext4_request_blocks vmlinux dev %s flags %u len %u ino %lu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu -ext4_request_inode vmlinux dev %s dir %lu mode %d -ext4_sync_file vmlinux dev %s datasync %d ino %ld parent %ld -ext4_sync_fs vmlinux dev %s wait %d -ext4_write_begin vmlinux dev %s ino %lu pos %llu len %u flags %u -ext4_writeback_write_end vmlinux dev %s ino %lu pos %llu len %u copied %u -jbd2_checkpoint vmlinux dev %s need_checkpoint %d -jbd2_end_commit vmlinux dev %s transaction %d head %d -jbd2_start_commit vmlinux dev %s transaction %d diff --git a/rpmspec/wanpipe-mod.spec b/rpmspec/wanpipe-mod.spec index 9395d72..2616d38 100644 --- a/rpmspec/wanpipe-mod.spec +++ b/rpmspec/wanpipe-mod.spec @@ -1,6 +1,6 @@ %define WANPIPE_VER wanpipe-modules %define name %{WANPIPE_VER} -%define version 3.4.6 +%define version 3.4.7 %define release 0 %define serial 1 %define MODULES_DIR /lib/modules @@ -51,15 +51,37 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}" %changelog -* Tue Sep 18 2009 Nenad Corbic - Stable - 3.4.6 -===================================================================== +* Wed Nov 05 2009 Nenad Corbic - Feature Frozen - 3.4.7 +================================================================================ + +- New A200 Firmware V12 + Fixes the fifo reporting in firmware. + +- Updated driver fifo handling so that if customer is running + older version of A200 firmware (less than V12) the fifo interrupt handling + would still work correctly. + +- Dahdi 2.2 broke Sangoma RBS support +- Fixed the free run interrupt supported on V38 firmware +- Fixed chan_woomera inbound calls on second profile +- Fixed sangoma_mgd for multiple profiles +- Updated smg +- Fixed wanpipemon LIU alarm statistics +- Updates SMG for 32T1/E1 Support +- Backporte front end OOF alarm update. + A OOF alarm counter was added so that link does not + drop on a single OOF alarm as per T1/E1 spec. + + +* Tue Sep 18 2009 Nenad Corbic - Feature Frozen - 3.4.6 +=============================================================================== - Fund a bug in Sangoma_mgd causing channel 31 in each span to fail. This bug was introduced in 3.4.5 release. -* Tue Sep 16 2009 Nenad Corbic - Stable - 3.4.5 -===================================================================== +* Tue Sep 16 2009 Nenad Corbic - Feature Frozen - 3.4.5 +=============================================================================== - New firmawre feature for A101/2/5/8: Free Run Timer Interrupt The AFT T1/E1 cards will now provide perfect timing to zatpel/dahdi @@ -78,14 +100,14 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}" - Updated for 2.6.30 kernel -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.4 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.4 ===================================================================== - Latest smg update in 3.4.3 broke BRI support - This is now fixed. -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.3 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.3 ===================================================================== - New firmware @@ -151,7 +173,7 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}" Added Asterisk Load balancing using extension information. -* Fri Apr 30 2009 Nenad Corbic - Stable - 3.4.1 +* Fri Apr 30 2009 Nenad Corbic - Feature Frozen - 3.4.1 ======================================================================= - Updated wancfg_zaptel configuration utility diff --git a/rpmspec/wanpipe-util.spec b/rpmspec/wanpipe-util.spec index 9241dba..42f97a2 100644 --- a/rpmspec/wanpipe-util.spec +++ b/rpmspec/wanpipe-util.spec @@ -1,7 +1,7 @@ %define KERNEL_VERSION %{?kern_ver} %define WANPIPE_VER wanpipe-util %define name %{WANPIPE_VER} -%define version 3.4.6 +%define version 3.4.7 %define release 0 %define serial 1 %define ETC_DIR /etc @@ -328,15 +328,37 @@ enable_smg_log; %changelog -* Tue Sep 18 2009 Nenad Corbic - Stable - 3.4.6 -===================================================================== +* Wed Nov 05 2009 Nenad Corbic - Feature Frozen - 3.4.7 +================================================================================ + +- New A200 Firmware V12 + Fixes the fifo reporting in firmware. + +- Updated driver fifo handling so that if customer is running + older version of A200 firmware (less than V12) the fifo interrupt handling + would still work correctly. + +- Dahdi 2.2 broke Sangoma RBS support +- Fixed the free run interrupt supported on V38 firmware +- Fixed chan_woomera inbound calls on second profile +- Fixed sangoma_mgd for multiple profiles +- Updated smg +- Fixed wanpipemon LIU alarm statistics +- Updates SMG for 32T1/E1 Support +- Backporte front end OOF alarm update. + A OOF alarm counter was added so that link does not + drop on a single OOF alarm as per T1/E1 spec. + + +* Tue Sep 18 2009 Nenad Corbic - Feature Frozen - 3.4.6 +=============================================================================== - Fund a bug in Sangoma_mgd causing channel 31 in each span to fail. This bug was introduced in 3.4.5 release. -* Tue Sep 16 2009 Nenad Corbic - Stable - 3.4.5 -===================================================================== +* Tue Sep 16 2009 Nenad Corbic - Feature Frozen - 3.4.5 +=============================================================================== - New firmawre feature for A101/2/5/8: Free Run Timer Interrupt The AFT T1/E1 cards will now provide perfect timing to zatpel/dahdi @@ -355,14 +377,14 @@ enable_smg_log; - Updated for 2.6.30 kernel -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.4 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.4 ===================================================================== - Latest smg update in 3.4.3 broke BRI support - This is now fixed. -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.3 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.3 ===================================================================== - New firmware @@ -428,7 +450,7 @@ enable_smg_log; Added Asterisk Load balancing using extension information. -* Fri Apr 30 2009 Nenad Corbic - Stable - 3.4.1 +* Fri Apr 30 2009 Nenad Corbic - Feature Frozen - 3.4.1 ======================================================================= - Updated wancfg_zaptel configuration utility diff --git a/rpmspec/wanpipe.spec b/rpmspec/wanpipe.spec index 9a73cce..da50b04 100644 --- a/rpmspec/wanpipe.spec +++ b/rpmspec/wanpipe.spec @@ -1,7 +1,7 @@ %define KERNEL_VERSION %{?kern_ver} %define WANPIPE_VER wanpipe %define name %{WANPIPE_VER} -%define version 3.4.6 +%define version 3.4.7 %define release 0 %define serial 1 %define UTILS_DIR /usr/sbin @@ -255,15 +255,37 @@ install_init; %changelog -* Tue Sep 18 2009 Nenad Corbic - Stable - 3.4.6 -===================================================================== +* Wed Nov 05 2009 Nenad Corbic - Feature Frozen - 3.4.7 +================================================================================ + +- New A200 Firmware V12 + Fixes the fifo reporting in firmware. + +- Updated driver fifo handling so that if customer is running + older version of A200 firmware (less than V12) the fifo interrupt handling + would still work correctly. + +- Dahdi 2.2 broke Sangoma RBS support +- Fixed the free run interrupt supported on V38 firmware +- Fixed chan_woomera inbound calls on second profile +- Fixed sangoma_mgd for multiple profiles +- Updated smg +- Fixed wanpipemon LIU alarm statistics +- Updates SMG for 32T1/E1 Support +- Backporte front end OOF alarm update. + A OOF alarm counter was added so that link does not + drop on a single OOF alarm as per T1/E1 spec. + + +* Tue Sep 18 2009 Nenad Corbic - Feature Frozen - 3.4.6 +=============================================================================== - Fund a bug in Sangoma_mgd causing channel 31 in each span to fail. This bug was introduced in 3.4.5 release. -* Tue Sep 16 2009 Nenad Corbic - Stable - 3.4.5 -===================================================================== +* Tue Sep 16 2009 Nenad Corbic - Feature Frozen - 3.4.5 +=============================================================================== - New firmawre feature for A101/2/5/8: Free Run Timer Interrupt The AFT T1/E1 cards will now provide perfect timing to zatpel/dahdi @@ -282,14 +304,14 @@ install_init; - Updated for 2.6.30 kernel -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.4 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.4 ===================================================================== - Latest smg update in 3.4.3 broke BRI support - This is now fixed. -* Fri Jun 17 2009 Nenad Corbic - Stable - 3.4.3 +* Fri Jun 17 2009 Nenad Corbic - Feature Frozen - 3.4.3 ===================================================================== - New firmware @@ -355,7 +377,7 @@ install_init; Added Asterisk Load balancing using extension information. -* Fri Apr 30 2009 Nenad Corbic - Stable - 3.4.1 +* Fri Apr 30 2009 Nenad Corbic - Feature Frozen - 3.4.1 ======================================================================= - Updated wancfg_zaptel configuration utility diff --git a/samples/wanrouter b/samples/wanrouter index 60e4521..46dd3db 100644 --- a/samples/wanrouter +++ b/samples/wanrouter @@ -2195,7 +2195,7 @@ init_global_params() { if [ $OSYSTEM = "Linux" ]; then - ROUTER_VERSION=3.4.6 + ROUTER_VERSION=3.4.7 IFCONFIG_LIST=ifconfig MODULE_STAT=lsmod WAN_DRIVERS="wanpipe" diff --git a/scripts/Compile.sh b/scripts/Compile.sh index 7be4d92..f01404d 100644 --- a/scripts/Compile.sh +++ b/scripts/Compile.sh @@ -1,5 +1,5 @@ #!/bin/sh -make CFLAGS=" -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dlinux -D__KERNEL__ -I/lib/modules/2.6.18-92.1.22.el5/build/include -DMODULE -DAF_WANPIPE_2612_FORCE_UPDATE -DWANPIPE_MOD_266_FORCE_UPDATE -m32 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wstrict-prototypes -Wundef -Werror-implicit-function-declaration -Os -pipe -msoft-float -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -mpreferred-stack-boundary=2 -march=i686 -mtune=generic -mtune=generic -mregparm=3 -ffreestanding -I/lib/modules/2.6.18-92.1.22.el5/build/include/asm-i386/mach-generic -I/lib/modules/2.6.18-92.1.22.el5/build/include/asm-i386/mach-default -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -D__KERNEL__ -Iinclude -include include/linux/autoconf.h " PROTOCOL_DEFINES="-DCONFIG_PRODUCT_WANPIPE_BASE -DCONFIG_PRODUCT_WANPIPE_XMTP2 -DAFT_XMTP2_API_SUPPORT -I/root/3.4/wanpipe/patches/kdrivers/src/xmtp2km -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_CORE -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT_56K -DCONFIG_PRODUCT_WANPIPE_AFT_RM -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -DCONFIG_PRODUCT_WANPIPE_AFT_SERIAL -DCONFIG_PRODUCT_WANPIPE_AFT_A600 -DWANPIPE_USE_I_PRIVATE -DCONFIG_WANPIPE_HWEC " +make CFLAGS=" -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dlinux -D__KERNEL__ -I/lib/modules/2.6.18-164.el5/build/include -DMODULE -DAF_WANPIPE_2612_FORCE_UPDATE -DWANPIPE_MOD_266_FORCE_UPDATE -m32 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wstrict-prototypes -Wundef -Werror-implicit-function-declaration -fno-delete-null-pointer-checks -fwrapv -Os -pipe -msoft-float -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -mpreferred-stack-boundary=2 -march=i686 -mtune=generic -mtune=generic -mregparm=3 -ffreestanding -I/lib/modules/2.6.18-164.el5/build/include/asm-i386/mach-generic -I/lib/modules/2.6.18-164.el5/build/include/asm-i386/mach-default -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -D__KERNEL__ -Iinclude -include include/linux/autoconf.h -I/usr/src/dahdi" PROTOCOL_DEFINES="-DCONFIG_PRODUCT_WANPIPE_BASE -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL -DDAHDI_ISSUES -DCONFIG_PRODUCT_WANPIPE_FR -DCONFIG_PRODUCT_WANPIPE_CHDLC -DCONFIG_PRODUCT_WANPIPE_PPP -DCONFIG_PRODUCT_WANPIPE_X25 -DCONFIG_PRODUCT_WANPIPE_ADSL -DCONFIG_PRODUCT_WANPIPE_LIP_ATM -DCONFIG_PRODUCT_WANPIPE_ATM -DCONFIG_PRODUCT_WANPIPE_MULTFR -DCONFIG_PRODUCT_WANPIPE_MULTPROT -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_CORE -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT_56K -DCONFIG_PRODUCT_WANPIPE_AFT_RM -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -DCONFIG_PRODUCT_WANPIPE_AFT_SERIAL -DCONFIG_PRODUCT_WANPIPE_AFT_A600 -DCONFIG_PRODUCT_WANPIPE_AFT_TE3 -DWANPIPE_USE_I_PRIVATE -DCONFIG_WANPIPE_HWEC " diff --git a/ssmg/sangoma_mgd.trunk/.svn/all-wcprops b/ssmg/sangoma_mgd.trunk/.svn/all-wcprops index ebcf286..6a4eba4 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/all-wcprops +++ b/ssmg/sangoma_mgd.trunk/.svn/all-wcprops @@ -1,13 +1,13 @@ K 25 svn:wc:ra_dav:version-url V 35 -/svn/sangoma_mgd/!svn/ver/204/trunk +/svn/sangoma_mgd/!svn/ver/232/trunk END sigboost.h K 25 svn:wc:ra_dav:version-url V 46 -/svn/sangoma_mgd/!svn/ver/204/trunk/sigboost.h +/svn/sangoma_mgd/!svn/ver/230/trunk/sigboost.h END switch_buffer.h K 25 @@ -19,7 +19,7 @@ sangoma_mgd.conf.sample K 25 svn:wc:ra_dav:version-url V 59 -/svn/sangoma_mgd/!svn/ver/157/trunk/sangoma_mgd.conf.sample +/svn/sangoma_mgd/!svn/ver/221/trunk/sangoma_mgd.conf.sample END sound.raw K 25 @@ -31,7 +31,7 @@ safe_sangoma K 25 svn:wc:ra_dav:version-url V 48 -/svn/sangoma_mgd/!svn/ver/174/trunk/safe_sangoma +/svn/sangoma_mgd/!svn/ver/232/trunk/safe_sangoma END callgettest.sh K 25 @@ -55,7 +55,7 @@ call_signal.c K 25 svn:wc:ra_dav:version-url V 49 -/svn/sangoma_mgd/!svn/ver/202/trunk/call_signal.c +/svn/sangoma_mgd/!svn/ver/222/trunk/call_signal.c END re-sync.sh K 25 @@ -73,7 +73,7 @@ sangoma_mgd.c K 25 svn:wc:ra_dav:version-url V 49 -/svn/sangoma_mgd/!svn/ver/204/trunk/sangoma_mgd.c +/svn/sangoma_mgd/!svn/ver/222/trunk/sangoma_mgd.c END woomera.conf K 25 @@ -93,6 +93,12 @@ svn:wc:ra_dav:version-url V 42 /svn/sangoma_mgd/!svn/ver/133/trunk/list.h END +sangoma_mgd_ip_bridge.c +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/sangoma_mgd/!svn/ver/228/trunk/sangoma_mgd_ip_bridge.c +END Changelog.sangoma_mgd K 25 svn:wc:ra_dav:version-url @@ -103,7 +109,7 @@ sangoma_mgd.h K 25 svn:wc:ra_dav:version-url V 49 -/svn/sangoma_mgd/!svn/ver/204/trunk/sangoma_mgd.h +/svn/sangoma_mgd/!svn/ver/222/trunk/sangoma_mgd.h END q931_cause.h K 25 @@ -121,7 +127,7 @@ install K 25 svn:wc:ra_dav:version-url V 43 -/svn/sangoma_mgd/!svn/ver/186/trunk/install +/svn/sangoma_mgd/!svn/ver/222/trunk/install END sangoma_mgd_memdbg.c K 25 @@ -139,7 +145,7 @@ smg_ctrl K 25 svn:wc:ra_dav:version-url V 44 -/svn/sangoma_mgd/!svn/ver/198/trunk/smg_ctrl +/svn/sangoma_mgd/!svn/ver/232/trunk/smg_ctrl END switch_buffer.c K 25 @@ -151,7 +157,7 @@ Makefile K 25 svn:wc:ra_dav:version-url V 44 -/svn/sangoma_mgd/!svn/ver/203/trunk/Makefile +/svn/sangoma_mgd/!svn/ver/232/trunk/Makefile END sangoma_mgd_memdbg.h K 25 diff --git a/ssmg/sangoma_mgd.trunk/.svn/entries b/ssmg/sangoma_mgd.trunk/.svn/entries index 5260304..26bdc4b 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/entries +++ b/ssmg/sangoma_mgd.trunk/.svn/entries @@ -1,14 +1,14 @@ 8 dir -204 +232 https://www.sangomapbx.com/svn/sangoma_mgd/trunk https://www.sangomapbx.com/svn/sangoma_mgd -2009-09-18T20:42:35.794839Z -204 +2009-11-21T18:46:33.894854Z +232 ncorbic @@ -35,11 +35,11 @@ file -2009-09-18T19:50:52.000000Z -2f5277bc3255aa10d68b1df0a63b2de6 -2009-09-18T20:42:35.794839Z -204 -ncorbic +2009-11-24T17:29:10.000000Z +d98d37fe45e4f153c4999487391b302b +2009-11-20T22:07:01.823461Z +230 +davidy app dir @@ -62,10 +62,10 @@ file -2009-04-30T20:22:39.000000Z -93628c98a30a5b4897dd901064d2e937 -2009-03-28T00:40:33.375650Z -157 +2009-11-12T18:45:27.000000Z +c4decb82150b5bdc447c662bf1d29eb9 +2009-10-31T16:39:27.344728Z +221 ncorbic conf_bri @@ -77,10 +77,10 @@ file -2009-05-13T19:31:42.000000Z -1c73ae51836adae50fc242f5a117bf1c -2009-05-13T20:38:52.699491Z -174 +2009-11-24T17:29:10.000000Z +3d813e0a45e749dd5eaa956f1c4150ea +2009-11-21T18:46:33.894854Z +232 ncorbic has-props @@ -112,10 +112,10 @@ file -2009-09-17T20:37:35.000000Z -94b43fda8af2fc13879f7071793a12dc -2009-09-17T21:31:23.869639Z -202 +2009-11-12T18:45:27.000000Z +9aeab0754b523946644b3c27a09b3403 +2009-11-11T21:54:38.630069Z +222 ncorbic re-sync.sh @@ -143,6 +143,18 @@ file 105 ncorbic +sangoma_mgd_ip_bridge.c +file + + + + +2009-11-18T22:36:48.000000Z +056608fa90a921a6753c8c49f05678f2 +2009-11-19T00:43:00.203201Z +228 +ncorbic + Changelog.sangoma_mgd file @@ -197,18 +209,6 @@ file 189 davidy -Makefile -file - - - - -2009-09-17T20:37:35.000000Z -756ba033691b157a7d8af99d59af9346 -2009-09-17T21:48:55.845572Z -203 -ncorbic - sangoma_mgd_memdbg.h file @@ -221,6 +221,18 @@ file 62 ncorbic +Makefile +file + + + + +2009-11-24T17:29:10.000000Z +69042fbb71f5c3d7057721ff7bec81be +2009-11-21T18:46:33.894854Z +232 +ncorbic + sound.raw file @@ -271,18 +283,6 @@ e37c1c63f8594ae025098e6510327ee0 189 davidy -sangoma_mgd.c -file - - - - -2009-09-18T19:50:52.000000Z -0df244b0c94f5fadfeb4a6c5110f7f6a -2009-09-18T20:42:35.794839Z -204 -ncorbic - woomera.conf file @@ -295,6 +295,18 @@ file 1 root +sangoma_mgd.c +file + + + + +2009-10-29T20:55:16.000000Z +3ba30b11311bbae04f80014854510bf4 +2009-11-11T21:54:38.630069Z +222 +ncorbic + list.h file @@ -313,10 +325,10 @@ file -2009-09-18T19:50:52.000000Z -10830f87ebeabb8913c8a46405750f03 -2009-09-18T20:42:35.794839Z -204 +2009-11-12T18:45:27.000000Z +b23164289d388193d834e3b66470e2f2 +2009-11-11T21:54:38.630069Z +222 ncorbic q931_cause.h @@ -337,10 +349,10 @@ file -2009-07-17T14:59:38.000000Z -3c105b0995d2039c5cc25b4fe22c2b46 -2009-07-16T21:35:39.883599Z -186 +2009-11-12T18:45:27.000000Z +2dd2f13d45e11b6b85749d9c7fee4cef +2009-11-11T21:54:38.630069Z +222 ncorbic has-props @@ -350,10 +362,10 @@ file -2009-09-17T20:37:35.000000Z -3c25c0a7952abb4488eb6dc3dc356700 -2009-09-01T18:37:52.119878Z -198 +2009-11-24T17:29:10.000000Z +d2d1437dda0c6a3d0e2ddaca840d8708 +2009-11-21T18:46:33.894854Z +232 ncorbic has-props diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/Makefile.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/Makefile.svn-base index d93ba18..44343f5 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/Makefile.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/Makefile.svn-base @@ -39,6 +39,9 @@ ifndef DESTDIR endif endif +SAFE_D=/etc/wanpipe/safe_sangoma.d +SMGCTRL_D=/etc/wanpipe/smg_ctrl.d + INCLUDES = -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 @@ -91,12 +94,15 @@ sangoma_mgd_memdbg.o: sangoma_mgd_memdbg.c sangoma_mgd_memdbg.h sangoma_mgd_logger.o: sangoma_mgd_logger.c $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_logger.o sangoma_mgd_logger.c +sangoma_mgd_ip_bridge.o: sangoma_mgd_ip_bridge.c + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_ip_bridge.o sangoma_mgd_ip_bridge.c + sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c -sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h +sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o sangoma_mgd_ip_bridge.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h rm -fr core* - $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o switch_buffer.o call_signal.o $(LDFLAGS) + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o sangoma_mgd_ip_bridge.o switch_buffer.o call_signal.o $(LDFLAGS) @@ -117,8 +123,17 @@ install_smg: old_cleanup fi install -D -m 755 ./safe_sangoma $(DESTDIR)/usr/sbin/safe_sangoma + install -D -m 755 ./rc/safe_sangoma.rc $(DESTDIR)/etc/wanpipe/safe_sangoma.rc install -D -m 755 ./smg_ctrl $(DESTDIR)/usr/sbin/smg_ctrl + @if [ ! -d ${SAFE_D} ]; then \ + mkdir -p ${SAFE_D}; \ + fi + @if [ ! -d ${SMGCTRL_D} ]; then \ + mkdir -p ${SMGCTRL_D}; \ + fi + + ifeq "${PRI}" "YES" @echo "PRI control scripts installed" @if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \ diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.c.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.c.svn-base index 1322d89..9e19dab 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.c.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.c.svn-base @@ -120,23 +120,24 @@ static int smg_event_dbg=SMG_LOG_BOOST; static void clog_print_event_call(call_signal_connection_t *mcon,call_signal_event_t *event, int priority, int dir) { clog_printf((event->event_id==SIGBOOST_EVENT_HEARTBEAT)?SMG_LOG_DEBUG_CALL:smg_event_dbg, mcon->log, - "%s EVENT (%s): %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n", + "%s EVENT (%s): %s:(%X) [s%dc%d] Tg=%i CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n", dir ? "TX":"RX", priority ? "P":"N", call_signal_event_id_name(event->event_id), event->event_id, event->span+1, event->chan+1, + event->trunk_group, event->call_setup_id, event->fseqno, - strlen(event->calling_name)?event->calling_name:"N/A", + strlen(event->calling_name)?event->calling_name:"N/A", (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")); } static void clog_print_event_short(call_signal_connection_t *mcon,short_signal_event_t *event, int priority, int dir) { clog_printf((event->event_id==SIGBOOST_EVENT_HEARTBEAT)?SMG_LOG_DEBUG_CALL:smg_event_dbg, mcon->log, - "%s EVENT (%s): %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i \n", + "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n", dir ? "TX":"RX", priority ? "P":"N", call_signal_event_id_name(event->event_id), diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/install.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/install.svn-base index 218e0cd..ea75b95 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/install.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/install.svn-base @@ -49,7 +49,7 @@ cfgdir="/etc/asterisk" mysyslog=" " smg_installed=0 chan_woomera_installed=0 - +no_woomera="false" while [ ! -z $1 ] @@ -62,6 +62,9 @@ do noss7="flase" elif [ $1 = '-bri' ]; then noss7="true" + elif [ $1 = '-no_woomera' ]; then + noss7="true" + no_woomera="true" elif [ $1 = '-pri' ]; then noss7="true" pri="true" @@ -242,7 +245,7 @@ if [ ! -e /usr/include/netinet/sctp.h ] && [ ! -e /usr/include/sctp.h ]; then echo echo "Error: lksctp-tools-devel package missing" echo "Please install sctp using a package manager" - echo "eg: yum install ksctp-tools-devel" + echo "eg: yum install lksctp-tools-devel" echo exit 1 fi @@ -325,42 +328,44 @@ else smg_installed=1; fi -if [ -d chan_woomera.trunk ]; then +if [ "$no_woomera" == "false" ]; then + if [ -d chan_woomera.trunk ]; then - cd chan_woomera.trunk + cd chan_woomera.trunk - echo "Compiling Woomera Channel ..." + echo "Compiling Woomera Channel ..." - if [ ! -e $pbxdir ]; then - echo - echo "Error: $pbxdir directory does not exist!" - echo " Please provide the path to Asterik or CallWeaver source." - echo " Then re-run eg: ./install -pbxdir /usr/src/asterisk " - echo - getyn "Would you like to continue installation?" - if [ $? -ne 0 ]; then - exit 1; + if [ ! -e $pbxdir ]; then + echo + echo "Error: $pbxdir directory does not exist!" + echo " Please provide the path to Asterik or CallWeaver source." + echo " Then re-run eg: ./install -pbxdir /usr/src/asterisk " + echo + getyn "Would you like to continue installation?" + if [ $? -ne 0 ]; then + exit 1; + fi + else + eval "make clean 2> /dev/null > /dev/null" + eval "make PBXDIR=$pbxdir" + if [ $? -ne 0 ]; then + exit 1; + fi + make INSTALLPREFIX=$rootdir install + if [ $? -ne 0 ]; then + echo + echo "Error: Failed to compile chan_woomera into PBX source!" + echo + exit 1; + fi + echo "Ok." + chan_woomera_installed=1; fi + else - eval "make clean 2> /dev/null > /dev/null" - eval "make PBXDIR=$pbxdir" - if [ $? -ne 0 ]; then - exit 1; - fi - make INSTALLPREFIX=$rootdir install - if [ $? -ne 0 ]; then - echo - echo "Error: Failed to compile chan_woomera into PBX source!" - echo - exit 1; - fi - echo "Ok." - chan_woomera_installed=1; + echo "Warning: chan_woomera directory does not exist!" + exit 1 fi - -else - echo "Warning: chan_woomera directory does not exist!" - exit 1 fi if [ $smg_installed -eq 1 ]; then @@ -389,6 +394,10 @@ if [ $chan_woomera_installed -eq 1 ]; then echo "--> Start: start $pbxd (part of $pbxd)" echo echo "---------------------------------" +elif [ $no_woomera = "true" ];then + echo + echo " You chose not to install Chan Woomera" + echo else echo echo " Chan Woomera Installatin Failed" diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/safe_sangoma.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/safe_sangoma.svn-base index 5c7c604..19a6bfe 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/safe_sangoma.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/safe_sangoma.svn-base @@ -7,31 +7,46 @@ shift APPARGS="$*" # Grab any args passed to safe_sangoma TTY= # TTY (if you want one) for APP to run on CONSOLE=no # Whether or not you want a console -#NOTIFY=user@email.com # Who to notify about crashes -#EXEC=/path/to/somescript # Run this command if Asterisk crashes MACHINE=`hostname` # To specify which machine has crashed when getting the mail DUMPDROP=/tmp SLEEPSECS=2 BINDIR=/usr/sbin +BINDIR_SS7="/usr/local/ss7box" PIDFILE=/var/run/$APP.pid CORENAME=$(cat /proc/sys/kernel/core_pattern) VARDIR=/var/log +PROD="safe_sangoma" + +WAN_HOME=/etc/wanpipe +META_SMG_CONF=$WAN_HOME/safe_sangoma.rc + +# Read meta-configuration file. +# metconf file should define NOTIFY or EXEC path script +# to run +if [ -f $META_SMG_CONF ] + then . $META_SMG_CONF +fi if [ -z $APP ]; then echo - echo "Error: APP argument not specified" + logit "Error: APP argument not specified" echo - echo "Usage: safe_sangoma " + logit "Usage: safe_sangoma " echo exit 1 fi +if [ -e $BINDIR_SS7/$APP ]; then + BINDIR=$BINDIR_SS7 +fi + if [ ! -e $BINDIR/$APP ]; then echo - echo "Error: APP not found: $BINDIR/$APP" + logit "Error: APP not found: $BINDIR/$APP" exit 1 fi + # run APP with this priority PRIORITY=0 @@ -46,12 +61,12 @@ MAXFILES=32768 # starting safe_sangoma when APP is running is very bad. PID=`pidof $APP` if [ ! -z $PID ]; then - echo "Error: $APP already running. $0 will exit now." + logit "Error: $APP already running. $0 will exit now." exit 1 fi if [ -f $PIDFILE ]; then - echo "Error: $APP pid file $PIDFILE exists!. $0 will exit now." + logit "Error: $APP pid file $PIDFILE exists!. $0 will exit now." exit 1 fi @@ -61,8 +76,8 @@ fi # if we're not root, fall back to standard everything. if [ `id -u` != 0 ] then - echo "Oops. I'm not root. Falling back to standard prio and file max." >&2 - echo "This is NOT suitable for large systems." >&2 + logit "Oops. I'm not root. Falling back to standard prio and file max." >&2 + logit "This is NOT suitable for large systems." >&2 PRIORITY=0 else if `echo $OSTYPE | grep linux 2>&1 > /dev/null ` @@ -124,7 +139,7 @@ ulimit -c unlimited #fi if [ ! -w ${DUMPDROP} ]; then - echo "Cannot write to ${DUMPDROP}" >&2 + logit "Cannot write to ${DUMPDROP}" >&2 exit 1 fi @@ -136,15 +151,24 @@ trap '' PIPE # # Run scripts to set any environment variables or do any other system-specific setup needed # - if [ -d /etc/wanpipe/safe_startup.d ]; then for script in /etc/wanpipe/safe_startup.d/*.sh; do - if [ -x ${script} ]; then - source ${script} + if [ -x $script ]; then + logit "Executing startup script: $script" + source $script fi done fi + +logit() +{ + local data="$1" + + echo "$PROD: $data" + logger "$PROD: $data" +} + run_sangoma() { while :; do @@ -153,26 +177,38 @@ run_sangoma() nice -n $PRIORITY ${BINDIR}/$APP ${APPARGS} EXITSTATUS=$? - echo "$APP ended with exit status $EXITSTATUS" + logit "$APP ended with exit status $EXITSTATUS" if [ "$EXITSTATUS" = "0" ]; then # Properly shutdown.... - echo "$APP shutdown normally." + logit "$APP shutdown normally." exit 0 elif [ $EXITSTATUS -gt 128 ]; then let EXITSIGNAL=EXITSTATUS-128 - echo "$APP exited on signal $EXITSIGNAL." + logit "$APP exited on signal $EXITSIGNAL." else - echo "$APP died with code $EXITSTATUS." + logit "$APP died with code $EXITSTATUS." fi if [ "$NOTIFY" != "" ]; then - echo "$APP on $MACHINE exited on signal $EXITSIGNAL. Might want to take a peek." | \ - mail -s "$APP Died" $NOTIFY + logfile="/etc/wanpipe/safe_sangoma_crash_"$APP"_"$$".log" + echo > $logfile + date >> $logfile + echo >> $logfile + echo "$APP on $MACHINE exited on signal $EXITSIGNAL. " >> $logfile + echo >> $logfile + echo "/var/log/messages" >> $logfile + echo "====================" >> $logfile + tail -n 50 /var/log/messages >> $logfile + echo "====================" >> $logfile + echo >> $logfile + cat $logfile | \ + mail -s "$APP on $MACHINE Died" $NOTIFY + ret=$? + logit "Email sent to $NOTIFY result $ret" fi if [ "$EXEC" != "" ]; then $EXEC fi - PID=`cat ${PIDFILE}` if [ -f /tmp/$CORENAME.${PID} ]; then mv /tmp/$CORENAME.${PID} ${DUMPDROP}/core.$APP.`hostname`-`date -Iseconds` & @@ -180,7 +216,7 @@ run_sangoma() mv /tmp/$CORENAME ${DUMPDROP}/core.$APP.`hostname`-`date -Iseconds` & fi - echo "Automatically restarting $APP." + logit "Automatically restarting $APP." sleep $SLEEPSECS \rm -f ${PIDFILE} done diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.c.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.c.svn-base index 660ddeb..aaf77f8 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.c.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.c.svn-base @@ -9,6 +9,21 @@ * * ============================================= * + * v1.59 Nenad Corbic + * Changed w1g1 to s1c1 + * + * v1.58 Nenad Corbic + * Added bridge tdm to ip functionality + * + * v1.57 Nenad Corbic + * Support for woomera multiple profiles + * + * v1.56 David Yat Sin + * Changed BRI to run with HWEC in non-persist mode + * + * v1.55 Nenad Corbic + * Updated the base media port to 10000 and max media ports to 5000 + * * v1.54 Nenad Corbic * Bug added in 1.51 release causing call on channel 31 to fail. * @@ -299,14 +314,24 @@ static char ps_progname[]="sangoma_mgd"; static struct woomera_interface woomera_dead_dev; + +/* For 3.4. release always set to 1 */ +#ifdef BRI_PROT +static unsigned char tdmv_hwec_persist = 0; +#else +static unsigned char tdmv_hwec_persist = 1; +#endif struct woomera_server server; +struct smg_tdm_ip_bridge g_smg_ip_bridge_idx[MAX_SMG_BRIDGE]; +pthread_mutex_t g_smg_ip_bridge_lock; + #if 0 #define DOTRACE #endif -#define SMG_VERSION "v1.54" +#define SMG_VERSION "v1.59" /* enable early media */ #if 1 @@ -356,7 +381,7 @@ static int drop_seq=0; const char WELCOME_TEXT[] = "================================================================================\n" -"Sangoma Media Gateway Daemon v1.54 \n" +"Sangoma Media Gateway Daemon v1.59 \n" "\n" "TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" "Copyright 2005, 2006, 2007 \n" @@ -485,8 +510,14 @@ isup_exec_cmd_retry: static int get_span_chan_from_interface(char* interface, int *span_ptr, int *chan_ptr) { int span, chan; + int err; - if (sscanf(interface, "w%dg%d", &span, &chan) == 2) { + err=sscanf(interface, "s%dc%d", &span, &chan); + if (err!=2) { + err=sscanf(interface, "w%dg%d", &span, &chan); + } + + if (err==2) { if (smg_validate_span_chan(span,chan) != 0) { log_printf(SMG_LOG_DEBUG_CALL, server.log, "WOOMERA Warning invalid span chan in interface %s\n", @@ -975,7 +1006,7 @@ waitfor_socket_tryagain: } -static int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) +int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) { struct pollfd pfds[2]; int res = 0; @@ -999,8 +1030,6 @@ waitfor_2sockets_tryagain: pfds[0].events = POLLIN | errflags; pfds[1].events = POLLIN | errflags; - - res = poll(pfds, 2, timeout); if (res > 0) { @@ -1073,7 +1102,7 @@ static struct media_session *media_session_new(struct woomera_interface *woomera /* Setup artificial DTMF stuff */ memset(&ms->tone_session, 0, sizeof(ms->tone_session)); if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { - log_printf(SMG_LOG_ALL, server.log, "ERROR: Failed to initialize TONE [w%ig%i]!\n", + log_printf(SMG_LOG_ALL, server.log, "ERROR: Failed to initialize TONE [s%ic%i]!\n", span+1,chan+1); } @@ -1084,7 +1113,7 @@ static struct media_session *media_session_new(struct woomera_interface *woomera teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); } else { - log_printf(SMG_LOG_ALL, server.log, "ERROR: Memory Alloc Failed [w%ig%i]!\n", + log_printf(SMG_LOG_ALL, server.log, "ERROR: Memory Alloc Failed [s%ic%i]!\n", span+1,chan+1); } @@ -1300,7 +1329,7 @@ retry_loop: usleep(500000); goto retry_loop; } - log_printf(SMG_LOG_ALL, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [w%ig%i]\n", + log_printf(SMG_LOG_ALL, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [s%ic%i]\n", strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); } else { @@ -1337,7 +1366,7 @@ retry_loop: } if (server.loop_trace) { - sprintf(filename,"/smg/w%ig%i-loop.trace",woomera->span+1,woomera->chan+1); + sprintf(filename,"/smg/s%ic%i-loop.trace",woomera->span+1,woomera->chan+1); unlink(filename); filed = safe_fopen(filename, "w"); } @@ -1451,7 +1480,9 @@ static void *media_thread_run(void *obj) wanpipe_tdm_api_t tdm_api; FILE *tx_fd=NULL; int sock_timeout=200; - int hwec_reenable=0; + + int hwec_enabled=0, hwec_reenable=0; + int open_cnt = 0; open_cnt=0; @@ -1523,13 +1554,13 @@ media_retry: if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) { media_retry_cnt++; if (media_retry_cnt < 5) { - log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Retry [w%ig%i]\n", + log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Retry [s%ic%i]\n", woomera->span+1, woomera->chan+1); usleep(100000); goto media_retry; } - log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Error (%s) if=[%s] [w%ig%i]\n", + log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Error (%s) if=[%s] [s%ic%i]\n", strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); /* Switch Congestion */ @@ -1571,15 +1602,15 @@ media_retry: # ifdef LIBSANGOMA_GET_HWDTMF ms->hw_dtmf=sangoma_tdm_get_hw_dtmf(ms->sangoma_sock, &tdm_api); if (ms->hw_dtmf) { - log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Supported [w%ig%i]\n", + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Supported [s%ic%i]\n", strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); } else { - log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [w%ig%i]\n", + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [s%ic%i]\n", strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); } #else ms->hw_dtmf=0; - log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [w%ig%i]\n", + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [s%ic%i]\n", strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); # warning "libsangoma missing hwdtmf feature: not up to date!" @@ -1592,16 +1623,30 @@ media_retry: ms->oob_disable = 1; } #endif - if (!bearer_cap_is_audio(woomera->bearer_cap)) { - int err; - err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api); - if (err == 0) { - hwec_reenable=1; - log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Disabling hwec Ok\n",woomera->interface); - } else { - log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Disabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + + if (!tdmv_hwec_persist) { + // BRI cards start with HWEC in bypass disable state + if (bearer_cap_is_audio(woomera->bearer_cap)) { + int err; + err=sangoma_tdm_enable_hwec(ms->sangoma_sock, &tdm_api); + if (err == 0) { + hwec_enabled=1; + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Enabling hwec Ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Enabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } else { + if (!bearer_cap_is_audio(woomera->bearer_cap)) { + int err; + err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api); + if (err == 0) { + hwec_reenable=1; + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Disabling hwec Ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Disabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } } - } sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); @@ -1878,13 +1923,25 @@ media_retry: media_thread_exit: - if (hwec_reenable) { - int err; - err=sangoma_tdm_enable_hwec(ms->sangoma_sock, &tdm_api); - if (err==0) { - log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Re-enabling hwec ok\n",woomera->interface); - } else { - log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Re-enabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + if (!tdmv_hwec_persist) { + if (hwec_enabled) { + int err; + err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api); + if (err==0) { + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] disabling hwec ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] disabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } else { + if (hwec_reenable) { + int err; + err=sangoma_tdm_enable_hwec(ms->sangoma_sock, &tdm_api); + if (err==0) { + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Re-enabling hwec ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Re-enabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } } } @@ -2167,9 +2224,9 @@ static struct woomera_interface * launch_woomera_loop_thread(short_signal_event_ struct woomera_interface *woomera = NULL; char callid[20]; - sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(callid, "s%dc%d", event->span+1,event->chan+1); - if ((woomera = alloc_woomera())) { + if ((woomera = alloc_woomera())) { woomera->chan = event->chan; woomera->span = event->span; @@ -2790,7 +2847,7 @@ static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, SIGBOOST_EVENT_CALL_ANSWERED, 0); log_printf(SMG_LOG_DEBUG_CALL, server.log, - "Sent SIGBOOST_EVENT_CALL_ANSWERED [w%dg%d]\n", + "Sent SIGBOOST_EVENT_CALL_ANSWERED [s%dc%d]\n", woomera->span+1,woomera->chan+1); } else { struct woomera_event wevent; @@ -2860,6 +2917,7 @@ static int handle_woomera_call_start (struct woomera_interface *woomera, char *uil1p = woomera_message_header(wmsg, "uil1p"); char *called = wmsg->callid; char *grp = wmsg->callid; + char *profile; char *p; int cause = 34; int tg = 0; @@ -2887,7 +2945,15 @@ static int handle_woomera_call_start (struct woomera_interface *woomera, } - log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "New Call %d/%d\n", server.call_count, server.max_calls); + /* Remove profile name out of destiantion */ + if ((profile = strchr(called, ':'))) { + profile++; + called=profile; + grp=profile; + } + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "New Call %d/%d origdest=%s newdest=%s\n", + server.call_count, server.max_calls, wmsg->callid, called); switch(called[0]) { case 'g': @@ -3166,8 +3232,13 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ char *session=NULL; int span, chan; char ifname[100]; + int err; + /* If session does not exist this is an incoming call */ - sscanf(unique_id, "w%dg%d", &span, &chan); + err=sscanf(unique_id, "s%dc%d", &span, &chan); + if (err!=2) { + err=sscanf(unique_id, "w%dg%d", &span, &chan); + } span--; chan--; @@ -3254,14 +3325,14 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ int clients=server.process_table[span][chan].clients; if (server.process_table[span][chan].clients < 0) { - log_printf(SMG_LOG_ALL, woomera->log, "WOOMERA CMD: Warning Clients (%i) Race condition on Hangup [w%dg%d]\n", + log_printf(SMG_LOG_ALL, woomera->log, "WOOMERA CMD: Warning Clients (%i) Race condition on Hangup [s%dc%d]\n", clients, span+1,chan+1); } else if (server.process_table[span][chan].clients > 1) { server.process_table[span][chan].clients--; pthread_mutex_unlock(&server.process_lock); - log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Got Hungup on Multiple Clients %i, skipping hangup [w%dg%d]\n", + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Got Hungup on Multiple Clients %i, skipping hangup [s%dc%d]\n", clients, span+1,chan+1); cause=16; @@ -3280,14 +3351,14 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ woomera_set_flag(woomera, WFLAG_HANGUP); return; } - log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Hanging up channel [w%dg%d]\n", + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Hanging up channel [s%dc%d]\n", span+1,chan+1); } #endif server.process_table[span][chan].dev=woomera; strncpy(woomera->session,unique_id,sizeof(woomera->session)); - sprintf(ifname,"w%dg%d",span+1,chan+1); + sprintf(ifname,"s%dc%d",span+1,chan+1); woomera_set_interface(woomera, ifname); woomera->span=span; @@ -3365,7 +3436,7 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ } - log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "Hangup Received: [w%dg%d]\n", + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "Hangup Received: [s%dc%d]\n", span+1,chan+1); @@ -3468,7 +3539,7 @@ static void handle_call_answer(short_signal_event_t *event) } else { int err; err=0; - sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + sprintf(callid, "s%dc%d", event->span + 1, event->chan + 1); woomera_set_interface(woomera, callid); #ifndef WOOMERA_EARLY_MEDIA err=launch_media_thread(woomera); @@ -3506,7 +3577,7 @@ static void handle_call_answer(short_signal_event_t *event) #endif if (!kill) { - new_woomera_event_printf(&wevent, "EVENT CONNECT w%dg%d%s" + new_woomera_event_printf(&wevent, "EVENT CONNECT s%dc%d%s" "Unique-Call-Id: %s%s", event->span+1, event->chan+1, @@ -3518,7 +3589,7 @@ static void handle_call_answer(short_signal_event_t *event) } } } else { - log_printf(SMG_LOG_PROD, server.log, "Answer requested on non-existant session. [w%dg%d]\n", + log_printf(SMG_LOG_PROD, server.log, "Answer requested on non-existant session. [s%dc%d]\n", event->span+1, event->chan+1); kill++; } @@ -3539,10 +3610,10 @@ handle_call_answer_end: SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_NORMAL); - log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to Answer without session [w%dg%d]\n", + log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to Answer without session [s%dc%d]\n", event->span+1, event->chan+1); #endif - log_printf(SMG_LOG_ALL, server.log, "WARNING: Received Answer with no session [w%dg%d]\n", + log_printf(SMG_LOG_ALL, server.log, "WARNING: Received Answer with no session [s%dc%d]\n", event->span+1, event->chan+1); } } @@ -3564,7 +3635,7 @@ static void handle_call_start_ack(short_signal_event_t *event) int err, span, chan; pull_from_holding_tank(event->call_setup_id,event->span,event->chan); - sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + sprintf(callid, "s%dc%d", event->span + 1, event->chan + 1); span = event->span; chan = event->chan; @@ -3578,7 +3649,7 @@ static void handle_call_start_ack(short_signal_event_t *event) struct woomera_interface *tmp_woomera = server.process_table[span][chan].dev; woomera_set_flag(tmp_woomera,WFLAG_HANGUP); woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END); - log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [w%dg%d] - Call ACK!\n", event->span+1, event->chan+1); + log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [s%dc%d] - Call ACK!\n", event->span+1, event->chan+1); kill++; } @@ -3636,7 +3707,7 @@ static void handle_call_start_ack(short_signal_event_t *event) #endif if (!kill) { - new_woomera_event_printf(&wevent, "EVENT PROCEED w%dg%d%s" + new_woomera_event_printf(&wevent, "EVENT PROCEED s%dc%d%s" "Channel-Name: g%d/%d%s" "Unique-Call-Id: %s%s", event->span+1, @@ -3659,13 +3730,13 @@ static void handle_call_start_ack(short_signal_event_t *event) enqueue_event(woomera, &wevent,EVENT_FREE_DATA); - log_printf(SMG_LOG_DEBUG_MISC, server.log, "Call Answered Event ID = %d Device = w%dg%d!\n", + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Call Answered Event ID = %d Device = s%dc%d!\n", event->call_setup_id,woomera->span+1,woomera->chan+1); } } } else { log_printf(SMG_LOG_PROD, server.log, - "Event (START ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + "Event (START ACK) %d referrs to a non-existant session (%d) [s%dc%d]!\n", event->event_id, event->call_setup_id,event->span+1, event->chan+1); kill++; } @@ -3681,7 +3752,7 @@ woomera_call_ack_skip: SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_NORMAL); - log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to CALL START ACK without session [w%dg%d]\n", + log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to CALL START ACK without session [s%dc%d]\n", event->span+1, event->chan+1); } } @@ -3721,7 +3792,7 @@ static void handle_call_start_nack(short_signal_event_t *event) woomera_set_cause_topbx(woomera,event->release_cause); woomera_set_flag(woomera, (WFLAG_HANGUP|WFLAG_HANGUP_NACK_ACK)); - new_woomera_event_printf(&wevent, "EVENT HANGUP w%dg%d%s" + new_woomera_event_printf(&wevent, "EVENT HANGUP s%dc%d%s" "Unique-Call-Id: %s%s" "Cause: %s%s" "Q931-Cause-Code: %d%s", @@ -3780,7 +3851,7 @@ static void handle_call_start_nack(short_signal_event_t *event) if (woomera) { - log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event START NACK on w%dg%d ptr=%p ms=%p\n", + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event START NACK on s%dc%d ptr=%p ms=%p\n", woomera->span+1,woomera->chan+1,woomera,woomera->ms); if (!woomera_test_flag(woomera,WFLAG_HANGUP)){ @@ -3800,13 +3871,13 @@ static void handle_call_start_nack(short_signal_event_t *event) } else { /* Valid state when we are not in autoacm mode */ ack++; - log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event: NACK no woomera on span chan [w%dg%d]!\n", + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event: NACK no woomera on span chan [s%dc%d]!\n", event->span+1, event->chan+1); } } else { log_printf(SMG_LOG_ALL, server.log, - "Error: Start Nack Invalid State Should not happen [%d] [w%dg%d]!\n", + "Error: Start Nack Invalid State Should not happen [%d] [s%dc%d]!\n", event->call_setup_id, event->span+1, event->chan+1); ack++; } @@ -3816,7 +3887,7 @@ static void handle_call_start_nack(short_signal_event_t *event) log_printf(SMG_LOG_ALL, server.log, "WARNING: All ckt busy Timeout=%i!\n",server.all_ckt_busy); } if (event->release_cause == SIGBOOST_CALL_SETUP_CSUPID_DBL_USE) { - log_printf(SMG_LOG_ALL, server.log, "WARNING: Double use on [w%ig%i] setup id %i!\n", + log_printf(SMG_LOG_ALL, server.log, "WARNING: Double use on [s%ic%i] setup id %i!\n", event->span+1,event->chan+1,event->call_setup_id); } @@ -3843,7 +3914,7 @@ static void handle_call_start_nack(short_signal_event_t *event) 0); if (!woomera) { - log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [s%dc%d]!\n", event->event_id,event->call_setup_id, event->span+1, event->chan+1); } } @@ -3866,7 +3937,7 @@ static void handle_call_loop_start(short_signal_event_t *event) log_printf(SMG_LOG_PROD, server.log, - "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [s%dc%d] ptr=%d\n", event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); pthread_mutex_unlock(&server.process_lock); @@ -3874,7 +3945,7 @@ static void handle_call_loop_start(short_signal_event_t *event) } - sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(callid, "s%dc%d", event->span+1,event->chan+1); sprintf(server.process_table[event->span][event->chan].session, "%s-%i-%i",callid,rand(),rand()); session=server.process_table[event->span][event->chan].session; @@ -3890,7 +3961,7 @@ static void handle_call_loop_start(short_signal_event_t *event) SIGBOOST_EVENT_CALL_START_NACK, 17); log_printf(SMG_LOG_PROD, server.log, - "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [s%dc%d] ptr=%d\n", event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); } @@ -3918,7 +3989,7 @@ static void handle_call_start(call_signal_event_t *event) if (smg_validate_span_chan(event->span,event->chan)) { log_printf(0,server.log, - "Error: invalid span=% chan=%i on incoming call [w%dg%d] - Call START!\n", + "Error: invalid span=% chan=%i on incoming call [s%dc%d] - Call START!\n", event->span+1, event->chan+1, event->span+1,event->chan+1); return; } @@ -3929,7 +4000,7 @@ static void handle_call_start(call_signal_event_t *event) woomera_set_flag(tmp_woomera,WFLAG_HANGUP); woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END); - log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [w%dg%d] - Call START!\n", event->span+1, event->chan+1); + log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [s%dc%d] - Call START!\n", event->span+1, event->chan+1); isup_exec_command(event->span, event->chan, @@ -3938,14 +4009,14 @@ static void handle_call_start(call_signal_event_t *event) 17); log_printf(SMG_LOG_ALL, server.log, - "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [s%dc%d]\n", event->span+1, event->chan+1); pthread_mutex_unlock(&server.process_lock); return; } - sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(callid, "s%dc%d", event->span+1,event->chan+1); sprintf(server.process_table[event->span][event->chan].session, "%s-%i-%i",callid,rand(),rand()); session=server.process_table[event->span][event->chan].session; @@ -3976,7 +4047,7 @@ static void handle_call_start(call_signal_event_t *event) } } - new_woomera_event_printf(&wevent, "EVENT INCOMING w%dg%d%s" + new_woomera_event_printf(&wevent, "EVENT INCOMING s%dc%d%s" "Unique-Call-Id: %s%s" "Remote-Number: %s%s" "Remote-Name: %s%s" @@ -4044,7 +4115,7 @@ static void handle_call_start(call_signal_event_t *event) SIGBOOST_EVENT_CALL_STOPPED, 17); log_printf(SMG_LOG_ALL, server.log, - "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [s%dc%d]\n", event->span+1, event->chan+1); } else { @@ -4054,13 +4125,15 @@ static void handle_call_start(call_signal_event_t *event) SIGBOOST_EVENT_CALL_START_NACK, 17); log_printf(SMG_LOG_ALL, server.log, - "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_START_NACK [s%dc%d]\n", event->span+1, event->chan+1); } } else { - server.process_table[event->span][event->chan].clients=clients; + //pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].clients = clients; + //pthread_mutex_unlock(&server.process_lock); } destroy_woomera_event_data(&wevent); @@ -4073,20 +4146,20 @@ static void handle_incoming_digit(call_signal_event_t *event) int digits_len; if (smg_validate_span_chan(event->span,event->chan)) { - log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event DTMF on invalid span chan [w%dg%d] !\n", + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event DTMF on invalid span chan [s%dc%d] !\n", event->span+1, event->chan+1); return; } if (!event->called_number_digits_count) { - log_printf(SMG_LOG_ALL, server.log, "Error Incoming digit with len %s %d [w%dg%d]\n", + log_printf(SMG_LOG_ALL, server.log, "Error Incoming digit with len %s %d [s%dc%d]\n", event->called_number_digits, event->called_number_digits_count, event->span+1, event->chan+1); } - log_printf(SMG_LOG_DEBUG_9, server.log, "Queuing incoming digits %s [w%dg%d]\n", + log_printf(SMG_LOG_DEBUG_9, server.log, "Queuing incoming digits %s [s%dc%d]\n", event->called_number_digits, event->span+1, event->chan+1); @@ -4183,7 +4256,7 @@ static void handle_remove_loop(short_signal_event_t *event) /* We have to close the socket because At this point we are release span chan */ - log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event REMOVE LOOP on w%dg%d ptr=%p ms=%p\n", + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event REMOVE LOOP on s%dc%d ptr=%p ms=%p\n", woomera->span+1,woomera->chan+1,woomera,woomera->ms); } @@ -4226,7 +4299,7 @@ static void handle_call_stop(short_signal_event_t *event) /* We have to close the socket because At this point we are release span chan */ - log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP on w%dg%d ptr=%p ms=%p\n", + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP on s%dc%d ptr=%p ms=%p\n", woomera->span+1,woomera->chan+1,woomera,woomera->ms); } else { @@ -4245,7 +4318,7 @@ static void handle_call_stop(short_signal_event_t *event) if (!woomera){ /* This is allowed on incoming call if remote app does not answer it */ - log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP referrs to a non-existant session [w%dg%d]!\n", + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP referrs to a non-existant session [s%dc%d]!\n", event->span+1, event->chan+1); } } @@ -4279,14 +4352,14 @@ static void handle_call_stop_ack(short_signal_event_t *event) if (woomera) { - log_printf(SMG_LOG_DEBUG_CALL, server.log, "Stop Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Stop Ack on [s%dc%d] [Setup ID: %d] [%s]!\n", event->span+1, event->chan+1, event->call_setup_id, woomera->interface); woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); } else { - log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [s%dc%d] [Setup ID: %d]!\n", event->event_id, event->span+1, event->chan+1, event->call_setup_id); } @@ -4325,13 +4398,13 @@ static void handle_call_start_nack_ack(short_signal_event_t *event) * woomera client being down, in this case no * woomera thread is created */ log_printf(SMG_LOG_DEBUG_8, server.log, - "Event NACK ACK [w%dg%d] with valid span/chan no dev!\n", + "Event NACK ACK [s%dc%d] with valid span/chan no dev!\n", event->span+1, event->chan+1); } } else { log_printf(SMG_LOG_DEBUG_CALL, server.log, - "Event NACK ACK referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + "Event NACK ACK referrs to a non-existant session [s%dc%d] [Setup ID: %d]!\n", event->span+1, event->chan+1, event->call_setup_id); } @@ -4410,9 +4483,9 @@ static void *monitor_thread_run(void *obj) call_signal_connection_t *mcon=&server.mcon; call_signal_connection_t *mconp=&server.mconp; - pthread_mutex_lock(&server.thread_count_lock); + pthread_mutex_lock(&server.thread_count_lock); server.thread_count++; - pthread_mutex_unlock(&server.thread_count_lock); + pthread_mutex_unlock(&server.thread_count_lock); woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); @@ -4771,7 +4844,7 @@ woomera_session_close: woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT); - log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] ptr=%p\n", + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [s%dc%d] [%s] ptr=%p\n", span+1, chan+1,woomera->interface,woomera); } else { @@ -4783,11 +4856,11 @@ woomera_session_close: woomera->q931_rel_cause_tosig); woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); - log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d] [%s] ptr=%p\n", + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_START_NACK [s%dc%d] [%s] ptr=%p\n", span+1, chan+1,woomera->interface,woomera); } } else { - log_printf(SMG_LOG_ALL, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [w%dg%d] [%s] ptr=%p\n", + log_printf(SMG_LOG_ALL, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [s%dc%d] [%s] ptr=%p\n", span+1, chan+1,woomera->interface,woomera); } @@ -4797,7 +4870,7 @@ woomera_session_close: failure */ if (!woomera->index) { /* In this case we really failed to tx STOP */ - log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [s%dc%d] [%s] Index=%d ptr=%p\n", span+1, chan+1, woomera->interface, woomera->index, woomera); } } @@ -4825,14 +4898,14 @@ woo_re_hangup: woomera->q931_rel_cause_tosig); log_printf(SMG_LOG_DEBUG_MISC, woomera->log, - "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] ptr=%p\n", + "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [s%dc%d] [%s] ptr=%p\n", span+1,chan+1,woomera->interface,woomera); }else{ /* This should never happen! If it does we broke protocol */ log_printf(SMG_LOG_ALL, woomera->log, - "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [s%dc%d] [%s] Index=%d ptr=%p\n", span+1, chan+1, woomera->interface, woomera->index, woomera); } @@ -4856,7 +4929,7 @@ woo_re_hangup: woomera->q931_rel_cause_tosig); log_printf(SMG_LOG_DEBUG_MISC, woomera->log, - "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] ptr=%p\n", + "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [s%dc%d] [%s] ptr=%p\n", span+1,chan+1,woomera->interface,woomera); woomera->index=0; @@ -4872,7 +4945,7 @@ woo_re_hangup: } else { log_printf(SMG_LOG_ALL, woomera->log, - "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [s%dc%d] [%s] Index=%d ptr=%p\n", span+1, chan+1, woomera->interface, woomera->index, woomera); } @@ -5098,7 +5171,7 @@ woo_re_hangup: if (server.process_table[span][chan]){ log_printf(SMG_LOG_ALL, server.log, - "Sanity Span Chan Still in use: [w%dg%d] [%s] Index=%d ptr=%p\n", + "Sanity Span Chan Still in use: [s%dc%d] [%s] Index=%d ptr=%p\n", span+1, chan+1, woomera->interface, woomera->index, woomera); //server.process_table[span][chan] = NULL; } @@ -5300,7 +5373,9 @@ static int configure_server(void) struct woomera_config cfg; char *var, *val; int cnt = 0; + struct smg_tdm_ip_bridge *ip_bridge=NULL; + server.dtmf_intr_ch = -1; if (!woomera_open_file(&cfg, server.config_file)) { @@ -5407,19 +5482,71 @@ static int configure_server(void) server.base_media_port = base; server.next_media_port = base; server.max_media_port = server.base_media_port + WOOMERA_MAX_MEDIA_PORTS; - log_printf(SMG_LOG_ALL,server.log, "Server - Base Media Port: %d\n",server.base_media_port); + log_printf(SMG_LOG_ALL,server.log, "Server - Base Media Port: %d\n",server.base_media_port); } } else if (!strcasecmp(var, "max_media_ports")) { int max = atoi(val); - if (max > WOOMERA_MAX_MEDIA_PORTS) { + if (max >= 0) { server.max_media_port = server.base_media_port+max; - log_printf(SMG_LOG_ALL,server.log, "Server - Max Media Port: %d\n",server.max_media_port); + log_printf(SMG_LOG_ALL,server.log, "Server - Max Media Port: %d\n",server.max_media_port); } } else if (!strcasecmp(var, "media_ip")) { strncpy(server.media_ip, val, sizeof(server.media_ip) -1); log_printf(SMG_LOG_ALL,server.log, "Server - Media IP: %s\n",server.media_ip); + + } else if (!strcasecmp(var, "bridge_tdm_ip")) { + int err=smg_get_ip_bridge_session(&ip_bridge); + if (err) { + log_printf(SMG_LOG_ALL, server.log, "Error failed to get free ip bridge %i!\n",err); + } else { + log_printf(SMG_LOG_ALL,server.log, "\n======================= \n"); + log_printf(SMG_LOG_ALL,server.log, "Bridge - Configuration \n"); + log_printf(SMG_LOG_ALL,server.log, "======================= \n"); + } + + } else if (!strcasecmp(var, "bridge_span")) { + int max = atoi(val); + if (max > 0 && max <= 32 && ip_bridge) { + ip_bridge->span=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Span: %i\n",ip_bridge->span); + } else { + log_printf(SMG_LOG_ALL, server.log, "Bridge Span: ERROR: Invalid Value %s\n",val); + } + } else if (!strcasecmp(var, "bridge_chan")) { + int max = atoi(val); + if (max > 0 && max < MAX_SMG_BRIDGE && ip_bridge) { + ip_bridge->chan=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Chan: %i\n",ip_bridge->chan); + } else { + log_printf(SMG_LOG_ALL, server.log, "Bridge Chan: ERROR: Invalid Value %s\n",val); + } + } else if (!strcasecmp(var, "bridge_local_ip")) { + if (ip_bridge) { + strncpy(ip_bridge->mcon.cfg.local_ip, val, + sizeof(ip_bridge->mcon.cfg.local_ip) -1); + log_printf(SMG_LOG_ALL, server.log, "Bridge Local IP: %s\n",ip_bridge->mcon.cfg.local_ip); + } + } else if (!strcasecmp(var, "bridge_remote_ip")) { + if (ip_bridge) { + strncpy(ip_bridge->mcon.cfg.remote_ip, val, + sizeof(ip_bridge->mcon.cfg.remote_ip) -1); + log_printf(SMG_LOG_ALL, server.log, "Bridge Remote IP: %s\n",ip_bridge->mcon.cfg.remote_ip); + } + } else if (!strcasecmp(var, "bridge_port")) { + int max = atoi(val); + if (max > 0 && ip_bridge) { + ip_bridge->mcon.cfg.local_port=max; + ip_bridge->mcon.cfg.remote_port=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Port: %i\n",max); + } + } else if (!strcasecmp(var, "bridge_period")) { + int max = atoi(val); + if (max > 0 && ip_bridge) { + ip_bridge->period=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Period: %ims\n",ip_bridge->period); + } } else { log_printf(SMG_LOG_ALL, server.log, "Invalid Option %s at line %d!\n", var, cfg.lineno); } @@ -5797,10 +5924,11 @@ static int woomera_startup(int argc, char **argv) usleep(5000); woomera_set_flag(&server.master_connection, WFLAG_RUNNING); + if (launch_monitor_thread()) { woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); - smg_log_cleanup(); - return 0; + smg_log_cleanup(); + return 0; } fprintf(stderr, "%s", WELCOME_TEXT); @@ -5882,7 +6010,8 @@ int main(int argc, char *argv[]) mlockall(MCL_FUTURE); memset(&server, 0, sizeof(server)); memset(&woomera_dead_dev, 0, sizeof(woomera_dead_dev)); - + memset(&g_smg_ip_bridge_idx,0, sizeof(g_smg_ip_bridge_idx)); + ret=nice(-5); sdla_memdbg_init(); @@ -5892,12 +6021,17 @@ int main(int argc, char *argv[]) openlog (ps_progname ,LOG_PID, LOG_LOCAL2); if (! (ret = woomera_startup(argc, argv))) { - exit(0); + exit(0); } - ret = main_thread(); + + ret = smg_ip_bridge_start(); + if (ret == 0) { + ret = main_thread(); + } woomera_shutdown(); + smg_ip_bridge_stop(); sdla_memdbg_free(1); return ret; diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.conf.sample.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.conf.sample.svn-base index 625cf63..a780e8f 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.conf.sample.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.conf.sample.svn-base @@ -32,8 +32,8 @@ woomera_port => 42420 # If changing from default values # ensure that woomera client # UDP ports do not conflict. -base_media_port => 9000 -max_media_ports => 899 +base_media_port => 10000 +max_media_ports => 5000 #Used to play Sangoma Rocks on all @@ -94,3 +94,31 @@ woomera_udp_seq => 0 call_timeout=100 +#Enable tdm bridge profile 1 +#Note profile number must not be zero. +#Configure all parameters for the bridge. +#The opposite sangoma_mgd must be configured +#with same parameters except IP address +#need to be swaped. +#bridge_tdm_ip => 1 +#bridge_span => 1 +#bridge_chan => 1 +#bridge_local_ip => 192.168.1.251 +#bridge_remote_ip => 192.168.1.252 +#bridge_port => 60000 +#bridge_period => 10 #milliseconds + + +#Enable tdm bridge profile 2 +#Note profile number must not be zero. +#Configure all parameters for the bridge. +#The opposite sangoma_mgd must be configured +#with same parameters except IP address +#need to be swaped. +#bridge_tdm_ip => 2 +#bridge_span => 1 +#bridge_chan => 2 +#bridge_local_ip => 192.168.1.251 +#bridge_remote_ip => 192.168.1.252 +#bridge_port => 60001 +#bridge_period => 10 #milliseconds diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.h.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.h.svn-base index 345ad86..b5de3d5 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.h.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd.h.svn-base @@ -62,13 +62,13 @@ #define PIDFILE "/var/run/sangoma_mgd.pid" #define PIDFILE_UNIT "/var/run/sangoma_mgd_unit.pid" -#define WOOMERA_MAX_MEDIA_PORTS 899 +#define WOOMERA_MAX_MEDIA_PORTS 5000 #define CORE_EVENT_LEN 512 #define WOOMERA_STRLEN 256 #define WOOMERA_ARRAY_LEN 50 #define WOOMERA_BODYLEN 2048 -#define WOOMERA_MIN_MEDIA_PORT 9000 +#define WOOMERA_MIN_MEDIA_PORT 10000 #define WOOMERA_MAX_MEDIA_PORT (WOOMERA_MIN_MEDIA_PORT + WOOMERA_MAX_MEDIA_PORTS) #define WOOMERA_HARD_TIMEOUT 0 #define WOOMERA_LINE_SEPERATOR "\r\n" @@ -297,6 +297,26 @@ struct woomera_session { pthread_mutex_t media_lock; }; +struct smg_tdm_ip_bridge { + int init; + int end; + int span; + int chan; +#if 0 + int port; + char local_ip[25]; + char remote_ip[25]; +#endif + int period; + int tdm_fd; + call_signal_connection_t mcon; + pthread_t thread; +}; + +extern struct smg_tdm_ip_bridge g_smg_ip_bridge_idx[]; +extern pthread_mutex_t g_smg_ip_bridge_lock; + +#define MAX_SMG_BRIDGE 32 #define CORE_TANK_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS struct woomera_server { @@ -342,11 +362,12 @@ struct woomera_server { struct timeval all_ckt_busy_time; struct timeval restart_timeout; int dtmf_on; - int dtmf_off; - int dtmf_intr_ch; - int dtmf_size; + int dtmf_off; + int dtmf_intr_ch; + int dtmf_size; int strip_cid_non_digits; int call_timeout; + struct smg_tdm_ip_bridge ip_bridge_idx[MAX_SMG_BRIDGE]; }; extern struct woomera_server server; @@ -359,6 +380,28 @@ struct woomera_config { int lineno; }; +static inline int smg_get_ip_bridge_session(struct smg_tdm_ip_bridge **ip_bridge) +{ + int i; + for (i=0;i 0) { log_printf(SMG_LOG_ALL, server.log, - "Critical Error: channel already opened [w%ig%i]\n", span, chan); + "Critical Error: channel already opened [s%ic%i]\n", span, chan); } else { server.process_table[span][chan].media_used++; @@ -736,5 +779,8 @@ static inline void close_span_chan (int *socket, unsigned char span, unsigned ch extern int smg_log_init(void); extern void smg_log_cleanup(void); +extern int smg_ip_bridge_start(void); +extern int smg_ip_bridge_stop(void); +extern int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout); #endif diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd_ip_bridge.c.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd_ip_bridge.c.svn-base new file mode 100644 index 0000000..1a98a77 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/sangoma_mgd_ip_bridge.c.svn-base @@ -0,0 +1,376 @@ + +#include "sangoma_mgd.h" +static int bridge_threads=0; + +#define TEST_SEQ 0 + +static void *bridge_thread_run(void *obj) +{ + struct smg_tdm_ip_bridge *bridge= (struct smg_tdm_ip_bridge*)obj; + call_signal_connection_t *mcon = &bridge->mcon; + wanpipe_tdm_api_t tdm_api; + int ss = 0; + char a=0,b=0; + int bytes=0,err; + unsigned char data[1024]; + unsigned int fromlen = sizeof(struct sockaddr_in); + sangoma_api_hdr_t hdrframe; + unsigned int udp_rx=0,udp_tx=0,tdm_rx=0,tdm_tx=0; + unsigned int udp_rx_err=0, udp_tx_err=0; + unsigned int tdm_rx_err=0, tdm_tx_err=0; + int bridge_ip_sync=0; + int err_flag=0; + unsigned char prev_status=0; +#if TEST_SEQ + unsigned char tx_seq_cnt=0; + unsigned char rx_seq_cnt=0; + int i; + int insync=0; +#endif + + memset(&hdrframe,0,sizeof(hdrframe)); + memset(data,0,sizeof(data)); + memset(&tdm_api,0,sizeof(tdm_api)); + + if (bridge->period) { + err=sangoma_tdm_set_usr_period(bridge->tdm_fd, &tdm_api,bridge->period); + if (err) { + log_printf(SMG_LOG_ALL,server.log,"%s: Failed to execute set period %i\n",__FUNCTION__,bridge->period); + } + } + + sangoma_tdm_disable_hwec(bridge->tdm_fd, &tdm_api); + + err=sangoma_tdm_flush_bufs(bridge->tdm_fd, &tdm_api); + if (err) { + log_printf(SMG_LOG_ALL,server.log,"%s: Failed to execute tdm flush\n",__FUNCTION__); + } + + while (!bridge->end && + woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + + err_flag=0; + + ss = waitfor_2sockets(mcon->socket, + bridge->tdm_fd, + &a, &b, 1000); + + if (ss > 0) { + + if (a) { + + bytes = recvfrom(mcon->socket, &data[0], sizeof(data), MSG_DONTWAIT, + (struct sockaddr *) &mcon->local_addr, &fromlen); + +#if TEST_SEQ + for (i=0;i 0) { + + if (bridge_ip_sync == 0) { + bridge_ip_sync=1; + log_printf(SMG_LOG_ALL,server.log,"Bridge IP Sync: span=%i chan=%i port=%d len=%i\n",bridge->span,bridge->chan,bridge->mcon.cfg.local_port,bytes); + } + udp_rx++; + + err=sangoma_sendmsg_socket(bridge->tdm_fd, + &hdrframe, + sizeof(hdrframe), + data, + bytes, 0); + if (err != bytes) { + + unsigned char current_status; + unsigned char verbose=1; + + sangoma_tdm_get_link_status(bridge->tdm_fd, &tdm_api, ¤t_status); + if (current_status != WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED) { + if (prev_status == current_status) { + verbose=0; + } + } + + prev_status = current_status; + + if (verbose) { + log_printf(SMG_LOG_ALL,server.log,"%s: Error: Bridge tdm write failed (span=%i,chan=%i)! len=%i status=%s - %s\n", + __FUNCTION__,bridge->span,bridge->chan,bytes, current_status==WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED?"Connected":"Disconnected", + strerror(errno)); + sangoma_tdm_flush_bufs(bridge->tdm_fd, &tdm_api); + err_flag++; + } + + tdm_tx_err++; + + } else { + tdm_tx++; + } + } else { + log_printf(SMG_LOG_ALL,server.log,"%s: Error: Bridge sctp read failed (span=%i,chan=%i)! len=%i - %s\n", + __FUNCTION__,bridge->span,bridge->chan,bytes,strerror(errno)); + udp_rx_err++; + err_flag++; + } + } + + if (b) { + bytes = sangoma_readmsg_socket(bridge->tdm_fd, + &hdrframe, + sizeof(hdrframe), + data, + sizeof(data), 0); + + if (bytes > 0) { + tdm_rx++; + err=sendto(mcon->socket, + data, + bytes, 0, + (struct sockaddr *) &mcon->remote_addr, + sizeof(mcon->remote_addr)); + if (err != bytes) { + log_printf(SMG_LOG_ALL,server.log,"%s: Error: Bridge sctp write failed (span=%i,chan=%i)! len=%i - %s\n",__FUNCTION__,bridge->span,bridge->chan,bytes,strerror(errno)); + udp_tx_err++; + err_flag++; + } else { + udp_tx++; + } + } else { + log_printf(SMG_LOG_ALL,server.log,"%s: Error: Bridge tdm read failed (span=%i,chan=%i)! len=%i - %s\n", + __FUNCTION__,bridge->span,bridge->chan,bytes,strerror(errno)); + tdm_rx_err++; + err_flag++; + } + } + + } else if (ss < 0) { + if (!bridge->end) { + log_printf(SMG_LOG_ALL,server.log,"%s: Poll failed on fd exiting bridge (span=%i,chan=%i)\n", + __FUNCTION__,bridge->span,bridge->chan); + } + break; + + } else if (ss == 0) { + + if (bridge_ip_sync) { + log_printf(SMG_LOG_ALL,server.log,"Bridge IP Timeout: span=%i chan=%i port=%d \n", + bridge->span,bridge->chan,bridge->mcon.cfg.local_port); + err_flag++; + } + bridge_ip_sync=0; + } + + + +#if TEST_SEQ + if (udp_rx % 1000 == 0) { + err_flag++; + } +#endif + + if (err_flag) { + log_printf(SMG_LOG_ALL,server.log,"Bridge (s%02ic%02i) urx/ttx=(%i/%i) ue/te=(%i/%i) | trx/utx=(%i/%i) te/ue=(%i/%i) \n", + bridge->span,bridge->chan, + udp_rx,tdm_tx,udp_rx_err,tdm_tx_err, + tdm_rx,udp_tx,tdm_rx_err,udp_tx_err); + } + + } + + pthread_mutex_lock(&g_smg_ip_bridge_lock); + bridge_threads--; + pthread_mutex_unlock(&g_smg_ip_bridge_lock); + + return NULL; +} + + + +static int launch_bridge_thread(int idx) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 9; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + log_printf(SMG_LOG_ALL,server.log,"%s: Bridge Priority=%i res=%i \n",__FUNCTION__, + param.sched_priority,result); + + bridge_threads++; + + result = pthread_create(&g_smg_ip_bridge_idx[idx].thread, &attr, bridge_thread_run, &g_smg_ip_bridge_idx[idx]); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + g_smg_ip_bridge_idx[idx].end=1; + bridge_threads--; + } + pthread_attr_destroy(&attr); + + return result; +} + +static int create_udp_socket(call_signal_connection_t *ms, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + log_printf(SMG_LOG_DEBUG_9,server.log,"LocalIP %s:%d IP %s:%d \n",local_ip, local_port, ip, port); + + memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); + memset(&ms->local_hp, 0, sizeof(ms->local_hp)); + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + ms->remote_addr.sin_family = ms->remote_hp.h_addrtype; + memcpy((char *) &ms->remote_addr.sin_addr.s_addr, ms->remote_hp.h_addr_list[0], ms->remote_hp.h_length); + ms->remote_addr.sin_port = htons(port); + + ms->local_addr.sin_family = ms->local_hp.h_addrtype; + memcpy((char *) &ms->local_addr.sin_addr.s_addr, ms->local_hp.h_addr_list[0], ms->local_hp.h_length); + ms->local_addr.sin_port = htons(local_port); + + rc = bind(ms->socket, (struct sockaddr *) &ms->local_addr, sizeof(ms->local_addr)); + if (rc < 0) { + close(ms->socket); + ms->socket = -1; + + log_printf(SMG_LOG_DEBUG_9,server.log, + "Failed to bind LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + + /* OK */ + + } else { + log_printf(SMG_LOG_ALL,server.log, + "Failed to get hostbyname LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + } else { + log_printf(SMG_LOG_ALL,server.log, + "Failed to create/allocate UDP socket\n"); + } + + return ms->socket; +} + + + +int smg_ip_bridge_start(void) +{ + int i; + int err; + struct smg_tdm_ip_bridge *bridge; + call_signal_connection_t *mcon; + + pthread_mutex_init(&g_smg_ip_bridge_lock,NULL); + + for (i=0;imcon; + + log_printf(SMG_LOG_ALL, server.log, "Opening Bridge MCON Socket [%d] local %s/%d remote %s/%d \n", + mcon->socket,mcon->cfg.local_ip,mcon->cfg.local_port,mcon->cfg.remote_ip,mcon->cfg.remote_port); + +#if 0 + if (call_signal_connection_open(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(SMG_LOG_ALL, server.log, "Error: Opening Bridge MCON Socket [%d] local %s/%d remote %s/%d %s\n", + mcon->socket,mcon->cfg.local_ip,mcon->cfg.local_port,mcon->cfg.remote_ip,mcon->cfg.remote_port,strerror(errno)); + bridge->end=1; + return -1; + } +#else + if (create_udp_socket(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(SMG_LOG_ALL, server.log, "Error: Opening Bridge MCON Socket [%d] local %s/%d remote %s/%d %s\n", + mcon->socket,mcon->cfg.local_ip,mcon->cfg.local_port,mcon->cfg.remote_ip,mcon->cfg.remote_port,strerror(errno)); + bridge->end=1; + return -1; + } + +#endif + + bridge->tdm_fd=open_span_chan(bridge->span, bridge->chan); + if (bridge->tdm_fd < 0) { + log_printf(SMG_LOG_ALL, server.log, "Error: Failed to open span=%i chan=%i - %s\n", + bridge->span,bridge->chan,strerror(errno)); + return -1; + } + + err=launch_bridge_thread(i); + if (err) { + bridge->end=1; + return -1; + } + } + + return 0; +} + + +int smg_ip_bridge_stop(void) +{ + int i; + int timeout=10; + + for (i=0;i/dev/null 2>/dev/null" if [ $? -ne 0 ]; then - echo "$sigd is stopped" + logit "$sigd is stopped" return; else - echo "waiting for $sigd to finish($i/$max_retry)...." + logit "waiting for $sigd to finish($i/$max_retry)...." sleep 1 fi done @@ -96,6 +107,7 @@ function stop_sigdaemon() echo "OK" else echo "FAILED" + logit "Failed to KILL $sigd" break; fi fi @@ -103,10 +115,10 @@ function stop_sigdaemon() do eval "pidof $sigd >/dev/null 2>/dev/null" if [ $? -ne 0 ]; then - echo "$sigd is stopped" + logit "$sigd is stopped" break; else - echo "waiting for $sigd to finish($i/$max_retry)...." + logit "waiting for $sigd to finish($i/$max_retry)...." sleep 1 fi done @@ -127,7 +139,7 @@ function stop_sangoma_mgd() return 0; fi else - echo "sangoma_mgd not running..." + logit "sangoma_mgd not running..." return; fi @@ -135,10 +147,10 @@ function stop_sangoma_mgd() do eval "pidof sangoma_mgd >/dev/null 2>/dev/null" if [ $? -ne 0 ]; then - echo "sangoma_mgd is stopped" + logit "sangoma_mgd is stopped" return 0 else - echo "waiting for sangoma_mgd to finish($i/$max_retry)...." + logit "waiting for sangoma_mgd to finish($i/$max_retry)...." sleep 1 fi done @@ -167,7 +179,7 @@ function stop_safe_sangoma() if [ $? -eq 0 ]; then echo -n "Sending TERM signal to safe_sangoma..." else - echo "safe_sangoma not running..." + logit "safe_sangoma not running..." return; fi sleep 1 @@ -181,7 +193,7 @@ function stop_safe_sangoma() echo "OK" else echo "FAILED" - echo "Failed to stop safe_sangoma" + logit "Failed to stop safe_sangoma" return 1 fi else @@ -196,14 +208,14 @@ function remove_pid_files() eval "rm -f /var/run/$sigd.pid > /dev/null" if [ $? -ne 0 ]; then echo " " - echo "Failed to remove /var/run/$sigd.pid, try to remove it manually" + logit "Failed to remove /var/run/$sigd.pid, try to remove it manually" fi fi if [ -e /var/run/sangoma_mgd.pid ]; then eval "rm -f /var/run/sangoma_mgd.pid > /dev/null" if [ $? -ne 0 ]; then echo " " - echo "Failed to remove /var/run/sangoma_mgd.pid, try to remove it manually" + logit "Failed to remove /var/run/sangoma_mgd.pid, try to remove it manually" fi fi echo "done" @@ -212,7 +224,7 @@ function remove_pid_files() function start_test() { echo " " - echo "Testing configuration files..." + logit "Testing configuration files..." if [ $use_syslog -eq 1 ]; then eval "$sigd -t" else @@ -220,13 +232,37 @@ function start_test() fi if [ $? -eq 0 ]; then - echo "OK" + logit "OK" else - echo "Failed" + logit "Failed" fi } +function start_scripts() +{ + if [ -d /etc/wanpipe/smg_ctrl.d ]; then + for script in /etc/wanpipe/smg_ctrl.d/*.start; do + if [ -x $script ]; then + logit "Executing startup script: $script" + source $script + fi + done + fi +} + +function stop_scripts() +{ + if [ -d /etc/wanpipe/smg_ctrl.d ]; then + for script in /etc/wanpipe/smg_ctrl.d/*.stop; do + if [ -x $script ]; then + logit "Executing stop script: $script" + source $script + fi + done + fi +} + function start_all() { #post_args=$post_args" >/dev/null 2>/dev/null &" @@ -241,6 +277,9 @@ function start_all() ret=$? fi fi + + start_scripts + return $ret } @@ -250,14 +289,17 @@ function start_sigd() pre_args=""; post_args=""; echo " " - echo "Starting processes..." + if [ $use_safe -eq 1 ]; then + logit "Starting smg_ctrl in safe mode ..." + fi + logit "Starting processes..." echo -n "Loading SCTP..." eval "modprobe sctp >>$LOG 2>>$LOG" if [ $? -eq 0 ]; then echo "OK" else - echo "Failed" - echo "Failed to load SCTP module, check $LOG" + logit "Failed" + logit "Failed to load SCTP module, check $LOG" return 1; fi sleep 1 @@ -266,8 +308,8 @@ function start_sigd() if [ $? -ne 0 ]; then eval "ls /dev/wanpipe* >/dev/null 2>/dev/null" if [ $? -ne 0 ]; then - echo "No Sangoma TDM API interfaces running" - echo "Did you start wanrouter? " + logit "No Sangoma TDM API interfaces running" + logit "Did you start wanrouter? " return 1; fi fi @@ -288,24 +330,24 @@ function start_sigd() if [ $? -eq 0 ]; then echo "OK" else - echo "Failed" - echo "Failed to start $sigd, check $SIG_LOG for errors" + logit "Failed" + logit "Failed to start $sigd, check $SIG_LOG for errors" return 1; fi sleep 2 if [ ! $(pidof $sigd) ]; then - echo "$sigd failed to start" - echo "check $SIG_LOG for errors" + logit "$sigd failed to start" + logit "check $SIG_LOG for errors" return 1; fi sleep 3 if [ "$xtraargs" = "sigdonly" ]; then - echo "Sangoma $sigd running.." + logit "Sangoma $sigd running.." if [ $use_syslog -eq 1 ]; then - echo "log file: $LOG and /var/log/messages" + logit "log file: $LOG and /var/log/messages" else - echo "log file: $LOG and /var/log/messages" + logit "log file: $LOG and /var/log/messages" fi echo " " fi @@ -314,7 +356,6 @@ function start_sigd() } function start_smg() { - #check_sigd_running check_smg_running pre_args=""; post_args=""; @@ -327,7 +368,7 @@ function start_smg() fi if [ -e /etc/wanpipe/.no_smg_load ]; then - echo "Skipping sangoma_mgd..." + logit "Skipping sangoma_mgd..." return 0; fi @@ -336,23 +377,23 @@ function start_smg() if [ $? -eq 0 ]; then echo "OK" else - echo "Failed" - echo "Failed to start sangoma_mgd, check $LOG for errors" + logit "Failed" + logit "Failed to start sangoma_mgd, check $LOG for errors" return 1; fi sleep 2 if [ ! $(pidof sangoma_mgd) ]; then - echo "sangoma_mgd failed to start" - echo "check $LOG for errors" + logit "sangoma_mgd failed to start" + logit "check $LOG for errors" return 1; fi echo "Sangoma SMG running.." if [ $use_syslog -eq 1 ]; then - echo "log file: $LOG and /var/log/messages" + logit "log file: $LOG and /var/log/messages" else - echo "log file: $LOG and /var/log/messages" + logit "log file: $LOG and /var/log/messages" fi echo " " @@ -367,10 +408,13 @@ function check_sigd_running() eval "pidof $sigd 2> /dev/null > /dev/null" rc=$? if [ $rc -eq 0 ]; then - echo "$sigd is currently running" - echo "exiting..." + logit "$sigd is currently running" + logit "exiting..." exit 0 fi + if [ -e /var/run/$sigd.pid ];then + eval "rm -f /var/run/$sigd.pid >/dev/null 2>/dev/null"; + fi return 0 } @@ -381,13 +425,10 @@ function check_smg_running() eval "pidof sangoma_mgd 2> /dev/null > /dev/null" rc=$? if [ $rc -eq 0 ]; then - echo "sangoma_mgd is currently running" - echo "exiting..." + logit "sangoma_mgd is currently running" + logit "exiting..." exit 0 fi - if [ -e /var/run/$sigd.pid ];then - eval "rm -f /var/run/$sigd.pid >/dev/null 2>/dev/null"; - fi if [ -e /var/run/sangoma_mgd.pid ];then eval "rm -f /var/run/sangoma_mgd.pid >/dev/null 2>/dev/null"; fi @@ -397,7 +438,7 @@ function check_smg_running() function check_pid_sigd() { if [ ! $(pidof $sigd) ]; then - echo "$sigd is not running" + logit "$sigd is not running" exit 1 fi return 0 @@ -410,9 +451,9 @@ function toggle_capture() eval "kill -SIGRTMIN+2 $(pidof $sigd)" rc=$? if [ $rc -eq 0 ]; then - echo "BRI: Protocol capture toggled" + logit "BRI: Protocol capture toggled" else - echo "BRI: Failed to send command" + logit "BRI: Failed to send command" fi return $rc @@ -423,13 +464,13 @@ function increase_verbose() local rc check_pid_sigd SIG_VAL=`kill -l SIGRTMIN` - echo "signal: $SIG_VAL" + logit "signal: $SIG_VAL" eval "kill -SIGRTMIN $(pidof $sigd)" rc=$? if [ $rc -eq 0 ]; then - echo "BRI: Verbosity increased" + logit "BRI: Verbosity increased" else - echo "BRI: Failed to send command" + logit "BRI: Failed to send command" fi return $rc @@ -442,9 +483,9 @@ function decrease_verbose() eval "kill -SIGRTMIN+1 $(pidof $sigd)" rc=$? if [ $rc -eq 0 ]; then - echo "BRI: Verbosity decreased" + logit "BRI: Verbosity decreased" else - echo "BRI: Failed to send command" + logit "BRI: Failed to send command" fi return $rc @@ -457,9 +498,9 @@ function show_calls() eval "kill -SIGRTMIN+3 $(pidof $sigd) " rc=$? if [ $rc -eq 0 ]; then - echo "BRI: Show calls" + logit "BRI: Show calls" else - echo "BRI: Failed to send command" + logit "BRI: Failed to send command" fi return $rc @@ -472,9 +513,9 @@ function show_spans() eval "kill -SIGRTMIN+4 $(pidof $sigd)" rc=$? if [ $rc -eq 0 ]; then - echo "BRI: Show spans" + logit "BRI: Show spans" else - echo "BRI: Failed to send command" + logit "BRI: Failed to send command" fi return $rc @@ -507,7 +548,7 @@ read_smg_conf () if [ -f $META_SMG_CONF ] then . $META_SMG_CONF else - echo " $META_SMG_CONF not found !!!!" + logit " $META_SMG_CONF not found !!!!" return 1 fi return 0 @@ -520,6 +561,8 @@ SANGOMA_PRID= SANGOMA_BRID= SANGOMA_SS7ISUP= SANGOMA_MEDIA_GATEWAY= +SANGOMA_SS7BOOST= +SANGOMA_SAFE_MODE= } ###################### #main start here @@ -529,22 +572,21 @@ parse_args init_smg_conf read_smg_conf #Set sigd -if [ $SANGOMA_PRID = "YES" ]; then +if [ "$SANGOMA_PRID" = "YES" ]; then sigd="sangoma_prid" -elif [ $SANGOMA_BRID = "YES" ]; then +elif [ "$SANGOMA_BRID" = "YES" ]; then sigd="sangoma_brid" -elif [ $SANGOMA_PRID = "YES" ]; then - sigd="sangoma_prid" -elif [ $SANGOMA_SS7ISUP = "YES" ]; then +elif [ "$SANGOMA_SS7ISUP" = "YES" ]; then sigd="sangoma_isupd" -elif [ $SANGOMA_SS7BOOST = "YES" ]; then +elif [ "$SANGOMA_SS7BOOST" = "YES" ]; then sigd="ss7boost" else - echo "Failed to specify sigd!!! check $META_SMG_CONF " + logit "Failed to specify sigd!!! check $META_SMG_CONF " exit 1 fi + if [ $SANGOMA_MEDIA_GATEWAY = "NO" ]; then xtraargs="sigdonly" fi @@ -560,7 +602,7 @@ if [ $sigd = "ss7boost" ] || [ $sigd = "sangoma_isupd" ]; then eval "type $sigd 2> /dev/null > /dev/null" if [ $? -ne 0 ]; then echo - echo "Error $sigd is not found" + logit "Error $sigd is not found" echo exit 1 fi @@ -587,6 +629,10 @@ done ret=0 +if [ "$cmd" = "start" ] && [ "$SANGOMA_SAFE_MODE" = "YES" ]; then + cmd="safe_start" +fi + if [ "$cmd" = "start" ]; then start_all ret=$? @@ -606,14 +652,17 @@ elif [ "$cmd" = "stop" ]; then ret=$? elif [ "$cmd" = "restart" ]; then stop_all + if [ "$SANGOMA_SAFE_MODE" = "YES" ]; then + use_safe=1 + fi start_all + ret=$? if [ $ret -ne 0 ]; then stop_all fi - ret=$? else if [ $SS7 -eq 1 ]; then - echo "Error: Unsupported command $cmd for SS7" + logit "Error: Unsupported command $cmd for SS7" echo usage exit 1 diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp new file mode 100644 index 0000000..d3d47f0 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp @@ -0,0 +1,5953 @@ +/********************************************************************************* + * sangoma_mgd.c -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-09, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * ============================================= + * + * v1.56 David Yat Sin + * Changed BRI to run with HWEC in non-persist mode + * + * v1.55 Nenad Corbic + * Updated the base media port to 10000 and max media ports to 5000 + * + * v1.54 Nenad Corbic + * Bug added in 1.51 release causing call on channel 31 to fail. + * + * v1.53 Nenad Corbic + * Added progress message + * + * v1.52 David Yat Sin + * Changed sangoma_open_span_chan to __sangoma_span_chan + * to enabled shared used of file descriptors when using + * with PRI in NFAS mode + * + * v1.51 David Yat Sin + * MAX_SPANS increased to 32. + * Fix for server.process_table declared incorrectly + * + * v1.50 Nenad Corbic + * Logic to support multiple woomera clients hanging up the + * channel. This feature now supprorts woomera loadbalancing + * with extension check on the client end. Example, two Asterisk + * systems setup where Asterisk with correct extension gets the + * call. + * Changed log levels: Loglevel 1 = production + * Loglevel 2 = Boost TX/RX EVENTS + * Loglevel 3 = Woomera RX Messages + * Loglevel 4 = call setup debugging + * Loglevel 5 = extra debugging + * Loglevel 10 = full debugging + * + * v1.49 Nenad Corbic + * Removed tv from sigboost to make it binary compatible + * Updated release cause on double use return code. + * + * v1.48 Nenad Corbic + * Konrad Hammel + * Jun 30 2009 + * Added feature to disable/enable HWEC on channels that are + * passing a call with a "data" only transfer capability + * + * v1.47 Nenad Corbic + * Apr 30 2009 + * Updated hangup woomera events. Each event must + * be followed by a woomera error code 200=ok >299=no ok. + * This update fixes the chan_woomera socket write + * warnings. + * + * v1.46 Nenad Corbic + * Mar 27 2009 + * Major updates on socket handling. A bug was introducted + * when cmm and trunk was merged. + * Added configuration print in the logs. + * + * v1.45 Nenad Corbic + * Mar 19 2009 + * Outbound call timeout defaulted to 300 seconds. + * Timeout on answer instead of accept. + * + * v1.44 Nenad Corbic + * Mar 19 2009 + * Adjustable boost size. Added boost version check. + * + * v1.43 David Yat Sin + * Feb 25 2009 + * Merged CMM and Trunk + * + * v1.42 Nenad Corbic + * Jan 26 2008 + * Call Bearer Capability + * BugFix: Hangup NACK was sent out with invalid cause 0 + * + * v1.41 Nenad Corbic + * Jan 12 2008 + * Fixed the NACK with cause 0 bug. + * Added cause 19 on call timeout. + * Added configuration option call_timeout to timeout + * outbound calls. + * + * v1.40 Nenad Corbic + * Dec 10 2008 + * Check for Rx call overrun. + * In unlikely case sangoma_mgd goes out of + * sync with boost. + * + * v1.39 Nenad Corbic + * Sep 17 2008 + * Updated for Unit Test + * Bug fix in Loop Logic, possible race + * between media and woomera thread on loop end. + * + * v1.38 Nenad Corbic + * Sep 5 2008 + * Added a Double use of setup id logic. + * Currently double use call gets dropped. + * + * v1.37 Nenad Corbic + * Sep 2 2008 + * Bug fix in REMOVE LOOP logic continued + * The woomera->sock in loop logic was set to 0. + * Closing it failed the next call. + * + * v1.36 Nenad Corbic + * Aug 28 2008 + * Bug fix in REMOVE LOOP logic + * Remove F from incoming calls by default + * Check for errno on poll() + * Do not delay in closing socket on media down. + * + * v1.35cmm Nenad Corbic + * Jul 28 2008 + * Bug fixes on ACK Timeout and trunk release + * Added a thread logger + * Increased max spans to 32 + * + * v1.34cmm Nenad Corbic + * Jul 24 2008 + * Clean up the setup id on CALL STOP ACK + * + * v1.33cmm Nenad Corbic + * Jul 24 2008 + * The CALL STOP timeout function had a bug + * resulting in false blocking of tank ids + * due to STOP ACK Timeouts. + * + * v1.33 Nenad Corbic + * Jul 18 2008 + * Added UDP Sequencing to check for dropped frames + * Should only be used for debugging. + * + * v1.32 David Yat Sin + * Jul 17 2008 + * Support for d-channel incoming digit + * passthrough to Asterisk + * + * v1.32cmm Nenad Corbic + * Jun 03 2008 + * Implemented new Restart ACK Policy + * Split the Event packet into 2 types + * + * v1.31cmm Nenad Corbic + * Apr 04 2008 + * New CMM Restart procedure for boost + * Block TRUNK ID on ACK Timeout + * + * v1.31 David Yat Sin + * Apr 29 2008 + * Support for HW DTMF events. + * + * v1.30 Nenad Corbic + * Feb 08 2008 + * The fix in v1.26 causes double stop. + * I took out the v1.26 fix and added + * a big warning if that condition is + * ever reached. + * + * v1.29 Nenad Corbic + * Feb 07 2008 + * Added strip_cid_non_digits option + * + * v1.28 Nenad Corbic + * Feb 06 2008 + * Fixed a memory leak in clone event + * function. Added memory check subsystem + * + * v1.27 Nenad Corbic + * Jan 24 2008 + * Fixed a memory leak on incoming calls + * Removed the use of server listener which + * was not used + * + * v1.26 Nenad Corbic + * Jan 18 2008 + * Fixed hangup after invalid Answer or Ack Session + * Can cause double use of setup id - now fixed + * Update on autoacm on accept check for acked. + * + * v1.25 Nenad Corbic + * Dec 31 2007 + * Removed UDP Resync it can cause skb_over errors. + * Moved RDNIS message to higher debug level + * + * v1.24 Nenad Corbic + * Nov 30 2007 + * Bug fix on return code on ALL ckt busy + * + * v1.23 Nenad Corbic + * Bug fix on socket open. Check for retun code >= 0 + * + * v1.22 Nenad Corbic + * Nov 27 2007 + * Updated DTMF Tx function + * Fixed - dtmf tx without voice + * Fxied - dtmf clipping. + * + * v1.21 Nenad Corbic + * Nov 25 2007 + * Major unit testing of each state + * Numerous bug fixes for non autoacm mode. + * Changed "Channel-Name" to tg/cic + * Added compile option WANPIPE_CHAN_NAME to change Asterisk channel + * name of chan_woomera.so. So one can use Dial(SS7/g1/${EXTE}) + * instead of WOOMERA (for example) + * + * v1.20 Nenad Corbic + * Added option for Auto ACM response mode. + * + * v1.19 Nenad Corbic + * Configurable DTMF + * Bug fix in release codes (all ckt busy) + * + * v1.18 Nenad Corbic + * Added new rel cause support based on + * digits instead of strings. + * + * v1.17 Nenad Corbic + * Added session support + * + * v1.16 Nenad Corbic + * Added hwec disable on loop ccr + * + * v1.15 Nenad Corbic + * Updated DTMF Locking + * Added delay between digits + * + * v1.14 Nenad Corbic + * Updated DTMF Library + * Fixed DTMF synchronization + * + * v1.13 Nenad Corbic + * Woomera OPAL Dialect + * Added Congestion control + * Added SCTP + * Added priority ISUP queue + * Fixed presentation + * + * v1.12 Nenad Corbic + * Fixed CCR + * Removed socket shutdown on end call. + * Let Media thread shutodwn sockets. + * + * v1.11 Nenad Corbic + * Fixed Remote asterisk/woomera connection + * Increased socket timeouts + * + * v1.10 Nenad Corbic + * Added Woomera OPAL dialect. + * Start montor thread in priority + * + * v1.9 Nenad Corbic + * Added Loop mode for ccr + * Added remote debug enable + * Fixed syslog logging. + * + * v1.8 Nenad Corbic + * Added a ccr loop mode for each channel. + * Boost can set any channel in loop mode + * + * v1.7 Nenad Corbic + * Pass trunk group number to incoming call + * chan woomera will use it to append to context + * name. Added presentation feature. + * + * v1.6 Nenad Corbic + * Use only ALAW and MLAW not SLIN. + * This reduces the load quite a bit. + * Send out ALAW/ULAW format on HELLO message. + * RxTx Gain is done now in chan_woomera. + * + * v1.5 Nenad Corbic + * Bug fix in START_NACK_ACK handling. + * When we receive START_NACK we must alwasy pull tank before + * we send out NACK_ACK this way we will not try to send NACK + * ourself. + *********************************************************************************/ + +#include "sangoma_mgd.h" +#include "sangoma_mgd_memdbg.h" +#include "q931_cause.h" +#include "smg_capabilities.h" + +int pipe_fd[2]; + +#ifdef CODEC_LAW_DEFAULT +static uint32_t codec_sample=8; +#else +static uint32_t codec_sample=16; +#endif + +static char ps_progname[]="sangoma_mgd"; + +static struct woomera_interface woomera_dead_dev; + + +/* For 3.4. release always set to 1 */ +#ifdef BRI_PROT +static unsigned char tdmv_hwec_persist = 1; +#else +static unsigned char tdmv_hwec_persist = 1; +#endif +struct woomera_server server; + +#if 0 +#define DOTRACE +#endif + + +#define SMG_VERSION "v1.56" + +/* enable early media */ +#if 1 +#define WOOMERA_EARLY_MEDIA 1 +#endif + + +#define SMG_DTMF_ON 60 +#define SMG_DTMF_OFF 10 +#define SMG_DTMF_RATE 8000 +#define SMG_DEFAULT_CALL_TIMEOUT 300 + +#if 0 +#define MEDIA_SOCK_SHUTDOWN 1 +#endif + +#ifdef DOTRACE +static int tc = 0; +#endif + +#if 0 +#warning "NENAD: HPTDM API" +#define WP_HPTDM_API 1 +#else +#undef WP_HPTDM_API +#endif + +#ifdef WP_HPTDM_API +hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; +#endif + +#if 0 +#define SMG_DROP_SEQ 1 +#warning "SMG Debug feature Drop Seq Enabled" +static int drop_seq=0; +#else +#undef SMG_DROP_SEQ +#endif + + +#if 0 +#define SMG_NO_MEDIA +#warning "SMG No Media Defined" +#else +#undef SMG_NO_MEDIA +#endif + +const char WELCOME_TEXT[] = +"================================================================================\n" +"Sangoma Media Gateway Daemon v1.56 \n" +"\n" +"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" +"Copyright 2005, 2006, 2007 \n" +"Nenad Corbic , Anthony Minessale II \n" +"This program is free software, distributed under the terms of\n" +"the GNU General Public License\n" +"================================================================================\n" +""; + + + +static int coredump=1; +static int autoacm=0; + +/* FIXME: Should be done in cfg file */ +#if defined(BRI_PROT) +int max_spans=WOOMERA_BRI_MAX_SPAN; +int max_chans=WOOMERA_BRI_MAX_CHAN; +#else +/* PRI_PROT uses these defines as well */ +int max_spans=WOOMERA_MAX_SPAN; +int max_chans=WOOMERA_MAX_CHAN; +#endif + +static int launch_media_tdm_thread(struct woomera_interface *woomera); +static int launch_woomera_thread(struct woomera_interface *woomera); +static void woomera_check_digits (struct woomera_interface *woomera); +static struct woomera_interface *alloc_woomera(void); +static void handle_event_dtmf(struct woomera_interface *woomera, unsigned char dtmf_digit); + +q931_cause_to_str_array_t q931_cause_to_str_array[255]; +bearer_cap_to_str_array_t bearer_cap_to_str_array[255]; +uil1p_to_str_array_t uil1p_to_str_array[255]; + +static int isup_exec_command(int span, int chan, int id, int cmd, int cause) +{ + short_signal_event_t oevent; + int retry=5; + + call_signal_event_init((short_signal_event_t*)&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, (call_signal_event_t*)&oevent) < 0){ + + --retry; + if (retry <= 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(SMG_LOG_ALL, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + +static int isup_exec_event(call_signal_event_t *event) +{ + int retry=5; + +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, event) < 0){ + + --retry; + if (retry <= 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(SMG_LOG_ALL, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + + +static int isup_exec_commandp(int span, int chan, int id, int cmd, int cause) +{ + short_signal_event_t oevent; + int retry=5; + + call_signal_event_init(&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_writep(&server.mconp, (call_signal_event_t*)&oevent) < 0){ + + --retry; + if (retry <= 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(SMG_LOG_ALL, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + + +static int get_span_chan_from_interface(char* interface, int *span_ptr, int *chan_ptr) +{ + int span, chan; + + if (sscanf(interface, "w%dg%d", &span, &chan) == 2) { + if (smg_validate_span_chan(span,chan) != 0) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "WOOMERA Warning invalid span chan in interface %s\n", + interface); + return -1; + } + + *span_ptr = span; + *chan_ptr = chan; + return 0; + } + log_printf(SMG_LOG_ALL, server.log, "ERROR: Failed to get span chan from interface:[%s]\n", interface, span, chan); + return -1; +} + +static int socket_printf(int socket, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return -1; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) smg_malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + log_printf(SMG_LOG_ALL, server.log, "Crtical ERROR: Memory Error!\n"); + } else { + int err; + int len = strlen(data); + err=send(socket, data, strlen(data), 0); + if (err != strlen(data)) { + log_printf(SMG_LOG_DEBUG_8, server.log, "ERROR: Failed to send data to woomera socket(%i): err=%i len=%d %s\n", + socket,err,len,strerror(errno)); + ret = err; + } else { + ret = 0; + } + + free(data); + } + + return ret; +} + + + +static int woomera_next_pair(struct woomera_config *cfg, char **var, char **val) +{ + int ret = 0; + char *p, *end; + + *var = *val = NULL; + + for(;;) { + cfg->lineno++; + + if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) { + ret = 0; + break; + } + + *var = cfg->buf; + + if (**var == '[' && (end = strchr(*var, ']'))) { + *end = '\0'; + (*var)++; + strncpy(cfg->category, *var, sizeof(cfg->category) - 1); + continue; + } + + if (**var == '#' || **var == '\n' || **var == '\r') { + continue; + } + + if ((end = strchr(*var, '#'))) { + *end = '\0'; + end--; + } else if ((end = strchr(*var, '\n'))) { + if (*end - 1 == '\r') { + end--; + } + *end = '\0'; + } + + p = *var; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *var = p; + + if (!(*val = strchr(*var, '='))) { + ret = -1; + log_printf(SMG_LOG_ALL, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); + continue; + } else { + p = *val - 1; + *(*val) = '\0'; + (*val)++; + if (*(*val) == '>') { + *(*val) = '\0'; + (*val)++; + } + + while ((*p == ' ' || *p == '\t') && p != *var) { + *p = '\0'; + p--; + } + + p = *val; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *val = p; + ret = 1; + break; + } + } + + return ret; + +} + + +#if 0 +static void woomera_set_span_chan(struct woomera_interface *woomera, int span, int chan) +{ + pthread_mutex_lock(&woomera->vlock); + woomera->span = span; + woomera->chan = chan; + pthread_mutex_unlock(&woomera->vlock); + +} +#endif + + +static struct woomera_event *new_woomera_event_printf(struct woomera_event *ebuf, char *fmt, ...) +{ + struct woomera_event *event = NULL; + int ret = 0; + va_list ap; + + if (ebuf) { + event = ebuf; + } else if (!(event = new_woomera_event())) { + log_printf(SMG_LOG_ALL, server.log, "Memory Error queuing event!\n"); + return NULL; + } else { + return NULL; + } + + va_start(ap, fmt); +#ifdef SOLARIS + event->data = (char *) smg_malloc(2048); + vsnprintf(event->data, 2048, fmt, ap); +#else + ret = smg_vasprintf(&event->data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + log_printf(SMG_LOG_ALL, server.log, "Memory Error queuing event!\n"); + destroy_woomera_event(&event, EVENT_FREE_DATA); + return NULL; + } + + return event; + +} + +static struct woomera_event *woomera_clone_event(struct woomera_event *event) +{ + struct woomera_event *clone; + + if (!(clone = new_woomera_event())) { + return NULL; + } + + /* This overwrites the MALLOC in clone causing a memory leak */ + memcpy(clone, event, sizeof(*event)); + + /* We must set the malloc flag back so that this event + * will be deleted */ + _woomera_set_flag(clone, WFLAG_MALLOC); + clone->next = NULL; + clone->data = smg_strdup(event->data); + + return clone; +} + +static void enqueue_event(struct woomera_interface *woomera, + struct woomera_event *event, + event_args free_data) +{ + struct woomera_event *ptr, *clone = NULL; + + assert(woomera != NULL); + assert(event != NULL); + + if (!(clone = woomera_clone_event(event))) { + log_printf(SMG_LOG_ALL, server.log, "Error Cloning Event\n"); + return; + } + + pthread_mutex_lock(&woomera->queue_lock); + + for (ptr = woomera->event_queue; ptr && ptr->next ; ptr = ptr->next); + + if (ptr) { + ptr->next = clone; + } else { + woomera->event_queue = clone; + } + + pthread_mutex_unlock(&woomera->queue_lock); + + woomera_set_flag(woomera, WFLAG_EVENT); + + if (free_data && event->data) { + /* The event has been duplicated, the original data + * should be freed */ + smg_free(event->data); + event->data=NULL; + } +} + +static char *dequeue_event(struct woomera_interface *woomera) +{ + struct woomera_event *event; + char *data = NULL; + + if (!woomera) { + return NULL; + } + + pthread_mutex_lock(&woomera->queue_lock); + if (woomera->event_queue) { + event = woomera->event_queue; + woomera->event_queue = event->next; + data = event->data; + pthread_mutex_unlock(&woomera->queue_lock); + + destroy_woomera_event(&event, EVENT_KEEP_DATA); + return data; + } + pthread_mutex_unlock(&woomera->queue_lock); + + return data; +} + + +static int enqueue_event_on_listeners(struct woomera_event *event) +{ + struct woomera_listener *ptr; + int x = 0; + + assert(event != NULL); + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + enqueue_event(ptr->woomera, event, EVENT_KEEP_DATA); + x++; + } + pthread_mutex_unlock(&server.listen_lock); + + return x; +} + + +static void del_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *ptr, *last = NULL; + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + if (ptr->woomera == woomera) { + if (last) { + last->next = ptr->next; + } else { + server.listeners = ptr->next; + } + smg_free(ptr); + break; + } + last = ptr; + } + pthread_mutex_unlock(&server.listen_lock); +} + +static void add_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *new; + + pthread_mutex_lock(&server.listen_lock); + + if ((new = smg_malloc(sizeof(*new)))) { + memset(new, 0, sizeof(*new)); + new->woomera = woomera; + new->next = server.listeners; + server.listeners = new; + } else { + log_printf(SMG_LOG_ALL, server.log, "Memory Error adding listener!\n"); + } + + pthread_mutex_unlock(&server.listen_lock); +} + + + +static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) +{ + struct media_session *ms = woomera_get_ms(woomera); + char *cur = NULL; + int wrote = 0; + int err; + + if (!ms) { + return -EINVAL; + } + + if (!ms->dtmf_buffer) { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Allocate DTMF Buffer...."); + + err=switch_buffer_create_dynamic(&ms->dtmf_buffer, 1024, server.dtmf_size, 0); + + if (err != 0) { + log_printf(SMG_LOG_ALL, woomera->log, "Failed to allocate DTMF Buffer!\n"); + return -ENOMEM; + } else { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "SUCCESS!\n"); + } + + } + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Sending DTMF %s\n",digits); + for (cur = digits; *cur; cur++) { + if ((wrote = teletone_mux_tones(&ms->tone_session, + &ms->tone_session.TONES[(int)*cur]))) { + + pthread_mutex_lock(&woomera->dtmf_lock); + + err=switch_buffer_write(ms->dtmf_buffer, ms->tone_session.buffer, wrote * 2); + + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Sending DTMF %s Wrote=%i (err=%i)\n", + digits,wrote*2,err); + } else { + log_printf(SMG_LOG_ALL, woomera->log, "Error: Sending DTMF %s (err=%i)\n", + digits,wrote); + } + } + + ms->skip_read_frames = 200; + return 0; +} + +static struct woomera_interface *alloc_woomera(void) +{ + struct woomera_interface *woomera = NULL; + + if ((woomera = smg_malloc(sizeof(struct woomera_interface)))) { + + memset(woomera, 0, sizeof(struct woomera_interface)); + + woomera->chan = -1; + woomera->span = -1; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->q931_rel_cause_topbx=SIGBOOST_RELEASE_CAUSE_NORMAL; + woomera->q931_rel_cause_tosig=SIGBOOST_RELEASE_CAUSE_NORMAL; + + woomera_set_interface(woomera, "w-1g-1"); + + + + } + + return woomera; + +} + + +static struct woomera_interface *new_woomera_interface(int socket, struct sockaddr_in *sock_addr, int len) +{ + struct woomera_interface *woomera = NULL; + + if (socket < 0) { + log_printf(SMG_LOG_ALL, server.log, "Critical: Invalid Socket on new interface!\n"); + return NULL; + } + + if ((woomera = alloc_woomera())) { + if (socket >= 0) { + no_nagle(socket); + woomera->socket = socket; + } + + if (sock_addr && len) { + memcpy(&woomera->addr, sock_addr, len); + } + } + + return woomera; + +} + +static char *woomera_message_header(struct woomera_message *wmsg, char *key) +{ + int x = 0; + char *value = NULL; + + for (x = 0 ; x < wmsg->last ; x++) { + if (!strcasecmp(wmsg->names[x], key)) { + value = wmsg->values[x]; + break; + } + } + + return value; +} + + +#define SMG_DECODE_POLL_ERRORS(err) \ + (err & POLLERR) ? "POLLERR" : \ + (err & POLLHUP) ? "POLLHUP" : \ + (err & POLLNVAL) ? "POLLNVAL" : "UNKNOWN" + +static int waitfor_socket(int fd, int timeout, int flags, int *flags_out) +{ + struct pollfd pfds[1]; + int res; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + +waitfor_socket_tryagain: + + memset(&pfds[0], 0, sizeof(pfds[0])); + + pfds[0].fd = fd; + pfds[0].events = flags | errflags; + + res = poll(pfds, 1, timeout); + + if (res == 0) { + return res; + } + + if (res > 0) { + res=-1; + *flags_out = pfds[0].revents; + if (pfds[0].revents & errflags) { + res=-1; +#if 0 + log_printf(SMG_LOG_DEBUG_10,server.log, "Wait for socket Error in revents 0x%X %s Error=%s!\n", + pfds[0].revents,strerror(errno),SMG_DECODE_POLL_ERRORS(pfds[0].revents)); +#endif + return res; + } else { + if (pfds[0].revents & flags) { + res=1; + } else { + log_printf(SMG_LOG_ALL,server.log, "Wait for socket invalid poll event in revents 0x%X Error=%s Errno=%s !\n", + pfds[0].revents,SMG_DECODE_POLL_ERRORS(pfds[0].revents),strerror(errno)); + } + } + } else { + if ((errno == EINTR || errno == EAGAIN)) { + goto waitfor_socket_tryagain; + } + log_printf(SMG_LOG_ALL,server.log, "Wait for socket error!\n"); + } + + return res; +} + + +static int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) +{ + struct pollfd pfds[2]; + int res = 0; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + if (fda < 0 || fdb < 0) { + return -1; + } + + +waitfor_2sockets_tryagain: + + *a=0; + *b=0; + + + memset(pfds, 0, sizeof(pfds)); + + pfds[0].fd = fda; + pfds[1].fd = fdb; + pfds[0].events = POLLIN | errflags; + pfds[1].events = POLLIN | errflags; + + + + res = poll(pfds, 2, timeout); + + if (res > 0) { + res = 1; + if ((pfds[0].revents & errflags) || (pfds[1].revents & errflags)) { + res = -1; + } else { + if ((pfds[0].revents & POLLIN)) { + *a=1; + res++; + } + if ((pfds[1].revents & POLLIN)) { + *b=1; + res++; + } + } + + if (res == 1) { + /* No event found what to do */ + res=-1; + } + } else if (res < 0) { + + if (errno == EINTR || errno == EAGAIN) { + goto waitfor_2sockets_tryagain; + } + + } + + return res; +} + + +static struct media_session *media_session_new(struct woomera_interface *woomera) +{ + struct media_session *ms = NULL; + int x; + char *p; + int span,chan; + + span=woomera->span; + chan=woomera->chan; + + log_printf(SMG_LOG_DEBUG_CALL, server.log,"Starting new MEDIA session [%s] [%s]\n", + woomera->interface,woomera->raw?woomera->raw:"N/A"); + + if ((ms = smg_malloc(sizeof(struct media_session)))) { + memset(ms, 0, sizeof(struct media_session)); + + if (woomera->loop_tdm != 1) { + for(x = 0; x < strlen(woomera->raw) ; x++) { + if (woomera->raw[x] == ':') { + break; + } + if (woomera->raw[x] == '/') { + break; + } + } + + ms->ip = smg_strndup(woomera->raw, x); + time(&ms->started); + p = woomera->raw + (x+1); + ms->port = atoi(p); + } + + time(&ms->started); + woomera_set_ms(woomera,ms); + ms->woomera = woomera; + + /* Setup artificial DTMF stuff */ + memset(&ms->tone_session, 0, sizeof(ms->tone_session)); + if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { + log_printf(SMG_LOG_ALL, server.log, "ERROR: Failed to initialize TONE [w%ig%i]!\n", + span+1,chan+1); + } + + ms->tone_session.rate = SMG_DTMF_RATE; + ms->tone_session.duration = server.dtmf_on * (ms->tone_session.rate / 1000); + ms->tone_session.wait = server.dtmf_off * (ms->tone_session.rate / 1000); + + teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); + + } else { + log_printf(SMG_LOG_ALL, server.log, "ERROR: Memory Alloc Failed [w%ig%i]!\n", + span+1,chan+1); + } + + return ms; +} + +static void media_session_free(struct media_session *ms) +{ + if (ms->ip) { + smg_free(ms->ip); + } + + teletone_destroy_session(&ms->tone_session); + switch_buffer_destroy(&ms->dtmf_buffer); + + ms->woomera = NULL; + + smg_free(ms); +} + + +static int create_udp_socket(struct media_session *ms, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + log_printf(SMG_LOG_DEBUG_9,server.log,"LocalIP %s:%d IP %s:%d \n",local_ip, local_port, ip, port); + + memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); + memset(&ms->local_hp, 0, sizeof(ms->local_hp)); + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + ms->remote_addr.sin_family = ms->remote_hp.h_addrtype; + memcpy((char *) &ms->remote_addr.sin_addr.s_addr, ms->remote_hp.h_addr_list[0], ms->remote_hp.h_length); + ms->remote_addr.sin_port = htons(port); + + ms->local_addr.sin_family = ms->local_hp.h_addrtype; + memcpy((char *) &ms->local_addr.sin_addr.s_addr, ms->local_hp.h_addr_list[0], ms->local_hp.h_length); + ms->local_addr.sin_port = htons(local_port); + + rc = bind(ms->socket, (struct sockaddr *) &ms->local_addr, sizeof(ms->local_addr)); + if (rc < 0) { + close(ms->socket); + ms->socket = -1; + + log_printf(SMG_LOG_DEBUG_9,server.log, + "Failed to bind LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + + /* OK */ + + } else { + log_printf(SMG_LOG_ALL,server.log, + "Failed to get hostbyname LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + } else { + log_printf(SMG_LOG_ALL,server.log, + "Failed to create/allocate UDP socket\n"); + } + + return ms->socket; +} + +static int next_media_port(void) +{ + int port; + + pthread_mutex_lock(&server.media_udp_port_lock); + port = ++server.next_media_port; + if (port > server.max_media_port) { + server.next_media_port = server.base_media_port; + port = server.base_media_port; + } + pthread_mutex_unlock(&server.media_udp_port_lock); + + return port; +} + + + +static int woomera_dtmf_transmit(struct media_session *ms, int mtu) +{ + struct woomera_interface *woomera = ms->woomera; + int bread; + unsigned char dtmf[1024]; + unsigned char dtmf_law[1024]; + sangoma_api_hdr_t hdrframe; + int i; + int slin_len = mtu*2; + short *data; + int used; + int res; + int err; + int txdtmf=0; + int flags_out; + memset(&hdrframe,0,sizeof(hdrframe)); + + if (!ms->dtmf_buffer) { + return -1; + } + + for (;;) { + + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + break; + } + + res = waitfor_socket(ms->sangoma_sock, -1, POLLOUT, &flags_out); + if (res <= 0) { + break; + } + +#ifdef CODEC_LAW_DEFAULT + + pthread_mutex_lock(&woomera->dtmf_lock); + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + pthread_mutex_unlock(&woomera->dtmf_lock); + break; + } + + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, slin_len); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread <= 0) { + break; + } + + log_printf(SMG_LOG_DEBUG_MISC,woomera->log,"%s: Write DTMF Got %d bytes MTU=%i Coding=%i Used=%i\n", + woomera->interface,bread,mtu,ms->hw_coding,used); + + data=(short*)dtmf; + for (i=0;ihw_coding) { + /* ALAW */ + dtmf_law[i] = linear_to_alaw((int)data[i]); + } else { + /* ULAW */ + dtmf_law[i] = linear_to_ulaw((int)data[i]); + } + } + + err=sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf_law, mtu, 0); + + if (err != mtu) { + log_printf(SMG_LOG_ALL, woomera->log, "Error: Failed to TX to TDM API on DTMF (err=%i mtu=%i)!\n",err,mtu); + } + + txdtmf++; + ms->skip_write_frames++; +#else +... + pthread_mutex_lock(&woomera->dtmf_lock); + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, mtu); + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(SMG_LOG_DEBUG_MISC,woomera->log,"%s: Write DTMF Got %d bytes\n", + woomera->interface,bread); + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf, mtu, 0); + txdtmf++; + ms->skip_write_frames++; +#endif + + } + + if (txdtmf) { + return 0; + } else { + return -1; + } +} + +static void media_loop_run(struct media_session *ms) +{ + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int errs=0; + int res=0; + wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + char filename[100]; + FILE *filed=NULL; + int loops=0,flags_out=0; + int open_cnt = 0; + + open_cnt=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + +retry_loop: + ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1); + + log_printf(SMG_LOG_PROD, server.log, "Media Loop Started %s fd=%i\n", + woomera->interface,ms->sangoma_sock); + + if (ms->sangoma_sock < 0) { + errs++; + if (errs < 5) { + usleep(500000); + goto retry_loop; + } + log_printf(SMG_LOG_ALL, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + + } else { + errs=0; + + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } + + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api); + ms->oob_disable = 0; +#ifdef LIBSANGOMA_VERSION + open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api); + if (open_cnt > 1) { + ms->oob_disable = 1; + } +#endif + } + + if (errs) { + log_printf(SMG_LOG_ALL, server.log, "Media Loop: failed to open tdm device %s\n", + woomera->interface); + return; + } + + if (server.loop_trace) { + sprintf(filename,"/smg/w%ig%i-loop.trace",woomera->span+1,woomera->chan+1); + unlink(filename); + filed = safe_fopen(filename, "w"); + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + ((res = waitfor_socket(ms->sangoma_sock, 1000, POLLIN, &flags_out)) >= 0)) { + + if (res == SMG_SOCKET_EVENT_TIMEOUT) { + //log_printf(SMG_LOG_DEBUG_8, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(SMG_LOG_ALL, server.log, "TDM Loop ReadMsg Error: %s\n", + strerror(errno), woomera->interface); + break; + } + + if (server.loop_trace && filed != NULL) { + int i; + for (i=0;isangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + res, 0); + + res=0; + + loops++; + } + + + if (res < 0) { + if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + log_printf(SMG_LOG_ALL, server.log, "Media Loop: socket error %s (fd=%i) %s\n", + woomera->interface, ms->sangoma_sock, strerror(errno)); + } + } + + + if (server.loop_trace && filed != NULL) { + fclose(filed); + } + + sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api); + + close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1); + + if (loops < 1) { + log_printf(SMG_LOG_ALL, server.log, "Media Loop FAILED %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + } else { + log_printf(SMG_LOG_PROD, server.log, "Media Loop PASSED %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + } + + return; + +} + + + + +#ifdef WP_HPTDM_API +static int media_rx_ready(void *p, unsigned char *data, int len) +{ + struct media_session *ms = (struct media_session *)p; + + if (ms->udp_sock < 0) { + return -1; + } + + return sendto(ms->udp_sock, + data,len, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + +} +#endif + +static void *media_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int local_port, x = 0, errs = 0, res = 0, packet_len = 0; + //int udp_cnt=0; + struct woomera_event wevent; + wanpipe_tdm_api_t tdm_api; + FILE *tx_fd=NULL; + int sock_timeout=200; + + int hwec_enabled=0, hwec_reenable=0; + + int open_cnt = 0; + + open_cnt=0; + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + !woomera->interface || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "MEDIA session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(ms); + pthread_exit(NULL); + return NULL; + } + + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA session for [%s] started (ptr=%p loop=%i)\n", + woomera->interface,woomera,woomera->loop_tdm); + + if (woomera->loop_tdm) { + media_loop_run(ms); + ms->udp_sock=-1; + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + goto media_thread_exit; + } + + for(x = 0; x < 1000 ; x++) { + local_port = next_media_port(); + if ((ms->udp_sock = create_udp_socket(ms, server.media_ip, local_port, ms->ip, ms->port)) > -1) { + break; + } + } + + /* Normal Temporary Failure */ + woomera->q931_rel_cause_topbx = 41; + + if (ms->udp_sock < 0) { + log_printf(SMG_LOG_ALL, server.log, "UDP Socket Error (%s) [%s] LocalPort=%d\n", + strerror(errno), woomera->interface, local_port); + + errs++; + } else { + int media_retry_cnt=0; +#ifdef WP_HPTDM_API + hp_tdm_api_span_t *span=hptdmspan[woomera->span+1]; + if (!span || !span->init) { + errs++; + } else { + hp_tdm_api_usr_callback_t usr_callback; + memset(&usr_callback,0,sizeof(usr_callback)); + usr_callback.p = ms; + usr_callback.rx_avail = media_rx_ready; + if (span->open_chan(span, &usr_callback, &ms->tdmchan,woomera->chan+1)) { + errs++; + /* Switch Congestion */ + woomera->q931_rel_cause_topbx = 42; + } + } +#else +media_retry: + ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1); + if (ms->sangoma_sock < 0) { + + if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + media_retry_cnt++; + if (media_retry_cnt < 5) { + log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Retry [w%ig%i]\n", + woomera->span+1, woomera->chan+1); + usleep(100000); + goto media_retry; + } + + log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + + /* Switch Congestion */ + woomera->q931_rel_cause_topbx = 42; + } + + errs++; + } else { + +# ifdef CODEC_LAW_DEFAULT + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } +# else + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_SLINEAR) < 0 ) { + errs++; + } +# endif + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + +# ifdef CODEC_LAW_DEFAULT +# ifdef LIBSANGOMA_GET_HWCODING + ms->hw_coding=sangoma_tdm_get_hw_coding(ms->sangoma_sock, &tdm_api); + if (ms->hw_coding < 0) { + errs++; + } +# else +# error "libsangoma missing hwcoding feature: not up to date!" +# endif +# endif + + +# ifdef LIBSANGOMA_GET_HWDTMF + ms->hw_dtmf=sangoma_tdm_get_hw_dtmf(ms->sangoma_sock, &tdm_api); + if (ms->hw_dtmf) { + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Supported [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + } else { + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + } +#else + ms->hw_dtmf=0; + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); +# warning "libsangoma missing hwdtmf feature: not up to date!" + +#endif + + ms->oob_disable = 0; +#ifdef LIBSANGOMA_VERSION + open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api); + if (open_cnt > 1) { + ms->oob_disable = 1; + } +#endif + + if (!tdmv_hwec_persist) { + // BRI cards start with HWEC in bypass disable state + if (bearer_cap_is_audio(woomera->bearer_cap)) { + int err; + err=sangoma_tdm_enable_hwec(ms->sangoma_sock, &tdm_api); + if (err == 0) { + hwec_enabled=1; + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Enabling hwec Ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Enabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } else { + if (!bearer_cap_is_audio(woomera->bearer_cap)) { + int err; + err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api); + if (err == 0) { + hwec_reenable=1; + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Disabling hwec Ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Disabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + } +#endif + } + + + +#ifdef WP_HPTDM_API + /* No tdm thread */ +#else +#ifndef SMG_NO_MEDIA + if (!errs && + launch_media_tdm_thread(woomera)) { + errs++; + } +#endif +#endif + + if (errs) { + + woomera->q931_rel_cause_topbx = 42; + + } else { + + unsigned char udp_frame[4096]; + unsigned int fromlen = sizeof(struct sockaddr_in); + int flags_out=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(udp_frame,0,sizeof(udp_frame)); +#ifdef DOTRACE + int fdin, fdout; + char path_in[512], path_out[512]; +#endif + + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Unique-Call-Id: %s%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: PCM-16%s" + "DTMF: %s%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + (ms->hw_dtmf)? "OutofBand": "InBand", + + WOOMERA_RECORD_SEPERATOR + ); + + + enqueue_event(woomera, &wevent, EVENT_FREE_DATA); + +#ifdef DOTRACE + sprintf(path_in, "/tmp/debug-in.%d.raw", tc); + sprintf(path_out, "/tmp/debug-out.%d.raw", tc++); + fdin = open(path_in, O_WRONLY | O_CREAT, O_TRUNC, 0600); + fdout = open(path_out, O_WRONLY | O_CREAT, O_TRUNC, 0600); +#endif + + if (server.out_tx_test) { + tx_fd=fopen("/smg/sound.raw","rb"); + if (!tx_fd) { + log_printf(SMG_LOG_ALL,server.log, "FAILED TO OPEN Sound file!\n"); + } + } + + + for (;;) { + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + res=0; + break; + } + + res = waitfor_socket(ms->udp_sock, sock_timeout, POLLIN, &flags_out); + + if (res < 0) { + break; + } + +#ifdef SMG_NO_MEDIA + continue; +#endif + + if (res == 0) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + + log_printf(SMG_LOG_DEBUG_8, server.log, "%s: UDP Sock Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if ((packet_len = recvfrom(ms->udp_sock, udp_frame, sizeof(udp_frame), + MSG_DONTWAIT, (struct sockaddr *) &ms->local_addr, &fromlen)) < 1) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "UDP Recv Error: %s\n",strerror(errno)); + break; + } + + +#ifdef SMG_DROP_SEQ + if (drop_seq) { + log_printf(SMG_LOG_ALL,server.log,"Dropping TX Sequence! %i\n",drop_seq); + drop_seq--; + continue; + } +#endif + +#if 0 + log_printf(SMG_LOG_DEBUG_10, server.log, "%s: UDP Receive %i !!!\n", + woomera->interface,packet_len); +#endif + + if (packet_len > 0) { + +#if 0 +/* NC: This can cause skb_over panic must be retested */ + if (packet_len != sangoma_frame_len && ms->udp_sync_cnt <= 5) { + /* Assume that we will always receive SLINEAR here */ + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, packet_len/codec_sample); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + log_printf(SMG_LOG_DEBUG_MISC, server.log, + "%s: UDP TDM Period ReSync to Len=%i %ims (udp=%i) \n", + woomera->interface,sangoma_frame_len, + sangoma_frame_len/codec_sample,packet_len); + + + if (++ms->udp_sync_cnt >= 6) { + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, 20); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + log_printf(SMG_LOG_ALL, server.log, + "%s: UDP TDM Period Force ReSync to 20ms \n", + woomera->interface); + } + + } +#endif + if (!server.out_tx_test) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + /* For sanity sake if we are doing the out test + * dont take any chances force tx udp data */ + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + continue; + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + continue; + } + + } + + if (server.out_tx_test && tx_fd && + fread((void*)udp_frame, + sizeof(char), + packet_len,tx_fd) <= 0) { + + sangoma_get_full_cfg(ms->sangoma_sock,&tdm_api); + fclose(tx_fd); + tx_fd=NULL; + } + +#ifdef WP_HPTDM_API + if (ms->tdmchan->push) { + ms->tdmchan->push(ms->tdmchan,udp_frame,packet_len); + } +#else + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + udp_frame, + packet_len, 0); +#endif + + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + udp_cnt++; + if (udp_cnt && udp_cnt % 1000 == 0) { + log_printf(SMG_LOG_ALL, server.log, "%s: MEDIA UDP TX RX CNT %i %i\n", + woomera->interface,udp_cnt,packet_len); + } + } +#endif + } + + if (res < 0) { + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + res=0; + } else { + log_printf(SMG_LOG_ALL, server.log, "Media Thread: socket error %s SockID=%i %s Poll=%s!\n", + woomera->interface,ms->sangoma_sock,strerror(errno),SMG_DECODE_POLL_ERRORS(flags_out)); + } + } + } + + new_woomera_event_printf(&wevent, + "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Start-Time: %ld%s" + "End-Time: %ld%s" + "Answer-Time: %ld%s" + "Call-ID: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + woomera->session, + WOOMERA_LINE_SEPERATOR, + + time(&ms->started), + WOOMERA_LINE_SEPERATOR, + + time(NULL), + WOOMERA_LINE_SEPERATOR, + + time(&ms->answered), + WOOMERA_LINE_SEPERATOR, + + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + +media_thread_exit: + + if (!tdmv_hwec_persist) { + if (hwec_enabled) { + int err; + err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api); + if (err==0) { + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] disabling hwec ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] disabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } else { + if (hwec_reenable) { + int err; + err=sangoma_tdm_enable_hwec(ms->sangoma_sock, &tdm_api); + if (err==0) { + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Re-enabling hwec ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Re-enabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + /* Dont wait for the other thread */ + close_socket(&ms->udp_sock); + close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1); + while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + usleep(1000); + sched_yield(); + } + } + + + close_socket(&ms->udp_sock); + close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1); + + if (tx_fd){ + fclose(tx_fd); + tx_fd=NULL; + } + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + woomera_set_ms(woomera,NULL); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + + media_session_free(ms); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + + pthread_exit(NULL); + return NULL; +} + + + + +static void *media_tdm_thread_run(void *obj) +{ + wanpipe_tdm_api_t tdm_api; + wp_tdm_api_event_t *rx_event; + + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int res = 0; + unsigned char circuit_frame[1024]; + sangoma_api_hdr_t hdrframe; + int flags_out; + int poll_opt = POLLIN | POLLPRI; + + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + memset(&tdm_api, 0, sizeof(wanpipe_tdm_api_t)); + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || !woomera->interface) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA TDM session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + pthread_exit(NULL); + return NULL; + } + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA TDM session for [%s] started (ptr=%p)\n", + woomera->interface,woomera); + + + for (;;) { + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + res=0; + break; + } + + if (ms->oob_disable) { + poll_opt = POLLIN; + } else { + poll_opt = POLLIN | POLLPRI; + } + res = waitfor_socket(ms->sangoma_sock, 1000, poll_opt, &flags_out); + + + if (res < 0) { + break; + } + + if (res == 0) { +#if 0 + log_printf(SMG_LOG_DEBUG_8, server.log, "%s: TDM UDP Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ +#endif + continue; + } + + + if (flags_out & POLLIN) { + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + + if (res < 0) { + if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + log_printf(SMG_LOG_ALL, server.log, "TDM Read Data Error: %s %s Sockid=%i\n", + woomera->interface, + strerror(errno),ms->sangoma_sock); + } + break; + } + + res = sendto(ms->udp_sock, + circuit_frame, + res, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + if (res < 0) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "UDP Sento Error: %s\n", strerror(errno)); + + } + } + + if (flags_out & POLLPRI) { + + res = sangoma_tdm_read_event(ms->sangoma_sock, &tdm_api); + if (res < 0) { + log_printf(SMG_LOG_ALL, server.log, "TDM Read Event Error: %s %s Sockid=%i\n", + woomera->interface, + strerror(errno),ms->sangoma_sock); + break; + } + + rx_event = &tdm_api.wp_tdm_cmd.event; + + switch (rx_event->wp_tdm_api_event_type){ +# ifdef LIBSANGOMA_GET_HWDTMF + case WP_TDMAPI_EVENT_DTMF: + + /* Only handle hw dtmf if hw_dtmf option is enabled */ + if (!ms->hw_dtmf) { + break; + } + + /* PORT_SOUT = 1 */ + if (rx_event->wp_tdm_api_event_dtmf_port == WAN_EC_CHANNEL_PORT_SOUT && + rx_event->wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { + + handle_event_dtmf(woomera, rx_event->wp_tdm_api_event_dtmf_digit); + } + break; +#endif + default: + log_printf(SMG_LOG_ALL, server.log, "TDM API Unknown OOB Event %i\n", + rx_event->wp_tdm_api_event_type); + break; + } + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + tdm_cnt++; + if (tdm_cnt && tdm_cnt % 1000 == 0) { + log_printf(SMG_LOG_ALL, server.log, "%s: MEDIA TDM TX RX CNT %i %i\n", + woomera->interface,tdm_cnt,res); + } + } +#endif + + } + + if (res < 0) { + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + + /* Good reason to exit */ + + } else { + + log_printf(SMG_LOG_ALL, server.log, "Media TDM Thread: socket error %s Sockid=%i %s Woomera Flags=0x%08X Poll=%s!\n", + woomera->interface,ms->sangoma_sock,strerror(errno),woomera->flags,SMG_DECODE_POLL_ERRORS(flags_out)); + woomera_print_flags(woomera,0); + } + } + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA TDM session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + + pthread_exit(NULL); + return NULL; + +} + + +/* This function must be called with process_lock + * because it modifies shared process_table */ + +static int launch_media_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms; + + if ((ms = media_session_new(woomera))) { + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_RUNNING); + result = pthread_create(&ms->thread, &attr, media_thread_run, ms); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(woomera->ms); + + } + pthread_attr_destroy(&attr); + + } else { + log_printf(SMG_LOG_ALL, server.log, "Failed to start new media session\n"); + } + + return result; + +} + +static int launch_media_tdm_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms = woomera_get_ms(woomera); + + if (!ms) { + return result; + } + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + result = pthread_create(&ms->thread, &attr, media_tdm_thread_run, ms); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +static struct woomera_interface * launch_woomera_loop_thread(short_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + char callid[20]; + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + + if ((woomera = alloc_woomera())) { + + woomera->chan = event->chan; + woomera->span = event->span; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->loop_tdm=1; + woomera->socket=-1; + + } else { + log_printf(SMG_LOG_ALL, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + woomera_set_interface(woomera,callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = woomera; + pthread_mutex_unlock(&server.process_lock); + + if (launch_woomera_thread(woomera)) { + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + smg_free(woomera); + log_printf(SMG_LOG_ALL, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + return woomera; +} + +static int woomera_message_parse(struct woomera_interface *woomera, struct woomera_message *wmsg, int timeout) +{ + char *cur, *cr, *next = NULL, *eor = NULL; + char buf[2048]; + int res = 0, bytes = 0, sanity = 0; + struct timeval started, ended; + int elapsed, loops = 0; + int failto = 0; + int packet = 0; + int flags_out = 0; + + memset(wmsg, 0, sizeof(*wmsg)); + + if (woomera->socket < 0 ) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX "%s Invalid Socket! %d\n", + woomera->interface,woomera->socket); + return -1; + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_9, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Woomera Message parse: Call Hangup - skipping message parse !\n", + woomera->interface); + return -1; + } + + gettimeofday(&started, NULL); + memset(buf, 0, sizeof(buf)); + + if (timeout < 0) { + timeout = abs(timeout); + failto = 1; + } else if (timeout == 0) { + timeout = -1; + } + + + while (!(eor = strstr(buf, WOOMERA_RECORD_SEPERATOR))) { + if (sanity > 1000) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX "%s Failed Sanity Check!\n[%s]\n\n", woomera->interface, buf); + return -1; + } + + if ((res = waitfor_socket(woomera->socket, 1000, POLLIN, &flags_out) > 0)) { + + res = recv(woomera->socket, buf, sizeof(buf), MSG_PEEK); + + if (res > 1) { + packet++; + } + if (!strncmp(buf, WOOMERA_LINE_SEPERATOR, 2)) { + res = read(woomera->socket, buf, 2); + return 0; + } + if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_9, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + + } else if (res < 0) { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, WOOMERA_DEBUG_PREFIX + "%s error during packet retry (err=%i) Loops#%d (%s)\n", + woomera->interface, res, loops, + strerror(errno)); + return res; + } else if (loops) { + ysleep(100000); + } + } + + gettimeofday(&ended, NULL); + elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000)); + + if (res < 0) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX "%s Bad RECV\n", + woomera->interface); + return res; + } else if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_9, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } + + if (packet && loops > 150) { + log_printf(SMG_LOG_PROD, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout waiting for packet.\n", + woomera->interface); + return -1; + } + + if (timeout > 0 && (elapsed > timeout)) { + log_printf(SMG_LOG_PROD, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout [%d] reached\n", + woomera->interface, timeout); + return failto ? -1 : 0; + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)) { + /* BRB! we have an Event to deliver....*/ + return 0; + } + + /* what're we still doing here? */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + !woomera_test_flag(woomera, WFLAG_RUNNING)) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Woomera Message Parse: Server or Woomera not Running\n", woomera->interface); + return -1; + } + loops++; + } + + *eor = '\0'; + bytes = strlen(buf) + 4; + + memset(buf, 0, sizeof(buf)); + res = read(woomera->socket, buf, bytes); + next = buf; + + log_printf(SMG_LOG_WOOMERA, woomera->log, "%s:WOOMERA RX MSG: %s\n",woomera->interface,buf); + + while ((cur = next)) { + + if ((cr = strstr(cur, WOOMERA_LINE_SEPERATOR))) { + *cr = '\0'; + next = cr + (sizeof(WOOMERA_LINE_SEPERATOR) - 1); + if (!strcmp(next, WOOMERA_RECORD_SEPERATOR)) { + break; + } + } + if (!cur || !*cur) { + break; + } + + if (!wmsg->last) { + char *cmd, *id, *args; + woomera_set_flag(wmsg, MFLAG_EXISTS); + cmd = cur; + + if ((id = strchr(cmd, ' '))) { + *id = '\0'; + id++; + if ((args = strchr(id, ' '))) { + *args = '\0'; + args++; + strncpy(wmsg->command_args, args, sizeof(wmsg->command_args)-1); + } + strncpy(wmsg->callid, id, sizeof(wmsg->callid)-1); + } + + strncpy(wmsg->command, cmd, sizeof(wmsg->command)-1); + } else { + char *name, *val; + name = cur; + + if ((val = strchr(name, ':'))) { + *val = '\0'; + val++; + while (*val == ' ') { + *val = '\0'; + val++; + } + strncpy(wmsg->values[wmsg->last-1], val, WOOMERA_STRLEN); + } + strncpy(wmsg->names[wmsg->last-1], name, WOOMERA_STRLEN); + if (name && val && !strcasecmp(name, "content-type")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + if (name && val && !strcasecmp(name, "content-length")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + + + } + wmsg->last++; + } + + wmsg->last--; + + if (bytes && woomera_test_flag(wmsg, MFLAG_CONTENT)) { + int terr; + terr=read(woomera->socket, wmsg->body, + (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); + } + + return woomera_test_flag(wmsg, MFLAG_EXISTS); + +} + +static struct woomera_interface *pull_from_holding_tank(int index, int span , int chan) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + + /* Block this index until the call is completed */ + server.holding_tank[index] = &woomera_dead_dev; + + woomera->index = 0; + woomera->span=span; + woomera->chan=chan; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static void clear_all_holding_tank(void) +{ + int i; + pthread_mutex_lock(&server.ht_lock); + for (i=0;i= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + woomera = server.holding_tank[index]; + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + + +static void clear_from_holding_tank(int index, struct woomera_interface *woomera) +{ + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] == &woomera_dead_dev) { +#if 0 + log_printf(SMG_LOG_ALL,server.log, "%s Clearing DEAD id=%i OK\n", + __FUNCTION__,index); +#endif + server.holding_tank[index] = NULL; + } else if (woomera && server.holding_tank[index] == woomera) { +#if 0 + log_printf(SMG_LOG_ALL,server.log, "%s Clearing ACTIVE Woomera id=%i OK\n", + __FUNCTION__,index); +#endif + server.holding_tank[index] = NULL; + } else if (server.holding_tank[index]) { + log_printf(SMG_LOG_ALL, server.log, "Critical Error: Holding tank index %i not cleared %p !\n", + index, server.holding_tank[index]); + } + pthread_mutex_unlock(&server.ht_lock); + + return; +} + +static struct woomera_interface *peek_from_holding_tank(int index) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static int add_to_holding_tank(struct woomera_interface *woomera) +{ + int next, i, found=0; + + pthread_mutex_lock(&server.ht_lock); + + for (i=0;i= CORE_TANK_LEN) { + next = server.holding_tank_index = 1; + } + + if (next == 0) { + log_printf(SMG_LOG_ALL, server.log, "\nCritical Error on TANK INDEX == 0\n"); + continue; + } + + if (server.holding_tank[next]) { + continue; + } + + found=1; + break; + } + + if (!found) { + /* This means all tank vales are busy + * should never happend */ + pthread_mutex_unlock(&server.ht_lock); + log_printf(SMG_LOG_ALL, server.log, "\nCritical Error failed to obtain a TANK INDEX\n"); + return 0; + } + + server.holding_tank[next] = woomera; + woomera->timeout = time(NULL) + server.call_timeout; + + pthread_mutex_unlock(&server.ht_lock); + return next; +} + + + +static void handle_event_dtmf(struct woomera_interface *woomera, unsigned char dtmf_digit) +{ + struct woomera_event wevent; + + memset(&wevent, 0, sizeof(struct woomera_event)); + + new_woomera_event_printf(&wevent, "EVENT DTMF %sUnique-Call-Id:%s%sContent-Length:%d%s%s%c%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 1, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + dtmf_digit, + WOOMERA_RECORD_SEPERATOR); + + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + return; +} + +static int handle_woomera_progress(struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + call_signal_event_t event; + int err=-1; + + memset(&event, 0, sizeof(event)); + + call_signal_event_init((short_signal_event_t*)&event, SIGBOOST_EVENT_CALL_PROGRESS, woomera->chan, woomera->span); + sprintf(event.isup_in_rdnis,"SMG003-EVI-2"); + event.isup_in_rdnis_size=strlen(event.isup_in_rdnis); + if (woomera->index >= 0) { + event.call_setup_id = woomera->index; + } + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + if (!woomera_check_running(woomera)) { + socket_printf(woomera->socket, "405 PROGRESS Channel already hungup%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + if (!woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + + socket_printf(woomera->socket, "405 PROGRESS Channel not aceked%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + err=isup_exec_event(&event); + if (err == 0) { + socket_printf(woomera->socket, + "200 %s PROGRESS OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + socket_printf(woomera->socket, "405 PROGRESS Boost failure%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } + + return err; +} + +static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, + struct woomera_message *wmsg, + int media, int answer, int accept) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + struct woomera_event wevent; + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + if (!woomera_check_running(woomera)) { + + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n"); + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call already hungup!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera->timeout=0; + return -1; + } + + log_printf(SMG_LOG_DEBUG_MISC, server.log,"WOOMERA: GOT %s EVENT: [%s] RAW=%s\n", + wmsg->command,wmsg->callid,raw); + + + if (raw && + woomera->raw == NULL && + !woomera_test_flag(woomera, WFLAG_RAW_MEDIA_STARTED)) { + + woomera_set_flag(woomera, WFLAG_RAW_MEDIA_STARTED); + + woomera_set_raw(woomera, raw); + + if (launch_media_thread(woomera)) { + + log_printf(SMG_LOG_DEBUG_8, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + woomera->timeout=0; + return -1; + } + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log,"ERROR! Monitor Thread not running!\n"); + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + return -1; + + } else { + + if (accept) { + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + } + + if (answer) { + struct media_session *ms; + + pthread_mutex_lock(&woomera->ms_lock); + if ((ms=woomera->ms)) { + time(&woomera->ms->answered); + } + pthread_mutex_unlock(&woomera->ms_lock); + + if (ms) { + + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_ANSWERED, + 0); + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "Sent SIGBOOST_EVENT_CALL_ANSWERED [w%dg%d]\n", + woomera->span+1,woomera->chan+1); + } else { + struct woomera_event wevent; + log_printf(SMG_LOG_ALL, server.log, + "WOOMERA ANSWER: FAILED [%s] no Media \n", + wmsg->command,wmsg->callid); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + woomera->timeout=0; + return -1; + } + } + } + + new_woomera_event_printf(&wevent, "200 %s OK%s" + "Unique-Call-Id: %s%s", + answer ? "ANSWER" : + accept ? "ACCEPT" : "MEDIA", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + return 0; +} + +static int handle_woomera_call_start (struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + call_signal_event_t event; + char *calling = woomera_message_header(wmsg, "local-number"); +#ifdef SMG_CALLING_NAME + char *calling_name = woomera_message_header(wmsg, "local-name"); +#endif + char *presentation = woomera_message_header(wmsg, "Presentation"); + char *screening = woomera_message_header(wmsg, "Screening"); + char *rdnis = woomera_message_header(wmsg, "RDNIS"); + char *bearer_cap = woomera_message_header(wmsg, "Bearer-Cap"); + char *uil1p = woomera_message_header(wmsg, "uil1p"); + char *called = wmsg->callid; + char *grp = wmsg->callid; + char *p; + int cause = 34; + int tg = 0; + int huntgroup = SIGBOOST_HUNTGRP_SEQ_ASC; + + if (smg_check_all_busy() || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + + + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, + "405 SMG Server All Ckt Busy!%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "SMG Server Full %d (ckt busy cnt=%i)\n", + server.call_count, server.all_ckt_busy); + return -1; + } + + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "New Call %d/%d\n", server.call_count, server.max_calls); + + switch(called[0]) { + case 'g': + huntgroup = SIGBOOST_HUNTGRP_SEQ_ASC; + break; + case 'G': + huntgroup = SIGBOOST_HUNTGRP_SEQ_DESC; + break; + case 'r': + huntgroup = SIGBOOST_HUNTGRP_RR_ASC; + break; + case 'R': + huntgroup = SIGBOOST_HUNTGRP_RR_DESC; + break; + default: + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "Warning: Failed to determine huntgroup (%s)\n", + called); + huntgroup = SIGBOOST_HUNTGRP_SEQ_ASC; + } + + if ((p = strchr(called, '/'))) { + *p = '\0'; + called = p+1; + tg = atoi(grp+1) - 1; + if (tg < 0) { + tg=0; + } + } + + woomera->trunk_group=tg; + if (raw) { + woomera_set_raw(woomera, raw); + } + + woomera->index = add_to_holding_tank(woomera); + if (woomera->index < 1) { + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Tanks Busy!%s", + WOOMERA_RECORD_SEPERATOR); + log_printf(SMG_LOG_ALL, woomera->log, "Error: Call Tank Full (Call Cnt=%i)\n", + server.call_count); + return -1; + } + + + woomera->index_hold = woomera->index; + + call_signal_call_init(&event, calling, called, woomera->index); + + if (presentation) { + event.calling_number_presentation = atoi(presentation); + } else { + event.calling_number_presentation = 0; + } + + if (screening) { + event.calling_number_screening_ind = atoi(screening); + } else { + event.calling_number_screening_ind = 0; + } + + event.isup_in_rdnis_size=0; + event.isup_in_rdnis[0]=0; + + if (rdnis && strlen(rdnis) ) { + + if (strlen(rdnis) > sizeof(event.isup_in_rdnis)){ + log_printf(SMG_LOG_ALL,server.log,"Error: RDNIS Overflow (in size=%i max=%i)\n", + strlen(rdnis), sizeof(event.isup_in_rdnis)); + + } else { + + strncpy(event.isup_in_rdnis,rdnis, + sizeof(event.isup_in_rdnis)-1); + event.isup_in_rdnis_size=strlen(rdnis)+1; + log_printf(SMG_LOG_DEBUG_MISC,server.log,"RDNIS %s\n", rdnis); + } + + } + + if (bearer_cap && strlen(bearer_cap)) { + event.bearer.capability = bearer_cap_to_code(bearer_cap); + woomera->bearer_cap = event.bearer.capability; + } + + if (uil1p && strlen(uil1p)) { + event.bearer.uil1p = uil1p_to_code(uil1p); + } + +#ifdef SMG_CALLING_NAME + if (calling_name) { + strncpy((char*)event.calling_name,calling_name, + sizeof(event.calling_name)-1); + } +#endif + + event.trunk_group = tg; + event.hunt_group = huntgroup; + + if (call_signal_connection_write(&server.mcon, &event) < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, + "405 SMG Signalling Contestion!%s", + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + socket_printf(woomera->socket, "100 Trying%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Call Called Event [Setup ID: %d] TG=%d\n", + woomera->index,tg); + + return 0; +} + + +static void interpret_command(struct woomera_interface *woomera, struct woomera_message *wmsg) +{ + int answer = 0, media = 0, accept=0; + char *unique_id; + int cause=0; + + + + if (!strcasecmp(wmsg->command, "call")) { + int err; + + if (strlen(woomera->session) != 0) { + /* Call has already been placed */ + socket_printf(woomera->socket, "400 Error Call already in progress %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(SMG_LOG_ALL,server.log,"Woomera RX Call Even while call in progress!\n"); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(34), + WOOMERA_LINE_SEPERATOR, + 34, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Ckt Reset!%s", WOOMERA_RECORD_SEPERATOR); + + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + err=handle_woomera_call_start(woomera,wmsg); + if (err) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + return; + + } else if (!strcasecmp(wmsg->command, "bye") || !strcasecmp(wmsg->command, "quit")) { + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (cause) { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Bye Cause Received: [%s]\n", cause); + } + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: Bye Received: [%s]\n", woomera->interface); + + woomera_clear_flag(woomera, WFLAG_RUNNING); + socket_printf(woomera->socket, "200 Connection closed%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + + } else if (!strcasecmp(wmsg->command, "listen")) { + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + socket_printf(woomera->socket, "405 Listener already started%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + + woomera_set_flag(woomera, WFLAG_LISTENING); + add_listener(woomera); + log_printf(SMG_LOG_ALL,woomera->log, "Starting Listen Device!\n"); + + socket_printf(woomera->socket, "%s", + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "200 Listener enabled%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } + return; + + } else if ((media = !strcasecmp(wmsg->command, "debug"))) { + + int debug_level=atoi(wmsg->callid); + + if (debug_level < 10) { + server.debug=debug_level; + log_printf(SMG_LOG_ALL,server.log,"SMG Debugging set to %i (window=%i)\n",server.debug,server.mcon.txwindow); + } + + return; + } + + if (!strcasecmp(wmsg->command, "hangup")) { + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + + if (q931cause && atoi(q931cause)) { + log_printf(SMG_LOG_DEBUG_8,server.log,"Woomera Hangup setting cause to %s %i\n", + q931cause,atoi(q931cause)); + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + /* Continue Through */ + } + + + + unique_id = woomera_message_header(wmsg, "Unique-Call-Id"); + if (!unique_id) { + + cause=111; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "400 Woomera cmd without uniquie id%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_CALL,server.log,"Woomera RX Event (%s) without unique id!\n",wmsg->command); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (strlen(woomera->session) == 0) { + struct woomera_interface *session_woomera=NULL; + char *session=NULL; + int span, chan; + char ifname[100]; + /* If session does not exist this is an incoming call */ + sscanf(unique_id, "w%dg%d", &span, &chan); + span--; + chan--; + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "WOOMERA Got CMD %s Span=%d Chan=%d from session %s\n", + wmsg->command,span,chan,unique_id); + + if (smg_validate_span_chan(span,chan) != 0) { + + cause=81; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Invalid span/chan in session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "WOOMERA Warning invalid span chan in session %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + pthread_mutex_lock(&server.process_lock); + session = server.process_table[span][chan].session; + session_woomera = server.process_table[span][chan].dev; + + /* This scenario is very common when we have multile clients + where multiple clients race get the incoming call */ + if (session_woomera) { + pthread_mutex_unlock(&server.process_lock); + + cause=81; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Session not found%s" + WOOMERA_RECORD_SEPERATOR); + + + log_printf(SMG_LOG_DEBUG_8, woomera->log, "WOOMERA Error channel in use %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (!session || strlen(session) == 0 || + strncmp(session,unique_id,sizeof(woomera->session))){ + pthread_mutex_unlock(&server.process_lock); + + /* Invalid call reference */ + cause=81; + socket_printf(woomera->socket, "event hangup %s" + "cause: %s%s" + "q931-cause-code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Invalid/Expired Session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "WOOMERA Warning: Cmd=%s with invalid session %s (orig=%s)\n", + wmsg->command,unique_id,session?session:"N/A"); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + +#if 1 + if (!strcasecmp(wmsg->command, "hangup")) { + int clients=server.process_table[span][chan].clients; + if (server.process_table[span][chan].clients < 0) { + + log_printf(SMG_LOG_ALL, woomera->log, "WOOMERA CMD: Warning Clients (%i) Race condition on Hangup [w%dg%d]\n", + clients, span+1,chan+1); + + } else if (server.process_table[span][chan].clients > 1) { + server.process_table[span][chan].clients--; + pthread_mutex_unlock(&server.process_lock); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Got Hungup on Multiple Clients %i, skipping hangup [w%dg%d]\n", + clients, span+1,chan+1); + + cause=16; + socket_printf(woomera->socket, "event hangup %s" + "cause: %s%s" + "q931-cause-code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Hangup on multiple session%s" + WOOMERA_RECORD_SEPERATOR); + + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Hanging up channel [w%dg%d]\n", + span+1,chan+1); + } +#endif + + server.process_table[span][chan].dev=woomera; + strncpy(woomera->session,unique_id,sizeof(woomera->session)); + sprintf(ifname,"w%dg%d",span+1,chan+1); + woomera_set_interface(woomera, ifname); + + woomera->span=span; + woomera->chan=chan; + + /* Save bearer cap that came in on incoming call event */ + woomera->bearer_cap = server.process_table[span][chan].bearer_cap; + + /* set it to 1 so that queued digits are checked on proceed message */ + woomera->check_digits = 1; + + pthread_mutex_unlock(&server.process_lock); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA Got New If=%s Session %s\n", + woomera->interface, woomera->session); + + + } else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) { + + cause=81; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Session Mis-match%s" + WOOMERA_RECORD_SEPERATOR); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (!strcasecmp(wmsg->command, "dtmf")) { + + log_printf(SMG_LOG_WOOMERA, woomera->log, + "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n", + woomera->interface, wmsg->command_args, wmsg->body); + + wanpipe_send_dtmf(woomera,wmsg->body); + + socket_printf(woomera->socket, "200 DTMF OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "hangup")) { + + int chan = -1, span = -1; + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + span=woomera->span; + chan=woomera->chan; + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Hangup Received: [%s] MEDIA EXIST Cause=%s\n", + woomera->interface,cause); + + if (smg_validate_span_chan(span,chan) != 0) { + + socket_printf(woomera->socket, "405 No Such Channel%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + } + + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "Hangup Received: [w%dg%d]\n", + span+1,chan+1); + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + + socket_printf(woomera->socket, "200 HANGUP OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if (!strcasecmp(wmsg->command, "proceed")) { + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + socket_printf(woomera->socket, + "200 %s PROCEED OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if (!strcasecmp(wmsg->command, "progress")) { + + handle_woomera_progress(woomera,wmsg); + + + } else if ((media = !strcasecmp(wmsg->command, "media")) || + (answer = !strcasecmp(wmsg->command, "answer")) || + (accept = !strcasecmp(wmsg->command, "accept"))) { + + handle_woomera_media_accept_answer(woomera, wmsg, media,answer,accept); + + + } else { + log_printf(SMG_LOG_ALL, server.log,"WOOMERA INVALID EVENT: %s [%s] \n", + wmsg->command,wmsg->callid); + socket_printf(woomera->socket, "501 Command '%s' not implemented%s", + wmsg->command, WOOMERA_RECORD_SEPERATOR); + } +} + + +/* + EVENT INCOMING 1 + Remote-Address: 10.3.3.104 + Remote-Number: + Remote-Name: Anthony Minessale!8668630501 + Protocol: H.323 + User-Agent: Post Increment Woomera 1.0alpha1 (OpenH323 v1.17.2) 9/61 + H323-Call-Id: 887b1ff8-bb1f-da11-85c0-0007e98988c4 + Local-Number: 996 + Start-Time: Fri, 09 Sep 2005 12:25:14 -0400 + Local-Name: root +*/ + + +static void handle_call_answer(short_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int kill = 0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + char callid[80]; + struct woomera_event wevent; + + woomera->timeout = 0; + + if (!woomera->raw) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to answer call with no media!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_ANSWER)) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to double-answer a call!\n"); + kill++; + goto handle_call_answer_end; + } + + woomera_set_flag(woomera, WFLAG_ANSWER); + + if (woomera->span != event->span || woomera->chan != event->chan) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to start media on a different channel from the one we agreed on.!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to answer a dead call!\n"); + kill++; + } else { + int err; + err=0; + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + woomera_set_interface(woomera, callid); +#ifndef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(SMG_LOG_ALL, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + kill++; + } +#endif + + if (!kill) { + new_woomera_event_printf(&wevent, "EVENT CONNECT w%dg%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + } + } else { + log_printf(SMG_LOG_PROD, server.log, "Answer requested on non-existant session. [w%dg%d]\n", + event->span+1, event->chan+1); + kill++; + } + +handle_call_answer_end: + + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + +/* This can casuse a double STOP + must be debugged further */ +#if 0 + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to Answer without session [w%dg%d]\n", + event->span+1, event->chan+1); +#endif + log_printf(SMG_LOG_ALL, server.log, "WARNING: Received Answer with no session [w%dg%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_ack(short_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + struct woomera_event wevent; + int kill = 0; + + if ((woomera = peek_from_holding_tank(event->call_setup_id))) { + char callid[80]; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to ack a dead call!\n"); + kill++; + } else { + int err, span, chan; + + pull_from_holding_tank(event->call_setup_id,event->span,event->chan); + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + + span = event->span; + chan = event->chan; + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + woomera_set_interface(woomera, callid); + + pthread_mutex_lock(&server.process_lock); + + if (server.process_table[span][chan].dev) { + struct woomera_interface *tmp_woomera = server.process_table[span][chan].dev; + woomera_set_flag(tmp_woomera,WFLAG_HANGUP); + woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END); + log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [w%dg%d] - Call ACK!\n", event->span+1, event->chan+1); + kill++; + } + + server.process_table[span][chan].dev = woomera; + sprintf(woomera->session,"%s-%i-%i",callid,rand(),rand()); + sprintf(server.process_table[span][chan].session,"%s-%s", + callid,woomera->session); + + + memset(server.process_table[span][chan].digits, 0, + sizeof(server.process_table[span][chan].digits)); + + server.process_table[span][chan].digits_len = 0; + + pthread_mutex_unlock(&server.process_lock); + + if (kill) { + goto woomera_call_ack_skip; + } + +#ifdef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(SMG_LOG_ALL, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id:%s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + kill++; + } +#endif + if (!kill) { + + new_woomera_event_printf(&wevent, "EVENT PROCEED w%dg%d%s" + "Channel-Name: g%d/%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->trunk_group+1, + (event->span*max_chans)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "201 Accepted%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Call Answered Event ID = %d Device = w%dg%d!\n", + event->call_setup_id,woomera->span+1,woomera->chan+1); + } + } + } else { + log_printf(SMG_LOG_PROD, server.log, + "Event (START ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id, event->call_setup_id,event->span+1, event->chan+1); + kill++; + } + +woomera_call_ack_skip: + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to CALL START ACK without session [w%dg%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_nack(short_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int span=-1, chan=-1; + int ack=0; + + /* Always ACK the incoming NACK + * Send out the NACK ACK before pulling the TANK, because + * if we send after the pull, the outgoing call could send + * a message to boost with the pulled TANK value before + * we send a NACK ACK */ + + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + if (event->call_setup_id > 0) { + woomera=peek_from_holding_tank(event->call_setup_id); + } + + if (woomera) { + + struct woomera_event wevent; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_ALL, server.log, "Event CALL START NACK on hungup call [%d]!\n", + event->call_setup_id); + ack++; + } else { + + woomera_set_cause_topbx(woomera,event->release_cause); + woomera_set_flag(woomera, (WFLAG_HANGUP|WFLAG_HANGUP_NACK_ACK)); + + new_woomera_event_printf(&wevent, "EVENT HANGUP w%dg%d%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + /* Do not ack here, let woomera thread ack it */ + ack=0; + } + + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + + if (woomera) { + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hang up */ + woomera=NULL; + } else { + /* At this point call is already hang up */ + woomera=NULL; + } + } + + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event START NACK on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + if (!woomera_test_flag(woomera,WFLAG_HANGUP)){ + if (event->release_cause == SIGBOOST_CALL_SETUP_CSUPID_DBL_USE || + event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + woomera_set_cause_topbx(woomera,17); + } else { + woomera_set_cause_topbx(woomera,event->release_cause); + } + } + + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END|WFLAG_HANGUP_NACK_ACK)); + + /* Nack Ack will be sent by the woomera thread */ + ack=0; + } else { + /* Valid state when we are not in autoacm mode */ + ack++; + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event: NACK no woomera on span chan [w%dg%d]!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(SMG_LOG_ALL, server.log, + "Error: Start Nack Invalid State Should not happen [%d] [w%dg%d]!\n", + event->call_setup_id, event->span+1, event->chan+1); + ack++; + } + + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + smg_all_ckt_busy(); + log_printf(SMG_LOG_ALL, server.log, "WARNING: All ckt busy Timeout=%i!\n",server.all_ckt_busy); + } + if (event->release_cause == SIGBOOST_CALL_SETUP_CSUPID_DBL_USE) { + log_printf(SMG_LOG_ALL, server.log, "WARNING: Double use on [w%ig%i] setup id %i!\n", + event->span+1,event->chan+1,event->call_setup_id); + } + +#warning "Ignoring CALL GAP" +#if 0 + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP) { + log_printf(SMG_LOG_ALL, server.log, "WARNING: Call Gapping Detected!\n"); + smg_all_ckt_gap(); + } +#endif + + if (ack) { + span=0; + chan=0; + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + isup_exec_command(span, + chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + if (!woomera) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id,event->call_setup_id, event->span+1, event->chan+1); + } + } +} + +static void handle_call_loop_start(short_signal_event_t *event) +{ + struct woomera_interface *woomera; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + + + log_printf(SMG_LOG_PROD, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + + woomera=launch_woomera_loop_thread(event); + if (woomera == NULL) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + log_printf(SMG_LOG_PROD, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + } + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + + return; +} + + +static void handle_call_start(call_signal_event_t *event) +{ + struct woomera_event wevent; + char callid[20]; + char *session; + struct woomera_interface *tmp_woomera=NULL; + int clients; + + remove_end_of_digits_char((unsigned char*)event->called_number_digits); + remove_end_of_digits_char((unsigned char*)event->calling_number_digits); + + if (server.strip_cid_non_digits) { + validate_number((unsigned char*)event->called_number_digits); + validate_number((unsigned char*)event->calling_number_digits); + } + + if (smg_validate_span_chan(event->span,event->chan)) { + log_printf(0,server.log, + "Error: invalid span=% chan=%i on incoming call [w%dg%d] - Call START!\n", + event->span+1, event->chan+1, event->span+1,event->chan+1); + return; + } + + pthread_mutex_lock(&server.process_lock); + + if ((tmp_woomera=server.process_table[event->span][event->chan].dev)) { + + woomera_set_flag(tmp_woomera,WFLAG_HANGUP); + woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END); + log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [w%dg%d] - Call START!\n", event->span+1, event->chan+1); + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + + log_printf(SMG_LOG_ALL, server.log, + "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + pthread_mutex_unlock(&server.process_lock); + return; + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].digits, 0, sizeof(server.process_table[event->span][event->chan].digits)); + server.process_table[event->span][event->chan].digits_len = 0; + server.process_table[event->span][event->chan].bearer_cap = event->bearer.capability; + server.process_table[event->span][event->chan].clients=0; + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + + log_printf(SMG_LOG_DEBUG_8,server.log,"BEARER %i , UIL1P = %i\n", + event->bearer.capability,event->bearer.uil1p); + + if (event->bearer.uil1p == 0) { + if (server.hw_coding) { + event->bearer.uil1p=BC_IE_UIL1P_G711_ALAW; + } else { + event->bearer.uil1p=BC_IE_UIL1P_G711_ULAW; + } + } + + new_woomera_event_printf(&wevent, "EVENT INCOMING w%dg%d%s" + "Unique-Call-Id: %s%s" + "Remote-Number: %s%s" + "Remote-Name: %s%s" +#if defined(BRI_PROT) + "Protocol: BRI%s" +#else +#if defined(PRI_PROT) + "Protocol: PRI%s" +#else + "Protocol: SS7%s" +#endif +#endif + "User-Agent: sangoma_mgd%s" + "Local-Number: %s%s" + "Channel-Name: g%d/%d%s" + "Trunk-Group: %d%s" + "Presentation: %d%s" + "Screening: %d%s" + "RDNIS: %s%s" + "Bearer-Cap: %s%s" + "uil1p: %s%s" + , + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + session, + WOOMERA_LINE_SEPERATOR, + event->calling_number_digits, + WOOMERA_LINE_SEPERATOR, + event->calling_name, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + event->called_number_digits, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + (event->span*max_chans)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + WOOMERA_LINE_SEPERATOR, + event->calling_number_presentation, + WOOMERA_LINE_SEPERATOR, + event->calling_number_screening_ind, + WOOMERA_LINE_SEPERATOR, + event->isup_in_rdnis, + WOOMERA_LINE_SEPERATOR, + bearer_cap_to_str(event->bearer.capability), + WOOMERA_LINE_SEPERATOR, + uil1p_to_str(event->bearer.uil1p), + WOOMERA_RECORD_SEPERATOR + ); + + clients=enqueue_event_on_listeners(&wevent); + if (!clients) { + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + 17); + log_printf(SMG_LOG_ALL, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + log_printf(SMG_LOG_ALL, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + } + + } else { + server.process_table[event->span][event->chan].clients=clients; + } + + destroy_woomera_event_data(&wevent); + +} + +static void handle_incoming_digit(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + int digits_len; + + if (smg_validate_span_chan(event->span,event->chan)) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event DTMF on invalid span chan [w%dg%d] !\n", + event->span+1, event->chan+1); + return; + } + + + if (!event->called_number_digits_count) { + log_printf(SMG_LOG_ALL, server.log, "Error Incoming digit with len %s %d [w%dg%d]\n", + event->called_number_digits, + event->called_number_digits_count, + event->span+1, event->chan+1); + } + + log_printf(SMG_LOG_DEBUG_9, server.log, "Queuing incoming digits %s [w%dg%d]\n", + event->called_number_digits, + event->span+1, event->chan+1); + + pthread_mutex_lock(&server.digits_lock); + + digits_len = server.process_table[event->span][event->chan].digits_len; + + strncpy(&server.process_table[event->span][event->chan].digits[digits_len], + event->called_number_digits, + event->called_number_digits_count); + + server.process_table[event->span][event->chan].digits_len += event->called_number_digits_count; + + pthread_mutex_unlock(&server.digits_lock); + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + if (!woomera || !strlen(woomera->session)) { + return; + } + woomera_check_digits(woomera); +} + +static void handle_gap_abate(short_signal_event_t *event) +{ + log_printf(SMG_LOG_ALL, server.log, "NOTICE: GAP Cleared!\n", + event->span+1, event->chan+1); + smg_clear_ckt_gap(); +} + +static void handle_restart(call_signal_connection_t *mcon, short_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + /* Clear Reset */ + /* Tell all threads to go down */ + + log_printf(SMG_LOG_ALL, server.log, + "RESTART Received: resetting all threads\n"); + + smg_all_ckt_busy(); + woomera_set_flag(&server.master_connection, WFLAG_SYSTEM_RESET); + gettimeofday(&server.restart_timeout,NULL); + +#if 0 + sleep(5); + + clear_all_holding_tank(); + + sleep(2); + + event->event_id = SIGBOOST_EVENT_SYSTEM_RESTART_ACK; + err=call_signal_connection_write(&server.mcon, (call_signal_event_t*)event); + if (err < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + + smg_all_ckt_busy(); + woomera_clear_flag(&server.master_connection, WFLAG_SYSTEM_RESET); +#endif + } + +} + +static void handle_restart_ack(call_signal_connection_t *mcon, short_signal_event_t *event) +{ + + /* Do not reset WFLAG_SYSTEM_RESET flag here!. The flag should + only be reset on restart from boost */ + //woomera_clear_flag(&server.master_connection, WFLAG_SYSTEM_RESET); +} + + + +static void handle_remove_loop(short_signal_event_t *event) +{ + struct woomera_interface *woomera; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + server.process_table[event->span][event->chan].dev=NULL; + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP)); + + /* We have to close the socket because + At this point we are release span chan */ + + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event REMOVE LOOP on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } +} + + +static void handle_call_stop(short_signal_event_t *event) +{ + struct woomera_interface *woomera; + int ack=0; + + woomera = NULL; + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + if (woomera) { + + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + //server.process_table[event->span][event->chan].dev=NULL; + + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hangup */ + woomera=NULL; + } else { + /* At this point call is already hangup */ + woomera=NULL; + } + } + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + woomera_set_cause_topbx(woomera,event->release_cause); + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP|WFLAG_HANGUP_ACK)); + + /* We have to close the socket because + At this point we are release span chan */ + + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } else { + ack++; + } + + + if (ack) { + /* At this point we have already sent our STOP so its safe to ACK */ + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); + } + + if (!woomera){ + /* This is allowed on incoming call if remote app does not answer it */ + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP referrs to a non-existant session [w%dg%d]!\n", + event->span+1, event->chan+1); + } +} + +static void handle_heartbeat(short_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + int err=call_signal_connection_writep(&server.mconp, (call_signal_event_t*)event); + if (err < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + } + return; +} + + +static void handle_call_stop_ack(short_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Stop Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id, + woomera->interface); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + } else { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->event_id, event->span+1, event->chan+1, event->call_setup_id); + } + + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id, NULL); + } + + /* No need for us to do any thing here */ + return; +} + + +static void handle_call_start_nack_ack(short_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + if ((woomera=pull_from_holding_tank(event->call_setup_id,-1,-1))) { + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + } else { + /* Possible if incoming call is NACKed due to + * woomera client being down, in this case no + * woomera thread is created */ + log_printf(SMG_LOG_DEBUG_8, server.log, + "Event NACK ACK [w%dg%d] with valid span/chan no dev!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "Event NACK ACK referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } + + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id, NULL); + } + + /* No need for us to do any thing here */ + return; +} + + +static int parse_ss7_event(call_signal_connection_t *mcon, short_signal_event_t *event) +{ + int ret = 0; + + switch(event->event_id) { + + case SIGBOOST_EVENT_CALL_START: + handle_call_start((call_signal_event_t*)event); + break; + case SIGBOOST_EVENT_CALL_STOPPED: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_CALL_START_ACK: + handle_call_start_ack(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK: + handle_call_start_nack(event); + break; + case SIGBOOST_EVENT_CALL_ANSWERED: + handle_call_answer(event); + break; + case SIGBOOST_EVENT_HEARTBEAT: + handle_heartbeat(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK_ACK: + handle_call_start_nack_ack(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED_ACK: + handle_call_stop_ack(event); + break; + case SIGBOOST_EVENT_INSERT_CHECK_LOOP: + handle_call_loop_start(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART: + handle_restart(mcon,event); + break; + case SIGBOOST_EVENT_REMOVE_CHECK_LOOP: + handle_remove_loop(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART_ACK: + handle_restart_ack(mcon,event); + break; + case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE: + handle_gap_abate(event); + break; + case SIGBOOST_EVENT_DIGIT_IN: + handle_incoming_digit((call_signal_event_t*)event); + break; + default: + log_printf(SMG_LOG_ALL, server.log, "Warning no handler implemented for [%s val:%d]\n", + call_signal_event_id_name(event->event_id), event->event_id); + break; + } + + return ret; +} + + +static void *monitor_thread_run(void *obj) +{ + int ss = 0; + int policy=0,priority=0; + char a=0,b=0; + call_signal_connection_t *mcon=&server.mcon; + call_signal_connection_t *mconp=&server.mconp; + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + + if (call_signal_connection_open(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(SMG_LOG_ALL, server.log, "Error: Opening MCON Socket [%d] %s\n", + mcon->socket,strerror(errno)); + exit(-1); + } + + if (call_signal_connection_open(mconp, + mconp->cfg.local_ip, + mconp->cfg.local_port, + mconp->cfg.remote_ip, + mconp->cfg.remote_port) < 0) { + log_printf(SMG_LOG_ALL, server.log, "Error: Opening MCONP Socket [%d] %s\n", + mconp->socket,strerror(errno)); + exit(-1); + } + + mcon->log = server.log; + mconp->log = server.log; + + isup_exec_commandp(0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + + woomera_set_flag(&server.master_connection, WFLAG_SYSTEM_RESET); + + smg_get_current_priority(&policy,&priority); + + log_printf(SMG_LOG_PROD, server.log, "Open udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + log_printf(SMG_LOG_PROD, server.log, "Monitor Thread Started (%i:%i)\n",policy,priority); + + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { +#if 0 + ss = waitfor_socket(server.mcon.socket, 1000, POLLERR | POLLIN); +#else + ss = waitfor_2sockets(mcon->socket, + mconp->socket, + &a, &b, 1000); +#endif + + if (ss > 0) { + + call_signal_event_t *event=NULL; + int i=0; + + if (b) { +mcon_retry_priority: + if ((event = call_signal_connection_readp(mconp,i))) { + log_printf(SMG_LOG_DEBUG_9, server.log, "Socket Event P [%s] \n", + call_signal_event_id_name(event->event_id)); + parse_ss7_event(mconp,(short_signal_event_t*)event); + if (++i < 10) { + goto mcon_retry_priority; + } + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(SMG_LOG_ALL, server.log, + "Error: Reading from Boost P Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + i=0; + + if (a) { + if ((event = call_signal_connection_read(mcon,i))) { + log_printf(SMG_LOG_DEBUG_9, server.log, "Socket Event [%s]\n", + call_signal_event_id_name(event->event_id)); + parse_ss7_event(mcon,(short_signal_event_t*)event); + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(SMG_LOG_ALL, server.log, + "Error: Reading from Boost Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + } + + if (ss < 0){ + log_printf(SMG_LOG_ALL, server.log, "Thread Run: Select Socket Error!\n"); + break; + } + + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)) { + short_signal_event_t event; + struct timeval current; + int elapsed; + gettimeofday(¤t,NULL); + + elapsed=smg_calc_elapsed(&server.restart_timeout, ¤t); + if (elapsed > 5000) { + int err; + log_printf(SMG_LOG_ALL, server.log, "Reset Condition Cleared Elapsed=%i!\n",elapsed); + clear_all_holding_tank(); + memset(&event,0,sizeof(event)); + event.event_id = SIGBOOST_EVENT_SYSTEM_RESTART_ACK; + err=call_signal_connection_write(&server.mcon, (call_signal_event_t*)&event); + if (err < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + smg_all_ckt_busy(); + woomera_clear_flag(&server.master_connection, WFLAG_SYSTEM_RESET); + } + } + + } + + log_printf(SMG_LOG_PROD, server.log, "Close udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + call_signal_connection_close(&server.mcon); + call_signal_connection_close(&server.mconp); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + log_printf(SMG_LOG_ALL, server.log, "Monitor Thread Ended\n"); + + return NULL; +} + +static void woomera_loop_thread_run(struct woomera_interface *woomera) +{ + int err=launch_media_thread(woomera); + if (err) { + log_printf(SMG_LOG_ALL, server.log, "Failed to start loop media thread\n"); + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + return; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + !woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + usleep(300000); + continue; + + } + + woomera_clear_flag(woomera, WFLAG_RUNNING); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Woomera Session: For Loop Test exiting %s\n",woomera->interface); + + return; +} + +static void woomera_check_digits (struct woomera_interface *woomera) +{ + int span, chan; + + if (!strlen(woomera->session)) { + return; + } + + if (get_span_chan_from_interface(woomera->interface, &span, &chan) == 0) { + pthread_mutex_lock(&server.digits_lock); + if (server.process_table[span-1][chan-1].digits_len > 0) { + int i; + unsigned char digit; + + for (i=0; i < server.process_table[span-1][chan-1].digits_len; i++) { + digit = server.process_table[span-1][chan-1].digits[i]; + + handle_event_dtmf(woomera, digit); + } + + server.process_table[span-1][chan-1].digits_len = 0; + } + pthread_mutex_unlock(&server.digits_lock); + } +} + + +static void *woomera_thread_run(void *obj) +{ + struct woomera_interface *woomera = obj; + struct woomera_message wmsg; + struct woomera_event wevent; + char *event_string; + int mwi; + int err; + int policy=0, priority=0; + int span = -1, chan = -1; + + woomera_message_init(&wmsg); + + smg_get_current_priority(&policy,&priority); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "WOOMERA session started (ptr=%p : loop=%i)(%i:%i) Index=%i\n", + woomera,woomera->loop_tdm,policy,priority, woomera->index); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_mutex_init(&woomera->queue_lock, NULL); + pthread_mutex_init(&woomera->ms_lock, NULL); + pthread_mutex_init(&woomera->dtmf_lock, NULL); + pthread_mutex_init(&woomera->vlock, NULL); + pthread_mutex_init(&woomera->flags_lock, NULL); + + if (woomera->loop_tdm) { + /* We must set woomera socket to -1 otherwise + a valid file descriptor will get closed */ + woomera->socket = -1; + woomera_loop_thread_run(woomera); + goto woomera_session_close; + } + + err=socket_printf(woomera->socket, + "EVENT HELLO Sangoma Media Gateway%s" + "Supported-Protocols: TDM%s" + "Version: %s%s" + "Remote-Address: %s%s" + "Remote-Port: %d%s" + "Raw-Format: %s%s", + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + SMG_VERSION, WOOMERA_LINE_SEPERATOR, + inet_ntoa(woomera->addr.sin_addr), WOOMERA_LINE_SEPERATOR, + ntohs(woomera->addr.sin_port), WOOMERA_LINE_SEPERATOR, + server.hw_coding?"ALAW":"ULAW", WOOMERA_RECORD_SEPERATOR + ); + + if (err) { + log_printf(SMG_LOG_ALL, server.log, "Woomera session socket failure! (ptr=%p)\n", + woomera); + woomera_clear_flag(woomera, WFLAG_RUNNING); + goto woomera_session_close; + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + woomera_test_flag(woomera, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + mwi = woomera_message_parse(woomera, &wmsg, WOOMERA_HARD_TIMEOUT); + if (mwi >= 0) { + + if (mwi) { + interpret_command(woomera, &wmsg); + } else if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + if (socket_printf(woomera->socket, "%s", event_string)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + smg_free(event_string); + log_printf(SMG_LOG_DEBUG_8, server.log, + "WOOMERA session (ptr=%p) print string error\n", + woomera); + break; + } + smg_free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + if(woomera->check_digits) { + woomera_check_digits(woomera); + woomera->check_digits = 0; + } + + if (woomera->timeout > 0 && time(NULL) >= woomera->timeout) { + + /* Sent the hangup only after we sent a NACK */ + + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "WOOMERA session Call Timedout ! [%s]\n", + woomera->interface); + + /* Let the Index check below send a NACK */ + if (woomera->index) { + woomera->q931_rel_cause_tosig=19; + woomera_set_flag(woomera, WFLAG_HANGUP); + } + break; + } + + } else { + log_printf(SMG_LOG_DEBUG_MISC, server.log, "WOOMERA session (ptr=%p) [%s] READ MSG Error %i \n", + woomera,woomera->interface,mwi); + break; + } + + } + +woomera_session_close: + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "WOOMERA session (ptr=%p) is dying [%s]: SR=%d WR=%d WF=0x%04X\n", + woomera,woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_RUNNING), + woomera->flags); + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + usleep(100); + sched_yield(); + } + } + + + /*********************************************** + * Identify the SPAN CHAN to be used below + ***********************************************/ + + chan = woomera->chan; + span = woomera->span; + + + if (!woomera_test_flag(woomera, WFLAG_HANGUP)) { + + /* The call was not HUNGUP. This is the last check, + If the call is valid, hungup the call if the call + was never up the keep going */ + + + if (smg_validate_span_chan(span,chan) == 0) { + + if (!woomera->index) { + + if (autoacm || woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT); + + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } else { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } + } else { + log_printf(SMG_LOG_ALL, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + + } + }else{ + /* This can happend if an outgoing call times out + or gets hungup before it gets acked. Its not a + failure */ + if (!woomera->index) { + /* In this case we really failed to tx STOP */ + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + + } + +woo_re_hangup: + + /* We must send a STOP ACK to boost telling it that we are done */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + + /* SMG received a HANGUP from boost. + We must now send back the ACK to the HANGUP. + Boost will not release channel until we + ACK the hangup */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + }else{ + /* This should never happen! If it does + we broke protocol */ + log_printf(SMG_LOG_ALL, woomera->log, + "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_ACK); + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + + /* SMG received a NACK from boost during call startup. + We must now send back the ACK to the NACK. + Boost will not release channel until we + ACK the NACK */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + woomera->index=0; + + } else if (woomera->index) { + isup_exec_command(0, + 0, + woomera->index, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + woomera->index=0; + + } else { + log_printf(SMG_LOG_ALL, woomera->log, + "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + + } + + if (woomera->index) { + + int index = woomera->index; + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Timeout: %ld%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + woomera->timeout, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(18), + WOOMERA_LINE_SEPERATOR, + 18, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + smg_free(event_string); + } + + if (peek_from_holding_tank(index)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(0, + 0, + index, + SIGBOOST_EVENT_CALL_START_NACK, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] .. WAITING FOR NACK ACK\n", + index); + } else { + log_printf(SMG_LOG_PROD, woomera->log, + "Error Failed to Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] - index stale!\n", + index); + } + } + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent NACK to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + timeout_cnt++; + if (timeout_cnt > 100) { //5sec timeout + timeout_cnt=0; + overall_cnt++; + + log_printf((overall_cnt==1)?0:4, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] ... \n", + woomera->index_hold); + } + + if (overall_cnt > 15) { //50sec timeout + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + break; + } + + /* If ACK comes in while we wait for NACK ACK, the ACk will + clear the tank causing NACK ACK never to clear the waiting flag + in this case we abort waiting for NACK ACK and we timeout + the wait */ + if (woomera_test_flag(&server.master_connection, WFLAG_CALL_ACKED)){ + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + usleep(50000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + /* If ACK came in while waiting for NACK ACK, we TIMEOUT on purpose. + The ACK has blocked the tank id and now ony NACK ACK can unblock it. + THe only problem is that we blind and have to assume that NACK ACK + will eventually come in :) */ + if (!woomera_test_flag(&server.master_connection, WFLAG_CALL_ACKED)) { + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", + woomera->index_hold); + + } else { + log_printf(SMG_LOG_DEBUG_8, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", + woomera->index_hold); + } + } + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + smg_free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent HANGUP to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + log_printf(SMG_LOG_DEBUG_8, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + timeout_cnt++; + if (timeout_cnt > 100) { //5sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf((overall_cnt==1)?0:4, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i] %i... \n", + woomera->interface,woomera->index_hold,overall_cnt); + } + + if (overall_cnt > 15) { //50sec + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + break; + } + + usleep(50000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + } else { + log_printf(SMG_LOG_DEBUG_8, woomera->log, + "Wait GOT STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + } + } + + /***************************************************** + * We must wait for WFLAG_WAIT_FOR_STOPPED_ACK here + * so that STOP_ACK can access the woomera + *****************************************************/ + + if (smg_validate_span_chan(span,chan) == 0) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "WOOMERA Clearing Processs Table ... \n", + woomera->interface); + pthread_mutex_lock(&server.process_lock); + if (server.process_table[span][chan].dev == woomera){ + server.process_table[span][chan].dev = NULL; + memset(server.process_table[span][chan].session,0,SMG_SESSION_NAME_SZ); + memset(server.process_table[span][chan].digits,0, + sizeof(server.process_table[span][chan].digits)); + server.process_table[span][chan].digits_len = 0; + } + pthread_mutex_unlock(&server.process_lock); + } + +#if 0 +//Used for testing + if (1) { + int chan = woomera->chan; + int span = woomera->span; + if (smg_validate_span_chan(span,chan) == 0) { + pthread_mutex_lock(&server.process_lock); + /* This is possible in case media thread dies on startup */ + + if (server.process_table[span][chan]){ + log_printf(SMG_LOG_ALL, server.log, + "Sanity Span Chan Still in use: [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + //server.process_table[span][chan] = NULL; + } + pthread_mutex_unlock(&server.process_lock); + } + } +#endif + + usleep(3000000); + + /* Sanity Check */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP ACK\n"); + goto woo_re_hangup; + } + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP NACK ACK\n"); + goto woo_re_hangup; + } + + + /* This is where we actually pull the index + * out of the tank. We had to keep the tank + * value until the end of the call. Tank is only + * used on outgoing calls. */ + if (woomera->index_hold >= 1) { + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT)) { + /* Replace real woomera interface with a dummy so + the tank is blocked. The real woomera interface will be + deallocated */ + pull_from_holding_tank(woomera->index_hold,-1,-1); + + if (check_tank_index(woomera->index_hold) != NULL){ + log_printf(SMG_LOG_PROD, woomera->log, "Woomera Thread: [%s] setup id %i blocked waiting for NACK or ACK\n", + woomera->interface ,woomera->index_hold); + } + } else { + clear_from_holding_tank(woomera->index_hold, woomera); + + } + woomera->index_hold=0; + } + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "Woomera Thread Finished %u\n", (unsigned long) woomera->thread); + close_socket(&woomera->socket); + woomera->socket=-1; + + /* delete queue */ + while ((event_string = dequeue_event(woomera))) { + smg_free(event_string); + } + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + del_listener(woomera); + } + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "WOOMERA session for [%s] stopped (ptr=%p)\n", + woomera->interface,woomera); + + pthread_mutex_destroy(&woomera->queue_lock); + pthread_mutex_destroy(&woomera->ms_lock); + pthread_mutex_destroy(&woomera->dtmf_lock); + pthread_mutex_destroy(&woomera->vlock); + pthread_mutex_destroy(&woomera->flags_lock); + woomera_set_raw(woomera, NULL); + woomera_set_interface(woomera, NULL); + + woomera_message_clear(&wmsg); + + smg_free(woomera); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count--; + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_exit(NULL); + return NULL; +} + + +static int launch_woomera_thread(struct woomera_interface *woomera) +{ + int result = 0; + pthread_attr_t attr; + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_RUNNING); + result = pthread_create(&woomera->thread, &attr, woomera_thread_run, woomera); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Woomera Thread! (%i) %s\n", + __FUNCTION__,result,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + +static int launch_monitor_thread(void) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 10; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + log_printf(SMG_LOG_ALL,server.log,"%s: Old Priority =%i res=%i \n",__FUNCTION__, + param.sched_priority,result); + + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + result = pthread_create(&server.monitor_thread, &attr, monitor_thread_run, NULL); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +#ifdef WP_HPTDM_API +static void *hp_tdmapi_span_run(void *obj) +{ + hp_tdm_api_span_t *span = obj; + int err; + + log_printf(SMG_LOG_ALL,server.log,"Starting %s span!\n",span->ifname); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + if (!span->run_span) { + break; + } + + err = span->run_span(span); + if (err) { + break; + } + + } + + if (span->close_span) { + span->close_span(span); + } + + sleep(3); + log_printf(SMG_LOG_ALL,server.log,"Stopping %s span!\n",span->ifname); + + pthread_exit(NULL); +} + + +static int launch_hptdm_api_span_thread(int span) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 5; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + result = pthread_create(&server.monitor_thread, &attr, hp_tdmapi_span_run, &hptdmspan[span]); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + } + pthread_attr_destroy(&attr); + + return result; +} +#endif + +static int configure_server(void) +{ + struct woomera_config cfg; + char *var, *val; + int cnt = 0; + + server.dtmf_intr_ch = -1; + + if (!woomera_open_file(&cfg, server.config_file)) { + log_printf(SMG_LOG_ALL, server.log, "open of %s failed\n", server.config_file); + return 0; + } + + log_printf(SMG_LOG_ALL,server.log, "\n======================= \n"); + log_printf(SMG_LOG_ALL,server.log, "Server - Configuration \n"); + log_printf(SMG_LOG_ALL,server.log, "======================= \n"); + + while (woomera_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(var, "boost_local_ip")) { + strncpy(server.mcon.cfg.local_ip, val, + sizeof(server.mcon.cfg.local_ip) -1); + strncpy(server.mconp.cfg.local_ip, val, + sizeof(server.mconp.cfg.local_ip) -1); + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Local IP: %s\n",val); + + cnt++; + } else if (!strcasecmp(var, "boost_local_port")) { + server.mcon.cfg.local_port = atoi(val); + server.mconp.cfg.local_port = + server.mcon.cfg.local_port+1; + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Local Port: %i\n",server.mcon.cfg.local_port); + cnt++; + } else if (!strcasecmp(var, "boost_remote_ip")) { + strncpy(server.mcon.cfg.remote_ip, val, + sizeof(server.mcon.cfg.remote_ip) -1); + strncpy(server.mconp.cfg.remote_ip, val, + sizeof(server.mconp.cfg.remote_ip) -1); + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Remote IP: %s\n",server.mcon.cfg.remote_ip); + cnt++; + } else if (!strcasecmp(var, "boost_remote_port")) { + server.mcon.cfg.remote_port = atoi(val); + server.mconp.cfg.remote_port = + server.mcon.cfg.remote_port+1; + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Remote Port: %i\n",server.mcon.cfg.local_port); + cnt++; + } else if (!strcasecmp(var, "logfile_path")) { + if (!server.logfile_path) { + server.logfile_path = smg_strdup(val); + } + } else if (!strcasecmp(var, "woomera_port")) { + server.port = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Woomera Port: %i\n",server.port); + } else if (!strcasecmp(var, "debug_level")) { + server.debug = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Debug Level: %i\n",server.debug); + } else if (!strcasecmp(var, "out_tx_test")) { + server.out_tx_test = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Tx Media Dbg: %s\n",server.out_tx_test?"On":"Off (Default)"); + } else if (!strcasecmp(var, "loop_trace")) { + server.loop_trace = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Media Loop Trace: %s\n",server.loop_trace?"On":"Off (Default)"); + } else if (!strcasecmp(var, "rxgain")) { + server.rxgain = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Rx Gain: %d\n",server.rxgain); + } else if (!strcasecmp(var, "txgain")) { + server.txgain = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Tx Gain: %d\n",server.txgain); + } else if (!strcasecmp(var, "dtmf_on_duration")){ + server.dtmf_on = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - DTMF ON Duration: %d ms\n",server.dtmf_on); + } else if (!strcasecmp(var, "dtmf_off_duration")){ + server.dtmf_off = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - DTMF Off Duration: %d ms\n",server.dtmf_off); + } else if (!strcasecmp(var, "dtmf_inter_ch_duration")){ + server.dtmf_intr_ch = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - DTMF Spacing: %d\n",server.dtmf_intr_ch); + } else if (!strcasecmp(var, "strip_cid_non_digits")){ + server.strip_cid_non_digits = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Strip non digits: %d\n",server.strip_cid_non_digits); + } else if (!strcasecmp(var, "max_calls")) { + int max = atoi(val); + if (max > 0) { + server.max_calls = max; + log_printf(SMG_LOG_ALL,server.log, "Server - Max Active Calls: %d\n",server.max_calls); + } + } else if (!strcasecmp(var, "autoacm")) { + int max = atoi(val); + if (max >= 0) { + autoacm=max; + log_printf(SMG_LOG_ALL,server.log, "Server - Auto ACM: %s\n",autoacm?"On":"Off (Default)"); + } + } else if (!strcasecmp(var, "max_spans")) { + int max = atoi(val); + if (max > 0) { + max_spans = max; + log_printf(SMG_LOG_ALL,server.log, "Server - Max Spans: %d\n",max_spans); + } + } else if (!strcasecmp(var, "call_timeout")) { + int max = atoi(val); + if (max >= 0) { + server.call_timeout=max; + } else { + server.call_timeout=SMG_DEFAULT_CALL_TIMEOUT; + } + log_printf(SMG_LOG_ALL,server.log, "Server - Call Comp Timeout: %d s\n",server.call_timeout); + + } else if (!strcasecmp(var, "base_media_port")) { + int base = atoi(val); + if (base >= 0) { + server.base_media_port = base; + server.next_media_port = base; + server.max_media_port = server.base_media_port + WOOMERA_MAX_MEDIA_PORTS; + log_printf(SMG_LOG_ALL,server.log, "Server - Base Media Port: %d\n",server.base_media_port); + } + + } else if (!strcasecmp(var, "max_media_ports")) { + int max = atoi(val); + if (max >= 0) { + server.max_media_port = server.base_media_port+max; + log_printf(SMG_LOG_ALL,server.log, "Server - Max Media Port: %d\n",server.max_media_port); + } + + } else if (!strcasecmp(var, "media_ip")) { + strncpy(server.media_ip, val, sizeof(server.media_ip) -1); + log_printf(SMG_LOG_ALL,server.log, "Server - Media IP: %s\n",server.media_ip); + } else { + log_printf(SMG_LOG_ALL, server.log, "Invalid Option %s at line %d!\n", var, cfg.lineno); + } + } + + log_printf(SMG_LOG_ALL,server.log, "======================= \n\n"); + + /* Post initialize */ + if (server.dtmf_on == 0){ + server.dtmf_on=SMG_DTMF_ON; + } + if (server.dtmf_off == 0) { + server.dtmf_off=SMG_DTMF_OFF; + } + if (server.dtmf_intr_ch == -1) { + server.dtmf_intr_ch = 0; + } + server.dtmf_size=(server.dtmf_on+server.dtmf_off)*10*2; + + log_printf(SMG_LOG_ALL,server.log, "DTMF On=%i Off=%i IntrCh=%i Size=%i\n", + server.dtmf_on,server.dtmf_off,server.dtmf_intr_ch,server.dtmf_size); + + woomera_close_file(&cfg); + return cnt == 4 ? 1 : 0; +} + + + +static int main_thread(void) +{ + + struct sockaddr_in sock_addr, client_addr; + struct woomera_interface *new_woomera; + int client_sock = -1, pid = 0; + unsigned int len = 0; + FILE *tmp; + + if ((server.master_connection.socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + fprintf(stderr,"%s:%d socket() failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + return 1; + } + + memset(&sock_addr, 0, sizeof(sock_addr)); /* Zero out structure */ + sock_addr.sin_family = AF_INET; /* Internet address family */ + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ + sock_addr.sin_port = htons(server.port); /* Local port */ + + /* Bind to the local address */ + if (bind(server.master_connection.socket, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0) { + fprintf(stderr,"%s:%d socket() bind %i failed %s\n",__FUNCTION__,__LINE__,server.port,strerror(errno)); + log_printf(SMG_LOG_ALL, server.log, "bind(%d) failed\n", server.port); + return 1; + } + + /* Mark the socket so it will listen for incoming connections */ + if (listen(server.master_connection.socket, MAXPENDING) < 0) { + fprintf(stderr,"%s:%d socket() listen failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + log_printf(SMG_LOG_ALL, server.log, "listen() failed\n"); + return 1; + } + + if ((pid = get_pid_from_file(PIDFILE))) { + fprintf(stderr,"%s:%d get pid file failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + log_printf(SMG_LOG_ALL, stderr, "pid %d already exists.\n", pid); + exit(0); + } + + if (!(tmp = safe_fopen(PIDFILE, "w"))) { + fprintf(stderr,"%s:%d open pid file failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + log_printf(SMG_LOG_ALL, stderr, "Error creating pidfile %s\n", PIDFILE); + return 1; + } else { + fprintf(tmp, "%d", getpid()); + fclose(tmp); + tmp = NULL; + } + + no_nagle(server.master_connection.socket); + +#if 0 + if (1) { + int span,chan; + call_signal_event_t event; +#if 0 + span=1; + chan=30; + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); +#else + for (span=0;span<8;span++) { + for (chan=0;chan<31;chan++) { + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); + } + } +#endif + } +#endif + +#ifdef WP_HPTDM_API + if (1) { + int span; + for (span=0;span<16;span++) { + hptdmspan[span] = sangoma_hptdm_api_span_init(span); + if (!hptdmspan[span]) { + break; + } else { + log_printf(SMG_LOG_ALL, server.log, "HP TDM API Span: %d configured...\n", + span); + launch_hptdm_api_span_thread(span); + } + } + } +#endif + + log_printf(SMG_LOG_PROD, server.log, "Main Process Started: Woomera Ready port: %d\n", server.port); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + /* Set the size of the in-out parameter */ + len = sizeof(client_addr); + + /* Wait for a client to connect */ + if ((client_sock = accept(server.master_connection.socket, (struct sockaddr *) &client_addr, &len)) < 0) { + /* Check if we are supposed to stop */ + if(!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log, "accept() stopped\n"); + return 0; + } + log_printf(SMG_LOG_ALL, server.log, "accept() failed\n"); + return 1; + } + + if ((new_woomera = new_woomera_interface(client_sock, &client_addr, len))) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Starting Thread for New Connection %s:%d Sock=%d\n", + inet_ntoa(new_woomera->addr.sin_addr), + ntohs(new_woomera->addr.sin_port), + client_sock); + + pthread_mutex_lock(&server.thread_count_lock); + server.call_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + + if (launch_woomera_thread(new_woomera)) { + socket_printf(new_woomera->socket, + "501 call was cancelled!%s", + WOOMERA_RECORD_SEPERATOR); + + close_socket(&new_woomera->socket); + new_woomera->socket=-1; + smg_free(new_woomera); + log_printf(SMG_LOG_ALL, server.log, "ERROR: failed to launch woomera thread\n"); + } + } else { + log_printf(SMG_LOG_ALL, server.log, "Critical ERROR: memory/socket error\n"); + } + } + + log_printf(SMG_LOG_PROD, server.log, "Main Process End\n"); + + return 0; +} + +static int do_ignore(int sig) + +{ +#ifdef SMG_DROP_SEQ + drop_seq=4; +#endif + sdla_memdbg_free(0); + return 0; +} + +static int do_shut(int sig) +{ + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + close_socket(&server.master_connection.socket); + log_printf(SMG_LOG_PROD, server.log, "Caught SIG %d, Closing Master Socket!\n", sig); + return 0; +} + +static int sangoma_tdm_init (int span) +{ +#ifdef LIBSANGOMA_GET_HWCODING + wanpipe_tdm_api_t tdm_api; + int fd=sangoma_open_tdmapi_span(span); + if (fd < 0 ){ + return -1; + } else { + server.hw_coding=sangoma_tdm_get_hw_coding(fd,&tdm_api); + close_socket(&fd); + } +#else +#error "libsangoma missing hwcoding feature: not up to date!" +#endif + return 0; +} + +static int woomera_startup(int argc, char **argv) +{ + int x = 0, pid = 0, bg = 0; + int span_cnt, chan_cnt; + char *cfg=NULL, *debug=NULL, *arg=NULL; + + while((arg = argv[x++])) { + + if (!strcasecmp(arg, "-hup")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(SMG_LOG_ALL, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(SMG_LOG_ALL, stderr, "Killing PID %d\n", pid); + kill(pid, SIGHUP); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-term") || !strcasecmp(arg, "--term")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(SMG_LOG_ALL, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(SMG_LOG_ALL, stderr, "Killing PID %d\n", pid); + kill(pid, SIGTERM); + unlink(PIDFILE); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-version")) { + fprintf(stdout, "\nSangoma Media Gateway: Version %s\n\n", SMG_VERSION); + exit(0); + + } else if (!strcasecmp(arg, "-help")) { + fprintf(stdout, "%s\n%s [-help] | [ -version] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(0); + } else if (!strcasecmp(arg, "-wipe")) { + unlink(PIDFILE); + } else if (!strcasecmp(arg, "-bg")) { + bg = 1; + + } else if (!strcasecmp(arg, "-g")) { + coredump = 1; + + } else if (!strcasecmp(arg, "-debug")) { + if (argv[x] && *(argv[x]) != '-') { + debug = argv[x++]; + } + } else if (!strcasecmp(arg, "-cfg")) { + if (argv[x] && *(argv[x]) != '-') { + cfg = argv[x++]; + } + } else if (!strcasecmp(arg, "-log")) { + if (argv[x] && *(argv[x]) != '-') { + server.logfile_path = smg_strdup(argv[x++]); + } + } else if (*arg == '-') { + log_printf(SMG_LOG_ALL, stderr, "Unknown Option %s\n", arg); + fprintf(stdout, "%s\n%s [-help] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(1); + } + } + + if (1){ + int spn; + for (spn=1;spn<=WOOMERA_MAX_SPAN;spn++) { + if (sangoma_tdm_init(spn) == 0) { + break; + } + } + if (spn>WOOMERA_MAX_SPAN) { + printf("\nError: Failed to access a channel on spans 1-16\n"); + printf(" Please start Wanpipe TDM API drivers\n"); + return 0; + } + } + + if (bg && (pid = fork())) { + log_printf(SMG_LOG_ALL, stderr, "Backgrounding!\n"); + return 0; + } + + for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) { + for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) { + pthread_mutex_init(&server.process_table[span_cnt][chan_cnt].media_lock, NULL); + } + } + + q931_cause_setup(); + bearer_cap_setup(); + uil1p_to_str_setup(); + + server.port = 42420; + server.debug = 0; + strcpy(server.media_ip, "127.0.0.1"); + server.base_media_port = WOOMERA_MIN_MEDIA_PORT; + server.max_media_port = WOOMERA_MAX_MEDIA_PORT; + server.next_media_port = server.base_media_port; + server.log = stdout; + server.master_connection.socket = -1; + server.master_connection.event_queue = NULL; + server.config_file = cfg ? cfg : "/etc/sangoma_mgd.conf"; + pthread_mutex_init(&server.listen_lock, NULL); + pthread_mutex_init(&server.ht_lock, NULL); + pthread_mutex_init(&server.process_lock, NULL); + pthread_mutex_init(&server.digits_lock, NULL); + pthread_mutex_init(&server.media_udp_port_lock, NULL); + pthread_mutex_init(&server.thread_count_lock, NULL); + pthread_mutex_init(&server.master_connection.queue_lock, NULL); + pthread_mutex_init(&server.master_connection.flags_lock, NULL); + pthread_mutex_init(&server.mcon.lock, NULL); + server.master_connection.chan = -1; + server.master_connection.span = -1; + server.call_timeout=SMG_DEFAULT_CALL_TIMEOUT; + + if (smg_log_init()) { + printf("Error: Logger Launch Failed\n"); + fprintf(stderr, "Error: Logger Launch Failed\n"); + return 0; + } + + if (!configure_server()) { + log_printf(SMG_LOG_ALL, server.log, "configuration failed!\n"); + return 0; + } + +#ifndef USE_SYSLOG + if (server.logfile_path) { + if (!(server.log = safe_fopen(server.logfile_path, "a"))) { + log_printf(SMG_LOG_ALL, stderr, "Error setting logfile %s!\n", server.logfile_path); + server.log = stderr; + return 0; + } + } +#endif + + + if (debug) { + server.debug = atoi(debug); + } + + if (coredump) { + struct rlimit l; + memset(&l, 0, sizeof(l)); + l.rlim_cur = RLIM_INFINITY; + l.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_CORE, &l)) { + log_printf(SMG_LOG_ALL, stderr, "Warning: Failed to disable core size limit: %s\n", + strerror(errno)); + } + } + +#ifdef __LINUX__ + if (geteuid() && coredump) { + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + log_printf(SMG_LOG_ALL, stderr, "Warning: Failed to disable core size limit for non-root: %s\n", + strerror(errno)); + } + } +#endif + + + + (void) signal(SIGINT,(void *) do_shut); + (void) signal(SIGTERM,(void *) do_shut); + (void) signal(SIGPIPE,(void *) do_ignore); + (void) signal(SIGUSR1,(void *) do_ignore); + (void) signal(SIGHUP,(void *) do_shut); + + /* Wait for logger thread to start */ + usleep(5000); + + woomera_set_flag(&server.master_connection, WFLAG_RUNNING); + if (launch_monitor_thread()) { + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + smg_log_cleanup(); + return 0; + } + + fprintf(stderr, "%s", WELCOME_TEXT); + + log_printf(SMG_LOG_ALL, stderr, "Woomera STARTUP Complete. [AutoACM=%i SDigit=%i]\n", + autoacm,server.strip_cid_non_digits); + return 1; +} + +static int woomera_shutdown(void) +{ + char *event_string; + int told = 0, loops = 0; + int span_cnt, chan_cnt; + + for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) { + for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) { + pthread_mutex_destroy(&server.process_table[span_cnt][chan_cnt].media_lock); + } + } + + close_socket(&server.master_connection.socket); + pthread_mutex_destroy(&server.listen_lock); + pthread_mutex_destroy(&server.ht_lock); + pthread_mutex_destroy(&server.process_lock); + pthread_mutex_destroy(&server.digits_lock); + pthread_mutex_destroy(&server.media_udp_port_lock); + pthread_mutex_destroy(&server.thread_count_lock); + pthread_mutex_destroy(&server.master_connection.queue_lock); + pthread_mutex_destroy(&server.master_connection.flags_lock); + pthread_mutex_destroy(&server.mcon.lock); + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + + + if (server.logfile_path) { + smg_free(server.logfile_path); + server.logfile_path = NULL; + } + + /* delete queue */ + while ((event_string = dequeue_event(&server.master_connection))) { + smg_free(event_string); + } + + while(server.thread_count > 0) { + loops++; + + if (loops % 1000 == 0) { + told = 0; + } + + if (loops > 10000) { + log_printf(SMG_LOG_ALL, server.log, "Red Alert! threads did not stop\n"); + assert(server.thread_count == 0); + } + + if (told != server.thread_count) { + log_printf(SMG_LOG_PROD, server.log, "Waiting For %d thread%s.\n", + server.thread_count, server.thread_count == 1 ? "" : "s"); + told = server.thread_count; + } + ysleep(10000); + } + unlink(PIDFILE); + log_printf(SMG_LOG_ALL, stderr, "Woomera SHUTDOWN Complete.\n"); + + smg_log_cleanup(); + + return 0; +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + + memset(&server,0,sizeof(server)); + memset(&woomera_dead_dev,0,sizeof(woomera_dead_dev)); + + mlockall(MCL_FUTURE); + memset(&server, 0, sizeof(server)); + memset(&woomera_dead_dev, 0, sizeof(woomera_dead_dev)); + + ret=nice(-5); + + sdla_memdbg_init(); + + server.hw_coding=0; + + openlog (ps_progname ,LOG_PID, LOG_LOCAL2); + + if (! (ret = woomera_startup(argc, argv))) { + exit(0); + } + ret = main_thread(); + + woomera_shutdown(); + + sdla_memdbg_free(1); + + return ret; +} + +/** EMACS ** + * Local variables: + * mode: C + * c-basic-offset: 4 + * End: + */ + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp new file mode 100644 index 0000000..e65126d --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp @@ -0,0 +1,6046 @@ +/********************************************************************************* + * sangoma_mgd.c -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-09, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * ============================================= + * + * v1.59 Nenad Corbic + * Changed w1g1 to s1c1 + * + * v1.58 Nenad Corbic + * Added bridge tdm to ip functionality + * + * v1.57 Nenad Corbic + * Support for woomera multiple profiles + * + * v1.56 David Yat Sin + * Changed BRI to run with HWEC in non-persist mode + * + * v1.55 Nenad Corbic + * Updated the base media port to 10000 and max media ports to 5000 + * + * v1.54 Nenad Corbic + * Bug added in 1.51 release causing call on channel 31 to fail. + * + * v1.53 Nenad Corbic + * Added progress message + * + * v1.52 David Yat Sin + * Changed sangoma_open_span_chan to __sangoma_span_chan + * to enabled shared used of file descriptors when using + * with PRI in NFAS mode + * + * v1.51 David Yat Sin + * MAX_SPANS increased to 32. + * Fix for server.process_table declared incorrectly + * + * v1.50 Nenad Corbic + * Logic to support multiple woomera clients hanging up the + * channel. This feature now supprorts woomera loadbalancing + * with extension check on the client end. Example, two Asterisk + * systems setup where Asterisk with correct extension gets the + * call. + * Changed log levels: Loglevel 1 = production + * Loglevel 2 = Boost TX/RX EVENTS + * Loglevel 3 = Woomera RX Messages + * Loglevel 4 = call setup debugging + * Loglevel 5 = extra debugging + * Loglevel 10 = full debugging + * + * v1.49 Nenad Corbic + * Removed tv from sigboost to make it binary compatible + * Updated release cause on double use return code. + * + * v1.48 Nenad Corbic + * Konrad Hammel + * Jun 30 2009 + * Added feature to disable/enable HWEC on channels that are + * passing a call with a "data" only transfer capability + * + * v1.47 Nenad Corbic + * Apr 30 2009 + * Updated hangup woomera events. Each event must + * be followed by a woomera error code 200=ok >299=no ok. + * This update fixes the chan_woomera socket write + * warnings. + * + * v1.46 Nenad Corbic + * Mar 27 2009 + * Major updates on socket handling. A bug was introducted + * when cmm and trunk was merged. + * Added configuration print in the logs. + * + * v1.45 Nenad Corbic + * Mar 19 2009 + * Outbound call timeout defaulted to 300 seconds. + * Timeout on answer instead of accept. + * + * v1.44 Nenad Corbic + * Mar 19 2009 + * Adjustable boost size. Added boost version check. + * + * v1.43 David Yat Sin + * Feb 25 2009 + * Merged CMM and Trunk + * + * v1.42 Nenad Corbic + * Jan 26 2008 + * Call Bearer Capability + * BugFix: Hangup NACK was sent out with invalid cause 0 + * + * v1.41 Nenad Corbic + * Jan 12 2008 + * Fixed the NACK with cause 0 bug. + * Added cause 19 on call timeout. + * Added configuration option call_timeout to timeout + * outbound calls. + * + * v1.40 Nenad Corbic + * Dec 10 2008 + * Check for Rx call overrun. + * In unlikely case sangoma_mgd goes out of + * sync with boost. + * + * v1.39 Nenad Corbic + * Sep 17 2008 + * Updated for Unit Test + * Bug fix in Loop Logic, possible race + * between media and woomera thread on loop end. + * + * v1.38 Nenad Corbic + * Sep 5 2008 + * Added a Double use of setup id logic. + * Currently double use call gets dropped. + * + * v1.37 Nenad Corbic + * Sep 2 2008 + * Bug fix in REMOVE LOOP logic continued + * The woomera->sock in loop logic was set to 0. + * Closing it failed the next call. + * + * v1.36 Nenad Corbic + * Aug 28 2008 + * Bug fix in REMOVE LOOP logic + * Remove F from incoming calls by default + * Check for errno on poll() + * Do not delay in closing socket on media down. + * + * v1.35cmm Nenad Corbic + * Jul 28 2008 + * Bug fixes on ACK Timeout and trunk release + * Added a thread logger + * Increased max spans to 32 + * + * v1.34cmm Nenad Corbic + * Jul 24 2008 + * Clean up the setup id on CALL STOP ACK + * + * v1.33cmm Nenad Corbic + * Jul 24 2008 + * The CALL STOP timeout function had a bug + * resulting in false blocking of tank ids + * due to STOP ACK Timeouts. + * + * v1.33 Nenad Corbic + * Jul 18 2008 + * Added UDP Sequencing to check for dropped frames + * Should only be used for debugging. + * + * v1.32 David Yat Sin + * Jul 17 2008 + * Support for d-channel incoming digit + * passthrough to Asterisk + * + * v1.32cmm Nenad Corbic + * Jun 03 2008 + * Implemented new Restart ACK Policy + * Split the Event packet into 2 types + * + * v1.31cmm Nenad Corbic + * Apr 04 2008 + * New CMM Restart procedure for boost + * Block TRUNK ID on ACK Timeout + * + * v1.31 David Yat Sin + * Apr 29 2008 + * Support for HW DTMF events. + * + * v1.30 Nenad Corbic + * Feb 08 2008 + * The fix in v1.26 causes double stop. + * I took out the v1.26 fix and added + * a big warning if that condition is + * ever reached. + * + * v1.29 Nenad Corbic + * Feb 07 2008 + * Added strip_cid_non_digits option + * + * v1.28 Nenad Corbic + * Feb 06 2008 + * Fixed a memory leak in clone event + * function. Added memory check subsystem + * + * v1.27 Nenad Corbic + * Jan 24 2008 + * Fixed a memory leak on incoming calls + * Removed the use of server listener which + * was not used + * + * v1.26 Nenad Corbic + * Jan 18 2008 + * Fixed hangup after invalid Answer or Ack Session + * Can cause double use of setup id - now fixed + * Update on autoacm on accept check for acked. + * + * v1.25 Nenad Corbic + * Dec 31 2007 + * Removed UDP Resync it can cause skb_over errors. + * Moved RDNIS message to higher debug level + * + * v1.24 Nenad Corbic + * Nov 30 2007 + * Bug fix on return code on ALL ckt busy + * + * v1.23 Nenad Corbic + * Bug fix on socket open. Check for retun code >= 0 + * + * v1.22 Nenad Corbic + * Nov 27 2007 + * Updated DTMF Tx function + * Fixed - dtmf tx without voice + * Fxied - dtmf clipping. + * + * v1.21 Nenad Corbic + * Nov 25 2007 + * Major unit testing of each state + * Numerous bug fixes for non autoacm mode. + * Changed "Channel-Name" to tg/cic + * Added compile option WANPIPE_CHAN_NAME to change Asterisk channel + * name of chan_woomera.so. So one can use Dial(SS7/g1/${EXTE}) + * instead of WOOMERA (for example) + * + * v1.20 Nenad Corbic + * Added option for Auto ACM response mode. + * + * v1.19 Nenad Corbic + * Configurable DTMF + * Bug fix in release codes (all ckt busy) + * + * v1.18 Nenad Corbic + * Added new rel cause support based on + * digits instead of strings. + * + * v1.17 Nenad Corbic + * Added session support + * + * v1.16 Nenad Corbic + * Added hwec disable on loop ccr + * + * v1.15 Nenad Corbic + * Updated DTMF Locking + * Added delay between digits + * + * v1.14 Nenad Corbic + * Updated DTMF Library + * Fixed DTMF synchronization + * + * v1.13 Nenad Corbic + * Woomera OPAL Dialect + * Added Congestion control + * Added SCTP + * Added priority ISUP queue + * Fixed presentation + * + * v1.12 Nenad Corbic + * Fixed CCR + * Removed socket shutdown on end call. + * Let Media thread shutodwn sockets. + * + * v1.11 Nenad Corbic + * Fixed Remote asterisk/woomera connection + * Increased socket timeouts + * + * v1.10 Nenad Corbic + * Added Woomera OPAL dialect. + * Start montor thread in priority + * + * v1.9 Nenad Corbic + * Added Loop mode for ccr + * Added remote debug enable + * Fixed syslog logging. + * + * v1.8 Nenad Corbic + * Added a ccr loop mode for each channel. + * Boost can set any channel in loop mode + * + * v1.7 Nenad Corbic + * Pass trunk group number to incoming call + * chan woomera will use it to append to context + * name. Added presentation feature. + * + * v1.6 Nenad Corbic + * Use only ALAW and MLAW not SLIN. + * This reduces the load quite a bit. + * Send out ALAW/ULAW format on HELLO message. + * RxTx Gain is done now in chan_woomera. + * + * v1.5 Nenad Corbic + * Bug fix in START_NACK_ACK handling. + * When we receive START_NACK we must alwasy pull tank before + * we send out NACK_ACK this way we will not try to send NACK + * ourself. + *********************************************************************************/ + +#include "sangoma_mgd.h" +#include "sangoma_mgd_memdbg.h" +#include "q931_cause.h" +#include "smg_capabilities.h" + +int pipe_fd[2]; + +#ifdef CODEC_LAW_DEFAULT +static uint32_t codec_sample=8; +#else +static uint32_t codec_sample=16; +#endif + +static char ps_progname[]="sangoma_mgd"; + +static struct woomera_interface woomera_dead_dev; + + +/* For 3.4. release always set to 1 */ +#ifdef BRI_PROT +static unsigned char tdmv_hwec_persist = 1; +#else +static unsigned char tdmv_hwec_persist = 1; +#endif +struct woomera_server server; + +struct smg_tdm_ip_bridge g_smg_ip_bridge_idx[MAX_SMG_BRIDGE]; +pthread_mutex_t g_smg_ip_bridge_lock; + +#if 0 +#define DOTRACE +#endif + + +#define SMG_VERSION "v1.59" + +/* enable early media */ +#if 1 +#define WOOMERA_EARLY_MEDIA 1 +#endif + + +#define SMG_DTMF_ON 60 +#define SMG_DTMF_OFF 10 +#define SMG_DTMF_RATE 8000 +#define SMG_DEFAULT_CALL_TIMEOUT 300 + +#if 0 +#define MEDIA_SOCK_SHUTDOWN 1 +#endif + +#ifdef DOTRACE +static int tc = 0; +#endif + +#if 0 +#warning "NENAD: HPTDM API" +#define WP_HPTDM_API 1 +#else +#undef WP_HPTDM_API +#endif + +#ifdef WP_HPTDM_API +hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; +#endif + +#if 0 +#define SMG_DROP_SEQ 1 +#warning "SMG Debug feature Drop Seq Enabled" +static int drop_seq=0; +#else +#undef SMG_DROP_SEQ +#endif + + +#if 0 +#define SMG_NO_MEDIA +#warning "SMG No Media Defined" +#else +#undef SMG_NO_MEDIA +#endif + +const char WELCOME_TEXT[] = +"================================================================================\n" +"Sangoma Media Gateway Daemon v1.59 \n" +"\n" +"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" +"Copyright 2005, 2006, 2007 \n" +"Nenad Corbic , Anthony Minessale II \n" +"This program is free software, distributed under the terms of\n" +"the GNU General Public License\n" +"================================================================================\n" +""; + + + +static int coredump=1; +static int autoacm=0; + +/* FIXME: Should be done in cfg file */ +#if defined(BRI_PROT) +int max_spans=WOOMERA_BRI_MAX_SPAN; +int max_chans=WOOMERA_BRI_MAX_CHAN; +#else +/* PRI_PROT uses these defines as well */ +int max_spans=WOOMERA_MAX_SPAN; +int max_chans=WOOMERA_MAX_CHAN; +#endif + +static int launch_media_tdm_thread(struct woomera_interface *woomera); +static int launch_woomera_thread(struct woomera_interface *woomera); +static void woomera_check_digits (struct woomera_interface *woomera); +static struct woomera_interface *alloc_woomera(void); +static void handle_event_dtmf(struct woomera_interface *woomera, unsigned char dtmf_digit); + +q931_cause_to_str_array_t q931_cause_to_str_array[255]; +bearer_cap_to_str_array_t bearer_cap_to_str_array[255]; +uil1p_to_str_array_t uil1p_to_str_array[255]; + +static int isup_exec_command(int span, int chan, int id, int cmd, int cause) +{ + short_signal_event_t oevent; + int retry=5; + + call_signal_event_init((short_signal_event_t*)&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, (call_signal_event_t*)&oevent) < 0){ + + --retry; + if (retry <= 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(SMG_LOG_ALL, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + +static int isup_exec_event(call_signal_event_t *event) +{ + int retry=5; + +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, event) < 0){ + + --retry; + if (retry <= 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(SMG_LOG_ALL, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + + +static int isup_exec_commandp(int span, int chan, int id, int cmd, int cause) +{ + short_signal_event_t oevent; + int retry=5; + + call_signal_event_init(&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_writep(&server.mconp, (call_signal_event_t*)&oevent) < 0){ + + --retry; + if (retry <= 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(SMG_LOG_ALL, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + + +static int get_span_chan_from_interface(char* interface, int *span_ptr, int *chan_ptr) +{ + int span, chan; + int err; + + err=sscanf(interface, "s%dc%d", &span, &chan); + if (err!=2) { + err=sscanf(interface, "w%dg%d", &span, &chan); + } + + if (err==2) { + if (smg_validate_span_chan(span,chan) != 0) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "WOOMERA Warning invalid span chan in interface %s\n", + interface); + return -1; + } + + *span_ptr = span; + *chan_ptr = chan; + return 0; + } + log_printf(SMG_LOG_ALL, server.log, "ERROR: Failed to get span chan from interface:[%s]\n", interface, span, chan); + return -1; +} + +static int socket_printf(int socket, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return -1; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) smg_malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + log_printf(SMG_LOG_ALL, server.log, "Crtical ERROR: Memory Error!\n"); + } else { + int err; + int len = strlen(data); + err=send(socket, data, strlen(data), 0); + if (err != strlen(data)) { + log_printf(SMG_LOG_DEBUG_8, server.log, "ERROR: Failed to send data to woomera socket(%i): err=%i len=%d %s\n", + socket,err,len,strerror(errno)); + ret = err; + } else { + ret = 0; + } + + free(data); + } + + return ret; +} + + + +static int woomera_next_pair(struct woomera_config *cfg, char **var, char **val) +{ + int ret = 0; + char *p, *end; + + *var = *val = NULL; + + for(;;) { + cfg->lineno++; + + if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) { + ret = 0; + break; + } + + *var = cfg->buf; + + if (**var == '[' && (end = strchr(*var, ']'))) { + *end = '\0'; + (*var)++; + strncpy(cfg->category, *var, sizeof(cfg->category) - 1); + continue; + } + + if (**var == '#' || **var == '\n' || **var == '\r') { + continue; + } + + if ((end = strchr(*var, '#'))) { + *end = '\0'; + end--; + } else if ((end = strchr(*var, '\n'))) { + if (*end - 1 == '\r') { + end--; + } + *end = '\0'; + } + + p = *var; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *var = p; + + if (!(*val = strchr(*var, '='))) { + ret = -1; + log_printf(SMG_LOG_ALL, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); + continue; + } else { + p = *val - 1; + *(*val) = '\0'; + (*val)++; + if (*(*val) == '>') { + *(*val) = '\0'; + (*val)++; + } + + while ((*p == ' ' || *p == '\t') && p != *var) { + *p = '\0'; + p--; + } + + p = *val; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *val = p; + ret = 1; + break; + } + } + + return ret; + +} + + +#if 0 +static void woomera_set_span_chan(struct woomera_interface *woomera, int span, int chan) +{ + pthread_mutex_lock(&woomera->vlock); + woomera->span = span; + woomera->chan = chan; + pthread_mutex_unlock(&woomera->vlock); + +} +#endif + + +static struct woomera_event *new_woomera_event_printf(struct woomera_event *ebuf, char *fmt, ...) +{ + struct woomera_event *event = NULL; + int ret = 0; + va_list ap; + + if (ebuf) { + event = ebuf; + } else if (!(event = new_woomera_event())) { + log_printf(SMG_LOG_ALL, server.log, "Memory Error queuing event!\n"); + return NULL; + } else { + return NULL; + } + + va_start(ap, fmt); +#ifdef SOLARIS + event->data = (char *) smg_malloc(2048); + vsnprintf(event->data, 2048, fmt, ap); +#else + ret = smg_vasprintf(&event->data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + log_printf(SMG_LOG_ALL, server.log, "Memory Error queuing event!\n"); + destroy_woomera_event(&event, EVENT_FREE_DATA); + return NULL; + } + + return event; + +} + +static struct woomera_event *woomera_clone_event(struct woomera_event *event) +{ + struct woomera_event *clone; + + if (!(clone = new_woomera_event())) { + return NULL; + } + + /* This overwrites the MALLOC in clone causing a memory leak */ + memcpy(clone, event, sizeof(*event)); + + /* We must set the malloc flag back so that this event + * will be deleted */ + _woomera_set_flag(clone, WFLAG_MALLOC); + clone->next = NULL; + clone->data = smg_strdup(event->data); + + return clone; +} + +static void enqueue_event(struct woomera_interface *woomera, + struct woomera_event *event, + event_args free_data) +{ + struct woomera_event *ptr, *clone = NULL; + + assert(woomera != NULL); + assert(event != NULL); + + if (!(clone = woomera_clone_event(event))) { + log_printf(SMG_LOG_ALL, server.log, "Error Cloning Event\n"); + return; + } + + pthread_mutex_lock(&woomera->queue_lock); + + for (ptr = woomera->event_queue; ptr && ptr->next ; ptr = ptr->next); + + if (ptr) { + ptr->next = clone; + } else { + woomera->event_queue = clone; + } + + pthread_mutex_unlock(&woomera->queue_lock); + + woomera_set_flag(woomera, WFLAG_EVENT); + + if (free_data && event->data) { + /* The event has been duplicated, the original data + * should be freed */ + smg_free(event->data); + event->data=NULL; + } +} + +static char *dequeue_event(struct woomera_interface *woomera) +{ + struct woomera_event *event; + char *data = NULL; + + if (!woomera) { + return NULL; + } + + pthread_mutex_lock(&woomera->queue_lock); + if (woomera->event_queue) { + event = woomera->event_queue; + woomera->event_queue = event->next; + data = event->data; + pthread_mutex_unlock(&woomera->queue_lock); + + destroy_woomera_event(&event, EVENT_KEEP_DATA); + return data; + } + pthread_mutex_unlock(&woomera->queue_lock); + + return data; +} + + +static int enqueue_event_on_listeners(struct woomera_event *event) +{ + struct woomera_listener *ptr; + int x = 0; + + assert(event != NULL); + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + enqueue_event(ptr->woomera, event, EVENT_KEEP_DATA); + x++; + } + pthread_mutex_unlock(&server.listen_lock); + + return x; +} + + +static void del_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *ptr, *last = NULL; + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + if (ptr->woomera == woomera) { + if (last) { + last->next = ptr->next; + } else { + server.listeners = ptr->next; + } + smg_free(ptr); + break; + } + last = ptr; + } + pthread_mutex_unlock(&server.listen_lock); +} + +static void add_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *new; + + pthread_mutex_lock(&server.listen_lock); + + if ((new = smg_malloc(sizeof(*new)))) { + memset(new, 0, sizeof(*new)); + new->woomera = woomera; + new->next = server.listeners; + server.listeners = new; + } else { + log_printf(SMG_LOG_ALL, server.log, "Memory Error adding listener!\n"); + } + + pthread_mutex_unlock(&server.listen_lock); +} + + + +static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) +{ + struct media_session *ms = woomera_get_ms(woomera); + char *cur = NULL; + int wrote = 0; + int err; + + if (!ms) { + return -EINVAL; + } + + if (!ms->dtmf_buffer) { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Allocate DTMF Buffer...."); + + err=switch_buffer_create_dynamic(&ms->dtmf_buffer, 1024, server.dtmf_size, 0); + + if (err != 0) { + log_printf(SMG_LOG_ALL, woomera->log, "Failed to allocate DTMF Buffer!\n"); + return -ENOMEM; + } else { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "SUCCESS!\n"); + } + + } + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Sending DTMF %s\n",digits); + for (cur = digits; *cur; cur++) { + if ((wrote = teletone_mux_tones(&ms->tone_session, + &ms->tone_session.TONES[(int)*cur]))) { + + pthread_mutex_lock(&woomera->dtmf_lock); + + err=switch_buffer_write(ms->dtmf_buffer, ms->tone_session.buffer, wrote * 2); + + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Sending DTMF %s Wrote=%i (err=%i)\n", + digits,wrote*2,err); + } else { + log_printf(SMG_LOG_ALL, woomera->log, "Error: Sending DTMF %s (err=%i)\n", + digits,wrote); + } + } + + ms->skip_read_frames = 200; + return 0; +} + +static struct woomera_interface *alloc_woomera(void) +{ + struct woomera_interface *woomera = NULL; + + if ((woomera = smg_malloc(sizeof(struct woomera_interface)))) { + + memset(woomera, 0, sizeof(struct woomera_interface)); + + woomera->chan = -1; + woomera->span = -1; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->q931_rel_cause_topbx=SIGBOOST_RELEASE_CAUSE_NORMAL; + woomera->q931_rel_cause_tosig=SIGBOOST_RELEASE_CAUSE_NORMAL; + + woomera_set_interface(woomera, "w-1g-1"); + + + + } + + return woomera; + +} + + +static struct woomera_interface *new_woomera_interface(int socket, struct sockaddr_in *sock_addr, int len) +{ + struct woomera_interface *woomera = NULL; + + if (socket < 0) { + log_printf(SMG_LOG_ALL, server.log, "Critical: Invalid Socket on new interface!\n"); + return NULL; + } + + if ((woomera = alloc_woomera())) { + if (socket >= 0) { + no_nagle(socket); + woomera->socket = socket; + } + + if (sock_addr && len) { + memcpy(&woomera->addr, sock_addr, len); + } + } + + return woomera; + +} + +static char *woomera_message_header(struct woomera_message *wmsg, char *key) +{ + int x = 0; + char *value = NULL; + + for (x = 0 ; x < wmsg->last ; x++) { + if (!strcasecmp(wmsg->names[x], key)) { + value = wmsg->values[x]; + break; + } + } + + return value; +} + + +#define SMG_DECODE_POLL_ERRORS(err) \ + (err & POLLERR) ? "POLLERR" : \ + (err & POLLHUP) ? "POLLHUP" : \ + (err & POLLNVAL) ? "POLLNVAL" : "UNKNOWN" + +static int waitfor_socket(int fd, int timeout, int flags, int *flags_out) +{ + struct pollfd pfds[1]; + int res; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + +waitfor_socket_tryagain: + + memset(&pfds[0], 0, sizeof(pfds[0])); + + pfds[0].fd = fd; + pfds[0].events = flags | errflags; + + res = poll(pfds, 1, timeout); + + if (res == 0) { + return res; + } + + if (res > 0) { + res=-1; + *flags_out = pfds[0].revents; + if (pfds[0].revents & errflags) { + res=-1; +#if 0 + log_printf(SMG_LOG_DEBUG_10,server.log, "Wait for socket Error in revents 0x%X %s Error=%s!\n", + pfds[0].revents,strerror(errno),SMG_DECODE_POLL_ERRORS(pfds[0].revents)); +#endif + return res; + } else { + if (pfds[0].revents & flags) { + res=1; + } else { + log_printf(SMG_LOG_ALL,server.log, "Wait for socket invalid poll event in revents 0x%X Error=%s Errno=%s !\n", + pfds[0].revents,SMG_DECODE_POLL_ERRORS(pfds[0].revents),strerror(errno)); + } + } + } else { + if ((errno == EINTR || errno == EAGAIN)) { + goto waitfor_socket_tryagain; + } + log_printf(SMG_LOG_ALL,server.log, "Wait for socket error!\n"); + } + + return res; +} + + +int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) +{ + struct pollfd pfds[2]; + int res = 0; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + if (fda < 0 || fdb < 0) { + return -1; + } + + +waitfor_2sockets_tryagain: + + *a=0; + *b=0; + + + memset(pfds, 0, sizeof(pfds)); + + pfds[0].fd = fda; + pfds[1].fd = fdb; + pfds[0].events = POLLIN | errflags; + pfds[1].events = POLLIN | errflags; + + res = poll(pfds, 2, timeout); + + if (res > 0) { + res = 1; + if ((pfds[0].revents & errflags) || (pfds[1].revents & errflags)) { + res = -1; + } else { + if ((pfds[0].revents & POLLIN)) { + *a=1; + res++; + } + if ((pfds[1].revents & POLLIN)) { + *b=1; + res++; + } + } + + if (res == 1) { + /* No event found what to do */ + res=-1; + } + } else if (res < 0) { + + if (errno == EINTR || errno == EAGAIN) { + goto waitfor_2sockets_tryagain; + } + + } + + return res; +} + + +static struct media_session *media_session_new(struct woomera_interface *woomera) +{ + struct media_session *ms = NULL; + int x; + char *p; + int span,chan; + + span=woomera->span; + chan=woomera->chan; + + log_printf(SMG_LOG_DEBUG_CALL, server.log,"Starting new MEDIA session [%s] [%s]\n", + woomera->interface,woomera->raw?woomera->raw:"N/A"); + + if ((ms = smg_malloc(sizeof(struct media_session)))) { + memset(ms, 0, sizeof(struct media_session)); + + if (woomera->loop_tdm != 1) { + for(x = 0; x < strlen(woomera->raw) ; x++) { + if (woomera->raw[x] == ':') { + break; + } + if (woomera->raw[x] == '/') { + break; + } + } + + ms->ip = smg_strndup(woomera->raw, x); + time(&ms->started); + p = woomera->raw + (x+1); + ms->port = atoi(p); + } + + time(&ms->started); + woomera_set_ms(woomera,ms); + ms->woomera = woomera; + + /* Setup artificial DTMF stuff */ + memset(&ms->tone_session, 0, sizeof(ms->tone_session)); + if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { + log_printf(SMG_LOG_ALL, server.log, "ERROR: Failed to initialize TONE [s%ic%i]!\n", + span+1,chan+1); + } + + ms->tone_session.rate = SMG_DTMF_RATE; + ms->tone_session.duration = server.dtmf_on * (ms->tone_session.rate / 1000); + ms->tone_session.wait = server.dtmf_off * (ms->tone_session.rate / 1000); + + teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); + + } else { + log_printf(SMG_LOG_ALL, server.log, "ERROR: Memory Alloc Failed [s%ic%i]!\n", + span+1,chan+1); + } + + return ms; +} + +static void media_session_free(struct media_session *ms) +{ + if (ms->ip) { + smg_free(ms->ip); + } + + teletone_destroy_session(&ms->tone_session); + switch_buffer_destroy(&ms->dtmf_buffer); + + ms->woomera = NULL; + + smg_free(ms); +} + + +static int create_udp_socket(struct media_session *ms, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + log_printf(SMG_LOG_DEBUG_9,server.log,"LocalIP %s:%d IP %s:%d \n",local_ip, local_port, ip, port); + + memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); + memset(&ms->local_hp, 0, sizeof(ms->local_hp)); + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + ms->remote_addr.sin_family = ms->remote_hp.h_addrtype; + memcpy((char *) &ms->remote_addr.sin_addr.s_addr, ms->remote_hp.h_addr_list[0], ms->remote_hp.h_length); + ms->remote_addr.sin_port = htons(port); + + ms->local_addr.sin_family = ms->local_hp.h_addrtype; + memcpy((char *) &ms->local_addr.sin_addr.s_addr, ms->local_hp.h_addr_list[0], ms->local_hp.h_length); + ms->local_addr.sin_port = htons(local_port); + + rc = bind(ms->socket, (struct sockaddr *) &ms->local_addr, sizeof(ms->local_addr)); + if (rc < 0) { + close(ms->socket); + ms->socket = -1; + + log_printf(SMG_LOG_DEBUG_9,server.log, + "Failed to bind LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + + /* OK */ + + } else { + log_printf(SMG_LOG_ALL,server.log, + "Failed to get hostbyname LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + } else { + log_printf(SMG_LOG_ALL,server.log, + "Failed to create/allocate UDP socket\n"); + } + + return ms->socket; +} + +static int next_media_port(void) +{ + int port; + + pthread_mutex_lock(&server.media_udp_port_lock); + port = ++server.next_media_port; + if (port > server.max_media_port) { + server.next_media_port = server.base_media_port; + port = server.base_media_port; + } + pthread_mutex_unlock(&server.media_udp_port_lock); + + return port; +} + + + +static int woomera_dtmf_transmit(struct media_session *ms, int mtu) +{ + struct woomera_interface *woomera = ms->woomera; + int bread; + unsigned char dtmf[1024]; + unsigned char dtmf_law[1024]; + sangoma_api_hdr_t hdrframe; + int i; + int slin_len = mtu*2; + short *data; + int used; + int res; + int err; + int txdtmf=0; + int flags_out; + memset(&hdrframe,0,sizeof(hdrframe)); + + if (!ms->dtmf_buffer) { + return -1; + } + + for (;;) { + + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + break; + } + + res = waitfor_socket(ms->sangoma_sock, -1, POLLOUT, &flags_out); + if (res <= 0) { + break; + } + +#ifdef CODEC_LAW_DEFAULT + + pthread_mutex_lock(&woomera->dtmf_lock); + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + pthread_mutex_unlock(&woomera->dtmf_lock); + break; + } + + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, slin_len); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread <= 0) { + break; + } + + log_printf(SMG_LOG_DEBUG_MISC,woomera->log,"%s: Write DTMF Got %d bytes MTU=%i Coding=%i Used=%i\n", + woomera->interface,bread,mtu,ms->hw_coding,used); + + data=(short*)dtmf; + for (i=0;ihw_coding) { + /* ALAW */ + dtmf_law[i] = linear_to_alaw((int)data[i]); + } else { + /* ULAW */ + dtmf_law[i] = linear_to_ulaw((int)data[i]); + } + } + + err=sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf_law, mtu, 0); + + if (err != mtu) { + log_printf(SMG_LOG_ALL, woomera->log, "Error: Failed to TX to TDM API on DTMF (err=%i mtu=%i)!\n",err,mtu); + } + + txdtmf++; + ms->skip_write_frames++; +#else +... + pthread_mutex_lock(&woomera->dtmf_lock); + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, mtu); + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(SMG_LOG_DEBUG_MISC,woomera->log,"%s: Write DTMF Got %d bytes\n", + woomera->interface,bread); + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf, mtu, 0); + txdtmf++; + ms->skip_write_frames++; +#endif + + } + + if (txdtmf) { + return 0; + } else { + return -1; + } +} + +static void media_loop_run(struct media_session *ms) +{ + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int errs=0; + int res=0; + wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + char filename[100]; + FILE *filed=NULL; + int loops=0,flags_out=0; + int open_cnt = 0; + + open_cnt=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + +retry_loop: + ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1); + + log_printf(SMG_LOG_PROD, server.log, "Media Loop Started %s fd=%i\n", + woomera->interface,ms->sangoma_sock); + + if (ms->sangoma_sock < 0) { + errs++; + if (errs < 5) { + usleep(500000); + goto retry_loop; + } + log_printf(SMG_LOG_ALL, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [s%ic%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + + } else { + errs=0; + + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } + + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api); + ms->oob_disable = 0; +#ifdef LIBSANGOMA_VERSION + open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api); + if (open_cnt > 1) { + ms->oob_disable = 1; + } +#endif + } + + if (errs) { + log_printf(SMG_LOG_ALL, server.log, "Media Loop: failed to open tdm device %s\n", + woomera->interface); + return; + } + + if (server.loop_trace) { + sprintf(filename,"/smg/s%ic%i-loop.trace",woomera->span+1,woomera->chan+1); + unlink(filename); + filed = safe_fopen(filename, "w"); + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + ((res = waitfor_socket(ms->sangoma_sock, 1000, POLLIN, &flags_out)) >= 0)) { + + if (res == SMG_SOCKET_EVENT_TIMEOUT) { + //log_printf(SMG_LOG_DEBUG_8, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(SMG_LOG_ALL, server.log, "TDM Loop ReadMsg Error: %s\n", + strerror(errno), woomera->interface); + break; + } + + if (server.loop_trace && filed != NULL) { + int i; + for (i=0;isangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + res, 0); + + res=0; + + loops++; + } + + + if (res < 0) { + if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + log_printf(SMG_LOG_ALL, server.log, "Media Loop: socket error %s (fd=%i) %s\n", + woomera->interface, ms->sangoma_sock, strerror(errno)); + } + } + + + if (server.loop_trace && filed != NULL) { + fclose(filed); + } + + sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api); + + close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1); + + if (loops < 1) { + log_printf(SMG_LOG_ALL, server.log, "Media Loop FAILED %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + } else { + log_printf(SMG_LOG_PROD, server.log, "Media Loop PASSED %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + } + + return; + +} + + + + +#ifdef WP_HPTDM_API +static int media_rx_ready(void *p, unsigned char *data, int len) +{ + struct media_session *ms = (struct media_session *)p; + + if (ms->udp_sock < 0) { + return -1; + } + + return sendto(ms->udp_sock, + data,len, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + +} +#endif + +static void *media_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int local_port, x = 0, errs = 0, res = 0, packet_len = 0; + //int udp_cnt=0; + struct woomera_event wevent; + wanpipe_tdm_api_t tdm_api; + FILE *tx_fd=NULL; + int sock_timeout=200; + + int hwec_enabled=0, hwec_reenable=0; + + int open_cnt = 0; + + open_cnt=0; + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + !woomera->interface || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "MEDIA session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(ms); + pthread_exit(NULL); + return NULL; + } + + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA session for [%s] started (ptr=%p loop=%i)\n", + woomera->interface,woomera,woomera->loop_tdm); + + if (woomera->loop_tdm) { + media_loop_run(ms); + ms->udp_sock=-1; + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + goto media_thread_exit; + } + + for(x = 0; x < 1000 ; x++) { + local_port = next_media_port(); + if ((ms->udp_sock = create_udp_socket(ms, server.media_ip, local_port, ms->ip, ms->port)) > -1) { + break; + } + } + + /* Normal Temporary Failure */ + woomera->q931_rel_cause_topbx = 41; + + if (ms->udp_sock < 0) { + log_printf(SMG_LOG_ALL, server.log, "UDP Socket Error (%s) [%s] LocalPort=%d\n", + strerror(errno), woomera->interface, local_port); + + errs++; + } else { + int media_retry_cnt=0; +#ifdef WP_HPTDM_API + hp_tdm_api_span_t *span=hptdmspan[woomera->span+1]; + if (!span || !span->init) { + errs++; + } else { + hp_tdm_api_usr_callback_t usr_callback; + memset(&usr_callback,0,sizeof(usr_callback)); + usr_callback.p = ms; + usr_callback.rx_avail = media_rx_ready; + if (span->open_chan(span, &usr_callback, &ms->tdmchan,woomera->chan+1)) { + errs++; + /* Switch Congestion */ + woomera->q931_rel_cause_topbx = 42; + } + } +#else +media_retry: + ms->sangoma_sock = open_span_chan(woomera->span+1, woomera->chan+1); + if (ms->sangoma_sock < 0) { + + if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + media_retry_cnt++; + if (media_retry_cnt < 5) { + log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Retry [s%ic%i]\n", + woomera->span+1, woomera->chan+1); + usleep(100000); + goto media_retry; + } + + log_printf(SMG_LOG_ALL, server.log, "WANPIPE Socket Error (%s) if=[%s] [s%ic%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + + /* Switch Congestion */ + woomera->q931_rel_cause_topbx = 42; + } + + errs++; + } else { + +# ifdef CODEC_LAW_DEFAULT + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } +# else + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_SLINEAR) < 0 ) { + errs++; + } +# endif + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + +# ifdef CODEC_LAW_DEFAULT +# ifdef LIBSANGOMA_GET_HWCODING + ms->hw_coding=sangoma_tdm_get_hw_coding(ms->sangoma_sock, &tdm_api); + if (ms->hw_coding < 0) { + errs++; + } +# else +# error "libsangoma missing hwcoding feature: not up to date!" +# endif +# endif + + +# ifdef LIBSANGOMA_GET_HWDTMF + ms->hw_dtmf=sangoma_tdm_get_hw_dtmf(ms->sangoma_sock, &tdm_api); + if (ms->hw_dtmf) { + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Supported [s%ic%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + } else { + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [s%ic%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + } +#else + ms->hw_dtmf=0; + log_printf(SMG_LOG_DEBUG_9, server.log, "HW DTMF Not Supported [s%ic%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); +# warning "libsangoma missing hwdtmf feature: not up to date!" + +#endif + + ms->oob_disable = 0; +#ifdef LIBSANGOMA_VERSION + open_cnt = sangoma_get_open_cnt(ms->sangoma_sock, &tdm_api); + if (open_cnt > 1) { + ms->oob_disable = 1; + } +#endif + + if (!tdmv_hwec_persist) { + // BRI cards start with HWEC in bypass disable state + if (bearer_cap_is_audio(woomera->bearer_cap)) { + int err; + err=sangoma_tdm_enable_hwec(ms->sangoma_sock, &tdm_api); + if (err == 0) { + hwec_enabled=1; + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Enabling hwec Ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Enabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } else { + if (!bearer_cap_is_audio(woomera->bearer_cap)) { + int err; + err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api); + if (err == 0) { + hwec_reenable=1; + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Disabling hwec Ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Disabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + } +#endif + } + + + +#ifdef WP_HPTDM_API + /* No tdm thread */ +#else +#ifndef SMG_NO_MEDIA + if (!errs && + launch_media_tdm_thread(woomera)) { + errs++; + } +#endif +#endif + + if (errs) { + + woomera->q931_rel_cause_topbx = 42; + + } else { + + unsigned char udp_frame[4096]; + unsigned int fromlen = sizeof(struct sockaddr_in); + int flags_out=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(udp_frame,0,sizeof(udp_frame)); +#ifdef DOTRACE + int fdin, fdout; + char path_in[512], path_out[512]; +#endif + + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Unique-Call-Id: %s%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: PCM-16%s" + "DTMF: %s%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + (ms->hw_dtmf)? "OutofBand": "InBand", + + WOOMERA_RECORD_SEPERATOR + ); + + + enqueue_event(woomera, &wevent, EVENT_FREE_DATA); + +#ifdef DOTRACE + sprintf(path_in, "/tmp/debug-in.%d.raw", tc); + sprintf(path_out, "/tmp/debug-out.%d.raw", tc++); + fdin = open(path_in, O_WRONLY | O_CREAT, O_TRUNC, 0600); + fdout = open(path_out, O_WRONLY | O_CREAT, O_TRUNC, 0600); +#endif + + if (server.out_tx_test) { + tx_fd=fopen("/smg/sound.raw","rb"); + if (!tx_fd) { + log_printf(SMG_LOG_ALL,server.log, "FAILED TO OPEN Sound file!\n"); + } + } + + + for (;;) { + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + res=0; + break; + } + + res = waitfor_socket(ms->udp_sock, sock_timeout, POLLIN, &flags_out); + + if (res < 0) { + break; + } + +#ifdef SMG_NO_MEDIA + continue; +#endif + + if (res == 0) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + + log_printf(SMG_LOG_DEBUG_8, server.log, "%s: UDP Sock Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if ((packet_len = recvfrom(ms->udp_sock, udp_frame, sizeof(udp_frame), + MSG_DONTWAIT, (struct sockaddr *) &ms->local_addr, &fromlen)) < 1) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "UDP Recv Error: %s\n",strerror(errno)); + break; + } + + +#ifdef SMG_DROP_SEQ + if (drop_seq) { + log_printf(SMG_LOG_ALL,server.log,"Dropping TX Sequence! %i\n",drop_seq); + drop_seq--; + continue; + } +#endif + +#if 0 + log_printf(SMG_LOG_DEBUG_10, server.log, "%s: UDP Receive %i !!!\n", + woomera->interface,packet_len); +#endif + + if (packet_len > 0) { + +#if 0 +/* NC: This can cause skb_over panic must be retested */ + if (packet_len != sangoma_frame_len && ms->udp_sync_cnt <= 5) { + /* Assume that we will always receive SLINEAR here */ + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, packet_len/codec_sample); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + log_printf(SMG_LOG_DEBUG_MISC, server.log, + "%s: UDP TDM Period ReSync to Len=%i %ims (udp=%i) \n", + woomera->interface,sangoma_frame_len, + sangoma_frame_len/codec_sample,packet_len); + + + if (++ms->udp_sync_cnt >= 6) { + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, 20); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + log_printf(SMG_LOG_ALL, server.log, + "%s: UDP TDM Period Force ReSync to 20ms \n", + woomera->interface); + } + + } +#endif + if (!server.out_tx_test) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + /* For sanity sake if we are doing the out test + * dont take any chances force tx udp data */ + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + continue; + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + continue; + } + + } + + if (server.out_tx_test && tx_fd && + fread((void*)udp_frame, + sizeof(char), + packet_len,tx_fd) <= 0) { + + sangoma_get_full_cfg(ms->sangoma_sock,&tdm_api); + fclose(tx_fd); + tx_fd=NULL; + } + +#ifdef WP_HPTDM_API + if (ms->tdmchan->push) { + ms->tdmchan->push(ms->tdmchan,udp_frame,packet_len); + } +#else + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + udp_frame, + packet_len, 0); +#endif + + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + udp_cnt++; + if (udp_cnt && udp_cnt % 1000 == 0) { + log_printf(SMG_LOG_ALL, server.log, "%s: MEDIA UDP TX RX CNT %i %i\n", + woomera->interface,udp_cnt,packet_len); + } + } +#endif + } + + if (res < 0) { + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + res=0; + } else { + log_printf(SMG_LOG_ALL, server.log, "Media Thread: socket error %s SockID=%i %s Poll=%s!\n", + woomera->interface,ms->sangoma_sock,strerror(errno),SMG_DECODE_POLL_ERRORS(flags_out)); + } + } + } + + new_woomera_event_printf(&wevent, + "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Start-Time: %ld%s" + "End-Time: %ld%s" + "Answer-Time: %ld%s" + "Call-ID: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + woomera->session, + WOOMERA_LINE_SEPERATOR, + + time(&ms->started), + WOOMERA_LINE_SEPERATOR, + + time(NULL), + WOOMERA_LINE_SEPERATOR, + + time(&ms->answered), + WOOMERA_LINE_SEPERATOR, + + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + +media_thread_exit: + + if (!tdmv_hwec_persist) { + if (hwec_enabled) { + int err; + err=sangoma_tdm_disable_hwec(ms->sangoma_sock, &tdm_api); + if (err==0) { + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] disabling hwec ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] disabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } else { + if (hwec_reenable) { + int err; + err=sangoma_tdm_enable_hwec(ms->sangoma_sock, &tdm_api); + if (err==0) { + log_printf(SMG_LOG_DEBUG_8, server.log, "MEDIA [%s] Re-enabling hwec ok\n",woomera->interface); + } else { + log_printf(SMG_LOG_PROD, server.log, "MEDIA [%s] Re-enabling hwec Failed (%s)\n",woomera->interface, strerror(errno)); + } + } + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + /* Dont wait for the other thread */ + close_socket(&ms->udp_sock); + close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1); + while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + usleep(1000); + sched_yield(); + } + } + + + close_socket(&ms->udp_sock); + close_span_chan(&ms->sangoma_sock, woomera->span+1, woomera->chan+1); + + if (tx_fd){ + fclose(tx_fd); + tx_fd=NULL; + } + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + woomera_set_ms(woomera,NULL); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + + media_session_free(ms); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + + pthread_exit(NULL); + return NULL; +} + + + + +static void *media_tdm_thread_run(void *obj) +{ + wanpipe_tdm_api_t tdm_api; + wp_tdm_api_event_t *rx_event; + + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int res = 0; + unsigned char circuit_frame[1024]; + sangoma_api_hdr_t hdrframe; + int flags_out; + int poll_opt = POLLIN | POLLPRI; + + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + memset(&tdm_api, 0, sizeof(wanpipe_tdm_api_t)); + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || !woomera->interface) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA TDM session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + pthread_exit(NULL); + return NULL; + } + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA TDM session for [%s] started (ptr=%p)\n", + woomera->interface,woomera); + + + for (;;) { + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + res=0; + break; + } + + if (ms->oob_disable) { + poll_opt = POLLIN; + } else { + poll_opt = POLLIN | POLLPRI; + } + res = waitfor_socket(ms->sangoma_sock, 1000, poll_opt, &flags_out); + + + if (res < 0) { + break; + } + + if (res == 0) { +#if 0 + log_printf(SMG_LOG_DEBUG_8, server.log, "%s: TDM UDP Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ +#endif + continue; + } + + + if (flags_out & POLLIN) { + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + + if (res < 0) { + if (!woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + log_printf(SMG_LOG_ALL, server.log, "TDM Read Data Error: %s %s Sockid=%i\n", + woomera->interface, + strerror(errno),ms->sangoma_sock); + } + break; + } + + res = sendto(ms->udp_sock, + circuit_frame, + res, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + if (res < 0) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "UDP Sento Error: %s\n", strerror(errno)); + + } + } + + if (flags_out & POLLPRI) { + + res = sangoma_tdm_read_event(ms->sangoma_sock, &tdm_api); + if (res < 0) { + log_printf(SMG_LOG_ALL, server.log, "TDM Read Event Error: %s %s Sockid=%i\n", + woomera->interface, + strerror(errno),ms->sangoma_sock); + break; + } + + rx_event = &tdm_api.wp_tdm_cmd.event; + + switch (rx_event->wp_tdm_api_event_type){ +# ifdef LIBSANGOMA_GET_HWDTMF + case WP_TDMAPI_EVENT_DTMF: + + /* Only handle hw dtmf if hw_dtmf option is enabled */ + if (!ms->hw_dtmf) { + break; + } + + /* PORT_SOUT = 1 */ + if (rx_event->wp_tdm_api_event_dtmf_port == WAN_EC_CHANNEL_PORT_SOUT && + rx_event->wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { + + handle_event_dtmf(woomera, rx_event->wp_tdm_api_event_dtmf_digit); + } + break; +#endif + default: + log_printf(SMG_LOG_ALL, server.log, "TDM API Unknown OOB Event %i\n", + rx_event->wp_tdm_api_event_type); + break; + } + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + tdm_cnt++; + if (tdm_cnt && tdm_cnt % 1000 == 0) { + log_printf(SMG_LOG_ALL, server.log, "%s: MEDIA TDM TX RX CNT %i %i\n", + woomera->interface,tdm_cnt,res); + } + } +#endif + + } + + if (res < 0) { + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + + /* Good reason to exit */ + + } else { + + log_printf(SMG_LOG_ALL, server.log, "Media TDM Thread: socket error %s Sockid=%i %s Woomera Flags=0x%08X Poll=%s!\n", + woomera->interface,ms->sangoma_sock,strerror(errno),woomera->flags,SMG_DECODE_POLL_ERRORS(flags_out)); + woomera_print_flags(woomera,0); + } + } + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "MEDIA TDM session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + + pthread_exit(NULL); + return NULL; + +} + + +/* This function must be called with process_lock + * because it modifies shared process_table */ + +static int launch_media_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms; + + if ((ms = media_session_new(woomera))) { + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_RUNNING); + result = pthread_create(&ms->thread, &attr, media_thread_run, ms); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(woomera->ms); + + } + pthread_attr_destroy(&attr); + + } else { + log_printf(SMG_LOG_ALL, server.log, "Failed to start new media session\n"); + } + + return result; + +} + +static int launch_media_tdm_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms = woomera_get_ms(woomera); + + if (!ms) { + return result; + } + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + result = pthread_create(&ms->thread, &attr, media_tdm_thread_run, ms); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +static struct woomera_interface * launch_woomera_loop_thread(short_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + char callid[20]; + + sprintf(callid, "s%dc%d", event->span+1,event->chan+1); + + if ((woomera = alloc_woomera())) { + + woomera->chan = event->chan; + woomera->span = event->span; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->loop_tdm=1; + woomera->socket=-1; + + } else { + log_printf(SMG_LOG_ALL, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + woomera_set_interface(woomera,callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = woomera; + pthread_mutex_unlock(&server.process_lock); + + if (launch_woomera_thread(woomera)) { + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + smg_free(woomera); + log_printf(SMG_LOG_ALL, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + return woomera; +} + +static int woomera_message_parse(struct woomera_interface *woomera, struct woomera_message *wmsg, int timeout) +{ + char *cur, *cr, *next = NULL, *eor = NULL; + char buf[2048]; + int res = 0, bytes = 0, sanity = 0; + struct timeval started, ended; + int elapsed, loops = 0; + int failto = 0; + int packet = 0; + int flags_out = 0; + + memset(wmsg, 0, sizeof(*wmsg)); + + if (woomera->socket < 0 ) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX "%s Invalid Socket! %d\n", + woomera->interface,woomera->socket); + return -1; + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_9, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Woomera Message parse: Call Hangup - skipping message parse !\n", + woomera->interface); + return -1; + } + + gettimeofday(&started, NULL); + memset(buf, 0, sizeof(buf)); + + if (timeout < 0) { + timeout = abs(timeout); + failto = 1; + } else if (timeout == 0) { + timeout = -1; + } + + + while (!(eor = strstr(buf, WOOMERA_RECORD_SEPERATOR))) { + if (sanity > 1000) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX "%s Failed Sanity Check!\n[%s]\n\n", woomera->interface, buf); + return -1; + } + + if ((res = waitfor_socket(woomera->socket, 1000, POLLIN, &flags_out) > 0)) { + + res = recv(woomera->socket, buf, sizeof(buf), MSG_PEEK); + + if (res > 1) { + packet++; + } + if (!strncmp(buf, WOOMERA_LINE_SEPERATOR, 2)) { + res = read(woomera->socket, buf, 2); + return 0; + } + if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_9, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + + } else if (res < 0) { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, WOOMERA_DEBUG_PREFIX + "%s error during packet retry (err=%i) Loops#%d (%s)\n", + woomera->interface, res, loops, + strerror(errno)); + return res; + } else if (loops) { + ysleep(100000); + } + } + + gettimeofday(&ended, NULL); + elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000)); + + if (res < 0) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX "%s Bad RECV\n", + woomera->interface); + return res; + } else if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_DEBUG_9, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } + + if (packet && loops > 150) { + log_printf(SMG_LOG_PROD, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout waiting for packet.\n", + woomera->interface); + return -1; + } + + if (timeout > 0 && (elapsed > timeout)) { + log_printf(SMG_LOG_PROD, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout [%d] reached\n", + woomera->interface, timeout); + return failto ? -1 : 0; + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)) { + /* BRB! we have an Event to deliver....*/ + return 0; + } + + /* what're we still doing here? */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + !woomera_test_flag(woomera, WFLAG_RUNNING)) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Woomera Message Parse: Server or Woomera not Running\n", woomera->interface); + return -1; + } + loops++; + } + + *eor = '\0'; + bytes = strlen(buf) + 4; + + memset(buf, 0, sizeof(buf)); + res = read(woomera->socket, buf, bytes); + next = buf; + + log_printf(SMG_LOG_WOOMERA, woomera->log, "%s:WOOMERA RX MSG: %s\n",woomera->interface,buf); + + while ((cur = next)) { + + if ((cr = strstr(cur, WOOMERA_LINE_SEPERATOR))) { + *cr = '\0'; + next = cr + (sizeof(WOOMERA_LINE_SEPERATOR) - 1); + if (!strcmp(next, WOOMERA_RECORD_SEPERATOR)) { + break; + } + } + if (!cur || !*cur) { + break; + } + + if (!wmsg->last) { + char *cmd, *id, *args; + woomera_set_flag(wmsg, MFLAG_EXISTS); + cmd = cur; + + if ((id = strchr(cmd, ' '))) { + *id = '\0'; + id++; + if ((args = strchr(id, ' '))) { + *args = '\0'; + args++; + strncpy(wmsg->command_args, args, sizeof(wmsg->command_args)-1); + } + strncpy(wmsg->callid, id, sizeof(wmsg->callid)-1); + } + + strncpy(wmsg->command, cmd, sizeof(wmsg->command)-1); + } else { + char *name, *val; + name = cur; + + if ((val = strchr(name, ':'))) { + *val = '\0'; + val++; + while (*val == ' ') { + *val = '\0'; + val++; + } + strncpy(wmsg->values[wmsg->last-1], val, WOOMERA_STRLEN); + } + strncpy(wmsg->names[wmsg->last-1], name, WOOMERA_STRLEN); + if (name && val && !strcasecmp(name, "content-type")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + if (name && val && !strcasecmp(name, "content-length")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + + + } + wmsg->last++; + } + + wmsg->last--; + + if (bytes && woomera_test_flag(wmsg, MFLAG_CONTENT)) { + int terr; + terr=read(woomera->socket, wmsg->body, + (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); + } + + return woomera_test_flag(wmsg, MFLAG_EXISTS); + +} + +static struct woomera_interface *pull_from_holding_tank(int index, int span , int chan) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + + /* Block this index until the call is completed */ + server.holding_tank[index] = &woomera_dead_dev; + + woomera->index = 0; + woomera->span=span; + woomera->chan=chan; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static void clear_all_holding_tank(void) +{ + int i; + pthread_mutex_lock(&server.ht_lock); + for (i=0;i= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + woomera = server.holding_tank[index]; + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + + +static void clear_from_holding_tank(int index, struct woomera_interface *woomera) +{ + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] == &woomera_dead_dev) { +#if 0 + log_printf(SMG_LOG_ALL,server.log, "%s Clearing DEAD id=%i OK\n", + __FUNCTION__,index); +#endif + server.holding_tank[index] = NULL; + } else if (woomera && server.holding_tank[index] == woomera) { +#if 0 + log_printf(SMG_LOG_ALL,server.log, "%s Clearing ACTIVE Woomera id=%i OK\n", + __FUNCTION__,index); +#endif + server.holding_tank[index] = NULL; + } else if (server.holding_tank[index]) { + log_printf(SMG_LOG_ALL, server.log, "Critical Error: Holding tank index %i not cleared %p !\n", + index, server.holding_tank[index]); + } + pthread_mutex_unlock(&server.ht_lock); + + return; +} + +static struct woomera_interface *peek_from_holding_tank(int index) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(SMG_LOG_ALL, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static int add_to_holding_tank(struct woomera_interface *woomera) +{ + int next, i, found=0; + + pthread_mutex_lock(&server.ht_lock); + + for (i=0;i= CORE_TANK_LEN) { + next = server.holding_tank_index = 1; + } + + if (next == 0) { + log_printf(SMG_LOG_ALL, server.log, "\nCritical Error on TANK INDEX == 0\n"); + continue; + } + + if (server.holding_tank[next]) { + continue; + } + + found=1; + break; + } + + if (!found) { + /* This means all tank vales are busy + * should never happend */ + pthread_mutex_unlock(&server.ht_lock); + log_printf(SMG_LOG_ALL, server.log, "\nCritical Error failed to obtain a TANK INDEX\n"); + return 0; + } + + server.holding_tank[next] = woomera; + woomera->timeout = time(NULL) + server.call_timeout; + + pthread_mutex_unlock(&server.ht_lock); + return next; +} + + + +static void handle_event_dtmf(struct woomera_interface *woomera, unsigned char dtmf_digit) +{ + struct woomera_event wevent; + + memset(&wevent, 0, sizeof(struct woomera_event)); + + new_woomera_event_printf(&wevent, "EVENT DTMF %sUnique-Call-Id:%s%sContent-Length:%d%s%s%c%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 1, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + dtmf_digit, + WOOMERA_RECORD_SEPERATOR); + + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + return; +} + +static int handle_woomera_progress(struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + call_signal_event_t event; + int err=-1; + + memset(&event, 0, sizeof(event)); + + call_signal_event_init((short_signal_event_t*)&event, SIGBOOST_EVENT_CALL_PROGRESS, woomera->chan, woomera->span); + sprintf(event.isup_in_rdnis,"SMG003-EVI-2"); + event.isup_in_rdnis_size=strlen(event.isup_in_rdnis); + if (woomera->index >= 0) { + event.call_setup_id = woomera->index; + } + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + if (!woomera_check_running(woomera)) { + socket_printf(woomera->socket, "405 PROGRESS Channel already hungup%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + if (!woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + + socket_printf(woomera->socket, "405 PROGRESS Channel not aceked%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + err=isup_exec_event(&event); + if (err == 0) { + socket_printf(woomera->socket, + "200 %s PROGRESS OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + socket_printf(woomera->socket, "405 PROGRESS Boost failure%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } + + return err; +} + +static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, + struct woomera_message *wmsg, + int media, int answer, int accept) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + struct woomera_event wevent; + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + if (!woomera_check_running(woomera)) { + + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n"); + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call already hungup!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera->timeout=0; + return -1; + } + + log_printf(SMG_LOG_DEBUG_MISC, server.log,"WOOMERA: GOT %s EVENT: [%s] RAW=%s\n", + wmsg->command,wmsg->callid,raw); + + + if (raw && + woomera->raw == NULL && + !woomera_test_flag(woomera, WFLAG_RAW_MEDIA_STARTED)) { + + woomera_set_flag(woomera, WFLAG_RAW_MEDIA_STARTED); + + woomera_set_raw(woomera, raw); + + if (launch_media_thread(woomera)) { + + log_printf(SMG_LOG_DEBUG_8, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + woomera->timeout=0; + return -1; + } + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log,"ERROR! Monitor Thread not running!\n"); + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + return -1; + + } else { + + if (accept) { + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + } + + if (answer) { + struct media_session *ms; + + pthread_mutex_lock(&woomera->ms_lock); + if ((ms=woomera->ms)) { + time(&woomera->ms->answered); + } + pthread_mutex_unlock(&woomera->ms_lock); + + if (ms) { + + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_ANSWERED, + 0); + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "Sent SIGBOOST_EVENT_CALL_ANSWERED [s%dc%d]\n", + woomera->span+1,woomera->chan+1); + } else { + struct woomera_event wevent; + log_printf(SMG_LOG_ALL, server.log, + "WOOMERA ANSWER: FAILED [%s] no Media \n", + wmsg->command,wmsg->callid); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + woomera->timeout=0; + return -1; + } + } + } + + new_woomera_event_printf(&wevent, "200 %s OK%s" + "Unique-Call-Id: %s%s", + answer ? "ANSWER" : + accept ? "ACCEPT" : "MEDIA", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + return 0; +} + +static int handle_woomera_call_start (struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + call_signal_event_t event; + char *calling = woomera_message_header(wmsg, "local-number"); +#ifdef SMG_CALLING_NAME + char *calling_name = woomera_message_header(wmsg, "local-name"); +#endif + char *presentation = woomera_message_header(wmsg, "Presentation"); + char *screening = woomera_message_header(wmsg, "Screening"); + char *rdnis = woomera_message_header(wmsg, "RDNIS"); + char *bearer_cap = woomera_message_header(wmsg, "Bearer-Cap"); + char *uil1p = woomera_message_header(wmsg, "uil1p"); + char *called = wmsg->callid; + char *grp = wmsg->callid; + char *profile; + char *p; + int cause = 34; + int tg = 0; + int huntgroup = SIGBOOST_HUNTGRP_SEQ_ASC; + + if (smg_check_all_busy() || + woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + + + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, + "405 SMG Server All Ckt Busy!%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "SMG Server Full %d (ckt busy cnt=%i)\n", + server.call_count, server.all_ckt_busy); + return -1; + } + + + /* Remove profile name out of destiantion */ + if ((profile = strchr(called, ':'))) { + profile++; + called=profile; + grp=profile; + } + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "New Call %d/%d origdest=%s newdest=%s\n", + server.call_count, server.max_calls, wmsg->callid, called); + + switch(called[0]) { + case 'g': + huntgroup = SIGBOOST_HUNTGRP_SEQ_ASC; + break; + case 'G': + huntgroup = SIGBOOST_HUNTGRP_SEQ_DESC; + break; + case 'r': + huntgroup = SIGBOOST_HUNTGRP_RR_ASC; + break; + case 'R': + huntgroup = SIGBOOST_HUNTGRP_RR_DESC; + break; + default: + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "Warning: Failed to determine huntgroup (%s)\n", + called); + huntgroup = SIGBOOST_HUNTGRP_SEQ_ASC; + } + + if ((p = strchr(called, '/'))) { + *p = '\0'; + called = p+1; + tg = atoi(grp+1) - 1; + if (tg < 0) { + tg=0; + } + } + + woomera->trunk_group=tg; + if (raw) { + woomera_set_raw(woomera, raw); + } + + woomera->index = add_to_holding_tank(woomera); + if (woomera->index < 1) { + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Tanks Busy!%s", + WOOMERA_RECORD_SEPERATOR); + log_printf(SMG_LOG_ALL, woomera->log, "Error: Call Tank Full (Call Cnt=%i)\n", + server.call_count); + return -1; + } + + + woomera->index_hold = woomera->index; + + call_signal_call_init(&event, calling, called, woomera->index); + + if (presentation) { + event.calling_number_presentation = atoi(presentation); + } else { + event.calling_number_presentation = 0; + } + + if (screening) { + event.calling_number_screening_ind = atoi(screening); + } else { + event.calling_number_screening_ind = 0; + } + + event.isup_in_rdnis_size=0; + event.isup_in_rdnis[0]=0; + + if (rdnis && strlen(rdnis) ) { + + if (strlen(rdnis) > sizeof(event.isup_in_rdnis)){ + log_printf(SMG_LOG_ALL,server.log,"Error: RDNIS Overflow (in size=%i max=%i)\n", + strlen(rdnis), sizeof(event.isup_in_rdnis)); + + } else { + + strncpy(event.isup_in_rdnis,rdnis, + sizeof(event.isup_in_rdnis)-1); + event.isup_in_rdnis_size=strlen(rdnis)+1; + log_printf(SMG_LOG_DEBUG_MISC,server.log,"RDNIS %s\n", rdnis); + } + + } + + if (bearer_cap && strlen(bearer_cap)) { + event.bearer.capability = bearer_cap_to_code(bearer_cap); + woomera->bearer_cap = event.bearer.capability; + } + + if (uil1p && strlen(uil1p)) { + event.bearer.uil1p = uil1p_to_code(uil1p); + } + +#ifdef SMG_CALLING_NAME + if (calling_name) { + strncpy((char*)event.calling_name,calling_name, + sizeof(event.calling_name)-1); + } +#endif + + event.trunk_group = tg; + event.hunt_group = huntgroup; + + if (call_signal_connection_write(&server.mcon, &event) < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, + "405 SMG Signalling Contestion!%s", + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + socket_printf(woomera->socket, "100 Trying%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Call Called Event [Setup ID: %d] TG=%d\n", + woomera->index,tg); + + return 0; +} + + +static void interpret_command(struct woomera_interface *woomera, struct woomera_message *wmsg) +{ + int answer = 0, media = 0, accept=0; + char *unique_id; + int cause=0; + + + + if (!strcasecmp(wmsg->command, "call")) { + int err; + + if (strlen(woomera->session) != 0) { + /* Call has already been placed */ + socket_printf(woomera->socket, "400 Error Call already in progress %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(SMG_LOG_ALL,server.log,"Woomera RX Call Even while call in progress!\n"); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(34), + WOOMERA_LINE_SEPERATOR, + 34, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Ckt Reset!%s", WOOMERA_RECORD_SEPERATOR); + + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + err=handle_woomera_call_start(woomera,wmsg); + if (err) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + return; + + } else if (!strcasecmp(wmsg->command, "bye") || !strcasecmp(wmsg->command, "quit")) { + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (cause) { + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Bye Cause Received: [%s]\n", cause); + } + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: Bye Received: [%s]\n", woomera->interface); + + woomera_clear_flag(woomera, WFLAG_RUNNING); + socket_printf(woomera->socket, "200 Connection closed%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + + } else if (!strcasecmp(wmsg->command, "listen")) { + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + socket_printf(woomera->socket, "405 Listener already started%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + + woomera_set_flag(woomera, WFLAG_LISTENING); + add_listener(woomera); + log_printf(SMG_LOG_ALL,woomera->log, "Starting Listen Device!\n"); + + socket_printf(woomera->socket, "%s", + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "200 Listener enabled%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } + return; + + } else if ((media = !strcasecmp(wmsg->command, "debug"))) { + + int debug_level=atoi(wmsg->callid); + + if (debug_level < 10) { + server.debug=debug_level; + log_printf(SMG_LOG_ALL,server.log,"SMG Debugging set to %i (window=%i)\n",server.debug,server.mcon.txwindow); + } + + return; + } + + if (!strcasecmp(wmsg->command, "hangup")) { + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + + if (q931cause && atoi(q931cause)) { + log_printf(SMG_LOG_DEBUG_8,server.log,"Woomera Hangup setting cause to %s %i\n", + q931cause,atoi(q931cause)); + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + /* Continue Through */ + } + + + + unique_id = woomera_message_header(wmsg, "Unique-Call-Id"); + if (!unique_id) { + + cause=111; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "400 Woomera cmd without uniquie id%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_CALL,server.log,"Woomera RX Event (%s) without unique id!\n",wmsg->command); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (strlen(woomera->session) == 0) { + struct woomera_interface *session_woomera=NULL; + char *session=NULL; + int span, chan; + char ifname[100]; + int err; + + /* If session does not exist this is an incoming call */ + err=sscanf(unique_id, "s%dc%d", &span, &chan); + if (err!=2) { + err=sscanf(unique_id, "w%dg%d", &span, &chan); + } + span--; + chan--; + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "WOOMERA Got CMD %s Span=%d Chan=%d from session %s\n", + wmsg->command,span,chan,unique_id); + + if (smg_validate_span_chan(span,chan) != 0) { + + cause=81; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Invalid span/chan in session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "WOOMERA Warning invalid span chan in session %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + pthread_mutex_lock(&server.process_lock); + session = server.process_table[span][chan].session; + session_woomera = server.process_table[span][chan].dev; + + /* This scenario is very common when we have multile clients + where multiple clients race get the incoming call */ + if (session_woomera) { + pthread_mutex_unlock(&server.process_lock); + + cause=81; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Session not found%s" + WOOMERA_RECORD_SEPERATOR); + + + log_printf(SMG_LOG_DEBUG_8, woomera->log, "WOOMERA Error channel in use %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (!session || strlen(session) == 0 || + strncmp(session,unique_id,sizeof(woomera->session))){ + pthread_mutex_unlock(&server.process_lock); + + /* Invalid call reference */ + cause=81; + socket_printf(woomera->socket, "event hangup %s" + "cause: %s%s" + "q931-cause-code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Invalid/Expired Session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "WOOMERA Warning: Cmd=%s with invalid session %s (orig=%s)\n", + wmsg->command,unique_id,session?session:"N/A"); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + +#if 1 + if (!strcasecmp(wmsg->command, "hangup")) { + int clients=server.process_table[span][chan].clients; + if (server.process_table[span][chan].clients < 0) { + + log_printf(SMG_LOG_ALL, woomera->log, "WOOMERA CMD: Warning Clients (%i) Race condition on Hangup [s%dc%d]\n", + clients, span+1,chan+1); + + } else if (server.process_table[span][chan].clients > 1) { + server.process_table[span][chan].clients--; + pthread_mutex_unlock(&server.process_lock); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Got Hungup on Multiple Clients %i, skipping hangup [s%dc%d]\n", + clients, span+1,chan+1); + + cause=16; + socket_printf(woomera->socket, "event hangup %s" + "cause: %s%s" + "q931-cause-code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Hangup on multiple session%s" + WOOMERA_RECORD_SEPERATOR); + + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Hanging up channel [s%dc%d]\n", + span+1,chan+1); + } +#endif + + server.process_table[span][chan].dev=woomera; + strncpy(woomera->session,unique_id,sizeof(woomera->session)); + sprintf(ifname,"s%dc%d",span+1,chan+1); + woomera_set_interface(woomera, ifname); + + woomera->span=span; + woomera->chan=chan; + + /* Save bearer cap that came in on incoming call event */ + woomera->bearer_cap = server.process_table[span][chan].bearer_cap; + + /* set it to 1 so that queued digits are checked on proceed message */ + woomera->check_digits = 1; + + pthread_mutex_unlock(&server.process_lock); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA Got New If=%s Session %s\n", + woomera->interface, woomera->session); + + + } else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) { + + cause=81; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Session Mis-match%s" + WOOMERA_RECORD_SEPERATOR); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (!strcasecmp(wmsg->command, "dtmf")) { + + log_printf(SMG_LOG_WOOMERA, woomera->log, + "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n", + woomera->interface, wmsg->command_args, wmsg->body); + + wanpipe_send_dtmf(woomera,wmsg->body); + + socket_printf(woomera->socket, "200 DTMF OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "hangup")) { + + int chan = -1, span = -1; + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + span=woomera->span; + chan=woomera->chan; + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "WOOMERA CMD: Hangup Received: [%s] MEDIA EXIST Cause=%s\n", + woomera->interface,cause); + + if (smg_validate_span_chan(span,chan) != 0) { + + socket_printf(woomera->socket, "405 No Such Channel%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + } + + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "Hangup Received: [s%dc%d]\n", + span+1,chan+1); + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + + socket_printf(woomera->socket, "200 HANGUP OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if (!strcasecmp(wmsg->command, "proceed")) { + + log_printf(SMG_LOG_WOOMERA, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + socket_printf(woomera->socket, + "200 %s PROCEED OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if (!strcasecmp(wmsg->command, "progress")) { + + handle_woomera_progress(woomera,wmsg); + + + } else if ((media = !strcasecmp(wmsg->command, "media")) || + (answer = !strcasecmp(wmsg->command, "answer")) || + (accept = !strcasecmp(wmsg->command, "accept"))) { + + handle_woomera_media_accept_answer(woomera, wmsg, media,answer,accept); + + + } else { + log_printf(SMG_LOG_ALL, server.log,"WOOMERA INVALID EVENT: %s [%s] \n", + wmsg->command,wmsg->callid); + socket_printf(woomera->socket, "501 Command '%s' not implemented%s", + wmsg->command, WOOMERA_RECORD_SEPERATOR); + } +} + + +/* + EVENT INCOMING 1 + Remote-Address: 10.3.3.104 + Remote-Number: + Remote-Name: Anthony Minessale!8668630501 + Protocol: H.323 + User-Agent: Post Increment Woomera 1.0alpha1 (OpenH323 v1.17.2) 9/61 + H323-Call-Id: 887b1ff8-bb1f-da11-85c0-0007e98988c4 + Local-Number: 996 + Start-Time: Fri, 09 Sep 2005 12:25:14 -0400 + Local-Name: root +*/ + + +static void handle_call_answer(short_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int kill = 0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + char callid[80]; + struct woomera_event wevent; + + woomera->timeout = 0; + + if (!woomera->raw) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to answer call with no media!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_ANSWER)) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to double-answer a call!\n"); + kill++; + goto handle_call_answer_end; + } + + woomera_set_flag(woomera, WFLAG_ANSWER); + + if (woomera->span != event->span || woomera->chan != event->chan) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to start media on a different channel from the one we agreed on.!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to answer a dead call!\n"); + kill++; + } else { + int err; + err=0; + sprintf(callid, "s%dc%d", event->span + 1, event->chan + 1); + woomera_set_interface(woomera, callid); +#ifndef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(SMG_LOG_ALL, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + kill++; + } +#endif + + if (!kill) { + new_woomera_event_printf(&wevent, "EVENT CONNECT s%dc%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + } + } else { + log_printf(SMG_LOG_PROD, server.log, "Answer requested on non-existant session. [s%dc%d]\n", + event->span+1, event->chan+1); + kill++; + } + +handle_call_answer_end: + + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + +/* This can casuse a double STOP + must be debugged further */ +#if 0 + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to Answer without session [s%dc%d]\n", + event->span+1, event->chan+1); +#endif + log_printf(SMG_LOG_ALL, server.log, "WARNING: Received Answer with no session [s%dc%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_ack(short_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + struct woomera_event wevent; + int kill = 0; + + if ((woomera = peek_from_holding_tank(event->call_setup_id))) { + char callid[80]; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_PROD, server.log, "Refusing to ack a dead call!\n"); + kill++; + } else { + int err, span, chan; + + pull_from_holding_tank(event->call_setup_id,event->span,event->chan); + sprintf(callid, "s%dc%d", event->span + 1, event->chan + 1); + + span = event->span; + chan = event->chan; + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + woomera_set_interface(woomera, callid); + + pthread_mutex_lock(&server.process_lock); + + if (server.process_table[span][chan].dev) { + struct woomera_interface *tmp_woomera = server.process_table[span][chan].dev; + woomera_set_flag(tmp_woomera,WFLAG_HANGUP); + woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END); + log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [s%dc%d] - Call ACK!\n", event->span+1, event->chan+1); + kill++; + } + + server.process_table[span][chan].dev = woomera; + sprintf(woomera->session,"%s-%i-%i",callid,rand(),rand()); + sprintf(server.process_table[span][chan].session,"%s-%s", + callid,woomera->session); + + + memset(server.process_table[span][chan].digits, 0, + sizeof(server.process_table[span][chan].digits)); + + server.process_table[span][chan].digits_len = 0; + + pthread_mutex_unlock(&server.process_lock); + + if (kill) { + goto woomera_call_ack_skip; + } + +#ifdef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(SMG_LOG_ALL, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id:%s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + kill++; + } +#endif + if (!kill) { + + new_woomera_event_printf(&wevent, "EVENT PROCEED s%dc%d%s" + "Channel-Name: g%d/%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->trunk_group+1, + (event->span*max_chans)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "201 Accepted%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Call Answered Event ID = %d Device = s%dc%d!\n", + event->call_setup_id,woomera->span+1,woomera->chan+1); + } + } + } else { + log_printf(SMG_LOG_PROD, server.log, + "Event (START ACK) %d referrs to a non-existant session (%d) [s%dc%d]!\n", + event->event_id, event->call_setup_id,event->span+1, event->chan+1); + kill++; + } + +woomera_call_ack_skip: + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(SMG_LOG_PROD, server.log, "Sent CALL STOP to CALL START ACK without session [s%dc%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_nack(short_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int span=-1, chan=-1; + int ack=0; + + /* Always ACK the incoming NACK + * Send out the NACK ACK before pulling the TANK, because + * if we send after the pull, the outgoing call could send + * a message to boost with the pulled TANK value before + * we send a NACK ACK */ + + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + if (event->call_setup_id > 0) { + woomera=peek_from_holding_tank(event->call_setup_id); + } + + if (woomera) { + + struct woomera_event wevent; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(SMG_LOG_ALL, server.log, "Event CALL START NACK on hungup call [%d]!\n", + event->call_setup_id); + ack++; + } else { + + woomera_set_cause_topbx(woomera,event->release_cause); + woomera_set_flag(woomera, (WFLAG_HANGUP|WFLAG_HANGUP_NACK_ACK)); + + new_woomera_event_printf(&wevent, "EVENT HANGUP s%dc%d%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + /* Do not ack here, let woomera thread ack it */ + ack=0; + } + + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + + if (woomera) { + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hang up */ + woomera=NULL; + } else { + /* At this point call is already hang up */ + woomera=NULL; + } + } + + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event START NACK on s%dc%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + if (!woomera_test_flag(woomera,WFLAG_HANGUP)){ + if (event->release_cause == SIGBOOST_CALL_SETUP_CSUPID_DBL_USE || + event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + woomera_set_cause_topbx(woomera,17); + } else { + woomera_set_cause_topbx(woomera,event->release_cause); + } + } + + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END|WFLAG_HANGUP_NACK_ACK)); + + /* Nack Ack will be sent by the woomera thread */ + ack=0; + } else { + /* Valid state when we are not in autoacm mode */ + ack++; + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event: NACK no woomera on span chan [s%dc%d]!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(SMG_LOG_ALL, server.log, + "Error: Start Nack Invalid State Should not happen [%d] [s%dc%d]!\n", + event->call_setup_id, event->span+1, event->chan+1); + ack++; + } + + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + smg_all_ckt_busy(); + log_printf(SMG_LOG_ALL, server.log, "WARNING: All ckt busy Timeout=%i!\n",server.all_ckt_busy); + } + if (event->release_cause == SIGBOOST_CALL_SETUP_CSUPID_DBL_USE) { + log_printf(SMG_LOG_ALL, server.log, "WARNING: Double use on [s%ic%i] setup id %i!\n", + event->span+1,event->chan+1,event->call_setup_id); + } + +#warning "Ignoring CALL GAP" +#if 0 + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP) { + log_printf(SMG_LOG_ALL, server.log, "WARNING: Call Gapping Detected!\n"); + smg_all_ckt_gap(); + } +#endif + + if (ack) { + span=0; + chan=0; + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + isup_exec_command(span, + chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + if (!woomera) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [s%dc%d]!\n", + event->event_id,event->call_setup_id, event->span+1, event->chan+1); + } + } +} + +static void handle_call_loop_start(short_signal_event_t *event) +{ + struct woomera_interface *woomera; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + + + log_printf(SMG_LOG_PROD, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [s%dc%d] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + + sprintf(callid, "s%dc%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + + woomera=launch_woomera_loop_thread(event); + if (woomera == NULL) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + log_printf(SMG_LOG_PROD, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [s%dc%d] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + } + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + + return; +} + + +static void handle_call_start(call_signal_event_t *event) +{ + struct woomera_event wevent; + char callid[20]; + char *session; + struct woomera_interface *tmp_woomera=NULL; + int clients; + + remove_end_of_digits_char((unsigned char*)event->called_number_digits); + remove_end_of_digits_char((unsigned char*)event->calling_number_digits); + + if (server.strip_cid_non_digits) { + validate_number((unsigned char*)event->called_number_digits); + validate_number((unsigned char*)event->calling_number_digits); + } + + if (smg_validate_span_chan(event->span,event->chan)) { + log_printf(0,server.log, + "Error: invalid span=% chan=%i on incoming call [s%dc%d] - Call START!\n", + event->span+1, event->chan+1, event->span+1,event->chan+1); + return; + } + + pthread_mutex_lock(&server.process_lock); + + if ((tmp_woomera=server.process_table[event->span][event->chan].dev)) { + + woomera_set_flag(tmp_woomera,WFLAG_HANGUP); + woomera_set_flag(tmp_woomera,WFLAG_MEDIA_END); + log_printf(SMG_LOG_ALL,server.log,"Call Overrun on [s%dc%d] - Call START!\n", event->span+1, event->chan+1); + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + + log_printf(SMG_LOG_ALL, server.log, + "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [s%dc%d]\n", + event->span+1, event->chan+1); + + pthread_mutex_unlock(&server.process_lock); + return; + } + + sprintf(callid, "s%dc%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].digits, 0, sizeof(server.process_table[event->span][event->chan].digits)); + server.process_table[event->span][event->chan].digits_len = 0; + server.process_table[event->span][event->chan].bearer_cap = event->bearer.capability; + server.process_table[event->span][event->chan].clients=0; + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + + log_printf(SMG_LOG_DEBUG_8,server.log,"BEARER %i , UIL1P = %i\n", + event->bearer.capability,event->bearer.uil1p); + + if (event->bearer.uil1p == 0) { + if (server.hw_coding) { + event->bearer.uil1p=BC_IE_UIL1P_G711_ALAW; + } else { + event->bearer.uil1p=BC_IE_UIL1P_G711_ULAW; + } + } + + new_woomera_event_printf(&wevent, "EVENT INCOMING s%dc%d%s" + "Unique-Call-Id: %s%s" + "Remote-Number: %s%s" + "Remote-Name: %s%s" +#if defined(BRI_PROT) + "Protocol: BRI%s" +#else +#if defined(PRI_PROT) + "Protocol: PRI%s" +#else + "Protocol: SS7%s" +#endif +#endif + "User-Agent: sangoma_mgd%s" + "Local-Number: %s%s" + "Channel-Name: g%d/%d%s" + "Trunk-Group: %d%s" + "Presentation: %d%s" + "Screening: %d%s" + "RDNIS: %s%s" + "Bearer-Cap: %s%s" + "uil1p: %s%s" + , + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + session, + WOOMERA_LINE_SEPERATOR, + event->calling_number_digits, + WOOMERA_LINE_SEPERATOR, + event->calling_name, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + event->called_number_digits, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + (event->span*max_chans)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + WOOMERA_LINE_SEPERATOR, + event->calling_number_presentation, + WOOMERA_LINE_SEPERATOR, + event->calling_number_screening_ind, + WOOMERA_LINE_SEPERATOR, + event->isup_in_rdnis, + WOOMERA_LINE_SEPERATOR, + bearer_cap_to_str(event->bearer.capability), + WOOMERA_LINE_SEPERATOR, + uil1p_to_str(event->bearer.uil1p), + WOOMERA_RECORD_SEPERATOR + ); + + clients=enqueue_event_on_listeners(&wevent); + if (!clients) { + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + 17); + log_printf(SMG_LOG_ALL, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [s%dc%d]\n", + event->span+1, event->chan+1); + + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + 17); + log_printf(SMG_LOG_ALL, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_START_NACK [s%dc%d]\n", + event->span+1, event->chan+1); + + } + + } else { + //pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].clients = clients; + //pthread_mutex_unlock(&server.process_lock); + } + + destroy_woomera_event_data(&wevent); + +} + +static void handle_incoming_digit(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + int digits_len; + + if (smg_validate_span_chan(event->span,event->chan)) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event DTMF on invalid span chan [s%dc%d] !\n", + event->span+1, event->chan+1); + return; + } + + + if (!event->called_number_digits_count) { + log_printf(SMG_LOG_ALL, server.log, "Error Incoming digit with len %s %d [s%dc%d]\n", + event->called_number_digits, + event->called_number_digits_count, + event->span+1, event->chan+1); + } + + log_printf(SMG_LOG_DEBUG_9, server.log, "Queuing incoming digits %s [s%dc%d]\n", + event->called_number_digits, + event->span+1, event->chan+1); + + pthread_mutex_lock(&server.digits_lock); + + digits_len = server.process_table[event->span][event->chan].digits_len; + + strncpy(&server.process_table[event->span][event->chan].digits[digits_len], + event->called_number_digits, + event->called_number_digits_count); + + server.process_table[event->span][event->chan].digits_len += event->called_number_digits_count; + + pthread_mutex_unlock(&server.digits_lock); + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + if (!woomera || !strlen(woomera->session)) { + return; + } + woomera_check_digits(woomera); +} + +static void handle_gap_abate(short_signal_event_t *event) +{ + log_printf(SMG_LOG_ALL, server.log, "NOTICE: GAP Cleared!\n", + event->span+1, event->chan+1); + smg_clear_ckt_gap(); +} + +static void handle_restart(call_signal_connection_t *mcon, short_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + /* Clear Reset */ + /* Tell all threads to go down */ + + log_printf(SMG_LOG_ALL, server.log, + "RESTART Received: resetting all threads\n"); + + smg_all_ckt_busy(); + woomera_set_flag(&server.master_connection, WFLAG_SYSTEM_RESET); + gettimeofday(&server.restart_timeout,NULL); + +#if 0 + sleep(5); + + clear_all_holding_tank(); + + sleep(2); + + event->event_id = SIGBOOST_EVENT_SYSTEM_RESTART_ACK; + err=call_signal_connection_write(&server.mcon, (call_signal_event_t*)event); + if (err < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + + smg_all_ckt_busy(); + woomera_clear_flag(&server.master_connection, WFLAG_SYSTEM_RESET); +#endif + } + +} + +static void handle_restart_ack(call_signal_connection_t *mcon, short_signal_event_t *event) +{ + + /* Do not reset WFLAG_SYSTEM_RESET flag here!. The flag should + only be reset on restart from boost */ + //woomera_clear_flag(&server.master_connection, WFLAG_SYSTEM_RESET); +} + + + +static void handle_remove_loop(short_signal_event_t *event) +{ + struct woomera_interface *woomera; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + server.process_table[event->span][event->chan].dev=NULL; + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP)); + + /* We have to close the socket because + At this point we are release span chan */ + + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event REMOVE LOOP on s%dc%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } +} + + +static void handle_call_stop(short_signal_event_t *event) +{ + struct woomera_interface *woomera; + int ack=0; + + woomera = NULL; + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + if (woomera) { + + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + //server.process_table[event->span][event->chan].dev=NULL; + + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hangup */ + woomera=NULL; + } else { + /* At this point call is already hangup */ + woomera=NULL; + } + } + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + woomera_set_cause_topbx(woomera,event->release_cause); + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP|WFLAG_HANGUP_ACK)); + + /* We have to close the socket because + At this point we are release span chan */ + + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP on s%dc%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } else { + ack++; + } + + + if (ack) { + /* At this point we have already sent our STOP so its safe to ACK */ + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); + } + + if (!woomera){ + /* This is allowed on incoming call if remote app does not answer it */ + log_printf(SMG_LOG_DEBUG_MISC, server.log, "Event CALL STOP referrs to a non-existant session [s%dc%d]!\n", + event->span+1, event->chan+1); + } +} + +static void handle_heartbeat(short_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + int err=call_signal_connection_writep(&server.mconp, (call_signal_event_t*)event); + if (err < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + } + return; +} + + +static void handle_call_stop_ack(short_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Stop Ack on [s%dc%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id, + woomera->interface); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + } else { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [s%dc%d] [Setup ID: %d]!\n", + event->event_id, event->span+1, event->chan+1, event->call_setup_id); + } + + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id, NULL); + } + + /* No need for us to do any thing here */ + return; +} + + +static void handle_call_start_nack_ack(short_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + if ((woomera=pull_from_holding_tank(event->call_setup_id,-1,-1))) { + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + } else { + /* Possible if incoming call is NACKed due to + * woomera client being down, in this case no + * woomera thread is created */ + log_printf(SMG_LOG_DEBUG_8, server.log, + "Event NACK ACK [s%dc%d] with valid span/chan no dev!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "Event NACK ACK referrs to a non-existant session [s%dc%d] [Setup ID: %d]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } + + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id, NULL); + } + + /* No need for us to do any thing here */ + return; +} + + +static int parse_ss7_event(call_signal_connection_t *mcon, short_signal_event_t *event) +{ + int ret = 0; + + switch(event->event_id) { + + case SIGBOOST_EVENT_CALL_START: + handle_call_start((call_signal_event_t*)event); + break; + case SIGBOOST_EVENT_CALL_STOPPED: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_CALL_START_ACK: + handle_call_start_ack(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK: + handle_call_start_nack(event); + break; + case SIGBOOST_EVENT_CALL_ANSWERED: + handle_call_answer(event); + break; + case SIGBOOST_EVENT_HEARTBEAT: + handle_heartbeat(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK_ACK: + handle_call_start_nack_ack(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED_ACK: + handle_call_stop_ack(event); + break; + case SIGBOOST_EVENT_INSERT_CHECK_LOOP: + handle_call_loop_start(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART: + handle_restart(mcon,event); + break; + case SIGBOOST_EVENT_REMOVE_CHECK_LOOP: + handle_remove_loop(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART_ACK: + handle_restart_ack(mcon,event); + break; + case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE: + handle_gap_abate(event); + break; + case SIGBOOST_EVENT_DIGIT_IN: + handle_incoming_digit((call_signal_event_t*)event); + break; + default: + log_printf(SMG_LOG_ALL, server.log, "Warning no handler implemented for [%s val:%d]\n", + call_signal_event_id_name(event->event_id), event->event_id); + break; + } + + return ret; +} + + +static void *monitor_thread_run(void *obj) +{ + int ss = 0; + int policy=0,priority=0; + char a=0,b=0; + call_signal_connection_t *mcon=&server.mcon; + call_signal_connection_t *mconp=&server.mconp; + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + + if (call_signal_connection_open(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(SMG_LOG_ALL, server.log, "Error: Opening MCON Socket [%d] %s\n", + mcon->socket,strerror(errno)); + exit(-1); + } + + if (call_signal_connection_open(mconp, + mconp->cfg.local_ip, + mconp->cfg.local_port, + mconp->cfg.remote_ip, + mconp->cfg.remote_port) < 0) { + log_printf(SMG_LOG_ALL, server.log, "Error: Opening MCONP Socket [%d] %s\n", + mconp->socket,strerror(errno)); + exit(-1); + } + + mcon->log = server.log; + mconp->log = server.log; + + isup_exec_commandp(0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + + woomera_set_flag(&server.master_connection, WFLAG_SYSTEM_RESET); + + smg_get_current_priority(&policy,&priority); + + log_printf(SMG_LOG_PROD, server.log, "Open udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + log_printf(SMG_LOG_PROD, server.log, "Monitor Thread Started (%i:%i)\n",policy,priority); + + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { +#if 0 + ss = waitfor_socket(server.mcon.socket, 1000, POLLERR | POLLIN); +#else + ss = waitfor_2sockets(mcon->socket, + mconp->socket, + &a, &b, 1000); +#endif + + if (ss > 0) { + + call_signal_event_t *event=NULL; + int i=0; + + if (b) { +mcon_retry_priority: + if ((event = call_signal_connection_readp(mconp,i))) { + log_printf(SMG_LOG_DEBUG_9, server.log, "Socket Event P [%s] \n", + call_signal_event_id_name(event->event_id)); + parse_ss7_event(mconp,(short_signal_event_t*)event); + if (++i < 10) { + goto mcon_retry_priority; + } + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(SMG_LOG_ALL, server.log, + "Error: Reading from Boost P Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + i=0; + + if (a) { + if ((event = call_signal_connection_read(mcon,i))) { + log_printf(SMG_LOG_DEBUG_9, server.log, "Socket Event [%s]\n", + call_signal_event_id_name(event->event_id)); + parse_ss7_event(mcon,(short_signal_event_t*)event); + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(SMG_LOG_ALL, server.log, + "Error: Reading from Boost Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + } + + if (ss < 0){ + log_printf(SMG_LOG_ALL, server.log, "Thread Run: Select Socket Error!\n"); + break; + } + + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)) { + short_signal_event_t event; + struct timeval current; + int elapsed; + gettimeofday(¤t,NULL); + + elapsed=smg_calc_elapsed(&server.restart_timeout, ¤t); + if (elapsed > 5000) { + int err; + log_printf(SMG_LOG_ALL, server.log, "Reset Condition Cleared Elapsed=%i!\n",elapsed); + clear_all_holding_tank(); + memset(&event,0,sizeof(event)); + event.event_id = SIGBOOST_EVENT_SYSTEM_RESTART_ACK; + err=call_signal_connection_write(&server.mcon, (call_signal_event_t*)&event); + if (err < 0) { + log_printf(SMG_LOG_ALL, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + smg_all_ckt_busy(); + woomera_clear_flag(&server.master_connection, WFLAG_SYSTEM_RESET); + } + } + + } + + log_printf(SMG_LOG_PROD, server.log, "Close udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + call_signal_connection_close(&server.mcon); + call_signal_connection_close(&server.mconp); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + log_printf(SMG_LOG_ALL, server.log, "Monitor Thread Ended\n"); + + return NULL; +} + +static void woomera_loop_thread_run(struct woomera_interface *woomera) +{ + int err=launch_media_thread(woomera); + if (err) { + log_printf(SMG_LOG_ALL, server.log, "Failed to start loop media thread\n"); + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + return; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + !woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + usleep(300000); + continue; + + } + + woomera_clear_flag(woomera, WFLAG_RUNNING); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Woomera Session: For Loop Test exiting %s\n",woomera->interface); + + return; +} + +static void woomera_check_digits (struct woomera_interface *woomera) +{ + int span, chan; + + if (!strlen(woomera->session)) { + return; + } + + if (get_span_chan_from_interface(woomera->interface, &span, &chan) == 0) { + pthread_mutex_lock(&server.digits_lock); + if (server.process_table[span-1][chan-1].digits_len > 0) { + int i; + unsigned char digit; + + for (i=0; i < server.process_table[span-1][chan-1].digits_len; i++) { + digit = server.process_table[span-1][chan-1].digits[i]; + + handle_event_dtmf(woomera, digit); + } + + server.process_table[span-1][chan-1].digits_len = 0; + } + pthread_mutex_unlock(&server.digits_lock); + } +} + + +static void *woomera_thread_run(void *obj) +{ + struct woomera_interface *woomera = obj; + struct woomera_message wmsg; + struct woomera_event wevent; + char *event_string; + int mwi; + int err; + int policy=0, priority=0; + int span = -1, chan = -1; + + woomera_message_init(&wmsg); + + smg_get_current_priority(&policy,&priority); + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "WOOMERA session started (ptr=%p : loop=%i)(%i:%i) Index=%i\n", + woomera,woomera->loop_tdm,policy,priority, woomera->index); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_mutex_init(&woomera->queue_lock, NULL); + pthread_mutex_init(&woomera->ms_lock, NULL); + pthread_mutex_init(&woomera->dtmf_lock, NULL); + pthread_mutex_init(&woomera->vlock, NULL); + pthread_mutex_init(&woomera->flags_lock, NULL); + + if (woomera->loop_tdm) { + /* We must set woomera socket to -1 otherwise + a valid file descriptor will get closed */ + woomera->socket = -1; + woomera_loop_thread_run(woomera); + goto woomera_session_close; + } + + err=socket_printf(woomera->socket, + "EVENT HELLO Sangoma Media Gateway%s" + "Supported-Protocols: TDM%s" + "Version: %s%s" + "Remote-Address: %s%s" + "Remote-Port: %d%s" + "Raw-Format: %s%s", + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + SMG_VERSION, WOOMERA_LINE_SEPERATOR, + inet_ntoa(woomera->addr.sin_addr), WOOMERA_LINE_SEPERATOR, + ntohs(woomera->addr.sin_port), WOOMERA_LINE_SEPERATOR, + server.hw_coding?"ALAW":"ULAW", WOOMERA_RECORD_SEPERATOR + ); + + if (err) { + log_printf(SMG_LOG_ALL, server.log, "Woomera session socket failure! (ptr=%p)\n", + woomera); + woomera_clear_flag(woomera, WFLAG_RUNNING); + goto woomera_session_close; + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + woomera_test_flag(woomera, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + mwi = woomera_message_parse(woomera, &wmsg, WOOMERA_HARD_TIMEOUT); + if (mwi >= 0) { + + if (mwi) { + interpret_command(woomera, &wmsg); + } else if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + if (socket_printf(woomera->socket, "%s", event_string)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + smg_free(event_string); + log_printf(SMG_LOG_DEBUG_8, server.log, + "WOOMERA session (ptr=%p) print string error\n", + woomera); + break; + } + smg_free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + if(woomera->check_digits) { + woomera_check_digits(woomera); + woomera->check_digits = 0; + } + + if (woomera->timeout > 0 && time(NULL) >= woomera->timeout) { + + /* Sent the hangup only after we sent a NACK */ + + log_printf(SMG_LOG_DEBUG_CALL, server.log, + "WOOMERA session Call Timedout ! [%s]\n", + woomera->interface); + + /* Let the Index check below send a NACK */ + if (woomera->index) { + woomera->q931_rel_cause_tosig=19; + woomera_set_flag(woomera, WFLAG_HANGUP); + } + break; + } + + } else { + log_printf(SMG_LOG_DEBUG_MISC, server.log, "WOOMERA session (ptr=%p) [%s] READ MSG Error %i \n", + woomera,woomera->interface,mwi); + break; + } + + } + +woomera_session_close: + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "WOOMERA session (ptr=%p) is dying [%s]: SR=%d WR=%d WF=0x%04X\n", + woomera,woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_RUNNING), + woomera->flags); + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + usleep(100); + sched_yield(); + } + } + + + /*********************************************** + * Identify the SPAN CHAN to be used below + ***********************************************/ + + chan = woomera->chan; + span = woomera->span; + + + if (!woomera_test_flag(woomera, WFLAG_HANGUP)) { + + /* The call was not HUNGUP. This is the last check, + If the call is valid, hungup the call if the call + was never up the keep going */ + + + if (smg_validate_span_chan(span,chan) == 0) { + + if (!woomera->index) { + + if (autoacm || woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT); + + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [s%dc%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } else { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_START_NACK [s%dc%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } + } else { + log_printf(SMG_LOG_ALL, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [s%dc%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + + } + }else{ + /* This can happend if an outgoing call times out + or gets hungup before it gets acked. Its not a + failure */ + if (!woomera->index) { + /* In this case we really failed to tx STOP */ + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [s%dc%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + + } + +woo_re_hangup: + + /* We must send a STOP ACK to boost telling it that we are done */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + + /* SMG received a HANGUP from boost. + We must now send back the ACK to the HANGUP. + Boost will not release channel until we + ACK the hangup */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [s%dc%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + }else{ + /* This should never happen! If it does + we broke protocol */ + log_printf(SMG_LOG_ALL, woomera->log, + "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [s%dc%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_ACK); + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + + /* SMG received a NACK from boost during call startup. + We must now send back the ACK to the NACK. + Boost will not release channel until we + ACK the NACK */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(SMG_LOG_DEBUG_MISC, woomera->log, + "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [s%dc%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + woomera->index=0; + + } else if (woomera->index) { + isup_exec_command(0, + 0, + woomera->index, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + woomera->index=0; + + } else { + log_printf(SMG_LOG_ALL, woomera->log, + "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [s%dc%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + + } + + if (woomera->index) { + + int index = woomera->index; + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Timeout: %ld%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + woomera->timeout, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(18), + WOOMERA_LINE_SEPERATOR, + 18, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + smg_free(event_string); + } + + if (peek_from_holding_tank(index)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(0, + 0, + index, + SIGBOOST_EVENT_CALL_START_NACK, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] .. WAITING FOR NACK ACK\n", + index); + } else { + log_printf(SMG_LOG_PROD, woomera->log, + "Error Failed to Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] - index stale!\n", + index); + } + } + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent NACK to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + timeout_cnt++; + if (timeout_cnt > 100) { //5sec timeout + timeout_cnt=0; + overall_cnt++; + + log_printf((overall_cnt==1)?0:4, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] ... \n", + woomera->index_hold); + } + + if (overall_cnt > 15) { //50sec timeout + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + break; + } + + /* If ACK comes in while we wait for NACK ACK, the ACk will + clear the tank causing NACK ACK never to clear the waiting flag + in this case we abort waiting for NACK ACK and we timeout + the wait */ + if (woomera_test_flag(&server.master_connection, WFLAG_CALL_ACKED)){ + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + usleep(50000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + /* If ACK came in while waiting for NACK ACK, we TIMEOUT on purpose. + The ACK has blocked the tank id and now ony NACK ACK can unblock it. + THe only problem is that we blind and have to assume that NACK ACK + will eventually come in :) */ + if (!woomera_test_flag(&server.master_connection, WFLAG_CALL_ACKED)) { + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", + woomera->index_hold); + + } else { + log_printf(SMG_LOG_DEBUG_8, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", + woomera->index_hold); + } + } + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + smg_free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent HANGUP to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + log_printf(SMG_LOG_DEBUG_8, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + timeout_cnt++; + if (timeout_cnt > 100) { //5sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf((overall_cnt==1)?0:4, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i] %i... \n", + woomera->interface,woomera->index_hold,overall_cnt); + } + + if (overall_cnt > 15) { //50sec + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT); + break; + } + + if (woomera_test_flag(&server.master_connection, WFLAG_SYSTEM_RESET)){ + break; + } + + usleep(50000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + } else { + log_printf(SMG_LOG_DEBUG_8, woomera->log, + "Wait GOT STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + } + } + + /***************************************************** + * We must wait for WFLAG_WAIT_FOR_STOPPED_ACK here + * so that STOP_ACK can access the woomera + *****************************************************/ + + if (smg_validate_span_chan(span,chan) == 0) { + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, + "WOOMERA Clearing Processs Table ... \n", + woomera->interface); + pthread_mutex_lock(&server.process_lock); + if (server.process_table[span][chan].dev == woomera){ + server.process_table[span][chan].dev = NULL; + memset(server.process_table[span][chan].session,0,SMG_SESSION_NAME_SZ); + memset(server.process_table[span][chan].digits,0, + sizeof(server.process_table[span][chan].digits)); + server.process_table[span][chan].digits_len = 0; + } + pthread_mutex_unlock(&server.process_lock); + } + +#if 0 +//Used for testing + if (1) { + int chan = woomera->chan; + int span = woomera->span; + if (smg_validate_span_chan(span,chan) == 0) { + pthread_mutex_lock(&server.process_lock); + /* This is possible in case media thread dies on startup */ + + if (server.process_table[span][chan]){ + log_printf(SMG_LOG_ALL, server.log, + "Sanity Span Chan Still in use: [s%dc%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + //server.process_table[span][chan] = NULL; + } + pthread_mutex_unlock(&server.process_lock); + } + } +#endif + + usleep(3000000); + + /* Sanity Check */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP ACK\n"); + goto woo_re_hangup; + } + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + log_printf(SMG_LOG_ALL, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP NACK ACK\n"); + goto woo_re_hangup; + } + + + /* This is where we actually pull the index + * out of the tank. We had to keep the tank + * value until the end of the call. Tank is only + * used on outgoing calls. */ + if (woomera->index_hold >= 1) { + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_ACK_TIMEOUT)) { + /* Replace real woomera interface with a dummy so + the tank is blocked. The real woomera interface will be + deallocated */ + pull_from_holding_tank(woomera->index_hold,-1,-1); + + if (check_tank_index(woomera->index_hold) != NULL){ + log_printf(SMG_LOG_PROD, woomera->log, "Woomera Thread: [%s] setup id %i blocked waiting for NACK or ACK\n", + woomera->interface ,woomera->index_hold); + } + } else { + clear_from_holding_tank(woomera->index_hold, woomera); + + } + woomera->index_hold=0; + } + + log_printf(SMG_LOG_DEBUG_CALL, woomera->log, "Woomera Thread Finished %u\n", (unsigned long) woomera->thread); + close_socket(&woomera->socket); + woomera->socket=-1; + + /* delete queue */ + while ((event_string = dequeue_event(woomera))) { + smg_free(event_string); + } + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + del_listener(woomera); + } + + log_printf(SMG_LOG_DEBUG_CALL, server.log, "WOOMERA session for [%s] stopped (ptr=%p)\n", + woomera->interface,woomera); + + pthread_mutex_destroy(&woomera->queue_lock); + pthread_mutex_destroy(&woomera->ms_lock); + pthread_mutex_destroy(&woomera->dtmf_lock); + pthread_mutex_destroy(&woomera->vlock); + pthread_mutex_destroy(&woomera->flags_lock); + woomera_set_raw(woomera, NULL); + woomera_set_interface(woomera, NULL); + + woomera_message_clear(&wmsg); + + smg_free(woomera); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count--; + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_exit(NULL); + return NULL; +} + + +static int launch_woomera_thread(struct woomera_interface *woomera) +{ + int result = 0; + pthread_attr_t attr; + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_RUNNING); + result = pthread_create(&woomera->thread, &attr, woomera_thread_run, woomera); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Woomera Thread! (%i) %s\n", + __FUNCTION__,result,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + +static int launch_monitor_thread(void) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 10; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + log_printf(SMG_LOG_ALL,server.log,"%s: Old Priority =%i res=%i \n",__FUNCTION__, + param.sched_priority,result); + + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + result = pthread_create(&server.monitor_thread, &attr, monitor_thread_run, NULL); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +#ifdef WP_HPTDM_API +static void *hp_tdmapi_span_run(void *obj) +{ + hp_tdm_api_span_t *span = obj; + int err; + + log_printf(SMG_LOG_ALL,server.log,"Starting %s span!\n",span->ifname); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + if (!span->run_span) { + break; + } + + err = span->run_span(span); + if (err) { + break; + } + + } + + if (span->close_span) { + span->close_span(span); + } + + sleep(3); + log_printf(SMG_LOG_ALL,server.log,"Stopping %s span!\n",span->ifname); + + pthread_exit(NULL); +} + + +static int launch_hptdm_api_span_thread(int span) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 5; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + result = pthread_create(&server.monitor_thread, &attr, hp_tdmapi_span_run, &hptdmspan[span]); + if (result) { + log_printf(SMG_LOG_ALL, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + } + pthread_attr_destroy(&attr); + + return result; +} +#endif + +static int configure_server(void) +{ + struct woomera_config cfg; + char *var, *val; + int cnt = 0; + struct smg_tdm_ip_bridge *ip_bridge=NULL; + + + server.dtmf_intr_ch = -1; + + if (!woomera_open_file(&cfg, server.config_file)) { + log_printf(SMG_LOG_ALL, server.log, "open of %s failed\n", server.config_file); + return 0; + } + + log_printf(SMG_LOG_ALL,server.log, "\n======================= \n"); + log_printf(SMG_LOG_ALL,server.log, "Server - Configuration \n"); + log_printf(SMG_LOG_ALL,server.log, "======================= \n"); + + while (woomera_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(var, "boost_local_ip")) { + strncpy(server.mcon.cfg.local_ip, val, + sizeof(server.mcon.cfg.local_ip) -1); + strncpy(server.mconp.cfg.local_ip, val, + sizeof(server.mconp.cfg.local_ip) -1); + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Local IP: %s\n",val); + + cnt++; + } else if (!strcasecmp(var, "boost_local_port")) { + server.mcon.cfg.local_port = atoi(val); + server.mconp.cfg.local_port = + server.mcon.cfg.local_port+1; + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Local Port: %i\n",server.mcon.cfg.local_port); + cnt++; + } else if (!strcasecmp(var, "boost_remote_ip")) { + strncpy(server.mcon.cfg.remote_ip, val, + sizeof(server.mcon.cfg.remote_ip) -1); + strncpy(server.mconp.cfg.remote_ip, val, + sizeof(server.mconp.cfg.remote_ip) -1); + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Remote IP: %s\n",server.mcon.cfg.remote_ip); + cnt++; + } else if (!strcasecmp(var, "boost_remote_port")) { + server.mcon.cfg.remote_port = atoi(val); + server.mconp.cfg.remote_port = + server.mcon.cfg.remote_port+1; + log_printf(SMG_LOG_ALL,server.log, "Server - Boost Remote Port: %i\n",server.mcon.cfg.local_port); + cnt++; + } else if (!strcasecmp(var, "logfile_path")) { + if (!server.logfile_path) { + server.logfile_path = smg_strdup(val); + } + } else if (!strcasecmp(var, "woomera_port")) { + server.port = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Woomera Port: %i\n",server.port); + } else if (!strcasecmp(var, "debug_level")) { + server.debug = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Debug Level: %i\n",server.debug); + } else if (!strcasecmp(var, "out_tx_test")) { + server.out_tx_test = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Tx Media Dbg: %s\n",server.out_tx_test?"On":"Off (Default)"); + } else if (!strcasecmp(var, "loop_trace")) { + server.loop_trace = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Media Loop Trace: %s\n",server.loop_trace?"On":"Off (Default)"); + } else if (!strcasecmp(var, "rxgain")) { + server.rxgain = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Rx Gain: %d\n",server.rxgain); + } else if (!strcasecmp(var, "txgain")) { + server.txgain = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Tx Gain: %d\n",server.txgain); + } else if (!strcasecmp(var, "dtmf_on_duration")){ + server.dtmf_on = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - DTMF ON Duration: %d ms\n",server.dtmf_on); + } else if (!strcasecmp(var, "dtmf_off_duration")){ + server.dtmf_off = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - DTMF Off Duration: %d ms\n",server.dtmf_off); + } else if (!strcasecmp(var, "dtmf_inter_ch_duration")){ + server.dtmf_intr_ch = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - DTMF Spacing: %d\n",server.dtmf_intr_ch); + } else if (!strcasecmp(var, "strip_cid_non_digits")){ + server.strip_cid_non_digits = atoi(val); + log_printf(SMG_LOG_ALL,server.log, "Server - Strip non digits: %d\n",server.strip_cid_non_digits); + } else if (!strcasecmp(var, "max_calls")) { + int max = atoi(val); + if (max > 0) { + server.max_calls = max; + log_printf(SMG_LOG_ALL,server.log, "Server - Max Active Calls: %d\n",server.max_calls); + } + } else if (!strcasecmp(var, "autoacm")) { + int max = atoi(val); + if (max >= 0) { + autoacm=max; + log_printf(SMG_LOG_ALL,server.log, "Server - Auto ACM: %s\n",autoacm?"On":"Off (Default)"); + } + } else if (!strcasecmp(var, "max_spans")) { + int max = atoi(val); + if (max > 0) { + max_spans = max; + log_printf(SMG_LOG_ALL,server.log, "Server - Max Spans: %d\n",max_spans); + } + } else if (!strcasecmp(var, "call_timeout")) { + int max = atoi(val); + if (max >= 0) { + server.call_timeout=max; + } else { + server.call_timeout=SMG_DEFAULT_CALL_TIMEOUT; + } + log_printf(SMG_LOG_ALL,server.log, "Server - Call Comp Timeout: %d s\n",server.call_timeout); + + } else if (!strcasecmp(var, "base_media_port")) { + int base = atoi(val); + if (base >= 0) { + server.base_media_port = base; + server.next_media_port = base; + server.max_media_port = server.base_media_port + WOOMERA_MAX_MEDIA_PORTS; + log_printf(SMG_LOG_ALL,server.log, "Server - Base Media Port: %d\n",server.base_media_port); + } + + } else if (!strcasecmp(var, "max_media_ports")) { + int max = atoi(val); + if (max >= 0) { + server.max_media_port = server.base_media_port+max; + log_printf(SMG_LOG_ALL,server.log, "Server - Max Media Port: %d\n",server.max_media_port); + } + + } else if (!strcasecmp(var, "media_ip")) { + strncpy(server.media_ip, val, sizeof(server.media_ip) -1); + log_printf(SMG_LOG_ALL,server.log, "Server - Media IP: %s\n",server.media_ip); + + } else if (!strcasecmp(var, "bridge_tdm_ip")) { + int err=smg_get_ip_bridge_session(&ip_bridge); + if (err) { + log_printf(SMG_LOG_ALL, server.log, "Error failed to get free ip bridge %i!\n",err); + } else { + log_printf(SMG_LOG_ALL,server.log, "\n======================= \n"); + log_printf(SMG_LOG_ALL,server.log, "Bridge - Configuration \n"); + log_printf(SMG_LOG_ALL,server.log, "======================= \n"); + } + + } else if (!strcasecmp(var, "bridge_span")) { + int max = atoi(val); + if (max > 0 && max <= 32 && ip_bridge) { + ip_bridge->span=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Span: %i\n",ip_bridge->span); + } else { + log_printf(SMG_LOG_ALL, server.log, "Bridge Span: ERROR: Invalid Value %s\n",val); + } + } else if (!strcasecmp(var, "bridge_chan")) { + int max = atoi(val); + if (max > 0 && max < MAX_SMG_BRIDGE && ip_bridge) { + ip_bridge->chan=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Chan: %i\n",ip_bridge->chan); + } else { + log_printf(SMG_LOG_ALL, server.log, "Bridge Chan: ERROR: Invalid Value %s\n",val); + } + } else if (!strcasecmp(var, "bridge_local_ip")) { + if (ip_bridge) { + strncpy(ip_bridge->mcon.cfg.local_ip, val, + sizeof(ip_bridge->mcon.cfg.local_ip) -1); + log_printf(SMG_LOG_ALL, server.log, "Bridge Local IP: %s\n",ip_bridge->mcon.cfg.local_ip); + } + } else if (!strcasecmp(var, "bridge_remote_ip")) { + if (ip_bridge) { + strncpy(ip_bridge->mcon.cfg.remote_ip, val, + sizeof(ip_bridge->mcon.cfg.remote_ip) -1); + log_printf(SMG_LOG_ALL, server.log, "Bridge Remote IP: %s\n",ip_bridge->mcon.cfg.remote_ip); + } + } else if (!strcasecmp(var, "bridge_port")) { + int max = atoi(val); + if (max > 0 && ip_bridge) { + ip_bridge->mcon.cfg.local_port=max; + ip_bridge->mcon.cfg.remote_port=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Port: %i\n",max); + } + } else if (!strcasecmp(var, "bridge_period")) { + int max = atoi(val); + if (max > 0 && ip_bridge) { + ip_bridge->period=max; + log_printf(SMG_LOG_ALL, server.log, "Bridge Period: %ims\n",ip_bridge->period); + } + } else { + log_printf(SMG_LOG_ALL, server.log, "Invalid Option %s at line %d!\n", var, cfg.lineno); + } + } + + log_printf(SMG_LOG_ALL,server.log, "======================= \n\n"); + + /* Post initialize */ + if (server.dtmf_on == 0){ + server.dtmf_on=SMG_DTMF_ON; + } + if (server.dtmf_off == 0) { + server.dtmf_off=SMG_DTMF_OFF; + } + if (server.dtmf_intr_ch == -1) { + server.dtmf_intr_ch = 0; + } + server.dtmf_size=(server.dtmf_on+server.dtmf_off)*10*2; + + log_printf(SMG_LOG_ALL,server.log, "DTMF On=%i Off=%i IntrCh=%i Size=%i\n", + server.dtmf_on,server.dtmf_off,server.dtmf_intr_ch,server.dtmf_size); + + woomera_close_file(&cfg); + return cnt == 4 ? 1 : 0; +} + + + +static int main_thread(void) +{ + + struct sockaddr_in sock_addr, client_addr; + struct woomera_interface *new_woomera; + int client_sock = -1, pid = 0; + unsigned int len = 0; + FILE *tmp; + + if ((server.master_connection.socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + fprintf(stderr,"%s:%d socket() failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + return 1; + } + + memset(&sock_addr, 0, sizeof(sock_addr)); /* Zero out structure */ + sock_addr.sin_family = AF_INET; /* Internet address family */ + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ + sock_addr.sin_port = htons(server.port); /* Local port */ + + /* Bind to the local address */ + if (bind(server.master_connection.socket, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0) { + fprintf(stderr,"%s:%d socket() bind %i failed %s\n",__FUNCTION__,__LINE__,server.port,strerror(errno)); + log_printf(SMG_LOG_ALL, server.log, "bind(%d) failed\n", server.port); + return 1; + } + + /* Mark the socket so it will listen for incoming connections */ + if (listen(server.master_connection.socket, MAXPENDING) < 0) { + fprintf(stderr,"%s:%d socket() listen failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + log_printf(SMG_LOG_ALL, server.log, "listen() failed\n"); + return 1; + } + + if ((pid = get_pid_from_file(PIDFILE))) { + fprintf(stderr,"%s:%d get pid file failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + log_printf(SMG_LOG_ALL, stderr, "pid %d already exists.\n", pid); + exit(0); + } + + if (!(tmp = safe_fopen(PIDFILE, "w"))) { + fprintf(stderr,"%s:%d open pid file failed %s\n",__FUNCTION__,__LINE__,strerror(errno)); + log_printf(SMG_LOG_ALL, stderr, "Error creating pidfile %s\n", PIDFILE); + return 1; + } else { + fprintf(tmp, "%d", getpid()); + fclose(tmp); + tmp = NULL; + } + + no_nagle(server.master_connection.socket); + +#if 0 + if (1) { + int span,chan; + call_signal_event_t event; +#if 0 + span=1; + chan=30; + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); +#else + for (span=0;span<8;span++) { + for (chan=0;chan<31;chan++) { + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); + } + } +#endif + } +#endif + +#ifdef WP_HPTDM_API + if (1) { + int span; + for (span=0;span<16;span++) { + hptdmspan[span] = sangoma_hptdm_api_span_init(span); + if (!hptdmspan[span]) { + break; + } else { + log_printf(SMG_LOG_ALL, server.log, "HP TDM API Span: %d configured...\n", + span); + launch_hptdm_api_span_thread(span); + } + } + } +#endif + + log_printf(SMG_LOG_PROD, server.log, "Main Process Started: Woomera Ready port: %d\n", server.port); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + /* Set the size of the in-out parameter */ + len = sizeof(client_addr); + + /* Wait for a client to connect */ + if ((client_sock = accept(server.master_connection.socket, (struct sockaddr *) &client_addr, &len)) < 0) { + /* Check if we are supposed to stop */ + if(!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + log_printf(SMG_LOG_ALL, server.log, "accept() stopped\n"); + return 0; + } + log_printf(SMG_LOG_ALL, server.log, "accept() failed\n"); + return 1; + } + + if ((new_woomera = new_woomera_interface(client_sock, &client_addr, len))) { + log_printf(SMG_LOG_DEBUG_CALL, server.log, "Starting Thread for New Connection %s:%d Sock=%d\n", + inet_ntoa(new_woomera->addr.sin_addr), + ntohs(new_woomera->addr.sin_port), + client_sock); + + pthread_mutex_lock(&server.thread_count_lock); + server.call_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + + if (launch_woomera_thread(new_woomera)) { + socket_printf(new_woomera->socket, + "501 call was cancelled!%s", + WOOMERA_RECORD_SEPERATOR); + + close_socket(&new_woomera->socket); + new_woomera->socket=-1; + smg_free(new_woomera); + log_printf(SMG_LOG_ALL, server.log, "ERROR: failed to launch woomera thread\n"); + } + } else { + log_printf(SMG_LOG_ALL, server.log, "Critical ERROR: memory/socket error\n"); + } + } + + log_printf(SMG_LOG_PROD, server.log, "Main Process End\n"); + + return 0; +} + +static int do_ignore(int sig) + +{ +#ifdef SMG_DROP_SEQ + drop_seq=4; +#endif + sdla_memdbg_free(0); + return 0; +} + +static int do_shut(int sig) +{ + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + close_socket(&server.master_connection.socket); + log_printf(SMG_LOG_PROD, server.log, "Caught SIG %d, Closing Master Socket!\n", sig); + return 0; +} + +static int sangoma_tdm_init (int span) +{ +#ifdef LIBSANGOMA_GET_HWCODING + wanpipe_tdm_api_t tdm_api; + int fd=sangoma_open_tdmapi_span(span); + if (fd < 0 ){ + return -1; + } else { + server.hw_coding=sangoma_tdm_get_hw_coding(fd,&tdm_api); + close_socket(&fd); + } +#else +#error "libsangoma missing hwcoding feature: not up to date!" +#endif + return 0; +} + +static int woomera_startup(int argc, char **argv) +{ + int x = 0, pid = 0, bg = 0; + int span_cnt, chan_cnt; + char *cfg=NULL, *debug=NULL, *arg=NULL; + + while((arg = argv[x++])) { + + if (!strcasecmp(arg, "-hup")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(SMG_LOG_ALL, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(SMG_LOG_ALL, stderr, "Killing PID %d\n", pid); + kill(pid, SIGHUP); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-term") || !strcasecmp(arg, "--term")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(SMG_LOG_ALL, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(SMG_LOG_ALL, stderr, "Killing PID %d\n", pid); + kill(pid, SIGTERM); + unlink(PIDFILE); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-version")) { + fprintf(stdout, "\nSangoma Media Gateway: Version %s\n\n", SMG_VERSION); + exit(0); + + } else if (!strcasecmp(arg, "-help")) { + fprintf(stdout, "%s\n%s [-help] | [ -version] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(0); + } else if (!strcasecmp(arg, "-wipe")) { + unlink(PIDFILE); + } else if (!strcasecmp(arg, "-bg")) { + bg = 1; + + } else if (!strcasecmp(arg, "-g")) { + coredump = 1; + + } else if (!strcasecmp(arg, "-debug")) { + if (argv[x] && *(argv[x]) != '-') { + debug = argv[x++]; + } + } else if (!strcasecmp(arg, "-cfg")) { + if (argv[x] && *(argv[x]) != '-') { + cfg = argv[x++]; + } + } else if (!strcasecmp(arg, "-log")) { + if (argv[x] && *(argv[x]) != '-') { + server.logfile_path = smg_strdup(argv[x++]); + } + } else if (*arg == '-') { + log_printf(SMG_LOG_ALL, stderr, "Unknown Option %s\n", arg); + fprintf(stdout, "%s\n%s [-help] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(1); + } + } + + if (1){ + int spn; + for (spn=1;spn<=WOOMERA_MAX_SPAN;spn++) { + if (sangoma_tdm_init(spn) == 0) { + break; + } + } + if (spn>WOOMERA_MAX_SPAN) { + printf("\nError: Failed to access a channel on spans 1-16\n"); + printf(" Please start Wanpipe TDM API drivers\n"); + return 0; + } + } + + if (bg && (pid = fork())) { + log_printf(SMG_LOG_ALL, stderr, "Backgrounding!\n"); + return 0; + } + + for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) { + for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) { + pthread_mutex_init(&server.process_table[span_cnt][chan_cnt].media_lock, NULL); + } + } + + q931_cause_setup(); + bearer_cap_setup(); + uil1p_to_str_setup(); + + server.port = 42420; + server.debug = 0; + strcpy(server.media_ip, "127.0.0.1"); + server.base_media_port = WOOMERA_MIN_MEDIA_PORT; + server.max_media_port = WOOMERA_MAX_MEDIA_PORT; + server.next_media_port = server.base_media_port; + server.log = stdout; + server.master_connection.socket = -1; + server.master_connection.event_queue = NULL; + server.config_file = cfg ? cfg : "/etc/sangoma_mgd.conf"; + pthread_mutex_init(&server.listen_lock, NULL); + pthread_mutex_init(&server.ht_lock, NULL); + pthread_mutex_init(&server.process_lock, NULL); + pthread_mutex_init(&server.digits_lock, NULL); + pthread_mutex_init(&server.media_udp_port_lock, NULL); + pthread_mutex_init(&server.thread_count_lock, NULL); + pthread_mutex_init(&server.master_connection.queue_lock, NULL); + pthread_mutex_init(&server.master_connection.flags_lock, NULL); + pthread_mutex_init(&server.mcon.lock, NULL); + server.master_connection.chan = -1; + server.master_connection.span = -1; + server.call_timeout=SMG_DEFAULT_CALL_TIMEOUT; + + if (smg_log_init()) { + printf("Error: Logger Launch Failed\n"); + fprintf(stderr, "Error: Logger Launch Failed\n"); + return 0; + } + + if (!configure_server()) { + log_printf(SMG_LOG_ALL, server.log, "configuration failed!\n"); + return 0; + } + +#ifndef USE_SYSLOG + if (server.logfile_path) { + if (!(server.log = safe_fopen(server.logfile_path, "a"))) { + log_printf(SMG_LOG_ALL, stderr, "Error setting logfile %s!\n", server.logfile_path); + server.log = stderr; + return 0; + } + } +#endif + + + if (debug) { + server.debug = atoi(debug); + } + + if (coredump) { + struct rlimit l; + memset(&l, 0, sizeof(l)); + l.rlim_cur = RLIM_INFINITY; + l.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_CORE, &l)) { + log_printf(SMG_LOG_ALL, stderr, "Warning: Failed to disable core size limit: %s\n", + strerror(errno)); + } + } + +#ifdef __LINUX__ + if (geteuid() && coredump) { + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + log_printf(SMG_LOG_ALL, stderr, "Warning: Failed to disable core size limit for non-root: %s\n", + strerror(errno)); + } + } +#endif + + + + (void) signal(SIGINT,(void *) do_shut); + (void) signal(SIGTERM,(void *) do_shut); + (void) signal(SIGPIPE,(void *) do_ignore); + (void) signal(SIGUSR1,(void *) do_ignore); + (void) signal(SIGHUP,(void *) do_shut); + + /* Wait for logger thread to start */ + usleep(5000); + + woomera_set_flag(&server.master_connection, WFLAG_RUNNING); + + if (launch_monitor_thread()) { + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + smg_log_cleanup(); + return 0; + } + + fprintf(stderr, "%s", WELCOME_TEXT); + + log_printf(SMG_LOG_ALL, stderr, "Woomera STARTUP Complete. [AutoACM=%i SDigit=%i]\n", + autoacm,server.strip_cid_non_digits); + return 1; +} + +static int woomera_shutdown(void) +{ + char *event_string; + int told = 0, loops = 0; + int span_cnt, chan_cnt; + + for (span_cnt = 0; span_cnt < CORE_MAX_SPANS; span_cnt++) { + for (chan_cnt = 0; chan_cnt < CORE_MAX_CHAN_PER_SPAN; chan_cnt++) { + pthread_mutex_destroy(&server.process_table[span_cnt][chan_cnt].media_lock); + } + } + + close_socket(&server.master_connection.socket); + pthread_mutex_destroy(&server.listen_lock); + pthread_mutex_destroy(&server.ht_lock); + pthread_mutex_destroy(&server.process_lock); + pthread_mutex_destroy(&server.digits_lock); + pthread_mutex_destroy(&server.media_udp_port_lock); + pthread_mutex_destroy(&server.thread_count_lock); + pthread_mutex_destroy(&server.master_connection.queue_lock); + pthread_mutex_destroy(&server.master_connection.flags_lock); + pthread_mutex_destroy(&server.mcon.lock); + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + + + if (server.logfile_path) { + smg_free(server.logfile_path); + server.logfile_path = NULL; + } + + /* delete queue */ + while ((event_string = dequeue_event(&server.master_connection))) { + smg_free(event_string); + } + + while(server.thread_count > 0) { + loops++; + + if (loops % 1000 == 0) { + told = 0; + } + + if (loops > 10000) { + log_printf(SMG_LOG_ALL, server.log, "Red Alert! threads did not stop\n"); + assert(server.thread_count == 0); + } + + if (told != server.thread_count) { + log_printf(SMG_LOG_PROD, server.log, "Waiting For %d thread%s.\n", + server.thread_count, server.thread_count == 1 ? "" : "s"); + told = server.thread_count; + } + ysleep(10000); + } + unlink(PIDFILE); + log_printf(SMG_LOG_ALL, stderr, "Woomera SHUTDOWN Complete.\n"); + + smg_log_cleanup(); + + return 0; +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + + memset(&server,0,sizeof(server)); + memset(&woomera_dead_dev,0,sizeof(woomera_dead_dev)); + + mlockall(MCL_FUTURE); + memset(&server, 0, sizeof(server)); + memset(&woomera_dead_dev, 0, sizeof(woomera_dead_dev)); + memset(&g_smg_ip_bridge_idx,0, sizeof(g_smg_ip_bridge_idx)); + + ret=nice(-5); + + sdla_memdbg_init(); + + server.hw_coding=0; + + openlog (ps_progname ,LOG_PID, LOG_LOCAL2); + + if (! (ret = woomera_startup(argc, argv))) { + exit(0); + } + + ret = smg_ip_bridge_start(); + if (ret == 0) { + ret = main_thread(); + } + + woomera_shutdown(); + + smg_ip_bridge_stop(); + sdla_memdbg_free(1); + + return ret; +} + +/** EMACS ** + * Local variables: + * mode: C + * c-basic-offset: 4 + * End: + */ + diff --git a/ssmg/sangoma_mgd.trunk/Makefile b/ssmg/sangoma_mgd.trunk/Makefile index 1a40c1a..44343f5 100644 --- a/ssmg/sangoma_mgd.trunk/Makefile +++ b/ssmg/sangoma_mgd.trunk/Makefile @@ -39,6 +39,9 @@ ifndef DESTDIR endif endif +SAFE_D=/etc/wanpipe/safe_sangoma.d +SMGCTRL_D=/etc/wanpipe/smg_ctrl.d + INCLUDES = -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 @@ -91,12 +94,15 @@ sangoma_mgd_memdbg.o: sangoma_mgd_memdbg.c sangoma_mgd_memdbg.h sangoma_mgd_logger.o: sangoma_mgd_logger.c $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_logger.o sangoma_mgd_logger.c +sangoma_mgd_ip_bridge.o: sangoma_mgd_ip_bridge.c + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_ip_bridge.o sangoma_mgd_ip_bridge.c + sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c -sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h +sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o sangoma_mgd_ip_bridge.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h rm -fr core* - $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o switch_buffer.o call_signal.o $(LDFLAGS) + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o sangoma_mgd_logger.o sangoma_mgd_ip_bridge.o switch_buffer.o call_signal.o $(LDFLAGS) @@ -108,7 +114,7 @@ clean: old_cleanup distclean: clean @echo OK -install: all install_smg +install: all install_smg old_cleanup install_smg: old_cleanup install -D -m 755 sangoma_mgd $(DESTDIR)/usr/sbin/sangoma_mgd @@ -117,8 +123,17 @@ install_smg: old_cleanup fi install -D -m 755 ./safe_sangoma $(DESTDIR)/usr/sbin/safe_sangoma + install -D -m 755 ./rc/safe_sangoma.rc $(DESTDIR)/etc/wanpipe/safe_sangoma.rc install -D -m 755 ./smg_ctrl $(DESTDIR)/usr/sbin/smg_ctrl + @if [ ! -d ${SAFE_D} ]; then \ + mkdir -p ${SAFE_D}; \ + fi + @if [ ! -d ${SMGCTRL_D} ]; then \ + mkdir -p ${SMGCTRL_D}; \ + fi + + ifeq "${PRI}" "YES" @echo "PRI control scripts installed" @if [ ! -e $(DESTDIR)/etc/sangoma_mgd.conf ]; then \ diff --git a/ssmg/sangoma_mgd.trunk/app/.svn/entries b/ssmg/sangoma_mgd.trunk/app/.svn/entries index 337ced7..c094deb 100644 --- a/ssmg/sangoma_mgd.trunk/app/.svn/entries +++ b/ssmg/sangoma_mgd.trunk/app/.svn/entries @@ -1,7 +1,7 @@ 8 dir -204 +232 https://www.sangomapbx.com/svn/sangoma_mgd/trunk/app https://www.sangomapbx.com/svn/sangoma_mgd diff --git a/ssmg/sangoma_mgd.trunk/call_signal.c b/ssmg/sangoma_mgd.trunk/call_signal.c index 1322d89..9e19dab 100644 --- a/ssmg/sangoma_mgd.trunk/call_signal.c +++ b/ssmg/sangoma_mgd.trunk/call_signal.c @@ -120,23 +120,24 @@ static int smg_event_dbg=SMG_LOG_BOOST; static void clog_print_event_call(call_signal_connection_t *mcon,call_signal_event_t *event, int priority, int dir) { clog_printf((event->event_id==SIGBOOST_EVENT_HEARTBEAT)?SMG_LOG_DEBUG_CALL:smg_event_dbg, mcon->log, - "%s EVENT (%s): %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n", + "%s EVENT (%s): %s:(%X) [s%dc%d] Tg=%i CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s]\n", dir ? "TX":"RX", priority ? "P":"N", call_signal_event_id_name(event->event_id), event->event_id, event->span+1, event->chan+1, + event->trunk_group, event->call_setup_id, event->fseqno, - strlen(event->calling_name)?event->calling_name:"N/A", + strlen(event->calling_name)?event->calling_name:"N/A", (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")); } static void clog_print_event_short(call_signal_connection_t *mcon,short_signal_event_t *event, int priority, int dir) { clog_printf((event->event_id==SIGBOOST_EVENT_HEARTBEAT)?SMG_LOG_DEBUG_CALL:smg_event_dbg, mcon->log, - "%s EVENT (%s): %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i \n", + "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n", dir ? "TX":"RX", priority ? "P":"N", call_signal_event_id_name(event->event_id), diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast14_check b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast14_check index 573541a..0cfbf08 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast14_check +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast14_check @@ -1 +1 @@ -0 +2 diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast16_check b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast16_check index d00491f..573541a 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast16_check +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast16_check @@ -1 +1 @@ -1 +0 diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast_src_check b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast_src_check index d00491f..573541a 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast_src_check +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.ast_src_check @@ -1 +1 @@ -1 +0 diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.log b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.log index 01a3679..3f395b2 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.log +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.log @@ -6,169 +6,591 @@ cw_cli_entry /usr/src/asterisk/include/callweaver/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check MODULE_INFO /usr/src/asterisk/include/callweaver/module.h .cw_module_info_check echo 0 .cw_module_info_check +1.6 /usr/src/asterisk/.version .ast16_check +grep -c 1.6 /usr/src/asterisk/.version .ast16_check +1.4 /usr/src/asterisk/.version .ast14_check +grep -c 1.4 /usr/src/asterisk/.version .ast14_check +AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/asterisk/include/callweaver/cli.h .opbx_cli_entry_check +echo 0 .opbx_cli_entry_check +cw_cli_entry /usr/src/asterisk/include/callweaver/cli.h .cw_cli_entry_check +echo 0 .cw_cli_entry_check +MODULE_INFO /usr/src/asterisk/include/callweaver/module.h .cw_module_info_check +echo 0 .cw_module_info_check +1.6 /usr/src/asterisk/.version .ast16_check +grep -c 1.6 /usr/src/asterisk/.version .ast16_check +1.4 /usr/src/asterisk/.version .ast14_check +grep -c 1.4 /usr/src/asterisk/.version .ast14_check +AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/asterisk/include/callweaver/cli.h .opbx_cli_entry_check +echo 0 .opbx_cli_entry_check +cw_cli_entry /usr/src/asterisk/include/callweaver/cli.h .cw_cli_entry_check +echo 0 .cw_cli_entry_check +MODULE_INFO /usr/src/asterisk/include/callweaver/module.h .cw_module_info_check +echo 0 .cw_module_info_check +1.6 /usr/src/asterisk/.version .ast16_check +grep -c 1.6 /usr/src/asterisk/.version .ast16_check +1.4 /usr/src/asterisk/.version .ast14_check +grep -c 1.4 /usr/src/asterisk/.version .ast14_check +AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/asterisk/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/asterisk/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/asterisk/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/asterisk/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/asterisk/.version .ast16_check +grep -c 1.6 /usr/src/asterisk/.version .ast16_check +1.4 /usr/src/asterisk/.version .ast14_check +grep -c 1.4 /usr/src/asterisk/.version .ast14_check 1.6 /usr/src/asterisk/include/asterisk/version.h .ast16_check grep -c 1.6 /usr/src/asterisk/include/asterisk/version.h .ast16_check 1.4 /usr/src/asterisk/include/asterisk/version.h .ast14_check grep -c 1.4 /usr/src/asterisk/include/asterisk/version.h .ast14_check -AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/frame.h .ast_src_check +AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/asterisk/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/asterisk/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/asterisk/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/asterisk/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/asterisk/.version .ast16_check +grep -c 1.6 /usr/src/asterisk/.version .ast16_check +1.4 /usr/src/asterisk/.version .ast14_check +grep -c 1.4 /usr/src/asterisk/.version .ast14_check +1.6 /usr/src/asterisk/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/asterisk/include/asterisk/version.h .ast16_check +1.4 /usr/src/asterisk/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/asterisk/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/asterisk/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/asterisk/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/asterisk/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/asterisk/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/asterisk/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/asterisk/.version .ast16_check +grep -c 1.6 /usr/src/asterisk/.version .ast16_check +1.4 /usr/src/asterisk/.version .ast14_check +grep -c 1.4 /usr/src/asterisk/.version .ast14_check +1.6 /usr/src/asterisk/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/asterisk/include/asterisk/version.h .ast16_check +1.4 /usr/src/asterisk/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/asterisk/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.1/frame.h .ast_src_check echo 0 .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/cli.h .opbx_cli_entry_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .opbx_cli_entry_check echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/cli.h .cw_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/version.h .ast16_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/.version .ast16_check echo 0 .ast16_check -1.4 /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/version.h .ast14_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/.version .ast14_check echo 0 .ast14_check -AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/frame.h .ast_src_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.9/frame.h .ast_src_check echo 0 .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/cli.h .opbx_cli_entry_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.9/cli.h .opbx_cli_entry_check echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/cli.h .cw_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.9/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/version.h .ast16_check +1.6 /usr/src/ast1.4/asterisk-1.4.9/.version .ast16_check echo 0 .ast16_check -1.4 /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/version.h .ast14_check +1.4 /usr/src/ast1.4/asterisk-1.4.9/.version .ast14_check echo 0 .ast14_check -AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/frame.h .ast_src_check -echo 0 .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/cli.h .opbx_cli_entry_check -echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/cli.h .cw_cli_entry_check -echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.9/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/version.h .ast16_check +1.6 /usr/src/ast1.4/asterisk-1.4.9/version.h .ast16_check echo 0 .ast16_check -1.4 /usr/src/ast1.4/asterisk-1.4.9/include/asterisk/version.h .ast14_check +1.4 /usr/src/ast1.4/asterisk-1.4.9/version.h .ast14_check echo 0 .ast14_check AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .opbx_cli_entry_check -echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .cw_cli_entry_check -echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast16_check -echo 0 .ast16_check -1.4 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast14_check -echo 0 .ast14_check -AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .opbx_cli_entry_check -echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .cw_cli_entry_check -echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast16_check -echo 0 .ast16_check -1.4 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast14_check -echo 0 .ast14_check -AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .opbx_cli_entry_check -echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .cw_cli_entry_check -echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast16_check -echo 0 .ast16_check -1.4 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast14_check -echo 0 .ast14_check -AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .opbx_cli_entry_check -echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .cw_cli_entry_check -echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast16_check -echo 0 .ast16_check -1.4 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast14_check -echo 0 .ast14_check -1.4 /usr/src/ast1.4/asterisk-1.4.22/.version -grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.22/.version -1.4 /usr/src/ast1.4/asterisk-1.4.22/.version -grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.22/.version -1.4 /usr/src/ast1.4/asterisk-1.4.22/.version .ast14_check -grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.22/.version .ast14_check -AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .opbx_cli_entry_check -echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/cli.h .cw_cli_entry_check -echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.4/asterisk-1.4.22/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/cli.h .cw_cli_entry_check 1.6 /usr/src/ast1.4/asterisk-1.4.22/.version .ast16_check grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.22/.version .ast16_check 1.4 /usr/src/ast1.4/asterisk-1.4.22/.version .ast14_check grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.22/.version .ast14_check -AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .opbx_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.22/include/asterisk/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.21/frame.h .ast_src_check +echo 0 .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.21/cli.h .opbx_cli_entry_check echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .cw_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.21/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .opbx_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.21/.version .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.21/.version .ast14_check +echo 0 .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.21/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.21/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.1/frame.h .ast_src_check +echo 0 .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .opbx_cli_entry_check echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .cw_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .opbx_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/.version .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/.version .ast14_check +echo 0 .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.1/frame.h .ast_src_check +echo 0 .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .opbx_cli_entry_check echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .cw_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .opbx_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/.version .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/.version .ast14_check +echo 0 .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.1/frame.h .ast_src_check +echo 0 .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .opbx_cli_entry_check echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .cw_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.1/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -grep -c AST_CONTROL_SRC /usr/src/ast1.6/asterisk-1.6.0-rc5/include/asterisk/frame.h .ast_src_check -opbx_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .opbx_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/.version .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/.version .ast14_check +echo 0 .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.1/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16//include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.1/frame.h .ast_src_check +echo 0 .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.1/cli.h .opbx_cli_entry_check echo 0 .opbx_cli_entry_check -cw_cli_entry /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/cli.h .cw_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.1/cli.h .cw_cli_entry_check echo 0 .cw_cli_entry_check -MODULE_INFO /usr/src/ast1.6/asterisk-1.6.0-rc5/include/callweaver/module.h .cw_module_info_check -echo 0 .cw_module_info_check -1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -grep -c 1.6 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast16_check -1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check -grep -c 1.4 /usr/src/ast1.6/asterisk-1.6.0-rc5/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.1/.version .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.1/.version .ast14_check +echo 0 .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.1/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.1/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/aste/frame.h .ast_src_check +echo 0 .ast_src_check +opbx_cli_entry /usr/src/ast1.2/aste/cli.h .opbx_cli_entry_check +echo 0 .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/aste/cli.h .cw_cli_entry_check +echo 0 .cw_cli_entry_check +1.6 /usr/src/ast1.2/aste/.version .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.2/aste/.version .ast14_check +echo 0 .ast14_check +1.6 /usr/src/ast1.2/aste/version.h .ast16_check +echo 0 .ast16_check +1.4 /usr/src/ast1.2/aste/version.h .ast14_check +echo 0 .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/.version .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/.version .ast14_check +1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.2/asterisk-1.2.16/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +grep -c AST_CONTROL_SRC /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/frame.h .ast_src_check +opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +grep -c opbx_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .opbx_cli_entry_check +cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +grep -c cw_cli_entry /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/cli.h .cw_cli_entry_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/.version .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/.version .ast14_check +1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +grep -c 1.6 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast16_check +1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check +grep -c 1.4 /usr/src/ast1.4/asterisk-1.4.11/include/asterisk/version.h .ast14_check diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir index 8001934..aa0d569 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir @@ -1 +1 @@ -/usr/src/ast1.6/asterisk-1.6.0-rc5 +/usr/src/ast1.4/asterisk-1.4.11 diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops index 0a9a59c..0dbb15b 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops @@ -1,13 +1,13 @@ K 25 svn:wc:ra_dav:version-url V 36 -/svn/chan_woomera/!svn/ver/119/trunk +/svn/chan_woomera/!svn/ver/132/trunk END chan_woomera.c K 25 svn:wc:ra_dav:version-url V 51 -/svn/chan_woomera/!svn/ver/119/trunk/chan_woomera.c +/svn/chan_woomera/!svn/ver/132/trunk/chan_woomera.c END g711.h K 25 @@ -31,7 +31,7 @@ woomera.conf K 25 svn:wc:ra_dav:version-url V 49 -/svn/chan_woomera/!svn/ver/118/trunk/woomera.conf +/svn/chan_woomera/!svn/ver/120/trunk/woomera.conf END README K 25 @@ -43,5 +43,5 @@ Makefile K 25 svn:wc:ra_dav:version-url V 45 -/svn/chan_woomera/!svn/ver/111/trunk/Makefile +/svn/chan_woomera/!svn/ver/131/trunk/Makefile END diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries index e4cd161..2c4e32f 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries @@ -1,14 +1,14 @@ 8 dir -119 +132 https://www.sangomapbx.com/svn/chan_woomera/trunk https://www.sangomapbx.com/svn/chan_woomera -2009-09-17T21:28:42.285967Z -119 +2009-11-24T19:36:41.606843Z +132 ncorbic @@ -32,10 +32,10 @@ file -2009-09-17T21:01:12.000000Z -110d2fbba4c604cf87f486ed8c7896e8 -2009-09-17T21:28:42.285967Z -119 +2009-11-24T17:28:53.000000Z +7bdc932da3a3126573c89270e83dce46 +2009-11-24T19:36:41.606843Z +132 ncorbic g711.h @@ -44,7 +44,7 @@ file -2009-04-09T17:34:03.000000Z +2009-04-30T20:22:39.000000Z 0f725f95ced42af15dcaef21f3a1722b 2007-09-21T20:29:00.887216Z 1 @@ -68,7 +68,7 @@ file -2009-04-14T16:12:53.000000Z +2009-04-30T20:22:39.000000Z 0eb3ff60c8a8a748512ad6fe7c3fec5f 2009-04-14T01:12:18.691621Z 109 @@ -81,10 +81,10 @@ file -2009-09-17T21:01:12.000000Z -be929ca884ac67db1fcdc85c4e5384fb -2009-09-17T21:27:40.731828Z -118 +2009-09-22T21:58:45.000000Z +c71ba29fb7105eedc3e595ac81ba0feb +2009-09-22T22:50:21.147301Z +120 ncorbic README @@ -93,7 +93,7 @@ file -2009-04-09T17:34:03.000000Z +2009-04-30T20:22:39.000000Z 6b44396eddae33cda9cdb078e5030a1f 2007-10-30T20:04:39.055688Z 14 @@ -105,9 +105,9 @@ file -2009-04-22T18:22:56.000000Z -699049f068b9ca61569cc469cb8c7ad4 -2009-04-22T20:06:05.265796Z -111 +2009-11-18T18:14:42.000000Z +e7faa935e11b7d4a3f56e343db47befd +2009-11-18T20:20:28.099174Z +131 ncorbic diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base index e57a769..3257be8 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base @@ -13,7 +13,7 @@ ################################################################################ ifndef PBXDIR - PBXDIR=/usr/src/asterisk + PBXDIR=/usr/include/asterisk ifneq (,$(wildcard ./.pbxdir)) PBXDIR=$(shell cat .pbxdir) endif @@ -28,8 +28,25 @@ PBXCFGDIR=/etc/asterisk PBXDEFINES= PBXFLAGS_EXTRA= + +#Check if PBXDIR is asterisk source or include + +INCDIR=$(PBXDIR) +INCLUDES= + +ifneq (,$(wildcard $(PBXDIR)/include/asterisk/frame.h)) + INCLUDES= -I$(PBXDIR) -I$(PBXDIR)/include + INCDIR=$(PBXDIR)/include/asterisk +endif +ifneq (,$(wildcard $(PBXDIR)/include/callweaver/cli.h)) + INCLUDES= -I/$(PBXDIR) -I$(PBXDIR)/include + INCDIR=$(PBXDIR)/include/callweaver +endif + + + #Check for Asterisk AST_CONTROL_SRC feature -DUMMY:=$(shell ./check_for.sh AST_CONTROL_SRC $(PBXDIR)/include/asterisk/frame.h .ast_src_check;) +DUMMY:=$(shell ./check_for.sh AST_CONTROL_SRC $(INCDIR)/frame.h .ast_src_check;) ifeq (1,$(shell cat .ast_src_check)) PBXDEFINES+=-DWOO_CONTROL_SRC_FEATURE @@ -37,7 +54,7 @@ endif #Check for Callweaver opbx_cli_entry -DUMMY:=$(shell ./check_for.sh opbx_cli_entry $(PBXDIR)/include/callweaver/cli.h .opbx_cli_entry_check;) +DUMMY:=$(shell ./check_for.sh opbx_cli_entry $(INCDIR)/cli.h .opbx_cli_entry_check;) ifneq (0,$(shell cat .opbx_cli_entry_check)) PBXFLAGS_EXTRA+=-DCALLWEAVER_OPBX_CLI_ENTRY @@ -45,31 +62,31 @@ endif #Check for callweaver cw_cli_entry -DUMMY:=$(shell ./check_for.sh cw_cli_entry $(PBXDIR)/include/callweaver/cli.h .cw_cli_entry_check;) +DUMMY:=$(shell ./check_for.sh cw_cli_entry $(INCDIR)/cli.h .cw_cli_entry_check;) ifneq (0,$(shell cat .cw_cli_entry_check)) PBXFLAGS_EXTRA+=-DCALLWEAVER_CW_CLI_ENTRY endif -#Check for callweaver MODULE_INFO -DUMMY:=$(shell ./check_for.sh MODULE_INFO $(PBXDIR)/include/callweaver/module.h .cw_module_info_check;) - -ifneq (0,$(shell cat .cw_module_info_check)) - PBXFLAGS_EXTRA+=-DCALLWEAVER_MODULE_INFO -endif - - -ifneq (,$(wildcard $(PBXDIR)/include/callweaver/cwobj.h)) +ifneq (,$(wildcard $(INCDIR)/cwobj.h)) PBXFLAGS_EXTRA+=-DCALLWEAVER_CWOBJ endif -ifneq (,$(wildcard $(PBXDIR)/include/callweaver.h)) +ifneq (,$(wildcard $(INCDIR)/../callweaver.h)) PBXFLAGS_EXTRA+=-DCALLWEAVER -DHAVE_CONFIG_H PBXMODDIR=/usr/local/lib/callweaver/modules PBXCFGDIR=/usr/local/etc/callweaver + #Check for callweaver MODULE_INFO + DUMMY:=$(shell ./check_for.sh MODULE_INFO $(INCDIR)/module.h .cw_module_info_check;) + + ifneq (0,$(shell cat .cw_module_info_check)) + PBXFLAGS_EXTRA+=-DCALLWEAVER_MODULE_INFO + endif + + else #Check for Asterisk 1.6 @@ -82,6 +99,18 @@ DUMMY:=$(shell ./check_for.sh 1.4 $(PBXDIR)/.version .ast14_check;) ifneq (0,$(shell cat .ast14_check)) PBXFLAGS_EXTRA+=-DAST14 endif + +DUMMY:=$(shell ./check_for.sh 1.6 $(INCDIR)/version.h .ast16_check;) +ifneq (0,$(shell cat .ast16_check)) + PBXFLAGS_EXTRA+=-DAST16 +endif + +DUMMY:=$(shell ./check_for.sh 1.4 $(INCDIR)/version.h .ast14_check;) +ifneq (0,$(shell cat .ast14_check)) + PBXFLAGS_EXTRA+=-DAST14 +endif + + endif @@ -90,14 +119,13 @@ PBXFLAGS_EXTRA+= -DAST_MODULE=\"chan_woomera\" CC = gcc -INCLUDES= -I/usr/include -I./ CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm -PBXFLAGS= $(INCLUDES) -I$(PBXDIR) -I$(PBXDIR)/include -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Iinclude -I../include -D_REENTRANT -DWOOMERA_CHAN_NAME=\"$(CHAN_NAME)\" -D_GNU_SOURCE $(PBXDEFINES) -O6 -fomit-frame-pointer -fPIC +PBXFLAGS= $(INCLUDES) -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -D_REENTRANT -DWOOMERA_CHAN_NAME=\"$(CHAN_NAME)\" -D_GNU_SOURCE $(PBXDEFINES) -O6 -fomit-frame-pointer -fPIC all: chan_woomera.so diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base index ca5cc49..a55bd7e 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base @@ -14,6 +14,32 @@ * This program is free software, distributed under the terms of * the GNU General Public License * ============================================= + * v1.60 Nenad Corbic + * Nov 22 2009 + * Added Woomera No Answer feature for calling cards. + * + * v1.59 Nenad Corbic + * Nov 16 2009 + * Bug fix in woomera profile verbose introduced in 1.58 + * + * v1.58 Nenad Corbic + * Nov 10 2009 + * Added verbosity per profile. + * Updated cli commands + * + * v1.57 Nenad Corbic + * Nov 10 2009 + * Fixed global set flag. When one profile goes down it shuts down + * all calls. + * + * v1.56 Nenad Corbic + * Oct 29 2009 + * Fixed the call incoming call problem on second profile + * + * v1.55 Nenad Corbic + * Sep 22 2009 + * Updated udp base port to 20000 and numbe of ports to 5000 + * * v1.54 Nenad Corbic * Sep 16 2009 * Added Progress Messages @@ -247,6 +273,9 @@ * from CLI. */ +#if !defined(CALLWEAVER) +#include "asterisk.h" +#endif #if defined(CALLWEAVER) && defined(HAVE_CONFIG_H) #include "confdefs.h" @@ -296,7 +325,7 @@ #include "asterisk/musiconhold.h" #include "asterisk/transcap.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.54 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.60 $") #else @@ -347,7 +376,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.54 $") #define CALLWEAVER_19 1 #endif -CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.54 $") +CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.60 $") #if defined(DSP_FEATURE_FAX_CNG_DETECT) #undef DSP_FEATURE_FAX_DETECT @@ -654,7 +683,7 @@ CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.54 $") extern int option_verbose; -#define WOOMERA_VERSION "v1.54" +#define WOOMERA_VERSION "v1.60" #ifndef WOOMERA_CHAN_NAME #define WOOMERA_CHAN_NAME "SS7" #endif @@ -677,8 +706,6 @@ static const char desc[] = "Woomera Channel Driver"; //static const char type[] = "WOOMERA"; static const char tdesc[] = "Woomera Channel Driver"; static char configfile[] = "woomera.conf"; -static char smgversion_init=0; -static char smgversion[100] = "N/A"; static char mohinterpret[MAX_MUSICCLASS] = "default"; static char mohsuggest[MAX_MUSICCLASS] = ""; @@ -725,11 +752,11 @@ static struct ast_jb_conf global_jbconf; #define WOOMERA_ULAW 1 #define WOOMERA_ALAW 2 -#define WOOMERA_MAX_MEDIA_PORTS 899 +#define WOOMERA_MAX_MEDIA_PORTS 5000 #define WOOMERA_STRLEN 256 #define WOOMERA_ARRAY_LEN 50 -#define WOOMERA_MIN_PORT 10000 +#define WOOMERA_MIN_PORT 20000 #define WOOMERA_MAX_PORT WOOMERA_MIN_PORT+WOOMERA_MAX_MEDIA_PORTS #define WOOMERA_BODYLEN 2048 #define WOOMERA_LINE_SEPARATOR "\r\n" @@ -766,7 +793,6 @@ static int woomera_max_media_port = WOOMERA_MAX_PORT; }) #endif - #define FRAME_LEN 480 #if 0 @@ -875,12 +901,12 @@ struct woomera_profile { float txgain_val; unsigned char rxgain[256]; unsigned char txgain[256]; - int call_out; - int call_in; - int call_ok; - int call_end; - int call_abort; - int call_ast_hungup; + unsigned int call_out; + unsigned int call_in; + unsigned int call_ok; + unsigned int call_end; + unsigned int call_abort; + unsigned int call_ast_hungup; char default_context[WOOMERA_STRLEN]; char* tg_context [WOOMERA_MAX_TRUNKGROUPS+1]; char language[WOOMERA_STRLEN]; @@ -889,6 +915,8 @@ struct woomera_profile { int rx_sync_check_opt; int tx_sync_check_opt; int tx_sync_gen_opt; + unsigned int verbose; + char smgversion[100]; }; @@ -961,6 +989,17 @@ typedef struct woomera_event_queue woomera_event_queue; #endif +static inline int woomera_profile_verbose(woomera_profile *profile) +{ + if (!profile) { + /* If profile does not exists then log by default */ + return 100; + } + + return profile->verbose; +} + + static int my_ast_channel_trylock(struct ast_channel *chan) { #if defined (AST14) || defined (AST16) @@ -1058,7 +1097,7 @@ AST_MUTEX_DEFINE_STATIC(lock); /* local prototypes */ static void woomera_close_socket(int *socket); -static void global_set_flag(int flags); +static void global_set_flag(woomera_profile *profile,int flags); #ifdef WOOMERA_PRINTF_DEBUG static int __woomera_printf(const char* file, int line, woomera_profile *profile, int fd, char *fmt, ...); #else @@ -1202,14 +1241,16 @@ static int woomera_message_reply_ok(woomera_message *wmsg) } -static void global_set_flag(int flags) +static void global_set_flag(woomera_profile * profile, int flags) { private_object *tech_pvt; ASTOBJ_CONTAINER_TRAVERSE(&private_object_list, 1, do { ASTOBJ_RDLOCK(iterator); - tech_pvt = iterator; - ast_set_flag(tech_pvt, flags); + tech_pvt = iterator; + if (profile == NULL || tech_pvt->profile == profile ) { + ast_set_flag(tech_pvt, flags); + } ASTOBJ_UNLOCK(iterator); } while(0)); } @@ -1372,7 +1413,7 @@ static int __woomera_printf(woomera_profile *profile, int fd, char *fmt, ...) } else { res=0; if (profile && globals.debug) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "Send Message: {%s} [%s/%d]\n%s\n%s", profile->name, profile->woomera_host, profile->woomera_port, WOOMERA_DEBUG_LINE, stuff); } } @@ -1540,7 +1581,7 @@ static int woomera_message_parse(int fd, woomera_message *wmsg, int timeout, if (res == 0) { sanity++; } else if (res < 0) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "{%s} error during packet retry #%d\n", profile->name, loops); } return res; @@ -1588,7 +1629,7 @@ static int woomera_message_parse(int fd, woomera_message *wmsg, int timeout, next = buf; if (globals.debug) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "Receive Message: {%s} [%s/%d]\n%s\n%s", profile->name, profile->woomera_host, profile->woomera_port, WOOMERA_DEBUG_LINE, buf); } } @@ -1682,7 +1723,7 @@ static int woomera_message_parse(int fd, woomera_message *wmsg, int timeout, int terr; terr=read(fd, wmsg->body, (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); if (globals.debug) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_verbose("%s\n", wmsg->body); } } @@ -1690,7 +1731,7 @@ static int woomera_message_parse(int fd, woomera_message *wmsg, int timeout, if (event_queue && ast_test_flag(wmsg, WFLAG_EVENT)) { if (globals.debug) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "Queue Event: {%s} [%s]\n", profile->name, wmsg->command); } } @@ -1830,7 +1871,7 @@ retry_activate_again: } - if (globals.debug > 1 && option_verbose > 1) { + if (globals.debug > 1 && option_verbose > 1 && woomera_profile_verbose(tech_pvt->profile) > 1) { ast_log(LOG_ERROR, "Error: %s call connect to TCP/Woomera Server! tpvt=%p: %s\n", ast_test_flag(tech_pvt, TFLAG_OUTBOUND)?"Out":"In", tech_pvt,strerror(errno)); @@ -2102,7 +2143,7 @@ static int tech_init(private_object *tech_pvt, woomera_profile *profile, int fla memcpy(&tech_pvt->jbconf, &global_jbconf, sizeof(struct ast_jb_conf)); ast_jb_configure(self, &tech_pvt->jbconf); - if (globals.debug > 1 && option_verbose > 10) { + if (globals.debug > 1 && option_verbose > 10 && woomera_profile_verbose(profile) > 10) { ast_log(LOG_NOTICE, "%s: Cfg JitterBuffer (F=%i MS=%li Rs=%li Impl=%s)\n", self->name, tech_pvt->jbconf.flags, @@ -2182,7 +2223,7 @@ static void tech_destroy(private_object *tech_pvt, struct ast_channel *owner) if (tech_pvt->profile && tech_pvt->command_channel > -1) { - if (globals.debug > 1 && option_verbose > 1) { + if (globals.debug > 1 && option_verbose > 1 && woomera_profile_verbose(tech_pvt->profile) > 1) { ast_log(LOG_NOTICE, "+++DESTROY sent HANGUP %s\n", tech_pvt->callid); } @@ -2851,7 +2892,7 @@ static void *tech_monitor_thread(void *obj) } if (globals.debug > 4) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(tech_pvt->profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "CHECK {%s} (%d) %s\n", tech_pvt->profile->name, res,tech_pvt->callid); @@ -2911,7 +2952,7 @@ static int woomera_locate_socket(woomera_profile *profile, int *woomera_socket) profile->name); /* When we establish connection update smg version */ - smgversion_init=0; + profile->smgversion[0]='\0'; sleep(5); } @@ -2940,6 +2981,7 @@ static int woomera_locate_socket(woomera_profile *profile, int *woomera_socket) profile->name,__FUNCTION__,__LINE__); if (*woomera_socket > -1) { woomera_close_socket(woomera_socket); + profile->smgversion[0]='\0'; } continue; } @@ -3037,7 +3079,7 @@ static void *woomera_thread_run(void *obj) woomera_close_socket(&woomera_socket); profile->woomera_socket=-1; } - global_set_flag(TFLAG_ABORT); + global_set_flag(profile,TFLAG_ABORT); if (globals.panic > 2) { break; } @@ -3128,7 +3170,7 @@ static void *woomera_thread_run(void *obj) } } if(globals.debug > 4) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "Main Thread {%s} Select Return %d\n", profile->name, res); } } @@ -3176,7 +3218,7 @@ static int launch_tech_thread(private_object *tech_pvt) int result = 0; if (globals.debug > 2) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(tech_pvt->profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "+++LAUCN TECH THREAD\n"); } } @@ -3364,8 +3406,11 @@ static int config_woomera(void) } } } + default_context_set = 0; strncpy(profile->name, entry, sizeof(profile->name) - 1); profile->coding=AST_FORMAT_SLINEAR; + profile->verbose=100; + profile->smgversion[0]='\0'; /*default is inbound and outbound enabled */ ast_set_flag(profile, PFLAG_INBOUND | PFLAG_OUTBOUND); @@ -3669,11 +3714,10 @@ static int connect_woomera(int *new_socket, woomera_profile *profile, int flags) if (globals.debug > 2) { ast_log(LOG_NOTICE, "Woomera Got HELLO on connect! %s SMG Version %s\n", profile->name,woomera_message_header(&wmsg, "Version")); } - if (!smgversion_init && woomera_message_header(&wmsg, "Version")) { - smgversion_init=1; - strncpy(smgversion, + if (profile->smgversion[0] == '\0' && woomera_message_header(&wmsg, "Version")) { + strncpy(profile->smgversion, woomera_message_header(&wmsg, "Version"), - sizeof(smgversion)-1); + sizeof(profile->smgversion)-1); } audio_format = woomera_message_header(&wmsg, "Raw-Format"); @@ -3717,28 +3761,6 @@ static int connect_woomera(int *new_socket, woomera_profile *profile, int flags) return *new_socket; } -static int init_woomera(void) -{ - woomera_profile *profile; - ast_mutex_lock(&lock); - - if (!config_woomera()) { - ast_mutex_unlock(&lock); - return 0; - } - - ASTOBJ_CONTAINER_TRAVERSE(&woomera_profile_list, 1, do { - ASTOBJ_RDLOCK(iterator); - profile = iterator; - if (!ast_test_flag(profile, PFLAG_DISABLED)) { - launch_woomera_thread(profile); - } - ASTOBJ_UNLOCK(iterator); - } while(0)); - - ast_mutex_unlock(&lock); - return 1; -} static struct ast_channel *woomera_new(const char *type, int format, void *data, int *cause, @@ -3845,10 +3867,8 @@ static struct ast_channel *tech_requester(const char *type, int format, void *da ast_set_flag(tech_pvt, TFLAG_PBX); /* so we know we dont have to free the channel ourselves */ - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++REQ %s\n", chan->name); - } + if (globals.debug > 1 && option_verbose > 8) { + ast_verbose(WOOMERA_DEBUG_PREFIX "+++REQ %s\n", chan->name); } } else { @@ -3872,10 +3892,8 @@ static int tech_send_digit(struct ast_channel *self, char digit) private_object *tech_pvt = self->tech_pvt; int res = 0; - if (globals.debug > 1 && option_verbose > 2) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++DIGIT %s '%c'\n",self->name, digit); - } + if (globals.debug > 1 && option_verbose > 2 && woomera_profile_verbose(tech_pvt->profile) > 2) { + ast_verbose(WOOMERA_DEBUG_PREFIX "+++DIGIT %s '%c'\n",self->name, digit); } /* we don't have time to make sure the dtmf command is successful cos asterisk again @@ -4000,7 +4018,7 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) if (profile->max_calls) { if (profile->call_count >= profile->max_calls) { - if (globals.debug > 1 && option_verbose > 2) { + if (globals.debug > 1 && option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_log(LOG_ERROR, "This profile is at call limit of %d\n", profile->max_calls); } @@ -4043,7 +4061,7 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) return 0; tech_call_failed: - if (globals.debug > 1 && option_verbose > 2) { + if (globals.debug > 1 && option_verbose > 1) { ast_log(LOG_ERROR, "Error: Outbound Call Failed %p \n",tech_pvt); } self->hangupcause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; @@ -4173,6 +4191,7 @@ static int tech_answer(struct ast_channel *self) { private_object *tech_pvt; int res = 0; + const char *noanswer; tech_pvt = self->tech_pvt; if (!tech_pvt) { @@ -4181,19 +4200,22 @@ static int tech_answer(struct ast_channel *self) ast_mutex_lock(&tech_pvt->iolock); - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++ANSWER %s\n",self->name); - } + if (globals.debug > 1 && option_verbose > 2 && woomera_profile_verbose(tech_pvt->profile) > 2) { + ast_verbose(WOOMERA_DEBUG_PREFIX "+++ANSWER %s\n",self->name); } if (!ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { /* Only answer the inbound calls */ - ast_set_flag(tech_pvt, TFLAG_ANSWER); + noanswer=pbx_builtin_getvar_helper(self, "WOOMERA_NO_ANSWER"); + if (noanswer && atoi(noanswer) == 1) { + ast_clear_flag(tech_pvt, TFLAG_ANSWER); + } else { + ast_set_flag(tech_pvt, TFLAG_ANSWER); + } } else { ast_log(LOG_ERROR, "Warning: AST trying to Answer OUTBOUND Call!\n"); } - + ast_set_flag(tech_pvt, TFLAG_UP); ast_setstate(self, AST_STATE_UP); @@ -4221,7 +4243,7 @@ static void handle_fax(private_object *tech_pvt) const char *target_context = ast_strlen_zero(owner->macrocontext) ? owner->context : owner->macrocontext; #endif if (ast_exists_extension(owner, target_context, "fax", 1, owner->cid.cid_num)) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(tech_pvt->profile) > 2) { ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", owner->name); } @@ -4383,7 +4405,7 @@ tech_read_again: if (globals.debug > 4) { - if (option_verbose > 2) { + if (option_verbose > 2 && woomera_profile_verbose(tech_pvt->profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "+++READ %s %d coding %d\n",self->name, res, tech_pvt->coding); } @@ -4470,7 +4492,7 @@ static int tech_write(struct ast_channel *self, struct ast_frame *frame) return -1; } if (globals.debug > 4) { - if (option_verbose > 4) { + if (option_verbose > 9 && woomera_profile_verbose(tech_pvt->profile) > 9) { ast_verbose(WOOMERA_DEBUG_PREFIX "+++WRITE %s %d\n",self->name, i); } } @@ -4500,10 +4522,8 @@ static struct ast_frame *tech_exception(struct ast_channel *self) private_object *tech_pvt; tech_pvt = self->tech_pvt; - if (globals.debug > 1 && option_verbose > 2) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++EXCEPT %s\n",self->name); - } + if (globals.debug > 1 && option_verbose > 2 && woomera_profile_verbose(tech_pvt->profile) > 2) { + ast_verbose(WOOMERA_DEBUG_PREFIX "+++EXCEPT %s\n",self->name); } return &ast_null_frame; @@ -4569,9 +4589,11 @@ static int tech_indicate(struct ast_channel *self, int condition) if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { ast_set_flag(tech_pvt, TFLAG_ACCEPT); } +#if 0 if (!tech_pvt->profile->progress_on_accept) { ast_set_flag(tech_pvt, TFLAG_PROGRESS); } +#endif break; case AST_CONTROL_HOLD: @@ -4655,11 +4677,9 @@ static int tech_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) update_conf(p); #endif - if (globals.debug > 1 && option_verbose > 2) { - if (option_verbose > 2) { + if (globals.debug > 1 && option_verbose > 9) { ast_verbose(WOOMERA_DEBUG_PREFIX "+++FIXUP ChOld=%s ChNew=%s\n", oldchan->name,newchan->name); - } } ast_mutex_unlock(&p->iolock); @@ -4700,10 +4720,8 @@ static int tech_setoption(struct ast_channel *self, int option, void *data, int { int res = 0; - if (globals.debug > 1 && option_verbose > 2) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++SETOPT %s\n",self->name); - } + if (globals.debug > 1 && option_verbose > 9) { + ast_verbose(WOOMERA_DEBUG_PREFIX "+++SETOPT %s\n",self->name); } return res; @@ -4714,10 +4732,8 @@ static int tech_queryoption(struct ast_channel *self, int option, void *data, in { int res = 0; - if (globals.debug > 1 && option_verbose > 2) { - if (option_verbose > 2) { + if (globals.debug > 1 && option_verbose > 9) { ast_verbose(WOOMERA_DEBUG_PREFIX "+++GETOPT %s\n",self->name); - } } return res; } @@ -4728,7 +4744,7 @@ static struct ast_channel *tech_bridged_channel(struct ast_channel *self, struct { struct ast_channel *chan = NULL; - if (globals.debug > 1 && option_verbose > 2) { + if (globals.debug > 1 && option_verbose > 2 && woomera_profile_verbose(profile) > 2) { ast_verbose(WOOMERA_DEBUG_PREFIX "+++BRIDGED %s\n",self->name); } return chan; @@ -4741,10 +4757,8 @@ static int tech_transfer(struct ast_channel *self, const char *newdest) { int res = -1; - if (globals.debug > 1 && option_verbose > 2) { - if (option_verbose > 2) { + if (globals.debug > 1 && option_verbose > 9) { ast_verbose(WOOMERA_DEBUG_PREFIX "+++TRANSFER %s\n",self->name); - } } return res; } @@ -4779,33 +4793,82 @@ static char *ast16_woomera_cli(struct ast_cli_entry *e, int cmd, struct ast_cli_ } #endif +static int woomera_full_status(int fd) +{ + woomera_profile *profile; + ASTOBJ_CONTAINER_TRAVERSE(&woomera_profile_list, 1, do { + ASTOBJ_RDLOCK(iterator); + profile = iterator; + + if (!ast_test_flag(profile, PFLAG_DISABLED)) { + ast_cli(fd,"Profile: {%s} Host=%s WooVer=%s SmgVer=%s CurCalls=%i TotCalls=%i Verb=%i\n", + profile->name, profile->woomera_host, + WOOMERA_VERSION, profile->smgversion[0] == '\0'?"N/A":profile->smgversion, + profile->call_count, + profile->call_out+profile->call_in, + woomera_profile_verbose(profile)); + } + ASTOBJ_UNLOCK(iterator); + } while(0)); + + return 0; +} + + static int woomera_cli(int fd, int argc, char *argv[]) { struct woomera_profile *profile; char *profile_name="default"; - if (argc > 2) { + if (argc > 1) { profile_name=argv[1]; profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, profile_name); if (!profile) { - if (strcmp(profile_name,"version") == 0) { - ast_cli(fd, "Woomera version %s : SMG Version %s \n", - WOOMERA_VERSION,smgversion); + if (strcmp(profile_name,"version") == 0) { + ast_cli(fd, "Woomera version %s\n", + WOOMERA_VERSION); return 0; } + if (strcmp(profile_name, "debug") == 0) { + if (argc > 2) { + globals.debug = atoi(argv[2]); + } + ast_cli(fd, "Woomera debug=%d\n", globals.debug); + return 0; + } + + if (!strcmp(profile_name, "panic")) { + if (argc > 2) { + globals.panic = atoi(argv[2]); + } + ast_cli(fd, "Woomera panic=%d\n", globals.panic); + return 0; + } + + if (!strcmp(profile_name, "status")) { + woomera_full_status(fd); + return 0; + } + ast_cli(fd, "Woomera: Invalid profile name %s\n", profile_name); + ast_cli(fd, "Usage: woomera