[asterisk-commits] kmoore: testsuite/asterisk/trunk r3646 - in /asterisk/trunk: lib/python/aster...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 21 15:05:17 CST 2013


Author: kmoore
Date: Thu Feb 21 15:05:12 2013
New Revision: 3646

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3646
Log:
Tweak BridgeTestCase and add transfer caps test

Add fail tokens to BridgeTestCase so that it will properly report
errors when test stages fail to execute (thanks to jrose).

Add a bridging test for blind and attended transfer capabilities using
Dial options and the BRIDGE_FEATURES variable to ensure that the 't'
and 'T' options detect DTMF properly.

Review: https://reviewboard.asterisk.org/r/2268/
(closes issue SWP-5268)
Patches:
     transfer_capabilities.diff uploaded by Kinsey Moore

Added:
    asterisk/trunk/tests/bridge/transfer_capabilities/
    asterisk/trunk/tests/bridge/transfer_capabilities/configs/
    asterisk/trunk/tests/bridge/transfer_capabilities/configs/ast1/
    asterisk/trunk/tests/bridge/transfer_capabilities/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml   (with props)
Modified:
    asterisk/trunk/lib/python/asterisk/BridgeTestCase.py
    asterisk/trunk/tests/bridge/tests.yaml

Modified: asterisk/trunk/lib/python/asterisk/BridgeTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/BridgeTestCase.py?view=diff&rev=3646&r1=3645&r2=3646
==============================================================================
--- asterisk/trunk/lib/python/asterisk/BridgeTestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/BridgeTestCase.py Thu Feb 21 15:05:12 2013
@@ -11,6 +11,7 @@
 import logging
 import uuid
 import os
+from time import sleep
 
 sys.path.append("lib/python")
 from TestCase import TestCase
@@ -46,6 +47,7 @@
         self.ami_alice = None
         self.ami_bob = None
         self.call_end_observers = []
+        self.bridge_fail_token = self.create_fail_token("BridgeTestCase hasn't raised the flag to indicate completion of all expected calls.")
 
         if test_config is None:
             LOGGER.error("No configuration provided. Bailing.")
@@ -100,6 +102,7 @@
             self.start_test(self.test_runs[self.current_run])
         else:
             LOGGER.info("All calls executed, stopping")
+            self.remove_fail_token(self.bridge_fail_token)
             self.set_passed(True)
             self.stop_reactor()
 
@@ -258,7 +261,11 @@
 
         LOGGER.info("Sending feature %s from %s" % (feature['what'],
             feature['who']))
+        # make sure to put a gap between DTMF digits to ensure that events
+        # headed to the UUT are not ignored because they occur too quickly
+        sleep(0.25)
         ami.playDTMF(channel, BridgeTestCase.FEATURE_MAP[feature['what']])
+        sleep(0.25)
 
     def test_callback(self, ami, event):
         if event.get('state') != 'FEATURE_DETECTION':

Modified: asterisk/trunk/tests/bridge/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/tests.yaml?view=diff&rev=3646&r1=3645&r2=3646
==============================================================================
--- asterisk/trunk/tests/bridge/tests.yaml (original)
+++ asterisk/trunk/tests/bridge/tests.yaml Thu Feb 21 15:05:12 2013
@@ -9,3 +9,4 @@
     - dir: 'parkcall_timeout'
     - test: 'dial_LS_options'
     - test: 'connected_line_update'
+    - test: 'transfer_capabilities'

Added: asterisk/trunk/tests/bridge/transfer_capabilities/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/transfer_capabilities/configs/ast1/extensions.conf?view=auto&rev=3646
==============================================================================
--- asterisk/trunk/tests/bridge/transfer_capabilities/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/bridge/transfer_capabilities/configs/ast1/extensions.conf Thu Feb 21 15:05:12 2013
@@ -1,0 +1,16 @@
+[default]
+
+exten => alice_opt,1,Dial(SIP/test_call at bob,,Th)
+same => n,Hangup()
+
+exten => alice_bridge_features,1,Set(BRIDGE_FEATURES=T)
+same => n,Dial(SIP/test_call at bob,,h)
+same => n,Hangup()
+
+exten => bob_opt,1,Dial(SIP/test_call at bob,,tH)
+same => n,Hangup()
+
+exten => bob_bridge_features,1,Set(BRIDGE_FEATURES=t)
+same => n,Dial(SIP/test_call at bob,,H)
+same => n,Hangup()
+

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

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

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

