[asterisk-commits] jrose: testsuite/asterisk/trunk r4169 - in /asterisk/trunk/tests/bridge/parkc...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 12 12:46:41 CDT 2013


Author: jrose
Date: Thu Sep 12 12:46:39 2013
New Revision: 4169

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4169
Log:
Testsuite: Update bridge/parkcall_blindxfer test for res_parking

(closes issue ASTERISK-22328)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2815/

Added:
    asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf   (with props)
Modified:
    asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py
    asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf
    asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml

Modified: asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py?view=diff&rev=4169&r1=4168&r2=4169
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py (original)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py Thu Sep 12 12:46:39 2013
@@ -12,20 +12,43 @@
 
 sys.path.append("lib/python")
 
+from version import AsteriskVersion
+
 LOGGER = logging.getLogger(__name__)
 
-def hangup_chan(ami, event):
-    if ami.id != 0:
+
+def handle_parkedcall(ami, event):
+    running_version = AsteriskVersion()
+
+    if running_version >= AsteriskVersion("12.0.0"):
+        parkee = event.get('parkeechannel')
+    else:
+        parkee = event.get('channel')
+
+    if parkee is None:
+        LOGGER.error("Receved ParkedCall event without a Parkee.\n")
         return False
 
-    if event.get('channel') == 'SIP/alice-00000004':
+    LOGGER.info("Hanging up channel: %s" % parkee)
+    ami.hangup(parkee)
+
+    return True
+
+
+def handle_testevent(ami, event):
+    parkee = event.get('channel')
+
+    if parkee is None:
+        LOGGER.error("Received TestEvent without a channel.\n")
+
+    if parkee == 'SIP/alice-00000004':
         # channel which parking failed for
         LOGGER.info("Hanging up channel: SIP/bob-00000005")
         ami.hangup('SIP/bob-00000005')
         # the call that was parked
         LOGGER.info("Hanging up channel: Local/fill-park at default-00000000;2")
         ami.hangup('Local/fill-park at default-00000000;2')
-    elif event.get('channel') == 'SIP/alice-00000008':
+    elif parkee == 'SIP/alice-00000008':
         # channel which parking failed for
         LOGGER.info("Hanging up channel: SIP/bob-00000009")
         ami.hangup('SIP/bob-00000009')
@@ -33,9 +56,8 @@
         LOGGER.info("Hanging up channel: Local/fill-park at default-00000001;2")
         ami.hangup('Local/fill-park at default-00000001;2')
     else:
-        LOGGER.info("Hanging up channel: %s" % event.get('channel'))
-        ami.hangup(event.get('channel'))
+        LOGGER.info("Hanging up channel: %s" % parkee)
+        ami.hangup(parkee)
 
     return True
-
 # vim:sw=4:ts=4:expandtab:textwidth=79

Modified: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf?view=diff&rev=4169&r1=4168&r2=4169
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf Thu Sep 12 12:46:39 2013
@@ -33,7 +33,7 @@
 
 exten => dynparkvars,1,NoOp(Setting dynamic parking channel variables)
 	same => n,Set(_PARKINGLOT=parkinglot_dynamic)
-	same => n,Set(_PARKINGDYNAMIC=parkinglot_dynamic)
+	same => n,Set(_PARKINGDYNAMIC=parkinglot_static)
 	same => n,Set(_PARKINGDYNCONTEXT=parkedcalls-dynamic)
 	same => n,Set(_PARKINGDYNEXTEN=900)
 	same => n,Set(_PARKINGDYNPOS=901-901)

Added: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf?view=auto&rev=4169
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf (added)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf Thu Sep 12 12:46:39 2013
@@ -1,0 +1,7 @@
+[general]
+parkeddynamic = yes
+
+[parkinglot_static]
+context => parkedcalls-static
+parkext => 800
+parkpos => 801-801

Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/res_parking.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml?view=diff&rev=4169&r1=4168&r2=4169
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml (original)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml Thu Sep 12 12:46:39 2013
@@ -16,7 +16,12 @@
         typename: 'BridgeTestCase.BridgeTestCase'
     modules:
         -
+            maxversion: '12.0.0'
             config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+        -
+            minversion: '12.0.0'
+            config-section: 'ami-config-12'
             typename: 'ami.AMIEventModule'
 
 bridge-config:
@@ -103,7 +108,7 @@
                 Parkinglot: 'default'
                 From: 'SIP/alice-00000000'
         callbackModule: 'Hangup'
-        callbackMethod: 'hangup_chan'
+        callbackMethod: 'handle_parkedcall'
         count: '1'
 
     # Ensure Alice successfully parked Bob to the empty static lot. Then
