[asterisk-commits] tilghman: branch tilghman/callparking_retrieval r805 - in /asterisk/team/tilg...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 12 16:59:58 CDT 2010


Author: tilghman
Date: Tue Oct 12 16:59:55 2010
New Revision: 805

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=805
Log:
Routine checkin of code

Modified:
    asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test
    asterisk/team/tilghman/callparking_retrieval/tests/tests.yaml

Modified: asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test?view=diff&rev=805&r1=804&r2=805
==============================================================================
--- asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test (original)
+++ asterisk/team/tilghman/callparking_retrieval/tests/callparking_retrieval/run-test Tue Oct 12 16:59:55 2010
@@ -1,4 +1,10 @@
 #!/bin/sh
+
+set +e
+
+echo " >>> Starting callparking_retrieval test"
+
+testdir=${0%%run-test}
 
 case `uname -s` in
 	solaris*|sunos*)
@@ -11,41 +17,67 @@
 		;;
 esac
 
-testdir=${0%%runtest}
+case $2 in
+	*-1.4*)
+		ORIGINATE='originate'
+		CSC_HEADERS=3
+		;;
+	*-1.6.2*|*-1.4*)
+		ORIGINATE='originate'
+		CSC_HEADERS=4
+		;;
+	*)
+		ORIGINATE='channel originate'
+		CSC_HEADERS=4
+		;;
+esac
 
 cleanup() {
+	return
 	if test "x$userA_tmpdir" = "x"; then : ; else
-		asterisk -C $userA_tmpdir/asterisk.conf -rx "core stop now" >/dev/null 2>&1
+		/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "core stop now" >/dev/null 2>&1
 	fi
 	if test "x$userB_tmpdir" = "x"; then : ; else
-		asterisk -C /tmp/callparking_retrieval/userB/config/asterisk.conf -rx "core stop now" >/dev/null 2>&1
+		/usr/sbin/asterisk -C $userB_tmpdir/asterisk.conf -rx "core stop now" >/dev/null 2>&1
 	fi
 	rm -rf /tmp/callparking_retrieval
 	sleep 2
 	$KILLALL asterisk
 	sleep 1
 	$KILLALL -9 asterisk
+	set -e
+}
+
+show_channels() {
+	echo " * Channels on A:"
+	/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels"
+	echo " * Channels on B:"
+	/usr/sbin/asterisk -C $userB_tmpdir/asterisk.conf -rx "core show channels"
 }
 
 for user in userA userB; do
-	${user}_tmpdir=`mktemp -t -d callparking_retrieval_$user.XXXXXX`
-	if $?; then : ; else
+	echo " >>> Creating configuration directory for $user"
+	eval "${user}_tmpdir=`mktemp -t -d callparking_retrieval_$user.XXXXXX`"
+	# Shortcut for referral within this loop only
+	eval "conf=\${${user}_tmpdir}"
+
+	if test "$conf" = ""; then
 		echo " *** Unable to create temporary directory for $user"
 		cleanup()
 		exit 1
 	fi
 
-	eval "conf=\${${user}_tmpdir}"
 