Added: asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml?view=auto&rev=3646
==============================================================================
--- asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml (added)
+++ asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml Thu Feb 21 15:05:12 2013
@@ -1,0 +1,592 @@
+testinfo:
+    summary: 'Test blind and attended transfers via T dial option and BRIDGE_FEATURES'
+    description: |
+        'Test blind and attended transfers from Alice and Bob to ensure that
+        the "T" and "t" options allow the correct parties to perform transfers
+        when used from the Dial application and from BRIDGE_FEATURES.'
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - bridge
+
+test-modules:
+    test-object:
+        config-section: bridge-config
+        typename: 'BridgeTestCase.BridgeTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+        -
+            config-section: 'cel-config'
+            typename: 'cel.CELModule'
+        -
+            config-section: 'cdr-config'
+            typename: 'cdr.CDRModule'
+
+bridge-config:
+    -
+        originate_channel: 'SIP/alice_opt at uut'
+        hangup: 'alice'
+        features:
+            -
+                who: 'bob'
+                what: 'blindxfer'
+                success: 'false'
+            -
+                who: 'bob'
+                what: 'atxfer'
+                success: 'false'
+            -
+                who: 'alice'
+                what: 'blindxfer'
+                success: 'true'
+            -
+                who: 'alice'
+                what: 'atxfer'
+                success: 'true'
+    -
+        originate_channel: 'SIP/alice_bridge_features at uut'
+        hangup: 'alice'
+        features:
+            -
+                who: 'bob'
+                what: 'blindxfer'
+                success: 'false'
+            -
+                who: 'bob'
+                what: 'atxfer'
+                success: 'false'
+            -
+                who: 'alice'
+                what: 'blindxfer'
+                success: 'true'
+            -
+                who: 'alice'
+                what: 'atxfer'
+                success: 'true'
+    -
+        originate_channel: 'SIP/bob_opt at uut'
+        hangup: 'alice'
+        features:
+            -
+                who: 'alice'
+                what: 'blindxfer'
+                success: 'false'
+            -
+                who: 'alice'
+                what: 'atxfer'
+                success: 'false'
+            -
+                who: 'bob'
+                what: 'blindxfer'
+                success: 'true'
+            -
+                who: 'bob'
+                what: 'atxfer'
+                success: 'true'
+    -
+        originate_channel: 'SIP/bob_bridge_features at uut'
+        hangup: 'alice'
+        features:
+            -
+                who: 'alice'
+                what: 'blindxfer'
+                success: 'false'
+            -
+                who: 'alice'
+                what: 'atxfer'
+                success: 'false'
+            -
+                who: 'bob'
+                what: 'blindxfer'
+                success: 'true'
+            -
+                who: 'bob'
+                what: 'atxfer'
+                success: 'true'
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'VarSet'
+                Variable: 'BLINDTRANSFER'
+        count: '0'
+
+cel-config:
+    -
+        file: 'Master'
+        lines:
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'APP_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'BRIDGE_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'BRIDGE_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+                eventextra: '16,.*/alice-.*,'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'APP_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                eventextra: '16,.*/alice-.*,ANSWER'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'LINKEDID_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_opt'
+                exten: 'alice_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'APP_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'BRIDGE_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'BRIDGE_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+                eventextra: '16,.*/alice-.*,'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'APP_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                eventextra: '16,.*/alice-.*,ANSWER'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'LINKEDID_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'alice_bridge_features'
+                exten: 'alice_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'APP_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'BRIDGE_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'BRIDGE_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+                eventextra: '16,.*,'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'APP_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+                eventextra: '16,.*,ANSWER'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'LINKEDID_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_opt'
+                exten: 'bob_opt'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'APP_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'CHAN_START'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'ANSWER'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'BRIDGE_START'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'BRIDGE_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+                bridgepeer: '.*/bob-.*'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+                eventextra: '16,.*,'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Bob'
+                cidnum: '4321'
+                channel: '.*/bob-.*'
+                app: 'AppDial'
+                appdata: '\(Outgoing Line\)'
+            -
+                eventtype: 'APP_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                app: 'Dial'
+            -
+                eventtype: 'HANGUP'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+                eventextra: '16,.*,ANSWER'
+            -
+                eventtype: 'CHAN_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+            -
+                eventtype: 'LINKEDID_END'
+                cidname: 'Alice'
+                cidnum: '1234'
+                dnid: 'bob_bridge_features'
+                exten: 'bob_bridge_features'
+                context: 'default'
+                channel: '.*/alice-.*'
+
+cdr-config:
+    -
+        file: 'Master'
+        lines:
+            -
+                source: '1234'
+                destination: 'alice_opt'
+                dcontext: 'default'
+                callerid: '"Alice" <1234>'
+                channel: '.*/alice-.*'
+                dchannel: '.*/bob-.*'
+                lastapp: 'Dial'
+                disposition: 'ANSWERED'
+                amaflags: 'DOCUMENTATION'
+            -
+                source: '1234'
+                destination: 'alice_bridge_features'
+                dcontext: 'default'
+                callerid: '"Alice" <1234>'
+                channel: '.*/alice-.*'
+                dchannel: '.*/bob-.*'
+                lastapp: 'Dial'
+                disposition: 'ANSWERED'
+                amaflags: 'DOCUMENTATION'
+            -
+                source: '1234'
+                destination: 'bob_opt'
+                dcontext: 'default'
+                callerid: '"Alice" <1234>'
+                channel: '.*/alice-.*'
+                dchannel: '.*/bob-.*'
+                lastapp: 'Dial'
+                disposition: 'ANSWERED'
+            -
+                source: '1234'
+                destination: 'bob_bridge_features'
+                dcontext: 'default'
+                callerid: '"Alice" <1234>'
+                channel: '.*/alice-.*'
+                dchannel: '.*/bob-.*'
+                lastapp: 'Dial'
+                disposition: 'ANSWERED'

Propchange: asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/bridge/transfer_capabilities/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list