[asterisk-dev] Change in testsuite[master]: pjsip: Add test for OPTIONS requests received in-dialog.

Matt Jordan (Code Review) asteriskteam at digium.com
Fri Apr 10 08:27:06 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: pjsip: Add test for OPTIONS requests received in-dialog.
......................................................................


pjsip: Add test for OPTIONS requests received in-dialog.

This test establishes a session with Asterisk. Once established an
OPTIONS request is sent in-dialog. Asterisk is expected to respond
with a 200 OK. If this does not occur the test fails.

ASTERISK-24862 #close
Reported by: yaron nahum

Change-Id: I137c66e4faad5212040f6aded6be2aac20fc473d
---
A tests/channels/pjsip/in_dialog_options/configs/ast1/extensions.conf
A tests/channels/pjsip/in_dialog_options/configs/ast1/pjsip.conf
A tests/channels/pjsip/in_dialog_options/sipp/invite_with_options.xml
A tests/channels/pjsip/in_dialog_options/test-config.yaml
M tests/channels/pjsip/tests.yaml
5 files changed, 168 insertions(+), 0 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/tests/channels/pjsip/in_dialog_options/configs/ast1/extensions.conf b/tests/channels/pjsip/in_dialog_options/configs/ast1/extensions.conf
new file mode 100644
index 0000000..711c6cb
--- /dev/null
+++ b/tests/channels/pjsip/in_dialog_options/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => playback,1,Answer()
+same  =>          n,Playback(demo-congrats)
+same  =>          n,Hangup()
diff --git a/tests/channels/pjsip/in_dialog_options/configs/ast1/pjsip.conf b/tests/channels/pjsip/in_dialog_options/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..79da0da
--- /dev/null
+++ b/tests/channels/pjsip/in_dialog_options/configs/ast1/pjsip.conf
@@ -0,0 +1,15 @@
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[call](endpoint-template-ipv4)
+transport=local-transport-udp
diff --git a/tests/channels/pjsip/in_dialog_options/sipp/invite_with_options.xml b/tests/channels/pjsip/in_dialog_options/sipp/invite_with_options.xml
new file mode 100644
index 0000000..18c3a8a
--- /dev/null
+++ b/tests/channels/pjsip/in_dialog_options/sipp/invite_with_options.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to Asterisk and once answered send an OPTIONS request in-dialog">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:test@[local_ip]:[local_port]
+      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>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:test@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      OPTIONS sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 OPTIONS
+      Contact: sip:test@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Length: [len]
+    ]]>
+  </send>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: sip:test@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:playback@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 BYE
+      Contact: sip:test@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/in_dialog_options/test-config.yaml b/tests/channels/pjsip/in_dialog_options/test-config.yaml
new file mode 100644
index 0000000..4e5692d
--- /dev/null
+++ b/tests/channels/pjsip/in_dialog_options/test-config.yaml
@@ -0,0 +1,27 @@
+testinfo:
+    summary:     'Tests handling of an in-dialog OPTIONS'
+    description: |
+        This test runs a SIPp scenario which establishes a session with Asterisk.
+        Once the session has been established an OPTIONS request is sent in-dialog.
+        Asterisk is expected to respond with a 200 OK. If this does not occur then
+        the test fails.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'invite_with_options.xml', '-i': '127.0.0.1', '-p': '5061', '-d': '5000', '-s': 'call'} }
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 54b9d35..ddc655a 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -35,3 +35,5 @@
     - test: 'keep_alive'
     - test: 'endpoint_identify'
     - test: 'rpid_immediate'
+    - test: 'in_dialog_options'
+

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I137c66e4faad5212040f6aded6be2aac20fc473d
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-dev mailing list