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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 2 12:18:36 CST 2013


Author: kmoore
Date: Wed Jan  2 12:18:32 2013
New Revision: 3595

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3595
Log:
Add test for mid-call event

This test checks that connected line information is transmitted
correctly during a call versus initial transmission which occurs during
call setup.

(closes issue SWP-4713)
Review: https://reviewboard.asterisk.org/r/2249/

Added:
    asterisk/trunk/tests/bridge/connected_line_update/Tester.py   (with props)
    asterisk/trunk/tests/bridge/connected_line_update/configs/
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf   (with props)
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf   (with props)
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf   (with props)
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/
    asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf   (with props)
    asterisk/trunk/tests/bridge/connected_line_update/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=3595&r1=3594&r2=3595
==============================================================================
--- asterisk/trunk/lib/python/asterisk/BridgeTestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/BridgeTestCase.py Wed Jan  2 12:18:32 2013
@@ -230,6 +230,7 @@
             self.execute_feature(self.features[self.current_feature])
         else:
             LOGGER.info("All features executed")
+            self.ami_uut.userEvent("features_executed")
             self.send_hangup()
 
     def execute_feature(self, feature):

Added: asterisk/trunk/tests/bridge/connected_line_update/Tester.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/connected_line_update/Tester.py?view=auto&rev=3595
==============================================================================
--- asterisk/trunk/tests/bridge/connected_line_update/Tester.py (added)
+++ asterisk/trunk/tests/bridge/connected_line_update/Tester.py Wed Jan  2 12:18:32 2013
@@ -1,0 +1,71 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2012, Digium, Inc.
+Kinsey Moore <kmoore at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import logging
+import time
+
+sys.path.append("lib/python")
+
+LOGGER = logging.getLogger(__name__)
+
+class Tester(object):
+    def __init__(self, module_config, test_object):
+        self.alice = None
+        self.bob = None
+        test_object.register_ami_observer(self.ami_connect)
+        self.alice_channel = None
+        self.bob_channel = None
+        return
+
+    def ami_connect(self, ami):
+        if ami.id == 0:
+            ami.registerEvent('UserEvent', self.uut_userevent)
+        elif ami.id == 1:
+            self.alice = ami
+            self.alice.registerEvent('Newchannel', self.alice_newchannel)
+        elif ami.id == 2:
+            self.bob = ami
+            self.bob.registerEvent('Newchannel', self.bob_newchannel)
+
+    def alice_newchannel(self, ami, event):
+        '''Capture originated channel on Alice.'''
+        self.alice_channel = event['channel']
+
+    def bob_newchannel(self, ami, event):
+        '''Capture incoming channel on Bob.'''
+        self.bob_channel = event['channel']
+
+    def uut_userevent(self, ami, event):
+        '''Handle UserEvents from UUT'''
+
+        LOGGER.info('Got UUT event: %s' % str(event))
+        # wait until both are connected to process events
+        if event['userevent'] == 'CLInfo':
+            # first update
+            if event['clinfo'] == 'newbob <2345>':
+                LOGGER.info('Received first connected line update')
+                self.bob_to_alice_update()
+            # second update
+            elif event['clinfo'] == 'newalice <5432>':
+                LOGGER.info('Received second connected line update')
+                # tear down the call
+                self.alice.hangup(self.alice_channel)
+        elif event['userevent'] == 'features_executed':
+            self.alice_to_bob_update()
+
+    def alice_to_bob_update(self):
+        '''When Alice and Bob first indicate connectivity, kick off the first update.'''
+        self.alice.setVar(self.alice_channel, 'CONNECTEDLINE(all)', 'newbob <2345>')
+        LOGGER.info('Set new CLI on alice to propagate to bob')
+
+    def bob_to_alice_update(self):
+        '''After the first update is successfully passed across, kick off the second update.'''
+        self.bob.setVar(self.bob_channel, 'CONNECTEDLINE(all)', 'newalice <5432>')
+        LOGGER.info('Set new CLI on bob to propagate to alice')

