[asterisk-commits] pabelanger: branch pabelanger/SWP-2717 r1287 - in /asterisk/team/pabelanger/S...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Dec 23 02:35:01 UTC 2010
Author: pabelanger
Date: Wed Dec 22 20:34:57 2010
New Revision: 1287
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1287
Log:
Rework test
Added:
asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/configs/ast1/manager.conf
- copied unchanged from r1281, asterisk/team/pabelanger/SWP-2717/tests/mixmonitor/configs/ast1/manager.conf
Removed:
asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/configs/ast1/features.conf
Modified:
asterisk/team/pabelanger/SWP-2717/tests/mixmonitor/test-config.yaml
asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/configs/ast1/extensions.conf
asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/run-test
asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/test-config.yaml
Modified: asterisk/team/pabelanger/SWP-2717/tests/mixmonitor/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/SWP-2717/tests/mixmonitor/test-config.yaml?view=diff&rev=1287&r1=1286&r2=1287
==============================================================================
--- asterisk/team/pabelanger/SWP-2717/tests/mixmonitor/test-config.yaml (original)
+++ asterisk/team/pabelanger/SWP-2717/tests/mixmonitor/test-config.yaml Wed Dec 22 20:34:57 2010
@@ -8,3 +8,4 @@
minversion: '1.4'
dependencies:
- python : 'twisted'
+ - python : 'starpy'
Modified: asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/configs/ast1/extensions.conf?view=diff&rev=1287&r1=1286&r2=1287
==============================================================================
--- asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/configs/ast1/extensions.conf (original)
+++ asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/configs/ast1/extensions.conf Wed Dec 22 20:34:57 2010
@@ -2,22 +2,23 @@
[globals]
+[listener]
+exten => s,1,Answer()
+exten => s,n,Echo()
+
+[ast1]
+exten => 101,1,Answer()
+exten => 101,n,MixMonitor(${TESTAUDIO1})
+exten => 101,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
+exten => 101,n,Dial(Local/2000 at mixmonitortest,,tT)
+
[mixmonitortest]
-
-exten => test1,1,Answer()
-exten => test1,n,MixMonitor(${TESTAUDIO1})
-exten => test1,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
-exten => test1,n,Dial(Local/test_transfer at mixmonitortest,,tT)
-
-exten => test_transfer,1,Answer()
-
-exten => test_transfer,n,SendDTMF(*w2w)
-;exten => test_transfer,n,Wait(1)
-exten => test_transfer,n,SendDTMF(1w2w3w4w)
+exten => 2000,1,Answer()
+exten => 2000,n,SendDTMF(#)
+exten => 2000,n,SendDTMF(1w2w3w4w)
exten => 1234,1,Answer()
-exten => 1234,n,Playback(${TALK_AUDIO})
-exten => 1234,n,Playback(${TALK_AUDIO})
-exten => 1234,n,Playback(${TALK_AUDIO})
-exten => 1234,n,Playback(${TALK_AUDIO})
+exten => 1234,n,Playback(demo-thanks)
+exten => 1234,n,StopMixMonitor()
+exten => 1234,n,UserEvent(test1, status: SUCCESS)
exten => 1234,n,Hangup()
Modified: asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/run-test?view=diff&rev=1287&r1=1286&r2=1287
==============================================================================
--- asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/run-test (original)
+++ asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/run-test Wed Dec 22 20:34:57 2010
@@ -12,6 +12,7 @@
import math
from optparse import OptionParser
from twisted.internet import reactor
+from starpy import manager
sys.path.append("lib/python")
from asterisk.asterisk import Asterisk
@@ -42,17 +43,18 @@
self.audiofile1 = os.path.join(os.getcwd(), "%s/testaudio1" % (testdir))
self.talkingaudio = os.path.join(os.getcwd(), "%s/sounds/talking" % (testdir))
- def read_result(self):
- self.log_last_step("Reading result file from MixMonitor")
- if os.path.exists(self.audiofile1 + ".raw"):
- self.audiofile1size = os.path.getsize(self.audiofile1 + ".raw")
-
- self.stop_asterisk()
+ def stop_reactor(self):
print "Stopping Reactor ..."
if reactor.running:
reactor.stop()
+ def read_result(self):
self.passed = True
+ self.stop_reactor()
+
+ self.log_last_step("Reading result file from MixMonitor")
+ if os.path.exists(self.audiofile1 + ".raw"):
+ self.audiofile1size = os.path.getsize(self.audiofile1 + ".raw")
self.log_last_step("audiofile1 size is %d, a negative size indicates the file was not present." % (self.audiofile1size, ))
if self.audiofile1size < self.expectedfilesize:
@@ -65,7 +67,33 @@
def launch_test1(self):
self.log_last_step("Placing call to test1 exten")
- self.ast1.cli_exec("console dial test1 at mixmonitortest")
+ self.ast1.cli_originate("Local/s at listener extension 101 at ast1")
+
+ def check_test1(self, ami, event):
+ self.log_last_step("Checking Userevent")
+ if event.get("userevent").lower() != "test1":
+ return
+ status = event.get("status")
+ print ("Status of test1 is %s" % (status))
+ if status != "SUCCESS":
+ self.stop_reactor()
+ return
+
+ self.read_result()
+
+ def ami_on_connect1(self, ami):
+ self.log_last_step("Connected to AMI 1")
+ self.ami = ami
+ self.ami.registerEvent("UserEvent", self.check_test1)
+
+ 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)
def start_asterisk(self):
self.log_last_step("Starting Asterisk")
@@ -86,18 +114,16 @@
self.last_step = step
def run(self):
- self.start_asterisk()
-
- # call test1 extension now
+ self.ami_login()
self.launch_test1()
- # read test results in 20 seconds
- reactor.callLater(20, self.read_result)
+ reactor.callLater(30, self.stop_reactor)
def main(argv=None):
if argv is None:
argv = sys.argv
test = MixMonitorTest(argv)
+ test.start_asterisk()
reactor.run()
test.stop_asterisk()
if test.passed:
@@ -107,3 +133,4 @@
if __name__ == "__main__":
sys.exit(main() or 0)
+# vim:sw=4:ts=4:expandtab:textwidth=79
Modified: asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/test-config.yaml?view=diff&rev=1287&r1=1286&r2=1287
==============================================================================
--- asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/test-config.yaml (original)
+++ asterisk/team/pabelanger/SWP-2717/tests/mixmonitor_audiohook_inherit/test-config.yaml Wed Dec 22 20:34:57 2010
@@ -1,5 +1,4 @@
testinfo:
- skip: 'Skip while failures are debugged'
summary: 'Test MixMonitor with AUDIOHOOK_INHERIT'
description: |
'This test verifies basic functionality using MixMonitor with AUDIOHOOK_INHERIT.
@@ -15,4 +14,4 @@
minversion: '1.6.2'
dependencies:
- python : 'twisted'
- - custom : 'soundcard'
+ - python : 'starpy'
More information about the asterisk-commits
mailing list