[asterisk-commits] dlee: branch dlee/ari-bridge-tests r4051 - in /asterisk/team/dlee/ari-bridge-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 19 14:43:15 CDT 2013
Author: dlee
Date: Mon Aug 19 14:43:14 2013
New Revision: 4051
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4051
Log:
Merged revisions 4008-4047 from http://svn.asterisk.org/svn/testsuite/asterisk/trunk
Added:
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_hold_direct_media/
- copied from r4047, asterisk/trunk/tests/channels/SIP/sip_hold_direct_media/
asterisk/team/dlee/ari-bridge-tests/tests/channels/pjsip/registration/
- copied from r4047, asterisk/trunk/tests/channels/pjsip/registration/
Modified:
asterisk/team/dlee/ari-bridge-tests/ (props changed)
asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/TestCase.py
asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/asterisk.py
asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_nominal/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_setup/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/automixmon/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/automon/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_nominal/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_setup/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/blonde_nominal/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/disconnect/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_blindxfer/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_no/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_yes/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/simple_bridge/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_capabilities/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_failure/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr-tests.py
asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_manipulation/cdr_fork_end_time/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_properties/cdr_accountcode/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/caller_refer_only/run-test
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/caller_with_reinvite/run-test
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_hold/configs/ast1/sip.conf
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_hold/run-test
asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/tests.yaml
asterisk/team/dlee/ari-bridge-tests/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf
asterisk/team/dlee/ari-bridge-tests/tests/channels/local/local_holding_bridge/test-config.yaml
asterisk/team/dlee/ari-bridge-tests/tests/channels/pjsip/tests.yaml
Propchange: asterisk/team/dlee/ari-bridge-tests/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug 19 14:43:14 2013
@@ -1,1 +1,1 @@
-/asterisk/trunk:1-4005
+/asterisk/trunk:1-4050
Modified: asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/TestCase.py?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/TestCase.py (original)
+++ asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/TestCase.py Mon Aug 19 14:43:14 2013
@@ -345,7 +345,7 @@
temp_defer = self.ast[index].stop()
stop_defers.append(temp_defer)
- defer.DeferredList(stop_defers, consumeErrors=True).addCallback(
+ defer.DeferredList(stop_defers).addCallback(
__check_success_failure)
return result
@@ -581,3 +581,33 @@
if self.passed == False:
return
self.passed = value
+
+
+class TestCaseModule(TestCase):
+ '''
+ The most basic of test objects for a pluggable module. This wraps the TestCase
+ class such that it can be used and configured from YAML.
+ '''
+
+ def __init__(self, test_path='', test_config=None):
+ ''' Constructor
+
+ :param test_path Full path to the test location
+ :param test_config The YAML provided test configuration for this object
+ '''
+ super(TestCaseModule, self).__init__(test_path, test_config)
+ self.asterisk_instances = test_config.get('asterisk-instances') or 1
+ self.connect_ami = test_config.get('connect-ami') or False
+ self.connect_agi = test_config.get('connect-agi') or False
+
+ self.create_asterisk(count=self.asterisk_instances)
+
+ def run(self):
+ ''' The reactor entry point '''
+ super(TestCaseModule, self).run()
+
+ if self.connect_ami:
+ self.create_ami_factory(count=self.asterisk_instances)
+ if self.connect_agi:
+ self.create_fastagi_factory(count=self.asterisk_instances)
+
Modified: asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/asterisk.py?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/dlee/ari-bridge-tests/lib/python/asterisk/asterisk.py Mon Aug 19 14:43:14 2013
@@ -284,7 +284,7 @@
self.__start_deferred.errback(Exception("Command core waitfullybooted failed"))
else:
logger.debug("Asterisk core waitfullybooted failed, attempting again...")
- reactor.callLater(0, __execute_wait_fully_booted)
+ reactor.callLater(1, __execute_wait_fully_booted)
self.install_configs(os.getcwd() + "/configs")
self.__setup_configs()
@@ -324,77 +324,50 @@
asterisk.stop()
"""
+ def __cancel_stops(reason):
+ """ Cancel all stop actions - called when the process exits """
+ for token in self.__stop_cancel_tokens:
+ try:
+ if token.active():
+ token.cancel()
+ except error.AlreadyCalled:
+ # Ignore if we already killed it
+ pass
+ return reason
+
def __send_stop_gracefully():
""" Send a core stop gracefully CLI command """
+ logger.debug('sending stop gracefully')
if self.ast_version < AsteriskVersion("1.6.0"):
cli_deferred = self.cli_exec("stop gracefully")
else:
cli_deferred = self.cli_exec("core stop gracefully")
- cli_deferred.addCallbacks(__stop_gracefully_callback, __stop_gracefully_error)
+ cli_deferred.addCallbacks(__stop_gracefully_callback,
+ __stop_gracefully_error)
def __stop_gracefully_callback(cli_command):
""" Callback handler for the core stop gracefully CLI command """
logger.debug("Successfully stopped Asterisk %s" % self.host)
- self.__stop_attempts = 0
+ reactor.callLater(0, __cancel_stops, None)
+ return cli_command
def __stop_gracefully_error(cli_command):
""" Errback for the core stop gracefully CLI command """
- if self.__stop_attempts > 5:
- self.__stop_attempts = 0
- logger.warning("Asterisk graceful stop for %s failed" % self.host)
- else:
- logger.debug("Asterisk graceful stop failed, attempting again...")
- self.__stop_attempts += 1
- __send_stop_gracefully()
-
- def __send_stop_now():
- """ Send a core stop now CLI command """
- if self.ast_version < AsteriskVersion("1.6.0"):
- cli_deferred = self.cli_exec("stop now")
- else:
- cli_deferred = self.cli_exec("core stop now")
- if cli_deferred:
- cli_deferred.addCallbacks(__stop_now_callback, __stop_now_error)
-
- def __stop_now_callback(cli_command):
- """ Callback handler for the core stop now CLI command """
- logger.debug("Successfully stopped Asterisk %s" % self.host)
- self.__stop_attempts = 0
-
- def __stop_now_error(cli_command):
- """ Errback handler for the core stop now CLI command """
- if self.__stop_attempts > 5:
- self.__stop_attempts = 0
- logger.warning("Asterisk graceful stop for %s failed" % self.host)
- else:
- logger.debug("Asterisk stop now failed, attempting again...")
- self.__stop_attempts += 1
- cli_deferred = __send_stop_now()
- if cli_deferred:
- cli_deferred.addCallbacks(__stop_now_callback, __stop_now_error)
-
- def __send_term():
- """ Send a TERM signal to the Asterisk instance """
- try:
- logger.info("Sending TERM to Asterisk %s" % self.host)
- self.process.signalProcess("TERM")
- except error.ProcessExitedAlready:
- # Probably that we sent a signal to a process that was already
- # dead. Just ignore it.
- pass
+ logger.warning("Asterisk graceful stop for %s failed" % self.host)
+ return cli_command
def __send_kill():
""" Check to see if the process is running and kill it with fire """
try:
if not self.processProtocol.exited:
- logger.info("Sending KILL to Asterisk %s" % self.host)
+ logger.warning("Sending KILL to Asterisk %s" % self.host)
self.process.signalProcess("KILL")
except error.ProcessExitedAlready:
# Pass on this
pass
- # If you kill the process, the ProcessProtocol may never get the note
- # that its dead. Call the stop callback to notify everyone that we did
- # indeed kill the Asterisk instance.
+ # If you kill the process, the ProcessProtocol may never get
+ # the note that its dead. Call the stop callback to notify everyone
+ # that we did indeed kill the Asterisk instance.
try:
# Attempt to signal the process object that it should lose its
# connection - it may already be gone however.
@@ -403,33 +376,37 @@
pass
try:
if not self.__stop_deferred.called:
- self.__stop_deferred.callback("Asterisk %s KILLED" % self.host)
+ self.__stop_deferred.callback("Asterisk %s KILLED" %
+ self.host)
except defer.AlreadyCalledError:
- logger.warning("Asterisk %s stop deferred already called" % self.host)
-
- def __cancel_stops(reason):
- """ Cancel all stop actions - called when the process exits """
- for token in self.__stop_cancel_tokens:
- try:
- if token.active():
- token.cancel()
- except error.AlreadyCalled:
- # If we're canceling something that's already been called, move on
- pass
+ logger.warning("Asterisk %s stop deferred already called" %
+ self.host)
+
+ def __process_stopped(reason):
+ ''' Generic callback that raises the stopped deferred
+ subscribers use to know that the process has exited '''
+ self.__stop_deferred.callback(reason)
return reason
- self.__stop_cancel_tokens = []
- self.__stop_attempts = 0
- # Start by asking to stop gracefully.
- __send_stop_gracefully()
-
- # Schedule progressively more aggressive mechanisms of stopping Asterisk. If any
- # stop mechanism succeeds, all are canceled
- self.__stop_cancel_tokens.append(reactor.callLater(5, __send_stop_now))
- self.__stop_cancel_tokens.append(reactor.callLater(10, __send_term))
- self.__stop_cancel_tokens.append(reactor.callLater(15, __send_kill))
-
- self.__stop_deferred.addCallback(__cancel_stops)
+ if self.processProtocol.exited:
+ try:
+ if not self.__stop_deferred.called:
+ self.__stop_deferred.callback(
+ "Asterisk %s stopped prematurely" % self.host)
+ except defer.AlreadyCalledError:
+ logger.warning("Asterisk %s stop deferred already called" %
+ self.host)
+ else:
+ self.__stop_cancel_tokens = []
+
+ # Schedule a kill. If we don't gracefully shut down Asterisk, this
+ # will ensure that the test is stopped.
+ self.__stop_cancel_tokens.append(reactor.callLater(10, __send_kill))
+
+ # Start by asking to stop gracefully.
+ __send_stop_gracefully()
+
+ self.__stop_deferred.addCallback(__cancel_stops)
return self.__stop_deferred
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_nominal/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_nominal/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_nominal/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -59,8 +59,9 @@
exten: '123'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_setup/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_setup/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_setup/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/atxfer_setup/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -415,8 +415,9 @@
channel: '.*/alice-.*'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/automixmon/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/automixmon/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/automixmon/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/automixmon/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -589,6 +589,7 @@
properties:
minversion: '12.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/automon/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/automon/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/automon/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/automon/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -591,6 +591,7 @@
properties:
minversion: '12.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_nominal/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_nominal/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_nominal/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -59,8 +59,9 @@
exten: '123'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_setup/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_setup/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_setup/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/blindxfer_setup/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -415,8 +415,9 @@
channel: '.*/alice-.*'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/blonde_nominal/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/blonde_nominal/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/blonde_nominal/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/blonde_nominal/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -46,8 +46,9 @@
exten: '123'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/disconnect/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/disconnect/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/disconnect/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/disconnect/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -413,8 +413,9 @@
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -119,6 +119,7 @@
properties:
minversion: '12.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_blindxfer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_blindxfer/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_blindxfer/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_blindxfer/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -190,7 +190,7 @@
count: '1'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
- buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_no/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_no/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_no/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_no/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -80,8 +80,9 @@
amaflags: 'DOCUMENTATION'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_yes/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_yes/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_yes/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/parkcall_timeout/comebacktoorigin_yes/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -109,8 +109,9 @@
amaflags: 'DOCUMENTATION'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/simple_bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/simple_bridge/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/simple_bridge/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/simple_bridge/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -17,7 +17,12 @@
typename: 'cel.CELModule'
-
typename: 'ami.AMIEventModule'
- config-section: ami-uut
+ config-section: 'ami-uut-v12'
+ minversion: '12.0.0'
+ -
+ typename: 'ami.AMIEventModule'
+ config-section: 'ami-uut-v11'
+ maxversion: '12.0.0'
bridge-config:
test-runs:
@@ -28,7 +33,7 @@
originate_channel: 'SIP/test_call at uut'
hangup: 'bob'
-ami-uut:
+ami-uut-v12:
-
type: 'headermatch'
id: '0'
@@ -137,6 +142,66 @@
BridgeType: 'simple_bridge'
count: '2'
+ami-uut-v11:
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Newstate'
+ Channel: 'SIP/bob-.*'
+ ChannelStateDesc: 'Up'
+ requirements:
+ match:
+ CallerIDNum: '4321'
+ CallerIDName: 'Bob'
+ ConnectedLineNum: '1234'
+ ConnectedLineName: 'Alice'
+ count: '2'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Newstate'
+ Channel: 'SIP/alice-.*'
+ ChannelStateDesc: 'Up'
+ requirements:
+ match:
+ CallerIDNum: '1234'
+ CallerIDName: 'Alice'
+ ConnectedLineNum: '4321'
+ ConnectedLineName: 'Bob'
+ count: '2'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Bridge'
+ Bridgestate: 'Link'
+ requirements:
+ match:
+ Channel1: 'SIP/alice-.*'
+ Channel2: 'SIP/bob-.*'
+ CallerID1: '1234'
+ CallerID2: '4321'
+ count: '10'
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'Bridge'
+ Bridgestate: 'Unlink'
+ requirements:
+ match:
+ Channel1: 'SIP/alice-.*'
+ Channel2: 'SIP/bob-.*'
+ CallerID1: '1234'
+ CallerID2: '4321'
+ count: '10'
+
cdr-config:
-
file: 'Master'
@@ -380,7 +445,7 @@
channel: '.*/alice-.*'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
- python : 'twisted'
- python : 'starpy'
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_capabilities/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_capabilities/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_capabilities/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_capabilities/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -8,6 +8,7 @@
properties:
minversion: '12.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_failure/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_failure/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_failure/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/bridge/transfer_failure/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -5,8 +5,9 @@
that transfer attempts with invalid extensions do not succeed.'
properties:
- minversion: '12.0.0'
+ minversion: '11.0.0'
dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
- python : 'twisted'
- python : 'starpy'
tags:
Modified: asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr-tests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr-tests.py?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr-tests.py (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr-tests.py Mon Aug 19 14:43:14 2013
@@ -136,6 +136,34 @@
self.test_object.set_passed(False)
return
+ self.test_object.set_passed(True)
+
+
+
+class ForkCdrModuleEndResetTime(ForkCdrModuleEndTime):
+ ''' A class that adds some additional CDR checking of the end times on top
+ of CDRModule
+
+ In addition to checking the normal expectations, this class also checks
+ whether or not the end times of the CDRs are within some period of time
+ of each each other.
+
+ Note that this class assumes the CDRs are in cdrtest_local.
+ '''
+
+ def __init__(self, module_config, test_object):
+ super(ForkCdrModuleEndResetTime, self).__init__(module_config,
+ test_object)
+ self.entries_to_check = module_config[0]['check-entries']
+
+ def match_cdrs(self):
+ super(ForkCdrModuleEndResetTime, self).match_cdrs()
+
+ cdr1 = AsteriskCSVCDR(fn = "%s/%s/cdr-csv/%s.csv" %
+ (self.test_object.ast[0].base,
+ self.test_object.ast[0].directories['astlogdir'],
+ "cdrtest_local"))
+
LOGGER.debug('Checking start/end times for forked entries')
for i in range(len(self.entries_to_check) - 1):
end = time.strptime(cdr1[self.entries_to_check[i]].end,
Modified: asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_manipulation/cdr_fork_end_time/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_manipulation/cdr_fork_end_time/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_manipulation/cdr_fork_end_time/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_manipulation/cdr_fork_end_time/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -20,7 +20,7 @@
-
maxversion: '12.0.0'
config-section: 'cdr-config-pre-12'
- typename: 'cdr-tests.ForkCdrModuleEndTime'
+ typename: 'cdr-tests.ForkCdrModuleEndResetTime'
-
minversion: '12.0.0'
config-section: 'cdr-config-12'
Modified: asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_properties/cdr_accountcode/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_properties/cdr_accountcode/test-config.yaml?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_properties/cdr_accountcode/test-config.yaml (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/cdr/cdr_properties/cdr_accountcode/test-config.yaml Mon Aug 19 14:43:14 2013
@@ -109,6 +109,18 @@
disposition: 'ANSWERED'
amaflags: 'DOCUMENTATION'
-
+ # caller with Echo app
+ accountcode: ''
+ destination: '1'
+ dcontext: 'default'
+ callerid: '"" <2>'
+ channel: 'Local/1 at default-.*'
+ dchannel: ''
+ lastapp: 'Echo'
+ lastarg: ''
+ disposition: 'ANSWERED'
+ amaflags: 'DOCUMENTATION'
+ -
# 1 at default -> 2 at default
accountcode: 'initial'
destination: '1'
@@ -118,18 +130,6 @@
dchannel: 'Local/2 at default-.*'
lastapp: 'Dial'
lastarg: 'Local/2 at default'
- disposition: 'ANSWERED'
- amaflags: 'DOCUMENTATION'
- -
- # caller with Echo app
- accountcode: ''
- destination: '1'
- dcontext: 'default'
- callerid: '"" <>'
- channel: 'Local/1 at default-.*'
- dchannel: ''
- lastapp: 'Echo'
- lastarg: ''
disposition: 'ANSWERED'
amaflags: 'DOCUMENTATION'
Modified: asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_refer_only/run-test Mon Aug 19 14:43:14 2013
@@ -20,6 +20,7 @@
sys.path.append("lib/python")
from asterisk.asterisk import Asterisk
from asterisk.TestCase import TestCase
+from asterisk.version import AsteriskVersion
logger = logging.getLogger(__name__)
@@ -36,6 +37,8 @@
def __init__(self):
TestCase.__init__(self)
self.passed = False
+ self.channel1 = None
+ self.transfer_event_received = False
self.create_asterisk()
def read_result(self):
@@ -55,11 +58,35 @@
# start up the processes
self.start_processes()
- ami.registerEvent('Bridge', self.bridge_event_handler)
- ami.registerEvent('Transfer', self.transfer_event_handler)
+ if AsteriskVersion() >= AsteriskVersion("12"):
+ ami.registerEvent('BridgeEnter', self.bridge_enter_event_handler)
+ ami.registerEvent('BlindTransfer', self.blind_transfer_event_handler)
+ else:
+ ami.registerEvent('Bridge', self.bridge_event_handler)
+ ami.registerEvent('Transfer', self.transfer_event_handler)
ami.registerEvent('Hangup', self.hangup_event_handler)
self.a_call_b()
+
+ def bridge_enter_event_handler(self, ami, event):
+ if not self.channel1:
+ self.channel1 = event['channel']
+ logger.debug("Received bridge enter for channel %s" % self.channel1)
+ return
+
+ channel2 = event['channel']
+ logger.debug("Received bridge enter for channel %s" % channel2)
+
+ if (self.channel1 == BlindTransfer.phone_a_channel and channel2 == BlindTransfer.phone_b_channel) or \
+ (self.channel1 == BlindTransfer.phone_b_channel and channel2 == BlindTransfer.phone_a_channel):
+ logger.debug("Starting transfer of Phone B to Phone C")
+ self.b_transfer_a_to_c()
+ self.channel1 = None
+ elif (self.channel1 == BlindTransfer.phone_a_channel and channel2 == BlindTransfer.phone_c_channel) or \
+ (self.channel1 == BlindTransfer.phone_c_channel and channel2 == BlindTransfer.phone_a_channel):
+ self.ami_check_bridge()
+ else:
+ logger.warning("Unexpected bridge (%s and %s) received!" % (self.channel1, channel2))
def bridge_event_handler(self, ami, event):
bridgetype = event['bridgetype'].lower()
@@ -78,6 +105,13 @@
elif bridgetype != 'core' or bridgestate != 'unlink':
logger.warning("Unexpected bridgetype %s or bridgestate %s received!" % (bridgetype, bridgestate))
+ def blind_transfer_event_handler(self, ami, event):
+ if event['isexternal'].lower() != 'yes':
+ logger.warn("Unexpected transfer type: Internal")
+ else:
+ logger.debug("Received blind external transfer initiated by %(transfererchannel)s to %(extension)s@%(context)s" % event)
+ self.transfer_event_received = True
+
def transfer_event_handler(self, ami, event):
transfertype = event['transfertype'].lower()
transfermethod = event['transfermethod'].lower()
@@ -102,6 +136,12 @@
logger.warn("Transfer event failed or contained incorrect data; not checking bridge results")
self.passed = False
self.read_result()
+ return
+
+ if AsteriskVersion() >= AsteriskVersion('12'):
+ # the following has already been verified using bridgeenter messages so exit early
+ self.passed = True
+ self.hangup_channel_c()
return
logger.debug('Results %s' % str(results))
Modified: asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test?view=diff&rev=4051&r1=4050&r2=4051
==============================================================================
--- asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test (original)
+++ asterisk/team/dlee/ari-bridge-tests/tests/channels/SIP/sip_blind_transfer/callee_with_reinvite/run-test Mon Aug 19 14:43:14 2013
@@ -20,6 +20,7 @@
sys.path.append("lib/python")
from asterisk.asterisk import Asterisk
from asterisk.TestCase import TestCase
+from asterisk.version import AsteriskVersion
logger = logging.getLogger(__name__)
@@ -36,6 +37,8 @@
def __init__(self):
TestCase.__init__(self)
self.passed = False
+ self.channel1 = None
+ self.transfer_event_received = False
self.create_asterisk()
def read_result(self):
@@ -55,11 +58,35 @@
# start up the processes
self.start_processes()
- ami.registerEvent('Bridge', self.bridge_event_handler)
- ami.registerEvent('Transfer', self.transfer_event_handler)
+ if AsteriskVersion() >= AsteriskVersion("12"):
+ ami.registerEvent('BridgeEnter', self.bridge_enter_event_handler)
+ ami.registerEvent('BlindTransfer', self.blind_transfer_event_handler)
+ else:
+ ami.registerEvent('Bridge', self.bridge_event_handler)
+ ami.registerEvent('Transfer', self.transfer_event_handler)
ami.registerEvent('Hangup', self.hangup_event_handler)
self.a_call_b()
+
+ def bridge_enter_event_handler(self, ami, event):
+ if not self.channel1:
+ self.channel1 = event['channel']
+ logger.debug("Received bridge enter for channel %s" % self.channel1)
+ return
+
+ channel2 = event['channel']
+ logger.debug("Received bridge enter for channel %s" % channel2)
+
+ if (self.channel1 == BlindTransfer.phone_a_channel and channel2 == BlindTransfer.phone_b_channel) or \
+ (self.channel1 == BlindTransfer.phone_b_channel and channel2 == BlindTransfer.phone_a_channel):
+ logger.debug("Starting transfer of Phone B to Phone C")
+ self.b_transfer_a_to_c()
+ self.channel1 = None
+ elif (self.channel1 == BlindTransfer.phone_a_channel and channel2 == BlindTransfer.phone_c_channel) or \
+ (self.channel1 == BlindTransfer.phone_c_channel and channel2 == BlindTransfer.phone_a_channel):
+ self.ami_check_bridge()
+ else:
+ logger.warning("Unexpected bridge (%s and %s) received!" % (self.channel1, channel2))
def bridge_event_handler(self, ami, event):
bridgetype = event['bridgetype'].lower()
@@ -78,6 +105,13 @@
elif bridgetype != 'core' or bridgestate != 'unlink':
logger.warning("Unexpected bridgetype %s or bridgestate %s received!" % (bridgetype, bridgestate))
+ def blind_transfer_event_handler(self, ami, event):
+ if event['isexternal'].lower() != 'yes':
+ logger.warn("Unexpected transfer type: Internal")
+ else:
[... 347 lines stripped ...]
More information about the asterisk-commits
mailing list