[svn-commits] mattf: branch mattf/zaptel-hotwct4xxp r2390 - in /team/mattf/zaptel-hotwct4xx...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Apr 4 14:42:56 MST 2007


Author: mattf
Date: Wed Apr  4 16:42:55 2007
New Revision: 2390

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2390
Log:
Merged revisions 2309,2324,2332,2344,2349,2355-2357,2360,2382-2384 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/trunk

................
r2309 | mattf | 2007-03-14 10:11:22 -0600 (Wed, 14 Mar 2007) | 18 lines

Merged revisions 2308 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2308 | mattf | 2007-03-14 10:08:55 -0600 (Wed, 14 Mar 2007) | 10 lines

Merged revisions 2307 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2307 | mattf | 2007-03-14 10:03:18 -0600 (Wed, 14 Mar 2007) | 2 lines

Fix bug in J1 mode configuration.

........

................

................
r2324 | file | 2007-03-19 10:32:03 -0600 (Mon, 19 Mar 2007) | 18 lines

Merged revisions 2323 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2323 | file | 2007-03-19 12:30:37 -0400 (Mon, 19 Mar 2007) | 10 lines

Merged revisions 2322 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2322 | file | 2007-03-19 12:28:58 -0400 (Mon, 19 Mar 2007) | 2 lines

