Operation

    1. Wanpipe, Zaptel/Dahdi and Asterisk (Manual Start/Stop)
    2. WAN Router Commands
    3. WANPIPE Environment Check 
    4. WANPIPE Startup
    5. Auto-Start Zaptel after Wanpipe 
    6. Line Debugging 
    7. Line Errors and Driver Statistics 
    8. Wanpipe Power User Operation
    9. Monitoring/Debugging 
    10. Wanpipe Manual Startup
    11. Hardware Echo canceller commands 
    12. Manual Hardware Echo Cancellation

     

    At the heart of WANPIPE operation is the 'wanrouter' operation script.  It is used to start/stop/restart and display WANPIPE current status and environment.

    usage:
                    wanrouter <command>

    Linux paths:
                    Wanpipe configuration directory:         /etc/wanpipe
                    Wanpipe executable/script directory:   /usr/sbin
                    Asterisk configuration directory:           /etc/asterisk
                    Zaptel configuration file:                       /etc/zaptel.conf

     



    Wanpipe, Dahdi and Asterisk (Manual Start/Stop)

    1. To manually stop Wanpipe you must stop Asterisk first
      #> amportal stop 
      #>smg_ctrl stop   (only for A500 BRI users)
      #> wanrouter stop
      #>service dahdi stop 
      ---
    2. To manually start Wanpipe devices, Zaptel and Asterisk run:
      #> wanrouter start
      #>smg_ctrl start    (only for A500 BRI users)
      #> dahdi_cfg   -vvvv     (If you have AFT series T1/E1 or Analog cards)         
      #>safe_asterisk
      #> asterisk  -r ( To connect with Asterisk )

     

    Wanpipe, Zaptel and Asterisk (Manual Start/Stop)

    1. To manually stop Wanpipe you must stop Asterisk first
      #> amportal stop 
      #>smg_ctrl stop   (only for A500 BRI users)
      #> wanrouter stop
      #>service zaptel stop
       ---
    2. To manually start Wanpipe devices, Zaptel and Asterisk run:
      #> wanrouter start
      #>smg_ctrl start    (only for A500 BRI users)
      #> ztcfg   -vvvv     (If you have AFT series T1/E1 or Analog cards)         
      #>safe_asterisk
      #> asterisk  -r ( To connect with Asterisk )
      ---

     

     


    WAN Router Commands

    Usage: wanrouter: {options} <wanpipe#> <interface>

    #>wanrouter start
    :    
    Starts all devices specified in wanrouter.rc WAN_DEVICES

    #>wanrouter stop
      :    
    Stops all devices specified in wanrouter.rc WAN_DEVICES

    #>wanrouter restart :  
    Restart all devices specified in wanrouter.rc WAN_DEVICES

    #>wanrouter start wanpipe# :
    Start a single device

    #>wanrouter stop  wanpipe# :
    Stops a single device
                                     
    #>wanrouter restart wanpipe# :
    Restart a single device                               
                             
    #>wanrouter list :
    List all active devices

    #>wanrouter modules:
    Show wanpipe kernel modules

    #>wanrouter status:
    Display status for all active devices

    #>wanrouter summary:
    Summary of Wanpipe config files

    #>wanrouter hwprobe
    :
    #>wanrouter hwprobe verbose  (for A200/A400 analog  cards to check FXO/FXS modules )

    Display wanpipe hardware probe info.

    #>wanrouter messages:
    Display wanpipe kernel event messages
            i.e. /var/log/messages

    #>wanrouter version:
    wanpipe version information.


    WANPIPE Environment Check

    Make sure that the new WANPIPE kernel modules have been installed correctly, that they can be successfully loaded into the kernel, and that the hardware is properly detected.

    #> wanrouter hwprobe

    Check that a configuration (.conf) file exists in wanpipe configuration directory

    #> wanrouter summary

    Make sure that no WANPIPE devices are currently running on the system

    #> wanrouter list

     


    WANPIPE Startup

    Please note that all kernel driver output messages are located in /var/log/messages file.

    Run 'tail -f /var/log/messages' in a separate console window, to monitor WANPIPE start/stop and operation messages.

    To start/stop/restart WANPIPE devices listed in wanrouter.rc file: (default is wanpipe1)

    #> wanrouter start
    #> wanrouter stop
    #> wanrouter restart

    To start/stop/restart single wanpipe device: (eg: wanpipe2)

    This command is useful when running multiple devices and would like to operate on a singe device.

    #> wanrouter start wanpipe2
    #> wanrouter stop wanpipe2
    #> wanrouter restart wanpipe2

    To view current status and configuration of active devices:

    #> wanrouter status

    Auto-start Zaptel after Wanpipe (Linux)
    You can add a script to auto execute ztcfg (load/configures zaptel) after wanrouter start.

    WANPIPE's "wanrouter" script has the capability to execute an external script after "wanrouter start" command is competed.
     
    The wanrouter looks to /etc/wanpipe/scripts directory for any configured bash scripts. Please see below for a sample file
     
          1) Create a file called "start" (lower case)
     
           #>vi start

    ----------Cut Here----------------
    #!/bin/sh

    #Make sure that udev/devfs zaptel device
    #has come up.
    cnt=0
    max_delay=30
    for ((i=0;i<$max_delay;i++))
    do
        if [ -e /dev/zap ]; then
                break;
        fi

        echo "Waiting for zaptel device /dev/zap ($i/$max_delay)..."
        sleep 2
    done

    if [ ! -e /dev/zap ]; then
        echo
        echo "Error: Zaptel device failed to come up";
        echo "Possible Cause: UDEV not installed!";
        echo
        exit 1
    fi

    sleep 1

    ztcfg -vvvv  

    exit 0
     
    ----------Cut Here----------------

     
          2) Copy the file "start" into /etc/wanpipe/scripts directory (Note: the file doesn't require executive privileges).
     
     The script "start" will execute each time the "wanrouter start" command executes.
     Please Refer to README.external_scripts for more info about wanrouter and external scripts.


    Line Debugging
    See line debugging.


     

    Kernel Driver Errors
    All device driver errors and events will be displayed in:

    #>/var/log/messages

            (eg: tail -f /var/log/messages)


     Wanpipe Power User Operation

    Wanpipe package contents

    1. Wanpipe/Zaptel Kernel Drivers
        The drivers are listed in order of dependency.

            sdladrv.o (sdladrv.ko)          : Hardware Layer under Linux (FreeBSD)
            zaptel.o (zaptel.ko)               : Zaptel Layer under Linux (FreeBSD)
            wanrouter.o (wanrouter.ko)  : Wanpipe Protocol Interface Layer under Linux (FreeBSD)
            wanpipe.o (wanpipe.ko)        : Wanpipe multi-protocol layer under Linux (FreeBSD)

    2. User space programs
    2.1 Configuration
    wancfg
    Wanpipe configuration tool


    2.2 Operation
    wanconfig
    This is a WANPIPE operation tool that parses the config file and executed config ioctl() calls to the kernel driver.
    wanconfig -a /etc/wanpipe/wan_adsl.list card wanpipe1 up                  (Linux)
    wanconfig -a /usr/local/etc/wanpipe/wan_adsl.list card wanpipe1 up    (FreeBSD)

    wanrouter
    Wanpipe operation script used to start/stop/restart Wanpipe drivers.  The wanrouter script uses the above (wanconfig) to start wanpipe as well as standard "ifconfig" to bring all necessary interfaces up.


    Debugging/Monitoring

    wanpipemon
    Wanpipe debugging application used to debug the hardware, drivers and sync line.

    Graphical Mode: wanpipemon -g
    Raw trace: wanpipemon -i <if name> -c tr
    D-Channel trace: wanpipemon -i <if name> -c trd
              (For PRI only)
    Alarms : wanpipemon -i <if name> -c Ta
    Hardware echo canceller monitoring: wanpipemon -i <if name> -c ehw

     


    Wanpipe Manual Startup
    If a power user desn't want to use the wanrouter master script.  Here is the break down of the wanpipe startup sequence:

    wanrouter start

    1. Load Kernel Modules

    Linux:
            #>insmod sdladrv.o
            #>insmod zaptel.o
            #>insmod wanrouter.o
            #>insmod wanpipe.o

        or
            #>modprobe -v wanpipe

    FreeBSD:
            #> kldload sdladrv.ko
            #>
    kldload zaptel.ko
            #>
    kldload wanrouter.ko
            #>
    kldload wanpipe.ko
        or
            #> kldload wanpipe

    2. Configure and Start Drivers

       #> wanconfig card wanpipe1 up

    3. Confirmation

    #>tail -f /var/log/messages

    4. Check the events and driver statistics (Linux).

    #>cat /proc/net/wanrouter/status

    5. Check driver state


    Hardware Echo canceller commands (A104d/A108d/A200d only)

     1. To confirm that the hardware echo canceller is running and active

           #> wanpipemon -i <interface name> -c ehw

           It should say Sangoma HW Echo canceller is active on channel N.
                 Where N is an active channel (i.e there is an established call on it).
           You need TDMV_HWEC = YES in wanpipe*.conf and
           echocancel=yes in zapata.conf to activate the hardware echo canceller.

     


    Manual Hardware Echo Cancellation Configuration

    Currently Asterisk controls echo cancellation!
    The echocancel=yes in zapate.conf is used to enable and disable hardware echo cancellation in hardware on call start and call stop.  In this scenario it is possible to get inital echo for a 1 to 2 seconds until hardware echo canceller completely removes the echo from the call.

    In order to solve this issue on can disable echo cancellation in zapata.conf and manauly enable all sangoma hardawre echo channels to perform echo cancellation ALL THE TIME, whether the call is up or not!

    1. In zapta.conf
      --> set  echocancel=no
      --> set echocancelwhenbridged=no
    2. Configure wanpipe startup script to start echo cancellation on all channels after startup.

      /etc/wanpipe/scripts/start               (Linux)
      /usr/local/etc/wanpipe/scripts/start (FreeBSD)
      -------------cut here-------------------

      #Do not enable hwec on DCHAN
      #Uncoment the lines that apply to your configuration

      #T1 Spans
      wan_ec_client wanpipe1 be 1-23   #for first T1 span
      #wan_ec_client wanpipe2 be 1-23  #for second T1 span
      #wan_ec_client wanpipe3 be 1-23 #for third T1 span

      #E1 Spans
      #wan_ec_client wanpipe1 be 1-15.17-31  #for first E1 span
      #wan_ec_client wanpipe2 be 1-15.17-31  #for second E1 span
      #wan_ec_client wanpipe3 be 1-15.17-31  #for third E1 span

      #One can append the ztcfg startup script here as well !!!

      -------------cut here--------------------

      The Wanpipe startup script will be executed each time the wanrouter start is executed.
    3. Confirm that all hardware echo channels are up!

      wanpipemon -i w1g1 -c ehw   #hwec status on port 1
      wanpipemon -i w2g1 -c ehw   #hwec status on port 2