[asterisk-commits] sgriepentrog: testsuite/asterisk/trunk r4805 - in /asterisk/trunk: lib/python...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 7 14:01:31 CST 2014
Author: sgriepentrog
Date: Fri Mar 7 14:01:25 2014
New Revision: 4805
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4805
Log:
testsuite: check ARI objects created with ID's
Tests include channel origination, bridge creation,
starting playback, and snoop. Improvements made to
ARI test library to support these changes include:
* new class AriOriginateTestObject does exactly that
* new option for ari websocket events to send
arbitrary ari requests in response
* variable replacement from event values possible
in creating uri for request
(issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3277/
Added:
asterisk/trunk/tests/rest_api/bridges/bridge_by_id/
asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/
asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/
asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/channels/originate_with_id/
asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/
asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/
asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/channels/snoop_id/
asterisk/trunk/tests/rest_api/channels/snoop_id/configs/
asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/
asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/playback/
asterisk/trunk/tests/rest_api/playback/basic/
asterisk/trunk/tests/rest_api/playback/basic/configs/
asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/
asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/rest_api/playback/basic/test-config.yaml (with props)
asterisk/trunk/tests/rest_api/playback/tests.yaml (with props)
Modified:
asterisk/trunk/lib/python/asterisk/ari.py
asterisk/trunk/tests/rest_api/bridges/tests.yaml
asterisk/trunk/tests/rest_api/channels/tests.yaml
asterisk/trunk/tests/rest_api/tests.yaml
Modified: asterisk/trunk/lib/python/asterisk/ari.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/ari.py?view=diff&rev=4805&r1=4804&r2=4805
==============================================================================
--- asterisk/trunk/lib/python/asterisk/ari.py (original)
+++ asterisk/trunk/lib/python/asterisk/ari.py Fri Mar 7 14:01:25 2014
@@ -192,6 +192,37 @@
deferred.addErrback(self.handle_originate_failure)
+class AriOriginateTestObject(AriTestObject):
+ """Class that overrides AriTestObject origination to use ARI"""
+
+ def __init__(self, test_path='', test_config=None):
+ """Constructor for a test object
+
+ :param test_path The full path to the test location
+ :param test_config The YAML test configuration
+ """
+
+ if test_config is None:
+ test_config = {}
+
+ if not test_config.get('test-iterations'):
+ # preset the default test in ARI format to prevent post failure
+ test_config['test-iterations'] = [{
+ 'endpoint': 'Local/s at default',
+ 'channelId': 'testsuite-default-id',
+ 'app': 'testsuite'
+ }]
+
+ super(AriOriginateTestObject, self).__init__(test_path, test_config)
+
+ def _spawn_channel(self, channel_def):
+ """Create a new channel"""
+
+ # Create a channel using ARI POST to channel instead
+ LOGGER.info("Creating channel %s" % channel_def['endpoint'])
+ self.ari.post('channels', **channel_def)
+
+
class WebSocketEventModule(object):
"""Module for capturing events from the ARI WebSocket"""
@@ -387,6 +418,21 @@
return self.raise_on_err(requests.delete(url, params=kwargs,
auth=self.userpass))
+ def request(self, method, *args, **kwargs):
+ """ Send an arbitrary request to ARI.
+
+ :param method: Method (get, post, delete, etc).
+ :param args: Path segements.
+ :param kwargs: Query parameters.
+ :returns: requests.models.Response
+ :throws: requests.exceptions.HTTPError
+ """
+ url = self.build_url(*args)
+ LOGGER.info("%s %s %r" % (method, url, kwargs))
+ requests_method = getattr(requests, method)
+ return self.raise_on_err(requests_method(url, params=kwargs,
+ auth=self.userpass))
+
def set_allow_errors(self, value):
"""Sets whether error responses returns exceptions.
@@ -423,6 +469,7 @@
self.count_range = decode_range(self.instance_config.get('count'))
self.count = 0
self.passed = True
+
callback = self.instance_config.get('callback')
if callback:
module = __import__(callback['module'])
@@ -431,7 +478,61 @@
# No callback; just use a no-op
self.callback = lambda *args, **kwargs: True
+ self.requests = []
+ request_list = self.instance_config.get('requests')
+ if not request_list:
+ request_list = []
+ if isinstance(request_list, dict):
+ request_list = [request_list]
+ for request in request_list:
+ params = request['params'] if 'params' in request else {}
+ inst = request['instance'] if 'instance' in request else 0
+ delay = request['delay'] if 'delay' in request else 0
+ self.requests.append({
+ 'method': request['method'],
+ 'uri': request['uri'],
+ 'params': params,
+ 'instance': inst,
+ 'delay': delay
+ })
+
test_object.register_stop_observer(self.on_stop)
+
+ def var_replace(self, uri, values):
+ """ perform variable replacement on uri
+
+ This allows a uri to be written in the form:
+ playbacks/{playback.id}/control
+
+ :param uri: uri with optional {var} entries
+ :param values: nested dict of values to get replacement values from
+ """
+ for match in re.findall(r'{[^}]*}', uri):
+ value = values
+ for var in match[1:-1].split('.'):
+ if not var in value:
+ LOGGER.error('Unable to replace variables in %s from %s' %
+ uri, values)
+ return None
+ value = value[var]
+ uri = uri.replace(match, value)
+
+ return uri
+
+ def send_request(self, request, uri):
+ """ transmit an ari request
+
+ :param request: request parameters
+ :param uri: uri rewritten for this call
+ """
+ response = self.ari.request(request['method'],
+ uri,
+ **request['params'])
+
+ LOGGER.info('%s %s %s returned %s' % (request['method'],
+ uri,
+ request['params'],
+ response))
def on_event(self, message):
"""Callback for every received ARI event.
@@ -440,6 +541,21 @@
"""
if self.matches(message):
self.count += 1
+
+ # send any associated requests
+ for request in self.requests:
+ if request['instance'] and request['instance'] != self.count:
+ continue
+ uri = self.var_replace(request['uri'], message)
+ if uri:
+ if request['delay']:
+ reactor.callLater(request['delay'],
+ self.send_request,
+ request,
+ uri)
+ else:
+ self.send_request(request, uri)
+
# Split call and accumulation to always call the callback
try:
res = self.callback(self.ari, message, self.test_object)
@@ -453,6 +569,7 @@
LOGGER.error("Exception in callback: %s" %
traceback.format_exc())
self.passed = False
+
return False
def on_stop(self, *args):
Added: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf Fri Mar 7 14:01:25 2014
@@ -1,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml Fri Mar 7 14:01:25 2014
@@ -1,0 +1,168 @@
+
+testinfo:
+ summary: 'Test bridge creation and manipulation using IDs'
+ description: |
+ * Originate a bridge and a channel
+ * Put the channel in the bridge
+ * Take the channel out of the bridge
+ * Delete both
+ * Validate all the events
+
+properties:
+ # change this to correct minimum version that implements IDs
+ minversion: '12.0.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - asterisk : res_ari_channels
+ - asterisk : app_echo
+ tags:
+ - ARI
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriOriginateTestObject
+ modules:
+ - config-section: ari-config
+ typename: ari.WebSocketEventModule
+
+test-object-config:
+ # using default origination:
+ # endpoint: Local/s at default
+ # channelId: testsuite-default-id
+ # app: testsuite
+
+ari-config:
+ apps: testsuite
+ events:
+ -
+ conditions:
+ match:
+ type: 'ChannelStateChange'
+ count: '>1'
+ -
+ conditions:
+ match:
+ type: StasisStart
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+ requests:
+ -
+ method: 'post'
+ uri: 'bridges'
+ params:
+ bridgeId: 'MyFirstBridge'
+ # note: creating bridge does not cause event
+ -
+ method: 'post'
+ uri: 'channels'
+ params:
+ endpoint: 'Local/s at default'
+ channelId: 'MyFirstChannel'
+ app: 'testsuite'
+ -
+ conditions:
+ match:
+ type: StasisStart
+ application: testsuite
+ channel:
+ id: 'MyFirstChannel$'
+ count: 1
+ requests:
+ method: 'post'
+ uri: 'bridges/MyFirstBridge/addChannel'
+ params:
+ channel: 'MyFirstChannel'
+ -
+ conditions:
+ match:
+ type: ChannelEnteredBridge
+ application: testsuite
+ channel:
+ id: 'MyFirstChannel$'
+ count: 1
+ requests:
+ method: 'post'
+ uri: 'bridges/MyFirstBridge/removeChannel'
+ params:
+ channel: 'MyFirstChannel'
+ -
+ conditions:
+ match:
+ type: ChannelLeftBridge
+ application: testsuite
+ channel:
+ id: 'MyFirstChannel$'
+ count: 1
+ requests:
+ method: 'delete'
+ uri: 'bridges/MyFirstBridge'
+ -
+ conditions:
+ match:
+ type: BridgeDestroyed
+ application: testsuite
+ bridge:
+ id: 'MyFirstBridge$'
+ count: 1
+ requests:
+ method: 'delete'
+ uri: 'channels/MyFirstChannel'
+ -
+ conditions:
+ match:
+ type: ChannelHangupRequest
+ application: testsuite
+ channel:
+ id: 'MyFirstChannel$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: ChannelDestroyed
+ application: testsuite
+ channel:
+ id: 'MyFirstChannel$'
+ count: 1
+ requests:
+ # delete the first stasis channel to end the test
+ method: 'delete'
+ uri: 'channels/testsuite-default-id'
+ -
+ conditions:
+ match:
+ type: StasisEnd
+ application: testsuite
+ channel:
+ id: 'MyFirstChannel$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: ChannelHangupRequest
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: ChannelDestroyed
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: StasisEnd
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+
Propchange: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/bridges/bridge_by_id/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/rest_api/bridges/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/tests.yaml?view=diff&rev=4805&r1=4804&r2=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/tests.yaml (original)
+++ asterisk/trunk/tests/rest_api/bridges/tests.yaml Fri Mar 7 14:01:25 2014
@@ -7,3 +7,4 @@
- test: 'add_recording_channel'
- test: 'blind_transfer'
- test: 'attended_transfer'
+ - test: 'bridge_by_id'
Added: asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf Fri Mar 7 14:01:25 2014
@@ -1,0 +1,29 @@
+[default]
+
+exten => stasis,1,NoOp()
+ same => n,Answer()
+ same => n,Stasis(testsuite)
+ same => n,Hangup()
+
+exten => one,1,NoOp()
+ same => n,Answer()
+ same => n,Wait(1)
+ same => n,Hangup()
+
+exten => two,1,NoOp()
+ same => n,Answer()
+ same => n,Wait(1)
+ same => n,Hangup()
+
+exten => three,1,NoOp()
+ same => n,Answer()
+ same => n,Wait(1)
+ same => n,Hangup()
+
+; this is echo not wait to force test4 to delete the channel
+; in order to successfully end the test
+exten => four,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+ same => n,Hangup()
+
Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml Fri Mar 7 14:01:25 2014
@@ -1,0 +1,322 @@
+
+testinfo:
+ summary: 'Test UniqueID on ARI Originate'
+ description: |
+ * Originate four calls:
+ 1) Specifying both Unique IDs
+ 2) Specifying a single Unique ID
+ 3) Not specifying Unique ID
+ 4) Stasis app with both Unique IDs
+ * Check that the AMI and CEL events all correctly match
+ * Check that the ARI events work correctly
+
+properties:
+ # change this correct minimum version that implements Originate with ID
+ minversion: '12.0.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - asterisk : res_ari_channels
+ - asterisk : app_echo
+ tags:
+ - ARI
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriOriginateTestObject
+ modules:
+ - config-section: ari-config
+ typename: ari.WebSocketEventModule
+ -
+ config-section: ami-config
+ typename: 'ami.AMIEventModule'
+ -
+ config-section: cel-config
+ typename: 'ami.AMIEventModule'
+
+test-object-config:
+ test-iterations:
+ -
+ # test 1 - both id's creating local channel
+ endpoint: 'Local/one at default'
+ channelId: 'MyCustomId'
+ otherChannelId: 'MyOtherCustomId'
+ app: 'no-app'
+ -
+ # test 2 - just the first id, second should suffix ;2
+ endpoint: 'Local/two at default'
+ channelId: 'OnlyOneId'
+ app: 'no-app'
+ -
+ # test 3 - no id's specified, should revert to normal id pattern
+ endpoint: 'Local/three at default'
+ app: 'no-app'
+ -
+ # test 4 - create call to Stasis App and check websocket events
+ endpoint: 'Local/four at default'
+ channelId: 'MyStasisId'
+ otherChannelId: 'MyOtherStasisId'
+ app: 'testsuite'
+
+ari-config:
+ apps: testsuite
+ events:
+ -
+ # detect the first local channel
+ conditions:
+ match:
+ type: StasisStart
+ application: testsuite
+ channel:
+ id: 'MyStasisId$'
+ count: 1
+ requests:
+ # delete the channel to end the test
+ method: 'delete'
+ uri: 'channels/MyStasisId'
+ -
+ # We should not see the other channel as it went to dialplan
+ # The fact that is has the correct ID is checked by AMI & CEL
+ conditions:
+ match:
+ type: StasisStart
+ application: testsuite
+ channel:
+ id: 'MyOtherStasisId'
+ count: 0
+ -
+ conditions:
+ match:
+ type: ChannelStateChange
+ application: testsuite
+ channel:
+ id: 'MyStasisId$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: ChannelHangupRequest
+ application: testsuite
+ channel:
+ id: 'MyStasisId$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: ChannelDestroyed
+ application: testsuite
+ channel:
+ id: 'MyStasisId$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: StasisEnd
+ application: testsuite
+ channel:
+ id: 'MyStasisId$'
+ count: 1
+
+
+ami-config:
+ # test 1
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/one at default-.{7}0;1'
+ requirements:
+ match:
+ Uniqueid: 'MyCustomId'
+ count: '1'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/one at default-.{7}0;2'
+ requirements:
+ match:
+ Uniqueid: 'MyOtherCustomId'
+ count: '1'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'LocalBridge'
+ LocalOneChannel: 'Local/one at default-.{7}0;1'
+ LocalTwoChannel: 'Local/one at default-.{7}0;2'
+ requirements:
+ match:
+ LocalOneUniqueid: 'MyCustomId'
+ LocalTwoUniqueid: 'MyOtherCustomId'
+ count: '1'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Hangup'
+ Channel: 'Local/one at default-.{7}0;1'
+ requirements:
+ match:
+ Uniqueid: 'MyCustomId'
+ count: '1'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Hangup'
+ Channel: 'Local/one at default-.{7}0;2'
+ requirements:
+ match:
+ Uniqueid: 'MyOtherCustomId'
+ count: '1'
+
+ # test 2
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/two at default-.{7}1;1'
+ requirements:
+ match:
+ Uniqueid: 'OnlyOneId$'
+ count: '1'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/two at default-.{7}1;2'
+ requirements:
+ match:
+ Uniqueid: 'OnlyOneId;2'
+ count: '1'
+ # test 3
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/three at default-.{7}2;1'
+ requirements:
+ match:
+ UniqueId: '[0-9]{10}\.[0-9]+'
+ count: '1'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/three at default-.{7}2;2'
+ requirements:
+ match:
+ UniqueId: '[0-9]{10}\.[0-9]+'
+ count: '1'
+
+ # test 4
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/four at default-.{7}3;1'
+ requirements:
+ match:
+ UniqueId: 'MyStasisId$'
+ count: '1'
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Newchannel'
+ Channel: 'Local/four at default-.{7}3;2'
+ requirements:
+ match:
+ UniqueId: 'MyOtherStasisId'
+ count: '1'
+
+cel-config:
+ # test 1
+ -
+ type: 'cel'
+ conditions:
+ match:
+ Channel: 'Local/one at default-.{7}0;.'
+ requirements:
+ -
+ match:
+ Channel: 'Local/one at default-.{7}0;1'
+ EventName: 'CHAN_START'
+ UniqueId: 'MyCustomId'
+ LinkedId: 'MyCustomId'
+ -
+ match:
+ Channel: 'Local/one at default-.{7}0;2'
+ EventName: 'CHAN_START'
+ UniqueId: 'MyOtherCustomId'
+ LinkedId: 'MyCustomId'
+ # test 2
+ -
+ type: 'cel'
+ conditions:
+ match:
+ Channel: 'Local/two at default-.{7}1;.'
+ requirements:
+ -
+ match:
+ Channel: 'Local/two at default-.{7}1;1'
+ EventName: 'CHAN_START'
+ UniqueId: 'OnlyOneId$'
+ LinkedId: 'OnlyOneId$'
+ -
+ match:
+ Channel: 'Local/two at default-.{7}1;2'
+ EventName: 'CHAN_START'
+ UniqueId: 'OnlyOneId;2'
+ LinkedId: 'OnlyOneId$'
+ # test 3
+ -
+ type: 'cel'
+ conditions:
+ match:
+ Channel: 'Local/three at default-.{7}2;.'
+ requirements:
+ -
+ match:
+ Channel: 'Local/three at default-.{7}2;1'
+ EventName: 'CHAN_START'
+ UniqueId: '[0-9]{10}\.[0-9]+'
+ LinkedId: '[0-9]{10}\.[0-9]+'
+ -
+ match:
+ Channel: 'Local/three at default-.{7}2;2'
+ EventName: 'CHAN_START'
+ UniqueId: '[0-9]{10}\.[0-9]+'
+ LinkedId: '[0-9]{10}\.[0-9]+'
+
+ # test 4
+ -
+ type: 'cel'
+ conditions:
+ match:
+ Channel: 'Local/four at default-.{7}3;.'
+ requirements:
+ -
+ match:
+ Channel: 'Local/four at default-.{7}3;1'
+ EventName: 'CHAN_START'
+ UniqueId: 'MyStasisId$'
+ LinkedId: 'MyStasisId$'
+ -
+ match:
+ Channel: 'Local/four at default-.{7}3;2'
+ EventName: 'CHAN_START'
+ UniqueId: 'MyOtherStasisId'
+ LinkedId: 'MyStasisId$'
+
Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/channels/originate_with_id/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf Fri Mar 7 14:01:25 2014
@@ -1,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/channels/snoop_id/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml Fri Mar 7 14:01:25 2014
@@ -1,0 +1,115 @@
+
+testinfo:
+ summary: 'Test channel snoop using ID'
+ description: |
+ * Originate a channel
+ * Start a snoop channel
+ * Delete the snoop channel
+ * Delete the original channel
+ * Validate all the events
+
+properties:
+ # change this to correct minimum version that implements IDs
+ minversion: '12.0.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - asterisk : res_ari_channels
+ - asterisk : app_echo
+ tags:
+ - ARI
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriOriginateTestObject
+ modules:
+ - config-section: ari-config
+ typename: ari.WebSocketEventModule
+
+test-object-config:
+ # using default origination:
+ # endpoint: Local/s at default
+ # channelId: testsuite-default-id
+ # app: testsuite
+
+ari-config:
+ apps: testsuite
+ events:
+ -
+ conditions:
+ match:
+ type: 'ChannelStateChange'
+ count: '>1'
+ -
+ conditions:
+ match:
+ type: StasisStart
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+ requests:
+ method: 'post'
+ uri: 'channels/testsuite-default-id/snoop/MySnoopyId'
+ params:
+ spy: 'both'
+ app: 'testsuite'
+ -
+ conditions:
+ match:
+ type: StasisStart
+ application: testsuite
+ channel:
+ id: 'MySnoopyId'
+ count: 1
+ requests:
+ method: 'delete'
+ uri: 'channels/{channel.id}'
+ -
+ conditions:
+ match:
+ type: ChannelHangupRequest
+ application: testsuite
+ channel:
+ id: 'MySnoopyId'
+ count: 1
+ -
+ conditions:
+ match:
+ type: StasisEnd
+ application: testsuite
+ channel:
+ id: 'MySnoopyId'
+ count: 1
+ requests:
+ # kill the original channel to end the test
+ method: 'delete'
+ uri: 'channels/testsuite-default-id'
+ -
+ conditions:
+ match:
+ type: ChannelHangupRequest
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: StasisEnd
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+ -
+ conditions:
+ match:
+ type: ChannelDestroyed
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+
Propchange: asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/channels/snoop_id/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/rest_api/channels/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/tests.yaml?view=diff&rev=4805&r1=4804&r2=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/tests.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/tests.yaml Fri Mar 7 14:01:25 2014
@@ -1,5 +1,7 @@
tests:
- test: 'originate'
- test: 'originate_with_vars'
+ - test: 'originate_with_id'
- test: 'snoop_whisper'
- test: 'snoop_spy'
+ - test: 'snoop_id'
Added: asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf Fri Mar 7 14:01:25 2014
@@ -1,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Answer()
+ same => n,Echo()
+ same => n,Hangup()
Propchange: asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/rest_api/playback/basic/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/rest_api/playback/basic/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/playback/basic/test-config.yaml?view=auto&rev=4805
==============================================================================
--- asterisk/trunk/tests/rest_api/playback/basic/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/playback/basic/test-config.yaml Fri Mar 7 14:01:25 2014
@@ -1,0 +1,131 @@
+
+testinfo:
+ summary: 'Test playback start and manipulation using IDs'
+ description: |
+ * Originate a channel
+ * Playback an audio file
+ * Pause it
+ * Unpause it
+ * Rewind it
+ * Delete the playback
+ * Delete the channel
+ * Validate all the events
+
+properties:
+ # change this to correct minimum version that implements IDs
+ minversion: '12.0.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - asterisk : res_ari_channels
+ - asterisk : app_echo
+ tags:
+ - ARI
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriOriginateTestObject
+ modules:
+ - config-section: ari-config
+ typename: ari.WebSocketEventModule
+
+test-object-config:
+ # using default origination:
+ # endpoint: Local/s at default
+ # channelId: testsuite-default-id
+ # app: testsuite
+
+ari-config:
+ apps: testsuite
+ events:
+ -
+ conditions:
+ match:
+ type: 'ChannelStateChange'
+ count: '>1'
+ -
+ conditions:
+ match:
+ type: StasisStart
+ application: testsuite
+ channel:
+ id: 'testsuite-default-id$'
+ count: 1
+ requests:
+ method: 'post'
+ uri: 'channels/testsuite-default-id/play/MyPlaybackId'
+ params:
+ media: 'sound:silence/5'
+ -
+ conditions:
+ match:
+ type: PlaybackStarted
+ application: testsuite
+ playback:
+ id: 'MyPlaybackId'
+ target_uri: 'channel:testsuite-default-id$'
+ count: 2
+ requests:
+ -
+ instance: 1
+ delay: 1
+ method: 'post'
+ uri: 'playbacks/MyPlaybackId/control'
+ params:
+ operation: pause
+ # pause operation does not generate an event
+ -
+ instance: 1
+ delay: 2
+ method: 'post'
+ uri: 'playbacks/MyPlaybackId/control'
+ params:
+ operation: unpause
+ # unpause operation triggers PlaybackStarted instance #2
+ -
+ instance: 2
+ method: 'post'
[... 88 lines stripped ...]
More information about the asterisk-commits
mailing list