[asterisk-commits] Add test for PJSIP forward loops. (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 21 07:32:05 CDT 2015
Joshua Colp has submitted this change and it was merged.
Change subject: Add test for PJSIP forward loops.
......................................................................
Add test for PJSIP forward loops.
This test sets up a SIPp scenario that forwards incoming calls to
itself. The test ensures that the SIPp scenario is only dialed the
expected number of times before the outgoing call fails.
ASTERISK-24958
Change-Id: I5675c6d1642c53c7fcd8e0d5847b0c3d66798197
---
A tests/channels/pjsip/forward_loop/configs/ast1/extensions.conf
A tests/channels/pjsip/forward_loop/configs/ast1/pjsip.conf
A tests/channels/pjsip/forward_loop/sipp/redirect.xml
A tests/channels/pjsip/forward_loop/test-config.yaml
M tests/channels/pjsip/tests.yaml
5 files changed, 118 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/forward_loop/configs/ast1/extensions.conf b/tests/channels/pjsip/forward_loop/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5100f47
--- /dev/null
+++ b/tests/channels/pjsip/forward_loop/configs/ast1/extensions.conf
@@ -0,0 +1,10 @@
+[default]
+
+exten => loop,1,NoOp()
+same => n,Set(CHANNEL(max_forwards)=10)
+same => n,NoOp(max forwards is ${CHANNEL(max_forwards)})
+same => n,Goto(default,loop1,1)
+
+exten => loop1,1,NoOp()
+same => n,NoOp(max forwards is ${CHANNEL(max_forwards)})
+same => n,Dial(PJSIP/redirect)
diff --git a/tests/channels/pjsip/forward_loop/configs/ast1/pjsip.conf b/tests/channels/pjsip/forward_loop/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..e9bbfc7
--- /dev/null
+++ b/tests/channels/pjsip/forward_loop/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+[local-transport]
+type = transport
+protocol = udp
+bind = 127.0.0.1
+
+[redirect]
+type = endpoint
+allow = ulaw
+context = default
+aors = redirect
+
+[redirect]
+type = aor
+contact = sip:127.0.0.1:5061
diff --git a/tests/channels/pjsip/forward_loop/sipp/redirect.xml b/tests/channels/pjsip/forward_loop/sipp/redirect.xml
new file mode 100644
index 0000000..d42f603
--- /dev/null
+++ b/tests/channels/pjsip/forward_loop/sipp/redirect.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Call forwarder">
+ <recv request="INVITE" crlf="true">
+ </recv>
+
+ <send retrans="500">
+ <![CDATA[
+
+ SIP/2.0 302 Moved Temporarily
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:loop1@[local_ip]:[local_port];transport=[transport]>
+ Content-Type: application/sdp
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv request="ACK"
+ optional="true"
+ rtd="true"
+ crlf="true">
+ </recv>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/forward_loop/test-config.yaml b/tests/channels/pjsip/forward_loop/test-config.yaml
new file mode 100644
index 0000000..ac23409
--- /dev/null
+++ b/tests/channels/pjsip/forward_loop/test-config.yaml
@@ -0,0 +1,62 @@
+testinfo:
+ summary: 'Ensure that infinite loops of SIP forwards cannot happen.'
+ description: |
+ 'This test originates a call to an extension that sets the max forwards
+ for the call to 10. The extension then dials a PJSIP channel that calls
+ a SIPp scenario that will send a 302 response indicating to redirect the
+ call to itself. The test ensures that after 10 Dials, all of the calls
+ are hung up.'
+
+test-modules:
+ test-object:
+ typename: sipp.SIPpTestCase
+ config-section: sipp-config
+ modules:
+ -
+ config-section: originator-config
+ typename: 'pluggable_modules.Originator'
+ -
+ config-section: ami-config
+ typename: 'ami.AMIEventModule'
+ -
+ config-section: hangup-config
+ typename: 'pluggable_modules.HangupMonitor'
+
+sipp-config:
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': {'scenario': 'redirect.xml', '-m': '11'} }
+
+originator-config:
+ channel: 'Local/loop at default'
+ application: 'Echo'
+ ignore-originate-failure: 'yes'
+ trigger: 'ami_connect'
+
+ami-config:
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'DialBegin'
+ DestChannel: 'PJSIP/redirect-.*'
+ count: 10
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'DialEnd'
+ DestChannel: 'PJSIP/redirect-.*'
+ count: 10
+
+hangup-config:
+ ids: ['0']
+
+properties:
+ minversion: '13.4.0'
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ tags:
+ - pjsip
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 86f9910..d806233 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -37,3 +37,4 @@
- test: 'rpid_immediate'
- test: 'in_dialog_options'
- dir: 'resolver'
+ - test: 'forward_loop'
--
To view, visit https://gerrit.asterisk.org/119
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5675c6d1642c53c7fcd8e0d5847b0c3d66798197
Gerrit-PatchSet: 6
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: Jared K. Smith <jaredsmith at jaredsmith.net>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list