Update documentation to match current Makefile. linux26 is no longer a valid target. (issue #9296 reported by valley)

........

................

................
r2332 | tzafrir | 2007-03-22 01:01:21 -0600 (Thu, 22 Mar 2007) | 8 lines

* genzaptelconf -z will also generate the output of zapscan (The additional 
  /etc/asterisk/zapscan.conf the asterisk gui needs).
* Also put every digital span N in group 10+N (in addition to 0 / 5).
* Removed useless fxs/fxo-s lists, and other unused code.
* Add wcte12xp to the modules list. Prefer vzaphfc to zaphfc.
* Default to ptmp for zapbri signalling.
* Should be more readable.

................
r2344 | russell | 2007-03-27 12:50:56 -0600 (Tue, 27 Mar 2007) | 21 lines

Merged revisions 2343 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2343 | russell | 2007-03-27 13:49:01 -0500 (Tue, 27 Mar 2007) | 13 lines

Merged revisions 2342 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2342 | russell | 2007-03-27 13:48:23 -0500 (Tue, 27 Mar 2007) | 5 lines

When debug is enabled, ensure that "debug=1" gets passed to the zaptel module,
and not just the hardware modules.  Also, run "ztcfg -s" at the beginning of
the "stop" action of the script.
(issue #7409, PCadach and tzafrir)

........

................

................
r2349 | russell | 2007-03-29 10:07:03 -0600 (Thu, 29 Mar 2007) | 18 lines

Blocked revisions 2348 via svnmerge

................
r2348 | russell | 2007-03-29 11:06:28 -0500 (Thu, 29 Mar 2007) | 11 lines

Merged revisions 2347 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2347 | russell | 2007-03-29 11:05:32 -0500 (Thu, 29 Mar 2007) | 3 lines

Add a README for HPEC, and add support for HPEC in the init script.
(issue #9413, chozian)

........

................

................
r2355 | qwell | 2007-03-30 13:00:28 -0600 (Fri, 30 Mar 2007) | 20 lines

Merged revisions 2354 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r2354 | qwell | 2007-03-30 13:57:48 -0500 (Fri, 30 Mar 2007) | 12 lines

Merged revisions 2353 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2353 | qwell | 2007-03-30 13:56:46 -0500 (Fri, 30 Mar 2007) | 4 lines

Fix an issue where an echo can was freed incorrectly in certain circumstances.

Issue 9292, fix suggested by ddv2005.

........

................

................
r2356 | qwell | 2007-03-30 13:18:40 -0600 (Fri, 30 Mar 2007) | 2 lines

Need to revert this last change.  trunk doesn't yet have all the right stuff in place.

................
r2357 | qwell | 2007-03-30 13:19:13 -0600 (Fri, 30 Mar 2007) | 19 lines

Blocked revisions 2354 via svnmerge

................
r2354 | qwell | 2007-03-30 13:57:48 -0500 (Fri, 30 Mar 2007) | 12 lines

Merged revisions 2353 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r2353 | qwell | 2007-03-30 13:56:46 -0500 (Fri, 30 Mar 2007) | 4 lines

Fix an issue where an echo can was freed incorrectly in certain circumstances.

Issue 9292, fix suggested by ddv2005.

........

................

................
r2360 | mattf | 2007-03-30 15:07:03 -0600 (Fri, 30 Mar 2007) | 10 lines

Merged revisions 2359 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

........
r2359 | mattf | 2007-03-30 15:03:19 -0600 (Fri, 30 Mar 2007) | 2 lines

Fix potential spinlock recursion issue.

........

................
r2382 | russell | 2007-04-03 13:28:17 -0500 (Tue, 03 Apr 2007) | 2 lines

Improve the descriptions for things shown in menuselect.  (issue #9450, caio1982)

................
r2383 | qwell | 2007-04-03 14:08:30 -0500 (Tue, 03 Apr 2007) | 4 lines

Fix a couple of typos, and fix a small bug with remove_on_change for wct4xxp driver.

Try to get a little closer to the 1.4 version.

................
r2384 | russell | 2007-04-03 18:39:58 -0500 (Tue, 03 Apr 2007) | 5 lines

The ZT_CHANDIAG ioctl was disabled by default because the large zt_chan struct
that was being allocated on the stack is too big for some systems (those with
4k stacks).  So, change the code to allocate the struct on the heap, and let
the ioctl be always enabled.  (issue #9364, patch by tzafrir, with minor mods)

................

Modified:
    team/mattf/zaptel-hotwct4xxp/   (props changed)
    team/mattf/zaptel-hotwct4xxp/README.Linux26
    team/mattf/zaptel-hotwct4xxp/wct4xxp/base.c
    team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf
    team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf.8
    team/mattf/zaptel-hotwct4xxp/zaptel.c
    team/mattf/zaptel-hotwct4xxp/zaptel.init
    team/mattf/zaptel-hotwct4xxp/zaptel.xml

Propchange: team/mattf/zaptel-hotwct4xxp/
            ('branch-1.2-merged' removed)

Propchange: team/mattf/zaptel-hotwct4xxp/
------------------------------------------------------------------------------
--- branch-1.4-blocked (original)
+++ branch-1.4-blocked Wed Apr  4 16:42:55 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1889,2271,2297
+/branches/1.4:1889,2271,2297,2348,2354

Propchange: team/mattf/zaptel-hotwct4xxp/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/mattf/zaptel-hotwct4xxp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr  4 16:42:55 2007
@@ -1,1 +1,1 @@
-/trunk:1-2305
+/trunk:1-2389

Modified: team/mattf/zaptel-hotwct4xxp/README.Linux26
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/README.Linux26?view=diff&rev=2390&r1=2389&r2=2390
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/README.Linux26 (original)
+++ team/mattf/zaptel-hotwct4xxp/README.Linux26 Wed Apr  4 16:42:55 2007
@@ -4,7 +4,7 @@
 can create the symlink to /lib/modules/`uname -r`/build/ and then 
 you can type:
 
-# make linux26
+# make
 # make install
 
 Note that you will also need CRC-CCITT functions compiled

Modified: team/mattf/zaptel-hotwct4xxp/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/wct4xxp/base.c?view=diff&rev=2390&r1=2389&r2=2390
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/wct4xxp/base.c (original)
+++ team/mattf/zaptel-hotwct4xxp/wct4xxp/base.c Wed Apr  4 16:42:55 2007
@@ -965,7 +965,7 @@
 	struct t4_span *ts = wc->tspans[span];
 
 	oldnotclear = ts->notclear;
-	if (ts->spantype == TYPE_T1) {
+	if ((ts->spantype == TYPE_T1) || (ts->spantype == TYPE_J1)) {
 		for (i=0;i<24;i++) {
 			j = (i/8);
 			if (ts->span.chans[i].flags & ZT_FLAG_CLEAR) {

Modified: team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf?view=diff&rev=2390&r1=2389&r2=2390
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf (original)
+++ team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf Wed Apr  4 16:42:55 2007
@@ -34,7 +34,7 @@
 # (redhat/centos)
 
 # /etc/default/zaptel may override the following variables
-VERSION=0.5.8
+VERSION=0.5.10
 rcsid='$Id$'
 lc_country=us
 # set to: ls, ks or gs for (Loopstart, Kewlstart and GroundStart)
@@ -59,6 +59,7 @@
 ZAPCONF_FILE=${ZAPCONF_FILE:-/etc/zaptel.conf}
 ZAPCONF_FILE_SYSTEM=$ZAPCONF_FILE
 ZAPATA_FILE=${ZAPATA_FILE:-/etc/asterisk/zapata-channels.conf}
+ZAPSCAN_FILE=${ZAPSCAN_FILE:-/etc/asterisk/zapscan.conf}
 ZAPTEL_BOOT_DEBIAN=${ZAPTEL_BOOT_DEBIAN:-/etc/default/zaptel}
 ZAPTEL_BOOT_FEDORA=${ZAPTEL_BOOT_FEDORA:-/etc/sysconfig/zaptel}
 MODLIST_FILE=/etc/modules
@@ -68,6 +69,9 @@
 # how long to wait for /dev/zap/ctl to appear? (seconds)
 DEVZAP_TIMEOUT=${DEVZAP_TIMEOUT:-20}
 ZTCFG=${ZTCFG:-/sbin/ztcfg}
+# BRI/PRI spans will be in an additional per-span group whose number
+# is SPAN_GROUP_BASE + span-number
+SPAN_GROUP_BASE=10
 
 # a temporary directory to store whatever we need to remember.
 #
@@ -77,14 +81,14 @@
 # A list of all modules:
 # - the list of modules which will be probed (in this order) if -d is used
 # - 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"
+ALL_MODULES="vzaphfc zaphfc qozap ztgsm wctdm wctdm24xxp wcfxo wcfxs pciradio tor2 torisa wcte12xp 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=bri
+ZAPBRI_SIGNALLING=bri_ptmp
 #ZAPBRI_SIGNALLING=pri
 
 # read default configuration from /etc/default/zaptel
@@ -115,6 +119,7 @@
 verbose=no
 do_restart=yes
 fxsdisable=no
+do_gen_zapscan=no
 
 span_te_timing_counter=1
 
@@ -123,7 +128,7 @@
 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"
+	echo >&2 "Incorrect value for ZAPBRI_SIGNALLING ($ZAPBRI_SIGNALLING). Abortring"
 	exit 1
 	;;
 esac
@@ -146,10 +151,10 @@
 	# no point waiting.
 	if [ -c /dev/zap/ctl ] || ! grep -q zaptel /proc/modules ; then
 	  return
-  fi
-  say "Waiting for /dev/zap/ctl to be generated"
-  devzap_found=0
-  for i in `seq $DEVZAP_TIMEOUT`; do
+	fi
+	say "Waiting for /dev/zap/ctl to be generated"
+	devzap_found=0
+	for i in `seq $DEVZAP_TIMEOUT`; do
 		sleep 1
 		if [ -c /dev/zap/ctl ]; then
 		  devzap_found=1
@@ -157,8 +162,8 @@
 		fi
 	done
 	if [ "$devzap_found" != 1 ]; then
-	  say "Still no /dev/zap/ctl after $devzap_timeout seconds."
-	  echo >&2 "No /dev/zap/ctl: cannot run ztcfg. Aborting."
+		say "Still no /dev/zap/ctl after $devzap_timeout seconds."
+		echo >&2 "No /dev/zap/ctl: cannot run ztcfg. Aborting."
 	fi
 }
 
@@ -198,9 +203,9 @@
 
 update_module_list() {
   if   [ -f "$MODLIST_FILE" ]; then
-	  update_module_list_debian "$@"
+		update_module_list_debian "$@"
 	elif [ -f "$MODLIST_FILE_FEDORA" ]; then
-	  update_module_list_fedora "$@"
+		update_module_list_fedora "$@"
 	else
 	  die "Can't find a modules list to update. Tried: $MODLIST_FILE, $MODLIST_FILE_FEDORA. Aborting"
 	fi
@@ -251,6 +256,20 @@
 	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."
+	echo >&2 "  -z: also generate zapscan.conf for the asterisk GUI."
+}
+
+# print /etc/asterisk/zapscan.conf for the Asterisk-GUI
+# $1: port type. Currently only fxs/fxo . Note that this is the type, and
+#                not the signalling (which would be the fxo fir an fxs port.
+# $2: port number. Probably a range of ports is also allowed.
+print_zapscan_port () {
+	if [ "$do_gen_zapscan" != 'yes' ]; then return 0; fi
+
+	echo "
+[$2]
+port=$1
+"	>>$zapscan_file
 }
 
 # $1: channel number
@@ -286,12 +305,12 @@
 	else
 		method="$fxs_default_start"
 	fi
+	case "$sig" in
+	fxs) sig_name=FXO; sig_name_sc=fxo ;;
+	fxo) sig_name=FXS; sig_name_sc=fxs ;;
+	esac
 	case "$mode" in
 	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 
@@ -400,18 +419,7 @@
 		reset_zapata_entry $zapata_file $reset_values
 		echo ""                                          >> $zapata_file
 
-		# Keep a note of what channels we have identified
-		say "DEBUG: adding to channels list: channel: $chan, sig: $sig"
-		case "$sig" in
-		fxs)
-			echo $chan >$tmp_dir/fxo_$chan
-			say "DEBUG: FXO list now contains: `cat $tmp_dir/fxo_* |xargs`"
-			;;
-		fxo)
-			echo $chan >$tmp_dir/fxs_$chan
-			say "DEBUG: FXS list now contains: `cat $tmp_dir/fxs_* |xargs`"
-			;;
-		esac
+		print_zapscan_port "$sig_name_sc" "$chan"
 		;;
 	esac
 	
@@ -552,32 +560,6 @@
 	esac
 }
 
-# TODO: kill this function. It is now unreferenced from anywhere.
-check_tdm_sigtype() {
-	chan_num=$1
-	sig_type=$2
-	mode=$3
-	
-	case "$sig_type" in
-	fxs)chan_sig_type=fxo;;
-	fxo)chan_sig_type=fxs;;
-	esac
-
-#	print_pattern $chan_num $chan_sig_type $mode
-	
-  # if you get syntax error from this line, make sure you use 'bash' 
-  # rather than 'sh'
-	$ztcfg_cmd -c <(print_pattern $chan_num $chan_sig_type zaptel) 2>/dev/null  \
-		|| return 1
-	if head -c1 /dev/zap/$chan_num >/dev/null 2>/dev/null
-	then 
-		print_pattern $chan_num $chan_sig_type $mode
-		return 0
-	else
-		return 1
-	fi	
-}
-
 # run after the channel's entry. Used to reset all the values 
 reset_zapata_entry() {
 	conf_file="$1"; shift
@@ -595,12 +577,215 @@
 }
 
 
+# we need to preserve the permissions of existing configurations files.
+# However we also don't want to be left with incomplete configurations in 
+# case we are stopped in the middle. Thus we create a temporary file and
+# mv it to the original file only when done.
+#
+# This function gives the temporary file the permissions of the original,
+# or some sane defaults.
+#
+# The temporary file is generated here, and ths its name is passed through
+# a variable whose name is passed as a parameter (new_var).
+#
+# $1: orig_cfg_file
+# $2: new_var
+gen_tmp_conf() {
+	orig_cfg_file=$1
+	new_var=$2
+
+	eval $new_var=`mktemp -t genzaptelconf-zapata-XXXXXX` # assign by reference
+	if [ -r "$orig_cfg_file" ]; then
+		chown --reference="$orig_cfg_file" ${!new_var} 2>/dev/null
+		chmod --reference="$orig_cfg_file" ${!new_var} 2>/dev/null  
+	else
+		chmod 644 ${!new_var}
+	fi
+}
+
+# Extract information from one digital channel (one line in a /proc/zaptel 
+# file). Information is saved to $tmp_dir/span_foo variables.
+detect_digital_channel() {
+	line="$1"
+	chan_num="$2"
+	span_num="$3"
+
+	# PRI/BRI channel
+	# Rather than identifying cards by the header line, we identify 
+	# them by the channel names. This is shorter. 
+	# This also allows us to count the channel numbers and check if 
+	# we have a E1 span, a T1 span or a BRI span.
+	if [ "`cat $tmp_dir/span_begin`" = "-1" ]
+	then
+		echo $chan_num      >$tmp_dir/span_begin
+		echo $span_num      >$tmp_dir/span_num
+		# The Astribank channels provide the information of TE/NT in the channel name. So 
+		# why not use it?
+		case "$line" in
+		*XPP_BRI_TE/*) echo 'te' >$tmp_dir/span_termtype;;
+		*XPP_BRI_NT/*) echo 'nt' >$tmp_dir/span_termtype;;
+		esac
+		case "$line" in
+		*ZTHFC*/*|*ztqoz*/*|*XPP_BRI_*/*)
+			# BRI channel
+			echo 'ccs'          >$tmp_dir/span_framing
+			echo 'euroisdn'     >$tmp_dir/span_switchtype
+			if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ]
+			then
+				echo $ZAPBRI_NET >$tmp_dir/span_signalling 
+			else
+				echo $ZAPBRI_CPE >$tmp_dir/span_signalling
+			fi
+			;;
+		*ztgsm*/*)
+			# Junghanns's GSM cards. 
+			echo 'ccs'          >$tmp_dir/span_framing
+			#Does this mean anything?
+			echo 'gsm'          >$tmp_dir/span_signalling
+			;;
+		*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*WP[TE]1/*)
+			# PRI span (E1/T1)
+			echo 'esf'       >$tmp_dir/span_framing
+			echo 'b8zs'      >$tmp_dir/span_coding
+			echo 'national'  >$tmp_dir/span_switchtype
+			echo 'pri_cpe'   >$tmp_dir/span_signalling
+			# an example of country-specific setup. This is probably not accurate
+			# Contributions are welcome
+			case "$lc_country" in 
+			nl)
+				# (Just an example for per-country info)
+				echo 'ccs'       >$tmp_dir/span_framing
+				echo 'ami'       >$tmp_dir/span_coding
+				#echo 'crc4'      >$tmp_dir/span_yellow
+				#echo 'euroisdn'  >$tmp_dir/span_switchtype
+				#echo 'pri_cpe'   >$tmp_dir/span_signalling
+				;;
+			il|de|au)
+				echo 'ccs'       >$tmp_dir/span_framing
+				echo 'hdb3'      >$tmp_dir/span_coding
+				echo 'crc4'      >$tmp_dir/span_yellow
+				echo 'euroisdn'  >$tmp_dir/span_switchtype
+				;;
+			cl)
+				echo 'ccs'       >$tmp_dir/span_framing
+				echo 'hdb3'      >$tmp_dir/span_coding
+				#echo 'crc4'      >$tmp_dir/span_yellow
+				echo 'national'  >$tmp_dir/span_switchtype
+				;;
+			esac
+		;;
+		esac
+	fi
+	# span_lastd is always the one before last 
+	# channel. span_bchan is the last:
+	echo $chan_num      >$tmp_dir/span_end
+}
+
+# read information from the $tmp_dir/span_foo files and generate 
+# configuration for the span and its channels.
+write_digital_config() {
+	# if the current file we checked was not of a digital span, we have
+	# nothing to do:
+	if [ "`cat $tmp_dir/span_begin`" = -1 ]; then return; fi
+
+	# read files to variables:
+	for suffix in num begin end timing lbo framing \
+		coding switchtype signalling yellow termtype
+	do
+		eval span_$suffix=`cat $tmp_dir/span_$suffix 2>/dev/null`
+	done
+
+	if [ "$span_yellow" != '' ]; then span_yellow=",$span_yellow"; fi
+	# exactly the same logic is used in asterisk's chan_zap.c.
+	# also not that $(( )) is bash-specific
+	case "$((1+ $span_end - $span_begin))" in
+	2|3|24) #ztgsm, BRI or T1
+		dchan=$span_end
+		bchans="$span_begin-$(($span_end-1))"
+		;;
+	31) #E1
+		dchan="$(($span_begin+15))"
+		bchans="$span_begin-$(($span_begin+14)),$(($span_begin+16))-$span_end"
+		if [ "$span_switchtype" = 'national' ]; then
+			# don't leave an E1 span with defective defaults:
+			span_framing=ccs
+			span_coding=hdb3
+			span_switchtype=euroisdn
+		fi
+		;;
+	esac
+	# Let's assume that a TE span should get the clock from the remote unit,
+	# and NT spans should provide timing. Just as a sane default.
+	# If we have several TE spans, the first will have priority 1, 
+	# second: 2, etc.
+	case "$span_signalling" in *_cpe*)
+		span_timing=$span_te_timing_counter
+		span_te_timing_counter=$(($span_te_timing_counter + 1))
+		;;
+	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
+		# this span is TE or NT:
+		if [ "$span_termtype" != '' ]
+		then echo "# termtype: $span_termtype" >>$zaptel_file
+		fi
+		echo bchan=$bchans >>$zaptel_file
+		echo dchan=$dchan  >>$zaptel_file
+		span_group=$(($SPAN_GROUP_BASE + $span_num))
+		
+		if [ "$span_termtype" != '' ]
+		then
+			# an ISDN card's span that we know if it is in NT mode or TE mode.
+			# NT is the same as FXS for us and TE is the same as FXO
+			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,$span_group"     >> $zapata_file
+					reset_values="$reset_values group"
+				fi
+				if [ "$context_manual" != "yes" ]
+				then 
+					echo "context=$context_phones" >> $zapata_file
+				fi
+			else 
+				#echo "mailbox="
+				if [ "$group_manual" != "yes" ]
+				then 
+					echo "group=$group_lines,$span_group"      >> $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
+		reset_values=
+		;;
+	list)
+		echo "### BRI/PRI: $span_termtype" 
+		echo "$bchans Data"
+		echo "$dchan Control"
+		#echo BRI/PRI: chans: $bchans, control: $dchan
+		;;
+	esac
+}
+
+# This is where the actual detection configuration detection work happens.
 genconf() {
 	local mode=$1
 	local reset_values=""
-	# reset FXO list (global)
-	#say "DEBUG: resetting channels lists"
-	rm -f $tmp_dir/fx{s,o}_*
 
 # 	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)
@@ -613,22 +798,20 @@
 
 
 	case "$mode" in 
-		files)
-			local zaptel_file=`mktemp -t genzaptelconf-zaptel-XXXXXX`
-			local zapata_file=`mktemp -t genzaptelconf-zapata-XXXXXX`
-			if [ -r "${ZAPCONF_FILE}" ]; then
-				chown --reference="${ZAPCONF_FILE}" $zaptel_file || true
-				chmod --reference="${ZAPCONF_FILE}" $zaptel_file 
-			else
-				chmod 644 $zaptel_file 
-			fi
-			if [ -r "${ZAPATA_FILE}" ]; then
-				chown --reference="${ZAPATA_FILE}" $zapata_file || true
-				chmod --reference="${ZAPATA_FILE}" $zapata_file 
-			else
-				chmod 644 $zapata_file 
-			fi
-			cat <<EOF >$zaptel_file
+	files)
+		if [ "$do_gen_zapscan" = 'yes' ]; then
+			gen_tmp_conf "$ZAPSCAN_FILE" zapscan_file
+			cat <<EOF >$zapscan_file
+; zapscan.conf: information about detected zaptel channels
+; (currently: analog only)
+;
+; Automatically generated by $0 -- Please do not edit.
+
+EOF
+		fi
+		gen_tmp_conf "$ZAPTEL_FILE" zaptel_file
+		gen_tmp_conf "$ZAPATA_FILE" zapata_file
+		cat <<EOF >$zaptel_file
 # Autogenerated by $0 -- do not hand edit
 # Zaptel Configuration File
 #
@@ -638,7 +821,7 @@
 # It must be in the module loading order
 
 EOF
-			cat <<EOF >$zapata_file
+		cat <<EOF >$zapata_file
 ; Autogenerated by $0 -- do not hand edit
 ; Zaptel Channels Configurations (zapata.conf)
 ;
@@ -672,10 +855,10 @@
 		case "$mode" in
 		list) echo "### $title";;
 		files)
-		  echo ""         >>$zaptel_file
-		  echo "# $title" >>$zaptel_file
-		  echo ""         >>$zapata_file
-		  echo "; $title" >>$zapata_file
+			echo ""         >>$zaptel_file
+			echo "# $title" >>$zaptel_file
+			echo ""         >>$zapata_file
+			echo "; $title" >>$zapata_file
 			;;
 		esac
 		echo '-1'  >$tmp_dir/span_begin
@@ -749,74 +932,7 @@
 				print_pattern -a input $chan_num fxo $mode
 				;;
 			*ZTHFC*/*|*ztqoz*/*|*ztgsm/*|*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*XPP_BRI_*/*|*WP[TE]1/*)
-				# PRI/BRI channel
-				# Rather than identifying cards by the header line, we identify them by the channel names
-				# This is shorter. This also allows us to count the channel numbers and check if a PRI
-				# card is E1 or T1.
-				if [ "`cat $tmp_dir/span_begin`" = "-1" ]
-				then
-					echo $chan_num      >$tmp_dir/span_begin
-					echo $span_num      >$tmp_dir/span_num
-					# The Astribank channels provide the information of TE/NT in the channel name. So 
-					# why not use it?
-					case "$line" in
-					*XPP_BRI_TE/*) echo 'te' >$tmp_dir/span_termtype;;
-					*XPP_BRI_NT/*) echo 'nt' >$tmp_dir/span_termtype;;
-					esac
-					case "$line" in
-					*ZTHFC*/*|*ztqoz*/*|*XPP_BRI_*/*)
-						# BRI channel
-						echo 'ccs'          >$tmp_dir/span_framing
-						echo 'euroisdn'     >$tmp_dir/span_switchtype
-						if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ]
-						then
-							echo $ZAPBRI_NET >$tmp_dir/span_signalling 
-						else
-							echo $ZAPBRI_CPE >$tmp_dir/span_signalling
-						fi
-						;;
-					*ztgsm*/*)
-						# Junghanns's GSM cards. 
-						echo 'ccs'          >$tmp_dir/span_framing
-            # what switch type? Any meaning to it?
-						echo 'gsm'          >$tmp_dir/span_signalling
-						;;
-					*TE[24]/*|*WCT1/*|*Tor2/*|*TorISA/*|*WP[TE]1/*)
-						# PRI span (E1/T1)
-						echo 'esf'       >$tmp_dir/span_framing
-						echo 'b8zs'      >$tmp_dir/span_coding
-						echo 'national'  >$tmp_dir/span_switchtype
-						echo 'pri_cpe'   >$tmp_dir/span_signalling
-						# an example of country-specific setup. This is probably not accurate
-						# Contributions are welcome
-						case "$lc_country" in 
-						nl)
-							# (Just an example for per-country info)
-							echo 'ccs'       >$tmp_dir/span_framing
-							echo 'ami'       >$tmp_dir/span_coding
-							#echo 'crc4'      >$tmp_dir/span_yellow
-							#echo 'euroisdn'  >$tmp_dir/span_switchtype
-							#echo 'pri_cpe'   >$tmp_dir/span_signalling
-							;;
-						il|de|au)
-							echo 'ccs'       >$tmp_dir/span_framing
-							echo 'hdb3'      >$tmp_dir/span_coding
-							echo 'crc4'      >$tmp_dir/span_yellow
-							echo 'euroisdn'  >$tmp_dir/span_switchtype
-							;;
-						cl)
-							echo 'ccs'       >$tmp_dir/span_framing
-							echo 'hdb3'      >$tmp_dir/span_coding
-							#echo 'crc4'      >$tmp_dir/span_yellow
-							echo 'national'  >$tmp_dir/span_switchtype
-							;;
-						esac
-					;;
-					esac
-				fi
-				# span_lastd is always the one before last 
-				# channel. span_bchan is the last:
-				echo $chan_num      >$tmp_dir/span_end
+				detect_digital_channel "$line" "$chan_num" "$span_num"
 				;;
 			'') ;;		# Empty line (after span header)
 			*) 
@@ -831,97 +947,7 @@
 		done
 		# end of part in sub-process.
 		
-		if [ "`cat $tmp_dir/span_begin`" != -1 ]
-		then # write PRI span ocnfig:
-			# read files to variables:
-			for suffix in num begin end timing lbo framing \
-				coding switchtype signalling yellow termtype
-			do
-				eval span_$suffix=`cat $tmp_dir/span_$suffix 2>/dev/null`
-			done
-			if [ "$span_yellow" != '' ]; then span_yellow=",$span_yellow"; fi
-			# exactly the same logic is used in asterisk's chan_zap.c.
-			# also not that $(( )) is bash-specific
-			case "$((1+ $span_end - $span_begin))" in
-			2|3|24) #ztgsm, BRI or T1
-			  dchan=$span_end
-				bchans="$span_begin-$(($span_end-1))"
-				;;
-			31) #E1
-				dchan="$(($span_begin+15))"
-				bchans="$span_begin-$(($span_begin+14)),$(($span_begin+16))-$span_end"
-				if [ "$span_switchtype" = 'national' ]; then
-					span_framing=ccs
-					span_coding=hdb3
-					span_switchtype=euroisdn
-				fi
-				;;
-			esac
-			# Let's assume that a TE span should get the clock from the remote unit,
-			# and NT spans should provide timing. Just as a sane default.
-			# If we have several TE spans, the first will have priority 1, 
-			# second: 2, etc.
-			case "$span_signalling" in *_cpe*)
-				span_timing=$span_te_timing_counter
-				span_te_timing_counter=$(($span_te_timing_counter + 1))
-				;;
-			esac
-			case "$mode" in
-			files)
-				echo span=$span_num,$span_timing,$span_lbo,$span_framing,$span_coding$span_yellow >> $zaptel_file
-				if [ "$span_termtype" != '' ]
-				then echo "# termtype: $span_termtype" >>$zaptel_file
-				fi
-				echo bchan=$bchans >>$zaptel_file
-				echo dchan=$dchan  >>$zaptel_file
-				
-				if [ "$span_termtype" != '' ]
-				then
-					# an ISDN card's span that we know if it is in NT mode or TE mode.
-					# NT is the same as FXS for us and TE is the same as FXO
-					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 
-							echo "context=$context_phones" >> $zapata_file
-						fi
-					else # we have may have set it. So reset it:
-						echo "callerid=asreceived"       >> $zapata_file
-						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: $span_termtype" 
-				echo "$bchans Data"
-				echo "$dchan Control"
-				#echo BRI/PRI: chans: $bchans, control: $dchan
-				;;
-			esac
-		fi
+		write_digital_config
 	done
 
 	if [ "$mode" = 'files' ]
@@ -936,14 +962,18 @@
 	fi
 	
 	if [ "$mode" = 'files' ]; then
-		mv ${ZAPCONF_FILE} ${ZAPCONF_FILE}.bak
+		mv ${ZAPCONF_FILE} ${ZAPCONF_FILE}.bak 2>/dev/null
 		mv $zaptel_file ${ZAPCONF_FILE}
-		mv ${ZAPATA_FILE} ${ZAPATA_FILE}.bak
+		mv ${ZAPATA_FILE} ${ZAPATA_FILE}.bak 2>/dev/nullk
 		mv $zapata_file ${ZAPATA_FILE}
-	fi
-}
-
-while getopts 'c:de:Fhlm:MRsuv' arg
+		if [ "$do_gen_zapscan" = 'yes' ]; then
+			mv $ZAPSCAN_FILE $ZAPSCAN_FILE.bak 2>/dev/null 
+			mv $zapscan_file $ZAPSCAN_FILE
+		fi
+	fi
+}
+
+while getopts 'c:de:Fhlm:MRsuvz' arg
 do
 	case "$arg" in
 		e) # guarantee that it is a number:
@@ -959,6 +989,7 @@
 		M) do_module_list=yes; do_detect=yes ;;
 		s) force_stop_ast=yes ;;
 		R) do_restart=no ;;
+		z) do_gen_zapscan=yes ;;
 		h) usage; exit 0;;
 		*) echo >&2 "unknown parameter -$arg, Aborting"; usage; exit 1;;
 	esac
@@ -991,14 +1022,14 @@
 # make sure asterisk is not in our way
 if [ "$force_stop_ast" = 'yes' ]
 then
-  /etc/init.d/asterisk stop 1>&2
+	/etc/init.d/asterisk stop 1>&2
 else
   # if asterisk is running and we wanted to detect modules
 	# or simply to unload modules, asterisk needs to go away.
 	if ( [ "$do_unload" = yes ] || [ "$do_detect" = yes ] ) && \
-	  pidof asterisk >/dev/null 
+		pidof asterisk >/dev/null 
 	then
-	  echo >&2 "Asterisk is already running. Configuration left untouched"
+		echo >&2 "Asterisk is already running. Configuration left untouched"
 		echo >&2 "You can use the option -s to shut down Asterisk for the"
 		echo >&2 "duration of the detection."
 		exit 1
@@ -1028,17 +1059,17 @@
 
 if [ "$tmp_dir" != '' ]
 then
-  rm -rf "$tmp_dir"
+	rm -rf "$tmp_dir"
 fi
 
 if [ "$force_stop_ast" != 'yes' ] || [ "$do_restart" != 'yes' ]
 then
-  exit 0
+	exit 0
 fi
 
 if [ -x /etc/init.d/asterisk ]
 then
-  /etc/init.d/asterisk start 1>&2
+	/etc/init.d/asterisk start 1>&2
 fi
 
 # if in verbose mode: verify that asterisk is running
@@ -1054,4 +1085,4 @@
 	fi
 fi
 
-# vim:ts=2:
+# vim:ts=8:

Modified: team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf.8
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf.8?view=diff&rev=2390&r1=2389&r2=2390
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf.8 (original)
+++ team/mattf/zaptel-hotwct4xxp/xpp/utils/genzaptelconf.8 Wed Apr  4 16:42:55 2007
@@ -5,7 +5,7 @@
 .SH SYNOPSIS
 .PP 
 .B genzaptelconf 
-[-sRdv] [-c <country_code>] [-e <base_exten>] [ -F ]
+[-sRdvzF] [-c <country_code>] [-e <base_exten>]
 
 .B genzaptelconf 
 [-sRdv] -l -- only list to standard output
@@ -27,7 +27,7 @@
 .I PRI
 and 
 .I BRI
-(HFC, with ZapBRI) cards are basically identified as well. However the span
+(with ZapBRI) cards are basically identified as well. However the span
 configiration is a default that I only hope is sane. Looking for feedback
 
 .SH OPTIONS
@@ -126,6 +126,14 @@
 is used. Lists detected channls. In the end tries to connect to asterisk
 to get a list of configured zaptel channels.
 .RE
+
+.B -z
+.RS
+emulate the operation of zapscan.bin: generate 
+.I /etc/asterisk/zapscan.conf
+with the results of the scan.
+.RE
+
 .SH CONFIGURATION
 Look at the beginning of the script for a number of variables that can 
 be overriden through the configuraion file. Some variables can also be 

Modified: team/mattf/zaptel-hotwct4xxp/zaptel.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/zaptel.c?view=diff&rev=2390&r1=2389&r2=2390
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/zaptel.c (original)
+++ team/mattf/zaptel-hotwct4xxp/zaptel.c Wed Apr  4 16:42:55 2007
@@ -2943,10 +2943,8 @@
 	struct zt_chan *chan;
 	unsigned long flags;
 	unsigned char *txgain, *rxgain;
-#ifdef ALLOW_CHAN_DIAG
 	/* This structure is huge and will bork a 4k stack */
