[svn-commits] tzafrir: branch 1.4 r2065 - /branches/1.4/xpp/utils/genzaptelconf

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Jan 31 13:07:23 MST 2007


Author: tzafrir
Date: Wed Jan 31 14:07:23 2007
New Revision: 2065

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2065
Log:
Merging 1.2 changes of genzaptelconf:
 * -l (list) now works reliebly.
 * Cleared some leftover writes to standard output.
 * Fixed xpp spans sort order.

Modified:
    branches/1.4/xpp/utils/genzaptelconf

Modified: branches/1.4/xpp/utils/genzaptelconf
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/utils/genzaptelconf?view=diff&rev=2065&r1=2064&r2=2065
==============================================================================
--- branches/1.4/xpp/utils/genzaptelconf (original)
+++ branches/1.4/xpp/utils/genzaptelconf Wed Jan 31 14:07:23 2007
@@ -215,7 +215,9 @@
 	# Get a list of connected Astribank devices, sorted by the name of
 	# the USB connector. That order is rather arbitrary, but will not
 	# change without changes to the cabling.
-	xbusses=`sort -k 2 /proc/xpp/xbuses | awk -F: '/STATUS=connected/ {print $1}'`
+	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 "$xbusses"
 
 	# get a list of XPDs that were not yet registered as zaptel spans.
 	# this will be the case if you set the parameter zap_autoreg=0 to
@@ -290,7 +292,12 @@
 		;;
 	esac
 	case "$mode" in
-	list) echo $chan $sig $astbanktype;;
+	list)
+		case "$sig" in
+		fxs) sig_name=FXO;;
+		fxo) sig_name=FXS;;
+		esac
+		echo $chan $sig_name $astbank_type;;
 	files)
 		# sadly, both input ports and output ports go into the same span as 
 		# the FXS ports. Thus we need to separate between them. See also 
@@ -670,10 +677,15 @@
 		# the second line is empty
 		title=`head -n 1 $procfile`
 		# stuff that needs to be remembered accross lines (for PRI/BRI support)
-		echo ""         >>$zaptel_file
-		echo "# $title" >>$zaptel_file
-		echo ""         >>$zapata_file
-		echo "; $title" >>$zapata_file
+		case "$mode" in
+		list) echo "### $title";;
+		files)
+		  echo ""         >>$zaptel_file
+		  echo "# $title" >>$zaptel_file
+		  echo ""         >>$zapata_file
+		  echo "; $title" >>$zapata_file
+			;;
+		esac
 		echo '-1'  >$tmp_dir/span_begin
 		echo '-1'  >$tmp_dir/span_end
 		echo '0'   >$tmp_dir/span_timing
@@ -890,7 +902,7 @@
 							echo "context=$context_phones" >> $zapata_file
 						fi
 					else # we have may have set it. So reset it:
-						echo "callerid=asreceived"
+						echo "callerid=asreceived"       >> $zapata_file
 						reset_values="$reset_values callerid"
 						#echo "mailbox="
 						if [ "$group_manual" != "yes" ]
@@ -911,7 +923,10 @@
 				reset_zapata_entry $zapata_file $reset_values
 				;;
 			list)
-				echo BRI/PRI: chans: $bchans, control: $dchan
+				echo "### BRI/PRI: $span_termtype" 
+				echo "$bchans Data"
+				echo "$dchan Control"
+				#echo BRI/PRI: chans: $bchans, control: $dchan
 				;;
 			esac
 		fi
@@ -928,12 +943,12 @@
 EOF
 	fi
 	
-	mv ${ZAPCONF_FILE} ${ZAPCONF_FILE}.bak
-	mv $zaptel_file ${ZAPCONF_FILE}
-	mv ${ZAPATA_FILE} ${ZAPATA_FILE}.bak
-	mv $zapata_file ${ZAPATA_FILE}
-	# cleaning up the temp dir
-	if [ -d "$tmp_dir" ]; then rm -rf "$tmp_dir"; fi
+	if [ "$mode" = 'files' ]; then
+		mv ${ZAPCONF_FILE} ${ZAPCONF_FILE}.bak
+		mv $zaptel_file ${ZAPCONF_FILE}
+		mv ${ZAPATA_FILE} ${ZAPATA_FILE}.bak
+		mv $zapata_file ${ZAPATA_FILE}
+	fi
 }
 
 while getopts 'c:de:Fhlm:MRsuv' arg



More information about the svn-commits mailing list