--- Setup	2008-09-18 17:20:45.000000000 -0400
+++ /tmp/Setup	2008-09-23 11:04:39.000000000 -0400
@@ -2021,9 +2021,6 @@
     	WANCFG_DEFS=
     	if [ "$TDM_PROT" = "YES" ]; then
  		WANCFG_DEFS=$WANCFG_DEFS" ENABLE_ZAPTEL_PARSER=YES ZAPINC=$ZAPTEL_SOURCE_DIR"
-		if [ -d $ZAPTEL_SOURCE_DIR/dahdi ]; then
-			WANCFG_DEFS=$WANCFG_DEFS" DAHDI_ISSUES=YES"
-		fi
     	fi
     	eval "make -C wancfg all CC=$CC SYSINC=$SOURCEDIR/include $WANCFG_DEFS >> $CMP_LOG 2>> $CMP_LOG"
 
@@ -2514,6 +2511,7 @@
 	fi	
 
 
+	cat $PROD_HOME/$MODSYM.wanrouter > $MODSYM
 	build_kernel_module wanec "$files" "$EXTRA_FLAGS" 
 	if [ $? -ne 0 ]; then
           	return $?;
@@ -2555,7 +2553,7 @@
 function create_kernel_mod_file()
 {
 	local file=$1
-	eval "$SOURCEDIR/scripts/mod/modpost -m -i $SOURCEDIR/Module.symvers $file 2> /dev/null 2> /dev/null"
+	eval "$SOURCEDIR/scripts/mod/modpost -m -i $SOURCEDIR/$MODSYM $file 2> /dev/null 2> /dev/null"
 }
 
 function update_kernel_custom_name()
@@ -3434,7 +3432,6 @@
 	i386*)   LD_ELF="-m elf_i386" 
 		 ;;
 	x86*)   LD_ELF="-m elf_i386" 
-		 ARCH=i386
 		 ;;
 	ppc*)
 		 ;;
@@ -3471,10 +3468,6 @@
 		fi
 		
 		check_inode_struct
-
-		if [ "$BRI_MODULE_TEST" = "YES" ]; then
-                       PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DBUILD_MOD_TESTER"
-		fi
 		
 		if [ 1 -eq 1 ]; then
 		echo
@@ -3720,16 +3713,11 @@
 
 	rm -f sdladrv_src.c
 	ln -s sdladrv.c sdladrv_src.c
-
-	SDLADRV_OBJS="sdladrv_src sdladrv_fe sdladrv_utils "
-
-	if [ "$AFT_USB_PROT" = "YES" ]; then
-		SDLADRV_OBJS=$SDLADRV_OBJS"sdladrv_usb "
-	fi
-
-	build_kernel_module sdladrv "$SDLADRV_OBJS"
+	build_kernel_module sdladrv "sdladrv_src sdladrv_fe sdladrv_utils"
+	cp $MODSYM  $PROD_HOME/$MODSYM.sdladrv 
 
 	build_kernel_module wanrouter "wanmain wanproc waniface"  
+	cp $MODSYM  $PROD_HOME/$MODSYM.wanrouter 
 
 	AF_EXTRA_FLAGS="-DCONFIG_PRODUCT_WANPIPE_SOCK_DATASCOPE"
 	check_for_af_wanpipe_updates
@@ -3737,6 +3725,7 @@
 	rm -f af_wanpipe_src.c
 	ln -s af_wanpipe.c af_wanpipe_src.c
 	build_kernel_module af_wanpipe "af_wanpipe_src af_wanpipe_datascope" "$AF_EXTRA_FLAGS"
+	cp $MODSYM  $PROD_HOME/$MODSYM.af_wanpipe 
 
 	echo -n "."
 
@@ -3926,10 +3915,6 @@
 		\cp $DRIVER_UPDATE_DIR/src/net/sdla_tdmv_dummy.c .
 		WANPIPE_OBJS=$WANPIPE_OBJS"sdla_tdmv sdla_remora_tdmv sdla_bri_tdmv sdla_tdmv_dummy "
 		WANPIPE_EXTRA_CFLAGS=$WANPIPE_EXTRA_CFLAGS"-I$ZAPTEL_SOURCE_DIR "
