From 4ffddec27088284c2cfaf7ce8fa8d3fe06b2a7b4 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Mon, 4 Sep 2006 22:25:56 +0000 Subject: genzaptelconf: handle the case of zap_autoreg=0 (FIXME: code copied from zaptel.init) git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1384 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- xpp/utils/genzaptelconf | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xpp/utils/genzaptelconf b/xpp/utils/genzaptelconf index 52d42bc..8dbf78c 100755 --- a/xpp/utils/genzaptelconf +++ b/xpp/utils/genzaptelconf @@ -279,6 +279,28 @@ update_extensions_defs() { if [ -d "$tmp_dir" ]; then rm -rf "$tmp_dir"; fi } + + +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` + for file in $xpds_to_register; do + echo 1 >$file + done +} + + check_for_astribank(){ if ! grep -q XPP_IN/ /proc/zaptel/* 2>/dev/null then @@ -986,6 +1008,7 @@ fi if [ "$mode" = list ]; then genconf list else + zap_reg_xpp check_for_astribank get_rapid_extens say "Generating '${ZAPCONF_FILE}'" -- cgit v1.2.3