[asterisk-commits] mmichelson: branch mmichelson/bridge-tests r3362 - in /asterisk/team/mmichels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 25 10:47:56 CDT 2012


Author: mmichelson
Date: Wed Jul 25 10:47:52 2012
New Revision: 3362

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3362
Log:
Only register for events once instead of duplicating event registration on every test call.


Modified:
    asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py
    asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf
    asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml

Modified: asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py?view=diff&rev=3362&r1=3361&r2=3362
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py (original)
+++ asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/BridgeTestCase.py Wed Jul 25 10:47:52 2012
@@ -60,14 +60,19 @@
     def ami_connect(self, ami):
         if (ami.id == 0):
             self.ami_uut = ami
+            self.ami_uut.registerEvent('Bridge', self.uut_bridge_callback)
             self.ast[ami.id].cli_exec("sip set debug on")
             LOGGER.info("UUT AMI connected")
         elif (ami.id == 1):
             self.ami_alice = ami
+            self.ami_alice.registerEvent('UserEvent', self.user_callback)
+            self.ami_alice.registerEvent('Hangup', self.hangup_callback)
             self.ast[ami.id].cli_exec("sip set debug on")
             LOGGER.info("Alice AMI connected")
         elif (ami.id == 2):
             self.ami_bob = ami
+            self.ami_bob.registerEvent('UserEvent', self.user_callback)
+            self.ami_bob.registerEvent('Hangup', self.hangup_callback)
             self.ast[ami.id].cli_exec("sip set debug on")
             LOGGER.info("Bob AMI connected")
         else:
@@ -88,12 +93,6 @@
 
     def start_test(self, test_run):
         # Step 0: Set up event handlers and initialize values for this test run
-        self.ami_alice.registerEvent('UserEvent', self.user_callback)
-        self.ami_alice.registerEvent('Hangup', self.hangup_callback)
-        self.ami_bob.registerEvent('UserEvent', self.user_callback)
-        self.ami_bob.registerEvent('Hangup', self.hangup_callback)
-        self.ami_uut.registerEvent('Bridge', self.uut_bridge_callback)
-        self.ami_alice.registerEvent('TestEvent', self.test_callback)
         self.hangup = test_run['hangup'] if 'hangup' in test_run else None
         self.alice_channel = None
         self.bob_channel = None
@@ -136,10 +135,6 @@
                 LOGGER.info("AUDIO SUCK!")
                 self.stop_reactor()
 
-    def test_callback(self, ami, event):
-        if (event.get('state') == 'DTMFRECEIVED'):
-            LOGGER.info("Alice got DTMF: %s: " % event.get('value'))
-
     def hangup_callback(self, ami, event):
         if ami is self.ami_bob:
             self.bob_hungup = True
@@ -157,6 +152,7 @@
         self.uut_bob_channel = event.get('channel2')
         if event.get('bridgestate') == 'Link':
             LOGGER.info("Bridge is up")
+            LOGGER.info("Type of bridge is %s" % event.get('bridgetype'))
             self.bridged = True
         else:
             LOGGER.info("Bridge is down")

Modified: asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf?view=diff&rev=3362&r1=3361&r2=3362
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf (original)
+++ asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/configs/ast1/extensions.conf Wed Jul 25 10:47:52 2012
@@ -1,4 +1,4 @@
 [default]
 
-exten => test_call,1,Dial(SIP/test_call at bob,,Ww)
+exten => test_call,1,Dial(SIP/test_call at bob)
 same => n,Hangup()

Modified: asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml?view=diff&rev=3362&r1=3361&r2=3362
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml (original)
+++ asterisk/team/mmichelson/bridge-tests/tests/bridge/simple_bridge/test-config.yaml Wed Jul 25 10:47:52 2012
@@ -13,6 +13,9 @@
     -
         extension: 'test_call'
         hangup: 'alice'
+    -
+        extension: 'test_call'
+        hangup: 'bob'
 
 properties:
     minversion: '11.0.0'




More information about the asterisk-commits mailing list