[asterisk-commits] res api/channels: Add test for channels/create and channels... (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 1 12:59:48 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: res_api/channels:  Add test for channels/create and channels/dial
......................................................................


res_api/channels:  Add test for channels/create and channels/dial

This is the first (and pilot) test for the new channels/create
and channels/dial ARI methods.

* Create channel 1 using channels/create with endpoint = Local/s at default
  which answers and plays tt-weasels (but not until dialed below).
* Create bridge1.
* Add channel 1 to bridge 1.
* Create channel 2 using channels/create with endpoint = Local/amd at default
  which just runs the AMD() app (but not until dialed below).
* Add channel 2 to bridge 1.
* Dial channel 1.
* Dial channel 2.
* Make sure AMD detects HUMAN.
* Wait for channel 2 to hang itself up after AMD returns.
* Delete channel 1 and the bridge.
* Stop.

ASTERISK-26000 #close

Change-Id: I20a9cc235ff0ade747846526d5c37167199870f4
---
A tests/rest_api/channels/create_and_dial/configs/ast1/extensions.conf
A tests/rest_api/channels/create_and_dial/test-config.yaml
M tests/rest_api/channels/tests.yaml
3 files changed, 167 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/tests/rest_api/channels/create_and_dial/configs/ast1/extensions.conf b/tests/rest_api/channels/create_and_dial/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b5c8661
--- /dev/null
+++ b/tests/rest_api/channels/create_and_dial/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Playback(silence/1&please-try-again&silence/3)
+	same => n,Hangup()
+
+exten => amd,1,NoOp()
+	same => n,Answer()
+	same => n,AMD()
+	same => n,Hangup()
diff --git a/tests/rest_api/channels/create_and_dial/test-config.yaml b/tests/rest_api/channels/create_and_dial/test-config.yaml
new file mode 100644
index 0000000..16f1ff5
--- /dev/null
+++ b/tests/rest_api/channels/create_and_dial/test-config.yaml
@@ -0,0 +1,155 @@
+testinfo:
+    summary: 'Test channels/create and channels/dial.'
+    description: |
+        * Create channel 1 using channels/create with endpoint = Local/s at default
+            which answers and plays tt-weasels (but not until dialed below).
+        * Create bridge1.
+        * Add channel 1 to bridge 1.
+        * Create channel 2 using channels/create with endpoint = Local/amd at default
+            which just runs the AMD() app (but not until dialed below).
+        * Add channel 2 to bridge 1.
+        * Dial channel 1.
+        * Dial channel 2.
+        * Make sure AMD detects HUMAN.
+        * Wait for channel 2 to hang itself up after AMD returns.
+        * Delete channel 1 and the bridge.
+        * Stop.
+
+test-modules:
+    test-object:
+        config-section: 'test-object-config'
+        typename: 'ari.AriBaseTestObject'
+    modules:
+    -   config-section: ami-uut
+        typename: 'ami.AMIEventModule'
+    -   config-section: 'pluggable-config'
+        typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    apps: 'testsuite'
+    reactor-timeout: 60
+    stop-on-end: False
+
+ami-uut:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'AMDSTATUS'
+                Value: 'HUMAN'
+        count: '1'
+
+pluggable-config:
+    -
+        ari-start:
+        ari-requests:
+            -
+                method: 'post'
+                uri: 'channels/create'
+                params:
+                    endpoint: 'Local/s at default'
+                    app: 'testsuite'
+                    channelId: 'channel1'
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                args: [
+                    ]
+                channel:
+                    id: 'channel1$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1'
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel1'
+    -   ari-events:
+            match:
+                type: 'ChannelEnteredBridge'
+                application: 'testsuite'
+                channel:
+                    id: 'channel1$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'channels/create'
+                params:
+                    'endpoint': 'Local/amd at default'
+                    'app': 'testsuite'
+                    'appArgs': 'amd'
+                    'channelId': 'channel2'
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                'args':
+                - 'amd'
+                channel:
+                    id: 'channel2$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel2'
+
+    -   ari-events:
+            match:
+                type: 'ChannelEnteredBridge'
+                application: 'testsuite'
+                channel:
+                    id: 'channel2$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'channels/channel1/dial'
+            -   method: 'post'
+                uri: 'channels/channel2/dial'
+                params:
+                    caller: 'channel1'
+
+    -   ari-events:
+            match:
+                type: 'ChannelStateChange'
+                application: 'testsuite'
+                channel:
+                    id: 'channel[12]'
+                    state: 'Up'
+            count: 2
+
+    -   ari-events:
+            match:
+                type: 'ChannelLeftBridge'
+                channel:
+                    id: 'channel2'
+            count: 1
+        ari-requests:
+            -   method: 'delete'
+                uri: 'channels/channel1'
+            -   method: 'delete'
+                uri: 'bridges/bridge1'
+
+    -   ari-events:
+            match:
+                type: 'BridgeDestroyed'
+            count: 1
+        stop_test:
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+    -   python: 'autobahn.websocket'
+    -   python: 'requests'
+    -   python: 'twisted'
+    -   python: 'starpy'
+    -   asterisk: 'res_ari_channels'
+    -   asterisk: 'app_amd'
+    tags:
+    - ARI
diff --git a/tests/rest_api/channels/tests.yaml b/tests/rest_api/channels/tests.yaml
index a6a5801..267cc51 100644
--- a/tests/rest_api/channels/tests.yaml
+++ b/tests/rest_api/channels/tests.yaml
@@ -11,4 +11,5 @@
     - dir: 'redirect'
     - test: 'connected_line_update'
     - test: 'originate_to_dialplan'
+    - test: 'create_and_dial'
     - dir: 'hold'

-- 
To view, visit https://gerrit.asterisk.org/2779
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I20a9cc235ff0ade747846526d5c37167199870f4
Gerrit-PatchSet: 4
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list