[Asterisk-code-review] Add test to ensure route set preservation on SIP ACK. (testsuite[master])
Mark Michelson
asteriskteam at digium.com
Wed Jun 24 17:03:25 CDT 2015
Mark Michelson has uploaded a new change for review.
https://gerrit.asterisk.org/712
Change subject: Add test to ensure route set preservation on SIP ACK.
......................................................................
Add test to ensure route set preservation on SIP ACK.
This test has Asterisk originate a call to a SIPp scenario. The
SIPp scenario sends a response that includes Record-Route headers.
The test ensures that the ACK that Asterisk sends preserves the
route set, despite the fact that rewrite_contact has been enabled.
Change-Id: I4c8613508605c5194b262edc0cb10d53f2b467e2
---
A tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/extensions.conf
A tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/pjsip.conf
A tests/channels/pjsip/nat/rewrite_contact/route_set_response/sipp/uas-route-set.xml
A tests/channels/pjsip/nat/rewrite_contact/route_set_response/test-config.yaml
A tests/channels/pjsip/nat/rewrite_contact/tests.yaml
A tests/channels/pjsip/nat/tests.yaml
M tests/channels/pjsip/tests.yaml
7 files changed, 157 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/12/712/1
diff --git a/tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/extensions.conf b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/extensions.conf
new file mode 100644
index 0000000..c0f0b19
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => sipp,1,NoOp()
+same => n,Dial(PJSIP/sipp)
+same => n,Hangup()
diff --git a/tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/pjsip.conf b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..2f6fe6e
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+[local]
+type = transport
+bind = 127.0.0.1:5060
+
+[sipp]
+type = endpoint
+context = default
+allow = ulaw
+rewrite_contact = yes
+aors = sipp
+
+[sipp]
+type = aor
+contact = sip:sipp at 127.0.0.1:5061
diff --git a/tests/channels/pjsip/nat/rewrite_contact/route_set_response/sipp/uas-route-set.xml b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/sipp/uas-route-set.xml
new file mode 100644
index 0000000..9a1532e
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/sipp/uas-route-set.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+ <!-- 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. -->
+ <Global variables="remote_tag" />
+ <recv request="INVITE" crlf="true">
+ <!-- Save the from tag. We'll need it when we send our BYE -->
+ <action>
+ <ereg regexp=".*(;tag=.*)"
+ header="From:"
+ search_in="hdr"
+ check_it="true"
+ assign_to="remote_tag"/>
+ </action>
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Record-Route: <sip:127.0.0.1:5062;lr>
+ Record-Route: <sip:127.0.0.1:5061;lr>
+ Contact: <sip:127.0.0.1:5063>
+ 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 request="ACK"
+ rtd="true"
+ crlf="true">
+ <action>
+ <ereg regexp="ACK sip:127.0.0.1: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" />
+
+ <pause/>
+
+ <send retrans="500">
+ <![CDATA[
+
+ BYE sip:[service]@127.0.0.1:[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]SIPpTag01[call_number]
+ To: [$remote_tag]
+ [last_Call-ID:]
+ CSeq: [cseq] BYE
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200">
+ </recv>
+
+ <!-- Keep the call open for a while in case the 200 is lost to be -->
+ <!-- able to retransmit it if we receive the BYE again. -->
+ <timewait milliseconds="4000"/>
+
+
+ <!-- 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/nat/rewrite_contact/route_set_response/test-config.yaml b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/test-config.yaml
new file mode 100644
index 0000000..bc2a671
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/route_set_response/test-config.yaml
@@ -0,0 +1,36 @@
+testinfo:
+ summary: 'Ensure that proper URI is rewritten on SIP responses'
+ description: |
+ 'This test has Asterisk place an outbound call to a SIPp scenario,
+ which represents a proxy in the path to some endpoint. The 200 OK
+ response that SIPp sends has Record-Route headers in it. We ensure
+ that Asterisk does not attempt to rewrite the Contact header in the
+ SIP response but rather rewrites the bottom-most Record-Route header.'
+
+test-modules:
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpAMIActionTestCase'
+
+sipp-config:
+ fail-on-any: True
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'uas-route-set.xml', '-p': '5061'} }
+ ami-action:
+ delay: 1
+ args:
+ Action: 'Originate'
+ Channel: 'PJSIP/sipp'
+ Application: 'Echo'
+
+
+properties:
+ minversion: '13.5.0'
+ 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
new file mode 100644
index 0000000..beef6a2
--- /dev/null
+++ b/tests/channels/pjsip/nat/rewrite_contact/tests.yaml
@@ -0,0 +1,2 @@
+tests:
+ - test: 'route_set_response'
diff --git a/tests/channels/pjsip/nat/tests.yaml b/tests/channels/pjsip/nat/tests.yaml
new file mode 100644
index 0000000..e6bdf77
--- /dev/null
+++ b/tests/channels/pjsip/nat/tests.yaml
@@ -0,0 +1,2 @@
+tests:
+ - dir: 'rewrite_contact'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index b9af685..6351df0 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -38,4 +38,5 @@
- test: 'in_dialog_options'
- dir: 'resolver'
- test: 'forward_loop'
- - dir: 'configuration'
\ No newline at end of file
+ - dir: 'configuration'
+ - dir: 'nat'
--
To view, visit https://gerrit.asterisk.org/712
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c8613508605c5194b262edc0cb10d53f2b467e2
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-code-review
mailing list