[Asterisk-code-review] pjsip: Add test for basic TEL URI call. (testsuite[20])

Benjamin Keith Ford asteriskteam at digium.com
Thu Sep 8 10:37:11 CDT 2022


Benjamin Keith Ford has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/19125 )


Change subject: pjsip: Add test for basic TEL URI call.
......................................................................

pjsip: Add test for basic TEL URI call.

Adds a simple test that checks for TEL URIs in the request, from, and to
headers. Passes if the call succeeds, fails otherwise.

Also updated the invalid URIs test that was failing when detecting a TEL
URI since they are now considered valid URIs. Only the contact header
part of that test is still valid.

Change-Id: Idb1107b9e67919f905afbb564f93d683c398ce1a
---
M tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml
M tests/channels/pjsip/invalid_uris/test-config.yaml
A tests/channels/pjsip/tel_uri/basic_call/configs/ast1/extensions.conf
A tests/channels/pjsip/tel_uri/basic_call/configs/ast1/pjsip.conf
A tests/channels/pjsip/tel_uri/basic_call/sipp/invite.xml
A tests/channels/pjsip/tel_uri/basic_call/test-config.yaml
A tests/channels/pjsip/tel_uri/tests.yaml
M tests/channels/pjsip/tests.yaml
8 files changed, 144 insertions(+), 85 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/25/19125/1

