[asterisk-commits] dvossel: testsuite/asterisk/trunk r308 - in /asterisk/trunk/tests: feature_at...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 25 11:40:16 CDT 2010
Author: dvossel
Date: Tue May 25 11:40:14 2010
New Revision: 308
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=308
Log:
addition of feature code attended transfer tests
Review: https://reviewboard.asterisk.org/r/659/
Added:
asterisk/trunk/tests/feature_attended_transfer/
asterisk/trunk/tests/feature_attended_transfer/configs/
asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf (with props)
asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf (with props)
asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf (with props)
asterisk/trunk/tests/feature_attended_transfer/configs2/
asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf (with props)
asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf (with props)
asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf (with props)
asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf (with props)
asterisk/trunk/tests/feature_attended_transfer/run-test (with props)
asterisk/trunk/tests/feature_attended_transfer/sounds/
asterisk/trunk/tests/feature_attended_transfer/sounds/talking.ulaw (with props)
asterisk/trunk/tests/feature_attended_transfer/test-config.yaml (with props)
asterisk/trunk/tests/feature_blonde_transfer/
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf (with props)
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf (with props)
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf (with props)
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf (with props)
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/features.conf (with props)
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/iax.conf (with props)
asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/manager.conf (with props)
asterisk/trunk/tests/feature_blonde_transfer/run-test (with props)
asterisk/trunk/tests/feature_blonde_transfer/sounds/
asterisk/trunk/tests/feature_blonde_transfer/sounds/talking.ulaw (with props)
asterisk/trunk/tests/feature_blonde_transfer/test-config.yaml (with props)
Added: asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf (added)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,92 @@
+[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
+
+[transfertest]
+
+; __________________ A ______________________
+exten => a_exten,1,Answer()
+
+;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})
+
+;WAIT FOR DTMF FROM C TO KNOW IT IS UP AND SYNCED
+exten => a_exten,n,Read(A_READ,,3,,,25)
+exten => a_exten,n,NoOp(A READ IS ${A_READ})
+
+;CHECK DTMF FROM C
+exten => a_exten,n,Set(GLOBAL(ATT_TEST_A_LEG)=FAIL-while checking dtmf results)
+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)
+
+;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,Playback(${TALK_AUDIO}) ; play some audio to B
+
+;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(1w1w0) ; send some dtmf to B
+exten => c_exten,1,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,SendDTMF(1w0w0) ; 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})
+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})
+
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf (added)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,33 @@
+[general]
+bindport=4570
+bindaddr=127.0.0.1
+
+transfer=yes
+disallow=all
+allow=ulaw
+jitterbuffer=no
+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
+
+[iax_c]
+type=friend
+host=127.0.0.1
+port=4570
+context=transfertest
+requirecalltoken=no
+
+
+
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/iax.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf (added)
+++ asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,10 @@
+[general]
+enabled = yes
+port = 5038
+bindaddr = 127.0.0.1
+
+[user]
+secret = mysecret
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
+
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf (added)
+++ asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,45 @@
+[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
+
+[transfertest]
+
+;Call A leg
+exten => a_dial,1,Dial(IAX2/iax_a at 127.0.0.1:4570/a_exten,,T)
+
+;Call C leg
+exten => 7002,1,Dial(IAX2/iax_c at 127.0.0.1:4570/c_exten)
+
+; __________________ 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()
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf (added)
+++ asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,4 @@
+[general]
+
+[featuremap]
+atxfer => *2
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/features.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf (added)
+++ asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,35 @@
+[general]
+
+bindport=4571
+bindaddr=127.0.0.1
+transfer=yes
+disallow=all
+allow=ulaw
+jitterbuffer=no
+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
+
+[iax_c]
+type=friend
+host=127.0.0.1
+port=4570
+context=transfertest
+requirecalltoken=no
+
+
+
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/iax.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf (added)
+++ asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,10 @@
+[general]
+enabled = yes
+port = 5039
+bindaddr = 127.0.0.1
+
+[user]
+secret = mysecret
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
+
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/configs2/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/run-test?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/run-test (added)
+++ asterisk/trunk/tests/feature_attended_transfer/run-test Tue May 25 11:40:14 2010
@@ -1,0 +1,203 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+David Vossel <dvossel at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import math
+from optparse import OptionParser
+from twisted.application import service, internet
+from twisted.internet import reactor
+from starpy import fastagi
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.version import AsteriskVersion
+
+class AttTransferTest:
+ def __init__(self, argv):
+ self.a_res = 0
+ self.b_res = 0
+ self.c_res = 0
+ self.passed = False
+ self.done = 0;
+
+ # Test timeout in seconds
+ self.test_to = 45
+ self.last_step = ""
+
+ # get version info
+ parser = OptionParser()
+ parser.add_option("-v", "--version", dest="ast_version",
+ 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)
+
+ print self.ast_version
+ self.asterisk1 = Asterisk(base=os.path.join(os.getcwd(), "/tmp/asterisk-testsuite/feature_attended_transfer"))
+ self.asterisk1.install_config("tests/feature_attended_transfer/configs/extensions.conf")
+ self.asterisk1.install_config("tests/feature_attended_transfer/configs/iax.conf")
+ self.asterisk1.install_config("tests/feature_attended_transfer/configs/manager.conf")
+
+ self.asterisk2 = Asterisk(base=os.path.join(os.getcwd(), "/tmp/asterisk-testsuite/feature_attended_transfer"))
+ self.asterisk2.install_config("tests/feature_attended_transfer/configs2/extensions.conf")
+ self.asterisk2.install_config("tests/feature_attended_transfer/configs2/features.conf")
+ self.asterisk2.install_config("tests/feature_attended_transfer/configs2/iax.conf")
+ self.asterisk2.install_config("tests/feature_attended_transfer/configs2/manager.conf")
+
+ self.talkingaudio = os.path.join(os.getcwd(), "tests/feature_attended_transfer/sounds/talking")
+
+ # 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()
+
+ # 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.asterisk1.cli_exec("core show locks") # get lock output in case of deadlock before tearing down.
+ self.asterisk2.cli_exec("core show locks") # get lock output in case of deadlock before tearing down.
+
+ self.asterisk1.cli_exec("core show channels")# if channels are still up for some reason, we want to know that as well
+ self.asterisk2.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.asterisk1.cli_exec("core show globals") # The global variables here hold failure conditions
+ self.asterisk2.cli_exec("core show globals") # The global variables here hold failure conditions
+ else:
+ self.asterisk1.cli_exec("dialplan show globals") # The global variables here hold failure conditions
+ self.asterisk2.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.")
+
+ 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):
+ self.asterisk2.cli_exec("core set verbose 10")
+ self.asterisk1.cli_exec("core set verbose 10")
+
+ if self.ast_version < AsteriskVersion("1.6.1"):
+ self.asterisk1.cli_exec("core set global TALK_AUDIO " + self.talkingaudio)
+ self.asterisk2.cli_exec("core set global TALK_AUDIO " + self.talkingaudio)
+ else:
+ self.asterisk1.cli_exec("dialplan set global TALK_AUDIO " + self.talkingaudio)
+ self.asterisk2.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.asterisk2.cli_exec("originate IAX2/iax_b at 127.0.0.1:4571/b_exten extension a_dial at transfertest")
+ else:
+ self.asterisk2.cli_exec("channel originate IAX2/iax_b at 127.0.0.1:4571/b_exten extension a_dial at transfertest")
+
+ def start_asterisk(self):
+ self.log_last_step("Starting Asterisk")
+ self.asterisk1.start()
+ self.asterisk2.start()
+
+ def stop_asterisk(self):
+ self.asterisk1.stop()
+ self.asterisk2.stop()
+
+ def log_last_step(self, step):
+ 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 run(self):
+ self.start_asterisk()
+
+ # call test1 extension now
+ reactor.callLater(5, self.launch_test)
+
+ # stop and read results after timeout
+ reactor.callLater(self.test_to, self.read_result)
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+
+ # Run Attended Transfer Test
+ att_transfer_test = AttTransferTest(argv)
+ reactor.run()
+ att_transfer_test.stop_asterisk()
+ if att_transfer_test.passed != True:
+ return 1
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
+
Propchange: asterisk/trunk/tests/feature_attended_transfer/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/feature_attended_transfer/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_attended_transfer/sounds/talking.ulaw
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_attended_transfer/sounds/talking.ulaw?view=auto&rev=308
==============================================================================
Binary file - no diff available.
Propchange: asterisk/trunk/tests/feature_attended_transfer/sounds/talking.ulaw
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: 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=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_attended_transfer/test-config.yaml (added)
+++ asterisk/trunk/tests/feature_attended_transfer/test-config.yaml Tue May 25 11:40:14 2010
@@ -1,0 +1,10 @@
+testinfo:
+ summary: 'Test Attended Transfer'
+ description: |
+ 'This test verifies the Attended Transfer routine used in the feature code.'
+
+properties:
+ minversion: '1.4'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
Propchange: asterisk/trunk/tests/feature_attended_transfer/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_attended_transfer/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_attended_transfer/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf (added)
+++ asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,95 @@
+[general]
+
+[globals]
+; these global variables can be used during debugging to view what step went wrong
+BLONDE_TEST_A_LEG=FAIL-never even got to read the results
+BLONDE_TEST_C_LEG=FAIL-never even got to read the results
+
+[transfertest]
+
+; __________________ A ______________________
+exten => a_exten,1,Answer()
+exten => a_exten,n,Set(GLOBAL(BLONDE_TEST_A_LEG)=FAIL-answered call from B)
+
+;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})
+
+;WAIT FOR DTMF FROM C TO KNOW IT IS UP AND SYNCED
+exten => a_exten,n,Set(GLOBAL(BLONDE_TEST_A_LEG)=FAIL-after reading DTMF from C)
+exten => a_exten,n,Read(A_READ,,3,,,25)
+exten => a_exten,n,NoOp(A READ IS ${A_READ})
+
+;CHECK DTMF FROM C
+exten => a_exten,n,Set(GLOBAL(BLONDE_TEST_A_LEG)=FAIL-while checking dtmf from C results)
+exten => a_exten,n,GoToIf($[${A_READ}=100]?dtmfpass:dtmffail)
+exten => a_exten,n(dtmffail),Set(GLOBAL(BLONDE_TEST_A_LEG)=FAIL-DTMF_FROM_C_FAILED ${A_READ})
+exten => a_exten,n,Hangup()
+exten => a_exten,n(dtmfpass),Set(GLOBAL(BLONDE_TEST_A_LEG)=FAIL-Got DTMF from C A_READ is ${A_READ} now performing audio detect)
+
+;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(BLONDE_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(BLONDE_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(BLONDE_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(BLONDE_TEST_C_LEG)=FAIL-extension was called)
+
+;Wait after entering dialplan for B to hangup.
+exten => c_exten,n,Ringing()
+exten => c_exten,n,Wait(2)
+exten => c_exten,n,Set(GLOBAL(BLONDE_TEST_C_LEG)=FAIL-after waiting before answer)
+exten => c_exten,n,Answer()
+
+exten => c_exten,n,Set(GLOBAL(BLONDE_TEST_C_LEG)=FAIL-extension was answered)
+
+; Play the same amount of audio A does in while waiting to guarantee
+; A is ready to receive DTMF before we send it.
+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,SendDTMF(1w0w0w) ; send some dtmf to A
+exten => c_exten,n,Set(GLOBAL(BLONDE_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(BLONDE_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(BLONDE_TEST_C_LEG)=FAIL-talk detect failed TALK_DETECT is ${TALK_DETECTED})
+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(BLONDE_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})
+
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf (added)
+++ asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,35 @@
+[general]
+bindport=4570
+bindaddr=127.0.0.1
+
+transfer=yes
+disallow=all
+allow=ulaw
+jitterbuffer=no
+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
+
+[iax_c]
+type=friend
+host=127.0.0.1
+port=4570
+context=transfertest
+requirecalltoken=no
+
+
+
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/iax.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf (added)
+++ asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,10 @@
+[general]
+enabled = yes
+port = 5038
+bindaddr = 127.0.0.1
+
+[user]
+secret = mysecret
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
+
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf (added)
+++ asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,31 @@
+[general]
+
+[globals]
+; 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 at 127.0.0.1:4570/a_exten,,T)
+
+;Call C leg
+exten => 7002,1,Dial(IAX2/iax_c at 127.0.0.1:4570/c_exten)
+
+; __________________ B ______________________
+exten => b_exten,1,Set(GLOBAL(BLONDE_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(BLONDE_TEST_B_LEG)=FAIL-began transfer)
+
+;ENTER TRANSFER EXTEN
+exten => b_exten,n,SendDTMF(7w0w0w2w)
+
+exten => b_exten,n,Set(GLOBAL(BLONDE_TEST_B_LEG)=PASS)
+
+;HANGUP before C answers
+;exten => b_exten,n,HangUp()
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/features.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/features.conf?view=auto&rev=308
==============================================================================
--- asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/features.conf (added)
+++ asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/features.conf Tue May 25 11:40:14 2010
@@ -1,0 +1,4 @@
+[general]
+
+[featuremap]
+atxfer => *2
Propchange: asterisk/trunk/tests/feature_blonde_transfer/blonde_configs2/features.conf
[... 340 lines stripped ...]
More information about the asterisk-commits
mailing list