[asterisk-commits] kmoore: testsuite/asterisk/trunk r3253 - in /asterisk/trunk/tests: ./ cause_a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 5 09:45:19 CDT 2012
Author: kmoore
Date: Tue Jun 5 09:45:14 2012
New Revision: 3253
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3253
Log:
Add test for AST_CAUSE_ANSWERED_ELSEWHERE
This tests the setting and forwarding of AST_CAUSE_ANSWERED_ELSEWHERE
on local channels.
Added:
asterisk/trunk/tests/cause_answered_elsewhere/
asterisk/trunk/tests/cause_answered_elsewhere/configs/
asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/
asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/cause_answered_elsewhere/run-test (with props)
asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/tests.yaml
Added: asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf?view=auto&rev=3253
==============================================================================
--- asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf Tue Jun 5 09:45:14 2012
@@ -1,0 +1,16 @@
+[test]
+exten => 100,1,NoOp()
+exten => 100,n,Dial(local/101 at test&local/102 at test)
+exten => 100,n,Hangup()
+
+exten => 101,1,NoOp()
+exten => 101,n,Answer()
+exten => 101,n,Hangup()
+
+exten => 102,1,NoOp()
+exten => 102,n,Dial(local/103 at test)
+
+exten => 103,1,NoOp()
+exten => 103,n,Wait(1)
+exten => 103,n,Answer()
+exten => 103,n,Hangup()
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cause_answered_elsewhere/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cause_answered_elsewhere/run-test?view=auto&rev=3253
==============================================================================
--- asterisk/trunk/tests/cause_answered_elsewhere/run-test (added)
+++ asterisk/trunk/tests/cause_answered_elsewhere/run-test Tue Jun 5 09:45:14 2012
@@ -1,0 +1,64 @@
+#!/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
+
+sys.path.append("lib/python")
+from asterisk.TestCase import TestCase
+from twisted.internet import reactor
+
+logger = logging.getLogger(__name__)
+
+class AnsweredElsewhereTest(TestCase):
+ def __init__(self):
+ self.event_count = 0
+ self.expected_events = 8
+ self.ans_elsewhere_count = 0
+ self.expected_ans_elsewhere = 4
+ TestCase.__init__(self)
+ self.create_asterisk()
+
+ def ami_connect(self, ami):
+ logger.info("Initiating call to local/100 at test on Echo() for answered_elsewhere test")
+
+ ami.registerEvent('Hangup', self.__hangup_cb)
+ ami.originate("local/100 at test", application="Echo").addErrback(self.handleOriginateFailure)
+
+ def __hangup_cb(self, ami, event):
+ logger.info("Got hangup event")
+ self.event_count += 1
+ if event['cause'] == '26':
+ self.ans_elsewhere_count += 1
+
+ if self.event_count == self.expected_events:
+ if self.ans_elsewhere_count == self.expected_ans_elsewhere:
+ self.passed = True
+ else:
+ logger.error("Test failed with %d received events and %d "\
+ "events with the answered_elsewhere cause code" %
+ (self.event_count, self.ans_elsewhere_count))
+ self.stop_reactor()
+
+ def run(self):
+ TestCase.run(self)
+ self.create_ami_factory()
+
+def main():
+ test = AnsweredElsewhereTest()
+ reactor.run()
+
+ if not test.passed:
+ return 1
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
+
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml?view=auto&rev=3253
==============================================================================
--- asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml (added)
+++ asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml Tue Jun 5 09:45:14 2012
@@ -1,0 +1,11 @@
+testinfo:
+ summary: 'Test AST_CAUSE_ANSWERED_ELSEWHERE usage.'
+ description: 'Ensure that AST_CAUSE_ANSWERED_ELSEWHERE is used and passed appropriately'
+
+properties:
+ minversion: '11'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ tags:
+ - answered_elsewhere
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cause_answered_elsewhere/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/tests.yaml?view=diff&rev=3253&r1=3252&r2=3253
==============================================================================
--- asterisk/trunk/tests/tests.yaml (original)
+++ asterisk/trunk/tests/tests.yaml Tue Jun 5 09:45:14 2012
@@ -31,3 +31,4 @@
- dir: 'connected_line'
- dir: 'redirecting'
- test: 'func_presencestate'
+ - test: 'cause_answered_elsewhere'
More information about the asterisk-commits
mailing list