+	echo " >>> Creating files in configuration directory"
 	for i in ../configs/*.sample; do
 		dst=$conf/`basename $i .sample`
 		install -m 644 $i $dst
 	done
-	for i in $testdir$user/*; do
+	for i in $testdir$user/*.conf; do
 		dst=$conf/`basename $i`
 		install -m 644 $i $dst
 	done
-	( echo "[directories]"; echo "astetcdir => $conf"; echo "[options]"; echo "verbose = 10"; echo "documentation_language = en_US" ) > $conf/asterisk.conf
+	( echo "[directories]"; echo "astetcdir => $conf"; echo "astrundir => $conf"; echo "astlogdir => $testdir/$user"; echo "[options]"; echo "verbose = 10"; echo "documentation_language = en_US" ) > $conf/asterisk.conf
 
 	# Verify that files got created properly
 	if test -s $conf/asterisk.conf ; then : ; else
@@ -53,7 +85,8 @@
 		echo " *** Unable to create test configuration files in $conf"
 		exit 1
 	fi
-	asterisk -C $conf/asterisk.conf
+	echo "Starting Asterisk for $user"
+	/usr/sbin/asterisk -g -C $conf/asterisk.conf
 	sleep 1
 	# Asterisk is running, right?
 	if test `$PS | grep $conf[/] | wc -l` = "0"; then
@@ -64,49 +97,56 @@
 done
 
 echo " >>> User A is calling user B, who will park the call."
-asterisk -C $userA_tmpdir/asterisk.conf -rx "channel originate Local/wait at parking extension callb at parking"
+/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "$ORIGINATE Local/wait at parking extension callb at parking"
 sleep 2
 
 # Verify that the call is up
-count=`asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-if test $count -lt 4; then # 4 = header line + channel A linked to B + channel B linked to A + summary line
+count=`/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
+show_channels()
+/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels"
+if test $count != $(($CSC_HEADERS+2)); then # 2 = channel A linked to B + channel B linked to A
 	cleanup()
-	echo " *** Call generation from user A to user B failed"
+	echo " *** Call generation from user A to user B failed: $count"
 	exit 1
 fi
 
-sleep 10
+sleep 8
 
 # Verify that the call is up
-count=`asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-if test $count -lt 3; then # 3 = header line + channel A linked to parking + summary line
+count=`/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
+show_channels()
+if test $count != $(($CSC_HEADERS+1)); then
 	cleanup()
-	echo " *** User B failed to park the call from user A"
+	echo " *** User B failed to park the call from user A: $count"
 	exit 1
 fi
 
 echo " >>> User B is retrieving user A from parking, then will attempt to repark it."
-asterisk -C $userB_tmpdir/asterisk.conf -rx "channel originate IAX2/usera/701 at parking extension parka at parking"
+/usr/sbin/asterisk -C $userB_tmpdir/asterisk.conf -rx "$ORIGINATE IAX2/usera/701 at parking extension parka at parking"
 sleep 2
 
 # Verify that the call is up
-count=`asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-if test $count -lt 4; then # 4 = header line + channel A linked to B + channel B linked to A + summary line
+count=`/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
+show_channels()
+if test $count != $(($CSC_HEADERS+2)); then # 2 = channel A linked to B + channel B linked to A
 	cleanup()
-	echo " *** User B failed to retrieve the call from parking"
+	echo " *** User B failed to retrieve the call from parking: $count"
 	exit 1
 fi
 
-sleep 10
+sleep 8
 
-a_parked=`asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
-if test $a_parked -lt 3; then
-	echo " *** Failed.  When user B hung up, user A was not parked and thus hungup as well."
+a_parked=`/usr/sbin/asterisk -C $userA_tmpdir/asterisk.conf -rx "core show channels" | wc -l`
+show_channels()
+if test $a_parked != $(($CSC_HEADERS+1)); then
+	echo " *** Failed.  When user B hung up, user A was not parked and thus hungup as well: $count."
 	cleanup()
 	exit 1
 fi
 
-cleanup()
+#cleanup()
+
+echo "Success!"
 
 exit 0
 

Modified: asterisk/team/tilghman/callparking_retrieval/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/tilghman/callparking_retrieval/tests/tests.yaml?view=diff&rev=805&r1=804&r2=805
==============================================================================
--- asterisk/team/tilghman/callparking_retrieval/tests/tests.yaml (original)
+++ asterisk/team/tilghman/callparking_retrieval/tests/tests.yaml Tue Oct 12 16:59:55 2010
@@ -36,6 +36,7 @@
     - test: 'blind-transfer-parkingtimeout'
     - test: 'one-step-parking'
     - test: 'callparking'
+    - test: 'callparking_retrieval'
     - test: 'mixmonitor'
     - test: 'mixmonitor_audiohook_inherit'
     - test: 'chanspy/chanspy_barge'




More information about the asterisk-commits mailing list