[asterisk-commits] res pjsip: Add direct media rtp keepalive test (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 22 06:56:54 CDT 2015
Joshua Colp has submitted this change and it was merged.
Change subject: res_pjsip: Add direct media rtp_keepalive test
......................................................................
res_pjsip: Add direct media rtp_keepalive test
This test has two SIPp scenarios bridged together in Asterisk with
direct media enabled. The test ensures that when direct media is in use,
Asterisk does not send any RTP keepalive packets to the endpoints.
ASTERISK-25242
Reported by Mark Michelson
Change-Id: I23009970201cc07701f8208a652b682f64c11537
---
A tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/extensions.conf
A tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/pjsip.conf
A tests/channels/pjsip/rtp/rtp_keepalive/direct_media/rtp.py
A tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/alice.xml
A tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/bob.xml
A tests/channels/pjsip/rtp/rtp_keepalive/direct_media/test-config.yaml
M tests/channels/pjsip/rtp/rtp_keepalive/tests.yaml
7 files changed, 336 insertions(+), 0 deletions(-)
Approvals:
Matt Jordan: Looks good to me, approved; Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/extensions.conf
new file mode 100644
index 0000000..994204a
--- /dev/null
+++ b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => call_bob,1,NoOp()
+same => n,Dial(PJSIP/bob)
+same => n,Hangup()
diff --git a/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..867b055
--- /dev/null
+++ b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/configs/ast1/pjsip.conf
@@ -0,0 +1,21 @@
+[local-transport]
+type = transport
+bind = 127.0.0.1
+protocol = udp
+
+[alice]
+type = endpoint
+context = default
+allow = ulaw
+rtp_keepalive = 3
+
+[bob]
+type = endpoint
+context = default
+allow = ulaw
+aors = bob
+rtp_keepalive = 3
+
+[bob]
+type = aor
+contact = sip:bob at 127.0.0.1:5062
diff --git a/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/rtp.py b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/rtp.py
new file mode 100644
index 0000000..bd4eff3
--- /dev/null
+++ b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/rtp.py
@@ -0,0 +1,27 @@
+'''
+Copyright (C) 2015, Digium, Inc.
+Mark Michelson <mmichelson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+import logging
+
+from twisted.internet.protocol import DatagramProtocol
+from twisted.internet import reactor
+
+LOGGER = logging.getLogger(__name__)
+
+class RTP(DatagramProtocol):
+ def __init__(self, test_object):
+ self.test_object = test_object
+
+ def datagramReceived(self, data, (host, port)):
+ LOGGER.error("Received RTP from Asterisk unexpectedly")
+ self.test_object.set_passed(False)
+ self.test_object.stop_reactor()
+
+class KeepaliveCheck(object):
+ def __init__(self, module_config, test_object):
+ reactor.listenUDP(25552, RTP(test_object))
+ reactor.listenUDP(55225, RTP(test_object))
diff --git a/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/alice.xml b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/alice.xml
new file mode 100644
index 0000000..f0bef95
--- /dev/null
+++ b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/alice.xml
@@ -0,0 +1,118 @@
+<?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: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]>
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Contact: sip:alice@[local_ip]:[local_port]
+ 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 25552 RTP/AVP 0
+ a=rtpmap:8 PCMA/8000
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+
+ ]]>
+ </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: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 1 ACK
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="INVITE" />
+
+ <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:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ 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 25552 RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+ </send>
+
+ <recv request="ACK" />
+
+ <pause/>
+
+ <send retrans="500">
+ <![CDATA[
+
+ BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: alice <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Contact: sip:alice@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" crlf="true">
+ </recv>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/bob.xml b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/bob.xml
new file mode 100644
index 0000000..f99bbf3
--- /dev/null
+++ b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/sipp/bob.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+ <recv request="INVITE" crlf="true">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 180 Ringing
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <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:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ 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 55225 RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+ </send>
+
+ <recv request="ACK"
+ optional="true"
+ rtd="true"
+ crlf="true">
+ </recv>
+
+ <!-- Direct media reinvite -->
+ <recv request="INVITE" />
+
+ <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:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ 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 55225 RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+ </send>
+
+ <recv request="ACK" />
+
+ <!-- Reinvite back to Asterisk after Alice hangs up -->
+ <recv request="INVITE" />
+
+ <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:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ 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 55225 RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+ </send>
+
+ <recv request="ACK" />
+
+ <recv request="BYE">
+ </recv>
+
+ <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/rtp/rtp_keepalive/direct_media/test-config.yaml b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/test-config.yaml
new file mode 100644
index 0000000..f5496e8
--- /dev/null
+++ b/tests/channels/pjsip/rtp/rtp_keepalive/direct_media/test-config.yaml
@@ -0,0 +1,35 @@
+testinfo:
+ summary: 'Ensure that Asterisk does not send RTP keepalives during direct media'
+ description: |
+ 'A SIPp test scenario calls another SIPp scenario through Asterisk. The endpoints
+ are capable of direct media and so should end up in a remote native RTP bridge.
+ Because of this, Asterisk should not attempt to send RTP keepalive packets to the
+ endpoints. If any RTP keepalive packets are detected, then the test has failed.'
+
+test-modules:
+ add-test-to-search-path: True
+ test-object:
+ config-section: sipp-config
+ typename: 'sipp.SIPpTestCase'
+ modules:
+ -
+ typename: 'rtp.KeepaliveCheck'
+
+sipp-config:
+ fail-on-any: True
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'bob.xml', '-p': '5062'}}
+ - { 'key-args': {'scenario': 'alice.xml', '-s': 'call_bob', '-d': '10000', '-p': '5061'} }
+
+properties:
+ minversion: '13.6.0'
+ dependencies:
+ - sipp:
+ version: 'v3.0'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_session'
+ - asterisk: 'res_pjsip_sdp_rtp'
+ tags:
+ - pjsip
diff --git a/tests/channels/pjsip/rtp/rtp_keepalive/tests.yaml b/tests/channels/pjsip/rtp/rtp_keepalive/tests.yaml
index 978b809..c7cd0bd 100644
--- a/tests/channels/pjsip/rtp/rtp_keepalive/tests.yaml
+++ b/tests/channels/pjsip/rtp/rtp_keepalive/tests.yaml
@@ -1,3 +1,4 @@
# Enter tests here in the order they should be considered for execution:
tests:
- test: 'base'
+ - test: 'direct_media'
--
To view, visit https://gerrit.asterisk.org/900
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I23009970201cc07701f8208a652b682f64c11537
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list