-		if [ -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
-			# this is required for some dependencies of kernel.h (dahdi_config.h, ecdis.h etc)
-			WANPIPE_EXTRA_CFLAGS=$WANPIPE_EXTRA_CFLAGS"-I$ZAPTEL_INSTALL_DIR/drivers/dahdi "
-		fi
 	fi
 
 	if [ "$AFT_TE1_PROT" = "YES" ]; then
@@ -3940,10 +3925,6 @@
 		WANPIPE_OBJS=$WANPIPE_OBJS"sdla_bri aft_bri "
 	fi
 
-	if [ "$AFT_USB_PROT" = "YES" ]; then
-		WANPIPE_OBJS=$WANPIPE_OBJS"wanpipe_usb sdla_usb_remora sdla_usb_remora_tdmv "
-	fi
-
 	if [ "$AFT_SERIAL_PROT" = "YES" ]; then
 		WANPIPE_OBJS=$WANPIPE_OBJS"sdla_serial "
 	fi
@@ -3989,12 +3970,15 @@
 		home_tmp=`pwd`
 		cd $DRIVER_UPDATE_DIR/wanec
 		\cp -f $PROD_HOME/kbuild/Makefile.wanec Makefile		
+
+
 		build_wanec_module
 		if [ $? -eq 0 ]; then
 			echo "WAN HWEC module enabled and compiled!"
 		else
 			echo "WAN HWEC module failed to compile!"
 		fi
+		cp $MODSYM  $PROD_HOME/$MODSYM.wanec 
 		cd $home_tmp
 
 	fi
@@ -4228,6 +4212,11 @@
 
 	#Link in appropriate protocols as needed.
 	WANPIPE_OBJS=$WANPIPE_OBJS"sdlamain wanpipe_tdm_api wanpipe_codec wanpipe_codec_law " 
+
+
+	cat $ZAPTEL_SOURCE_DIR/$MODSYM >> $MODSYM
+	cat $PROD_HOME/$MODSYM.wanec >> $MODSYM
+
 	build_kernel_module wanpipe "$WANPIPE_OBJS" "$WANPIPE_EXTRA_CFLAGS" "$WANPIPE_BIN_OBJS" 
 	
 
@@ -5176,24 +5165,6 @@
 	done
 }
 
-# set the proper directory for headers depending on
-# zaptel/dahdi version
-set_zaptel_source_dir()
-{
-	#Check if this is Dahdi
-	if [ -d $ZAPTEL_INSTALL_DIR/include/dahdi ]; then
-		# when Dahdi present ZAPTEL_SOURCE_DIR is not really the source dir, but the headers dir
-		# no harm done, no conflict, just a bit misleading variable name 
-		ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/include
-	#Check if this is post Zaptel-1.4.9
-	elif [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then
-		ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel
-	#Good ol' zaptel
-	else
-		ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR
-	fi
-}
-
 search_and_replace()
 {
 	local input_file_name=$1
@@ -5220,15 +5191,6 @@
 
 	return $?
 }
-
-function main_zap_header_present()
-{
-        if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ] && [ ! -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
-		return 0;
-	fi
-	return 1;
-}
-
 function tdmv_get_zaptel_path ()
 {
 
@@ -5250,20 +5212,22 @@
 
                                 [ $response ] && {
                                  ZAPTEL_INSTALL_DIR=$response
-				 set_zaptel_source_dir
+				 if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then
+					ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel
+				 else
+					ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR
+				fi				
                         }
                 fi
         fi
-
-	main_zap_header_present	
-	if [ $? -eq 0 ]; then
-                echo "   Zaptel/Dahdi source not found in $ZAPTEL_SOURCE_DIR"
+        if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ]; then
+                echo "   Zaptel source not found in $ZAPTEL_SOURCE_DIR"
                 ZAPTEL_SOURCE_DIR="/usr/src/zaptel"
 		ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR
                 if test $NONINTERACTIVE; then
                         return 1
                 else
-                        getyn "   Press Y to specify another Zaptel/Dahdi source directory, N to exit"
+                        getyn "   Press Y to specify another Zaptel source directory, N to exit"
                         if [ $? -ne 0 ]; then
                                 exit 1;
                         fi
@@ -5278,7 +5242,6 @@
         return 0;
 }
 
-# this function seems unused and does not seem to need to be updated for Dahdi
 function tdmv_apply_zaptel_dchan_patch_old ()
 {
 	local rc
@@ -5351,108 +5314,87 @@
 
 	return $rc 
 }
