[svn-commits] jrose: testsuite/asterisk/trunk r5026 - in /asterisk/trunk/tests/rest_api: br...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 8 17:09:26 CDT 2014


Author: jrose
Date: Thu May  8 17:09:17 2014
New Revision: 5026

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5026
Log:
Testsuite: ARI playback for tones on channels and bridges (also with tonezone)

(closes issue ASTERISK-23433)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3428/

Added:
    asterisk/trunk/tests/rest_api/bridges/playback/tones/
    asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py   (with props)
    asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/
    asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/
    asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml   (with props)
    asterisk/trunk/tests/rest_api/channels/playback/tones/
    asterisk/trunk/tests/rest_api/channels/playback/tones/configs/
    asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/
    asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/channels/playback/tones/test-config.yaml   (with props)
    asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/
    asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/
    asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/
    asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/rest_api/bridges/playback/tests.yaml
    asterisk/trunk/tests/rest_api/channels/playback/tests.yaml

Modified: asterisk/trunk/tests/rest_api/bridges/playback/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/playback/tests.yaml?view=diff&rev=5026&r1=5025&r2=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/playback/tests.yaml (original)
+++ asterisk/trunk/tests/rest_api/bridges/playback/tests.yaml Thu May  8 17:09:17 2014
@@ -1,2 +1,3 @@
 tests:
     - test: 'basic'
+    - test: 'tones'