Propchange: asterisk/trunk/tests/bridge/connected_line_update/Tester.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/bridge/connected_line_update/Tester.py
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/bridge/connected_line_update/Tester.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/bridge/connected_line_update/Tester.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/extensions.conf?view=auto&rev=3595
==============================================================================
--- asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/extensions.conf Wed Jan  2 12:18:32 2013
@@ -1,0 +1,15 @@
+[globals]
+CONNECTED_LINE_SEND_SUB=callback,s,1
+
+[callback]
+exten => s,1,NoOp()
+same => n,UserEvent(CLInfo,clinfo: ${CONNECTEDLINE(all)})
+same => n,Set(CONNECTEDLINE(all)=${CONNECTEDLINE(all)})
+same => n,Return()
+
+[default]
+
+exten => simple_bridge,1,NoOp()
+same => n,Dial(SIP/test_call at bob)
+same => n,Hangup()
+

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

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

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

Added: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf?view=auto&rev=3595
==============================================================================
--- asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf (added)
+++ asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf Wed Jan  2 12:18:32 2013
@@ -1,0 +1,2 @@
+[alice-extra](!)
+trustrpid=yes

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-alice.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf?view=auto&rev=3595
==============================================================================
--- asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf (added)
+++ asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf Wed Jan  2 12:18:32 2013
@@ -1,0 +1,2 @@
+[bob-extra](!)
+trustrpid=yes

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast1/sip-bob.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf?view=auto&rev=3595
==============================================================================
--- asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf (added)
+++ asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf Wed Jan  2 12:18:32 2013
@@ -1,0 +1,3 @@
+[uut-extra](!)
+sendrpid=pai
+trustrpid=yes

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast2/sip-uut.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf?view=auto&rev=3595
==============================================================================
--- asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf (added)
+++ asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf Wed Jan  2 12:18:32 2013
@@ -1,0 +1,3 @@
+[uut-extra](!)
+sendrpid=pai
+trustrpid=yes

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/bridge/connected_line_update/configs/ast3/sip-uut.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/bridge/connected_line_update/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/bridge/connected_line_update/test-config.yaml?view=auto&rev=3595
==============================================================================
--- asterisk/trunk/tests/bridge/connected_line_update/test-config.yaml (added)
+++ asterisk/trunk/tests/bridge/connected_line_update/test-config.yaml Wed Jan  2 12:18:32 2013
@@ -1,0 +1,79 @@
+testinfo:
+    summary: 'Connected line update propagation across a bridge'
+    description: |
+        'Set up a bridge between two endpoints and ensure that the initial connected line update moves across the bridge as well as subsequent updates.'
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: bridge-config
+        typename: 'BridgeTestCase.BridgeTestCase'
+    modules:
+        -
+            # for orchestration of the test
+            typename: 'Tester.Tester'
+        -
+            # for checking events
+            typename: 'ami.AMIEventModule'
+            config-section: ami-uut
+
+bridge-config:
+    -
+        originate_channel: 'SIP/uut/simple_bridge'
+
+ami-uut:
+    -
+        type: 'orderedheadermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'CLInfo'
+        requirements:
+            -
+                match:
+                    CLInfo: 'Bob <4321>'
+            -
+                match:
+                    CLInfo: 'Bob <4321>'
+            -
+                match:
+                    CLInfo: 'Bob <4321>'
+            -
+                match:
+                    CLInfo: 'newbob <2345>'
+            -
+                match:
+                    CLInfo: 'newalice <5432>'
+        count: '5'
+    -
+        type: 'headermatch'
+        id: '1'
+        conditions:
+            match:
+                Event: 'NewCallerid'
+                CallerIDNum: '5432'
+        requirements:
+            match:
+                CallerIDName: 'newalice'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '2'
+        conditions:
+            match:
+                Event: 'NewCallerid'
+                CallerIDNum: '2345'
+        requirements:
+            match:
+                CallerIDName: 'newbob'
+        count: '1'
+
+
+properties:
+    minversion: '11.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+    tags:
+        - bridge

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

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

Propchange: asterisk/trunk/tests/bridge/connected_line_update/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=3595&r1=3594&r2=3595
==============================================================================
--- asterisk/trunk/tests/bridge/tests.yaml (original)
+++ asterisk/trunk/tests/bridge/tests.yaml Wed Jan  2 12:18:32 2013
@@ -6,3 +6,4 @@
     - test: 'automon'
     - test: 'automixmon'
     - test: 'dial_LS_options'
+    - test: 'connected_line_update'




More information about the asterisk-commits mailing list