[asterisk-commits] mjordan: testsuite/asterisk/trunk r3889 - in /asterisk/trunk/tests/channels: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 8 09:51:48 CDT 2013


Author: mjordan
Date: Mon Jul  8 09:51:42 2013
New Revision: 3889

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3889
Log:
Add tests for Local channels

This patch adds four tests for Local channels to the Test Suite:

* A test that originates an optimizing Local channel, connects it to a SIP
  channel and executes an application. The test verifies that we don't
  optimize (yes, this is "impossible" currently, but it's good to check that)
* A test that originates both an optimizing and non-optimizing Local channel
  between two SIP channels in basic mixing bridges and verifies both that an
  optimization occurs when it should and that it doesn't when it shouldn't
* A test that originates both an optimizing and non-optimizing Local channel
  between a SIP channel and a holding bridge. The test verifies that we
  optimize when we should and don't optimize when we shouldn't.
* A test that originates a non-optimizing Local channel between two SIP
  channels and then forces an optimization via the LocalOptimizeAway AMI
  action.

Review: https://reviewboard.asterisk.org/r/2653

Added:
    asterisk/trunk/tests/channels/local/
    asterisk/trunk/tests/channels/local/local_app/
    asterisk/trunk/tests/channels/local/local_app/configs/
    asterisk/trunk/tests/channels/local/local_app/configs/ast1/
    asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/local/local_app/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/local/local_call/
    asterisk/trunk/tests/channels/local/local_call/configs/
    asterisk/trunk/tests/channels/local/local_call/configs/ast1/
    asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/local/local_call/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/local/local_holding_bridge/
    asterisk/trunk/tests/channels/local/local_holding_bridge/configs/
    asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/
    asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/local/local_optimize_away/
    asterisk/trunk/tests/channels/local/local_optimize_away/configs/
    asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/
    asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py   (with props)
    asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/local/tests.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/tests.yaml

Added: asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,16 @@
+
+[default]
+
+exten => app_exec,1,NoOp()
+	same => n,Answer()
+	same => n,Echo()
+	same => n,Hangup()
+
+exten => dial_foo,1,NoOp()
+	same => n,Dial(SIP/foo at asterisk)
+	same => n,Hangup()
+
+exten => foo,1,NoOp()
+	same => n,Answer()
+	same => n,Playback(beep)
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_app/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,7 @@
+[general]
+udpbindaddr = 127.0.0.1
+
+[asterisk]
+type = friend
+host = 127.0.0.1
+

Propchange: asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_app/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_app/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_app/test-config.yaml?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_app/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/local/local_app/test-config.yaml Mon Jul  8 09:51:42 2013
@@ -1,0 +1,59 @@
+testinfo:
+    summary: 'Test that a Local channel executing an app does not optimize'
+    description: |
+        This test puts a Local channel into the dialplan and ties the other
+        end to a SIP channel. The Local channel will enter into the Echo
+        application and the SIP channel will eventually hang up. The test passes
+        when the Local channel doesn't optimize
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'SimpleTestCase.SimpleTestCase'
+    modules:
+        -
+            minversion: '12.0.0'
+            config-section: ami-config-12
+            typename: 'ami.AMIEventModule'
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - chan_local
+
+test-object-config:
+    spawn-after-hangup: True
+    test-iterations:
+        -
+            channel: 'Local/app_exec at default'
+            exten: 'dial_foo'
+            context: 'default'
+            priority: '1'
+
+ami-config-12:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalBridge'
+                LocalOneChannel: 'Local/app_exec at default-.{7}0;1'
+                LocalTwoChannel: 'Local/app_exec at default-.{7}0;2'
+        requirements:
+            match:
+                LocalOptimization: 'Yes'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationBegin'
+        count: '0'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationEnd'
+        count: '0'

Propchange: asterisk/trunk/tests/channels/local/local_app/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_app/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_app/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,21 @@
+
+[default]
+
+exten => bar,1,NoOp()
+	same => n,Answer()
+	same => n,Playback(beep)
+	same => n,Echo()
+	same => n,Hangup()
+
+exten => dial_bar,1,NoOp()
+	same => n,Dial(SIP/bar at asterisk)
+	same => n,Hangup()
+
+exten => dial_foo,1,NoOp()
+	same => n,Dial(SIP/foo at asterisk)
+	same => n,Hangup()
+
+exten => foo,1,NoOp()
+	same => n,Answer()
+	same => n,Playback(beep)
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_call/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,7 @@
+[general]
+udpbindaddr = 127.0.0.1
+
+[asterisk]
+type = friend
+host = 127.0.0.1
+

Propchange: asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_call/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_call/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_call/test-config.yaml?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_call/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/local/local_call/test-config.yaml Mon Jul  8 09:51:42 2013
@@ -1,0 +1,98 @@
+testinfo:
+    summary: 'Test Local channel operation between two real channels'
+    description: |
+        This test puts a Local channel between two SIP channels:
+        SIP/foo <---> Local/1 <-> Local/2 <---> SIP/bar
+                 B0           LB           B1
+        In the first iteration, the Local channel should optimize itself away,
+        resulting in a bridge of SIP/foo and SIP/bar. In the second iteration,
+        the n flag should keep the Local channel from optimizing, resulting
+        in the original bridge(s) being maintained.
+
+properties:
+    minversion: '1.8.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - chan_local
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'SimpleTestCase.SimpleTestCase'
+    modules:
+        -
+            minversion: '12.0.0'
+            config-section: ami-config-12
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    spawn-after-hangup: True
+    test-iterations:
+        -
+            channel: 'Local/dial_bar at default'
+            exten: 'dial_foo'
+            context: 'default'
+            priority: '1'
+        -
+            channel: 'Local/dial_bar at default/n'
+            exten: 'dial_foo'
+            context: 'default'
+            priority: '1'
+
+ami-config-12:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalBridge'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
+        requirements:
+            match:
+                LocalOptimization: 'Yes'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationBegin'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationEnd'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalBridge'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}1;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}1;2'
+        requirements:
+            match:
+                LocalOptimization: 'No'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationBegin'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}1;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}1;2'
+        count: '0'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationEnd'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}1;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}1;2'
+        count: '0'

Propchange: asterisk/trunk/tests/channels/local/local_call/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_call/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_call/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,16 @@
+
+[default]
+
+exten => holdem,1,NoOp()
+	same => n,Answer()
+	same => n,BridgeWait(S(2))
+	same => n,Hangup()
+
+exten => dial_foo,1,NoOp()
+	same => n,Dial(SIP/foo at asterisk)
+	same => n,Hangup()
+
+exten => foo,1,NoOp()
+	same => n,Answer()
+	same => n,Playback(tt-monkeys)
+	same => n,Echo()

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,7 @@
+[general]
+udpbindaddr = 127.0.0.1
+
+[asterisk]
+type = friend
+host = 127.0.0.1
+

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml Mon Jul  8 09:51:42 2013
@@ -1,0 +1,99 @@
+testinfo:
+    summary: 'Test Local channel operation with a holding bridge'
+    description: |
+        This test puts a Local channel between a SIP channel and a Holding
+        Bridge:
+        SIP/foo <---> Local/1 <-> Local/2 <---
+                 B0           LB           HB
+        In the first iteration, the Local channel should optimize itself away,
+        resulting in SIP/foo being put directly into the Holding Bridge (HB).
+        In the second iteration, the n flag should keep the Local channel from
+        optimizing, resulting in the original bridge(s) being maintained.
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - chan_local
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'SimpleTestCase.SimpleTestCase'
+    modules:
+        -
+            minversion: '12.0.0'
+            config-section: ami-config-12
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    spawn-after-hangup: True
+    test-iterations:
+        -
+            channel: 'Local/holdem at default'
+            exten: 'dial_foo'
+            context: 'default'
+            priority: '1'
+        -
+            channel: 'Local/holdem at default/n'
+            exten: 'dial_foo'
+            context: 'default'
+            priority: '1'
+
+ami-config-12:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalBridge'
+                LocalOneChannel: 'Local/holdem at default-.{7}0;1'
+                LocalTwoChannel: 'Local/holdem at default-.{7}0;2'
+        requirements:
+            match:
+                LocalOptimization: 'Yes'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationBegin'
+                LocalOneChannel: 'Local/holdem at default-.{7}0;1'
+                LocalTwoChannel: 'Local/holdem at default-.{7}0;2'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationEnd'
+                LocalOneChannel: 'Local/holdem at default-.{7}0;1'
+                LocalTwoChannel: 'Local/holdem at default-.{7}0;2'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalBridge'
+                LocalOneChannel: 'Local/holdem at default-.{7}1;1'
+                LocalTwoChannel: 'Local/holdem at default-.{7}1;2'
+        requirements:
+            match:
+                LocalOptimization: 'No'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationBegin'
+                LocalOneChannel: 'Local/holdem at default-.{7}1;1'
+                LocalTwoChannel: 'Local/holdem at default-.{7}1;2'
+        count: '0'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationEnd'
+                LocalOneChannel: 'Local/holdem at default-.{7}1;1'
+                LocalTwoChannel: 'Local/holdem at default-.{7}1;2'
+        count: '0'

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_holding_bridge/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,22 @@
+
+[default]
+
+exten => bar,1,NoOp()
+	same => n,Answer()
+	same => n,Playback(demo-congrats)
+	same => n,Echo()
+	same => n,Hangup()
+
+exten => dial_bar,1,NoOp()
+	same => n,Dial(SIP/bar at asterisk)
+	same => n,Hangup()
+
+exten => dial_foo,1,NoOp()
+	same => n,Dial(SIP/foo at asterisk)
+	same => n,Hangup()
+
+exten => foo,1,NoOp()
+	same => n,Answer()
+	same => n,UserEvent(Trigger)
+	same => n,Playback(demo-congrats)
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf Mon Jul  8 09:51:42 2013
@@ -1,0 +1,7 @@
+[general]
+udpbindaddr = 127.0.0.1
+
+[asterisk]
+type = friend
+host = 127.0.0.1
+

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py (added)
+++ asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py Mon Jul  8 09:51:42 2013
@@ -1,0 +1,20 @@
+'''
+Copyright (C) 2013, Digium, Inc.
+Matt Jordan <mjordan at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import logging
+
+LOGGER = logging.getLogger(__name__)
+
+def optimize_channel(ami, event):
+    ''' Callback called when we decide to try and optimize the Local channel '''
+
+    LOGGER.info('Requesting Local channel optimization')
+    msg = {'Action': 'LocalOptimizeAway',
+           'Channel': 'Local/dial_bar at default-00000000;1',}
+    ami.sendMessage(msg)
+    return True

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/local_optimize_away.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml Mon Jul  8 09:51:42 2013
@@ -1,0 +1,74 @@
+testinfo:
+    summary: 'Test Local channel and the LocalOptimizeAway AMI command'
+    description: |
+        This test puts a Local channel between two SIP channels:
+        SIP/foo <---> Local/1 <-> Local/2 <---> SIP/bar
+                 B0           LB           B1
+        It then uses the LocalOptimizeAway command to force a Local channel
+        optimization.
+
+properties:
+    minversion: '12.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - chan_local
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-object-config
+        typename: 'SimpleTestCase.SimpleTestCase'
+    modules:
+        -
+            minversion: '12.0.0'
+            config-section: ami-config-12
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    expected_events: 0
+    spawn-after-hangup: True
+    test-iterations:
+        -
+            channel: 'Local/dial_bar at default/n'
+            exten: 'dial_foo'
+            context: 'default'
+            priority: '1'
+
+ami-config-12:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalBridge'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
+        requirements:
+            match:
+                LocalOptimization: 'No'
+        count: '1'
+    -
+        type: 'callback'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'Trigger'
+        callbackModule: 'local_optimize_away'
+        callbackMethod: 'optimize_channel'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationBegin'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
+        count: '1'
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'LocalOptimizationEnd'
+                LocalOneChannel: 'Local/dial_bar at default-.{7}0;1'
+                LocalTwoChannel: 'Local/dial_bar at default-.{7}0;2'
+        count: '1'

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/local_optimize_away/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/local/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/local/tests.yaml?view=auto&rev=3889
==============================================================================
--- asterisk/trunk/tests/channels/local/tests.yaml (added)
+++ asterisk/trunk/tests/channels/local/tests.yaml Mon Jul  8 09:51:42 2013
@@ -1,0 +1,6 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'local_app'
+    - test: 'local_call'
+    - test: 'local_holding_bridge'
+    - test: 'local_optimize_away'

Propchange: asterisk/trunk/tests/channels/local/tests.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/local/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/local/tests.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/tests.yaml?view=diff&rev=3889&r1=3888&r2=3889
==============================================================================
--- asterisk/trunk/tests/channels/tests.yaml (original)
+++ asterisk/trunk/tests/channels/tests.yaml Mon Jul  8 09:51:42 2013
@@ -2,4 +2,5 @@
 tests:
     - dir: 'SIP'
     - dir: 'iax2'
+    - dir: 'local'
     - dir: 'gulp'




More information about the asterisk-commits mailing list