[asterisk-commits] jrose: testsuite/asterisk/trunk r4588 - in /asterisk/trunk/tests/channels/pjs...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 20 12:19:42 CST 2014


Author: jrose
Date: Mon Jan 20 12:19:39 2014
New Revision: 4588

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4588
Log:
testsuite: Add device state checks to PJSIP hold test

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

Modified:
    asterisk/trunk/tests/channels/pjsip/hold/configs/ast1/extensions.conf
    asterisk/trunk/tests/channels/pjsip/hold/run-test

Modified: asterisk/trunk/tests/channels/pjsip/hold/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/hold/configs/ast1/extensions.conf?view=diff&rev=4588&r1=4587&r2=4588
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/hold/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/channels/pjsip/hold/configs/ast1/extensions.conf Mon Jan 20 12:19:39 2014
@@ -3,6 +3,8 @@
 
 [default]
 ; Dial with no options; use bridge set up based on peer definitions
+exten => devicehint,hint,PJSIP/phone_A
+
 exten => basicdial,1,NoOp()
 	same => n,Dial(PJSIP/phone_B,,g)
 	same => n,UserEvent(TestStatus, extension: basicdial)

Modified: asterisk/trunk/tests/channels/pjsip/hold/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/hold/run-test?view=diff&rev=4588&r1=4587&r2=4588
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/hold/run-test (original)
+++ asterisk/trunk/tests/channels/pjsip/hold/run-test Mon Jan 20 12:19:39 2014
@@ -59,6 +59,9 @@
         self.hold_events = 0
         self.unhold_events = 0
         self.user_events = 0
+        self.status_inuse_events = 0
+        self.status_onhold_events = 0
+        self.status_notinuse_events = 0
         self._test_counter = 0
         self._a_finished = False
         self._b_finished = False
@@ -73,6 +76,8 @@
 
         ami.registerEvent('MusicOnHoldStart', self.moh_start_event_handler)
         ami.registerEvent('MusicOnHoldStop', self.moh_stop_event_handler)
+
+        ami.registerEvent('ExtensionStatus', self.extension_status_handler)
 
         ami.registerEvent('Hold', self.hold_event_handler)
         ami.registerEvent('Unhold', self.unhold_event_handler)
@@ -165,6 +170,15 @@
         LOGGER.debug("Received MOH stop event")
         self.moh_stop_events += 1
 
+    def extension_status_handler(self, ami, event):
+        status = event.get('status')
+        if status == '1':
+            self.status_inuse_events += 1
+        elif status == '16':
+            self.status_onhold_events += 1
+        elif status == '0':
+            self.status_notinuse_events += 1
+
     def hold_event_handler(self, ami, event):
         ''' Reacts to hold events and tallies them.
 
@@ -215,6 +229,21 @@
     if (test.user_events != len(test.sipp_scn_phone_a)):
         LOGGER.error("Failed to receive %d user test events (received %d)" %
                      (len(test.sipp_scn_phone_a), test.user_events))
+        test.passed = False
+    if (test.status_inuse_events != len(test.sipp_scn_phone_a) * 2):
+        LOGGER.error("ExtensionStatus - InUse: %d / %d" %
+                     (len(test.sipp_scn_phone_a) * 2,
+                      test.status_inuse_events))
+        test.passed = False
+    if (test.status_onhold_events != len(test.sipp_scn_phone_a)):
+        LOGGER.error("ExtensionStatus - Hold: %d / %d" %
+                     (len(test.sipp_scn_phone_a),
+                      test.status_onhold_events))
+        test.passed = False
+    if (test.status_notinuse_events != len(test.sipp_scn_phone_a)):
+        LOGGER.error("ExtensionStatus - NotInUse: %d / %d" %
+                     (len(test.sipp_scn_phone_a),
+                      test.status_notinuse_events))
         test.passed = False
 
     if test.passed:




More information about the asterisk-commits mailing list