[svn-commits] file: testsuite/asterisk/trunk r4383 - in /asterisk/trunk/tests/rest_api/chan...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Nov 27 18:48:20 CST 2013


Author: file
Date: Wed Nov 27 18:48:17 2013
New Revision: 4383

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4383
Log:
Add tests which cover Snoop spying and whispering in ARI.

(closes issue ASTERISK-22780)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/3007/

Added:
    asterisk/trunk/tests/rest_api/channels/snoop_spy/
    asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py   (with props)
    asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/
    asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/ast1/
    asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml   (with props)
    asterisk/trunk/tests/rest_api/channels/snoop_whisper/
    asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py   (with props)
    asterisk/trunk/tests/rest_api/channels/snoop_whisper/configs/
    asterisk/trunk/tests/rest_api/channels/snoop_whisper/configs/ast1/
    asterisk/trunk/tests/rest_api/channels/snoop_whisper/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/rest_api/channels/snoop_whisper/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/rest_api/channels/tests.yaml

Added: asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py?view=auto&rev=4383
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py Wed Nov 27 18:48:17 2013
@@ -1,0 +1,35 @@
+'''
+Copyright (C) 2013, Digium, Inc.
+Joshua Colp <jcolp 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 Snoop(object):
+    def __init__(self):
+        self.bridge_id = None
+
+TEST = Snoop()
+
+def on_start(ari, event, test_object):
+    LOGGER.debug("on_start(%r)" % event)
+    ari.post('channels', event['channel']['id'], 'snoop', spy='in', whisper='none', app='testsuite', appArgs='snoop')
+    ari.post('channels', event['channel']['id'], 'play', media='sound:demo-congrats')
+    return True
+
+def on_snoop_start(ari, event, test_object):
+    LOGGER.debug("on_snoop_start(%r)" % event)
+    TEST.bridge_id = ari.post('bridges').json()['id']
+    ari.post('bridges', TEST.bridge_id, 'addChannel', channel=event['channel']['id'])
+    ari.post('channels', endpoint='Local/amd at default', app='testsuite', appArgs='amd')
+    return True
+
+def on_amd_start(ari, event, test_object):
+    LOGGER.debug("on_amd_start(%r)" % event)
+    ari.post('bridges', TEST.bridge_id, 'addChannel', channel=event['channel']['id'])
+    return True

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_spy/channel_spy.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/ast1/extensions.conf?view=auto&rev=4383
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/ast1/extensions.conf Wed Nov 27 18:48:17 2013
@@ -1,0 +1,10 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Stasis(testsuite)
+	same => n,Hangup()
+
+exten => amd,1,NoOp()
+        same => n,Answer()
+        same => n,AMD()

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_spy/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml?view=auto&rev=4383
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml Wed Nov 27 18:48:17 2013
@@ -1,0 +1,91 @@
+testinfo:
+    summary: Test spying on calls using ARI.
+    description: |
+        Originate a call and spy on it using ARI.
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriTestObject
+    modules:
+        -   config-section: ari-config
+            typename: ari.WebSocketEventModule
+        -
+            config-section: ami-uut
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    test-iterations:
+        -
+            -   channel: Local/s at default
+                application: Playback
+                data: demo-congrats
+
+ami-uut:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'AMDSTATUS'
+                Value: 'MACHINE'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'ChanSpyStart'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'ChanSpyStop'
+        count: '1'
+
+ari-config:
+    apps: testsuite
+    events:
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    args: []
+            count: 1
+            callback:
+                module: channel_spy
+                method: on_start
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    args: ['snoop']
+            count: 1
+            callback:
+                module: channel_spy
+                method: on_snoop_start
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    args: ['amd']
+            count: 1
+            callback:
+                module: channel_spy
+                method: on_amd_start
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : app_amd
+    tags:
+        - ARI

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_spy/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py?view=auto&rev=4383
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py Wed Nov 27 18:48:17 2013
@@ -1,0 +1,22 @@
+'''
+Copyright (C) 2013, Digium, Inc.
+Joshua Colp <jcolp 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__)
+
+def on_start(ari, event, test_object):
+    LOGGER.debug("on_start(%r)" % event)
+    ari.post('channels', event['channel']['id'], 'snoop', spy='none', whisper='out', app='testsuite', appArgs='snoop')
+    ari.post('channels', event['channel']['id'], 'play', media='sound:silence/10')
+    return True
+
+def on_snoop_start(ari, event, test_object):
+    LOGGER.debug("on_snoop_start(%r)" % event)
+    ari.post('channels', event['channel']['id'], 'play', media='sound:demo-congrats')
+    return True

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_whisper/channel_whisper.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/rest_api/channels/snoop_whisper/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_whisper/configs/ast1/extensions.conf?view=auto&rev=4383
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_whisper/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_whisper/configs/ast1/extensions.conf Wed Nov 27 18:48:17 2013
@@ -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/channels/snoop_whisper/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: asterisk/trunk/tests/rest_api/channels/snoop_whisper/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/channels/snoop_whisper/test-config.yaml?view=auto&rev=4383
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/snoop_whisper/test-config.yaml (added)
+++ asterisk/trunk/tests/rest_api/channels/snoop_whisper/test-config.yaml Wed Nov 27 18:48:17 2013
@@ -1,0 +1,81 @@
+testinfo:
+    summary: Test whispering calls using ARI.
+    description: |
+        Originate a call and whisper to it using ARI.
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriTestObject
+    modules:
+        -   config-section: ari-config
+            typename: ari.WebSocketEventModule
+        -
+            config-section: ami-uut
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    test-iterations:
+        -
+            -   channel: Local/s at default
+                application: AMD
+
+ami-uut:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'AMDSTATUS'
+                Value: 'MACHINE'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'ChanSpyStart'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'ChanSpyStop'
+        count: '1'
+
+ari-config:
+    apps: testsuite
+    events:
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    args: []
+            count: 1
+            callback:
+                module: channel_whisper
+                method: on_start
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    args: ['snoop']
+            count: 1
+            callback:
+                module: channel_whisper
+                method: on_snoop_start
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : app_amd
+    tags:
+        - ARI

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_whisper/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: asterisk/trunk/tests/rest_api/channels/snoop_whisper/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=4383&r1=4382&r2=4383
==============================================================================
--- asterisk/trunk/tests/rest_api/channels/tests.yaml (original)
+++ asterisk/trunk/tests/rest_api/channels/tests.yaml Wed Nov 27 18:48:17 2013
@@ -1,3 +1,4 @@
 tests:
     - test: 'originate'
-
+    - test: 'snoop_whisper'
+    - test: 'snoop_spy'




More information about the svn-commits mailing list