Xorcom Astribank 24 and Sangoma A104dx - I AM GOING INSANE!

Can anybody help?

The sangoma card is working flawlessly, and the wanpipe drivers run before Zaptel.

My client asked me to set them up with 8 FXS and 16 FXO ports. After reading the reviews, I bought a Xorcom Astribank.

I can see in /proc/xpp/ there are 3 spans getting detected, which makes sense…

But when I configure them in zaptel.conf like so:

[size=75]#Sangoma A104 port 1 [slot:4 bus:8 span: 1]
span=1,0,0,d4,ami
e&m=1-24

#Sangoma A104 port 2 [slot:4 bus:8 span: 2]
span=2,0,0,d4,ami
e&m=25-48

#Sangoma A104 port 3 [slot:4 bus:8 span: 3]
span=3,0,0,d4,ami
e&m=49-72

#Sangoma A104 port 4 [slot:4 bus:8 span: 4]
span=4,0,0,d4,ami
e&m=73-96

#Xorcom Astribank - 8 FXS + 5 Data Ports span 5
fxoks=97-110

#Xorcom Astribank - 8 FXO span 6
fxsks=111-118

#Xorcom Astribank - 8 FXO span 7
fxsks=119-126
[/size]
[size=100]

Zttool’s output shows the Sangoma spans appropriately, and Xorcom’s 1st and second span. The third span (7) doesn’t show up at all.

ztcfg -d shows this:
[/size]

[size=75]
Line 4: loadzone=us
Line 5: defaultzone=us
Line 8: span=1,0,0,d4,ami
Line 9: e&m=1-24
Line 12: span=2,0,0,d4,ami
Line 13: e&m=25-48
Line 16: span=3,0,0,d4,ami
Line 17: e&m=49-72
Line 20: span=4,0,0,d4,ami
Line 21: e&m=73-96
Line 23: fxoks=97-110
Line 24: fxsks=111-118
Line 25: fxsks=119-126

ZT_CHANCONFIG failed on channel 119: Invalid argument (22)
Did you forget that FXS interfaces are configured with FXO signalling
and that FXO interfaces use FXS signalling?
[/size]
[size=100]
No, I didn’t forget…the span isn’t registering! I’d try re-compiling zaptel but I’m concerned that sangoma’s wanrouter/wanpipe drivers are going to have to get recompiled and that this will bring me back to square 1.

I tried Xorcom’s live CD in a system without the Sangoma hardware and the cd detected and registered the Astribank spans properly.

I’ve been fighting with this for days now…any suggestions would be appreciated.
[/size]

What is the output of:

zaptel_hardware

Thanks for helping with this! Here’s the output:

usb:006/002 e4e4:1152 [xpp_usb] (usb-0000:00:1d.7-5)
XBUS-00/XPD-00: FXS Span 5 XPP-SYNC
XBUS-00/XPD-10: FXO Span 6
XBUS-00/XPD-20: FXO Unregistered

The sangoma card does not appear there . What is its vendor ID / product ID is missing from Zaptel/Hardware/PCI.pm . What are the vendor/product ID of your Sangoma card?

Anyway, it appears that only the first two spans are registered, and not the third one.
It probably means that ‘zt_registration on’ was not run after ‘cat /proc/xpp/XBUS-*/waitfor_xpds’

What zaptel init.d script do you use?

cat /etc/init.d/zaptel
#! /bin/sh

skeleton example file to build /etc/init.d/ scripts.

This file should be used to construct scripts for /etc/init.d.

Written by Miquel van Smoorenburg miquels@cistron.nl.

Modified for Debian

by Ian Murdock imurdock@gnu.ai.mit.edu.

Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/sbin/ztcfg
ZAPCONF_FILE=/etc/zaptel.conf
NAME=zaptel
DESC="Zaptel telephony kernel driver"
FXOTUNE=/usr/sbin/fxotune

Include am defaults if available

if [ -f /etc/default/zaptel ] ; then
. /etc/default/zaptel
fi

if [ ! -x $DAEMON ] ; then
echo >&2 $NAME “:” $DAEMON “fails test for exists and executable” ;
exit 0
fi

if [ ! -f $ZAPCONF_FILE ] ; then
echo >&2 $NAME “:” $ZAPCONF_FILE “fails test for exists and readable”;
exit 0
fi

defined in /etc/default/zaptel

ZAPTEL_MODS is a list of modules to be loaded at startup

set -e

