summaryrefslogtreecommitdiff
path: root/xpp
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-23 10:02:50 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-23 10:02:50 +0000
commit12ebc24581f7db437873bcba8ee10c133111159c (patch)
tree0cc217d4d18757842b99d66e88432264c741cd7f /xpp
parent1099effc63d5ce93b253e5f2b39d6db69f133cac (diff)
* Work around http://bugs.digium.com/view.php?id=7877: reset every value
we set (except signalling). Isn't zapata.conf fun to work with? * Allow different signalling type for ZapBRI through ZAPBRI_SIGNALLING. - Note that even "pri" ZAPBRI_SIGNALLING requires bristuffed zaptel. * All in all a good reason to increase version number. git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1640 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp')
-rwxr-xr-xxpp/utils/genzaptelconf69
1 files changed, 61 insertions, 8 deletions
diff --git a/xpp/utils/genzaptelconf b/xpp/utils/genzaptelconf
index 053bf1c..5618ee9 100755
--- a/xpp/utils/genzaptelconf
+++ b/xpp/utils/genzaptelconf
@@ -34,7 +34,7 @@
# (redhat/centos)
# /etc/default/zaptel may override the following variables
-VERSION=0.5.7
+VERSION=0.5.8
rcsid='$Id$'
lc_country=us
base_exten=6000
@@ -80,6 +80,14 @@ tmp_dir=
# - 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 wanpipe wcusb xpp_usb"
+# What signalling to give to ZapBRI channels?
+# bri: bri_net; bri_cpe (Bristuffed Asterisk. No multi- support)
+# bri_ptmpi: bri_net_ptmp; bri_cpe_ptmp (Bristuffed Asterisk, multi- support)
+# pri: pri_net; pri_cpe (Recent Asterisk. Experimental)
+#ZAPBRI_SIGNALLING=bri
+#ZAPBRI_SIGNALLING=bri_ptmp
+ZAPBRI_SIGNALLING=pri
+
# read default configuration from /etc/default/zaptel
if [ -r $ZAPTEL_BOOT_DEBIAN ]; then . $ZAPTEL_BOOT_DEBIAN; fi
if [ -r $ZAPTEL_BOOT_FEDORA ]; then . $ZAPTEL_BOOT_FEDORA; fi
@@ -111,6 +119,16 @@ fxsdisable=no
span_te_timing_counter=1
+case "$ZAPBRI_SIGNALLING" in
+bri) ZAPBRI_NET=bri_net; ZAPBRI_CPE=bri_cpe ;;
+pri) ZAPBRI_NET=pri_net; ZAPBRI_CPE=pri_cpe ;;
+bri_ptmp) ZAPBRI_NET=bri_net_ptmp; ZAPBRI_CPE=bri_cpe_ptmp ;;
+*)
+ echo >&2 "Incorrect value for ZAPBRI_SIGNALLING ($ZAPBRI_SIGNALLING). Abortring"
+ exit 1
+ ;;
+esac
+
die() {
echo "$@" >&2
exit 1
@@ -246,6 +264,7 @@ usage() {
# $1: channel number
print_pattern() {
local astbank_type=''
+ local reset_values=""
OPTIND=1
while getopts 'a:' arg
do
@@ -303,10 +322,13 @@ print_pattern() {
vmbox=$cfg_vmbox
fi
echo "callerid=\"Channel $chan\" <$exten>" >> $zapata_file
+ reset_values="$reset_values callerid"
echo "mailbox=$exten" >> $zapata_file
+ reset_values="$reset_values mailbox"
if [ "$group_manual" != "yes" ]
then
echo "group=$group_phones" >> $zapata_file
+ reset_values="$reset_values group"
fi
if [ "$context_manual" != "yes" ]
then
@@ -317,11 +339,11 @@ print_pattern() {
else
echo "context=$context_phones" >> $zapata_file
fi
+ reset_values="$reset_values context"
fi
else # this is an FXO (trunk/phone: FXO signalling)
# we have may have set it. So reset it:
echo "callerid=asreceived" >> $zapata_file
- echo "mailbox=" >> $zapata_file
if [ "$group_manual" != "yes" ]
then
echo "group=$group_lines" >> $zapata_file
@@ -329,6 +351,7 @@ print_pattern() {
if [ "$context_manual" != "yes" ]
then
echo "context=$context_lines" >> $zapata_file
+ reset_values="$reset_values context"
fi
if [ "$lc_country" = 'uk' ]
then
@@ -337,12 +360,14 @@ print_pattern() {
*WCFXO*) echo "cidstart=history" >> $zapata_file;;
*) echo "cidstart=polarity" >> $zapata_file;;
esac
+ reset_values="$reset_values cidsignalling cidstart"
fi
echo ";;; line=\"$line\"" >> $zapata_file
# if kewlstart is not used, busydetect has to be employed:
if [ "$method" = 'ls' ]
- then echo 'busydetect=yes' >> $zapata_file
- else echo 'busydetect=no' >> $zapata_file
+ then
+ echo 'busydetect=yes' >> $zapata_file
+ reset_values="$reset_values busydetect"
fi
fi
@@ -350,11 +375,13 @@ print_pattern() {
then
if [ "$astbank_type" = 'input' ] || \
( [ "$fxs_immediate" = 'yes' ] && [ "$sig" = "fxo" ] )
- then echo 'immediate=yes' >> $zapata_file
- else echo 'immediate=no' >> $zapata_file
+ then
+ echo 'immediate=yes' >> $zapata_file
+ reset_values="$reset_values immediate"
fi
fi
echo "channel => $chan" >> $zapata_file
+ reset_zapata_entry $zapata_file $reset_values
echo "" >> $zapata_file
# Keep a note of what channels we have identified
@@ -535,8 +562,28 @@ check_tdm_sigtype() {
fi
}
+# run after the channel's entry. Used to reset all the values
+reset_zapata_entry() {
+ conf_file="$1"; shift
+
+ for arg in "$@"; do
+ case "$arg" in
+ busydetect) echo "busydetect=no" >>$conf_file;;
+ callerid) echo "callerid=" >>$conf_file;;
+ cidstart) echo "cidstart=" >>$conf_file;;
+ cidsignalling) echo "cidsignalling=" >>$conf_file;;
+ context) echo "context=default" >>$conf_file;;
+ group) echo "group=" >>$conf_file;;
+ immediate) echo "immediate=no" >>$conf_file;;
+ mailbox) echo "mailbox=" >>$conf_file;;
+ esac
+ done
+}
+
+
genconf() {
local mode=$1
+ local reset_values=""
# reset FXO list (global)
#say "DEBUG: resetting channels lists"
rm -f $tmp_dir/fx{s,o}_*
@@ -704,9 +751,9 @@ EOF
echo 'euroisdn' >$tmp_dir/span_switchtype
if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ]
then
- echo 'bri_net' >$tmp_dir/span_signalling
+ echo $ZAPBRI_NET >$tmp_dir/span_signalling
else
- echo 'bri_cpe' >$tmp_dir/span_signalling
+ echo $ZAPBRI_CPE >$tmp_dir/span_signalling
fi
;;
*ztgsm*/*)
@@ -816,10 +863,12 @@ EOF
if [ "$span_termtype" = 'nt' ]
then
echo "callerid=\"Channels $span_begin - $span_end\" <$span_begin>" >> $zapata_file
+ reset_values="$reset_values callerid"
#echo "mailbox=$exten"
if [ "$group_manual" != "yes" ]
then
echo "group=$group_phones" >> $zapata_file
+ reset_values="$reset_values group"
fi
if [ "$context_manual" != "yes" ]
then
@@ -827,20 +876,24 @@ EOF
fi
else # we have may have set it. So reset it:
echo "callerid=asreceived"
+ reset_values="$reset_values callerid"
#echo "mailbox="
if [ "$group_manual" != "yes" ]
then
echo "group=$group_lines" >> $zapata_file
+ reset_values="$reset_values group"
fi
if [ "$context_manual" != "yes" ]
then
echo "context=$context_lines" >> $zapata_file
+ reset_values="$reset_values context"
fi
fi
fi
echo "switchtype = $span_switchtype" >> $zapata_file
echo "signalling = $span_signalling" >> $zapata_file
echo "channel => $bchans" >> $zapata_file
+ reset_zapata_entry $zapata_file $reset_values
;;
list)
echo BRI/PRI: chans: $bchans, control: $dchan