[Asterisk-code-review] Change in testsuite[master]: non_stasis_bridge_to_stasis_bridge: hangup race

Kevin Harwell (Code Review) asteriskteam at digium.com
Wed Apr 15 15:51:13 CDT 2015


Kevin Harwell has uploaded a new change for review.

  https://gerrit.asterisk.org/125

Change subject: non_stasis_bridge_to_stasis_bridge: hangup race
......................................................................

non_stasis_bridge_to_stasis_bridge: hangup race

During the transfer process there is a chance for a hang up to occur on the
channel being transfered (in this case bob) but before the transfer has time
to fully complete. If this happens not all expected events are raised, thus
not received. Addressed the possibility of this scenario occurring by adjusting
the expected events in question to accept at most one of the event, consequently
allowing zero as well.

Change-Id: Ic4ef9fff4830670137dbfb587f30eaf33a43a2d6
---
M tests/rest_api/external_interaction/attended_transfer/non_stasis_bridge_to_stasis_bridge/test-config.yaml
1 file changed, 34 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/25/125/1

diff --git a/tests/rest_api/external_interaction/attended_transfer/non_stasis_bridge_to_stasis_bridge/test-config.yaml b/tests/rest_api/external_interaction/attended_transfer/non_stasis_bridge_to_stasis_bridge/test-config.yaml
index 2ec68b6..ca41df0 100644
--- a/tests/rest_api/external_interaction/attended_transfer/non_stasis_bridge_to_stasis_bridge/test-config.yaml
+++ b/tests/rest_api/external_interaction/attended_transfer/non_stasis_bridge_to_stasis_bridge/test-config.yaml
@@ -1,7 +1,12 @@
 testinfo:
     summary: "Transfer (attended) non-Stasis bridge to Stasis bridge"
     description: |
-        "Upon the kick off local channel entering into the Stasis(testsuite)
+        "This test verifies that a non-Stasis bridge can be transferred
+         (attended) to a Stasis bridge. It also verifies that the StasisStart &
+         StasisEnd events occur for the alice(second), carol, and local
+         replacement channels.
+
+         Upon the kick off local channel entering into the Stasis(testsuite)
          app, a call is made from the 'alice' PJSUA account that executes the
          Dial() app and calls the 'bob' PJSUA account. Once alice and bob are
          in a non-Stasis bridge, alice begins an attended transfer by making
@@ -12,22 +17,23 @@
          Stasis(testsuite) app and added to the Stasis bridge 'test_bridge'
          with the second alice channel.
 
-         Alice then completes the attended transfer essentially transferring
-         the non-Stasis bridge to the Stasis bridge. Asterisk does this by
-         creating a Local channel where each half is swapped in place of the
-         two alice channels. After the transfer is successful with a local
-         replacement channel half in the non-Stasis bridge with bob and another
-         in the Stasis bridge with carol, bob is hung up. This then initiates
-         the hang up of the local replacement channel half that was in the
-         non-Stasis bridge with bob and the hang up of the local replacement
-         channel half that was in the Stasis bridge with carol. Carol is then
-         hung up which initiates the hung up of the kick off local channel and
-         the destruction of the stasis bridge.
+         In the nominal scenario, alice then completes the attended transfer
+         essentially transferring the non-Stasis bridge to the Stasis bridge.
+         Asterisk does this by creating a Local channel where each half is
+         swapped in place of the two alice channels. After the transfer is
+         successful with a local replacement channel half in the non-Stasis
+         bridge with bob and another in the Stasis bridge with carol, bob is
+         hung up. This then initiates the hang up of the local replacement
+         channel half that was in the non-Stasis bridge with bob and the hang
+         up of the local replacement channel half that was in the Stasis bridge
+         with carol. Carol is also hung up which initiates the hung up of the
+         kick off local channel and the destruction of the stasis bridge.
 
-         This test verifies that a non-Stasis bridge can be transferred
-         (attended) to a Stasis bridge. It also verifies that the StasisStart &
-         StasisEnd events occur for the alice(second), carol, and local
-         replacement channels."
+         However, it is possible, and valid, for alice to send a 'bye' to bob
+         immediately after the refer has been received. If this occurs bob is
+         hung up and the transfer process stops. The expected transfer events
+         are thus not raised and received. This test accounts for this
+         possibility."
     issues:
         - jira: 'ASTERISK-24782'
 
@@ -218,7 +224,7 @@
                 destination_link_second_leg:
                     name: 'Local/_attended at transfer-.*;2'
                 result: 'Success'
-            count: 1
+            count: <1
     # Ensure alice's first channel leaves the non-Stasis bridge.
     -
         ami-events:
@@ -250,7 +256,7 @@
                     name: 'Local/_attended at transfer-.*;2'
                 replace_channel:
                     name: 'PJSIP/alice-.*'
-            count: 1
+            count: <1
     # Ensure alice's second channel leaves the Stasis bridge.
     -
         ari-events:
@@ -272,7 +278,7 @@
                     id: 'test_bridge'
                 channel:
                     name: 'Local/_attended at transfer-.*;2'
-            count: 1
+            count: <1
     # Ensure alice's second channel exits the Stasis app. Then hang up bob.
     -
         ari-events:
@@ -287,7 +293,7 @@
                action: 'Hangup'
                channel: '/^PJSIP/bob-.*$/'
     # Upon hanging up bob, ensure bob leaves the non-Stasis bridge and is hung
-    # up.
+    # up. If bob is hungup, hang up carol as well.
     -
         ami-events:
             conditions:
@@ -304,6 +310,9 @@
                     Event: 'Hangup'
                     Channel: 'PJSIP/bob-.*'
             count: 1
+        ari-requests:
+            method: 'delete'
+            uri: 'channels/carol'
     # Ensure the local channel half that was bridged with bob in the non-Stasis
     # bridge leaves the bridge and is hung up.
     -
@@ -314,14 +323,14 @@
                     Channel: 'Local/_attended at transfer-.*;1'
                 nomatch:
                     BridgeUniqueid: 'test_bridge'
-            count: 1
+            count: <1
     -
         ami-events:
             conditions:
                 match:
                     Event: 'Hangup'
                     Channel: 'Local/_attended at transfer-.*;1'
-            count: 1
+            count: <1
     # Ensure the local channel half in Stasis bridge with carol leaves the
     # bridge.
     -
@@ -333,9 +342,9 @@
                     id: 'test_bridge'
                 channel:
                     name: 'Local/_attended at transfer-.*;2'
-            count: 1
+            count: <1
     # Ensure the local channel half in Stasis bridge with carol exits the
-    # Stasis app. Then hang up carol.
+    # Stasis app.
     -
         ari-events:
             match:
@@ -343,10 +352,7 @@
                 application: 'testsuite'
                 channel:
                     name: 'Local/_attended at transfer-.*;2'
-            count: 1
-        ari-requests:
-            method: 'delete'
-            uri: 'channels/carol'
+            count: <1
     # Ensure carol leaves the Stasis bridge.
     -
         ari-events:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4ef9fff4830670137dbfb587f30eaf33a43a2d6
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list