-
 function tdmv_apply_zaptel_chunk_patch () {
         lhome=`pwd`
         TEMP=tmp
         cd $ZAPTEL_SOURCE_DIR
-        echo "Applying Zaptel/Dahdi Chunk patch..."
+        echo "Applying Zaptel Chunk patch..."
         echo " "
-
-	filetopatch="zaptel.h"	
-	chunkname="ZT_CHUNKSIZE"
-	dhname="Zaptel"
-	isdahdi="no"
-	if [ -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
-		filetopatch="kernel.h"
-		chunkname="DAHDI_CHUNKSIZE"
-		dhname="Dahdi"
-		isdahdi="yes"
-	fi
-
-        #modify zaptel.h or kernel.h
-        eval "cat $filetopatch | sed '/^#define $chunkname/c\#define $chunkname          $ZAP_CHUNK' >$TEMP 2>/dev/null"
+        #modify zaptel.h
+        eval "cat zaptel.h | sed '/^#define ZT_CHUNKSIZE/c\#define ZT_CHUNKSIZE          $ZAP_CHUNK' >$TEMP 2>/dev/null"
         if [ $? -ne 0 ]; then
-                echo "   Failed to substitute $chunkname string in $filetopatch"
+                echo "   Failed to substitute ZT_CHUNKSIZE string in zaptel.h"
                 exit 1
         else
-                eval "\mv -f $TEMP $filetopatch"
+                eval "\mv -f $TEMP zaptel.h"
                 if [ $? -ne 0 ]; then
-                        echo "   Failed to overwrite existing $filetopatch"
+                        echo "   Failed to overwrite existing zaptel.h"
                         exit 1
                 else
-                        echo "   $dhname patched for chunk size successfully"
+                        echo "   Zaptel patched for chunk size successfully"
                         zaptel_modified=1
                 fi
         fi
 
         #remove wct4xxp module from Makefile
-	if [ $isdahdi = "no" ]; then
-		eval "cat Makefile |sed 's/wct1xxp wct4xxp wcte11xp/wct1xxp wcte11xp/g'>$TEMP 2>/dev/null "
-		if [ $? -ne 0 ]; then
-			echo "   Failed to remove wct4xxp from Makefile"
-			exit 1
-		else
-			eval "\mv -f $TEMP Makefile"
-			if [ $? -ne 0 ]; then
-				echo "   Failed to overwrite existing Makefile"
-				exit 1
-			else
-				echo "   wct4xxp module removed from Makefile successfully"
-				zaptel_modified=1
-			fi
-		fi
-	fi
+        eval "cat Makefile |sed 's/wct1xxp wct4xxp wcte11xp/wct1xxp wcte11xp/g'>$TEMP 2>/dev/null "
+        if [ $? -ne 0 ]; then
+                echo "   Failed to remove wct4xxp from Makefile"
+                exit 1
+        else
+                eval "\mv -f $TEMP Makefile"
+                if [ $? -ne 0 ]; then
+                        echo "   Failed to overwrite existing Makefile"
+                        exit 1
+                else
+                        echo "   wct4xxp module removed from Makefile successfully"
+                        zaptel_modified=1
+                fi
+        fi
 
 	cd $ZAPTEL_INSTALL_DIR
-	if [ $isdahdi = "no" ]; then
-		eval "cat Makefile |sed 's/^SUBDIR_MODULES:=.*//g'>$TEMP 2>/dev/null "
-		if [ $? -ne 0 ]; then
-			echo "   Failed to remove wct4xxp from Makefile"
-			exit 1
-		else
-			eval "\mv -f $TEMP Makefile"
-			if [ $? -ne 0 ]; then
-				echo "   Failed to overwrite existing Makefile"
-				exit 1
-			else
-				echo "   wct4xxp module removed from Makefile successfully"
-				zaptel_modified=1
-			fi
-		fi
-
-		if [ -f Makefile.kernel26 ]; then
-			eval "cat Makefile.kernel26 | sed 's/^obj-m.*+=.*wct4xx.*//g'>$TEMP 2>/dev/null "
-			if [ $? -ne 0 ]; then
-				 echo "   Failed to remove wct4xxp from Makefile.kernel26"
-				 exit 1
-			
-			else
-				eval "\mv -f $TEMP Makefile.kernel26"
-				echo "   wct4xxp module removed from Makefile.kernel26 successfully"
-				zaptel_modified=1			
-			fi
-		fi
-
-	fi # end if $isdahdi = "no"
+        eval "cat Makefile |sed 's/^SUBDIR_MODULES:=.*//g'>$TEMP 2>/dev/null "
+        if [ $? -ne 0 ]; then
+                echo "   Failed to remove wct4xxp from Makefile"
+                exit 1
+        else
+                eval "\mv -f $TEMP Makefile"
+                if [ $? -ne 0 ]; then
+                        echo "   Failed to overwrite existing Makefile"
+                        exit 1
+                else
+                        echo "   wct4xxp module removed from Makefile successfully"
+                        zaptel_modified=1
+                fi
+        fi
 
-	if [ $isdahdi = "yes" ]; then
-		cd drivers/dahdi
-	fi
-	# for zaptel-1.2.26 or later (including Dahdi)
-	if [ -f Kbuild ]; then
-		eval "cat Kbuild | sed 's/^obj-m.*+=.*wct4xx.*//g'>$TEMP 2>/dev/null "
+	if [ -f Makefile.kernel26 ]; then
+		eval "cat Makefile.kernel26 | sed 's/^obj-m.*+=.*wct4xx.*//g'>$TEMP 2>/dev/null "
 		if [ $? -ne 0 ]; then
-			 echo "   Failed to remove wct4xxp from Kbuild"
-			 exit 1
-
+			 echo "   Failed to remove wct4xxp from Makefile.kernel26"
+              		 exit 1
+		
 		else
-			eval "\mv -f $TEMP Kbuild"
-			echo "   wct4xxp module removed from Kbuild successfully"
-			zaptel_modified=1
+			eval "\mv -f $TEMP Makefile.kernel26"
+			echo "   wct4xxp module removed from Makefile.kernel26 successfully"
+                        zaptel_modified=1			
 		fi
 	fi
 
+        # for zaptel-1.2.26 or later
+        if [ -f Kbuild ]; then
+                eval "cat Kbuild | sed 's/^obj-m.*+=.*wct4xx.*//g'>$TEMP 2>/dev/null "
+                if [ $? -ne 0 ]; then
+                         echo "   Failed to remove wct4xxp from Kbuild"
+                         exit 1
+
+                else
+                        eval "\mv -f $TEMP Kbuild"
+                        echo "   wct4xxp module removed from Kbuild successfully"
+                        zaptel_modified=1
+                fi
+        fi
+
         cd $lhome
         return 0;
 }
@@ -5460,12 +5402,6 @@
 function tdmv_apply_zaptel_echo_debug_patch ()
 {
 	local rc
-
-	if [ -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
-		echo "Error: Patching for echo debugging not supported for Dahdi yet"
-		return 1;
-	fi
-
 	if [ ! -e $PROD_HOME/zaptel ]; then
 		echo "Error: Zaptel Patch Directory Not Found!"
 		return 1;
@@ -5545,11 +5481,6 @@
 {
 	local rc
 
-	if [ -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
-		echo "Error: TDMV Echo Detection and Control not supported for Dahdi yet"
-		return 1;
-	fi
-
 	if [ ! -e $PROD_HOME/edac ]; then
 		echo "Error: Zaptel Patch Directory Not Found!"
 		return 1;
@@ -5822,15 +5753,6 @@
 	find_zap_dirs "$1"
 }
 
-function is_valid_zap_dir()
-{
-	# one more !%*?@ change from Digium and we need an array here :-)
-	if [ -f $1/zaptel.h ] || [ -f $1/kernel/zaptel.h ] || [ -f $1/include/dahdi/kernel.h ]; then
-		return 1;
-	fi
-	return 0;
-}
-
 function find_zap_dirs ()
 {
 	local cnt
@@ -5844,18 +5766,14 @@
 	
 
 	echo
-	echo "Looking for zaptel/dahdi directory in /usr/src ..."	
+	echo "Looking for zaptel directory in /usr/src ..."	
 	echo "-------------------------------------------"
 	if [ "$zapdirs" = "" ]; then
 		zapdirs=`find /usr/src -maxdepth 2 -name 'zaptel*' | xargs `
 		 if [ -d "/usr/src/zaptel" ]; then
                         zapdirs="/usr/src/zaptel "$zapdirs
                  fi
-		dahdidirs=`find /usr/src -maxdepth 2 -name 'dahdi*' | xargs `
-		 if [ -d "/usr/src/dahdi" ]; then
-                        zapdirs="/usr/src/dahdi $zapdirs"
-		 fi
-		zapdirs="$dahdidirs $zapdirs"
+
 	fi
 
 	unset zapdir_array;
@@ -5871,8 +5789,7 @@
 			continue
 		fi
 
-		is_valid_zap_dir $dir
-		if [ $? -eq 0 ]; then
+		if [ ! -f $dir/zaptel.h ] && [ ! -f $dir/kernel/zaptel.h ]; then
 			continue;
 		fi
 		
@@ -5889,8 +5806,8 @@
 	
 	if [ $cnt -eq 1 ]; then
 		echo
-		echo "No zaptel/dahdi dirs found in /usr/src "
-		echo "Please use option \"m\" to enter zaptel/dahdi path"
+		echo "No zaptel dirs found in /usr/src "
+		echo "Please use option \"m\" to enter zaptel path"
 		echo
 	fi
 	echo "------------------------------------------ "
@@ -5901,8 +5818,7 @@
 			continue
 		fi
 
-		is_valid_zap_dir $dir
-		if [ $? -eq 0 ]; then
+		if [ ! -f $dir/zaptel.h ] && [ ! -f $dir/kernel/zaptel.h ]; then
 			continue;
 		fi
 
@@ -5953,11 +5869,16 @@
 		find_zap_dirs_invalid "$zapdirs"
 	fi	
 
-	set_zaptel_source_dir
-	main_zap_header_present
-	if [ $? -eq 0 ]; then
+	#Check if this is post Zaptel-1.4.9
+	if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then
+		ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel
+	else
+		ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR
+	fi
+				
+	if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ]; then
 		echo
-		echo "Error: zaptel.h or dahdi/kernel.h not found in $ZAPTEL_SOURCE_DIR"
+		echo "Error: zaptel.h not found in $ZAPTEL_SOURCE_DIR"
 		echo
 		echo
 		zapdir_manual=0
@@ -6202,9 +6123,6 @@
 	if [ "$PROTOCOL" = "DEF" ]; then
 		PROTOCOL=$DEFAULT_PROTOCOLS
 	fi	
-	if [ "$PROTOCOL" = "ALL" ]; then
-		PROTOCOL="$DEFAULT_PROTOCOLS $API_PROTOCOLS"
-	fi	
 	
 	echo "$PROTOCOL" | grep "BRI" > /dev/null
 	if [ $? -eq 0 ]; then
@@ -6454,13 +6372,10 @@
 		if [ $AFT_TE1_PROT != YES ]; then
 			echo "Enabling the AFT TE1 Support"
 			PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_CORE -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT_56K -DCONFIG_PRODUCT_WANPIPE_AFT_RM -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW  -DCONFIG_PRODUCT_WANPIPE_AFT_BRI  -DCONFIG_PRODUCT_WANPIPE_AFT_SERIAL "
-
-			#PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_USB "
 		fi
 		AFT_TE1_PROT=YES
 		AFT_BRI_PROT=YES
 		AFT_SERIAL_PROT=YES
-		#AFT_USB_PROT=YES
 		PROT_MATCH=YES
 	fi
 
@@ -6502,37 +6417,21 @@
 				ZAPTEL_NAME=zaptel.ko
 			fi
 
-			zaplikeinstalls=0
-			if [ -e $ZAP_MOD_DIR/zaptel/$ZAPTEL_NAME ]; then
-				zaplikeinstalls=$((zaplikeinstalls+1))
-			fi
-
-			if [ -e $ZAP_MOD_DIR/misc/$ZAPTEL_NAME ]; then
-				zaplikeinstalls=$((zaplikeinstalls+1))
-			fi
-
-			# Dahdi drops support for kernel 2.4, no need to check .o vs .ko
-			if [ -e $ZAP_MOD_DIR/dahdi/dahdi.ko ]; then
-				zaplikeinstalls=$((zaplikeinstalls+1))
-			fi
-
-			if [ $zaplikeinstalls -gt 1 ]; then
+			if [ -e $ZAP_MOD_DIR/zaptel/$ZAPTEL_NAME ] && [ -e $ZAP_MOD_DIR/misc/$ZAPTEL_NAME ]; then
 				echo 
 				echo "-------------------------------------------------------------"
-				echo "CRITICAL WARNING: Multiple ZAPTEL/DAHDI Installations Found"
+				echo "CRITICAL WARNING: Multiple ZAPTEL Installations Found"
 				echo
-				echo "./Setup has found MULTIPLE ZAPTEL/DAHDI driver installations"
-				echo " in 2 or more of this locations:"
+				echo "./Setup has found MULTIPLE ZAPTEL driver installations in:"
 				echo "        $ZAP_MOD_DIR/zaptel and" 
 				echo "        $ZAP_MOD_DIR/misc directory."
-				echo "        $ZAP_MOD_DIR/dahdi directory."
 				echo
 				echo "  The ZAPTEL drivers in $ZAP_MOD_DIR/zaptel are OLD."
 				echo
 				echo "  This is illegal, and CAN cause Wanpipe to CRASH."
 				echo
 				echo "  Please solve this PROBLEM by removing OLD ZAPTEL"
-				echo "  kernel modules before installing WANPIPE.  "
+				echo "  kerenl modules before installing WANPIPE.  "
 				echo
 				echo "      eg: rm -rf $ZAP_MOD_DIR/zaptel"
 				echo "          depmod -a"
@@ -6569,17 +6468,6 @@
 						PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN  -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL "
 					fi
  				fi
-
-				# if this is Dahdi, no need to check, already include hdlc_hard_xmit
-				if [ -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
-					echo "                                                      "
-					echo "Dahdi HW HDLC Support Detected: Enabling DCHAN Feature"
-					echo "Native Dahdi HW HDLC Support Detected - No patch required"
-					echo "Dahdi source unmodified"
-					echo "                        "
-					TDM_DCHAN="(DCHAN)"
-					PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN  -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL -DDAHDI_ISSUES"
-				fi
 	
 				#Check if dchan patch is already enabled 
 				if [ "$TDM_DCHAN" = "" ]; then
@@ -6632,7 +6520,7 @@
 
 			####################################################################
 			if [ $ENABLE_ECHO_DEBUG -eq 1 ]; then
-			getyn "Compile Echo Debugging Support for Zaptel (not supported for Dahdi yet) ? "
+			getyn "Compile Echo Debugging Support for Zaptel ? "
 			if [ $? -eq 0 ]; then
 				tdmv_apply_zaptel_echo_debug_patch
 				if [ $? -eq 0 ]; then
@@ -6653,7 +6541,7 @@
 
 			if [ $ENABLE_EDAC -gt 0 ]  && [ "$ECHO_MASTER_PROT" = "NO" ]; then
 			echo 
-			getyn "Compile TDMV Echo Detection and Control (EDAC) Support (No Dahdi support yet) (y/n)? "
+			getyn "Compile TDMV Echo Detection and Control (EDAC) Support (y/n)? "
 			if [ $? -eq 0 ]; then
 				echo
 				tdmv_apply_zaptel_edac_patch
@@ -6800,7 +6688,6 @@
 X25_PROT=NO
 AFT_TE1_PROT=NO
 AFT_BRI_PROT=NO
-AFT_USB_PROT=NO
 AFT_SERIAL_PROT=NO
 AFT_TE3_PROT=NO
 SSMG=NO
@@ -7040,7 +6927,7 @@
 }
 
 ####### MAIN #################################################################
-#set -x
+# set -x
 
 
 PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
@@ -7049,7 +6936,7 @@
 PKG_NAME=wanpipe
 DISTR_NAME="WANPIPE"
 PROD=wanrouter
-PROD_VER=3.3.12.9
+PROD_VER=3.3.12
 PROD_HOME=`pwd`
 META_CONF=$PROD_HOME/$PROD.rc
 WAN_INTR_DIR=$PROD_HOME/interfaces
@@ -7078,7 +6965,6 @@
 ENABLE_ECHO_DEBUG=0
 ZAPTEL_PATH_OP="NO"
 ZAPTEL_COMPILE_DISABLE="NO"
-BRI_MODULE_TEST="NO"
 ZAP_CHUNK_OP="NO"
 CMP_LOG=$PROD_HOME/setup_drv_compile.log
 CMP_BUILD=build.sh
@@ -7095,6 +6981,7 @@
 zaptel_auto_install="NO"
 bri_auto_install="NO"
 setup_install_quick="NO"
+MODSYM=Module.symvers
 
 
 echo > $CMP_LOG
@@ -7386,9 +7273,6 @@
 		--edac*)
 			#TAKEN OUT 
 			;;
-                --bri_module_test*)
-                       BRI_MODULE_TEST="YES"
-                       ;;
 		--noautostart*)
 			NO_AUTO_START=1
 			;;
@@ -7443,8 +7327,12 @@
 			fi
 			ZAPTEL_PATH_OP="YES";
 			echo "Zaptel path defined as: $ZAPTEL_INSTALL_DIR"
-
-			set_zaptel_source_dir	
+			
+			if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then
+				ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel
+			else
+				ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR
+			fi
 			
 			;;
 
@@ -7465,7 +7353,12 @@
 			ZAPTEL_PATH_OP="YES";
 			echo "Zaptel path defined as: $ZAPTEL_INSTALL_DIR"
 			
-			set_zaptel_source_dir			
+			
+			if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then
+				ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel
+			else
+				ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR
+			fi
 
 			;;
 	