Added: asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py?view=auto&rev=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py (added)
+++ asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py Thu May  8 17:09:17 2014
@@ -1,0 +1,50 @@
+'''
+Copyright (C) 2014, Digium, Inc.
+Jonathan R. Rose <jrose at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import logging
+
+LOGGER = logging.getLogger(__name__)
+
+
+class SubscribeBridge(object):
+    def __init__(self):
+        self.channel_id = None
+
+BRIDGE_ID = 'test-tones-bridge'
+TEST = SubscribeBridge()
+
+def on_start(ari, event, test_object):
+    """ When the channel enters stasis, create a bridge and add the channel. """
+    TEST.channel_id = event['channel']['id']
+
+    ari.post('bridges',
+             bridgeId=BRIDGE_ID)
+
+    ari.post('bridges', BRIDGE_ID, 'addChannel',
+             channel=TEST.channel_id)
+
+    return True
+
+
+def on_playback_finished(ari, event, test_object):
+    """ When the PlaybackFinished event is received, remove the channel. """
+    ari.post('bridges', BRIDGE_ID, 'removeChannel',
+             channel=TEST.channel_id)
+
+    return True
+
+
+def on_channel_left_bridge(ari, event, test_object):
+    """ testsuite received a ChannelLeftBridge event, wrap the test up. """
+    assert BRIDGE_ID == event['bridge']['id']
+    assert TEST.channel_id == event['channel']['id']
+
+    ari.delete('channels', TEST.channel_id)
+    ari.delete('bridges', BRIDGE_ID)
+
+    return True

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/bridges_play.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf?view=auto&rev=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf Thu May  8 17:09:17 2014
@@ -1,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Stasis(testsuite)
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml?view=auto&rev=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml Thu May  8 17:09:17 2014
@@ -1,0 +1,135 @@
+testinfo:
+    summary: Test detection of Playback events when using tones
+    description: |
+        * Originate a channel
+        * Create a bridge
+        * Add the channel to the bridge
+        * Start a tone playback on the bridge
+        * Pause the tone playback
+        * resume the tone playback
+        * Restart the tone playback
+        * Delete the tone playback
+        * Delete the channel
+        * Validate all the events
+
+properties:
+    minversion: '12.3.0'
+    dependencies:
+        - python: autobahn.websocket
+        - python: requests
+        - python: twisted
+        - python: starpy
+        - asterisk: res_ari_bridges
+        - asterisk: res_ari_channels
+        - asterisk: app_echo
+    tags:
+        - ARI
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriOriginateTestObject
+    modules:
+        -   config-section: ari-config
+            typename: ari.WebSocketEventModule
+
+ari-config:
+    apps: testsuite
+    events:
+        -
+            conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            callback:
+                module: bridges_play
+                method: on_start
+        -
+            conditions:
+                match:
+                    type: ChannelEnteredBridge
+                    application: testsuite
+                    bridge:
+                        id: 'test-tones-bridge'
+                    channel:
+                        id: 'testsuite-default-id$'
+            count: 1
+            requests:
+                method: 'post'
+                uri: 'bridges/test-tones-bridge/play/MyPlaybackId'
+                params:
+                    media: 'tone:record'
+        -
+            conditions:
+                match:
+                    type: PlaybackStarted
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        target_uri: 'bridge:test-tones-bridge'
+                        media_uri: 'tone:record'
+            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
+                -
+                    instance: 2
+                    method: 'post'
+                    uri: 'playbacks/MyPlaybackId/control'
+                    params:
+                        operation: restart
+                -
+                    instance: 2
+                    delay: 2
+                    method: 'delete'
+                    uri: 'playbacks/MyPlaybackId'
+        -
+            conditions:
+                match:
+                    type: PlaybackFinished
+                    application: testsuite
+                    playback:
+            count: 1
+            callback:
+                module: bridges_play
+                method: on_playback_finished
+        -
+            conditions:
+                match:
+                    type: ChannelLeftBridge
+                    application: testsuite
+                    bridge:
+                    channel:
+            count: 1
+            callback:
+                module: bridges_play
+                method: on_channel_left_bridge
+
+properties:
+    minversion: '12.3.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : res_ari_bridges
+    tags:
+        - ARI

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/bridges/playback/tones/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/rest_api/channels/playback/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/tests.yaml?view=diff&rev=5026&r1=5025&r2=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/tests.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/playback/tests.yaml Thu May  8 17:09:17 2014
@@ -2,3 +2,5 @@
 tests:
     - test: 'basic'
     - test: 'to_channel_in_bridge'
+    - test: 'tones'
+    - test: 'tones_w_tonezone'

Added: asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/extensions.conf?view=auto&rev=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/extensions.conf Thu May  8 17:09:17 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/playback/tones/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/channels/playback/tones/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/tones/test-config.yaml?view=auto&rev=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/tones/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/channels/playback/tones/test-config.yaml Thu May  8 17:09:17 2014
@@ -1,0 +1,125 @@
+
+testinfo:
+    summary: 'Test playback start and manipulation using IDs with a tone resource'
+    description: |
+        * Originate a channel
+        * Playback a tone
+        * Pause it
+        * Unpause it
+        * Restart it
+        * Delete the tone playback
+        * Delete the channel
+        * Validate all the events
+
+properties:
+    minversion: '12.3.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
+
+ari-config:
+    apps: testsuite
+    events:
+        -
+            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: 'tone:record'
+        -
+            conditions:
+                match:
+                    type: PlaybackStarted
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        target_uri: 'channel:testsuite-default-id$'
+                        media_uri: 'tone:record'
+            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'
+                    uri: 'playbacks/MyPlaybackId/control'
+                    params:
+                        operation: restart
+                -
+                    instance: 2
+                    delay: 2
+                    method: 'delete'
+                    uri: 'playbacks/MyPlaybackId'
+        -
+            conditions:
+                match:
+                    type: PlaybackFinished
+                    application: testsuite
+                    playback:
+                        target_uri: 'channel:testsuite-default-id$'
+            count: 1
+            requests:
+                # playback is already deleted
+                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/playback/tones/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/extensions.conf?view=auto&rev=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/extensions.conf Thu May  8 17:09:17 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/playback/tones_w_tonezone/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/test-config.yaml?view=auto&rev=5026
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/test-config.yaml Thu May  8 17:09:17 2014
@@ -1,0 +1,133 @@
+
+testinfo:
+    summary: 'Test playback start and manipulation using IDs with a tone resource using a tone zone'
+    description: |
+        * Originate a channel
+        * Playback a tone
+        * Pause it
+        * Unpause it
+        * Restart it
+        * Delete the tone playback
+        * Delete the channel
+        * Validate all the events
+
+properties:
+    minversion: '12.3.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:
+
+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:
+                    # Use the tonezone for Germany
+                    media: 'tone:record;tonezone=de'
+        -
+            conditions:
+                match:
+                    type: PlaybackStarted
+                    application: testsuite
+                    playback:
+                        id: 'MyPlaybackId'
+                        target_uri: 'channel:testsuite-default-id$'
+                        media_uri: 'tone:record;tonezone=de'
+            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'
+                    uri: 'playbacks/MyPlaybackId/control'
+                    params:
+                        operation: restart
+                -
+                    instance: 2
+                    delay: 2
+                    method: 'delete'
+                    uri: 'playbacks/MyPlaybackId'
+        -
+            conditions:
+                match:
+                    type: PlaybackFinished
+                    application: testsuite
+                    playback:
+                        target_uri: 'channel:testsuite-default-id$'
+            count: 1
+            requests:
+                # playback is already deleted
+                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/playback/tones_w_tonezone/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/channels/playback/tones_w_tonezone/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the svn-commits mailing list