summaryrefslogtreecommitdiff
path: root/xpp/utils/genzaptelconf
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/utils/genzaptelconf')
-rwxr-xr-xxpp/utils/genzaptelconf152
1 files changed, 81 insertions, 71 deletions
diff --git a/xpp/utils/genzaptelconf b/xpp/utils/genzaptelconf
index daccee8..cf32fcd 100755
--- a/xpp/utils/genzaptelconf
+++ b/xpp/utils/genzaptelconf
@@ -516,9 +516,8 @@ unload_module() {
set -- $line
# $1: the original module, $2: size, $3: refcount, $4: deps list
mods=`echo $4 | tr , ' '`
- # 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
+ # xpp_usb keeps the xpds below busy, and hence must be removed
+ # before them:
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:
@@ -583,7 +582,9 @@ temporary_zapconf() {
save)
say "Temporarily moving zaptel.conf aside to work around broken modprobe.conf"
ZAPCONF_FILE_TMP=`mktemp /tmp/genzaptelconf-zaptel.conf-XXXXXX` || die "Error creating temporary zaptel.conf"
- cp -a $ZAPCONF_FILE_SYSTEM $ZAPCONF_FILE_TMP
+ if [ -f $ZAPCONF_FILE_SYSTEM ]; then
+ cp -a $ZAPCONF_FILE_SYSTEM $ZAPCONF_FILE_TMP
+ fi
echo -n >$ZAPCONF_FILE_SYSTEM
;;
restore)
@@ -643,6 +644,8 @@ gen_tmp_conf() {
# Extract information from one digital channel (one line in a /proc/zaptel
# file). Information is saved to $tmp_dir/span_foo variables.
+# FIXME: detection should move to when we know the number of channels
+# and hence can tell between an E1 and a T1.
detect_digital_channel() {
line="$1"
chan_num="$2"
@@ -653,70 +656,78 @@ detect_digital_channel() {
# them by the channel names. This is shorter.
# This also allows us to count the channel numbers and check if
# we have a E1 span, a T1 span or a BRI span.
- if [ "`cat $tmp_dir/span_begin`" = "-1" ]
+
+ # span_lastd is always the one before last
+ # channel. span_bchan is the last:
+ echo $chan_num >$tmp_dir/span_end
+
+ if [ "`cat $tmp_dir/span_begin`" != "-1" ]
then
- echo $chan_num >$tmp_dir/span_begin
- echo $span_num >$tmp_dir/span_num
- # The Astribank channels provide the information of TE/NT in the channel name. So
- # why not use it?
- case "$line" in
- *XPP_BRI_TE/*) echo 'te' >$tmp_dir/span_termtype;;
- *XPP_BRI_NT/*) echo 'nt' >$tmp_dir/span_termtype;;
- esac
- case "$line" in
- *ZTHFC*/*|*ztqoz*/*|*XPP_BRI_*/*)
- # BRI channel
- echo 'ccs' >$tmp_dir/span_framing
- echo 'euroisdn' >$tmp_dir/span_switchtype
- if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ]
- then
- echo $ZAPBRI_NET >$tmp_dir/span_signalling
- else
- echo $ZAPBRI_CPE >$tmp_dir/span_signalling
- fi
+ return #we already configured this span.
+ fi
+
+ # Now we need to give initial configuration to the span
+ echo $chan_num >$tmp_dir/span_begin
+ echo $span_num >$tmp_dir/span_num
+
+ case "$line" in
+ *ZTHFC*/*|*ztqoz*/*|*XPP_BRI_*/*)
+ # BRI channel
+ echo 'ccs' >$tmp_dir/span_framing
+ echo 'euroisdn' >$tmp_dir/span_switchtype
+ if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ]
+ then
+ echo $ZAPBRI_NET >$tmp_dir/span_signalling
+ else
+ echo $ZAPBRI_CPE >$tmp_dir/span_signalling
+ fi
+ ;;
+ *ztgsm*/*)
+ # Junghanns's GSM cards.
+ echo 'ccs' >$tmp_dir/span_framing
+ #Does this mean anything?
+ echo 'gsm' >$tmp_dir/span_signalling
+ ;;
+ *TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*WP[TE]1/*)
+ # FIXME: handle cwain around here.
+ # name: *cwain[12]/* . Always E1.
+
+ # PRI span (E1/T1)
+ echo 'esf' >$tmp_dir/span_framing
+ echo 'b8zs' >$tmp_dir/span_coding
+ echo 'national' >$tmp_dir/span_switchtype
+ if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ]
+ then
+ echo pri_net >$tmp_dir/span_signalling
+ else
+ echo pri_cpe >$tmp_dir/span_signalling
+ fi
+ # an example of country-specific setup. This is probably not accurate
+ # Contributions are welcome
+ case "$lc_country" in
+ nl)
+ # (Just an example for per-country info)
+ echo 'ccs' >$tmp_dir/span_framing
+ echo 'ami' >$tmp_dir/span_coding
+ #echo 'crc4' >$tmp_dir/span_yellow
+ #echo 'euroisdn' >$tmp_dir/span_switchtype
+ #echo 'pri_cpe' >$tmp_dir/span_signalling
;;
- *ztgsm*/*)
- # Junghanns's GSM cards.
- echo 'ccs' >$tmp_dir/span_framing
- #Does this mean anything?
- echo 'gsm' >$tmp_dir/span_signalling
+ il|de|au)
+ echo 'ccs' >$tmp_dir/span_framing
+ echo 'hdb3' >$tmp_dir/span_coding
+ echo 'crc4' >$tmp_dir/span_yellow
+ echo 'euroisdn' >$tmp_dir/span_switchtype
;;
- *TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*WP[TE]1/*)
- # PRI span (E1/T1)
- echo 'esf' >$tmp_dir/span_framing
- echo 'b8zs' >$tmp_dir/span_coding
+ cl)
+ echo 'ccs' >$tmp_dir/span_framing
+ echo 'hdb3' >$tmp_dir/span_coding
+ #echo 'crc4' >$tmp_dir/span_yellow
echo 'national' >$tmp_dir/span_switchtype
- 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)
- # (Just an example for per-country info)
- echo 'ccs' >$tmp_dir/span_framing
- echo 'ami' >$tmp_dir/span_coding
- #echo 'crc4' >$tmp_dir/span_yellow
- #echo 'euroisdn' >$tmp_dir/span_switchtype
- #echo 'pri_cpe' >$tmp_dir/span_signalling
- ;;
- il|de|au)
- echo 'ccs' >$tmp_dir/span_framing
- echo 'hdb3' >$tmp_dir/span_coding
- echo 'crc4' >$tmp_dir/span_yellow
- echo 'euroisdn' >$tmp_dir/span_switchtype
- ;;
- cl)
- echo 'ccs' >$tmp_dir/span_framing
- echo 'hdb3' >$tmp_dir/span_coding
- #echo 'crc4' >$tmp_dir/span_yellow
- echo 'national' >$tmp_dir/span_switchtype
- ;;
- esac
- ;;
+ ;;
esac
- fi
- # span_lastd is always the one before last
- # channel. span_bchan is the last:
- echo $chan_num >$tmp_dir/span_end
+ ;;
+ esac
}
# read information from the $tmp_dir/span_foo files and generate
@@ -744,7 +755,7 @@ write_digital_config() {
31) #E1
dchan="$(($span_begin+15))"
bchans="$span_begin-$(($span_begin+14)),$(($span_begin+16))-$span_end"
- if [ "$span_switchtype" = 'national' ]; then
+ if [ "$span_framing" = 'esf' ]; then
# don't leave an E1 span with defective defaults:
span_framing=ccs
span_coding=hdb3
@@ -922,15 +933,14 @@ EOF
fi
# Check if ZapBRI cards are in TE or NT mode
- if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] )'
+ if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] |Xorcom .* BRI_NT)'
then
echo 'nt' >$tmp_dir/span_termtype
- else
- if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[TE\]\ |octoBRI \[TE\] |HFC-S PCI A ISDN.* \[TE\] )'
- then
- echo 'te' >$tmp_dir/span_termtype
- fi
+ elif echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[TE\]\ |octoBRI \[TE\] |HFC-S PCI A ISDN.* \[TE\] |Xorcom .* BRI_TE)'
+ then
+ echo 'te' >$tmp_dir/span_termtype
fi
+
# The rest of the lines are per-channel lines
sed -e 1,2d $procfile | \
while read line
@@ -982,7 +992,7 @@ EOF
# Astribank FXS span (input port)
print_pattern -a input $chan_num fxo $mode
;;
- *ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*XPP_BRI_*/*|*WP[TE]1/*)
+ *ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*XPP_BRI_*/*|*WP[TE]1/*|*XPP_BRI*)
detect_digital_channel "$line" "$chan_num" "$span_num"
;;
'') ;; # Empty line (after span header)