[Asterisk-code-review] rest api/channels: Add tests for create, dial and bridge (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Tue Jul 5 09:11:17 CDT 2016


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

Change subject: rest_api/channels:  Add tests for create, dial and bridge
......................................................................


rest_api/channels:  Add tests for create, dial and bridge

3 new tests:
  bridge_after_answer
  bridge_while_ringing
  bridge_early_media

Change-Id: I5f358c5f900c0c84827412ea3e79e6ecc4c1c51b
---
A tests/rest_api/channels/create_dial_bridge/bridge/bridge_after_answer/configs/ast1/extensions.conf
A tests/rest_api/channels/create_dial_bridge/bridge/bridge_after_answer/test-config.yaml
A tests/rest_api/channels/create_dial_bridge/bridge/bridge_early_media/configs/ast1/extensions.conf
A tests/rest_api/channels/create_dial_bridge/bridge/bridge_early_media/test-config.yaml
A tests/rest_api/channels/create_dial_bridge/bridge/bridge_while_ringing/configs/ast1/extensions.conf
A tests/rest_api/channels/create_dial_bridge/bridge/bridge_while_ringing/test-config.yaml
M tests/rest_api/channels/create_dial_bridge/bridge/tests.yaml
7 files changed, 513 insertions(+), 0 deletions(-)

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



diff --git a/tests/rest_api/channels/create_dial_bridge/bridge/bridge_after_answer/configs/ast1/extensions.conf b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_after_answer/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b5c8661
--- /dev/null
+++ b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_after_answer/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_dial_bridge/bridge/bridge_after_answer/test-config.yaml b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_after_answer/test-config.yaml
new file mode 100644
index 0000000..1559ac8
--- /dev/null
+++ b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_after_answer/test-config.yaml
@@ -0,0 +1,165 @@
+testinfo:
+    summary: 'Test channels create, dial and bridge after answer'
+    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.
+        * Create channel 2 using channels/create with endpoint = Local/amd at default
+            which just runs the AMD() app (but not until dialed below).
+        * Dial channel 1.
+        * Wait for answer
+        * Add to bridge.
+        * Dial channel 2.
+        * Wait for answer
+        * Add to bridge.
+        * 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'
+                expect: 200
+            -   method: 'post'
+                uri: 'channels/create'
+                params:
+                    'endpoint': 'Local/amd at default'
+                    'app': 'testsuite'
+                    'appArgs': 'amd'
+                    'channelId': 'channel2'
+                expect: 200
+            -   method: 'post'
+                uri: 'bridges/bridge1'
+                expect: 200
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                args: [
+                    ]
+                channel:
+                    id: 'channel1$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'channels/channel1/dial'
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                'args':
+                - 'amd'
+                channel:
+                    id: 'channel2$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'channels/channel2/dial'
+                params:
+                    caller: 'channel1'
+
+    -   ari-events:
+            match:
+                type: 'Dial'
+                dialstatus: 'ANSWER'
+                application: 'testsuite'
+                peer:
+                    id: 'channel1'
+                    state: 'Up'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel1'
+                expect: 204
+
+    -   ari-events:
+            match:
+                type: 'Dial'
+                dialstatus: 'ANSWER'
+                application: 'testsuite'
+                peer:
+                    id: 'channel2'
+                    state: 'Up'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel2'
+                expect: 204
+
+    -   ari-events:
+            match:
+                type: 'ChannelEnteredBridge'
+                application: 'testsuite'
+                channel:
+                    id: 'channel[12]$'
+            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/create_dial_bridge/bridge/bridge_early_media/configs/ast1/extensions.conf b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_early_media/configs/ast1/extensions.conf
new file mode 100644
index 0000000..7f0d264
--- /dev/null
+++ b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_early_media/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Ringing()
+	same => n,Playback(silence/1&please-try-again&silence/3)
+	same => n,Hangup()
+
+exten => amd,1,NoOp()
+	same => n,Ringing()
+	same => n,Wait(2)
+	same => n,Answer()
+	same => n,AMD()
+	same => n,Hangup()
diff --git a/tests/rest_api/channels/create_dial_bridge/bridge/bridge_early_media/test-config.yaml b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_early_media/test-config.yaml
new file mode 100644
index 0000000..d1431df
--- /dev/null
+++ b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_early_media/test-config.yaml
@@ -0,0 +1,143 @@
+testinfo:
+    summary: 'Test channels create, dial, bridge with early media'
+    description: |
+        * Create channel 1 using channels/create with endpoint = Local/s at default
+            which sends ringing and plays a human style greeting (but not until dialed below).
+        * Create channel 2 using channels/create with endpoint = Local/amd at default
+            which just runs the AMD() app (but not until dialed below).
+        * Create bridge1.
+        * Dial channel 2.
+        * Wait for Answer
+        * Add channel2 to bridge.
+        * Add channel1 to bridge.
+        * Dial channel 1 (it will provide Ringing then the greeting but it won't answer).
+        * 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'
+                expect: 200
+            -   method: 'post'
+                uri: 'channels/create'
+                params:
+                    'endpoint': 'Local/amd at default'
+                    'app': 'testsuite'
+                    'appArgs': 'amd'
+                    'channelId': 'channel2'
+                expect: 200
+            -   method: 'post'
+                uri: 'bridges/bridge1'
+                expect: 200
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                'args':
+                - 'amd'
+                channel:
+                    id: 'channel2$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'channels/channel2/dial'
+                expect: 204
+
+    -   ari-events:
+            match:
+                type: 'Dial'
+                dialstatus: 'ANSWER'
+                application: 'testsuite'
+                peer:
+                    id: 'channel2'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel2'
+                expect: 204
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel1'
+                expect: 204
+            -   method: 'post'
+                uri: 'channels/channel1/dial'
+                params:
+                    caller: 'channel2'
+                expect: 204
+
+    -   ari-events:
+            match:
+                type: 'ChannelEnteredBridge'
+                application: 'testsuite'
+                channel:
+                    id: 'channel[12]$'
+            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/create_dial_bridge/bridge/bridge_while_ringing/configs/ast1/extensions.conf b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_while_ringing/configs/ast1/extensions.conf
new file mode 100644
index 0000000..c746646
--- /dev/null
+++ b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_while_ringing/configs/ast1/extensions.conf
@@ -0,0 +1,15 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Ringing()
+	same => n,Wait(2)
+	same => n,Answer()
+	same => n,Playback(silence/1&please-try-again&silence/3)
+	same => n,Hangup()
+
+exten => amd,1,NoOp()
+	same => n,Ringing()
+	same => n,Wait(2)
+	same => n,Answer()
+	same => n,AMD()
+	same => n,Hangup()
diff --git a/tests/rest_api/channels/create_dial_bridge/bridge/bridge_while_ringing/test-config.yaml b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_while_ringing/test-config.yaml
new file mode 100644
index 0000000..c1140d0
--- /dev/null
+++ b/tests/rest_api/channels/create_dial_bridge/bridge/bridge_while_ringing/test-config.yaml
@@ -0,0 +1,163 @@
+testinfo:
+    summary: 'Test channels create, dial and bridge while ringing'
+    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.
+        * Create channel 2 using channels/create with endpoint = Local/amd at default
+            which just runs the AMD() app (but not until dialed below).
+        * Dial channel 1.
+        * Wait for ringing
+        * Add to bridge.
+        * Dial channel 2.
+        * Wait for ringing
+        * Add to bridge.
+        * 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'
+                expect: 200
+            -   method: 'post'
+                uri: 'channels/create'
+                params:
+                    'endpoint': 'Local/amd at default'
+                    'app': 'testsuite'
+                    'appArgs': 'amd'
+                    'channelId': 'channel2'
+                expect: 200
+            -   method: 'post'
+                uri: 'bridges/bridge1'
+                expect: 200
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                args: [
+                    ]
+                channel:
+                    id: 'channel1$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'channels/channel1/dial'
+
+    -   ari-events:
+            match:
+                type: 'StasisStart'
+                application: 'testsuite'
+                'args':
+                - 'amd'
+                channel:
+                    id: 'channel2$'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'channels/channel2/dial'
+                params:
+                    caller: 'channel1'
+
+    -   ari-events:
+            match:
+                type: 'Dial'
+                dialstatus: 'RINGING'
+                application: 'testsuite'
+                peer:
+                    id: 'channel1'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel1'
+                expect: 204
+
+    -   ari-events:
+            match:
+                type: 'Dial'
+                dialstatus: 'RINGING'
+                application: 'testsuite'
+                peer:
+                    id: 'channel2'
+            count: 1
+        ari-requests:
+            -   method: 'post'
+                uri: 'bridges/bridge1/addChannel'
+                params:
+                    channel: 'channel2'
+                expect: 204
+
+    -   ari-events:
+            match:
+                type: 'ChannelEnteredBridge'
+                application: 'testsuite'
+                channel:
+                    id: 'channel[12]$'
+            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/create_dial_bridge/bridge/tests.yaml b/tests/rest_api/channels/create_dial_bridge/bridge/tests.yaml
index 6025883..20fa246 100644
--- a/tests/rest_api/channels/create_dial_bridge/bridge/tests.yaml
+++ b/tests/rest_api/channels/create_dial_bridge/bridge/tests.yaml
@@ -1,2 +1,5 @@
 tests:
     - test: 'bridge_then_dial'
+    - test: 'bridge_after_answer'
+    - test: 'bridge_while_ringing'
+    - test: 'bridge_early_media'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5f358c5f900c0c84827412ea3e79e6ecc4c1c51b
Gerrit-PatchSet: 1
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>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list