[asterisk-commits] file: testsuite/asterisk/trunk r3087 - in /asterisk/trunk/tests/apps: ./ page...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Mar 10 14:21:08 CST 2012


Author: file
Date: Sat Mar 10 14:21:01 2012
New Revision: 3087

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3087
Log:
Add basic functionality test for app_page.

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

Added:
    asterisk/trunk/tests/apps/page/
    asterisk/trunk/tests/apps/page/configs/
    asterisk/trunk/tests/apps/page/configs/ast1/
    asterisk/trunk/tests/apps/page/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/page/configs/ast1/iax.conf   (with props)
    asterisk/trunk/tests/apps/page/run-test   (with props)
    asterisk/trunk/tests/apps/page/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/apps/tests.yaml

Added: asterisk/trunk/tests/apps/page/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/page/configs/ast1/extensions.conf?view=auto&rev=3087
==============================================================================
--- asterisk/trunk/tests/apps/page/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/page/configs/ast1/extensions.conf Sat Mar 10 14:21:01 2012
@@ -1,0 +1,13 @@
+[general]
+
+[globals]
+
+[pagetest]
+
+exten => 1000,1,Answer()
+exten => 1000,n,Page(IAX2/localhost/2000)
+
+exten => 2000,1,Answer()
+exten => 2000,n,AMD()
+exten => 2000,n,UserEvent(amdevent, status: ${AMDSTATUS})
+exten => 2000,n,Hangup

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

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

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

Added: asterisk/trunk/tests/apps/page/configs/ast1/iax.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/page/configs/ast1/iax.conf?view=auto&rev=3087
==============================================================================
--- asterisk/trunk/tests/apps/page/configs/ast1/iax.conf (added)
+++ asterisk/trunk/tests/apps/page/configs/ast1/iax.conf Sat Mar 10 14:21:01 2012
@@ -1,0 +1,14 @@
+[general]
+
+bindport=4569
+bindaddr=127.0.0.1
+
+disallow=all
+allow=ulaw
+
+jitterbuffer=no
+forcejitterbuffer=no
+
+[guest]
+type=user
+context=pagetest

Propchange: asterisk/trunk/tests/apps/page/configs/ast1/iax.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/page/configs/ast1/iax.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/page/configs/ast1/iax.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/page/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/page/run-test?view=auto&rev=3087
==============================================================================
--- asterisk/trunk/tests/apps/page/run-test (added)
+++ asterisk/trunk/tests/apps/page/run-test Sat Mar 10 14:21:01 2012
@@ -1,0 +1,67 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2012, Digium, Inc.
+Joshua Colp <jcolp at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+import sys
+from twisted.internet import reactor
+from starpy import manager
+import logging
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.TestCase import TestCase
+
+logger = logging.getLogger(__name__)
+
+class PageTest(TestCase):
+    def __init__(self):
+        TestCase.__init__(self)
+
+        self.reactor_timeout = 60
+        self.create_asterisk()
+
+    def ami_connect(self, ami):
+        self.ami[0].registerEvent("UserEvent", self.check_amd_status_result)
+        self.ami[0].originate(channel = "IAX2/localhost/1000",
+                              application = "Playback",
+                              data = "demo-congrats")
+
+    def check_amd_status_result(self, ami, event):
+        if event.get("userevent").lower() != "amdevent":
+            return
+
+        status = event.get("status")
+        logger.debug("Status of AMD is %s" % (status))
+        if status == "MACHINE":
+            self.passed = True
+            logger.debug("Page test passed -- detected machine")
+        elif status == "HUMAN":
+            self.passed = True
+            logger.debug("Page test passed -- detected human")
+        else:
+            self.passed = False
+            logger.warn("Page test failed!")
+        self.stop_reactor()
+
+    def run(self):
+        TestCase.run(self)
+        self.create_ami_factory()
+
+def main():
+    test = PageTest()
+    test.start_asterisk()
+    reactor.run()
+    test.stop_asterisk()
+
+    if not test.passed:
+        return 1
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main() or 0)
+
+# vim:sw=4:ts=4:expandtab:textwidth=79

Propchange: asterisk/trunk/tests/apps/page/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/page/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/page/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/page/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/page/test-config.yaml?view=auto&rev=3087
==============================================================================
--- asterisk/trunk/tests/apps/page/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/page/test-config.yaml Sat Mar 10 14:21:01 2012
@@ -1,0 +1,18 @@
+testinfo:
+    summary:     'Test paging'
+    description: |
+        'This test initiates multiple IAX2 calls between 2 instances of Asterisk.
+        Both ends connect to a FastAGI server implemented in the test script.
+        The FastAGI server instructs playback, paging, and waiting to occur.'
+
+properties:
+    minversion: '10'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'app_page'
+        - asterisk : 'app_playback'
+        - asterisk : 'app_amd'
+    tags:
+        - page
+        - apps

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

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

Propchange: asterisk/trunk/tests/apps/page/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/apps/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/tests.yaml?view=diff&rev=3087&r1=3086&r2=3087
==============================================================================
--- asterisk/trunk/tests/apps/tests.yaml (original)
+++ asterisk/trunk/tests/apps/tests.yaml Sat Mar 10 14:21:01 2012
@@ -5,4 +5,5 @@
     - test: 'directory_attendant_exit'
     - dir: 'voicemail'
     - dir: 'incomplete'
-    - dir: 'confbridge'
+    - dir: 'confbridge'
+    - test: 'page'




More information about the asterisk-commits mailing list