[Asterisk-code-review] testsuite: verify unknown content-disposion handling (testsuite[13])

Torrey Searle asteriskteam at digium.com
Thu Mar 19 04:43:55 CDT 2020


Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/13953 )


Change subject: testsuite: verify unknown content-disposion handling
......................................................................

testsuite: verify unknown content-disposion handling

Verify that if handling is required for a content type and
asterisk does not know how to handle it.  It will be rejected
with a 415 response

ASTERISK-28782 #close

Change-Id: Icaf27d73e4fb16be192025b59a7fa58a8f83b827
---
A tests/channels/pjsip/content_disposition/configs/ast1/extensions.conf
A tests/channels/pjsip/content_disposition/configs/ast1/pjsip.conf
A tests/channels/pjsip/content_disposition/configs/ast1/sip.conf
A tests/channels/pjsip/content_disposition/sipp/A_PARTY.xml
A tests/channels/pjsip/content_disposition/test-config.yaml
M tests/channels/pjsip/tests.yaml
6 files changed, 272 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/53/13953/1

diff --git a/tests/channels/pjsip/content_disposition/configs/ast1/extensions.conf b/tests/channels/pjsip/content_disposition/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ad7b155
--- /dev/null
+++ b/tests/channels/pjsip/content_disposition/configs/ast1/extensions.conf
@@ -0,0 +1,11 @@
+[general]
+static=yes
+writeprotect=yes
+autofallthrough=yes
+clearglobalvars=no
+priorityjumping=yes
+
+[globals]
+
+[default]
+exten => _X.,1,Dial(pjsip/sbc,180)
diff --git a/tests/channels/pjsip/content_disposition/configs/ast1/pjsip.conf b/tests/channels/pjsip/content_disposition/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..cc6e649
--- /dev/null
+++ b/tests/channels/pjsip/content_disposition/configs/ast1/pjsip.conf
@@ -0,0 +1,87 @@
+;--
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements start
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[general]
+sipdebug = yes
+
+[PEER_A]
+port = 5061
+
+[sbc]
+port = 5700
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+Non mapped elements end
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+--;
+
+
+[global]
+type = global
+user_agent = Vox Callcontrol
+debug = yes
+
+[transport-udp]
+type = transport
+protocol = udp
+bind = 0.0.0.0
+
+[PEER_A]
+type = aor
+contact = sip:127.0.0.1:5061
+
+[PEER_A]
+type = identify
+endpoint = PEER_A
+match = 127.0.0.1
+
+[PEER_A]
+type = endpoint
+context = default
+dtmf_mode = rfc4733
+disallow = all
+allow = alaw
+allow = ulaw
+allow = g729
+allow = h263p
+allow = h264
+direct_media = no
+send_rpid = yes
+sdp_session = session
+dtls_verify = no
+dtls_rekey = 300
+dtls_cert_file = /etc/asterisk/keys/asterisk.crt
+dtls_private_key = /etc/asterisk/keys/asterisk.key
+dtls_cipher = ALL
+aors = PEER_A
+t38_udptl = yes
+t38_udptl_ec = redundancy
+
+[sbc]
+type = aor
+contact = sip:127.0.0.1:5700
+
+[sbc]
+type = endpoint
+context = default
+dtmf_mode = rfc4733
+disallow = all
+allow = alaw
+allow = ulaw
+allow = g729
+allow = h263p
+allow = h264
+direct_media = no
+send_rpid = yes
+sdp_session = session
+dtls_verify = no
+dtls_rekey = 300
+dtls_cert_file = /etc/asterisk/keys/asterisk.crt
+dtls_private_key = /etc/asterisk/keys/asterisk.key
+dtls_cipher = ALL
+aors = sbc
+t38_udptl = yes
+t38_udptl_ec = redundancy
+
diff --git a/tests/channels/pjsip/content_disposition/configs/ast1/sip.conf b/tests/channels/pjsip/content_disposition/configs/ast1/sip.conf
new file mode 100644
index 0000000..c79ca07
--- /dev/null
+++ b/tests/channels/pjsip/content_disposition/configs/ast1/sip.conf
@@ -0,0 +1,52 @@
+[general]
+sipdebug=yes
+tcpenable=no
+tlsenable=no
+transport=udp
+canreinvite=no
+nat=no
+srvlookup=yes
+context=block
+pedantic=yes
+dtmfmode=rfc2833
+realm=voxbone.com
+useragent=Vox Callcontrol
+promiscredir=yes
+disallow=all
+allow=alaw
+allow=ulaw
+allow=g729
+allow=h263p
+allow=h264
+rtcachefriends=yes
+rtautoclear=86400
+sendrpid=yes
+videosupport=yes
+maxcallbitrate=20
+relaxdtmf=yes
+t38pt_udptl=yes,redundancy
+sdpsession=session
+ignoresdpversion=yes
+use_q850_reason=yes
+dtlsverify= no
+dtlsrekey= 300
+dtlscipher=ALL
+dtlscertfile= /etc/asterisk/keys/asterisk.crt
+dtlsprivatekey= /etc/asterisk/keys/asterisk.key
+
+[PEER_A]
+host=127.0.0.1
+port=5061
+type=peer
+insecure=invite
+context=default
+nat=no
+
+[sbc]
+host=127.0.0.1
+port=5700
+type=peer
+insecure=invite
+context=default
+
+
diff --git a/tests/channels/pjsip/content_disposition/sipp/A_PARTY.xml b/tests/channels/pjsip/content_disposition/sipp/A_PARTY.xml
new file mode 100644
index 0000000..67779e8
--- /dev/null
+++ b/tests/channels/pjsip/content_disposition/sipp/A_PARTY.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE scenario SYSTEM "bansallaptop.dtd">
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uac' scenario.                       -->
+<!--                                                                    -->
+<scenario name="A_PARTY.xml">
+  <!-- INVITE with application/ISUP and sdp body, asterisk should ignore ISUP body and still process the SDP -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From:  <sip:bansallaptop@[local_ip]:[local_port]>;tag=[call_number]
+      To: bansalphone <sip:[service]@[remote_ip]>
+      Call-ID: [call_id]
+      X-VCC-UUID: [pid][clock_tick][call_number]
+      X-VCC-Provider: 61 [local_ip] BEL
+      CSeq: 1 INVITE
+      Contact: sip:bansallaptop@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: multipart/mixed;boundary=ub-dialogic-sw-1
+      Content-Length: [len]
+
+      --ub-dialogic-sw-1
+      Content-Type: application/sdp
+
+      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 7000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+      --ub-dialogic-sw-1
+      Content-Type: application/ISUP;version=itu-t92+
+      Content-Disposition: signal;handling=required
+
+      \x01\x00\x20\x01\x0a\x00\x02\x0a\x08\x83\x90\x12\x31\x78\x98\x90\x09\x0a\x07\x03\x11\x12\x80\x81\x44\x10\x08\x01\x80\x31\x02\x00\x00\x3d\x01\x12\x03\x0c\x6d\x06\x80\x50\x31\x32\x33\x34\x7d\x02\x91\x81\x1d\x03\x80\x90\xa3\x20\x18\x04\x42\x69\x74\x74\x65\x20\x72\x75\x66\x65\x6e\x20\x53\x69\x65\x20\x7a\x75\x72\x75\x65\x63\x6b\x39\x06\x31\xc0\x3d\xc0\xfe\xd0\xfe\x01\x01\x00
+      --ub-dialogic-sw-1--
+    ]]>
+  </send>
+
+  <recv response="100" optional="true">
+  </recv>
+
+
+
+  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+  <!-- are saved and used for following messages sent. Useful to test   -->
+  <!-- against stateful SIP proxies/B2BUAs.                             -->
+  <recv response="415" rtd="true" rrs="true">
+  </recv>
+
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK [next_url] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: bansallaptop <sip:bansallaptop@[local_ip]:[local_port]>;tag=[call_number]
+      To: bansalphone <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:bansallaptop@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      [routes]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+
+</scenario>
diff --git a/tests/channels/pjsip/content_disposition/test-config.yaml b/tests/channels/pjsip/content_disposition/test-config.yaml
new file mode 100644
index 0000000..3e4adc8
--- /dev/null
+++ b/tests/channels/pjsip/content_disposition/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Reject INVITE if unknown content type requires handling'
+    description: |
+         'If unknown media has handling=required in its content disposition reject the call with 415'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'A_PARTY.xml', '-p': '5061', '-i': '127.0.0.1', '-s': '3200000000' } }
+
+
+properties:
+    dependencies:
+        - sipp :
+             version : 'v3.0'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_session'
+        - asterisk : 'chan_pjsip'
+
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index abc17c0..3b32221 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -59,3 +59,4 @@
     - test: 'invalid_uris'
     - test: 'moh_passthru_inactive'
     - test: 'non_negotiated_frame_SSRC_change'
+    - test: 'content_disposition'

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

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-Change-Id: Icaf27d73e4fb16be192025b59a7fa58a8f83b827
Gerrit-Change-Number: 13953
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200319/34987512/attachment-0001.html>


More information about the asterisk-code-review mailing list