[Asterisk-code-review] AST-2017-014: res pjsip - Test for missing contact headers (testsuite[master])
Kevin Harwell
asteriskteam at digium.com
Fri Dec 22 17:33:28 CST 2017
Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/7732
Change subject: AST-2017-014: res_pjsip - Test for missing contact headers
......................................................................
AST-2017-014: res_pjsip - Test for missing contact headers
If a SIP message that creates a dialog does not contain a contact header
Asterisk responds with a 400. This test checks each of those SIP messages
with missing contact headers against Asterisk to make sure the proper
response is received.
ASTERISK-27480 #close
Change-Id: Ie0078c482dd06f14653729a46b69fb48fbc19f23
---
A tests/channels/pjsip/headers/no_contact/configs/ast1/extensions.conf
A tests/channels/pjsip/headers/no_contact/configs/ast1/pjsip.conf
A tests/channels/pjsip/headers/no_contact/sipp/no_contact.xml
A tests/channels/pjsip/headers/no_contact/test-config.yaml
M tests/channels/pjsip/headers/tests.yaml
5 files changed, 182 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/32/7732/1
diff --git a/tests/channels/pjsip/headers/no_contact/configs/ast1/extensions.conf b/tests/channels/pjsip/headers/no_contact/configs/ast1/extensions.conf
new file mode 100644
index 0000000..4365177
--- /dev/null
+++ b/tests/channels/pjsip/headers/no_contact/configs/ast1/extensions.conf
@@ -0,0 +1,3 @@
+[general]
+
+[default]
diff --git a/tests/channels/pjsip/headers/no_contact/configs/ast1/pjsip.conf b/tests/channels/pjsip/headers/no_contact/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..e59c702
--- /dev/null
+++ b/tests/channels/pjsip/headers/no_contact/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[endpoint_t](!)
+type=endpoint
+transport=local
+context=default
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_t](!)
+type=aor
+max_contacts=10
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; alice
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[alice](aor_t)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice]
+type=auth
+username=alice
+password=alice
+
+[alice](endpoint_t)
+aors=alice
+auth=alice
diff --git a/tests/channels/pjsip/headers/no_contact/sipp/no_contact.xml b/tests/channels/pjsip/headers/no_contact/sipp/no_contact.xml
new file mode 100644
index 0000000..d0ede2b
--- /dev/null
+++ b/tests/channels/pjsip/headers/no_contact/sipp/no_contact.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Missing Contact">
+ <send retrans="500">
+ <![CDATA[
+ INVITE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ Max-Forwards: 70
+ From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[pid].[call_number]
+ To: "bob" <sip:bob@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ Supported: replaces, 100rel, timer, norefersub
+ Session-Expires: 1800
+ Min-SE: 90
+ User-Agent: Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <recv response="400" />
+
+ <send retrans="500">
+ <![CDATA[
+ UPDATE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ Max-Forwards: 70
+ From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[pid].[call_number]
+ To: "bob" <sip:bob@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] UPDATE
+ Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
+ Supported: replaces, 100rel, timer, norefersub
+ Session-Expires: 1800
+ Min-SE: 90
+ User-Agent: Test
+ Content-Type: application/sdp
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <recv response="400" />
+
+ <send retrans="500">
+ <![CDATA[
+ SUBSCRIBE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ Max-Forwards: 70
+ From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[pid].[call_number]
+ To: "alice" <sip:alice@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] SUBSCRIBE
+ Event: presence
+ Expires: 3600
+ Supported: replaces, 100rel, timer, norefersub
+ Accept: application/pidf+xml
+ User-Agent: Test
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <recv response="400" />
+
+ <send retrans="500">
+ <![CDATA[
+ REFER sip:alice@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ Max-Forwards: 70
+ From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[pid].[call_number]
+ To: "bob" <sip:bob@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] REFER
+ Event: refer
+ Expires: 600
+ Supported: replaces, 100rel, timer, norefersub
+ Accept: message/sipfag;version=2.0
+ Allow-Events: presence, message-summary, refer
+ Refer-To: sip:charlie@[remote_ip]:[remote_port];user=phone
+ Referred-By: sip:alice@[local_ip]:[local_port]
+ User-Agent: Test
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <recv response="400" />
+
+ <send retrans="500">
+ <![CDATA[
+ NOTIFY sip:bob@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ Max-Forwards: 70
+ From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[pid].[call_number]
+ To: "bob" <sip:bob@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] NOTIFY
+ Event: message-summary
+ Expires: 3600
+ Supported: replaces, 100rel, timer, norefersub
+ Accept: application/pidf+xml
+ User-Agent: Test
+ Content-Type: application/simple-message-summary
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <recv response="400" />
+
+</scenario>
diff --git a/tests/channels/pjsip/headers/no_contact/test-config.yaml b/tests/channels/pjsip/headers/no_contact/test-config.yaml
new file mode 100644
index 0000000..ffa105a
--- /dev/null
+++ b/tests/channels/pjsip/headers/no_contact/test-config.yaml
@@ -0,0 +1,28 @@
+testinfo:
+ summary: 'Test SIP messages that contain no contact header'
+ description: |
+ 'SIP messages that create dialogs must contain a contact header.
+ This test makes sure that Asterisk responds with a 400 for those
+ SIP message types that require a contact header.'
+
+properties:
+ minversion: ['13.19.1', '14.7.5', '15.2.1']
+ dependencies:
+ - sipp :
+ version : 'v3.0'
+ - asterisk : 'res_pjsip'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+
+sipp-config:
+ reactor-timeout: 20
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'no_contact.xml', '-p': '5061',
+ '-au': 'alice', '-ap': 'alice'} }
diff --git a/tests/channels/pjsip/headers/tests.yaml b/tests/channels/pjsip/headers/tests.yaml
index 7c3b64d..6206526 100644
--- a/tests/channels/pjsip/headers/tests.yaml
+++ b/tests/channels/pjsip/headers/tests.yaml
@@ -1,4 +1,5 @@
# Enter tests here in the order they should be considered for execution:
tests:
- test: 'anonymous_from_basic_call'
+ - test: 'no_contact'
- test: 'non-anonymous_from_basic_call'
--
To view, visit https://gerrit.asterisk.org/7732
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0078c482dd06f14653729a46b69fb48fbc19f23
Gerrit-Change-Number: 7732
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171222/cecd280f/attachment-0001.html>
More information about the asterisk-code-review
mailing list