-	struct zt_chan mychan;
-#endif	
+	struct zt_chan *mychan;
 	int i,j;
 	int return_master = 0;
 
@@ -3156,57 +3154,62 @@
 		if (copy_to_user((struct zt_spaninfo *) data,&stack.span,sizeof(stack.span)))
 			return -EFAULT;
 		break;
-#ifdef ALLOW_CHAN_DIAG
 	case ZT_CHANDIAG:
 		get_user(j, (int *)data); /* get channel number from user */
 		/* make sure its a valid channel number */
 		if ((j < 1) || (j >= maxchans))
 			return -EINVAL;
 		/* if channel not mapped, not there */
-		if (!chans[j]) return -EINVAL;
-		/* lock irq state */
+		if (!chans[j]) 
+			return -EINVAL;
+
+		if (!(mychan = kmalloc(sizeof(*mychan), GFP_KERNEL)))
+			return -ENOMEM;
+
+		/* lock channel */
 		spin_lock_irqsave(&chans[j]->lock, flags);
 		/* make static copy of channel */
-		memcpy(&mychan,chans[j],sizeof(struct zt_chan));
-		/* let irq's go */
+		memcpy(mychan, chans[j], sizeof(*mychan));
+		/* release it. */
 		spin_unlock_irqrestore(&chans[j]->lock, flags);
