[asterisk-commits] tests: Add a test for forwarding a Queue member (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 12 09:25:41 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: tests: Add a test for forwarding a Queue member
......................................................................


tests: Add a test for forwarding a Queue member

This patch adds a test that covers call forwards from a Queue member. It
verifies that a Queue member can forward a call to another location in
the dialplan. It also covers an invalid forward, where the forwarding
refers Queue to an invalid location in the dialplan.

ASTERISK-25797

Change-Id: Ia7e23a3756fc9ff8b474851f5e169af55d68381d
---
A tests/apps/queues/queue_member_forward/configs/ast1/extensions.conf
A tests/apps/queues/queue_member_forward/configs/ast1/pjsip.conf
A tests/apps/queues/queue_member_forward/configs/ast1/queues.conf
A tests/apps/queues/queue_member_forward/sipp/redirect-invalid.xml
A tests/apps/queues/queue_member_forward/sipp/redirect.xml
A tests/apps/queues/queue_member_forward/test-config.yaml
M tests/apps/queues/tests.yaml
7 files changed, 241 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/tests/apps/queues/queue_member_forward/configs/ast1/extensions.conf b/tests/apps/queues/queue_member_forward/configs/ast1/extensions.conf
new file mode 100644
index 0000000..2ea950e
--- /dev/null
+++ b/tests/apps/queues/queue_member_forward/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[globals]
+
+[default]
+
+exten => caller,1,NoOp()
+	same => n,Queue(test_queue,,,,3)
+
+exten => other_place,1,NoOp()
+	same => n,Answer()
+	same => n,Wait(1)
+	same => n,Hangup()
+
+
diff --git a/tests/apps/queues/queue_member_forward/configs/ast1/pjsip.conf b/tests/apps/queues/queue_member_forward/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..1a3c292
--- /dev/null
+++ b/tests/apps/queues/queue_member_forward/configs/ast1/pjsip.conf
@@ -0,0 +1,24 @@
+[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
+
+[redirect-invalid]
+type = endpoint
+allow = ulaw
+context = default
+aors = redirect-invalid
+
+[redirect-invalid]
+type = aor
+contact = sip:127.0.0.1:5062
\ No newline at end of file
diff --git a/tests/apps/queues/queue_member_forward/configs/ast1/queues.conf b/tests/apps/queues/queue_member_forward/configs/ast1/queues.conf
new file mode 100644
index 0000000..b35f9a2
--- /dev/null
+++ b/tests/apps/queues/queue_member_forward/configs/ast1/queues.conf
@@ -0,0 +1,9 @@
+[general]
+
+[test_queue]
+strategy = ringall
+timeout = 2
+retry = 1
+timeoutpriority = app|conf
+member => PJSIP/redirect
+member => PJSIP/redirect-invalid
diff --git a/tests/apps/queues/queue_member_forward/sipp/redirect-invalid.xml b/tests/apps/queues/queue_member_forward/sipp/redirect-invalid.xml
new file mode 100644
index 0000000..69b558b
--- /dev/null
+++ b/tests/apps/queues/queue_member_forward/sipp/redirect-invalid.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:I_DONT_EXIST_OMG@[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/apps/queues/queue_member_forward/sipp/redirect.xml b/tests/apps/queues/queue_member_forward/sipp/redirect.xml
new file mode 100644
index 0000000..0841484
--- /dev/null
+++ b/tests/apps/queues/queue_member_forward/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:other_place@[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/apps/queues/queue_member_forward/test-config.yaml b/tests/apps/queues/queue_member_forward/test-config.yaml
new file mode 100644
index 0000000..48b54b5
--- /dev/null
+++ b/tests/apps/queues/queue_member_forward/test-config.yaml
@@ -0,0 +1,132 @@
+testinfo:
+    summary: 'Verify that call forwarding from a Queue member works.'
+    description: |
+        'This test verifies that call forwarding from a Queue member
+        is honored correctly by app_queue itself. This includes both
+        a valid forwarding destination, along with an invalid one.
+        The test verifies that all of the expected DialBegin/DialEnd
+        events are received.'
+
+
+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'
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                DestChannel: 'Local/caller at default-00000000;1'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                Channel: 'Local/caller at default-.*'
+                DestChannel: 'PJSIP/redirect-invalid-.*'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                Channel: 'Local/caller at default-.*'
+                DestChannel: 'PJSIP/redirect-0.*'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                Channel: 'Local/caller at default-.*'
+                DestChannel: 'Local/I_DONT_EXIST_OMG at default-.*'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialBegin'
+                Channel: 'Local/caller at default-.*'
+                DestChannel: 'Local/other_place at default-.*'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                Channel: 'Local/caller at default-.*'
+                DestChannel: 'PJSIP/redirect-invalid-.*'
+                Forward: 'I_DONT_EXIST_OMG'
+                DialStatus: 'CANCEL'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                Channel: 'Local/caller at default-.*'
+                DestChannel: 'PJSIP/redirect-0.*'
+                Forward: 'other_place'
+                DialStatus: 'CANCEL'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                Channel: 'Local/caller at default-.*'
+                DestChannel: 'Local/other_place at default-.*'
+                DialStatus: 'ANSWER'
+        count: 1
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                DestChannel: 'Local/caller at default-00000000;1'
+                DialStatus: 'ANSWER'
+        count: 1
+
+
+sipp-config:
+    stop-after-scenarios: false
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'redirect.xml' } }
+                - { 'key-args': {'scenario': 'redirect-invalid.xml', '-p': '5062'} }
+
+originator-config:
+    channel: 'Local/caller at default'
+    application: 'Echo'
+    ignore-originate-failure: 'yes'
+    trigger: 'ami_connect'
+
+hangup-config:
+    ids: ['0']
+
+properties:
+    minversion: '13.11.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_queue'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'app_echo'
+    tags:
+        - pjsip
+        - queues
diff --git a/tests/apps/queues/tests.yaml b/tests/apps/queues/tests.yaml
index 5de2a02..f618ee2 100644
--- a/tests/apps/queues/tests.yaml
+++ b/tests/apps/queues/tests.yaml
@@ -14,3 +14,4 @@
     - test: 'ringinuse_and_pause'
     - test: 'wrapup_time'
     - test: 'reason_pause_ami'
+    - test: 'queue_member_forward'

-- 
To view, visit https://gerrit.asterisk.org/3465
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7e23a3756fc9ff8b474851f5e169af55d68381d
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list