[Asterisk-code-review] testsuite: add test to verify reinvites with rewrite contact (testsuite[13])

Torrey Searle asteriskteam at digium.com
Wed Oct 24 07:47:23 CDT 2018


Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/10532


Change subject: testsuite: add test to verify reinvites with rewrite_contact
......................................................................

testsuite: add test to verify reinvites with rewrite_contact

Verify that contact does not get modified if routset exists but
the reinvite does not contain Record-Route headers

ASTERISK-28129 #close

Change-Id: Ib6a2cbb21acac4837131f5d048b148658160367e
---
A tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/extensions.conf
A tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/pjsip.conf
A tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/sipp/uac-route-set.xml
A tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/test-config.yaml
M tests/channels/pjsip/nat/rewrite_contact/tests.yaml
5 files changed, 207 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/32/10532/1

diff --git a/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/extensions.conf b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/extensions.conf
new file mode 100644
index 0000000..7b75b3e
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/extensions.conf
@@ -0,0 +1,5 @@
+[default]
+exten => echo,1,NoOp()
+same => n,Answer()
+same => n,Echo()
+same => n,Hangup()
diff --git a/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/pjsip.conf b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f2ec207
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local]
+type = transport
+bind = 127.0.0.1:5060
+
+[sipp]
+type = endpoint
+context = default
+allow = ulaw
+rewrite_contact = yes
diff --git a/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/sipp/uac-route-set.xml b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/sipp/uac-route-set.xml
new file mode 100644
index 0000000..0908578
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/sipp/uac-route-set.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Record-Route: <sip:1.2.3.4:5061;lr>
+      Record-Route: <sip:127.0.0.1:5062;lr>
+      Contact: <sip:1.2.3.4:5063;transport=[transport]>
+      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="100"
+        optional="true">
+  </recv>
+
+  <recv response="181"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <recv response="183" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause ="10000" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: <sip:1.2.3.4:5063;transport=[transport]>
+      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="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE">
+      <action>
+          <ereg regexp="BYE sip:1.2.3.4:5063.*"
+              search_in="msg"
+              check_it="true"
+              assign_to="1"/>
+          <ereg regexp="Route: <sip:127.0.0.1:5061;lr>\r\nRoute: <sip:127.0.0.1:5062;lr>"
+              search_in="msg"
+              check_it="true"
+              assign_to="2"/>
+      </action>
+  </recv>
+
+  <Reference variables="1,2" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+</scenario>
diff --git a/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/test-config.yaml b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/test-config.yaml
new file mode 100644
index 0000000..133fbd1
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_reinvite/test-config.yaml
@@ -0,0 +1,38 @@
+testinfo:
+    summary: 'Ensure that proper URI is rewritten on SIP responses'
+    description: |
+        'This test has SIPp place a call to Asterisk. The SIPp scenario
+        represents a proxy in the path to some endpoint. The INVITE that the
+        SIPp scenario sends has Record-Route headers in it. We ensure that
+        Asterisk does not attempt to rewrite the Contact header in the INVITE
+        despite the fact that the rewrite_contact option is enabled. We instead
+        ensure that the top-most Record-Route header is rewritten. Also we verify
+        that if a re-invite w/o a Record-Route does not cause the contact to be
+        updated. We then hang up the call, and we ensure that the request URI 
+        and the route set in the BYE is correct.'
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpAMIActionTestCase'
+
+sipp-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uac-route-set.xml', '-p': '5061', '-s': 'echo'} }
+    ami-action:
+        delay: 2
+        args:
+            Action: 'Hangup'
+            Channel: '/PJSIP/sipp-.*/'
+
+properties:
+    dependencies:
+        - sipp:
+            version: 'v3.0'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/nat/rewrite_contact/tests.yaml b/tests/channels/pjsip/nat/rewrite_contact/tests.yaml
index 8f1a3e1..9c04329 100644
--- a/tests/channels/pjsip/nat/rewrite_contact/tests.yaml
+++ b/tests/channels/pjsip/nat/rewrite_contact/tests.yaml
@@ -1,3 +1,4 @@
 tests:
     - test: 'route_set_response'
     - test: 'route_set_request'
+    - test: 'route_set_reinvite'

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

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


More information about the asterisk-code-review mailing list