+
 		printk("Dump of Zaptel Channel %d (%s,%d,%d):\n\n",j,
-			mychan.name,mychan.channo,mychan.chanpos);
+			mychan->name,mychan->channo,mychan->chanpos);
 		printk("flags: %x hex, writechunk: %08lx, readchunk: %08lx\n",
-			mychan.flags, (long) mychan.writechunk, (long) mychan.readchunk);
+			mychan->flags, (long) mychan->writechunk, (long) mychan->readchunk);
 		printk("rxgain: %08lx, txgain: %08lx, gainalloc: %d\n",
-			(long) mychan.rxgain, (long)mychan.txgain, mychan.gainalloc);
+			(long) mychan->rxgain, (long)mychan->txgain, mychan->gainalloc);
 		printk("span: %08lx, sig: %x hex, sigcap: %x hex\n",
-			(long)mychan.span, mychan.sig, mychan.sigcap);
+			(long)mychan->span, mychan->sig, mychan->sigcap);
 		printk("inreadbuf: %d, outreadbuf: %d, inwritebuf: %d, outwritebuf: %d\n",
-			mychan.inreadbuf, mychan.outreadbuf, mychan.inwritebuf, mychan.outwritebuf);
+			mychan->inreadbuf, mychan->outreadbuf, mychan->inwritebuf, mychan->outwritebuf);
 		printk("blocksize: %d, numbufs: %d, txbufpolicy: %d, txbufpolicy: %d\n",
-			mychan.blocksize, mychan.numbufs, mychan.txbufpolicy, mychan.rxbufpolicy);
+			mychan->blocksize, mychan->numbufs, mychan->txbufpolicy, mychan->rxbufpolicy);
 		printk("txdisable: %d, rxdisable: %d, iomask: %d\n",
-			mychan.txdisable, mychan.rxdisable, mychan.iomask);
+			mychan->txdisable, mychan->rxdisable, mychan->iomask);
 		printk("curzone: %08lx, tonezone: %d, curtone: %08lx, tonep: %d\n",
-			(long) mychan.curzone, mychan.tonezone, (long) mychan.curtone, mychan.tonep);
+			(long) mychan->curzone, mychan->tonezone, (long) mychan->curtone, mychan->tonep);
 		printk("digitmode: %d, txdialbuf: %s, dialing: %d, aftdialtimer: %d, cadpos. %d\n",
-			mychan.digitmode, mychan.txdialbuf, mychan.dialing,
-				mychan.afterdialingtimer, mychan.cadencepos);
+			mychan->digitmode, mychan->txdialbuf, mychan->dialing,
+				mychan->afterdialingtimer, mychan->cadencepos);
 		printk("confna: %d, confn: %d, confmode: %d, confmute: %d\n",
-			mychan.confna, mychan._confn, mychan.confmode, mychan.confmute);
+			mychan->confna, mychan->_confn, mychan->confmode, mychan->confmute);
 		printk("ec: %08lx, echocancel: %d, deflaw: %d, xlaw: %08lx\n",
-			(long) mychan.ec, mychan.echocancel, mychan.deflaw, (long) mychan.xlaw);
+			(long) mychan->ec, mychan->echocancel, mychan->deflaw, (long) mychan->xlaw);
 		printk("echostate: %02x, echotimer: %d, echolastupdate: %d\n",
-			(int) mychan.echostate, mychan.echotimer, mychan.echolastupdate);
+			(int) mychan->echostate, mychan->echotimer, mychan->echolastupdate);
 		printk("itimer: %d, otimer: %d, ringdebtimer: %d\n\n",
-			mychan.itimer,mychan.otimer,mychan.ringdebtimer);
+			mychan->itimer, mychan->otimer, mychan->ringdebtimer);
 #if 0
