30
30
# The script uses a number of bash-specific features
31
31
# TODO: either ditch them or convert to perl
32
# Don't override variables here. Override them in /etc/default/zaptel
35
# * Experimental support for Sangoma analog cards (A20x)
36
# * Support OpenVox A1200P (A TDM400P clone refactored)
37
# * Fixed timeout for Astribank load
38
# * Delete unsuccessfully-probe modules
39
# * Pass callerid from trunks
40
# * A simpler wait_for_xpp using new proc wait_for_xpds
41
# * fixed confusion between framing and coding for E1/{il/nl}
43
# * Now it should detect most PRI cards and even wcusb
45
# * Initial support for ztgsm (Junghanns's PCI GSM card)
46
# * Wait for the xpp module to register if just loaded
48
# * Not trying to read from zaptel channels: we can run genzaptelconf even
50
# * Don't add ztdummy to the list of detected modules
52
# * remove ztdummy when rewriting modules file
53
# * Better ISDN PRI behaviour in Israel (il)
55
# * Added -F: to disable writing about FXS ports in zapata.conf
56
# * if we have an astribank: start zaptel rather than simple ztcfg (xpd sync)
58
# * support for digital input/output ports of Astribank
59
# * Different ISDN parameters for the Netherlands (nl)
60
# * unload zaptel and its dependencies, not a hard-coded list
61
# * hence we can reduce the list of modules
32
# Don't override variables here.
33
# Override them in /etc/default/zaptel (debian) or /etc/sysconfig/zaptel
63
36
# /etc/default/zaptel may override the following variables
65
rcsid='$Id: genzaptelconf 1229 2006-07-14 20:12:54Z tzafrir $'
38
rcsid='$Id: genzaptelconf 1495 2006-10-03 04:49:19Z tzafrir $'
68
41
# If set: no context changes are made in zapata-channels.conf
82
55
# will set this to "no", so you can safely leave it as "yes".
85
ZAPCONF_FILE=/etc/zaptel.conf
86
ZAPATA_FILE=/etc/asterisk/zapata-channels.conf
87
ZAPTEL_BOOT=/etc/default/zaptel
58
ZAPCONF_FILE=${ZAPCONF_FILE:-/etc/zaptel.conf}
59
ZAPCONF_FILE_SYSTEM=$ZAPCONF_FILE
60
ZAPATA_FILE=${ZAPATA_FILE:-/etc/asterisk/zapata-channels.conf}
61
ZAPTEL_BOOT_DEBIAN=${ZAPTEL_BOOT_DEBIAN:-/etc/default/zaptel}
62
ZAPTEL_BOOT_FEDORA=${ZAPTEL_BOOT_FEDORA:-/etc/sysconfig/zaptel}
88
63
MODLIST_FILE=/etc/modules
64
MODLIST_FILE_FEDORA=/etc/sysconfig/zaptel
89
65
exten_base_dir=/etc/asterisk/extensions-phones.d
90
66
exten_defs_file=/etc/asterisk/extensions-defs.conf
67
# how long to wait for /dev/zap/ctl to appear? (seconds)
68
DEVZAP_TIMEOUT=${DEVZAP_TIMEOUT:-20}
69
ZTCFG=${ZTCFG:-/sbin/ztcfg}
93
# a temporary directory. Created when the switch -r is parsed on getopts
94
# and deleted in the end on update_extensions_defs
71
# a temporary directory to store whatever we need to remember.
73
# The main loop of genconf is run in a sub-process.
97
76
# A list of all modules:
100
79
ALL_MODULES="zaphfc qozap ztgsm wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wct1xxp wct4xxp wcte11xp wanpipe wcusb xpp_usb"
102
81
# read default configuration from /etc/default/zaptel
103
if [ -r $ZAPTEL_BOOT ]; then . $ZAPTEL_BOOT; fi
82
if [ -r $ZAPTEL_BOOT_DEBIAN ]; then . $ZAPTEL_BOOT_DEBIAN; fi
83
if [ -r $ZAPTEL_BOOT_FEDORA ]; then . $ZAPTEL_BOOT_FEDORA; fi
85
if [ ! -x "$ZTCFG" ]; then
86
# Work around a bug in the rpm package: ztcfg should be in
87
# /sbin as it may be required for starting a network interface
88
if [ -x /usr/sbin/ztcfg ]; then
91
echo >&2 "ztcfg is not on found, do you have zaptel properly installed?"
105
96
# it is safe to use -c twice: the last one will be used.
106
97
ztcfg_cmd="$ZTCFG -c $ZAPCONF_FILE"
124
# Wait for udev to generate /dev/zap/ctl, if needed:
126
# if device file already exists, or if zaptel has failed to load:
128
if [ -c /dev/zap/ctl ] || ! grep -q zaptel /proc/modules ; then
131
say "Waiting for /dev/zap/ctl to be generated"
133
for i in `seq $DEVZAP_TIMEOUT`; do
135
if [ -c /dev/zap/ctl ]; then
140
if [ "$devzap_found" != 1 ]; then
141
say "Still no /dev/zap/ctl after $devzap_timeout seconds."
142
echo >&2 "No /dev/zap/ctl: cannot run ztcfg. Aborting."
136
148
if [ "$verbose" = no ]; then
158
171
done >> "$MODLIST_FILE"
162
if [ ! -d `dirname ${ZAPTEL_BOOT}` ]
166
sed -i.bak "s/^$1=.*\$/$1=\"$2\"/" ${ZAPTEL_BOOT}
167
if ! grep -q "^$1=" ${ZAPTEL_BOOT}; then
168
echo "$1=\"$2\"" >> ${ZAPTEL_BOOT}
172
update_extensions_defs() {
173
if [ "$rapid_conf_mode" = 'yes' ]
175
say "DEBUG: Updating dialplan defs file $exten_defs_file"
176
if [ "`echo $tmp_dir/fxo_* | grep -v '*'`" != '' ]
178
trunk_nums=`cat $tmp_dir/fxo_* | sort -n | xargs`
179
say "Configuring TRUNK to be [first of] zaptel channels: $trunk_nums"
180
trunk_dev=`echo $trunk_nums| sed -e 's/ /\\\\\\&/g' -e 's/[0-9a-zA-Z]\+/Zap\\\\\\/&/g'`
181
echo >&2 sed -i "s/^TRUNK.*=>.*/TRUNK => $trunk_dev/" $exten_defs_file
182
sed -i "s/^TRUNK.*=>.*/TRUNK => $trunk_dev/" $exten_defs_file
183
if ! grep -q "^TRUNK =>" $exten_defs_file; then
184
trunk_dev=`echo $trunk_nums| sed -e 's/ /&/g' -e 's/[0-9a-zA-Z]*/Zap\\/&/g'`
185
echo "TRUNK => $trunk_dev" >> $exten_defs_file
188
say "Warning: No FXO channel for trunk. Moving on."
190
if [ "`echo $tmp_dir/fxs_* | grep -v '*'`" != '' ]
192
fxs_nums=`cat $tmp_dir/fxs_* | sort -n | xargs`
193
zap_nums=`grep '^[^;].*Zap/\${CHAN_ZAP_' $exten_base_dir/*.conf | \
194
sed -e 's/.*Zap\/\${CHAN_ZAP_\([0-9]*\)}.*/\1/' | sort -u | xargs`
195
say "Configuring channels: $fxs_nums as channel placeholders: $zap_nums"
199
chan=`echo $fxs_nums | awk "{print \\$$i}"`
202
# if the result is empty, we probably got past the last one.
204
say "Warning: No FXS channel for CHAN_ZAP_$i. Moving on"
207
say "DEBUG: setting channel $chan to placeholder $i"
208
if grep -q "^CHAN_ZAP_$i " $exten_defs_file
210
sed -i -e "s/^CHAN_ZAP_$i .*/CHAN_ZAP_$i => Zap\/$chan/" $exten_defs_file
212
echo "CHAN_ZAP_$i => Zap/$chan" >> $exten_defs_file
216
# cleaning up the temp dir
218
if [ -d "$tmp_dir" ]; then rm -rf "$tmp_dir"; fi
174
update_module_list_fedora() {
175
say "Updating modules list in zaptel init config $MODLIST_FILE_FEDORA."
176
sed -i.bak -e '/^MODULES=/d' "$MODLIST_FILE_FEDORA"
177
echo "MODULES=\"$*\"" >> "$MODLIST_FILE_FEDORA"
180
update_module_list() {
181
if [ -f "$MODLIST_FILE" ]; then
182
update_module_list_debian "$@"
183
elif [ -f "$MODLIST_FILE_FEDORA" ]; then
184
update_module_list_fedora "$@"
186
die "Can't find a modules list to update. Tried: $MODLIST_FILE, $MODLIST_FILE_FEDORA. Aborting"
193
if [ ! -d /proc/xpp ]; then return; fi
195
# Get a list of connected Astribank devices, sorted by the name of
196
# the USB connector. That order is rather arbitrary, but will not
197
# change without changes to the cabling.
198
xbusses=`sort -k 2 /proc/xpp/xbuses | awk -F: '/STATUS=connected/ {print $1}'`
200
# get a list of XPDs that were not yet registered as zaptel spans.
201
# this will be the case if you set the parameter zap_autoreg=0 to
203
# Append /dev/null to provide a valid file name in case of an empty pattern.
204
xbusses_pattern=`echo $xbusses| sed -e 's|XBUS-[0-9]*|/proc/xpp/&/XPD-*/zt_registration|g'`' /dev/null'
205
xpds_to_register=`grep -l 0 $xbusses_pattern`
206
for file in $xpds_to_register; do
221
212
check_for_astribank(){
222
213
if ! grep -q XPP_IN/ /proc/zaptel/* 2>/dev/null
265
list) echo $chan $sig $astbanktype;;
276
267
# sadly, both input ports and output ports go into the same span as
277
268
# the FXS ports. Thus we need to separate between them. See also
278
269
# the zapata.conf section:
279
if [ "$astbank_type" != '' ]; then echo "# astbanktype: $astbank_type"; fi
280
echo "${sig}$method=$chan"
282
list) echo $chan $sig $astbanktype;;
270
if [ "$astbank_type" != '' ];
271
then echo "# astbanktype: $astbank_type" >>$zaptel_file;
273
echo "${sig}$method=$chan" >>$zaptel_file
284
274
# zap2amp will rewrite those from zaptel.conf and hints there
285
if [ "$fxsdisable" = 'yes' ] && [ $sig = 'fxo' ]; then return; fi
275
if [ "$fxsdisable" = 'yes' ] && [ "$sig" = 'fxo' ]; then return; fi
287
echo "signalling=${sig}_$method"
277
echo "signalling=${sig}_$method" >>$zapata_file
288
278
if [ "$sig" = 'fxo' ]
290
280
# to preconfigure channel 1's extension to 550, set
297
287
var_name=`echo chan_${chan}_cntxt`
298
288
cfg_cntxt=`echo ${!var_name} | tr -d -c 0-9`
300
# if option -E was given, get configuration from current extension
301
if [ "$rapid_conf_mode" = 'yes' ]
303
rap_exten=`echo $rapid_extens |awk "{print \\$$rapid_cur_exten}"`
304
if [ "$rap_exten" != '' ]
306
rap_cfgfile="$exten_base_dir/$rap_exten.conf"
307
if [ -r "$rap_exten" ]
310
# the vmbox is the third parameter to stdexten
311
rap_vmbox=`grep '^[^;].*Macro(stdexten' $rap_exten | cut -d, -f3 \
312
| cut -d')' -f1 | tr -d -c '0-9@a-zA-Z'`
313
if [ "$rap_vmbox" ]!= '' ; then cfg_vmbox=$rap_vmbox; fi
316
rapid_cur_exten=$(($rapid_cur_exten + 1))
319
290
if [ "$cfg_exten" = '' ]
320
291
then # No extension number set for this channel
321
292
exten=$(($chan+$base_exten))
329
300
else # use the pre-configured extension number
332
echo "callerid=\"Channel $chan\" <$exten>"
333
echo "mailbox=$exten"
303
echo "callerid=\"Channel $chan\" <$exten>" >> $zapata_file
304
echo "mailbox=$exten" >> $zapata_file
334
305
if [ "$group_manual" != "yes" ]
336
echo "group=$group_phones"
307
echo "group=$group_phones" >> $zapata_file
338
309
if [ "$context_manual" != "yes" ]
340
311
if [ "$astbank_type" != '' ];
342
313
context_var_name=context_$astbank_type
343
echo context=${!context_var_name}
314
echo context=${!context_var_name} >> $zapata_file
345
echo "context=$context_phones"
316
echo "context=$context_phones" >> $zapata_file
348
319
else # this is an FXO (trunk/phone: FXO signalling)
349
320
# we have may have set it. So reset it:
350
echo "callerid=asrecieved"
321
echo "callerid=asreceived" >> $zapata_file
322
echo "mailbox=" >> $zapata_file
352
323
if [ "$group_manual" != "yes" ]
354
echo "group=$group_lines"
325
echo "group=$group_lines" >> $zapata_file
356
327
if [ "$context_manual" != "yes" ]
358
echo "context=$context_lines"
329
echo "context=$context_lines" >> $zapata_file
360
331
if [ "$lc_country" = 'uk' ]
362
echo "cidsignalling=v23"
333
echo "cidsignalling=v23" >> $zapata_file
364
*WCFXO*) echo "cidstart=history";;
365
*) echo "cidstart=polarity";; #a TDM400
335
*WCFXO*) echo "cidstart=history" >> $zapata_file;;
336
*) echo "cidstart=polarity" >> $zapata_file;;
368
echo ";;; line=\"$line\""
339
echo ";;; line=\"$line\"" >> $zapata_file
369
340
# if kewlstart is not used, busydetect has to be employed:
370
341
if [ "$method" = 'ls' ]
371
then echo 'busydetect=yes'
372
else echo 'busydetect=no'
342
then echo 'busydetect=yes' >> $zapata_file
343
else echo 'busydetect=no' >> $zapata_file
376
347
if [ "$set_immediate" = 'yes' ]
378
349
if [ "$astbank_type" = 'input' ]
379
then echo 'immediate=yes'
380
else echo 'immediate=no'
350
then echo 'immediate=yes' >> $zapata_file
351
else echo 'immediate=no' >> $zapata_file
383
echo "channel => $chan"
354
echo "channel => $chan" >> $zapata_file
355
echo "" >> $zapata_file
386
357
# Keep a note of what channels we have identified
387
358
say "DEBUG: adding to channels list: channel: $chan, sig: $sig"
484
455
# sleep a while until the xpp modules fully register
459
autoreg="/sys/module/xpp/zap_autoreg"
462
autoreg="/sys/module/xpp/parameters/zap_autoreg"
486
465
if [ -d /proc/xpp ] && \
487
[ "`cat /sys/module/xpp/parameters/zap_autoreg`" = 'Y' ]
466
[ "`cat $autoreg`" = 'Y' ]
489
468
# wait for the XPDs to register:
490
469
# TODO: improve error reporting and produce a messagee here
491
cat /proc/xpp/XBUS-*/wait_for_xpds 2>/dev/null >/dev/null || true
470
cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true
476
temporary_zapconf save
478
temporary_zapconf restore
498
479
modlist="$probed_modules"
499
#for i in $ALL_MODULES
501
# if lsmod | grep "^$i *" > /dev/null; then
502
# modlist="$modlist $i"
505
480
modlist="$(echo $modlist)" # clean spaces
506
481
if [ "$do_module_list" = yes ]
508
say "Updating '${MODLIST_FILE}'"
509
483
update_module_list "$modlist"
511
485
if echo $modlist | grep -q xpp_usb; then wait_for_xpp; fi
488
# The module configuration generated by zaptel includes a totally useless
489
# automatic run of ztcfg after modules loading. As a workaround for that,
490
# we provide an empty zaptel.conf temporarily.
492
# At hardware detection time we shouldn't really touch zaptel.conf . So we
493
# must keep a copy of it somewhere.
495
# I use ZAPCONF_FILE_SYSTEM rather than ZAPCONF_FILE, as the bogus modprobe
496
# entries will not be initiated by us.
498
# ZAPCONF_FILE_TMP is a "global", as it needs to be preserved between the
499
# call to 'save' and to 'restore'
501
temporary_zapconf() {
504
say "Temporarily moving zaptel.conf aside to work around broken modprobe.conf"
505
ZAPCONF_FILE_TMP=`mktemp -t zaptel.conf-XXXXXX` || die "Error creating temporary zaptel.conf"
506
cp -a $ZAPCONF_FILE_SYSTEM $ZAPCONF_FILE_TMP
507
echo -n >$ZAPCONF_FILE_SYSTEM
510
# restore original zaptel.conf:
511
if [ "$ZAPCONF_FILE_TMP" = '' ]; then return; fi
512
mv $ZAPCONF_FILE_TMP $ZAPCONF_FILE_SYSTEM
514
518
# TODO: kill this function. It is now unreferenced from anywhere.
515
519
check_tdm_sigtype() {
615
605
# the first line is the title line. It states the model name
616
606
# the second line is empty
617
607
title=`head -n 1 $procfile`
619
# stuff that needs to be remembered accross lines (for PRI support)
620
echo "$rem_char $title"
608
# stuff that needs to be remembered accross lines (for PRI/BRI support)
609
echo "" >>$zaptel_file
610
echo "# $title" >>$zaptel_file
611
echo "" >>$zapata_file
612
echo "; $title" >>$zapata_file
621
613
echo '-1' >$tmp_dir/span_begin
622
614
echo '-1' >$tmp_dir/span_end
623
echo '1' >$tmp_dir/span_timing
615
echo '0' >$tmp_dir/span_timing
624
616
echo '1' >$tmp_dir/span_lbo
625
617
echo '' >$tmp_dir/span_framing
626
618
echo 'ami' >$tmp_dir/span_coding
627
619
echo '' >$tmp_dir/span_switchtype
628
620
echo '' >$tmp_dir/span_signalling
622
# Check if ZapBRI cards are in TE or NT mode
630
623
if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] )'
632
625
echo 'nt' >$tmp_dir/span_termtype
670
665
print_pattern $chan_num fxo $mode
673
669
print_pattern $chan_num fxs $mode
672
# Astribank FXS span (regular port)
676
673
print_pattern $chan_num fxo $mode
676
# Astribank FXS span (output port)
679
677
print_pattern -a output $chan_num fxo $mode
680
# Astribank FXS span (input port)
682
681
print_pattern -a input $chan_num fxo $mode
684
*ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*TE4/*|*TE2/*|*WCT1/*|*Tor2/*|*TorISA/*) # should also be used for other PRI channels
683
*ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*XPP_BRI_*/*|*WP[TE]1/*)
685
# Rather than identifying cards by the header line, we identify them by the channel names
686
# This is shorter. This also allows us to count the channel numbers and check if a PRI
685
688
if [ "`cat $tmp_dir/span_begin`" = "-1" ]
687
690
echo $chan_num >$tmp_dir/span_begin
688
691
echo $span_num >$tmp_dir/span_num
692
# The Astribank channels provide the information of TE/NT in the channel name. So
695
*XPP_BRI_TE/*) echo 'te' >$tmp_dir/span_termtype;;
696
*XPP_BRI_NT/*) echo 'nt' >$tmp_dir/span_termtype;;
699
*ZTHFC*/*|*ztqoz*/*|*XPP_BRI_*/*)
691
701
echo 'ccs' >$tmp_dir/span_framing
692
702
echo 'euroisdn' >$tmp_dir/span_switchtype
693
703
if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ]
695
echo 'bri_net' >$tmp_dir/span_signalling
705
echo 'bri_net' >$tmp_dir/span_signalling
697
707
echo 'bri_cpe' >$tmp_dir/span_signalling
711
# Junghanns's GSM cards.
701
712
echo 'ccs' >$tmp_dir/span_framing
702
713
# what switch type? Any meaning to it?
703
714
echo 'gsm' >$tmp_dir/span_signalling
705
*TE4/*|*TE2/*|*WCT1/*|*Tor2/*|*TorISA/*)
716
*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*WP[TE]1/*)
706
718
echo 'esf' >$tmp_dir/span_framing
707
719
echo 'b8zs' >$tmp_dir/span_coding
708
720
echo 'national' >$tmp_dir/span_switchtype
732
751
echo $chan_num >$tmp_dir/span_end
734
753
'') ;; # Empty line (after span header)
735
*) echo "$rem_char ??: $line";;
756
list) echo "# ??: $line";;
758
echo "# ??: $line" >>$zaptel_file
759
echo "; ??: $line" >>$zaptel_file
764
# end of part in sub-process.
738
766
if [ "`cat $tmp_dir/span_begin`" != -1 ]
739
767
then # write PRI span ocnfig:
740
768
# read files to variables:
752
780
bchans="$span_begin-$(($span_end-1))"
755
dchan="$(($span_begin+15))"
783
dchan="$(($span_begin+15))"
756
784
bchans="$span_begin-$(($span_begin+14)),$(($span_begin+16))-$span_end"
785
if [ "$span_switchtype" = 'national' ]; then
788
span_switchtype=euroisdn
792
# Let's assume that a TE span should get the clock from the remote unit,
793
# and NT spans should provide timing. Just as a sane default.
794
# If we have several TE spans, the first will have priority 1,
796
case "$span_signalling" in *_cpe*)
797
span_timing=$span_te_timing_counter
798
span_te_timing_counter=$(($span_te_timing_counter + 1))
761
echo span=$span_num,$span_timing,$span_lbo,$span_framing,$span_coding$span_yellow
803
echo span=$span_num,$span_timing,$span_lbo,$span_framing,$span_coding$span_yellow >> $zaptel_file
762
804
if [ "$span_termtype" != '' ]
763
then echo "# termtype: $span_termtype"
805
then echo "# termtype: $span_termtype" >>$zaptel_file
807
echo bchan=$bchans >>$zaptel_file
808
echo dchan=$dchan >>$zaptel_file
769
810
if [ "$span_termtype" != '' ]
771
812
# an ISDN card's span that we know if it is in NT mode or TE mode.
772
813
# NT is the same as FXS for us and TE is the same as FXO
773
814
if [ "$span_termtype" = 'nt' ]
775
echo "callerid=\"Channels $span_begin - $span_end\" <$span_begin>"
816
echo "callerid=\"Channels $span_begin - $span_end\" <$span_begin>" >> $zapata_file
776
817
#echo "mailbox=$exten"
777
818
if [ "$group_manual" != "yes" ]
779
echo "group=$group_phones"
820
echo "group=$group_phones" >> $zapata_file
781
822
if [ "$context_manual" != "yes" ]
783
echo "context=$context_phones"
824
echo "context=$context_phones" >> $zapata_file
785
826
else # we have may have set it. So reset it:
786
echo "callerid=asrecieved"
827
echo "callerid=asreceived"
788
829
if [ "$group_manual" != "yes" ]
790
echo "group=$group_lines"
831
echo "group=$group_lines" >> $zapata_file
792
833
if [ "$context_manual" != "yes" ]
794
echo "context=$context_lines"
835
echo "context=$context_lines" >> $zapata_file
798
echo "switchtype = $span_switchtype"
799
echo "signalling = $span_signalling"
800
echo "channel => $bchans"
839
echo "switchtype = $span_switchtype" >> $zapata_file
840
echo "signalling = $span_signalling" >> $zapata_file
841
echo "channel => $bchans" >> $zapata_file
803
844
echo BRI/PRI: chans: $bchans, control: $dchan
809
if [ "$mode" = 'zaptel' ]
850
if [ "$mode" = 'files' ]
852
cat <<EOF >> ${zaptel_file}
857
defaultzone = $defaultzone
816
echo "loadzone = $loadzone"
817
echo "defaultzone = $defaultzone"
820
if [ "$mode" = 'zapata' ] || [ "$mode" = 'list' ]
822
update_extensions_defs
861
mv ${ZAPCONF_FILE} ${ZAPCONF_FILE}.bak
862
mv $zaptel_file ${ZAPCONF_FILE}
863
mv ${ZAPATA_FILE} ${ZAPATA_FILE}.bak
864
mv $zapata_file ${ZAPATA_FILE}
865
# cleaning up the temp dir
866
if [ -d "$tmp_dir" ]; then rm -rf "$tmp_dir"; fi
826
while getopts 'c:de:Fhlm:Mrsuv' arg
869
while getopts 'c:de:Fhlm:MRsuv' arg
829
872
e) # guarantee that it is a number:
901
942
if [ "$mode" = list ]; then
904
946
check_for_astribank
906
say "Generating '${ZAPCONF_FILE}'"
907
mv "${ZAPCONF_FILE}" "${ZAPCONF_FILE}.bak"
908
genconf zaptel > "${ZAPCONF_FILE}"
909
say "Generating '${ZAPATA_FILE}'"
910
mv "${ZAPATA_FILE}" "${ZAPATA_FILE}.bak"
911
genconf zapata > "${ZAPATA_FILE}"
948
say "Generating '${ZAPCONF_FILE} and ${ZAPATA_FILE}'"
912
950
if [ "$set_immediate" = 'yes' ] && [ -x /etc/init.d/zaptel ]
913
951
then /etc/init.d/zaptel start
920
958
rm -rf "$tmp_dir"
923
if [ "$force_stop_ast" = 'yes' ]
925
if [ -x /etc/init.d/asterisk ]
927
/etc/init.d/asterisk start 1>&2
961
if [ "$force_stop_ast" != 'yes' ] || [ "$do_restart" != 'yes' ]
966
if [ -x /etc/init.d/asterisk ]
968
/etc/init.d/asterisk start 1>&2
931
971
# if in verbose mode: verify that asterisk is running
932
if [ "$verbose" != 'no' ] && [ "$force_stop_ast" = 'yes' ]
972
if [ "$verbose" != 'no' ]
934
974
say "Checking channels configured in Asterisk:"
935
975
sleep 1 # give it some time. This is enough on our simple test server