[Pkg-voip-commits] r1750 - zaptel/trunk/debian
Tzafrir Cohen
tzafrir-guest at costa.debian.org
Tue May 9 17:37:12 UTC 2006
Author: tzafrir-guest
Date: 2006-05-09 17:37:11 +0000 (Tue, 09 May 2006)
New Revision: 1750
Modified:
zaptel/trunk/debian/changelog
zaptel/trunk/debian/genzaptelconf
zaptel/trunk/debian/modulestest
zaptel/trunk/debian/zaptel.init
Log:
* genzaptelconf: 0.5.1 (does not require restart of asterisk)
* zaptel.init: 'unload' operation. Better support for Astribank
* moduletest script fixes
Modified: zaptel/trunk/debian/changelog
===================================================================
--- zaptel/trunk/debian/changelog 2006-05-09 05:19:27 UTC (rev 1749)
+++ zaptel/trunk/debian/changelog 2006-05-09 17:37:11 UTC (rev 1750)
@@ -9,9 +9,12 @@
upstream for next release.
[ Tzafrir Cohen ]
- * bristuff: 0.3.0-PRE1o
+ * bristuff: 0.3.0-PRE1o [TODO: package 1p]
* We have another ZapBRI module: ztgsm
* Experimental support in genzaptelconf for ztgsm (from sample files)
+ * genzaptelconf: 0.5.1 (does not require restart of asterisk)
+ * zaptel.init: 'unload' operation. Better support for Astribank
+ * moduletest script fixes
-- Tzafrir Cohen <tzafrir.cohen at xorcom.com> Mon, 8 May 2006 08:07:38 +0300
Modified: zaptel/trunk/debian/genzaptelconf
===================================================================
--- zaptel/trunk/debian/genzaptelconf 2006-05-09 05:19:27 UTC (rev 1749)
+++ zaptel/trunk/debian/genzaptelconf 2006-05-09 17:37:11 UTC (rev 1750)
@@ -36,6 +36,15 @@
# TODO: either ditch them or convert to perl
# Don't override variables here. Override them in /etc/default/zaptel
#
+# 0.5.1:
+# * Initial support for ztgsm (Junghanns's PCI GSM card)
+# 0.5.0:
+# * Not trying to read from zaptel channels: we can run genzaptelconf even
+# with asterisk up.
+# * Don't add ztdummy to the list of detected modules
+# 0.4.4:
+# * remove ztdummy when rewriting modules file
+# * Better ISDN PRI behaviour in Israel (il)
# 0.4.3:
# * Added -F: to disable writing about FXS ports in zapata.conf
# * if we have an astribank: start zaptel rather than simple ztcfg (xpd sync)
@@ -46,8 +55,8 @@
# * hence we can reduce the list of modules
# /etc/default/zaptel may override the following variables
-VERSION=0.4.3
-VERSION_FULL="$VERSION $Id: genzaptelconf 130 2006-01-24 13:15:21Z tzafrir $"
+VERSION=0.5.1
+VERSION_FULL="$VERSION $Id: /xorcom/zaptel/trunk/debian/genzaptelconf 292 2006-04-10T13:26:16.840155Z tzafrir $"
lc_country=us
base_exten=6000
# If set: no context changes are made in zapata-channels.conf
@@ -79,10 +88,9 @@
# and deleted in the end on update_extensions_defs
tmp_dir=
-# A list of all modules. This is:
-# - the list of modules which will be unloaded (in this order)
-# - the list of modules which will be probed (in this order)
-#ALL_MODULES="zaphfc qozap wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wct1xxp wct4xxp wcte11xp wcusb ztdynamic ztd_eth ztdummy xpp_usb xpd_fxs xpp"
+# A list of all modules:
+# - the list of modules which will be probed (in this order) if -d is used
+# - The module that will be deleted from /etc/modules , if -d -M is used
ALL_MODULES="zaphfc qozap ztgsm wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wct1xxp wct4xxp wcte11xp wcusb xpp_usb"
# read default configuration from /etc/default/zaptel
@@ -128,7 +136,7 @@
}
update_module_list() {
- del_args=`for i in $ALL_MODULES
+ del_args=`for i in $ALL_MODULES ztdummy
do
echo "$i" | sed s:.\*:-e\ '/^&/d':
done`
@@ -331,13 +339,6 @@
echo "context=$context_phones"
fi
fi
- if [ "$set_immediate" = 'yes' ]
- then
- if [ "$astbank_type" = 'input' ]
- then echo 'immediate=yes'
- else echo 'immediate=no'
- fi
- fi
else # this is an FXO (trunk/phone: FXO signalling)
# we have may have set it. So reset it:
echo "callerid=\"\" <0>"
@@ -366,6 +367,13 @@
fi
fi
+ if [ "$set_immediate" = 'yes' ]
+ then
+ if [ "$astbank_type" = 'input' ]
+ then echo 'immediate=yes'
+ else echo 'immediate=no'
+ fi
+ fi
echo "channel => $chan"
echo ""
@@ -435,7 +443,9 @@
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:
+ # old versions of xpd_fxs actually depend on xpp, but forget to tell it.
+ # bug has already been fixed but the code will remain here for a while
+ # just in case
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:
@@ -469,9 +479,6 @@
# fi
#done
modlist="$(echo $modlist)" # clean spaces
- if [ "$modlist" = '' ]; then
- modlist=ztdummy # Fallback
- fi
if [ "$do_module_list" = yes ]
then
say "Updating '${MODLIST_FILE}'"
@@ -479,6 +486,7 @@
fi
}
+# TODO: kill this function. It is now unreferenced from anywhere.
check_tdm_sigtype() {
chan_num=$1
sig_type=$2
@@ -612,12 +620,23 @@
case "$line" in
*WCTDM/*)
# this can be either FXS or FXO
- check_tdm_sigtype $chan_num fxs $mode || \
- check_tdm_sigtype $chan_num fxo $mode || \
- echo "$rem_char channel $chan_num, WCTDM, inactive."
+ maybe_fxs=0
+ maybe_fxo=0
+ $ztcfg_cmd -c <(print_pattern $chan_num fxo zaptel) &>/dev/null && maybe_fxs=1
+ $ztcfg_cmd -c <(print_pattern $chan_num fxs zaptel) &>/dev/null && maybe_fxo=1
+ if [ $maybe_fxs = 1 ] && [ $maybe_fxo = 1 ]
+ then
+ # An installed module won't accept both FXS and FXO signalling types:
+ # this is an empty slot.
+ echo "$rem_char channel $chan_num, WCTDM, no module."
+ continue
+ fi
+
+ if [ $maybe_fxs = 1 ]; then print_pattern $chan_num fxo $mode; fi
+ if [ $maybe_fxo = 1 ]; then print_pattern $chan_num fxs $mode; fi
;;
*WCFXO/*)
- check_tdm_sigtype $chan_num fxo $mode || \
+ print_pattern $chan_num fxs $mode || \
echo "$rem_char channel $chan_num, WCFXO, inactive."
;;
*XPP_FXO/*)
@@ -660,7 +679,8 @@
echo 'pri_cpe' >$tmp_dir/span_signalling
# an example of country-specific setup. This is probably not accurate
# Contributions are welcome
- case "$lc_country" in nl)
+ case "$lc_country" in
+ nl)
# (Just an example for per-country info)
echo 'ami' >$tmp_dir/span_framing
echo 'ccs' >$tmp_dir/span_coding
@@ -668,6 +688,11 @@
#echo 'euroisdn' >$tmp_dir/span_switchtype
#echo 'pri_cpe' >$tmp_dir/span_signalling
;;
+ il)
+ echo 'hdb3' >$tmp_dir/span_framing
+ echo 'ccs' >$tmp_dir/span_coding
+ echo 'crc4' >$tmp_dir/span_yellow
+ echo 'euroisdn' >$tmp_dir/span_switchtype
esac
;;
esac
@@ -820,7 +845,10 @@
then
/etc/init.d/asterisk stop 1>&2
else
- if pidof asterisk >/dev/null
+ # if asterisk is running and we wanted to detect modules
+ # or simply to unload modules, asterisk needs to go away.
+ if ( [ "$do_unload" = yes ] || [ "$do_detect" = yes ] ) && \
+ pidof asterisk >/dev/null
then
echo >&2 "Asterisk is already running. Configuration left untouched"
echo >&2 "You can use the option -s to shut down Asterisk for the"
Modified: zaptel/trunk/debian/modulestest
===================================================================
--- zaptel/trunk/debian/modulestest 2006-05-09 05:19:27 UTC (rev 1749)
+++ zaptel/trunk/debian/modulestest 2006-05-09 17:37:11 UTC (rev 1750)
@@ -17,6 +17,9 @@
#KERNEL_SOURCES=$HOME/Proj/Debs/Kernel/SwSusp/linux-2.6.15-rc5
KERNEL_HEADERS=
KERNEL_SOURCES=
+# run module-asustant with environment params that will generate
+# .changes files even without signing
+MODASS="env SIGNCHANGES=1 DEBSIGNCOMMAND=not_an_executable m-a"
while getopts ah:s:tx arg
do
@@ -34,7 +37,7 @@
# it (Tzafrir)
for conf in 386 686 686-smp k7 k7-smp
do
- for ver in 2.4.27-2 2.6.8
+ for ver in 2.4.27-2 2.6.8-2
do
KERNEL_HEADERS=$KERNEL_HEADERS,$ver-$conf
done
@@ -74,10 +77,10 @@
rm -f $TOP_DIR/
if [ "$hdrs_sw" != '' ]; then
- TARBALL=$TAR_BALL m-a -u $TOP_DIR -t -i -f $hdrs_sw build $PACKAGE >>$LOG_FILE
+ TARBALL=$TAR_BALL $MODASS -u $TOP_DIR -t -i -f $hdrs_sw build $PACKAGE >>$LOG_FILE
fi
if [ "$srcs_sw" != '' ]; then
- TARBALL=$TAR_BALL m-a -u $TOP_DIR -t -i -f $srcs_sw build $PACKAGE >>$LOG_FILE
+ TARBALL=$TAR_BALL $MODASS -u $TOP_DIR -t -i -f $srcs_sw build $PACKAGE >>$LOG_FILE
fi
ls -l $TOP_DIR/$PACKAGE-modules-*_$TAG_VERSION+*.deb
Modified: zaptel/trunk/debian/zaptel.init
===================================================================
--- zaptel/trunk/debian/zaptel.init 2006-05-09 05:19:27 UTC (rev 1749)
+++ zaptel/trunk/debian/zaptel.init 2006-05-09 17:37:11 UTC (rev 1750)
@@ -12,22 +12,68 @@
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 cards initial configuration"
-test -x $DAEMON || exit 0
-test -r /etc/zaptel.conf || exit 0
-
# Include am defaults if available
if [ -f /etc/default/zaptel ] ; then
. /etc/default/zaptel
fi
+test -x $DAEMON || exit 0
+test -r "$ZAPCONF_FILE" || exit 0
+
+
# defined in /etc/default/zaptel
# ZAPTEL_MODS is a list of modules to be loaded at startup
set -e
+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:
+ bus=`awk -F: '/STATUS=connected/{print $1}' /proc/xpp/xbuses | head -n 1 | cut -d- -f2`
+ 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
+}
case "$1" in
start|reload)
echo -n "$DESC: "
@@ -35,6 +81,7 @@
#do
# modprobe $module
#done
+ fix_asterisbank_sync
# If there is no zaptel timing source, load
# ztdummy. Other modules should have been loaded by
@@ -53,6 +100,9 @@
stop)
: # do nothing
;;
+ unload)
+ unload_module zaptel
+ ;;
force-reload|restart)
# there's no 'stop'
$0 start
More information about the Pkg-voip-commits
mailing list