[svn-commits] pabelanger: testsuite/asterisk/trunk r1279 - in /asterisk/trunk/tests/feature...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Dec 22 19:24:39 UTC 2010
Author: pabelanger
Date: Wed Dec 22 13:24:35 2010
New Revision: 1279
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1279
Log:
Rewrite feature_attended_transfer test
Removed:
asterisk/trunk/tests/feature_attended_transfer/sounds/
Modified:
asterisk/trunk/tests/feature_attended_transfer/configs/ast1/extensions.conf
asterisk/trunk/tests/feature_attended_transfer/configs/ast1/iax.conf
asterisk/trunk/tests/feature_attended_transfer/configs/ast1/manager.conf
asterisk/trunk/tests/feature_attended_transfer/configs/ast2/extensions.conf
asterisk/trunk/tests/feature_attended_transfer/configs/ast2/iax.conf
asterisk/trunk/tests/feature_attended_transfer/configs/ast2/manager.conf
asterisk/trunk/tests/feature_attended_transfer/run-test
asterisk/trunk/tests/feature_attended_transfer/test-config.yaml
Modified: asterisk/trunk/tests/feature_attended_transfer/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/ast1/extensions.conf?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/ast1/extensions.conf Wed Dec 22 13:24:35 2010
@@ -1,98 +1,34 @@
[general]
[globals]
-; use these variables during debug to see at what step the test failed
-ATT_TEST_A_LEG=FAIL-never even got to read the results
-ATT_TEST_C_LEG=FAIL-never even got to read the results
-ATT_C_DTMF_TO_A=never set
-ATT_READ_C_DTMF_TO_A=never set
-[transfertest]
-; __________________ A ______________________
-exten => a_exten,1,Answer()
+[alpha]
+exten => 1000,1,Answer()
+exten => 1000,n,SendDTMF(1w0w5w0w)
+exten => 1000,n,Background(demo-congrats)
+exten => 1000,n,UserEvent(alpha, status: FAILURE)
+exten => 1000,n,Hangup()
-exten => a_exten,n,Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-answered the call, begin waiting)
+exten => 2345,1,UserEvent(alpha, status: SUCCESS)
+exten => 2345,n,Background(demo-congrats)
+exten => 2345,n,Hangup()
-;Play back audio while B leg begins to start transfer. This
-;involves some timing. Playback is done 4 times to guarantee
-;that B has begun the transfer before we start listening for DTMF.
-exten => a_exten,n,Playback(${TALK_AUDIO})
-exten => a_exten,n,Playback(${TALK_AUDIO})
-exten => a_exten,n,Playback(${TALK_AUDIO})
-exten => a_exten,n,Playback(${TALK_AUDIO})
+[charlie]
+exten => 1010,1,Answer()
+exten => 1010,n,BackgroundDetect(demo-congrats,1,20,,20000)
+exten => 1010,n,UserEvent(charlie, status: FAILURE)
+exten => 1010,n,Hangup()
-;WAIT FOR DTMF FROM C TO KNOW IT IS UP AND SYNCED
-exten => a_exten,n,Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-while reading DTMF from C. Time is ${STRFTIME(epoch,,'seconds: %S ms: %q3')})
-exten => a_exten,n,Set(GLOBAL(ATT_READ_C_DTMF_TO_A)=Started waiting for DTMF from C at ${STRFTIME(epoch,,'seconds: %S ms: %q3')})
-exten => a_exten,n,Read(A_READ,,3,,,25)
-exten => a_exten,n,NoOp(A READ IS ${A_READ})
+exten => talk,1,UserEvent(charlie, status: SUCCESS)
+exten => talk,n,SendDTMF(1w0w7w5w)
+exten => talk,n,Goto(charlie_alpha,s,1)
-;CHECK DTMF FROM C
-exten => a_exten,n,Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-while checking DTMF results. Time is ${STRFTIME(epoch,,'seconds: %S ms: %q3')})
-exten => a_exten,n,GoToIf($[${A_READ}=100]?dtmfpass:dtmffail)
-exten => a_exten,n(dtmffail),Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-DTMF_FROM_C_FAILED ${A_READ})
-exten => a_exten,n,Hangup()
-exten => a_exten,n(dtmfpass),Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-Got DTMF from C A_READ is ${A_READ} now performing audio detect)
+[charlie_alpha]
+exten => s,1,BackgroundDetect(demo-congrats,1,20,,20000)
+exten => s,n,UserEvent(charlie_alpha, status: FAILURE)
+exten => s,n,Hangup()
-;DETECT AUDIO
-exten => a_exten,n,Set(TALK_DETECTED=0) ; initialize TALK_DETECT var
-exten => a_exten,n,BackgroundDetect(${TALK_AUDIO},1,20,,20000) ; lets see if we have 2 way audio
-
-;CHECK AUDIO RESULTS
-exten => a_exten,n,Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-checking talk detect results)
-exten => a_exten,n,GoToIf($[${TALK_DETECTED}=0]?talkdetectfail:talkdetectpass)
-exten => a_exten,n(talkdetectfail),Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-talk detect failed TALK_DETECTED is ${TALK_DETECTED})
-exten => a_exten,n,Hangup()
-
-;PASSED ! we make it to this point in the dial plan, A has passed.
-exten => a_exten,n(talkdetectpass),Set(GLOBAL(ATT_TEST_A_LEG)=PASS)
-
-;REPORT SUCCESS, at this point in the dialplay this call leg passed.
-exten => a_exten,n,AGI(agi://127.0.0.1:4573) ;Tell the test script A passed
-
-; since both channels are attempted to detect audio, we must play this file twice because
-; we can not guarantee who broke out of BackgroundDetect first
-exten => a_exten,n,Playback(${TALK_AUDIO})
-
-; __________________ C ______________________
-exten => c_exten,1,Set(GLOBAL(ATT_TEST_C_LEG)=FAIL-extension was called)
-exten => c_exten,n,Answer()
-exten => c_exten,n,Wait(1)
-
-;SEND DTMF TO B SIGNALING WE ARE HERE, b will hangup right after this, wait with audio to guarantee this.
-exten => c_exten,n,SendDTMF(1w1w0w#) ; send some dtmf to B
-exten => c_exten,n,Set(GLOBAL(ATT_TEST_C_LEG)=FAIL-sent dtmf to B waiting for B to terminate call)
-
-; Wait for B to hangup, which will connect C to A. Playback is done 4 times
-; just like A here to guarantee that by the time the audio is done playing
-; A will be ready to read DTMF from C.
-exten => c_exten,n,Playback(${TALK_AUDIO})
-exten => c_exten,n,Playback(${TALK_AUDIO})
-exten => c_exten,n,Playback(${TALK_AUDIO})
-exten => c_exten,n,Playback(${TALK_AUDIO})
-
-;SEND DTMF TO A SIGNALLING WE ARE HERE, b hung up, now we should be talking to A
-exten => c_exten,n,Set(GLOBAL(ATT_C_DTMF_TO_A)= sent dtmf to A at ${STRFTIME(epoch,,'seconds: %S ms: %q3')})
-exten => c_exten,n,SendDTMF(1w0w0w#) ; send some dtmf to A
-exten => c_exten,n,Set(GLOBAL(ATT_TEST_C_LEG)=FAIL-sent dtmf to A now performing audio detect)
-
-;DETECT AUDIO
-exten => c_exten,n,Set(TALK_DETECTED=0) ; initialize TALK_DETECTED var
-exten => c_exten,n,BackgroundDetect(${TALK_AUDIO},1,20,,20000) ; lets see if we have some 2 way audio
-
-;CHECK AUDIO RESULTS
-exten => c_exten,n,Set(GLOBAL(ATT_TEST_C_LEG)=FAIL-checking talk detect results)
-exten => c_exten,n,GoToIf($[${TALK_DETECTED}=0]?talkdetectfail:talkdetectpass)
-exten => c_exten,n(talkdetectfail),Set(GLOBAL(ATT_TEST_C_LEG)=FAIL-talk detect failed TALK_DETECT is ${TALK_DETECTED}. Time is ${STRFTIME(epoch,,'seconds: %S ms: %q3')})
-exten => c_exten,n,Hangup()
-
-;PASSED ! we make it to this point in the dial plan, C has passed.
-exten => c_exten,n(talkdetectpass),Set(GLOBAL(ATT_TEST_C_LEG)=PASS)
-
-;REPORT SUCCESS, at this point in the dialplay this call leg passed.
-exten => c_exten,n,AGI(agi://127.0.0.1:4575) ;Tell the test script C passed
-
-; Since both channels are attempted to detect audio, we must continue to play
-; this file because we can not guarantee who broke out of BackgroundDetect first.
-exten => c_exten,n,Playback(${TALK_AUDIO})
-
+exten => talk,1,UserEvent(charlie_alpha, status: SUCCESS)
+exten => talk,n,SendDTMF(2w3w4w5w)
+exten => talk,n,Playback(demo-congrats)
+exten => talk,n,Hangup()
Modified: asterisk/trunk/tests/feature_attended_transfer/configs/ast1/iax.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/ast1/iax.conf?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/ast1/iax.conf (original)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/ast1/iax.conf Wed Dec 22 13:24:35 2010
@@ -1,5 +1,4 @@
[general]
-bindport=4570
bindaddr=127.0.0.1
transfer=yes
@@ -9,25 +8,17 @@
forcejitterbuffer=no
[iax_a]
-type=friend
-host=127.0.0.1
-port=4570
-context=transfertest
-requirecalltoken=no
-
-[iax_b]
-type=friend
-host=127.0.0.1
-port=4571
-context=transfertest
-requirecalltoken=no
+type=user
+host=127.0.0.2
+secret=pa$$word
+context=alpha
+deny=0.0.0.0/0.0.0.0
+permit=127.0.0.2/255.255.255.255
[iax_c]
-type=friend
-host=127.0.0.1
-port=4570
-context=transfertest
-requirecalltoken=no
-
-
-
+type=user
+host=127.0.0.2
+secret=p at ssw0rd
+context=charlie
+deny=0.0.0.0/0.0.0.0
+permit=127.0.0.2/255.255.255.255
Modified: asterisk/trunk/tests/feature_attended_transfer/configs/ast1/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/ast1/manager.conf?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/ast1/manager.conf (original)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/ast1/manager.conf Wed Dec 22 13:24:35 2010
@@ -7,4 +7,3 @@
secret = mysecret
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate
-
Modified: asterisk/trunk/tests/feature_attended_transfer/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/ast2/extensions.conf?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/ast2/extensions.conf (original)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/ast2/extensions.conf Wed Dec 22 13:24:35 2010
@@ -1,45 +1,25 @@
[general]
[globals]
-; use this variable during debugging to see at what step the test failed
-ATT_TEST_B_LEG=FAIL - never even got to read the results
+; this global variable can be used during debugging to view what step went wrong
+BLONDE_TEST_B_LEG=FAIL - never even got to read the results
[transfertest]
+;Call A leg
+exten => a_dial,1,Dial(IAX2/iax_a/1000,,T)
+;Call C leg
+exten => 7002,1,Dial(IAX2/iax_c/1010)
-;Call A leg
-exten => a_dial,1,Dial(IAX2/iax_a at 127.0.0.1:4570/a_exten,,T)
+exten => 1000,1,Answer()
+exten => 1000,n,Background(demo-congrats)
+exten => 1000,n,UserEvent(bravo, status: FAILURE)
+exten => 1000,n,Hangup()
-;Call C leg
-exten => 7002,1,Dial(IAX2/iax_c at 127.0.0.1:4570/c_exten)
+exten => 1050,1,SendDTMF(*w2)
+exten => 1050,n,SendDTMF(7w0w0w2w)
+exten => 1050,n,Background(demo-congrats)
+exten => 1050,n,UserEvent(bravo, status: FAILURE)
+exten => 1050,n,Hangup()
-; __________________ B ______________________
-exten => b_exten,1,Set(GLOBAL(ATT_TEST_B_LEG)=FAIL-made it to b_exten though)
-exten => b_exten,n,Answer()
-exten => b_exten,n,Playback(${TALK_AUDIO})
-
-;SIGNAL FOR TRANSFER, then wait with audio
-exten => b_exten,n,SendDTMF(*w2)
-exten => b_exten,n,Playback(${TALK_AUDIO})
-exten => b_exten,n,Set(GLOBAL(ATT_TEST_B_LEG)=FAIL-began transfer)
-
-;ENTER TRANSFER EXTEN
-exten => b_exten,n,SendDTMF(7w0w0w2)
-exten => b_exten,n,Set(GLOBAL(ATT_TEST_B_LEG)=FAIL-after_entering_dtmf)
-
-;WAIT FOR DTMF FROM C TO KNOW IT IS UP AND SYNCED
-exten => b_exten,n,Read(B_READ,,3,,,20) ; read DTMF from C to know it is there
-exten => b_exten,n,NoOp(B READ IS ${B_READ})
-exten => b_exten,n,Set(GLOBAL(ATT_TEST_B_LEG)=FAIL- B_READ is ${B_READ})
-
-;MAKE SURE DTMF IS WHAT WE EXPECT
-exten => b_exten,n,Set(GLOBAL(ATT_TEST_B_LEG)=FAIL-sometime_after_checking_dtmf_results)
-exten => b_exten,n,GoToIf($[${B_READ}=110]?dtmfpass:dtmffail)
-exten => b_exten,n(dtmffail),Set(GLOBAL(ATT_TEST_B_LEG)=FAIL-DTMF_FROM_C_FAILED ${B_READ})
-exten => b_exten,n,Hangup()
-exten => b_exten,n(dtmfpass),Set(GLOBAL(ATT_TEST_B_LEG)=PASS)
-
-;REPORT SUCCESS, at this point in the dialplay this call leg passed.
-exten => b_exten,n,AGI(agi://127.0.0.1:4574) ;Tell the test script B passed
-
-;HANGUP, now A and C will be connected
-exten => b_exten,n,HangUp()
+exten => 1075,1,UserEvent(bravo, status: SUCCESS)
+exten => 1075,n,Hangup()
Modified: asterisk/trunk/tests/feature_attended_transfer/configs/ast2/iax.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/ast2/iax.conf?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/ast2/iax.conf (original)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/ast2/iax.conf Wed Dec 22 13:24:35 2010
@@ -1,35 +1,21 @@
[general]
-
-bindport=4571
-bindaddr=127.0.0.1
+bindaddr=127.0.0.2
transfer=yes
disallow=all
allow=ulaw
jitterbuffer=no
forcejitterbuffer=no
-
-
[iax_a]
-type=friend
+type=peer
host=127.0.0.1
-port=4570
-context=transfertest
-requirecalltoken=no
-
-[iax_b]
-type=friend
-host=127.0.0.1
-port=4571
-context=transfertest
-requirecalltoken=no
+username=iax_a
+secret=pa$$word
+context=alpha
[iax_c]
-type=friend
+type=peer
host=127.0.0.1
-port=4570
-context=transfertest
-requirecalltoken=no
-
-
-
+username=iax_c
+secret=p at ssw0rd
+context=charlie
Modified: asterisk/trunk/tests/feature_attended_transfer/configs/ast2/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/ast2/manager.conf?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/ast2/manager.conf (original)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/ast2/manager.conf Wed Dec 22 13:24:35 2010
@@ -1,10 +1,9 @@
[general]
enabled = yes
-port = 5039
-bindaddr = 127.0.0.1
+port = 5038
+bindaddr = 127.0.0.2
[user]
secret = mysecret
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate
-
Modified: asterisk/trunk/tests/feature_attended_transfer/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/run-test?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/run-test (original)
+++ asterisk/trunk/tests/feature_attended_transfer/run-test Wed Dec 22 13:24:35 2010
@@ -13,7 +13,7 @@
from optparse import OptionParser
from twisted.application import service, internet
from twisted.internet import reactor
-from starpy import fastagi
+from starpy import manager
sys.path.append("lib/python")
from asterisk.asterisk import Asterisk
@@ -22,18 +22,16 @@
workingdir = "/tmp/asterisk-testsuite/feature_attended_transfer"
testdir = "tests/feature_attended_transfer"
-
-class AttTransferTest:
+class BlondeTransferTest:
def __init__(self, argv):
- self.a_res = 0
- self.b_res = 0
- self.c_res = 0
self.passed = False
- self.done = 0;
+ self.alpha = False
+ self.bravo = False
+ self.charlie = False
+ self.charlie_alpha = False
# Test timeout in seconds
self.test_to = 45
- self.last_step = ""
# get version info
parser = OptionParser()
@@ -41,14 +39,6 @@
help="Asterisk version string")
(options, args) = parser.parse_args(argv)
self.ast_version = AsteriskVersion(options.ast_version)
-
- # FastAGI, listen for results from dialplan
- self.agi_a = fastagi.FastAGIFactory(self.get_result_a)
- self.agi_b = fastagi.FastAGIFactory(self.get_result_b)
- self.agi_c = fastagi.FastAGIFactory(self.get_result_c)
- reactor.listenTCP(4573, self.agi_a, self.test_to, '127.0.0.1')
- reactor.listenTCP(4574, self.agi_b, self.test_to, '127.0.0.1')
- reactor.listenTCP(4575, self.agi_c, self.test_to, '127.0.0.1')
reactor.callWhenRunning(self.run)
@@ -58,95 +48,21 @@
self.ast2 = Asterisk(base=workingdir)
self.ast2.install_configs("%s/configs/ast2" % (testdir))
- self.talkingaudio = os.path.join(os.getcwd(), "%s/sounds/talking" % (testdir))
- # Close out the agi
- def handle_agi_result(self, agi, do_hangup):
- sequence = fastagi.InSequence()
- if do_hangup == 1:
- sequence.append(agi.execute, "HangUp")
- sequence.append(agi.finish)
- self.result_changed()
- return sequence()
+ def check_result(self):
+ self.log_last_step("Checking results...")
+ if (self.alpha is True and self.bravo is True and self.charlie is True
+ and self.charlie_alpha is True):
+ self.stop_reactor()
+ self.passed = True
- # This gets invoked by the dialplan when call leg A passes
- def get_result_a(self, agi):
- self.log_last_step("Attended Xfer Call Leg A PASSED")
- self.a_res = 1
- return self.handle_agi_result(agi, 0)
-
- # This gets invoked by the dialplan when call leg B passes.
- def get_result_b(self, agi):
- self.log_last_step("Attended Xfer Call Leg B PASSED")
- self.b_res = 1
- return self.handle_agi_result(agi, 1)
-
- # This gets invoked by the dialplan when call leg C passes
- def get_result_c(self, agi):
- self.log_last_step("Attended Xfer Call Leg C PASSED")
- self.c_res = 1
- return self.handle_agi_result(agi, 0)
-
- def read_result(self):
- if self.done == True:
- return # this means results were read earlier than the Time Out period
- self.done = True
- self.log_last_step("Reading results")
- self.ast1.cli_exec("core show locks") # get lock output in case of deadlock before tearing down.
- self.ast2.cli_exec("core show locks") # get lock output in case of deadlock before tearing down.
-
- self.ast1.cli_exec("core show channels")# if channels are still up for some reason, we want to know that as well
- self.ast2.cli_exec("core show channels")# if channels are still up for some reason, we want to know that as well
-
- if self.ast_version < AsteriskVersion("1.6.1"):
- self.ast1.cli_exec("core show globals") # The global variables here hold failure conditions
- self.ast2.cli_exec("core show globals") # The global variables here hold failure conditions
- else:
- self.ast1.cli_exec("dialplan show globals") # The global variables here hold failure conditions
- self.ast2.cli_exec("dialplan show globals") # The global variables here hold failure conditions
-
-
- self.stop_asterisk()
-
- if (self.a_res and self.b_res and self.c_res):
- self.passed = True
- self.log_last_step("Attended Transfer Test Passed...")
- else:
- if self.a_res == 0:
- self.log_last_step("Attended Xfer Call Leg A failed.")
- if self.b_res == 0:
- self.log_last_step("Attended Xfer Call Leg B failed.")
- if self.c_res == 0:
- self.log_last_step("Attended Xfer Call Leg C failed.")
- self.log_last_step("Attended Transfer Test Failed... view result of 'core show globals' in log for more detailed failure results.")
-
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
if reactor.running:
- print "Stopping Reactor ..."
reactor.stop()
-
- # This is an attended transfer test. There are 3 call legs tested here, A, B, and C.
- # 1. B calls A
- # 2. B dials *2 to transfer A to C.
- # 3. B dials C
- # 4. C picks up and talks to B.
- # 5. B reports results to FastAGI
- # 6. B hangs up which connects A to C.
- # 7. Audio and DTMF is passed and detected on each side of the call verifying the connection.
- # 8. A and C report results to FastAGI and hangup.
def launch_test(self):
- if self.ast_version < AsteriskVersion("1.6.1"):
- self.ast1.cli_exec("core set global TALK_AUDIO " + self.talkingaudio)
- self.ast2.cli_exec("core set global TALK_AUDIO " + self.talkingaudio)
- else:
- self.ast1.cli_exec("dialplan set global TALK_AUDIO " + self.talkingaudio)
- self.ast2.cli_exec("dialplan set global TALK_AUDIO " + self.talkingaudio)
-
- self.log_last_step("Originating call to begin test 1")
- if self.ast_version < AsteriskVersion("1.6.2"):
- self.ast2.cli_exec("originate IAX2/iax_b at 127.0.0.1:4571/b_exten extension a_dial at transfertest")
- else:
- self.ast2.cli_exec("channel originate IAX2/iax_b at 127.0.0.1:4571/b_exten extension a_dial at transfertest")
+ self.ast2.cli_originate("Local/1000 at transfertest extension a_dial at transfertest")
def start_asterisk(self):
self.log_last_step("Starting Asterisk")
@@ -161,37 +77,102 @@
print step
self.last_step = step
- # This is called every time a result comes in, once all results are in
- # we can quit early instead of waiting for the time out.
- def result_changed(self):
- if (self.a_res and self.b_res and self.c_res):
- self.log_last_step("All the results are in, now read them.")
- # This attempts to schedule a read result earlier than our default timeout.
- # If the default timeout one gets called first, that is fine. Either way
- # this function shuts down the reactor so no other callbacks are processed.
- reactor.callLater(2, self.read_result)
+ def check_alpha(self, ami, event):
+ self.log_last_step("Checking Userevent")
+ if event.get("userevent").lower() != "alpha":
+ return
+ status = event.get("status")
+ print ("Status of alpha is %s" % (status))
+ if status != "SUCCESS":
+ self.stop_reactor()
+ return
+
+ self.alpha = True
+ self.check_result()
+
+ def check_bravo(self, ami, event):
+ self.log_last_step("Checking Userevent")
+ if event.get("userevent").lower() != "bravo":
+ return
+ status = event.get("status")
+ print ("Status of bravo is %s" % (status))
+ if status != "SUCCESS":
+ self.stop_reactor()
+ return
+
+ self.bravo = True
+ self.check_result()
+
+ def check_charlie_alpha(self, ami, event):
+ self.log_last_step("Checking Userevent")
+ if event.get("userevent").lower() != "charlie_alpha":
+ return
+ status = event.get("status")
+ print ("Status of charlie_alpha is %s" % (status))
+ if status != "SUCCESS":
+ self.stop_reactor()
+ return
+
+ self.charlie_alpha = True
+ self.check_result()
+
+ def check_charlie(self, ami, event):
+ self.log_last_step("Checking Userevent")
+ if event.get("userevent").lower() != "charlie":
+ return
+ status = event.get("status")
+ print ("Status of charlie is %s" % (status))
+ if status != "SUCCESS":
+ self.stop_reactor()
+ return
+
+ self.charlie = True
+ self.check_result()
+
+ def ami_on_connect2(self, ami):
+ self.log_last_step("Connected to AMI 2")
+ self.ami2 = ami
+ self.ami2.registerEvent("UserEvent", self.check_bravo)
+
+ def ami_on_connect1(self, ami):
+ self.log_last_step("Connected to AMI 1")
+ self.ami1 = ami
+ self.ami1.registerEvent("UserEvent", self.check_alpha)
+ self.ami1.registerEvent("UserEvent", self.check_charlie)
+ self.ami1.registerEvent("UserEvent", self.check_charlie_alpha)
+
+ def ami_login_error(self, ami):
+ self.log_last_step("AMI login failed")
+ self.stop_reactor()
+
+ def ami_login(self):
+ self.log_last_step("Logging in to the AMI")
+ self.ami_factory1 = manager.AMIFactory("user", "mysecret")
+ self.ami_factory1.login('127.0.0.1', 5038).addCallbacks(self.ami_on_connect1, self.ami_login_error)
+ self.ami_factory2 = manager.AMIFactory("user", "mysecret")
+ self.ami_factory2.login('127.0.0.2', 5038).addCallbacks(self.ami_on_connect2, self.ami_login_error)
def run(self):
- self.start_asterisk()
-
- # call test1 extension now
- reactor.callLater(5, self.launch_test)
+ self.ami_login()
+ self.launch_test()
# stop and read results after timeout
- reactor.callLater(self.test_to, self.read_result)
+ reactor.callLater(self.test_to, self.stop_reactor)
def main(argv=None):
if argv is None:
argv = sys.argv
- # Run Attended Transfer Test
- att_transfer_test = AttTransferTest(argv)
+ # Run Blonde Transfer Test
+ test = BlondeTransferTest(argv)
+ test.start_asterisk()
reactor.run()
- att_transfer_test.stop_asterisk()
- if att_transfer_test.passed != True:
+ test.stop_asterisk()
+ if test.passed != True:
return 1
return 0
if __name__ == "__main__":
sys.exit(main() or 0)
+# vim:sw=4:ts=4:expandtab:textwidth=79
Modified: asterisk/trunk/tests/feature_attended_transfer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/test-config.yaml?view=diff&rev=1279&r1=1278&r2=1279
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/test-config.yaml (original)
+++ asterisk/trunk/tests/feature_attended_transfer/test-config.yaml Wed Dec 22 13:24:35 2010
@@ -1,5 +1,4 @@
testinfo:
- skip: 'Skip while failures are debugged'
summary: 'Test Attended Transfer'
description: |
'This test verifies the Attended Transfer routine used in the feature code.'
More information about the svn-commits
mailing list