[asterisk-commits] Test that in-dialog NOTIFYs are sent to expected address. (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 22 05:28:49 CDT 2015
Joshua Colp has submitted this change and it was merged.
Change subject: Test that in-dialog NOTIFYs are sent to expected address.
......................................................................
Test that in-dialog NOTIFYs are sent to expected address.
This test simulates a NAT by having a SIPp scenario place a bogus
IP address/port combination in Contact headers it sends.
The scenario consists of an initial subscription to MWI, a mailbox
state change, and subscription termination. In all cases, all SIP
traffic from Asterisk should be sent to the IP address/port where
SIPp is running, not the IP address/port in the Contact header.
ASTERISK-24981 #close
Reported by Mark Michelson
Change-Id: I77cab15110caa171ecd11c00db021b572e250acd
---
A tests/channels/pjsip/subscriptions/nat_notify/configs/ast1/pjsip.conf
A tests/channels/pjsip/subscriptions/nat_notify/sipp/subscribe.xml
A tests/channels/pjsip/subscriptions/nat_notify/test-config.yaml
M tests/channels/pjsip/subscriptions/tests.yaml
4 files changed, 180 insertions(+), 0 deletions(-)
Approvals:
Joshua Colp: Looks good to me, approved; Verified
George Joseph: Looks good to me, but someone else must approve
diff --git a/tests/channels/pjsip/subscriptions/nat_notify/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/nat_notify/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3602bb3
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/nat_notify/configs/ast1/pjsip.conf
@@ -0,0 +1,17 @@
+[global]
+type = global
+debug = yes
+
+[transport]
+type = transport
+protocol = udp
+bind = 127.0.0.1
+
+[sipp]
+type = endpoint
+rewrite_contact = true
+aors = sipp
+
+[sipp]
+type = aor
+mailboxes = sipp
diff --git a/tests/channels/pjsip/subscriptions/nat_notify/sipp/subscribe.xml b/tests/channels/pjsip/subscriptions/nat_notify/sipp/subscribe.xml
new file mode 100644
index 0000000..fc9f6d0
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/nat_notify/sipp/subscribe.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="NAT NOTIFY">
+ <send retrans="500">
+ <![CDATA[
+
+ SUBSCRIBE 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 SUBSCRIBE
+ Contact: sip:sipp at 192.168.0.1:12345
+ Max-Forwards: 70
+ Subject: Performance Test
+ Event: message-summary
+ Supported: eventlist
+ Accept: application/simple-message-summary
+ Expires: 3600
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="100"
+ optional="true">
+ </recv>
+
+ <recv response="200" rtd="true" />
+
+ <!-- Initial NOTIFY upon subscribing -->
+ <recv request="NOTIFY" crlf="true" />
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: sip:sipp at 192.168.0.1:12345
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <!-- NOTIFY upon mailbox state change -->
+ <recv request="NOTIFY" crlf="true" />
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: sip:sipp at 192.168.0.1:12345
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SUBSCRIBE 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: [cseq] SUBSCRIBE
+ Contact: sip:sipp at 192.168.0.1:12345
+ Max-Forwards: 70
+ Subject: Performance Test
+ Event: message-summary
+ Supported: eventlist
+ Accept: application/simple-message-summary
+ Expires: 0
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <!-- NOTIFY upon resubscription -->
+ <recv request="NOTIFY" crlf="true" />
+
+ <recv response="200" crlf="true" />
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Content-Length: 0
+
+ ]]>
+ </send>
+</scenario>
diff --git a/tests/channels/pjsip/subscriptions/nat_notify/test-config.yaml b/tests/channels/pjsip/subscriptions/nat_notify/test-config.yaml
new file mode 100644
index 0000000..314ed27
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/nat_notify/test-config.yaml
@@ -0,0 +1,54 @@
+testinfo:
+ summary: 'Ensure that in-dialog NOTIFY is sent to expected address when NAT is involved'
+ description: |
+ 'This test runs a SIPp scenario that simulates a device behind a NAT by using a bogus
+ Contact header address. What we want to ensure is that the rewrite_contact option results
+ in Asterisk sending all in-dialog traffic to the address that rewrite_contact writes.
+
+ The actual SIPp scenario subscribes to MWI, expects a NOTIFY after a single mailbox change
+ and then unsubscribes from MWI. If Asterisk sends any requests or responses to the wrong
+ address, then the SIPp scenario will fail.'
+
+test-modules:
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ config-section: ami-action-config
+ typename: 'pluggable_modules.EventActionModule'
+
+sipp-config:
+ test-iterations:
+ -
+ scenarios:
+ - {'key-args': { 'scenario': 'subscribe.xml', '-s': 'sipp' }}
+
+ami-action-config:
+ -
+ ami-events:
+ conditions:
+ match:
+ Event: 'TestEvent'
+ State: 'SUBSCRIPTION_ESTABLISHED'
+ ami-actions:
+ -
+ action:
+ Action: 'MWIUpdate'
+ Mailbox: 'sipp'
+ OldMessages: '0'
+ NewMessages: '1'
+
+properties:
+ minversion: '13.4.0'
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_pubsub'
+ - asterisk: 'res_pjsip_mwi'
+ - asterisk: 'res_mwi_external'
+ - asterisk: 'res_mwi_external_ami'
+ tags:
+ - pjsip
+ - mwi_external
diff --git a/tests/channels/pjsip/subscriptions/tests.yaml b/tests/channels/pjsip/subscriptions/tests.yaml
index 86b50e0..136197d 100644
--- a/tests/channels/pjsip/subscriptions/tests.yaml
+++ b/tests/channels/pjsip/subscriptions/tests.yaml
@@ -8,3 +8,4 @@
- test: 'below_min_expiry'
- dir: 'rls'
- test: 'mismatch'
+ - test: 'nat_notify'
--
To view, visit https://gerrit.asterisk.org/165
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I77cab15110caa171ecd11c00db021b572e250acd
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-commits
mailing list