zap_reg_xpp() {
if [ ! -d /proc/xpp ]; then return; fi

    # Get a list of connected Astribank devices, sorted by the name of
    # the USB connector. That order is rather arbitrary, but will not
    # change without changes to the cabling.
    xbusses=`sort -k 2 /proc/xpp/xbuses | awk -F: '/STATUS=connected/ {print $1}'`

    # get a list of XPDs that were not yet registered as zaptel spans.
    # this will be the case if you set the parameter zap_autoreg=0 to
    # the module xpp
    # Append /dev/null to provide a valid file name in case of an empty pattern.
    xbusses_pattern=`echo $xbusses| sed -e 's|XBUS-[0-9]*|/proc/xpp/&/XPD-*/zt_registration|g'`' /dev/null'
    xpds_to_register=`grep -l 0 $xbusses_pattern 2>/dev/null` || true
    for file in $xpds_to_register; do
            echo 1 >$file
    done

}

fix_asterisbank_sync() {
# do nothing if module not present
if [ ! -d /proc/xpp ]; then return; fi

    #if ! grep -q '^HOST' /proc/xpp/sync 2>/dev/null; then return; fi

    case "$XPP_SYNC" in
    n*|N*) return;;
    host|HOST) sync_value="HOST";;
    [0-9]*)sync_value="$XPP_SYNC";;
    *)
      # find the number of the first bus, and sync from it:
      fxo_pat=`awk -F: '/STATUS=connected/{print $1}' /proc/xpp/xbuses | sed -e 's|.*|/proc/xpp/&/*/fxo_info|'`
      # find the first FXO unit, and set it as the sync master
      bus=`ls -1 $fxo_pat 2> /dev/null | head -n1 | cut -d- -f2 | cut -d/ -f1`

      # do nothing if there is no bus:
      case "$bus" in [0-9]*):;; *) return;; esac
      sync_value="$bus 0"
      ;;
    esac
    # the built-in echo of bash fails to print a proper error on failure
    if ! /bin/echo "$sync_value" >/proc/xpp/sync
    then
      echo >&2 "Updating XPP sync source failed (used XPP_SYNC='$XPP_SYNC')"
    fi

}

recursively unload a module and its dependencies, if possible.

where’s modprobe -r when you need it?

inputs: module to unload.

unload_module() {
set +e
module="$1"
line=lsmod 2>/dev/null | grep "^$module "
if [ “$line” = ‘’ ]; then return; fi # module was not loaded

    set -- $line
    # $1: the original module, $2: size, $3: refcount, $4: deps list
    mods=`echo $4 | tr , ' '`
    # xpd_fxs actually sort of depends on xpp:
    case "$module" in xpd_*) mods="xpp_usb $mods";; esac
    for mod in $mods; do
            # run in a subshell, so it won't step over our vars:
            (unload_module $mod)
    done
    rmmod $module || true
    set -e

}

sleep a while until the xpp modules fully register

wait_for_xpp() {
if [ -d /proc/xpp ] &&
[ “cat /sys/module/xpp/parameters/zap_autoreg” = ‘Y’ ]
then
# wait for the XPDs to register:
# TODO: improve error reporting and produce a messagee here
cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true
fi
}

case “$1” in
start|reload)
echo -n "$DESC: "
#for module in $ZAPTEL_MODS
#do
# modprobe $module
#done
wait_for_xpp
zap_reg_xpp
fix_asterisbank_sync

            # If there is no zaptel timing source, load
            # ztdummy. Other modules should have been loaded by
            # now.
            if ! head -c 0 /dev/zap/pseudo 2>/dev/null
            then modprobe ztdummy || true # will fail if there is no module package
            fi
            if [ -r /etc/fxotune.conf ] && [ -x $FXOTUNE ]; then
              $FXOTUNE -s
            fi

            # configure existing modules:
            $DAEMON $DAEMON_OPTS || echo -n $DAEMON "failed. Check" $ZAPCONF_FILE
            echo "$NAME."
            ;;
    stop)
            : # do nothing
            ;;
    unload)
            unload_module zaptel
            ;;
    force-reload|restart)
            # there's no 'stop'
            $0 start
            ;;

*)
N=/etc/init.d/$NAME
# echo “Usage: $N {start|stop|restart|reload|force-reload}” >&2
echo “Usage: $N {start|stop|restart|force-reload}” >&2
exit 1
;;
esac

exit 0

Any suggestions on the init.d script?