diff options
Diffstat (limited to 'xpp/genzaptelconf')
-rwxr-xr-x | xpp/genzaptelconf | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/xpp/genzaptelconf b/xpp/genzaptelconf index 163f595..023bd73 100755 --- a/xpp/genzaptelconf +++ b/xpp/genzaptelconf @@ -1,7 +1,7 @@ #! /bin/bash # genzaptelconf: generate as smartly as you can: -# /etc/zaptel.conf +# /etc/dahdi.conf # /etc/asterisk/zapata-channels.conf (to be #include-d into zapata.conf) # update: # With '-M' /etc/modules (list of modules to load) @@ -56,7 +56,7 @@ group_lines=0 # group for lines # Set fxs_immediate to 'yes' to make all FXS lines answer immediately. fxs_immediate=no -ZAPCONF_FILE=${ZAPCONF_FILE:-/etc/zaptel.conf} +ZAPCONF_FILE=${ZAPCONF_FILE:-/etc/dahdi.conf} ZAPCONF_FILE_SYSTEM=$ZAPCONF_FILE ZAPATA_FILE=${ZAPATA_FILE:-/etc/asterisk/zapata-channels.conf} ZAPSCAN_FILE=${ZAPSCAN_FILE:-/etc/asterisk/zapscan.conf} @@ -121,7 +121,7 @@ if [ ! -x "$ZTCFG" ]; then if [ -x /usr/sbin/ztcfg ]; then ZTCFG=/usr/sbin/ztcfg else - echo >&2 "ztcfg is not on found, do you have zaptel properly installed?" + echo >&2 "ztcfg is not on found, do you have dahdi properly installed?" exit_cleanup 1 fi fi @@ -178,9 +178,9 @@ exit_cleanup() { # Wait for udev to generate /dev/zap/ctl, if needed: wait_for_zapctl() { - # if device file already exists, or if zaptel has failed to load: + # if device file already exists, or if dahdi has failed to load: # no point waiting. - if [ -c /dev/zap/ctl ] || ! grep -q zaptel /proc/modules ; then + if [ -c /dev/zap/ctl ] || ! grep -q dahdi /proc/modules ; then return fi say "Waiting for /dev/zap/ctl to be generated" @@ -227,7 +227,7 @@ update_module_list_debian() { } update_module_list_fedora() { - say "Updating modules list in zaptel init config $MODLIST_FILE_FEDORA." + say "Updating modules list in dahdi init config $MODLIST_FILE_FEDORA." sed -i.bak -e "/^$modules_var=/d" "$MODLIST_FILE_FEDORA" echo "$modules_var=\"$*\"" >> "$MODLIST_FILE_FEDORA" } @@ -251,10 +251,10 @@ zap_reg_xpp() { # the USB connector. That order is rather arbitrary, but will not # change without changes to the cabling. xbusses=`sed -e '/STATUS=connected/!d' -e 's/ *STATUS=.*//' -e 's/ *CONNECTOR=//' /proc/xpp/xbuses | sort -t: -k 2 | cut -d: -f1` - say "Zaptel registration order:" + say "Dahdi registration order:" say "$xbusses" - # get a list of XPDs that were not yet registered as zaptel spans. + # get a list of XPDs that were not yet registered as dahdi 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. @@ -289,7 +289,7 @@ xpp_startup() { usage() { program=`basename $0` - echo >&2 "$program: generate zaptel.conf and zapata.conf" + echo >&2 "$program: generate dahdi.conf and zapata.conf" echo >&2 "(version $VERSION, $rcsid)" echo >&2 "usage:" echo >&2 " $program [-sRdv] [-m k|l|g] [-c <country_code>] [-e <base_exten>] [-F]" @@ -301,9 +301,9 @@ usage() { echo >&2 " -c CODE: set the country code (default: $lc_country)" echo >&2 " -e NUM: set the base extension number (default: $base_exten)" echo >&2 " -F: Don't print FXSs in zapata.conf" - echo >&2 " -l: output a list of detected channels instead of zaptel.conf" + echo >&2 " -l: output a list of detected channels instead of dahdi.conf" echo >&2 " -d: Perform hardware detection" - echo >&2 " -u: Unload zaptel modules (will not restart Asterisk)." + echo >&2 " -u: Unload dahdi modules (will not restart Asterisk)." echo >&2 " -v: verbose" echo >&2 " -s: Stop Asterisk before running, and start it at the end." echo >&2 " -R: Don't restart asterisk in the end." @@ -371,10 +371,10 @@ print_pattern() { echo ";;; line=\"$line\"" >> $zapata_file if [ "$astbank_type" != '' ]; - then echo "# astbanktype: $astbank_type" >>$zaptel_file; + then echo "# astbanktype: $astbank_type" >>$dahdi_file; fi - echo "${sig}$method=$chan" >>$zaptel_file - # zap2amp will rewrite those from zaptel.conf and hints there + echo "${sig}$method=$chan" >>$dahdi_file + # zap2amp will rewrite those from dahdi.conf and hints there if [ "$fxsdisable" = 'yes' ] && [ "$sig" = 'fxo' ]; then return; fi echo "signalling=${sig}_$method" >>$zapata_file @@ -476,14 +476,14 @@ print_pattern() { } -# the number of channels from /proc/zaptel +# the number of channels from /proc/dahdi # must always print a number as its output. count_proc_zap_lines() { - # if zaptel is not loaded there are 0 channels: - if [ ! -d /proc/zaptel ]; then echo '0'; return; fi + # if dahdi is not loaded there are 0 channels: + if [ ! -d /proc/dahdi ]; then echo '0'; return; fi ( - for file in `echo /proc/zaptel/* |grep -v '\*'` + for file in `echo /proc/dahdi/* |grep -v '\*'` do sed -e 1,2d $file # remove the two header lines done ) | wc -l # the total number of lines @@ -498,7 +498,7 @@ load_modules() { eval "args=\$$args" # a module is worth listing if it: # a. loaded successfully, and - # b. added channels lines under /proc/zaptel/* + # b. added channels lines under /proc/dahdi/* if /sbin/modprobe $i $args 2> /dev/null then check=0 @@ -545,8 +545,8 @@ unload_module() { } unload_modules() { - say "Unloading zaptel modules:" - unload_module zaptel + say "Unloading dahdi modules:" + unload_module dahdi say '' } @@ -574,11 +574,11 @@ detect() { if echo $modlist | grep -q xpp_usb; then wait_for_xpp; fi } -# The module configuration generated by zaptel includes a totally useless +# The module configuration generated by dahdi includes a totally useless # automatic run of ztcfg after modules loading. As a workaround for that, -# we provide an empty zaptel.conf temporarily. +# we provide an empty dahdi.conf temporarily. # -# At hardware detection time we shouldn't really touch zaptel.conf . So we +# At hardware detection time we shouldn't really touch dahdi.conf . So we # must keep a copy of it somewhere. # # I use ZAPCONF_FILE_SYSTEM rather than ZAPCONF_FILE, as the bogus modprobe @@ -590,15 +590,15 @@ ZAPCONF_FILE_TMP= temporary_zapconf() { case "$1" in 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" + say "Temporarily moving dahdi.conf aside to work around broken modprobe.conf" + ZAPCONF_FILE_TMP=`mktemp /tmp/genzaptelconf-dahdi.conf-XXXXXX` || die "Error creating temporary dahdi.conf" if [ -f $ZAPCONF_FILE_SYSTEM ]; then cp -a $ZAPCONF_FILE_SYSTEM $ZAPCONF_FILE_TMP fi echo -n >$ZAPCONF_FILE_SYSTEM ;; restore) - # restore original zaptel.conf: + # restore original dahdi.conf: if [ "$ZAPCONF_FILE_TMP" = '' ]; then return; fi mv $ZAPCONF_FILE_TMP $ZAPCONF_FILE_SYSTEM ZAPCONF_FILE_TMP='' @@ -652,7 +652,7 @@ gen_tmp_conf() { fi } -# Extract information from one digital channel (one line in a /proc/zaptel +# Extract information from one digital channel (one line in a /proc/dahdi # 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. @@ -786,15 +786,15 @@ write_digital_config() { esac case "$mode" in files) - echo span=$span_num,$span_timing,$span_lbo,$span_framing,$span_coding$span_yellow >> $zaptel_file - # leave a comment in zaptel.conf that allows to tell if + echo span=$span_num,$span_timing,$span_lbo,$span_framing,$span_coding$span_yellow >> $dahdi_file + # leave a comment in dahdi.conf that allows to tell if # this span is TE or NT: if [ "$span_termtype" != '' ] - then echo "# termtype: $span_termtype" >>$zaptel_file + then echo "# termtype: $span_termtype" >>$dahdi_file fi - echo bchan=$bchans >>$zaptel_file - echo dchan=$dchan >>$zaptel_file + echo bchan=$bchans >>$dahdi_file + echo dchan=$dchan >>$dahdi_file if [ "$fxsdisable" = 'yes' ] && [ "$span_termtype" = 'nt' ]; then return; fi # You should not send content to zapata.conf below this line @@ -857,13 +857,13 @@ genconf() { local mode=$1 local reset_values="" -# spanlist=`echo /proc/zaptel/* | grep -v '\*'` -# spanlist=$(for i in `for i in /proc/zaptel/*; do if [ -f $i ]; then echo $i | cut -f 4 -d / ; fi; done | sort -n`; do echo -n "/proc/zaptel/$i "; done) -# spanlist=(cd /proc/zaptel; ls | sort -n | sed 's|^|/proc/zaptel/|') - spanlist=`ls /proc/zaptel/ 2>/dev/null | sort -n | sed 's|^|/proc/zaptel/|'` +# spanlist=`echo /proc/dahdi/* | grep -v '\*'` +# spanlist=$(for i in `for i in /proc/dahdi/*; do if [ -f $i ]; then echo $i | cut -f 4 -d / ; fi; done | sort -n`; do echo -n "/proc/dahdi/$i "; done) +# spanlist=(cd /proc/dahdi; ls | sort -n | sed 's|^|/proc/dahdi/|') + spanlist=`ls /proc/dahdi/ 2>/dev/null | sort -n | sed 's|^|/proc/dahdi/|'` #if [ "$spanlist" == "" ]; then - # die "No zapata interfaces in /proc/zaptel" + # die "No zapata interfaces in /proc/dahdi" #fi @@ -872,20 +872,20 @@ genconf() { if [ "$do_gen_zapscan" = 'yes' ]; then gen_tmp_conf "$ZAPSCAN_FILE" zapscan_file cat <<EOF >$zapscan_file -; zapscan.conf: information about detected zaptel channels +; zapscan.conf: information about detected dahdi channels ; (currently: analog only) ; ; Automatically generated by $0 -- Please do not edit. EOF fi - gen_tmp_conf "$ZAPTEL_FILE" zaptel_file + gen_tmp_conf "$ZAPTEL_FILE" dahdi_file gen_tmp_conf "$ZAPATA_FILE" zapata_file - cat <<EOF >$zaptel_file + cat <<EOF >$dahdi_file # Autogenerated by $0 -- do not hand edit -# Zaptel Configuration File +# Dahdi Configuration File # -# This file is parsed by the Zaptel Configurator, ztcfg +# This file is parsed by the Dahdi Configurator, ztcfg # # It must be in the module loading order @@ -893,7 +893,7 @@ EOF EOF cat <<EOF >$zapata_file ; Autogenerated by $0 -- do not hand edit -; Zaptel Channels Configurations (zapata.conf) +; Dahdi Channels Configurations (zapata.conf) ; ; This is not intended to be a complete zapata.conf. Rather, it is intended ; to be #include-d by /etc/zapata.conf that will include the global settings @@ -913,7 +913,7 @@ EOF # Another problem with such an approach is how to include an existing # configuration file. For instance: how to include some default settings. # - # Maybe an 'include' directive should be added to zaptel.conf ? + # Maybe an 'include' directive should be added to dahdi.conf ? #cat $spanlist | for procfile in $spanlist do @@ -925,8 +925,8 @@ EOF case "$mode" in list) echo "### $title";; files) - echo "" >>$zaptel_file - echo "# $title" >>$zaptel_file + echo "" >>$dahdi_file + echo "# $title" >>$dahdi_file echo "" >>$zapata_file echo "; $title" >>$zapata_file ;; @@ -975,7 +975,7 @@ EOF # print nothing here. case "$mode" in list) echo "# channel $chan_num, WCTDM, no module.";; - files) echo "# channel $chan_num, WCTDM, no module." >> $zaptel_file;; + files) echo "# channel $chan_num, WCTDM, no module." >> $dahdi_file;; esac continue fi @@ -986,7 +986,7 @@ EOF *WCFXO/*) # X100P print_pattern $chan_num fxs $mode || \ - echo "# channel $chan_num, WCFXO, inactive." >>$zaptel_file + echo "# channel $chan_num, WCFXO, inactive." >>$dahdi_file ;; *WCUSB/*) print_pattern $chan_num fxo $mode @@ -1030,7 +1030,7 @@ EOF case "$mode" in list) echo "# ??: $line";; files) - echo "# ??: $line" >>$zaptel_file + echo "# ??: $line" >>$dahdi_file echo "; ??: $line" >>$zapata_file esac ;; @@ -1043,7 +1043,7 @@ EOF if [ "$mode" = 'files' ] then - cat <<EOF >> ${zaptel_file} + cat <<EOF >> ${dahdi_file} # Global data @@ -1054,7 +1054,7 @@ EOF if [ "$mode" = 'files' ]; then mv ${ZAPCONF_FILE} ${ZAPCONF_FILE}.bak 2>/dev/null - mv $zaptel_file ${ZAPCONF_FILE} + mv $dahdi_file ${ZAPCONF_FILE} mv ${ZAPATA_FILE} ${ZAPATA_FILE}.bak 2>/dev/nullk mv $zapata_file ${ZAPATA_FILE} if [ "$do_gen_zapscan" = 'yes' ]; then @@ -1105,7 +1105,7 @@ tmp_dir=`mktemp -d /tmp/genzaptelconf-dir-XXXXXX` || \ case "$lc_country" in - # the list was generated from the source of zaptel: + # the list was generated from the source of dahdi: #grep '{.*[0-9]\+,.*"[a-z][a-z]"' zonedata.c | cut -d'"' -f 2 | xargs |tr ' ' '|' us|au|fr|nl|uk|fi|es|jp|no|at|nz|it|gr|tw|cl|se|be|sg|il|br|hu|lt|pl|za|pt|ee|mx|in|de|ch|dk|cz|cn):;; *) @@ -1150,7 +1150,7 @@ if [ "$zapconf_use_perl" = yes ]; then #redefine genconf to use perl utilities: genconf() { case "$1" in - list) zaptel_hardware ;; + list) dahdi_hardware ;; files) zapconf ;; esac } |