[asterisk-commits] app queue: Test blind and attended transfers with queues (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 22 14:30:46 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: app_queue: Test blind and attended transfers with queues
......................................................................


app_queue: Test blind and attended transfers with queues

Verifies a caller initiated transfer using queues works as expected and that
the app_queue's attended/blind transfer stasis callback handler is executed
appropriately.

ASTERISK-25185 #close
Reported by: Etienne Lessard

Change-Id: I359ce622f4be04c1af7e10a41a39425b6674ea03
---
M tests/apps/queues/queue_baseline/test-config.yaml
M tests/apps/queues/tests.yaml
A tests/apps/queues/transfer/caller_attended/configs/ast1/extensions.conf
A tests/apps/queues/transfer/caller_attended/configs/ast1/pjsip.conf
A tests/apps/queues/transfer/caller_attended/configs/ast1/queues.conf
A tests/apps/queues/transfer/caller_attended/test-config.yaml
A tests/apps/queues/transfer/caller_blind/configs/ast1/extensions.conf
A tests/apps/queues/transfer/caller_blind/configs/ast1/pjsip.conf
A tests/apps/queues/transfer/caller_blind/configs/ast1/queues.conf
A tests/apps/queues/transfer/caller_blind/test-config.yaml
A tests/apps/queues/transfer/tests.yaml
11 files changed, 400 insertions(+), 1 deletion(-)

Approvals:
  Scott Griepentrog: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/tests/apps/queues/queue_baseline/test-config.yaml b/tests/apps/queues/queue_baseline/test-config.yaml
index e67f2f1..dbf51e0 100644
--- a/tests/apps/queues/queue_baseline/test-config.yaml
+++ b/tests/apps/queues/queue_baseline/test-config.yaml
@@ -10,4 +10,4 @@
     dependencies:
         - asterisk: 'app_queue'
     tags:
-        - queues
\ No newline at end of file
+        - queues
diff --git a/tests/apps/queues/tests.yaml b/tests/apps/queues/tests.yaml
index d46a058..b645417 100644
--- a/tests/apps/queues/tests.yaml
+++ b/tests/apps/queues/tests.yaml
@@ -1,5 +1,6 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
+    - dir: 'transfer'
     - test: 'queue_baseline'
     - test: 'queue_transfer_callee'
     - test: 'position_priority_maxlen'
diff --git a/tests/apps/queues/transfer/caller_attended/configs/ast1/extensions.conf b/tests/apps/queues/transfer/caller_attended/configs/ast1/extensions.conf
new file mode 100644
index 0000000..f49c76b
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_attended/configs/ast1/extensions.conf
@@ -0,0 +1,7 @@
+[default]
+
+exten => 101,1,Queue(queue,Rtc)
+      same => n,Hangup()
+
+exten => 102,1,Dial(PJSIP/charlie)
+      same => n,Hangup()
diff --git a/tests/apps/queues/transfer/caller_attended/configs/ast1/pjsip.conf b/tests/apps/queues/transfer/caller_attended/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..c63f17e
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_attended/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[global]
+type=global
+debug=yes
+
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint_t](!)
+type=endpoint
+context=default
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_t](!)
+type=aor
+max_contacts=1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[alice](aor_t)
+[alice](endpoint_t)
+aors=alice
+
+[bob](aor_t)
+[bob](endpoint_t)
+aors=bob
+
+[charlie](aor_t)
+[charlie](endpoint_t)
+aors=charlie
diff --git a/tests/apps/queues/transfer/caller_attended/configs/ast1/queues.conf b/tests/apps/queues/transfer/caller_attended/configs/ast1/queues.conf
new file mode 100644
index 0000000..a07fe64
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_attended/configs/ast1/queues.conf
@@ -0,0 +1,5 @@
+[general]
+
+[queue]
+eventwhencalled = yes
+member => PJSIP/bob
diff --git a/tests/apps/queues/transfer/caller_attended/test-config.yaml b/tests/apps/queues/transfer/caller_attended/test-config.yaml
new file mode 100644
index 0000000..2c1743f
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_attended/test-config.yaml
@@ -0,0 +1,160 @@
+testinfo:
+    summary: "Caller initiated attended queue transfer"
+    description: |
+        "This verifies a caller initiated attended transfer using queues works
+         as expected and that the app_queue's attended transfer stasis callback
+         handler is executed appropriately.
+
+         Alice dials into a queue and connects with member bob. Once alice and
+         bob are bridged, alice puts bob on hold, and then dials charlie. After
+         alice and charlie are bridged alice transfers bob to charlie using an
+         attended transfer."
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: pjsua-config
+            typename: 'phones.PjsuaPhoneController'
+        -
+            config-section: pluggable-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    connect-ami: True
+
+pjsua-config:
+    transports:
+        -
+            name: 'local-ipv4-1'
+            bind: '127.0.0.1'
+            bindport: '5061'
+        -
+            name: 'local-ipv4-2'
+            bind: '127.0.0.1'
+            bindport: '5062'
+        -
+            name: 'local-ipv4-3'
+            bind: '127.0.0.1'
+            bindport: '5063'
+    accounts:
+        -
+            name: 'alice'
+            username: 'alice'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-1'
+        -
+            name: 'bob'
+            username: 'bob'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-2'
+        -
+            name: 'charlie'
+            username: 'charlie'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-3'
+
+pluggable-config:
+    # Ensure our pjsua phones are ready. Then alice calls the queue.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'PJsuaPhonesReady'
+            count: 1
+        pjsua_phone:
+            action: 'call'
+            pjsua_account: 'alice'
+            call_uri: 'sip:101 at 127.0.0.1'
+    # Ensure alice and bob are connected. Then alice places bob on hold.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'AgentConnect'
+                    Channel: 'PJSIP/alice-.*'
+                    MemberName: 'PJSIP/bob'
+            count: '1'
+        pjsua_phone:
+            action: 'hold'
+            pjsua_account: 'alice'
+    # Once bob has been put on hold, call charlie.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'MusicOnHoldStart'
+                    Channel: 'PJSIP/bob-.*'
+            count: 1
+        pjsua_phone:
+            action: 'call'
+            pjsua_account: 'alice'
+            call_uri: 'sip:102 at 127.0.0.1'
+    # Ensure alice and charlie are bridged. Then alice transfers bob
+    # to charlie via an attended transfer.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'VarSet'
+                    Variable: BRIDGEPEER
+                    Channel: 'PJSIP/alice-.*'
+                    Value: 'PJSIP/charlie-.*'
+            count: '3'
+            trigger-on-count: True
+        pjsua_phone:
+            action: 'transfer'
+            pjsua_account: 'alice'
+            transfer_type: 'attended'
+    # Ensure the transfer is successful.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'AttendedTransfer'
+                    OrigTransfererChannel: 'PJSIP/alice-.*'
+                    SecondTransfererChannel: 'PJSIP/alice-.*'
+                    TransfereeChannel: 'PJSIP/bob-.*'
+                    TransferTargetChannel: 'PJSIP/charlie-.*'
+                    Result: 'Success'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'AgentComplete'
+                    Channel: 'PJSIP/alice-.*'
+                    MemberName: 'PJSIP/bob'
+                    Reason: 'transfer'
+            count: 1
+    # Ensure each alice channel leaves the bridge it was in.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'BridgeLeave'
+                    Channel: 'PJSIP/alice-.*'
+            count: 2
+    # Ensure alice hangs up with bob and charlie, then stop
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'Hangup'
+                    Channel: 'PJSIP/alice-.*'
+            count: 2
+        stop_test:
+
+properties:
+    minversion: '13.6.0'
+    dependencies:
+        - python : twisted
+        - python : starpy
+        - python : pjsua
+        - asterisk : res_pjsip
+    tags:
+        - pjsip
+
diff --git a/tests/apps/queues/transfer/caller_blind/configs/ast1/extensions.conf b/tests/apps/queues/transfer/caller_blind/configs/ast1/extensions.conf
new file mode 100644
index 0000000..f49c76b
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_blind/configs/ast1/extensions.conf
@@ -0,0 +1,7 @@
+[default]
+
+exten => 101,1,Queue(queue,Rtc)
+      same => n,Hangup()
+
+exten => 102,1,Dial(PJSIP/charlie)
+      same => n,Hangup()
diff --git a/tests/apps/queues/transfer/caller_blind/configs/ast1/pjsip.conf b/tests/apps/queues/transfer/caller_blind/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..c63f17e
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_blind/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[global]
+type=global
+debug=yes
+
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint_t](!)
+type=endpoint
+context=default
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_t](!)
+type=aor
+max_contacts=1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[alice](aor_t)
+[alice](endpoint_t)
+aors=alice
+
+[bob](aor_t)
+[bob](endpoint_t)
+aors=bob
+
+[charlie](aor_t)
+[charlie](endpoint_t)
+aors=charlie
diff --git a/tests/apps/queues/transfer/caller_blind/configs/ast1/queues.conf b/tests/apps/queues/transfer/caller_blind/configs/ast1/queues.conf
new file mode 100644
index 0000000..a07fe64
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_blind/configs/ast1/queues.conf
@@ -0,0 +1,5 @@
+[general]
+
+[queue]
+eventwhencalled = yes
+member => PJSIP/bob
diff --git a/tests/apps/queues/transfer/caller_blind/test-config.yaml b/tests/apps/queues/transfer/caller_blind/test-config.yaml
new file mode 100644
index 0000000..6ac2102
--- /dev/null
+++ b/tests/apps/queues/transfer/caller_blind/test-config.yaml
@@ -0,0 +1,144 @@
+testinfo:
+    summary: "Caller initiated blind queue transfer"
+    description: |
+        "This verifies a caller initiated blind transfer using queues works
+         as expected and that the app_queue's blind transfer stasis callback
+         handler is executed appropriately.
+
+         Alice dials into a queue and connects with member bob. Once alice and
+         bob are bridged, alice puts bob on hold, and then dials charlie. After
+         alice and charlie are bridged alice transfers bob to charlie using an
+         attended transfer."
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: pjsua-config
+            typename: 'phones.PjsuaPhoneController'
+        -
+            config-section: pluggable-config
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    connect-ami: True
+
+pjsua-config:
+    transports:
+        -
+            name: 'local-ipv4-1'
+            bind: '127.0.0.1'
+            bindport: '5061'
+        -
+            name: 'local-ipv4-2'
+            bind: '127.0.0.1'
+            bindport: '5062'
+        -
+            name: 'local-ipv4-3'
+            bind: '127.0.0.1'
+            bindport: '5063'
+    accounts:
+        -
+            name: 'alice'
+            username: 'alice'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-1'
+        -
+            name: 'bob'
+            username: 'bob'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-2'
+        -
+            name: 'charlie'
+            username: 'charlie'
+            domain: '127.0.0.1'
+            transport: 'local-ipv4-3'
+
+pluggable-config:
+    # Ensure our pjsua phones are ready. Then alice calls the queue.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'PJsuaPhonesReady'
+            count: 1
+        pjsua_phone:
+            action: 'call'
+            pjsua_account: 'alice'
+            call_uri: 'sip:101 at 127.0.0.1'
+    # Ensure alice and bob are connected. Then alice places bob on hold.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'AgentConnect'
+                    Channel: 'PJSIP/alice-.*'
+                    MemberName: 'PJSIP/bob'
+            count: '1'
+        pjsua_phone:
+            action: 'hold'
+            pjsua_account: 'alice'
+    # Once bob has been put on hold, blind transfer to charlie.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'MusicOnHoldStart'
+                    Channel: 'PJSIP/bob-.*'
+            count: 1
+        pjsua_phone:
+            action: 'transfer'
+            pjsua_account: 'alice'
+            transfer_type: 'blind'
+            transfer_uri: 'sip:102 at 127.0.0.1'
+    # Ensure the transfer is successful.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'BlindTransfer'
+                    TransfererChannel: 'PJSIP/alice-.*'
+                    TransfereeChannel: 'PJSIP/bob-.*'
+                    Extension: '102'
+                    Result: 'Success'
+            count: 1
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'AgentComplete'
+                    Channel: 'PJSIP/alice-.*'
+                    MemberName: 'PJSIP/bob'
+                    Reason: 'transfer'
+            count: 1
+    # Ensure alice channel leaves the bridge it was in.
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'BridgeLeave'
+                    Channel: 'PJSIP/alice-.*'
+            count: 1
+    # Ensure alice hangs up with bob, then stop
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'Hangup'
+                    Channel: 'PJSIP/alice-.*'
+            count: 1
+        stop_test:
+
+properties:
+    minversion: '13.6.0'
+    dependencies:
+        - python : twisted
+        - python : starpy
+        - python : pjsua
+        - asterisk : res_pjsip
+    tags:
+        - pjsip
+
diff --git a/tests/apps/queues/transfer/tests.yaml b/tests/apps/queues/transfer/tests.yaml
new file mode 100644
index 0000000..2b39437
--- /dev/null
+++ b/tests/apps/queues/transfer/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'caller_attended'
+    - test: 'caller_blind'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I359ce622f4be04c1af7e10a41a39425b6674ea03
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-commits mailing list