diff --git a/tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml b/tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml
index 1b5a5ae..a709617 100644
--- a/tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml
+++ b/tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml
@@ -5,90 +5,6 @@
   <send retrans="500">
     <![CDATA[
 
-      INVITE tel:+1000;phone-context=foo.com SIP/2.0
-      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
-      From: <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
-      To: sut <sip:1000@[remote_ip]:[remote_port]>
-      Call-ID: [call_id]
-      CSeq: 1 INVITE
-      Contact: sip:sipp@[local_ip]:[local_port]
-      Max-Forwards: 70
-      Subject: Performance Test
-      Content-Type: application/sdp
-      Content-Length: [len]
-
-      v=0
-      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
-      s=-
-      c=IN IP[media_ip_type] [media_ip]
-      t=0 0
-      m=audio [media_port] RTP/AVP 0
-      a=rtpmap:0 PCMU/8000
-
-    ]]>
-  </send>
-
-  <recv response="416" /> <!-- Unsupported URI Scheme -->
-
-  <send retrans="500">
-    <![CDATA[
-
-      INVITE sip:1000@[local_ip]:[local_port] SIP/2.0
-      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
-      From: <tel:+15558675309>;tag=[pid]SIPpTag00[call_number]
-      To: sut <sip:1000@[remote_ip]:[remote_port]>
-      Call-ID: [call_id]
-      CSeq: 1 INVITE
-      Contact: sip:sipp@[local_ip]:[local_port]
-      Max-Forwards: 70
-      Subject: Performance Test
-      Content-Type: application/sdp
-      Content-Length: [len]
-
-      v=0
-      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
-      s=-
-      c=IN IP[media_ip_type] [media_ip]
-      t=0 0
-      m=audio [media_port] RTP/AVP 0
-      a=rtpmap:0 PCMU/8000
-
-    ]]>
-  </send>
-
-  <recv response="416" /> <!-- Unsupported URI Scheme -->
-
-  <send retrans="500">
-    <![CDATA[
-
-      INVITE sip:1000@[local_ip]:[local_port] SIP/2.0
-      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
-      From: <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
-      To: sut <tel:+15558675309>
-      Call-ID: [call_id]
-      CSeq: 1 INVITE
-      Contact: sip:sipp@[local_ip]:[local_port]
-      Max-Forwards: 70
-      Subject: Performance Test
-      Content-Type: application/sdp
-      Content-Length: [len]
-
-      v=0
-      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
-      s=-
-      c=IN IP[media_ip_type] [media_ip]
-      t=0 0
-      m=audio [media_port] RTP/AVP 0
-      a=rtpmap:0 PCMU/8000
-
-    ]]>
-  </send>
-
-  <recv response="416" /> <!-- Unsupported URI Scheme -->
-
-  <send retrans="500">
-    <![CDATA[
-
       INVITE sip:1000@[local_ip]:[local_port] SIP/2.0
       Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
       From: <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
diff --git a/tests/channels/pjsip/invalid_uris/test-config.yaml b/tests/channels/pjsip/invalid_uris/test-config.yaml
index 2a8f1f9..56ec8a6 100644
--- a/tests/channels/pjsip/invalid_uris/test-config.yaml
+++ b/tests/channels/pjsip/invalid_uris/test-config.yaml
@@ -2,7 +2,7 @@
     summary: 'Verifies that non sip(s) uri requests are rejected'
     description: |
         This test verifies that non sip(s) URIs are rejected when appearing in
-        the Request Line or in the From/To/Contact headers.
+        the Contact header.
 
 properties:
     dependencies:
diff --git a/tests/channels/pjsip/tel_uri/basic_call/configs/ast1/extensions.conf b/tests/channels/pjsip/tel_uri/basic_call/configs/ast1/extensions.conf
new file mode 100644
index 0000000..7f07ac3
--- /dev/null
+++ b/tests/channels/pjsip/tel_uri/basic_call/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+
+exten => 1234,1,Answer()
+ same  => n,Echo()
+ same  => n,Hangup()
diff --git a/tests/channels/pjsip/tel_uri/basic_call/configs/ast1/pjsip.conf b/tests/channels/pjsip/tel_uri/basic_call/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..40384c4
--- /dev/null
+++ b/tests/channels/pjsip/tel_uri/basic_call/configs/ast1/pjsip.conf
@@ -0,0 +1,17 @@
+[global]
+debug=yes
+
+[transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[5555]
+type=endpoint
+context=default
+allow=!all,ulaw
+
+[5555]
+type=identify
+endpoint=5555
+match=127.0.0.1:5061
diff --git a/tests/channels/pjsip/tel_uri/basic_call/sipp/invite.xml b/tests/channels/pjsip/tel_uri/basic_call/sipp/invite.xml
new file mode 100644
index 0000000..2e1214d
--- /dev/null
+++ b/tests/channels/pjsip/tel_uri/basic_call/sipp/invite.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE tel">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE tel:1234 SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <tel:5555>;tag=[call_number]
+      To: <tel:1234>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:5555@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+
+  <recv response="200" rtd="true" />
+
+  <send>
+    <![CDATA[
+
+      ACK tel:1234 SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <tel:5555>;tag=[call_number]
+      To: <tel:1234>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:5555@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE tel:1234 SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <tel:5555>;tag=[call_number]
+      To: <tel:1234>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: <sip:5555@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true" />
+
+</scenario>
diff --git a/tests/channels/pjsip/tel_uri/basic_call/test-config.yaml b/tests/channels/pjsip/tel_uri/basic_call/test-config.yaml
new file mode 100644
index 0000000..5d5d6d1
--- /dev/null
+++ b/tests/channels/pjsip/tel_uri/basic_call/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Ensure that a call with tel URI works.'
+    description: |
+        Test to make sure calls with tel URIs in request, from,
+        and to headers works.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'invite.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - sipp :
+            version : 'v3.0'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/tel_uri/tests.yaml b/tests/channels/pjsip/tel_uri/tests.yaml
new file mode 100644
index 0000000..c97cf2e
--- /dev/null
+++ b/tests/channels/pjsip/tel_uri/tests.yaml
@@ -0,0 +1,3 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'basic_call'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index e585356..bc4424a 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -25,6 +25,7 @@
     - dir: 'statsd'
     - dir: 'stir_shaken'
     - dir: 'subscriptions'
+    - dir: 'tel_uri'
     - dir: 'transfers'
     - dir: 'transport'
     - dir: 'video_calls'

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

Gerrit-Project: testsuite
Gerrit-Branch: 20
Gerrit-Change-Id: Idb1107b9e67919f905afbb564f93d683c398ce1a
Gerrit-Change-Number: 19125
Gerrit-PatchSet: 1
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220908/03bc23ac/attachment-0001.html>


More information about the asterisk-code-review mailing list