[svn-commits] tzafrir: trunk r1640 - /trunk/xpp/utils/genzaptelconf

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Nov 23 03:02:51 MST 2006


Author: tzafrir
Date: Thu Nov 23 04:02:50 2006
New Revision: 1640

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1640
Log:
* 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.

Modified:
    trunk/xpp/utils/genzaptelconf

Modified: trunk/xpp/utils/genzaptelconf
URL: http://svn.digium.com/view/zaptel/trunk/xpp/utils/genzaptelconf?view=diff&rev=1640&r1=1639&r2=1640
==============================================================================
--- trunk/xpp/utils/genzaptelconf (original)
+++ trunk/xpp/utils/genzaptelconf Thu Nov 23 04:02:50 2006
@@ -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 @@
 # - 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
@@ -110,6 +118,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
@@ -246,6 +264,7 @@
 # $1: channel number
 print_pattern() {
 	local astbank_type=''
+	local reset_values=""
 	OPTIND=1
 	while getopts 'a:' arg
 	do
@@ -303,10 +322,13 @@
 				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 @@
 				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 @@
 			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 @@
 			  *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 @@
 		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 @@
 	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 @@
 						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 @@
 					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 @@
 						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



More information about the svn-commits mailing list