[Asterisk-code-review] res_ari_channels/res_pjsip: Added test for exposed protocol_id (testsuite[18])

George Joseph asteriskteam at digium.com
Fri Jul 8 05:46:11 CDT 2022


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/18758 )


Change subject: res_ari_channels/res_pjsip: Added test for exposed protocol_id
......................................................................

res_ari_channels/res_pjsip: Added test for exposed protocol_id

This test checks whether the protocol_id is successfully exposed
and filled with a PJSIP style Call-ID.

ASTERISK-30027
Reported by: Moritz Fain

Change-Id: Ibc8a103b9e54d709aa39472fa2d77a969c1685ac
---
A tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/extensions.conf
A tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/pjsip.conf
A tests/rest_api/channels/originate_to_pjsip_endpoint/test-config.yaml
M tests/rest_api/channels/tests.yaml
4 files changed, 116 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/58/18758/1

diff --git a/tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/extensions.conf b/tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/extensions.conf
new file mode 100644
index 0000000..3ba2826
--- /dev/null
+++ b/tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/extensions.conf
@@ -0,0 +1,14 @@
+[default]
+
+exten => s,1,NoOp()
+	same => n,Answer()
+	same => n,Stasis(testsuite)
+	same => n,Hangup()
+
+
+[default2]
+
+exten => 1000,1,NoOp()
+	same => n,Answer()
+	same => n,Wait(1)
+	same => n,Hangup()
diff --git a/tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/pjsip.conf b/tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f748994
--- /dev/null
+++ b/tests/rest_api/channels/originate_to_pjsip_endpoint/configs/ast1/pjsip.conf
@@ -0,0 +1,40 @@
+[global]
+debug=yes
+
+
+[transport1]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint1]
+type=endpoint
+context=default
+transport=transport1
+allow=!all,ulaw
+media_address=127.0.0.1
+direct_media=no
+aors=endpoint1_aor
+
+[endpoint1_aor]
+type=aor
+contact=sip:127.0.0.2:5060
+
+
+[transport2]
+type=transport
+protocol=udp
+bind=127.0.0.2:5060
+
+[endpoint2]
+type=endpoint
+context=default2
+transport=transport2
+allow=!all,ulaw
+media_address=127.0.0.2
+direct_media=no
+
+[endpoint2_identity]
+type=identify
+endpoint=endpoint2
+match=127.0.0.1
diff --git a/tests/rest_api/channels/originate_to_pjsip_endpoint/test-config.yaml b/tests/rest_api/channels/originate_to_pjsip_endpoint/test-config.yaml
new file mode 100644
index 0000000..5e0853c
--- /dev/null
+++ b/tests/rest_api/channels/originate_to_pjsip_endpoint/test-config.yaml
@@ -0,0 +1,61 @@
+testinfo:
+    summary: Test originating calls with PJSIP have a protocol_id set
+    description: |
+        Originate a call to a PJSIP endpoint using ARI and verify they have a protocol_id set (SIP Call-ID)
+
+properties:
+    dependencies:
+        - python : autobahn.websocket
+        - python : requests
+        - python : twisted
+        - python : starpy
+        - asterisk : res_ari_channels
+        - asterisk : chan_pjsip
+        - asterisk : res_pjsip
+    tags:
+        - ARI
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: ari.AriOriginateTestObject
+    modules:
+        -
+            config-section: ari-config
+            typename: ari.WebSocketEventModule
+        -
+            config-section: ari-test-stopper
+            typename: pluggable_modules.EventActionModule
+
+test-object-config:
+    stop-on-end: False
+    test-iterations:
+        -
+            endpoint: 'PJSIP/1000 at endpoint1'
+            channelId: 'MyCustomId'
+            otherChannelId: 'MyOtherCustomId'
+            app: 'testsuite'
+
+ari-test-stopper:
+    -
+        ari-events:
+            match:
+                type: ChannelDestroyed
+                application: testsuite
+                channel:
+                    id: 'MyCustomId$'
+        stop_test:
+
+ari-config:
+    apps: testsuite
+    events:
+        -
+            conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
+                    channel:
+                        protocol_id: '^.{8}-.{4}-.{4}-.{4}-.{12}$'
+                        id: 'MyCustomId'
+            count: 1
diff --git a/tests/rest_api/channels/tests.yaml b/tests/rest_api/channels/tests.yaml
index b585099..9f2b4fd 100644
--- a/tests/rest_api/channels/tests.yaml
+++ b/tests/rest_api/channels/tests.yaml
@@ -4,6 +4,7 @@
     - test: 'originate_with_id'
     - test: 'originate_with_linkedid'
     - test: 'originate_then_continue'
+    - test: 'originate_to_pjsip_endpoint'
     - test: 'snoop_whisper'
     - test: 'snoop_spy'
     - test: 'snoop_id'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/18758
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: Ibc8a103b9e54d709aa39472fa2d77a969c1685ac
Gerrit-Change-Number: 18758
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: Moritz Fain <moritz at fain.io>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220708/ae6e16b5/attachment-0001.html>


More information about the asterisk-code-review mailing list