[asterisk-commits] jbigelow: testsuite/asterisk/trunk r3766 - in /asterisk/trunk/tests/bridge: ....
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 7 15:10:06 CDT 2013
Author: jbigelow
Date: Tue May 7 15:10:03 2013
New Revision: 3766
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3766
Log:
Add bridging test that uses the blind transfer feature to park a channel.
This test uses BridgeTestCase to setup a bridge between two endpoints and
utilizes the DTMF blind transfer feature to ensure the feature is detected. It
also ensures that the transfered channels to the default, a static, and a
dynamic parking lot are successful when the lots are not full. Lastly it fills
a static and dynamic parking lot to ensure that further parking attempts fail.
The AMI callback type is used to hang up the channels that were successfully
and unsuccessfully parked.
Review: https://reviewboard.asterisk.org/r/2458/
Added:
asterisk/trunk/tests/bridge/parkcall_blindxfer/
asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py (with props)
asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/
asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/
asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf (with props)
asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/bridge/tests.yaml
Added: asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py?view=auto&rev=3766
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py (added)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py Tue May 7 15:10:03 2013
@@ -1,0 +1,41 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2013, Digium, Inc.
+John Bigelow <jbigelow at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import logging
+
+sys.path.append("lib/python")
+
+LOGGER = logging.getLogger(__name__)
+
+def hangup_chan(ami, event):
+ if ami.id != 0:
+ return False
+
+ if event.get('channel') == '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':
+ # channel which parking failed for
+ LOGGER.info("Hanging up channel: SIP/bob-00000009")
+ ami.hangup('SIP/bob-00000009')
+ # the call that was parked
+ 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'))
+
+ return True
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/Hangup.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=auto&rev=3766
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf Tue May 7 15:10:03 2013
@@ -1,0 +1,50 @@
+[default]
+include => parkedcalls
+include => parkedcalls-static
+
+; Dial bob
+exten => bob,1,NoOp()
+ same => n,Dial(SIP/test_call at bob,,T)
+ same => n,Hangup()
+
+exten => bob-static,1,NoOp()
+ same => n,Set(PARKINGLOT=parkinglot_static)
+ same => n,NoOp(CHANNEL TYPE: ${CHANNEL(channeltype)})
+ same => n,ExecIf($["${CHANNEL(channeltype)}" = "SIP"]?Goto(bob,1):Goto(echo,1))
+
+; Create a Local channel and park it to fill up the parking slot
+; for the static lot before calling Bob.
+exten => bob-static-full,1,NoOp()
+ same => n,Set(_PARKINGLOT=parkinglot_static)
+ same => n,Dial(local/fill-park at default,,G(default^bob-static^1))
+ same => n,Hangup()
+
+exten => bob-dynamic,1,NoOp()
+ same => n,Gosub(dynparkvars,1)
+ same => n,NoOp(CHANNEL TYPE: ${CHANNEL(channeltype)})
+ same => n,ExecIf($["${CHANNEL(channeltype)}" = "SIP"]?Goto(bob,1):Goto(echo,1))
+
+; Create a Local channel and park it to fill up the parking slot
+; for the dynamically created lot before calling Bob.
+exten => bob-dynamic-full,1,NoOp()
+ same => n,Gosub(dynparkvars,1)
+ same => n,Dial(local/fill-park at default,,G(default^bob-dynamic^1))
+ same => n,Hangup()
+
+exten => dynparkvars,1,NoOp(Setting dynamic parking channel variables)
+ same => n,Set(_PARKINGLOT=parkinglot_dynamic)
+ same => n,Set(_PARKINGDYNAMIC=parkinglot_dynamic)
+ same => n,Set(_PARKINGDYNCONTEXT=parkedcalls-dynamic)
+ same => n,Set(_PARKINGDYNEXTEN=900)
+ same => n,Set(_PARKINGDYNPOS=901-901)
+ same => n,Return()
+
+; Used to park local channels to fill up the parking slots
+exten => fill-park,1,NoOp(filling parking lot '${PARKINGLOT}' with a local channel)
+ same => n,Park()
+
+exten => echo,1,Echo()
+
+exten => 900,1,Park()
+ same => n,Hangup()
+
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf?view=auto&rev=3766
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf (added)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf Tue May 7 15:10:03 2013
@@ -1,0 +1,15 @@
+[general]
+parkeddynamic = yes
+
+[parkinglot_static]
+context => parkedcalls-static
+parkext => 800
+parkpos => 801-801
+
+[featuremap]
+blindxfer => 1
+atxfer => 2
+disconnect => 3
+automon => 4
+automixmon => 5
+parkcall => 6
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/configs/ast1/features.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=auto&rev=3766
==============================================================================
--- asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml (added)
+++ asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml Tue May 7 15:10:03 2013
@@ -1,0 +1,199 @@
+testinfo:
+ summary: 'Test the blind transfer feature on a bridge to park channels'
+ description: |
+ 'Set up a bridge between two endpoints and check that the DTMF blind
+ transfer feature is detected properly. This test checks that the
+ feature is detected with normal BridgeTestCase feature detection.
+ Additionally this test will park a channel in the default, a static,
+ and a dynamically created parking lot to ensure successfull parking. It
+ also ensures that when the static and dynamically created parking lots
+ are full, further parking attempts fail.'
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: bridge-config
+ typename: 'BridgeTestCase.BridgeTestCase'
+ modules:
+ -
+ config-section: 'ami-config'
+ typename: 'ami.AMIEventModule'
+
+bridge-config:
+ test-runs:
+ # Alice blind xfers Bob to the empty default lot.
+ -
+ originate_channel: 'SIP/bob at uut'
+ features:
+ -
+ who: 'alice'
+ what: 'blindxfer'
+ exten: '700'
+ success: 'true'
+
+ # Alice blind xfers Bob to an empty static custom lot.
+ -
+ originate_channel: 'SIP/bob-static at uut'
+ features:
+ -
+ who: 'alice'
+ what: 'blindxfer'
+ exten: '800'
+ success: 'true'
+
+ # Alice blind xfers Bob to a full static custom lot. The dialplan will
+ # create a local channel and park it to prevent bob's channel from being
+ # parked.
+ -
+ originate_channel: 'SIP/bob-static-full at uut'
+ features:
+ -
+ who: 'alice'
+ what: 'blindxfer'
+ exten: '800'
+ success: 'true'
+
+ # Alice blind xfers Bob to an empty dynamically created lot.
+ -
+ originate_channel: 'SIP/bob-dynamic at uut'
+ features:
+ -
+ who: 'alice'
+ what: 'blindxfer'
+ exten: '900'
+ success: 'true'
+
+ # Alice blind xfers Bob to a full dynamically created lot. The dialplan
+ # will create a local channel and park it to prevent bob's channel from
+ # being parked.
+ -
+ originate_channel: 'SIP/bob-dynamic-full at uut'
+ features:
+ -
+ who: 'alice'
+ what: 'blindxfer'
+ exten: '900'
+ success: 'true'
+
+ami-config:
+ # 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'
+ Channel: 'SIP/bob-00000001'
+ Exten: '701'
+ Parkinglot: 'default'
+ From: 'SIP/alice-00000000'
+ callbackModule: 'Hangup'
+ callbackMethod: 'hangup_chan'
+ 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'
+ Channel: 'SIP/bob-00000003'
+ Exten: '801'
+ Parkinglot: 'parkinglot_static'
+ From: 'SIP/alice-00000002'
+ callbackModule: 'Hangup'
+ callbackMethod: 'hangup_chan'
+ count: '1'
+
+ # Ensure the Local channel is parked thus filling up all static lot slots.
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'ParkedCall'
+ Exten: '801'
+ Parkinglot: 'parkinglot_static'
+ From: 'Local/fill-park at default-00000000;2'
+ requirements:
+ match:
+ Channel: '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: 'hangup_chan'
+ 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'
+ Channel: 'SIP/bob-00000007'
+ Exten: '901'
+ Parkinglot: 'parkinglot_dynamic'
+ From: 'SIP/alice-00000006'
+ callbackModule: 'Hangup'
+ callbackMethod: 'hangup_chan'
+ count: '1'
+
+ # Ensure the Local channel is parked thus filling up all dynamicall created
+ # lot slots.
+ -
+ type: 'headermatch'
+ id: '0'
+ conditions:
+ match:
+ Event: 'ParkedCall'
+ Exten: '901'
+ Parkinglot: 'parkinglot_dynamic'
+ From: 'Local/fill-park at default-00000001;2'
+ requirements:
+ match:
+ Channel: 'Local/fill-park at default-00000001;2'
+ count: '1'
+
+properties:
+ minversion: '12.0.0'
+ dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
+ - python : 'twisted'
+ - python : 'starpy'
+ tags:
+ - bridge
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/bridge/parkcall_blindxfer/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/bridge/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/tests.yaml?view=diff&rev=3766&r1=3765&r2=3766
==============================================================================
--- asterisk/trunk/tests/bridge/tests.yaml (original)
+++ asterisk/trunk/tests/bridge/tests.yaml Tue May 7 15:10:03 2013
@@ -10,6 +10,7 @@
- test: 'automixmon'
- test: 'parkcall'
- dir: 'parkcall_timeout'
+ - test: 'parkcall_blindxfer'
- test: 'dial_LS_options'
- test: 'connected_line_update'
- test: 'transfer_capabilities'
More information about the asterisk-commits
mailing list