-		if (mychan.ec) {
+		if (mychan->ec) {
 			int x;
 			/* Dump the echo canceller parameters */
-			for (x=0;x<mychan.ec->taps;x++) {
-				printk("tap %d: %d\n", x, mychan.ec->fir_taps[x]);
-			}
-		}
-#endif
-#endif /* ALLOW_CHAN_DIAG */
+			for (x=0;x<mychan->ec->taps;x++) {
+				printk("tap %d: %d\n", x, mychan->ec->fir_taps[x]);
+			}
+		}
+#endif
+		kfree(mychan);
 		break;
 	default:
 		return -ENOTTY;
@@ -6260,6 +6263,22 @@
 	__putbuf_chunk(ss, rxb, ZT_CHUNKSIZE);
 }
 
+extern void __zt_hdlc_abort(struct zt_chan *ss, int event)
+{
+	if (ss->inreadbuf >= 0)
+		ss->readidx[ss->inreadbuf] = 0;
+	if ((ss->flags & ZT_FLAG_OPEN) && !ss->span->alarms)
+		__qevent(ss->master, event);
+}
+
+extern void zt_hdlc_abort(struct zt_chan *ss, int event)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&ss->lock, flags);
+	__zt_hdlc_abort(ss, event);
+	spin_unlock_irqrestore(&ss->lock, flags);
+}
+
 extern void zt_hdlc_putbuf(struct zt_chan *ss, unsigned char *rxb, int bytes)
 {
 	unsigned long flags;
@@ -6289,20 +6308,9 @@
 #ifdef CONFIG_ZAPATA_DEBUG
 		printk("HDLC frame isn't fit into buffer space\n");
 #endif
-		zt_hdlc_abort(ss, ZT_EVENT_OVERRUN);
+		__zt_hdlc_abort(ss, ZT_EVENT_OVERRUN);
 	}
 	res = left;