@@ -120,7 +125,7 @@
                 Parkinglot: 'parkinglot_static'
                 From: 'SIP/alice-00000002'
         callbackModule: 'Hangup'
-        callbackMethod: 'hangup_chan'
+        callbackMethod: 'handle_parkedcall'
         count: '1'
 
     # Ensure the Local channel is parked thus filling up all static lot slots.
@@ -153,7 +158,7 @@
                 Message: 'pbx-parkingfailed'
                 Channel: 'SIP/alice-0000000(4|8)'
         callbackModule: 'Hangup'
-        callbackMethod: 'hangup_chan'
+        callbackMethod: 'handle_testevent'
         count: '2'
 
     # Ensure Alice successfully parked Bob to the empty dynamically created
@@ -170,7 +175,7 @@
                 Parkinglot: 'parkinglot_dynamic'
                 From: 'SIP/alice-00000006'
         callbackModule: 'Hangup'
-        callbackMethod: 'hangup_chan'
+        callbackMethod: 'handle_parkedcall'
         count: '1'
 
     # Ensure the Local channel is parked thus filling up all dynamicall created
@@ -187,6 +192,120 @@
         requirements:
             match:
                 Channel: 'Local/fill-park at default-00000001;2'
+        count: '1'
+
+ami-config-12:
+    # Ensure all of Alice's channels are hung up.
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'Hangup'
+                Channel: 'SIP/alice-0000000(0|2|4|6|8)'
+        requirements:
+            match:
+                Cause: '16'
+        count: '5'
+
+    # Ensure Alice successfully parked Bob to the empty default lot. Then hang
+    # up Bob's channel.
+    -
+        type: 'callback'
+        id: '0'
+        start: 'fail'
+        conditions:
+            match:
+                Event: 'ParkedCall'
+                ParkeeChannel: 'SIP/bob-00000001'
+                ParkingSpace: '701'
+                Parkinglot: 'default'
+                ParkerDialString: 'SIP/alice'
+        callbackModule: 'Hangup'
+        callbackMethod: 'handle_parkedcall'
+        count: '1'
+
+    # Ensure Alice successfully parked Bob to the empty static lot. Then
+    # hangup Bob's channel.
+    -
+        type: 'callback'
+        id: '0'
+        start: 'fail'
+        conditions:
+            match:
+                Event: 'ParkedCall'
+                ParkeeChannel: 'SIP/bob-00000003'
+                ParkingSpace: '801'
+                Parkinglot: 'parkinglot_static'
+                ParkerDialString: 'SIP/alice'
+        callbackModule: 'Hangup'
+        callbackMethod: 'handle_parkedcall'
+        count: '1'
+
+    # Ensure the Local channel is parked thus filling up all static lot slots.
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'ParkedCall'
+                ParkingSpace: '801'
+                Parkinglot: 'parkinglot_static'
+                ParkerDialString: 'Local/fill-park at default'
+        requirements:
+            match:
+                ParkeeChannel: 'Local/fill-park at default-00000000;2'
+        count: '1'
+
+    # Ensure that the pbx-parkingfailed sound is played to alice-0000000(4|8)
+    # which indicates that the parking of the corresponding bob channels failed
+    # as we expect since the static lot is full.
+    -
+        type: 'callback'
+        id: '0'
+        start: 'fail'
+        conditions:
+            match:
+                Event: 'TestEvent'
+                Type: 'StateChange'
+                State: 'PLAYBACK'
+                Message: 'pbx-parkingfailed'
+                Channel: 'SIP/alice-0000000(4|8)'
+        callbackModule: 'Hangup'
+        callbackMethod: 'handle_testevent'
+        count: '2'
+
+    # Ensure Alice successfully parked Bob to the empty dynamically created
+    # lot. Then hangup Bob's channel.
+    -
+        type: 'callback'
+        id: '0'
+        start: 'fail'
+        conditions:
+            match:
+                Event: 'ParkedCall'
+                ParkeeChannel: 'SIP/bob-00000007'
+                ParkingSpace: '901'
+                Parkinglot: 'parkinglot_dynamic'
+                ParkerDialString: 'SIP/alice'
+        callbackModule: 'Hangup'
+        callbackMethod: 'handle_parkedcall'
+        count: '1'
+
+    # Ensure the Local channel is parked thus filling up all dynamicall created
+    # lot slots.
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'ParkedCall'
+                ParkingSpace: '901'
+                Parkinglot: 'parkinglot_dynamic'
+                ParkerDialString: 'Local/fill-park at default'
+        requirements:
+            match:
+                ParkeeChannel: 'Local/fill-park at default-00000001;2'
         count: '1'
 
 properties:




More information about the asterisk-commits mailing list