[asterisk-commits] kmoore: testsuite/asterisk/trunk r3986 - in /asterisk/trunk/tests/callparking...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 7 11:32:01 CDT 2013


Author: kmoore
Date: Wed Aug  7 11:31:59 2013
New Revision: 3986

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3986
Log:
Allow callparking test to run on Asterisk 12

This adds the necessary version detection to allow the callparking test
to function on Asterisk 12 with modified ParkedCall and UnparkedCall
events and the new parking config file.

(closes issue ASTERISK-22214)

Added:
    asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf   (with props)
Modified:
    asterisk/trunk/tests/callparking/run-test

Added: asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf?view=auto&rev=3986
==============================================================================
--- asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf (added)
+++ asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf Wed Aug  7 11:31:59 2013
@@ -1,0 +1,6 @@
+[default]
+parkext => 700
+parkpos => 701-720
+context => parkedcalls
+parkingtime => 60
+findslot => next               ; Continue to the 'next' free parking space.

Propchange: asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/callparking/configs/ast1/res_parking.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/callparking/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/callparking/run-test?view=diff&rev=3986&r1=3985&r2=3986
==============================================================================
--- asterisk/trunk/tests/callparking/run-test (original)
+++ asterisk/trunk/tests/callparking/run-test Wed Aug  7 11:31:59 2013
@@ -13,6 +13,7 @@
 
 sys.path.append("lib/python")
 from asterisk.TestCase import TestCase
+from asterisk.version import AsteriskVersion
 
 logger = logging.getLogger(__name__)
 
@@ -22,6 +23,10 @@
         TestCase.__init__(self)
 
         self.ami_count = 0
+        self.parking_var = "exten"
+
+        if AsteriskVersion() >= AsteriskVersion('12'):
+            self.parking_var = "parkingspace"
 
         # Initial parked call subtest.
         self.expected_space = 701
@@ -37,10 +42,13 @@
 
     def check_result(self):
         if not self.got_AMI_UnParkedCall:
+            logger.info("Bailed 1")
             return
         if not self.ast1_event:
+            logger.info("Bailed 2")
             return
         if not self.ast2_event:
+            logger.info("Bailed 3")
             return
 
         # Parked call subtest completed successfully.
@@ -64,6 +72,7 @@
             return
 
         # All parked call subtests completed successfully.
+        logger.info("Test completed successfully")
         self.passed = True
         self.stop_reactor()
 
@@ -79,24 +88,24 @@
 
     # Called when got UnParkedCall AMI event
     def ast1_unparkedcall(self, ami, event):
-        exten = event.get("exten").lower()
-        logger.info("Parked call retrieved from exten: " + str(exten))
-        if exten != str(self.expected_space):
+        exten = event.get(self.parking_var)
+        if not exten or exten != str(self.expected_space):
             logger.info("Call not retrieved from expected space " + str(self.expected_space))
             self.stop_reactor()
             return
+        logger.info("Parked call retrieved from exten: " + str(exten))
 
         self.got_AMI_UnParkedCall = True
         self.check_result()
 
     # Called when got ParkedCall AMI event
     def ast1_parkedcall(self, ami, event):
-        exten = event.get("exten").lower()
-        logger.info("Call parked at exten: " + str(exten))
-        if exten != str(self.expected_space):
+        exten = event.get(self.parking_var)
+        if not exten or exten != str(self.expected_space):
             logger.info("Call not parked in expected space " + str(self.expected_space))
             self.stop_reactor()
             return
+        logger.info("Call parked at exten: " + str(exten))
 
         self.get_parkedcall()
 




More information about the asterisk-commits mailing list