-	spin_unlock_irqrestore(&ss->lock, flags);
-}
-
-extern void zt_hdlc_abort(struct zt_chan *ss, int event)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&ss->lock, flags);
-	if (ss->inreadbuf >= 0)
-		ss->readidx[ss->inreadbuf] = 0;
-	if ((ss->flags & ZT_FLAG_OPEN) && !ss->span->alarms)
-		__qevent(ss->master, event);
 	spin_unlock_irqrestore(&ss->lock, flags);
 }
 

Modified: team/mattf/zaptel-hotwct4xxp/zaptel.init
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/zaptel.init?view=diff&rev=2390&r1=2389&r2=2390
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/zaptel.init (original)
+++ team/mattf/zaptel-hotwct4xxp/zaptel.init Wed Apr  4 16:42:55 2007
@@ -161,10 +161,10 @@
 	rmmod audio >& /dev/null
 	if [ $system = debian ]; then
 	    echo -n "Loading zaptel framework: " 
-	    modprobe zaptel >& /dev/null && echo -n "done"
+	    modprobe zaptel ${ARGS} >& /dev/null && echo -n "done"
 	    echo "."
 	elif [ $system = redhat ]; then
-	    action "Loading zaptel framework: " modprobe zaptel
+	    action "Loading zaptel framework: " modprobe zaptel ${ARGS}
 	fi
 	echo -n "Waiting for zap to come online..."
 	TMOUT=10 # max secs to wait
@@ -203,6 +203,7 @@
 	;;
   stop)
 	# Unload drivers
+	$ZTCFG -s
 	echo -n "Unloading zaptel hardware drivers:"
   	unload_module zaptel
 	RETVAL=$?

Modified: team/mattf/zaptel-hotwct4xxp/zaptel.xml
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-hotwct4xxp/zaptel.xml?view=diff&rev=2390&r1=2389&r2=2390
==============================================================================
--- team/mattf/zaptel-hotwct4xxp/zaptel.xml (original)

[... 89 lines stripped ...]


More information about the svn-commits mailing list