[Asterisk-code-review] testsuite: Repurpose the tel uri test to test invalid URIs (testsuite[master])

George Joseph asteriskteam at digium.com
Thu Sep 14 14:37:28 CDT 2017


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/6505


Change subject: testsuite: Repurpose the tel_uri test to test invalid URIs
......................................................................

testsuite: Repurpose the tel_uri test to test invalid URIs

We're now testing that non sip(s) URIs that appear in the Request
Line or From/To/Contact headers are rejected with a 461.

Change-Id: I933dda31ff553c77dc64a4d95d28b8bfccbbe98f
---
R tests/channels/pjsip/invalid_uris/configs/ast1/extensions.conf
R tests/channels/pjsip/invalid_uris/configs/ast1/pjsip.conf
A tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml
A tests/channels/pjsip/invalid_uris/test-config.yaml
D tests/channels/pjsip/tel_uri/sipp/tel_uac.xml
D tests/channels/pjsip/tel_uri/test-config.yaml
M tests/channels/pjsip/tests.yaml
7 files changed, 145 insertions(+), 61 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/05/6505/1

diff --git a/tests/channels/pjsip/tel_uri/configs/ast1/extensions.conf b/tests/channels/pjsip/invalid_uris/configs/ast1/extensions.conf
similarity index 100%
rename from tests/channels/pjsip/tel_uri/configs/ast1/extensions.conf
rename to tests/channels/pjsip/invalid_uris/configs/ast1/extensions.conf
diff --git a/tests/channels/pjsip/tel_uri/configs/ast1/pjsip.conf b/tests/channels/pjsip/invalid_uris/configs/ast1/pjsip.conf
similarity index 100%
rename from tests/channels/pjsip/tel_uri/configs/ast1/pjsip.conf
rename to tests/channels/pjsip/invalid_uris/configs/ast1/pjsip.conf
diff --git a/tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml b/tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml
new file mode 100644
index 0000000..1b5a5ae
--- /dev/null
+++ b/tests/channels/pjsip/invalid_uris/sipp/invalid_uris.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+  <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]
+      To: sut <sip:1000@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: tel:+15558675309
+      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 -->
+
+</scenario>
+
diff --git a/tests/channels/pjsip/invalid_uris/test-config.yaml b/tests/channels/pjsip/invalid_uris/test-config.yaml
new file mode 100644
index 0000000..adf54dd
--- /dev/null
+++ b/tests/channels/pjsip/invalid_uris/test-config.yaml
@@ -0,0 +1,26 @@
+testinfo:
+    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.
+
+properties:
+    minversion: ['13.18.1', '14.7.1']
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+
+sipp-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'invalid_uris.xml', '-p': '5061'} }
diff --git a/tests/channels/pjsip/tel_uri/sipp/tel_uac.xml b/tests/channels/pjsip/tel_uri/sipp/tel_uac.xml
deleted file mode 100644
index 29c30b1..0000000
--- a/tests/channels/pjsip/tel_uri/sipp/tel_uac.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-<scenario name="Basic Sipstone UAC">
-  <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: <tel:1000;phone-context=+1555>;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 -->
-
-</scenario>
-
diff --git a/tests/channels/pjsip/tel_uri/test-config.yaml b/tests/channels/pjsip/tel_uri/test-config.yaml
deleted file mode 100644
index eb5e6d7..0000000
--- a/tests/channels/pjsip/tel_uri/test-config.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-testinfo:
-    summary: 'TEL URI support in basic inbound calls'
-    description: |
-        This test verifies that TEL URIs are appropriately handled in a basic
-        incoming call situation.
-
-properties:
-    minversion: ['13.17.1', '14.6.1']
-    dependencies:
-        - python : 'twisted'
-        - python : 'starpy'
-        - app : 'sipp'
-        - asterisk : 'res_pjsip'
-    tags:
-        - pjsip
-
-test-modules:
-    test-object:
-        config-section: sipp-config
-        typename: 'sipp.SIPpTestCase'
-
-sipp-config:
-    test-iterations:
-        -
-            scenarios:
-                - { 'key-args': {'scenario': 'tel_uac.xml', '-p': '5061'} }
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index a25007f..ceadbde 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -54,4 +54,4 @@
     - test: 'cseq_method'
     - test: 'multipart_empty_part'
     - test: 'dtmf_info_fallback'
-    - test: 'tel_uri'
+    - test: 'invalid_uris'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I933dda31ff553c77dc64a4d95d28b8bfccbbe98f
Gerrit-Change-Number: 6505
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170914/75b1681a/attachment-0001.html>


More information about the asterisk-code-review mailing list