diff --git a/ChangeLog.stable b/ChangeLog.stable index 476151f..a88e451 100644 --- a/ChangeLog.stable +++ b/ChangeLog.stable @@ -7,6 +7,28 @@ Author: Nenad Corbic Copyright (c) 1995-2007 Sangoma Technologies Inc. ------------------------------------------------------------------------------ + +* Thu Jun 14 2007 Nenad Corbic - 2.3.4-11 +=============================================================== + +- A101/2/4/8 (MAXIM) AFT Update IMPORTANT + A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. + On some lines the E1/CRC4 mode causes line errors on + the telco side which results in PRI not coming up. + + Symptiom: E1 is up (no alarms) on local side but pri is + not coming up! (Only in E1 CRC4 Mode) + +- A101/2/4/8 (MAXIM) Mandatory Firmware Update + An echo canceler bug has been fixed for all AFT + MAXIM Cards A101/2/4/8dm. New firmware version is V31. + If you are running MAXIM cards with hwec wiht older + firmware version you must upgrade. + +- Updated SMG + Fixed DTMF synchronization + + * Thu Jun 13 2007 Nenad Corbic - 2.3.4-10 =============================================================== diff --git a/Setup b/Setup index 4249ca9..0543c4c 100755 --- a/Setup +++ b/Setup @@ -1593,6 +1593,7 @@ ENDOFTEXT echo "WAN_LIB_DIR=/etc/wanpipe/lib" >> $META_CONF echo "WAN_ADSL_LIST=/etc/wanpipe/wan_adsl.list" >> $META_CONF echo "WAN_ANNEXG_LOAD=$ANNEXG_LOAD" >> $META_CONF + echo "WAN_SCTP_LOAD=$SCTP_LOAD" >> $META_CONF echo "WAN_LIP_LOAD=$LIP_LOAD" >> $META_CONF echo "WAN_DYN_WANCONFIG=NO" >> $META_CONF echo "WAN_SCRIPTS_DIR=/etc/wanpipe/scripts" >> $META_CONF @@ -1814,14 +1815,14 @@ WANPIPE utilities are used to: 1) create WANPIPE configuration files. (/usr/sbin/wancfg) 2) create configuration files for Zaptel and Asterisk - (/usr/sbin/wancfg-zaptel) - 2) start,stop,restart individual/all devices and interfaces. + (/usr/sbin/wancfg_zaptel) + 3) start,stop,restart individual/all devices and interfaces. (/usr/sbin/wanrouter) - 3) debug line, protocol and driver problems. + 4) debug line, protocol and driver problems. (/usr/sbin/wanpipemon) - 4) configure the optional onboard FT1 CSU/DSU (S508/S5143). + 5) configure the optional onboard FT1 CSU/DSU (S508/S5143). (/usr/sbin/cfgft1) - 5) aid in WANPIPE API development + 6) aid in WANPIPE API development (/etc/wanpipe/api) Refer to the WanpipeInstallation.(pdf/txt) for more information. @@ -3756,6 +3757,11 @@ WANPIPE_OBJS= \cp -f $DRIVER_UPDATE_DIR/src/lip/*.c . \cp -f $DRIVER_UPDATE_DIR/src/lip/bin/*.o . + if [ -e $DRIVER_UPDATE_DIR/src/lip/lip_katm ]; then + \cp -f $DRIVER_UPDATE_DIR/src/lip/lip_katm/*.c . + \cp -f $DRIVER_UPDATE_DIR/src/lip/lip_katm/*.h . + fi + LIP_LINKED_PROTOCOLS= TMP_CFLAGS="-I/$WANPIPE_INCLUDE_DIR -I/ -I$SOURCEDIR/include -I$SOURCEDIR/include/linux -I../include/common -I../include " @@ -3862,6 +3868,9 @@ WANPIPE_OBJS= fi if [ $XMTP2_PROT = "YES" ]; then + + SCTP_LOAD=YES + xmtp2_file=wanpipe_xmtp2.gcc$GCC_VER.$ARCH$REGPARM_OPT.o if [ ! -e $xmtp2_file ]; then echo "Warning: FR Binary $xmtp2_file not found!" @@ -4380,34 +4389,39 @@ function install_ssmg () eval "ldconfig" cd $PROD_HOME/$SSMG_DIR - cd sangoma_mgd.trunk - eval "make clean > /dev/null; make > /dev/null " - if [ $? -ne 0 ]; then - echo "FAILED" - return 1 - fi - eval "make install > /dev/null " +# Let smg install script install SMG components +#======================================================= + +# cd sangoma_mgd.trunk +# +# eval "make clean > /dev/null; make > /dev/null " +# if [ $? -ne 0 ]; then +# echo "FAILED" +# return 1 +# fi +# eval "make install > /dev/null " +# +# echo "Installing Sangoma Media Gateway Daemon...DONE" - echo "Installing Sangoma Media Gateway Daemon...DONE" - - eval "type asterisk > /dev/null 2> /dev/null" - if [ $? -ne 0 ]; then - echo "Error: Asterisk not installed!" - echo "Please install Asterisk first then retry SSMG installation!" - return 1 - fi +# eval "type asterisk > /dev/null 2> /dev/null" +# if [ $? -ne 0 ]; then +# echo "Error: Asterisk not installed!" +# echo "Please install Asterisk first then retry SSMG installation!" +# return 1 +# fi - echo - echo "Installing Chan Woomera into Asterisk..." - echo - install_chan_woomera - if [ $? -ne 0 ]; then - echo "Error: Failed to install chan_woomera into Asterisk!" - echo "Check that Asterisk is installed or Call Sangoma Tech Support" - echo - return 1 - fi +# echo +# echo "Installing Chan Woomera into Asterisk..." +# echo +# install_chan_woomera +# if [ $? -ne 0 ]; then +# echo "Error: Failed to install chan_woomera into Asterisk!" +# echo "Check that Asterisk is installed or Call Sangoma Tech Support" +# echo +# return 1 +# fi +#========================================================= cd $PROD_HOME/$SSMG_DIR cd sangoma_mgd.trunk @@ -6099,7 +6113,7 @@ KERNEL_UNAME=`uname -r` PKG_NAME=wanpipe DISTR_NAME="WANPIPE" PROD=wanrouter -PROD_VER=2.3.4-10 +PROD_VER=2.3.4-11 PROD_HOME=`pwd` META_CONF=$PROD_HOME/$PROD.rc WAN_INTR_DIR=$PROD_HOME/interfaces @@ -6178,6 +6192,7 @@ PROTOCOL_DEFINES="-DCONFIG_PRODUCT_WANPIPE_BASE " SS7_USER_ID="0" ANNEXG_LOAD=NO +SCTP_LOAD=NO ZAPTEL_INSTALL_DIR="/usr/src/zaptel" ZAPTEL_C_FILE="zaptel.c" diff --git a/deb_control/wanpipe.deb b/deb_control/wanpipe.deb index 79e1a66..5ad0c2a 100644 --- a/deb_control/wanpipe.deb +++ b/deb_control/wanpipe.deb @@ -1,5 +1,5 @@ Package: wanpipe -Version: 2.3.4-10 +Version: 2.3.4-11 Section: networking Priority: optional Architecture: all diff --git a/patches/kdrivers/include/sdla_te1_ds.h b/patches/kdrivers/include/sdla_te1_ds.h index 2e8b04b..d7d9ab6 100644 --- a/patches/kdrivers/include/sdla_te1_ds.h +++ b/patches/kdrivers/include/sdla_te1_ds.h @@ -519,6 +519,7 @@ #define REG_TCR2 0x182 #define BIT_TCR2_TD4RM 0x04 +#define BIT_TCR2_E1_AEBE 0x80 #define REG_TCR3 0x183 #define BIT_TCR3_ODF 0x80 diff --git a/patches/kdrivers/include/sdlapci.h b/patches/kdrivers/include/sdlapci.h index 2c45769..09ef50c 100644 --- a/patches/kdrivers/include/sdlapci.h +++ b/patches/kdrivers/include/sdlapci.h @@ -151,6 +151,7 @@ #define GSI_PCI_MEMORY_SIZE (8 * (4 * 2 * 1024)) #define PCI_VENDOR_ID_GSI 0x14BC #define PCI_DEVICE_ID_GSI_PULSAR 0xD002 +#define PCI_DEVICE_ID_GSI_ADSL_V2 0xD001 #define PCI_DEVICE_ID_GSI_ADSL PCI_DEVICE_ID_GSI_PULSAR diff --git a/patches/kdrivers/include/wanpipe_version.h b/patches/kdrivers/include/wanpipe_version.h index c832926..f3d896c 100644 --- a/patches/kdrivers/include/wanpipe_version.h +++ b/patches/kdrivers/include/wanpipe_version.h @@ -7,7 +7,7 @@ /********** LINUX **********/ #define WANPIPE_VERSION "2.3.4" -#define WANPIPE_SUB_VERSION "10" +#define WANPIPE_SUB_VERSION "11" #define WANPIPE_VERSION_BETA 0 #define WANPIPE_LITE_VERSION "1.1.1" diff --git a/patches/kdrivers/src/net/sdla_8te1.c b/patches/kdrivers/src/net/sdla_8te1.c index 8a60d0c..fa7964f 100644 --- a/patches/kdrivers/src/net/sdla_8te1.c +++ b/patches/kdrivers/src/net/sdla_8te1.c @@ -768,6 +768,15 @@ static int sdla_ds_te1_config(void* pfe) return -EINVAL; } + if (IS_E1_FEMEDIA(fe)){ + switch(WAN_FE_FRAME(fe)){ + case WAN_FR_CRC4: + value = READ_REG(REG_TCR2); + WRITE_REG(REG_TCR2, value | BIT_TCR2_E1_AEBE); + break; + } + } + if (IS_E1_FEMEDIA(fe)){ if (WAN_TE1_SIG_MODE(fe) == WAN_TE1_SIG_CAS){ diff --git a/patches/kdrivers/src/net/sdladrv.c b/patches/kdrivers/src/net/sdladrv.c index d384213..728f2e4 100644 --- a/patches/kdrivers/src/net/sdladrv.c +++ b/patches/kdrivers/src/net/sdladrv.c @@ -1621,14 +1621,13 @@ static int sdla_pci_probe(sdlahw_t *hw) /* Search for Pulsar PCI cards */ pci_dev = NULL; - while ((pci_dev = pci_get_device(PCI_VENDOR_ID_GSI, PCI_DEVICE_ID_GSI_ADSL, pci_dev)) != NULL) { tmp_hwcard->pci_dev = pci_dev; sdla_pci_read_config_word(hw, PCI_SUBSYS_ID_WORD, &pci_subsystem_id); -#if 1 +#if 0 if ((pci_subsystem_id & 0xFF) != S518_ADPTR_1_CPU_ADSL){ continue; } @@ -1651,6 +1650,31 @@ static int sdla_pci_probe(sdlahw_t *hw) } + /* Search for Pulsar PCI cards */ + pci_dev = NULL; + while ((pci_dev = pci_get_device(PCI_VENDOR_ID_GSI, PCI_DEVICE_ID_GSI_ADSL_V2, pci_dev)) + != NULL) { + + tmp_hwcard->pci_dev = pci_dev; + sdla_pci_read_config_word(hw, PCI_SUBSYS_ID_WORD, &pci_subsystem_id); + + pci_subsystem_id=S518_ADPTR_1_CPU_ADSL; + + hwcard = sdla_card_register(SDLA_PCI_CARD, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + 0); + if (hwcard == NULL){ + continue; + } + hwcard->adptr_type = pci_subsystem_id & 0xFF; + hwcard->pci_dev = pci_dev; + + number_pci_cards += + sdla_adsl_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); + + } + pci_dev=NULL; while((pci_dev = pci_get_device(SANGOMA_PCI_VENDOR, PCI_ANY_ID, pci_dev)) != NULL){ diff --git a/patches/kdrivers/wanec/.tmp_versions/wanec.mod b/patches/kdrivers/wanec/.tmp_versions/wanec.mod index ca6b7cb..327f127 100644 --- a/patches/kdrivers/wanec/.tmp_versions/wanec.mod +++ b/patches/kdrivers/wanec/.tmp_versions/wanec.mod @@ -1,2 +1,2 @@ -/root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/wanec.ko -/root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/wanec_iface.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/wanec_cmd.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/wanec_utils.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/wanec_dev.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/apilib/bt/octapi_bt0.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/apilib/largmath/octapi_largmath.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/apilib/llman/octapi_llman.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o /root/development/2.3.4/wanpipe-2.3.4-10/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_user.o +/root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/wanec.ko +/root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/wanec_iface.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/wanec_cmd.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/wanec_utils.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/wanec_dev.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/apilib/bt/octapi_bt0.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/apilib/largmath/octapi_largmath.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/apilib/llman/octapi_llman.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o /root/development/2.3.4/wanpipe-2.3.4-11/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_user.o diff --git a/rpmspec/wanpipe-mod.spec b/rpmspec/wanpipe-mod.spec index 1708068..313089a 100644 --- a/rpmspec/wanpipe-mod.spec +++ b/rpmspec/wanpipe-mod.spec @@ -1,7 +1,7 @@ %define WANPIPE_VER wanpipe-modules %define name %{WANPIPE_VER} %define version 2.3.4 -%define release 10 +%define release 11 %define serial 1 %define MODULES_DIR /lib/modules %define USR_INCLUDE_DIR /usr/include @@ -50,6 +50,28 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}" %changelog + +* Thu Jun 14 2007 Nenad Corbic - 2.3.4-11 +=============================================================== + +- A101/2/4/8 (MAXIM) AFT Update IMPORTANT + A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. + On some lines the E1/CRC4 mode causes line errors on + the telco side which results in PRI not coming up. + + Symptiom: E1 is up (no alarms) on local side but pri is + not coming up! (Only in E1 CRC4 Mode) + +- A101/2/4/8 (MAXIM) Mandatory Firmware Update + An echo canceler bug has been fixed for all AFT + MAXIM Cards A101/2/4/8dm. New firmware version is V31. + If you are running MAXIM cards with hwec wiht older + firmware version you must upgrade. + +- Updated SMG + Fixed DTMF synchronization + + * Thu Jun 13 2007 Nenad Corbic - 2.3.4-10 =============================================================== diff --git a/rpmspec/wanpipe-util.spec b/rpmspec/wanpipe-util.spec index 3e985f3..91d74cb 100644 --- a/rpmspec/wanpipe-util.spec +++ b/rpmspec/wanpipe-util.spec @@ -2,7 +2,7 @@ %define WANPIPE_VER wanpipe-util %define name %{WANPIPE_VER} %define version 2.3.4 -%define release 10 +%define release 11 %define serial 1 %define UTILS_DIR /usr/sbin %define UTILS_LOCAL_DIR /usr/local/sbin @@ -244,6 +244,28 @@ install_init; %changelog + +* Thu Jun 14 2007 Nenad Corbic - 2.3.4-11 +=============================================================== + +- A101/2/4/8 (MAXIM) AFT Update IMPORTANT + A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. + On some lines the E1/CRC4 mode causes line errors on + the telco side which results in PRI not coming up. + + Symptiom: E1 is up (no alarms) on local side but pri is + not coming up! (Only in E1 CRC4 Mode) + +- A101/2/4/8 (MAXIM) Mandatory Firmware Update + An echo canceler bug has been fixed for all AFT + MAXIM Cards A101/2/4/8dm. New firmware version is V31. + If you are running MAXIM cards with hwec wiht older + firmware version you must upgrade. + +- Updated SMG + Fixed DTMF synchronization + + * Thu Jun 13 2007 Nenad Corbic - 2.3.4-10 =============================================================== diff --git a/rpmspec/wanpipe.spec b/rpmspec/wanpipe.spec index bae05ea..ce5533b 100644 --- a/rpmspec/wanpipe.spec +++ b/rpmspec/wanpipe.spec @@ -2,7 +2,7 @@ %define WANPIPE_VER wanpipe %define name %{WANPIPE_VER} %define version 2.3.4 -%define release 10 +%define release 11 %define serial 1 %define UTILS_DIR /usr/sbin %define UTILS_LOCAL_DIR /usr/local/sbin @@ -252,6 +252,28 @@ install_init; %changelog + +* Thu Jun 14 2007 Nenad Corbic - 2.3.4-11 +=============================================================== + +- A101/2/4/8 (MAXIM) AFT Update IMPORTANT + A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. + On some lines the E1/CRC4 mode causes line errors on + the telco side which results in PRI not coming up. + + Symptiom: E1 is up (no alarms) on local side but pri is + not coming up! (Only in E1 CRC4 Mode) + +- A101/2/4/8 (MAXIM) Mandatory Firmware Update + An echo canceler bug has been fixed for all AFT + MAXIM Cards A101/2/4/8dm. New firmware version is V31. + If you are running MAXIM cards with hwec wiht older + firmware version you must upgrade. + +- Updated SMG + Fixed DTMF synchronization + + * Thu Jun 13 2007 Nenad Corbic - 2.3.4-10 =============================================================== diff --git a/samples/wanrouter b/samples/wanrouter index c222091..ac92c87 100644 --- a/samples/wanrouter +++ b/samples/wanrouter @@ -446,6 +446,7 @@ echo "Error: Your securelevel does not allow to load kernel modules!" if [ $OSYSTEM = "Linux" ]; then wansock_config LOAD annexg_config LOAD + sctp_config LOAD fi if ! lip_config LOAD @@ -1286,6 +1287,30 @@ wansock_config () return 0 } +sctp_config () +{ + local opt=$1 + + if [ $OSYSTEM != "Linux" ]; then + return 0 + fi + + if [ "$WAN_SCTP_LOAD" != "YES" ]; then + return 0 + fi + + if [ $DEPMOD != YES ]; then + return 0 + fi + + if [ $opt = LOAD ]; then + eval "modprobe sctp" 2> /dev/null >/dev/null + fi + + return 0 +} + + annexg_config () { local opt=$1 @@ -1904,7 +1929,7 @@ WANPIPE_IS_RUNNING=/var/run/wanpipe_is_running RUGGEDCOM=No if [ $OSYSTEM = "Linux" ]; then - ROUTER_VERSION=2.3.4-10 + ROUTER_VERSION=2.3.4-11 IFCONFIG_LIST=ifconfig MODULE_STAT=lsmod WAN_DRIVERS="wanpipe" diff --git a/ssmg/sangoma_mgd.trunk/.svn/entries b/ssmg/sangoma_mgd.trunk/.svn/entries index eff0fd6..98a98c4 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/entries +++ b/ssmg/sangoma_mgd.trunk/.svn/entries @@ -1,14 +1,14 @@ 8 dir -206 +223 svn://sangoma.freeswitch.org/sangoma_mgd/trunk svn://sangoma.freeswitch.org -2007-05-23T22:40:18.406377Z -203 +2007-07-10T21:28:58.437367Z +223 ncorbic @@ -26,53 +26,29 @@ svn:special svn:externals svn:needs-lock 2028fedf-720c-0410-83b8-d54a3e729fb0 -sigboost.h -file - - - - -2007-05-02T23:53:06.000000Z -3d2e4c760ba5aa8c6c65a44f1791f302 -2007-05-02T22:55:06.099862Z -193 -ncorbic - install.sh file -2007-05-17T21:56:02.000000Z -19d46c159dbe864a780804789297db25 -2007-05-18T15:18:52.166170Z -202 +2007-06-14T04:18:01.000000Z +eebdfdf347cb99e7d38591488df900d7 +2007-06-14T04:19:34.594824Z +212 ncorbic has-props -switch_buffer.h +sigboost.h file -2007-06-06T20:39:58.000000Z -33317d4c301ec4e698bf651bae64bae7 -2007-05-23T22:40:18.406377Z -203 -ncorbic - -sangoma_mgd.conf.sample -file - - - - -2007-04-13T19:46:26.000000Z -3332791842dafbc726d1b03b9f769db4 -2007-04-13T18:50:03.087811Z -178 +2007-06-14T04:10:02.000000Z +f60c7e21ea28daf62933e5fa55fac387 +2007-06-14T04:08:55.484670Z +208 ncorbic sound.raw @@ -88,16 +64,40 @@ da36acc78b83d5047481df0cca63d969 ncorbic has-props +sangoma_mgd.conf.sample +file + + + + +2007-04-13T19:46:26.000000Z +3332791842dafbc726d1b03b9f769db4 +2007-04-13T18:50:03.087811Z +178 +ncorbic + +switch_buffer.h +file + + + + +2007-06-21T22:16:27.000000Z +f4832443a621cbb88e92535898d11b83 +2007-06-21T22:11:59.891196Z +216 +ncorbic + chan_woomera.c file -2007-05-10T17:14:45.000000Z -6c8f7ef7a7ea4c9d89a18eb47804d4cb -2007-05-10T16:17:18.259953Z -198 +2007-07-10T21:29:42.000000Z +3693a07162575b55f4c9fcd4126b21d8 +2007-07-10T21:28:58.437367Z +223 ncorbic callgettest.sh @@ -116,18 +116,8 @@ has-props conf dir -switch_buffer.o -file - - - - -2007-06-06T20:39:58.000000Z -8dcd404011d16c393c380d6f0de727ed -2007-05-23T22:40:18.406377Z -203 -ncorbic -has-props +scripts +dir Changelog file @@ -135,38 +125,47 @@ file -2007-05-02T23:58:55.000000Z -3d40e2f19bf73c2c65238374f026bd16 -2007-05-02T23:01:52.479742Z -194 +2007-06-14T04:10:02.000000Z +e882d77b92b36e5878240af27f94d36f +2007-06-14T04:08:55.484670Z +208 ncorbic -scripts -dir - -re-sync.sh -file - - - - -2007-05-10T17:14:45.000000Z -add21bcb8c87b3136a0e31ab2b6d1af0 -2007-05-09T13:29:00.345429Z -197 -ncorbic -has-props - call_signal.c file -2007-05-02T23:53:06.000000Z -4904b13c46e305a2d305dcf99978f490 -2007-05-02T22:55:06.099862Z -193 +2007-06-21T22:16:27.000000Z +ce7833d67e4f74118a8fb4c7beecddf2 +2007-06-21T22:12:30.552870Z +218 +ncorbic + +re-sync.sh +file + + + + +2007-06-14T04:10:02.000000Z +9aa3a4dddd5f60be4c78e08d3e37c87c +2007-06-14T04:08:55.484670Z +208 +ncorbic +has-props + +sangoma_mgd.c +file + + + + +2007-07-10T21:29:46.000000Z +c940a7db93c8066de876e98328747594 +2007-07-10T21:28:10.949071Z +222 ncorbic woomera.conf @@ -181,18 +180,6 @@ aa9bfdfa7b10bb26911cf3b6ae9f604d 152 ncorbic -sangoma_mgd.c -file -207 - - - -2007-06-06T21:05:48.000000Z -b45fbe0a16ca2eef8c312d15ae4ad499 -2007-06-06T21:06:29.258451Z -207 -ncorbic - clog.sh file @@ -212,10 +199,22 @@ file -2007-05-02T23:53:06.000000Z -a641f97b4002c1ef4874aacbeed98861 -2007-05-02T22:55:06.099862Z -193 +2007-06-14T04:10:02.000000Z +1a8b734edbabbe1e04c0086460cf1565 +2007-06-14T04:08:55.484670Z +208 +ncorbic + +sangoma_mgd.h +file + + + + +2007-06-21T22:16:27.000000Z +ee7ac4b94dcda9781e242afcf8119488 +2007-06-21T22:12:18.622974Z +217 ncorbic g711.h @@ -252,10 +251,10 @@ file -2007-06-06T20:39:58.000000Z -b5a7c694b86448f3553a7d744885b50a -2007-05-23T22:40:18.406377Z -203 +2007-06-21T22:16:27.000000Z +628f33fbdf3fb2d3c2861684146bbf5c +2007-06-21T22:11:50.257308Z +215 ncorbic Makefile @@ -264,9 +263,9 @@ file -2007-02-01T01:39:42.000000Z -a060a5b05ca179bd79d41bac1efa5b7c -2007-03-23T21:32:51.180292Z -171 +2007-06-14T04:12:18.000000Z +afc38981b543b562f5262e9b1b16836a +2007-06-14T04:19:34.594824Z +212 ncorbic diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/Changelog.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/Changelog.svn-base index 5868682..385d189 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/Changelog.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/Changelog.svn-base @@ -1,3 +1,41 @@ +sangoma_mgd.c +====================================== +Jun 13 2007 + +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 + + +chan_woomera.c +====================================== +Jun 13 2007 + +v1.11 Nenad Corbic + Updated multiple profiles + Updated Dialect for OPAL Woomera + Added call logging/debugging + Fixed presentation + +v1.10 Nenad Corbic + Bug fix in incoming hangup + +v1.9 Nenad Corbic + Fixed remote asterisk/woomera + setup. + sangoma_mgd.c ====================================== 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 2a544ef..064cc66 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/Makefile.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/Makefile.svn-base @@ -15,7 +15,7 @@ SMG_DTMF=YES CC = gcc -INCLUDES = -I/lib/modules/$(shell uname -r)/build/include -I. -I/usr/local/include +INCLUDES = -I/lib/modules/$(shell uname -r)/build/include -I. -I/usr/local/include -I../../patches/kdrivers/include CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g LDFLAGS=-L. -L/usr/local/lib -lpthread -lsangoma -lm @@ -39,7 +39,7 @@ sangoma_mgd: sangoma_mgd.o call_signal.o switch_buffer.o sigboost.h rm -fr core* $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o switch_buffer.o call_signal.o $(LDFLAGS) -sangoma_mgd.o: sangoma_mgd.c sigboost.h +sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c clean: 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 ccaca3a..57177c0 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 @@ -4,7 +4,8 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 2005 Nenad Corbic + * Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -19,10 +20,6 @@ extern void __log_printf(int level, FILE *fp, char *file, const char *func, int #define clog_printf(level, fp, fmt, ...) __log_printf(level, fp, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) -extern unsigned int txseq; -extern unsigned int rxseq_reset; -extern unsigned int rxseq; - struct call_signal_map { uint32_t event_id; char *name; @@ -43,7 +40,7 @@ static struct call_signal_map call_signal_table[] = { {SIGBOOST_EVENT_REMOVE_CHECK_LOOP, "LOOP STOP"} }; - +#define USE_SCTP 1 static int create_udp_socket(call_signal_connection_t *mcon, char *local_ip, int local_port, char *ip, int port) { @@ -54,7 +51,17 @@ static int create_udp_socket(call_signal_connection_t *mcon, char *local_ip, int memset(&mcon->remote_hp, 0, sizeof(mcon->remote_hp)); memset(&mcon->local_hp, 0, sizeof(mcon->local_hp)); - if ((mcon->socket = socket(AF_INET, SOCK_DGRAM, 0))) { +#ifdef USE_SCTP + mcon->socket = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); +#else + mcon->socket = socket(AF_INET, SOCK_DGRAM, 0); +#endif + + clog_printf(3,mcon->log,"Creating L=%s:%d R=%s:%d\n", + local_ip,local_port,ip,port); + + if (mcon->socket >= 0) { + int flag=1; gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &result, &err); gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_result, &err); if (result && local_result) { @@ -66,9 +73,24 @@ static int create_udp_socket(call_signal_connection_t *mcon, char *local_ip, int memcpy((char *) &mcon->local_addr.sin_addr.s_addr, mcon->local_hp.h_addr_list[0], mcon->local_hp.h_length); mcon->local_addr.sin_port = htons(local_port); - if ((rc = bind(mcon->socket, (struct sockaddr *) &mcon->local_addr, sizeof(mcon->local_addr))) < 0) { +#ifdef USE_SCTP + setsockopt(mcon->socket, IPPROTO_SCTP, SCTP_NODELAY, + (char *)&flag, sizeof(int)); +#endif + + if ((rc = bind(mcon->socket, + (struct sockaddr *) &mcon->local_addr, + sizeof(mcon->local_addr))) < 0) { close(mcon->socket); mcon->socket = -1; + } else { +#ifdef USE_SCTP + rc=listen(mcon->socket,100); + if (rc) { + close(mcon->socket); + mcon->socket = -1; + } +#endif } } } @@ -87,8 +109,6 @@ int call_signal_connection_close(call_signal_connection_t *mcon) int call_signal_connection_open(call_signal_connection_t *mcon, char *local_ip, int local_port, char *ip, int port) { - memset(mcon, 0, sizeof(*mcon)); - create_udp_socket(mcon, local_ip, local_port, ip, port); return mcon->socket; } @@ -104,27 +124,30 @@ call_signal_event_t *call_signal_connection_read(call_signal_connection_t *mcon, if (bytes == sizeof(mcon->event) || bytes == (sizeof(mcon->event)-sizeof(uint32_t))) { - if (rxseq_reset) { + if (mcon->rxseq_reset) { if (mcon->event.event_id == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) { - rxseq++; + clog_printf(0,mcon->log,"Rx sync ok\n"); + mcon->rxseq=mcon->event.fseqno; return &mcon->event; } - errno=EAGAIN; clog_printf(0,mcon->log,"Waiting for rx sync...\n"); return NULL; } + + mcon->rxseq++; - if (rxseq != mcon->event.seqno) { + if (mcon->rxseq != mcon->event.fseqno) { clog_printf(0, mcon->log, "------------------------------------------\n"); clog_printf(0, mcon->log, "Critical Error: Invalid Sequence Number Expect=%i Rx=%i\n", - rxseq,mcon->event.seqno); + mcon->rxseq,mcon->event.fseqno); clog_printf(0, mcon->log, "------------------------------------------\n"); } - rxseq++; + + mcon->txwindow = mcon->txseq - mcon->event.bseqno; return &mcon->event; @@ -143,6 +166,33 @@ call_signal_event_t *call_signal_connection_read(call_signal_connection_t *mcon, return NULL; } +call_signal_event_t *call_signal_connection_readp(call_signal_connection_t *mcon, int iteration) +{ + unsigned int fromlen = sizeof(struct sockaddr_in); + int bytes = 0; + + bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, + (struct sockaddr *) &mcon->local_addr, &fromlen); + + if (bytes == sizeof(mcon->event) || + bytes == (sizeof(mcon->event)-sizeof(uint32_t))) { + return &mcon->event; + } else { + if (iteration == 0) { + clog_printf(0, mcon->log, + "------------------------------------------\n"); + clog_printf(0, mcon->log, + "Critical Error: PQ Invalid Event lenght from boost rxlen=%i evsz=%i\n", + bytes, sizeof(mcon->event)); + clog_printf(0, mcon->log, + "------------------------------------------\n"); + } + } + + return NULL; +} + + int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_event_t *event) { int err; @@ -151,7 +201,7 @@ int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_eve return -EINVAL; } - if (event->span < 0 || event->chan < 0 || event->span > 16 || event->chan > 30) { + if (event->span < 0 || event->chan < 0 || event->span > 16 || event->chan > 31) { clog_printf(0, mcon->log, "------------------------------------------\n"); clog_printf(0, mcon->log, @@ -164,7 +214,8 @@ int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_eve gettimeofday(&event->tv,NULL); pthread_mutex_lock(&mcon->lock); - event->seqno=txseq++; + event->fseqno=mcon->txseq++; + event->bseqno=mcon->rxseq; err=sendto(mcon->socket, event, sizeof(call_signal_event_t), 0, (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr)); pthread_mutex_unlock(&mcon->lock); @@ -172,7 +223,6 @@ int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_eve if (err != sizeof(call_signal_event_t)) { err = -1; } - #if 0 clog_printf(2, mcon->log, "TX EVENT\n"); @@ -189,7 +239,7 @@ int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_eve clog_printf(2, mcon->log, " tInterface: [w%dg%d]\n",event->span+1,event->chan+1); clog_printf(2, mcon->log, " tEvent ID: [%d]\n",event->event_id); clog_printf(2, mcon->log, " tSetup ID: [%d]\n",event->call_setup_id); - clog_printf(2, mcon->log, " tSeq: [%d]\n",event->seqno); + clog_printf(2, mcon->log, " tSeq: [%d]\n",event->fseqno); clog_printf(2, mcon->log, "===================================\n"); #endif @@ -202,7 +252,7 @@ int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_eve event->chan+1, event->release_cause, event->call_setup_id, - event->seqno, + event->fseqno, (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") ); @@ -237,7 +287,7 @@ int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_eve event->chan+1, event->event_id, event->call_setup_id, - event->seqno + event->fseqno ); #endif diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.h.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.h.svn-base index 5382a26..648aafb 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.h.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/call_signal.h.svn-base @@ -4,7 +4,8 @@ * Author(s): Anthony Minessale II * Nenad Corbic * - * Copyright: (c) 2005 Anthony Minessale II + * Copyright: (c) 05-07 Nenad Corbic + * Anthony Minessale II * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -56,6 +58,14 @@ typedef t_sigboost call_signal_event_t; typedef uint32_t call_signal_event_id_t; +typedef struct smg_ip_cfg +{ + char local_ip[25]; + int local_port; + char remote_ip[25]; + int remote_port; +}smg_ip_cfg_t; + struct call_signal_connection { int socket; struct sockaddr_in local_addr; @@ -66,6 +76,11 @@ struct call_signal_connection { unsigned int flags; pthread_mutex_t lock; FILE *log; + unsigned int txseq; + unsigned int rxseq; + unsigned int txwindow; + unsigned int rxseq_reset; + smg_ip_cfg_t cfg; }; typedef enum { @@ -74,9 +89,17 @@ typedef enum { typedef struct call_signal_connection call_signal_connection_t; +/* disable nagle's algorythm */ +static inline void sctp_no_nagle(int socket) +{ + int flag = 1; + setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY, (char *) &flag, sizeof(int)); +} + int call_signal_connection_close(call_signal_connection_t *mcon); int call_signal_connection_open(call_signal_connection_t *mcon, char *local_ip, int local_port, char *ip, int port); call_signal_event_t *call_signal_connection_read(call_signal_connection_t *mcon, int iteration); +call_signal_event_t *call_signal_connection_readp(call_signal_connection_t *mcon, int iteration); int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_event_t *event); void call_signal_event_init(call_signal_event_t *event, call_signal_event_id_t event_id, int chan, int span); void call_signal_call_init(call_signal_event_t *event, char *calling, char *called, int setup_id); diff --git a/ssmg/sangoma_mgd.trunk/.svn/text-base/chan_woomera.c.svn-base b/ssmg/sangoma_mgd.trunk/.svn/text-base/chan_woomera.c.svn-base index 4351ec3..100591e 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/text-base/chan_woomera.c.svn-base +++ b/ssmg/sangoma_mgd.trunk/.svn/text-base/chan_woomera.c.svn-base @@ -12,6 +12,14 @@ * This program is free software, distributed under the terms of * the GNU General Public License * ============================================= + * v1.12 Nenad Corbic + * Updated DTMF locking + * + * v1.11 Nenad Corbic + * Updated multiple profiles + * Updated Dialect for OPAL Woomera + * Added call logging/debugging + * * v1.10 Nenad Corbic * Bug fix in incoming hangup * @@ -81,9 +89,9 @@ #include "asterisk.h" extern int option_verbose; -#define WOOMERA_VERSION "v1.10" +#define WOOMERA_VERSION "v1.12" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.10 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.12 $") static int tech_count = 0; static const char desc[] = "Woomera Channel Driver"; @@ -119,7 +127,7 @@ static struct ast_jb_conf global_jbconf; #define WOOMERA_RECORD_SEPARATOR "\r\n\r\n" #define WOOMERA_DEBUG_PREFIX "**[WOOMERA]** " #define WOOMERA_DEBUG_LINE "--------------------------------------------------------------------------------" -#define WOOMERA_HARD_TIMEOUT -10000 +#define WOOMERA_HARD_TIMEOUT -1000 #define WOOMERA_QLEN 10 /* this macro is not in all versions of asterisk */ @@ -365,10 +373,9 @@ static int config_woomera(void); static int create_udp_socket(char *ip, int port, struct sockaddr_in *sockaddr, int client); static int connect_woomera(int *new_socket, woomera_profile *profile, int flags); static int init_woomera(void); -static struct ast_channel *woomera_new(const char *type, int format, void *data, int *cause); static int woomera_cli(int fd, int argc, char *argv[]); static void tech_destroy(private_object *tech_pvt, struct ast_channel *owner); -static struct ast_channel *woomera_new(const char *type, int format, void *data, int *cause); +static struct ast_channel *woomera_new(const char *type, int format, void *data, int *cause, woomera_profile *profile); static int launch_tech_thread(private_object *tech_pvt); static int tech_create_read_socket(private_object *tech_pvt); static int tech_activate(private_object *tech_pvt); @@ -810,6 +817,12 @@ static int woomera_message_parse(int fd, woomera_message *wmsg, int timeout, bytes = atoi(val); } + if (name && val && !strcasecmp(name, "content-length")) { + ast_set_flag(wmsg, WFLAG_CONTENT); + bytes = atoi(val); + } + + } wmsg->last++; } @@ -947,6 +960,7 @@ static int tech_activate(private_object *tech_pvt) int retry_activate_call=0; woomera_message wmsg; char *callid; + int err=0; memset(&wmsg,0,sizeof(wmsg)); retry_activate_again: @@ -992,10 +1006,11 @@ retry_activate_again: woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "CALL %s:%s%s" - "Raw-Audio: %s/%d%s" + "Raw-Audio: %s:%d%s" "Local-Name: %s!%s%s" "Local-Number:%s%s" "Presentation:%d%s" + "Screening:%d%s" "RDNIS:%s%s", tech_pvt->proto, tech_pvt->dest, @@ -1008,7 +1023,9 @@ retry_activate_again: WOOMERA_LINE_SEPARATOR, tech_pvt->cid_num, WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_pres, + (tech_pvt->cid_pres>>5)&0x7, + WOOMERA_LINE_SEPARATOR, + tech_pvt->cid_pres&0xF, WOOMERA_LINE_SEPARATOR, tech_pvt->cid_rdnis?tech_pvt->cid_rdnis:"", WOOMERA_RECORD_SEPARATOR @@ -1018,10 +1035,11 @@ retry_activate_again: woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "CALL %s%s" - "Raw-Audio: %s/%d%s" + "Raw-Audio: %s:%d%s" "Local-Name: %s!%s%s" "Local-Number:%s%s" "Presentation:%d%s" + "Screening:%d%s" "RDNIS:%s%s", tech_pvt->dest, WOOMERA_LINE_SEPARATOR, @@ -1033,16 +1051,17 @@ retry_activate_again: WOOMERA_LINE_SEPARATOR, tech_pvt->cid_num, WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_pres, + (tech_pvt->cid_pres>>5)&0x7, + WOOMERA_LINE_SEPARATOR, + tech_pvt->cid_pres&0xF, WOOMERA_LINE_SEPARATOR, tech_pvt->cid_rdnis?tech_pvt->cid_rdnis:"", WOOMERA_RECORD_SEPARATOR ); } - woomera_message_parse_wait(tech_pvt,&wmsg); - - if (woomera_message_reply_ok(&wmsg) != 0) { + err=woomera_message_parse_wait(tech_pvt,&wmsg); + if (err < 0 || woomera_message_reply_ok(&wmsg) != 0) { ast_set_flag(tech_pvt, TFLAG_ABORT); } @@ -1058,6 +1077,23 @@ retry_activate_again: __FUNCTION__,__LINE__, tech_pvt->callid,tech_pvt); } + + woomera_printf(tech_pvt->profile, + tech_pvt->command_channel, + "PROCEED %s%s" + "Unique-Call-Id %s%s", + tech_pvt->callid, + WOOMERA_LINE_SEPARATOR, + tech_pvt->callid, + WOOMERA_RECORD_SEPARATOR); + + err=woomera_message_parse_wait(tech_pvt,&wmsg); + if (err < 0 || woomera_message_reply_ok(&wmsg) != 0) { + ast_set_flag(tech_pvt, TFLAG_ABORT); + /* Do not hangup on main because + * socket connection has been + * established */ + } } @@ -1080,8 +1116,9 @@ tech_activate_failed: * We must send a message to SMG to hangup the call */ + if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Error: %s Call %s tpvt=%p Failed: CRITICAL\n", + ast_log(LOG_NOTICE, "Error: %s Call %s tpvt=%p Failed!\n", ast_test_flag(tech_pvt, TFLAG_OUTBOUND) ? "OUT":"IN", tech_pvt->callid,tech_pvt); } @@ -1136,6 +1173,54 @@ static int tech_init(private_object *tech_pvt, woomera_profile *profile, int fla ast_set_flag(tech_pvt, flags); + if (profile->dtmf_enable) { + + tech_pvt->dsp_features=0; + tech_pvt->dsp = ast_dsp_new(); + if (tech_pvt->dsp) { +#if 0 + i->dsp_features = features & ~DSP_PROGRESS_TALK; + + /* We cannot do progress detection until receives PROGRESS message */ + if (i->outgoing && (i->sig == SIG_PRI)) { + /* Remember requested DSP features, don't treat + talking as ANSWER */ + features = 0; + } +#endif + tech_pvt->dsp_features |= DSP_FEATURE_DTMF_DETECT; + //tech_pvt->dsp_features |= DSP_FEATURE_BUSY_DETECT; + //tech_pvt->dsp_features |= DSP_FEATURE_CALL_PROGRESS; + //tech_pvt->dsp_features |= DSP_FEATURE_FAX_DETECT; + ast_dsp_set_features(tech_pvt->dsp, tech_pvt->dsp_features); + ast_dsp_digitmode(tech_pvt->dsp, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF); + tech_pvt->ast_dsp=1; + +#if 0 + if (!ast_strlen_zero(progzone)) + ast_dsp_set_call_progress_zone(tech_pvt->dsp, progzone); + if (i->busydetect && CANBUSYDETECT(i)) { + ast_dsp_set_busy_count(tech_pvt->dsp, i->busycount); + ast_dsp_set_busy_pattern(tech_pvt->dsp, i->busy_tonelength, ->busy_quietlength); + } +#endif + } + } + + if (profile && profile->faxdetect) { + tech_pvt->faxdetect=1; + } + + if (profile->jb_enable) { +#ifdef AST_JB + /* Assign default jb conf to the new zt_pvt */ + memcpy(&tech_pvt->jbconf, &global_jbconf, sizeof(struct ast_jb_conf)); + ast_jb_configure(chan, &tech_pvt->jbconf); +#else + ast_log(LOG_ERROR, "Asterisk Jitter Buffer Not Compiled!\n"); +#endif + } + /* Asterisk being asterisk and all allows approx 1 nanosecond * to try and establish a connetion here before it starts crying. @@ -1163,13 +1248,13 @@ static int tech_init(private_object *tech_pvt, woomera_profile *profile, int fla ast_set_flag(tech_pvt, TFLAG_ABORT); return -1; } - ast_mutex_lock(&default_profile.call_count_lock); + ast_mutex_lock(&tech_pvt->profile->call_count_lock); if (ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - default_profile.call_out++; + tech_pvt->profile->call_out++; } else { - default_profile.call_in++; + tech_pvt->profile->call_in++; } - ast_mutex_unlock(&default_profile.call_count_lock); + ast_mutex_unlock(&tech_pvt->profile->call_count_lock); } else { if (ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { @@ -1179,12 +1264,13 @@ static int tech_init(private_object *tech_pvt, woomera_profile *profile, int fla } } - if (profile) { - ast_mutex_lock(&profile->call_count_lock); - profile->call_count++; - tech_pvt->call_count = profile->call_count; - ast_mutex_unlock(&profile->call_count_lock); - } + + ast_mutex_lock(&profile->call_count_lock); + profile->call_count++; + tech_pvt->call_count = profile->call_count; + ast_mutex_unlock(&profile->call_count_lock); + + if (globals.debug > 2) { ast_log(LOG_NOTICE, "TECH INIT tech_pvt=%p c=%p (use=%i)\n", tech_pvt,tech_pvt->owner,usecount()); @@ -1391,8 +1477,8 @@ static void *tech_monitor_thread(void *obj) if (globals.debug > 2) { ast_log(LOG_NOTICE, "IN THREAD %s rxgain=%f txtain=%f\n", tech_pvt->callid, - default_profile.rxgain_val, - default_profile.txgain_val); + tech_pvt->profile->rxgain_val, + tech_pvt->profile->txgain_val); } @@ -1501,13 +1587,13 @@ static void *tech_monitor_thread(void *obj) usleep(5000); sched_yield(); } - ast_mutex_lock(&default_profile.call_count_lock); - default_profile.call_end++; - ast_mutex_unlock(&default_profile.call_count_lock); + ast_mutex_lock(&tech_pvt->profile->call_count_lock); + tech_pvt->profile->call_end++; + ast_mutex_unlock(&tech_pvt->profile->call_count_lock); } else { - ast_mutex_lock(&default_profile.call_count_lock); - default_profile.call_abort++; - ast_mutex_unlock(&default_profile.call_count_lock); + ast_mutex_lock(&tech_pvt->profile->call_count_lock); + tech_pvt->profile->call_abort++; + ast_mutex_unlock(&tech_pvt->profile->call_count_lock); if (globals.debug > 2) { ast_log(LOG_NOTICE, "NOTE: Skipping Wait on destroy timedout! %s tech_pvt=%p\n", @@ -1595,7 +1681,7 @@ static void *tech_monitor_thread(void *obj) woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "%s %s%s" - "Raw-Audio: %s/%d%s" + "Raw-Audio: %s:%d%s" "Request-Audio: Raw%s" "Unique-Call-Id: %s%s", MEDIA_ANSWER, @@ -1663,22 +1749,23 @@ static void *tech_monitor_thread(void *obj) goto tech_thread_continue; continue; } - - ast_mutex_lock(&default_profile.call_count_lock); - default_profile.call_ok++; - ast_mutex_unlock(&default_profile.call_count_lock); + + ast_mutex_lock(&tech_pvt->profile->call_count_lock); + tech_pvt->profile->call_ok++; + ast_mutex_unlock(&tech_pvt->profile->call_count_lock); #endif } } if (ast_test_flag(tech_pvt, TFLAG_DTMF)) { if (globals.debug > 2) { - ast_log(LOG_NOTICE, "DTMF %s tpvt=%p\n", - tech_pvt->callid,tech_pvt); + ast_log(LOG_NOTICE, "DTMF %s tpvt=%p %s\n", + tech_pvt->callid,tech_pvt,tech_pvt->dtmfbuf); } //DIALECT -#if 1 + ast_mutex_lock(&tech_pvt->iolock); +#if 0 woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "DTMF %s %s%s", tech_pvt->callid, @@ -1697,6 +1784,10 @@ static void *tech_monitor_thread(void *obj) WOOMERA_RECORD_SEPARATOR); #endif + ast_clear_flag(tech_pvt, TFLAG_DTMF); + memset(tech_pvt->dtmfbuf, 0, sizeof(tech_pvt->dtmfbuf)); + ast_mutex_unlock(&tech_pvt->iolock); + if (woomera_message_parse_wait(tech_pvt,&wmsg) < 0) { ast_set_flag(tech_pvt, TFLAG_ABORT); ast_log(LOG_NOTICE, "DTMF ABORT Ch=%d\n", @@ -1704,10 +1795,6 @@ static void *tech_monitor_thread(void *obj) goto tech_thread_continue; continue; } - ast_mutex_lock(&tech_pvt->iolock); - ast_clear_flag(tech_pvt, TFLAG_DTMF); - memset(tech_pvt->dtmfbuf, 0, sizeof(tech_pvt->dtmfbuf)); - ast_mutex_unlock(&tech_pvt->iolock); } if(tech_pvt->timeout) { @@ -1852,9 +1939,9 @@ static void *tech_monitor_thread(void *obj) ast_queue_frame(owner, &answer_frame); ast_set_flag(tech_pvt, TFLAG_UP); - ast_mutex_lock(&default_profile.call_count_lock); - default_profile.call_ok++; - ast_mutex_unlock(&default_profile.call_count_lock); + ast_mutex_lock(&tech_pvt->profile->call_count_lock); + tech_pvt->profile->call_ok++; + ast_mutex_unlock(&tech_pvt->profile->call_count_lock); }else{ ast_set_flag(tech_pvt, TFLAG_ABORT); @@ -1952,7 +2039,6 @@ static int woomera_locate_socket(woomera_profile *profile, int *woomera_socket) ) < 0) { ast_log(LOG_ERROR, "{%s} %s:%d HELP! Woomera is broken!\n", profile->name,__FUNCTION__,__LINE__); - globals.panic = 1; if (*woomera_socket > -1) { woomera_close_socket(woomera_socket); } @@ -2055,7 +2141,6 @@ static void *woomera_thread_run(void *obj) break; } - globals.panic = 1; continue; if (woomera_socket > -1) { @@ -2071,7 +2156,6 @@ static void *woomera_thread_run(void *obj) &profile->event_queue ) < 0) { ast_log(LOG_ERROR, "{%s} %s:%d HELP! Woomera is broken!\n", profile->name,__FUNCTION__,__LINE__); - globals.panic = 1; woomera_close_socket(&woomera_socket); } } @@ -2105,7 +2189,7 @@ static void *woomera_thread_run(void *obj) ast_log(LOG_NOTICE, "NEW INBOUND CALL %s!\n",wmsg.callid); } - if ((inchan = woomera_new(type, WFORMAT, name, &cause))) { + if ((inchan = woomera_new(type, profile->coding, name, &cause, profile))) { private_object *tech_pvt; char *callid; tech_pvt = inchan->tech_pvt; @@ -2350,6 +2434,8 @@ static int config_woomera(void) } } strncpy(profile->name, entry, sizeof(profile->name) - 1); + profile->coding=AST_FORMAT_SLINEAR; + /*default is inbound and outbound enabled */ ast_set_flag(profile, PFLAG_INBOUND | PFLAG_OUTBOUND); for (v = ast_variable_browse(cfg, entry); v ; v = v->next) { @@ -2586,27 +2672,30 @@ static int connect_woomera(int *new_socket, woomera_profile *profile, int flags) woomera_message_header(&wmsg, "Version"), sizeof(smgversion)-1); } + audio_format = woomera_message_header(&wmsg, "Raw-Format"); + if (!audio_format) { + audio_format = woomera_message_header(&wmsg, "Raw-Audio-Format"); + } if (audio_format) { profile->coding=AST_FORMAT_SLINEAR; - if (strncmp(audio_format,"PMC-16",20) == 0){ + if (strncasecmp(audio_format,"PCM-16",20) == 0){ profile->coding=AST_FORMAT_SLINEAR; - } else if (strncmp(audio_format,"ULAW",15) == 0) { + } else if (strncasecmp(audio_format,"ULAW",15) == 0) { profile->coding=AST_FORMAT_ULAW; - } else if (strncmp(audio_format,"ALAW",15) == 0) { + } else if (strncasecmp(audio_format,"ALAW",15) == 0) { profile->coding=AST_FORMAT_ALAW; } else { ast_log(LOG_ERROR, "Error: Invalid Raw-Format %s\n", audio_format); } - default_profile.coding=profile->coding; - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Setting RAW Format to %s %i\n", - audio_format, default_profile.coding); + ast_log(LOG_NOTICE, "Setting RAW Format to %s %i (p%i:u%i:a%i)\n", + audio_format, profile->coding, + AST_FORMAT_SLINEAR,AST_FORMAT_ULAW,AST_FORMAT_ALAW); } } } @@ -2648,11 +2737,10 @@ static int init_woomera(void) return 1; } -static struct ast_channel *woomera_new(const char *type, int format, void *data, int *cause) +static struct ast_channel *woomera_new(const char *type, int format, void *data, int *cause, woomera_profile *parent_profile) { private_object *tech_pvt; struct ast_channel *chan = NULL; - woomera_profile *profile=NULL;; if ((chan = ast_channel_alloc(1))) { chan->nativeformats = WFORMAT; @@ -2685,63 +2773,11 @@ static struct ast_channel *woomera_new(const char *type, int format, void *data, tech_pvt->owner = chan; - - profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, "default"); - - if (profile) { - tech_pvt->coding = profile->coding; - chan->nativeformats = profile->coding; - chan->writeformat = chan->rawwriteformat = chan->readformat = profile->coding; - tech_pvt->frame.subclass = profile->coding; - } - - if (profile && profile->dtmf_enable) { - - - - tech_pvt->dsp_features=0; - tech_pvt->dsp = ast_dsp_new(); - if (tech_pvt->dsp) { -#if 0 - i->dsp_features = features & ~DSP_PROGRESS_TALK; - - /* We cannot do progress detection until receives PROGRESS message */ - if (i->outgoing && (i->sig == SIG_PRI)) { - /* Remember requested DSP features, don't treat - talking as ANSWER */ - features = 0; - } -#endif - tech_pvt->dsp_features |= DSP_FEATURE_DTMF_DETECT; - //tech_pvt->dsp_features |= DSP_FEATURE_BUSY_DETECT; - //tech_pvt->dsp_features |= DSP_FEATURE_CALL_PROGRESS; - //tech_pvt->dsp_features |= DSP_FEATURE_FAX_DETECT; - ast_dsp_set_features(tech_pvt->dsp, tech_pvt->dsp_features); - ast_dsp_digitmode(tech_pvt->dsp, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF); - tech_pvt->ast_dsp=1; - -#if 0 - if (!ast_strlen_zero(progzone)) - ast_dsp_set_call_progress_zone(tech_pvt->dsp, progzone); - if (i->busydetect && CANBUSYDETECT(i)) { - ast_dsp_set_busy_count(tech_pvt->dsp, i->busycount); - ast_dsp_set_busy_pattern(tech_pvt->dsp, i->busy_tonelength, i->busy_quietlength); - } -#endif - } - } - if (profile && profile->faxdetect) { - tech_pvt->faxdetect=1; - } - if (profile && profile->jb_enable) { -#ifdef AST_JB - /* Assign default jb conf to the new zt_pvt */ - memcpy(&tech_pvt->jbconf, &global_jbconf, sizeof(struct ast_jb_conf)); - ast_jb_configure(chan, &tech_pvt->jbconf); -#else - ast_log(LOG_ERROR, "Asterisk Jitter Buffer Not Compiled!\n"); -#endif - } + chan->nativeformats = tech_pvt->coding; + chan->writeformat = chan->rawwriteformat = chan->readformat = tech_pvt->coding; + tech_pvt->frame.subclass = tech_pvt->coding; + + ASTOBJ_CONTAINER_LINK(&private_object_list, tech_pvt); ast_mutex_lock(&usecnt_lock); @@ -2779,7 +2815,7 @@ static struct ast_channel *tech_requester(const char *type, int format, void *da return NULL; } - if ((chan = woomera_new(type, format, data, cause))) { + if ((chan = woomera_new(type, format, data, cause, NULL))) { private_object *tech_pvt; tech_pvt = chan->tech_pvt; @@ -2850,10 +2886,11 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) goto tech_call_failed; } if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH CALL %s (%s <%s>) (%p)\n", + ast_log(LOG_NOTICE, "TECH CALL %s (%s <%s>) pres=0x%02X dest=%s\n", self->name, self->cid.cid_name, self->cid.cid_num, - tech_pvt); + self->cid.cid_pres, + dest); } if (self->cid.cid_name) { strncpy(tech_pvt->cid_name, self->cid.cid_name, sizeof(tech_pvt->cid_name)-1); @@ -2871,7 +2908,11 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) if ((workspace = ast_strdupa(dest))) { char *addr, *profile_name, *proto=NULL; woomera_profile *profile; - int isprofile = 0, err; + int err; + +#if 0 + int isprofile = 0; + if ((addr = strchr(workspace, ':'))) { char *tst; @@ -2885,14 +2926,30 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) proto = NULL; addr = workspace; } - - if ((profile_name = strchr(addr, '*'))) { + + + + + if ((profile_name = strchr(addr, ':'))) { *profile_name = '\0'; profile_name++; isprofile = 1; } else { profile_name = "default"; } +#else + profile_name = "default"; + proto = NULL; + if ((addr = strchr(workspace, ':'))) { + profile_name = workspace; + proto=profile_name; + *addr = '\0'; + addr++; + } else { + addr = workspace; + } + +#endif if (! (profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, profile_name))) { profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, "default"); @@ -2902,7 +2959,7 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) ast_log(LOG_ERROR, "Unable to find profile! Call Aborted!\n"); goto tech_call_failed; } - + if (!ast_test_flag(profile, PFLAG_OUTBOUND)) { ast_log(LOG_ERROR, "This profile is not allowed to make outbound calls! Call Aborted!\n"); goto tech_call_failed; @@ -2924,6 +2981,16 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) snprintf(tech_pvt->dest, sizeof(tech_pvt->dest), "%s", addr ? addr : ""); snprintf(tech_pvt->proto, sizeof(tech_pvt->proto), "%s", proto ? proto : ""); + if (globals.debug > 2) { + ast_log(LOG_NOTICE, "TECH CALL: proto=%s addr=%s profile=%s Coding=%i\n", + proto,addr,profile_name,profile->coding); + } + + tech_pvt->coding = profile->coding; + self->nativeformats = tech_pvt->coding; + self->writeformat = self->rawwriteformat = self->readformat = tech_pvt->coding; + tech_pvt->frame.subclass = tech_pvt->coding; + tech_pvt->timeout = timeout; err=tech_init(tech_pvt, profile, TFLAG_OUTBOUND); if (err) { @@ -3149,6 +3216,7 @@ static struct ast_frame *tech_read(struct ast_channel *self) { private_object *tech_pvt = self->tech_pvt; int res = 0; + struct ast_frame *f; if (!tech_pvt || globals.panic || ast_test_flag(tech_pvt, TFLAG_ABORT)) { @@ -3172,34 +3240,46 @@ tech_read_again: return NULL; } - tech_pvt->frame.datalen = res; - if (tech_pvt->coding == AST_FORMAT_SLINEAR) { - tech_pvt->frame.samples = res / 2; - } else { - tech_pvt->frame.samples = res; - } - tech_pvt->frame.data = tech_pvt->fdata + AST_FRIENDLY_OFFSET; + tech_pvt->frame.frametype = AST_FRAME_VOICE; + tech_pvt->frame.subclass = tech_pvt->coding; + tech_pvt->frame.offset = AST_FRIENDLY_OFFSET; + tech_pvt->frame.datalen = res; + tech_pvt->frame.samples = res; + tech_pvt->frame.data = tech_pvt->fdata + AST_FRIENDLY_OFFSET; - if (default_profile.rxgain_val) { + f=&tech_pvt->frame; + + if (tech_pvt->profile->rxgain_val) { int i; unsigned char *data=tech_pvt->frame.data; for (i=0;iframe.datalen;i++) { - data[i]=default_profile.rxgain[data[i]]; + data[i]=tech_pvt->profile->rxgain[data[i]]; } } - - if (tech_pvt->faxdetect || tech_pvt->ast_dsp ) { - woomera_tx2ast_frm(tech_pvt, tech_pvt->frame.data, tech_pvt->frame.datalen); + + if (tech_pvt->owner && (tech_pvt->faxdetect || tech_pvt->ast_dsp)) { + f = ast_dsp_process(tech_pvt->owner, tech_pvt->dsp, &tech_pvt->frame); + if (f && f->frametype == AST_FRAME_DTMF){ + if (globals.debug > 2) { + ast_log(LOG_NOTICE, "%s: Detected inband DTMF digit: %c\n", + self->name, + f->subclass); + } + } + + //woomera_tx2ast_frm(tech_pvt, tech_pvt->frame.data, tech_pvt->frame.datalen); } if (globals.debug > 4) { if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++READ %s %d\n",self->name, res); + ast_verbose(WOOMERA_DEBUG_PREFIX "+++READ %s %d coding %d\n",self->name, res, + tech_pvt->coding); } } - return &tech_pvt->frame; + + return f; } /*--- tech_write: Write an audio frame to my channel @@ -3220,10 +3300,10 @@ static int tech_write(struct ast_channel *self, struct ast_frame *frame) if(ast_test_flag(tech_pvt, TFLAG_MEDIA) && frame->datalen) { if (frame->frametype == AST_FRAME_VOICE) { - if (default_profile.txgain_val) { + if (tech_pvt->profile->txgain_val) { unsigned char *data=frame->data; for (i=0;idatalen;i++) { - data[i]=default_profile.txgain[data[i]]; + data[i]=tech_pvt->profile->txgain[data[i]]; } } @@ -3237,6 +3317,8 @@ static int tech_write(struct ast_channel *self, struct ast_frame *frame) ast_verbose(WOOMERA_DEBUG_PREFIX "+++WRITE %s %d\n",self->name, i); } } + + } else { ast_log(LOG_WARNING, "Invalid frame type %d sent\n", frame->frametype); } @@ -3405,79 +3487,111 @@ static enum ast_bridge_result tech_bridge(struct ast_channel *c0, struct ast_cha static int woomera_cli(int fd, int argc, char *argv[]) { - if (argc > 1) { + struct woomera_profile *profile; + char *profile_name="default"; + + if (argc > 2) { + + profile_name=argv[1]; + profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, profile_name); + if (!profile) { + ast_cli(fd, "Woomera: Invalid profile name %s\n", profile_name); + return 0; + } - if (!strcmp(argv[1], "debug")) { - if (argc > 2) { - globals.debug = atoi(argv[2]); + if (!strcmp(argv[2], "debug")) { + if (argc > 3) { + globals.debug = atoi(argv[3]); } ast_cli(fd, "Woomera debug=%d\n", globals.debug); - - } else if (!strcmp(argv[1], "call_status")) { - - ast_cli(fd, "Woomera calls=%d tcalls=%d (out=%d in=%d ok=%d end=%d abort=%d)\n", - default_profile.call_count, - default_profile.call_out+default_profile.call_in, - default_profile.call_out, - default_profile.call_in, - default_profile.call_ok, - default_profile.call_end, - default_profile.call_abort); - } else if (!strcmp(argv[1], "version")) { + + } else if (!strcmp(argv[2], "coding")) { + + switch (profile->coding) { + case AST_FORMAT_ALAW: + ast_cli(fd, " Woomera {%s} coding=ALAW\n",profile_name); + break; + case AST_FORMAT_ULAW: + ast_cli(fd, " Woomera {%s} coding=ULAW\n",profile_name); + break; + case AST_FORMAT_SLINEAR: + ast_cli(fd, " Woomera {%s} coding=PMC-16\n",profile_name); + break; + default: + ast_cli(fd, " Woomera {%s} invalid coding=%d {internal error}", + profile_name,profile->coding); + break; + + } + + } else if (!strcmp(argv[2], "call_status")) { + + ast_cli(fd, "Woomera {%s} calls=%d tcalls=%d (out=%d in=%d ok=%d end=%d abort=%d)\n", + profile->name, + profile->call_count, + profile->call_out+profile->call_in, + profile->call_out, + profile->call_in, + profile->call_ok, + profile->call_end, + profile->call_abort); + + } else if (!strcmp(argv[2], "version")) { ast_cli(fd, "Woomera version %s : SMG Version %s \n", WOOMERA_VERSION,smgversion); - } else if (!strcmp(argv[1], "panic")) { - if (argc > 2) { - globals.panic = atoi(argv[2]); + } else if (!strcmp(argv[2], "panic")) { + if (argc > 3) { + globals.panic = atoi(argv[3]); } ast_cli(fd, "Woomera panic=%d \n", globals.panic); - } else if (!strcmp(argv[1], "rxgain")) { + } else if (!strcmp(argv[2], "rxgain")) { float gain; - if (argc > 2) { - if (sscanf(argv[2], "%f", &gain) != 1) { - ast_cli(fd, "Woomera Invalid rxgain: %s\n",argv[2]); + if (argc > 3) { + if (sscanf(argv[3], "%f", &gain) != 1) { + ast_cli(fd, "Woomera Invalid rxgain: %s\n",argv[3]); } else { - woomera_config_gain(&default_profile,gain,1); + woomera_config_gain(profile,gain,1); } } - ast_cli(fd, "Woomera rxgain: %f\n",default_profile.rxgain_val); + ast_cli(fd, "Woomera {%s} rxgain: %f\n",profile_name,profile->rxgain_val); - } else if (!strcmp(argv[1], "txgain")) { + } else if (!strcmp(argv[2], "txgain")) { float gain; - if (argc > 2) { - if (sscanf(argv[2], "%f", &gain) != 1) { - ast_cli(fd, "Woomera Invalid txgain: %s\n",argv[2]); + if (argc > 3) { + if (sscanf(argv[3], "%f", &gain) != 1) { + ast_cli(fd, "Woomera Invalid txgain: %s\n",argv[3]); } else { - woomera_config_gain(&default_profile,gain,0); + woomera_config_gain(profile,gain,0); } } - ast_cli(fd, "Woomera txgain: %f\n",default_profile.txgain_val); + ast_cli(fd, "Woomera {%s} txgain: %f\n",profile_name,profile->txgain_val); - } else if (!strcmp(argv[1], "threads")) { - ast_cli(fd, "chan_woomera is using %s threads!\n", globals.more_threads ? "more" : "less"); + } else if (!strcmp(argv[2], "threads")) { + ast_cli(fd, "chan_woomera is using %s threads!\n", + globals.more_threads ? "more" : "less"); - } else if (!strcmp(argv[1], "smgdebug")) { + } else if (!strcmp(argv[2], "smgdebug")) { if (argc > 2) { int smgdebug; - if (sscanf(argv[2], "%d", &smgdebug) != 1) { - ast_cli(fd, "Woomera Invalid smgdebug level: %s\n",argv[2]); + if (sscanf(argv[3], "%d", &smgdebug) != 1) { + ast_cli(fd, "Woomera Invalid smgdebug level: %s\n",argv[3]); } else { - woomera_printf(NULL, default_profile.woomera_socket , "debug %d%s", + woomera_printf(NULL, profile->woomera_socket , "debug %d%s", smgdebug, WOOMERA_RECORD_SEPARATOR); } } - } else if (!strcmp(argv[1], "abort")) { + } else if (!strcmp(argv[2], "abort")) { global_set_flag(TFLAG_ABORT); } } else { - ast_cli(fd, "Usage: woomera \n"); + ast_cli(fd, "Usage: woomera