[Asterisk-code-review] res_pjsip_session: Add test for outgoing URI parameters. (testsuite[master])

N A asteriskteam at digium.com
Sat Jul 23 15:12:04 CDT 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/18832 )


Change subject: res_pjsip_session: Add test for outgoing URI parameters.
......................................................................

res_pjsip_session: Add test for outgoing URI parameters.

Adds a test suite case for ensuring that outgoing URI
parameters get set properly.

ASTERISK_30150

Change-Id: Ic897797c6f0abf92bf5c7ce1fe26ebc45b10a064
---
A tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/extensions.conf
A tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/pjsip.conf
A tests/channels/pjsip/parameters/outgoing_uri/test-config.yaml
A tests/channels/pjsip/parameters/tests.yaml
M tests/channels/pjsip/tests.yaml
5 files changed, 105 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/32/18832/1

diff --git a/tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/extensions.conf b/tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/extensions.conf
new file mode 100644
index 0000000..360f490
--- /dev/null
+++ b/tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/extensions.conf
@@ -0,0 +1,22 @@
+
+[default]
+exten => s,1,Answer()
+	same => n,NoOp(From header: ${PJSIP_HEADER(read,From,1)})
+	same => n,GotoIf($["${CUT(PJSIP_HEADER(read,From,1),\;,2)}"="isup-oli=27>"]?good,1:bad,1) ; We should read the isup-oli parameter into the ANI2.
+exten => bad,1,UserEvent(TestFail,Result: Fail)
+	same => n,Hangup()
+exten => good,1,UserEvent(TestSuccess,Result: Pass)
+	same => n,Hangup()
+
+[dial]
+exten => s,1,Answer()
+	same => n,Set(CALLERID(num)=5552368)
+	same => n,Set(_SIPURIPARAMETERS=isup-oli=27) ; Manually set the ANI2 for the outgoing call
+	same => n,Dial(PJSIP/loopback/sip:s at 127.0.0.1) ; loop a call back to ourself to test.
+	same => n,UserEvent(TestFail,Result: Fail) ; If we fall through, it didn't work.
+	same => n,Hangup()
+
+[nothing]
+exten => s,1,Answer()
+	same => n,Wait(10)
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/pjsip.conf b/tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..88d5e7e
--- /dev/null
+++ b/tests/channels/pjsip/parameters/outgoing_uri/configs/ast1/pjsip.conf
@@ -0,0 +1,20 @@
+[global]
+type = global
+endpoint_identifier_order = ip,username,anonymous
+
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[loopback]
+type=identify
+match=127.0.0.1
+endpoint=loopback
+
+[loopback]
+type=endpoint
+identify_by=ip
+disallow=all
+allow=ulaw
+context=default
diff --git a/tests/channels/pjsip/parameters/outgoing_uri/test-config.yaml b/tests/channels/pjsip/parameters/outgoing_uri/test-config.yaml
new file mode 100644
index 0000000..ae963d9
--- /dev/null
+++ b/tests/channels/pjsip/parameters/outgoing_uri/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary: 'Ensure that outgoing URI parameters in PJSIP can be set properly.'
+    description: |
+        'This tests that outgoing parameters can be set in the PJSIP From
+        header by setting a custom header and ensuring it exists in a
+        SIP INVITE.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: caller-originator
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-monitor
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    connect-ami: True
+
+caller-originator:
+    channel: 'Local/s at dial'
+    context: 'nothing'
+    exten: 's'
+    priority: '1'
+    trigger: 'ami_connect'
+
+hangup-monitor:
+    ids: '0'
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'TestSuccess'
+            requirements:
+                match:
+                    Result: 'Pass'
+            count: 1
+        stop_test:
+
+properties:
+    tags:
+        - dial
+        - channels
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_userevent'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'pbx_config'
diff --git a/tests/channels/pjsip/parameters/tests.yaml b/tests/channels/pjsip/parameters/tests.yaml
new file mode 100644
index 0000000..51602fb
--- /dev/null
+++ b/tests/channels/pjsip/parameters/tests.yaml
@@ -0,0 +1,3 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'outgoing_uri'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index e585356..081a883 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -14,6 +14,7 @@
     - dir: 'message'
     - dir: 'nat'
     - dir: 'one_touch_recording'
+    - dir: 'parameters'
     - dir: 'publish'
     - dir: 'qualify'
     - dir: 'registration'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: Ic897797c6f0abf92bf5c7ce1fe26ebc45b10a064
Gerrit-Change-Number: 18832
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220723/9897e137/attachment-0001.html>


More information about the asterisk-code-review mailing list