Wanpipe How To

    1. How to reduce load by 70% (DAHDI Chunk size)
    2. How to take an audio recording from the hardware echo canceller
    3. How to know if the hardware echo canceller is being used
    4. How to know if the hardware echo canceller is being disabled during a fax

     


     

    How to reduce load by 70% (DAHDI Chunk size

    The following applies only for the following requirements:

    -> using Dahdi or Zaptel with Sangoma T1/E1 PRI Cards
    -> Sangoma Card MUST have Hardware Echo Cancellation, in order to be able to adjust dahdi chunk size
    -> Not supported for Analog and T1/E1 E&M because Dahdi/zaptel hard code 8byte chunk size for Analog/RBS
        timing code

    By default Zaptel/Dahdi runs with 8 byte chunk size.  This equates to 1ms interrupt on TDM hardware! This causes congestion on the PCI bus and overal creates a bottle neck.

    The default 8byte chunk size exists because of the constraints of running software based echo cancellation that was originally designed into the dahdi/zaptel driver.  Since Sangoma Hardware introduces Hardware based Echo cancellation, this limitation is eliminated.

    Sangoma hardware is able to automatically detect Dahdi/zaptel chunk size and adjust it accordingly.

    One can configure Zaptel/Dahdi for 8bytes (1ms - default)- 16bytes (2ms) -  40byte (5ms)  or 80byte (10ms) chunk size.  This would drastically reduce number of hardware interrupts on your system and context switches (changes  from user space to kernel space).  Interrupts have to be handled whether calls are up or not, while context switching load depends on the number of active calls. and allow you to scale better with large number of ports.

    To configure Dahdi/zaptel for higher chunk size

    Zaptel ==>

    ./Setup install --zap-chunk=<CHUNK SIZE>

    Dahdi ==>

     ./Setup install --dahdi-chunk=<CHUNK SIZE>
    Where CHUNK SIZE:  8, 16 , 40 or 80
    Setup will patch Zaptel/Dahdi source for selected chunk size and will remove wct4xxx (digium) driver out of zaptel Makefile.  Reason for this is that digium wct4xxx driver does not support any chunk size other than 8bytes (1ms).
    Chunk size =40 is the maximum that gives reliable timing for meetme and music on hold.  However, if you want to go to the maximum (chunk size=80), the cards have alternate timer that can be used for meetme synchronization


    Once Setup recompiles Dahdi/zaptel and wanpipe drivers.  There are no other configuration needed!  Just start wanpipe and Dahdi/zaptel and Asterisk:

    wanrouter start
    dahdi_cfg -vvv / ztcfg -vvv
    asterisk
    asterisk -r

     In order to confirm that you are running with new Dahdi/zaptel chunk size.  run:

    ifconfig w1g1


    -> confirm that MTU = configured chunk size  (8, 16, 40, 80) 

     


     

    How to take an audio recording from the hardware echo canceller 

     

     Follow the instructions below how to take a binary audio recording from the Echo cancellor chip, if you are experiencing these symptoms:
    -> Echo/noise
    -> DTMF issues
    -> one-way audio issues


    The hardware echo canceler chip has a debug feature which will capture chip debug data during active calls. The captured debug binary file can be sent to Sangoma for further processing and analysis.

    Below is a block diagram of how the audio is processed during a call (rx and tx read and write)


    binary_recording.jpg


    Sangoma Support will analyze the Rin/Rout, Sin/Sout audio streams from the binary recording
    * Note: if using FreeSWITCH, make sure to use the CLI command: "ftdm trace" to take audio recording from Freetdm point of view, to compare the Tx and Rx audio from FreeSWITCH with that of the hardware echo canceller

      *Note: In combination with this recording, you may wish to also run dahdi_monitor (at the same time) to take an audio from the dahdi layer (just below Asterisk in above diagram) to get a full picture of audio flow.  Diagnosis is much quicker by doing both.


    Before proceeding you should also confirm that Is my Hardware echo canceller running (for Asterisk)?    

    1. Establish a call that has an echo, noise, dtmf, or one-way audio problem  
    2. Determine the call channel number by running "show channels" on Asterisk/FreeSWITCH CLI:      

      *CLI> core show channels
       
    3. Start an audio recording on that channel (15 sec recording)

      wan_ec_client wanpipe1 monitor <channel number>
       
           
            Where <channel number> is a channel number obtained in step 2.  
            The wan_ec_client will write a binary file in your local directory.  
       
    4.  To record for 2 minutes run:

      wan_ec_client wanpipe1 monitor120 <channel number>


            Where <channel number> is a channel number obtained in step 2.  
            The wan_ec_client will write a binary file in your local directory.

         6.  Send the binary file back to support@sangoma.com

     

     


     

    How to know if the hardware echo canceller is being used

     

    1. Verify that your Sangoma card has hardware echo cancellation
      -> type:
      wanrouter hwprobe


      at the end of the output if you see:
      HWEC=0  <---no hardware echo cancellor
      HWEC= <anything not 0>    <---you have hardware echo cancellation

      Example of "wanrouter hwprobe" for card with Hardware echo cancellation:
      -------------------------------
      | Wanpipe Hardware Probe Info |
      -------------------------------
      1 . AFT-A108-SH : SLOT=1 : BUS=5 : IRQ=17 : CPU=A : PORT=1 : HWEC=256 : V=43
      2 . AFT-A108-SH : SLOT=1 : BUS=5 : IRQ=17 : CPU=A : PORT=2 : HWEC=256 : V=43
      3 . AFT-A108-SH : SLOT=1 : BUS=5 : IRQ=17 : CPU=A : PORT=3 : HWEC=256 : V=43
      4 . AFT-A108-SH : SLOT=1 : BUS=5 : IRQ=17 : CPU=A : PORT=4 : HWEC=256 : V=43

    2. type: wanpipemon -i wXg1 -c ehw   (where X=1,2,3..for interface. ie w1g1)

      If your hardware echo cancellor is activated and being used, the output should show the following for all your channels:

      # wanpipemon -i w1g1 -c ehw

      Sangoma HW Echo Canceller is enabled for channel 2
      Sangoma HW Echo Canceller is enabled for channel 3
      Sangoma HW Echo Canceller is enabled for channel 4
      .....

      If your Sangoma card DOES have hardware echo cancellation and you see:

                 Sangoma HW Echo Canceller is disabled for all channels!

    This means hardware echo cancellation is disabled, not used
    so,
    -> vi /etc/wanpipe/wanpipeX.conf   (replace X with 1,2,3,4...)
    -> verify near the end of each file TDMV_HWEC= YES:
         [w1g1]
         ACTIVE_CH       = ALL
         TDMV_HWEC       = YES
         MTU             = 8

    -> If TDMV_HWEC=NO, change to YES, then restart wanpipe, "wanrouter restart" (make sure Asterisk/FreeSWITCH is stopped first)
    -> If TDMV_HWEC=YES and you still have this issue, restart wanpipe:
        -> wanrouter restart   (make sure Asterisk/FreeSWITCH is stopped first)
    -> run wanpipemon -i wXg1 -c ehw again and see if issue is resolved
        -> if issue not resolved, please contact Sangoma Technical Support
       

    For Customers using Asterisk and Dahdi:
    -> If wanpipemon -i wXg1 -c ehw indicates echo cancellation is enabled, Dahdi software echo cancellation is NOT used. Disregard the MG2/OSLEC information in /etc/dahdi/system.conf:

           #Sangoma A104 port 1 [slot:1 bus:7 span:1] <wanpipe1>
             span=1,1,0,esf,b8zs
             bchan=1-23
             echocanceller=mg2,1-23
             hardhdlc=24

    Dahdi software echo cancellation is only enabled if Sangoma Hardware echo cancellation is disabled/not present.  Asterisk/Dahdi checks to see if Sangoma card has hardware echo cancellation.  If it does, Asterisk/Dahdi uses Hardware echo cancellation and disabled software echo cancellation.  It cannot run both hardware and software echo cancellation at the same time. 

    A further check to verify software echo cancellation is not being used:

    -> During a call (with wanrouter started of course), run the following command:
        -> lsdahdi

    The above command will indicate the live status of Dahdi's software echo cancellation for each channel
    The following is an example of "lsdahdi" during a call for a Sangoma card WITH hardware echo cancellation enabled:

    ## Span  1: WPT1/0 "wanpipe1 card 0" B8ZS/ESF
      1 PRI        Clear       (In use) (EC: MG2 - INACTIVE)
      2 PRI        Clear       (In use) (EC: MG2 - INACTIVE)
      3 PRI        Clear       (In use) (EC: MG2 - INACTIVE)
      4 PRI        Clear       (In use) (EC: MG2 - INACTIVE)

    If software echo cancellation was enabled and being used instead of Hardware echo cancellation, the above output would have indicated:
    -> (EC: MG2 - ACTIVE)

     


     How to know if the hardware echo canceller is being disabled during a fax


    To check if the EC is turning its self off during a fax or data call you can run the command below. Replace "X" with the wanpipe number and "Y" with the channel relative to the span. This command will give you full details from the DSP about the specified channel. To see if the EC is being disabled run the command during a fax and you should see "Tone Disabler Status" set to "Disabled". If you see "Tone Disabler Status" set to "Enabled" then this means the EC is currently attempting to remove echo from the channel. 

    wan_ec_client wanpipeX stats Y 

    eg. root@localhost ~]# wan_ec_client wanpipe1 stats 1

    wanpipe1: Running Get stats command to Echo Canceller device... Done!

    wanpipe1: 1: Echo Channel Operation Mode : NORMAL
    wanpipe1: 1: Enable Tone Disabler : TRUE
    wanpipe1: 1: Mute Ports : NONE
    wanpipe1: 1: Enable Extended Tone Detection : FALSE
    wanpipe1: 1: Tone Disabler Status : Enabled
    wanpipe1: 1: Voice activity is detected on SIN port : FALSE
    wanpipe1: 1: Echo canceller has detected and converged : FALSE
    wanpipe1: 1: Average power of signal level on RIN : -57 dBm0
    wanpipe1: 1: Average power of signal level on SIN : -66 dBm0
    wanpipe1: 1: Current gain applied to signal level on RIN : 0 dB
    wanpipe1: 1: Current gain applied to signal level on SOUT : 0 dB
    wanpipe1: 1: Average power of the comfort noise injected : -63 dBm0
    wanpipe1: 1: (TDM) PCM Law type on SIN : ALAW
    wanpipe1: 1: (TDM) TDM timeslot on SIN port : 0
    wanpipe1: 1: (TDM) TDM stream on SIN port : 6
    wanpipe1: 1: (TDM) PCM Law type on RIN : ALAW
    wanpipe1: 1: (TDM) TDM timeslot on RIN port : 0
    wanpipe1: 1: (TDM) TDM stream on RIN port : 4
    wanpipe1: 1: (TDM) PCM Law type on SOUT : ALAW
    wanpipe1: 1: (TDM) TDM timeslot on SOUT port : 0
    wanpipe1: 1: (TDM) TDM stream on SOUT port : 7
    wanpipe1: 1: (TDM) PCM Law type on ROUT : ALAW
    wanpipe1: 1: (TDM) TDM timeslot on ROUT port : 0
    wanpipe1: 1: (TDM) TDM stream on ROUT port : 5
    wanpipe1: 1: (VQE) NLP status : TRUE
    wanpipe1: 1: (VQE) Tail Displacement Status : FALSE
    wanpipe1: 1: (VQE) Tail Displacement (ms) : 0
    wanpipe1: 1: (VQE) Tail Length (ms) : 128
    wanpipe1: 1: (VQE) Comfort noise mode : NORMAL
    wanpipe1: 1: (VQE) Acoustic Echo : FALSE
    wanpipe1: 1: (VQE) Out Automatic Level Control : FALSE
    wanpipe1: 1: (VQE) Out Automatic Level Control Target : -20 dB
    wanpipe1: 1: (VQE) In Automatic Level Control : FALSE
    wanpipe1: 1: (VQE) In Automatic Level Control Target : -20 dB
    wanpipe1: 1: (VQE) Noise Reduction : FALSE
    wanpipe1: 1: (VQE) Tone Removal : FALSE
    wanpipe1: 1: (VQE) Activation Delay (ms) : 1836