[asterisk-commits] twilson: testsuite/asterisk/trunk r269 - in /asterisk/trunk: lib/python/aster...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 29 17:48:07 CDT 2010
Author: twilson
Date: Thu Apr 29 17:48:03 2010
New Revision: 269
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=269
Log:
Add CDR tests
Added:
asterisk/trunk/lib/python/asterisk/ami.py (with props)
asterisk/trunk/tests/cdr/cdr_unanswered_yes/
asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/
asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf (with props)
asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf (with props)
asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf (with props)
asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf (with props)
asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test (with props)
asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml (with props)
asterisk/trunk/tests/cdr/cdr_userfield/
asterisk/trunk/tests/cdr/cdr_userfield/configs/
asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf (with props)
asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf (with props)
asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf (with props)
asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf (with props)
asterisk/trunk/tests/cdr/cdr_userfield/run-test (with props)
asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/
asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/run-test (with props)
asterisk/trunk/tests/cdr/console_dial_sip_answer/test-config.yaml (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs1/
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs1/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs1/manager.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs1/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs2/
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs2/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs2/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs_common/
asterisk/trunk/tests/cdr/console_dial_sip_busy/configs_common/logger.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/run-test (with props)
asterisk/trunk/tests/cdr/console_dial_sip_busy/test-config.yaml (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs1/
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs1/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs1/manager.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs1/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs2/
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs2/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs2/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs_common/
asterisk/trunk/tests/cdr/console_dial_sip_congestion/configs_common/logger.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/run-test (with props)
asterisk/trunk/tests/cdr/console_dial_sip_congestion/test-config.yaml (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs1/
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs1/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs1/manager.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs1/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs2/
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs2/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs2/sip.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs_common/
asterisk/trunk/tests/cdr/console_dial_sip_transfer/configs_common/logger.conf (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/run-test (with props)
asterisk/trunk/tests/cdr/console_dial_sip_transfer/test-config.yaml (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs1/
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs1/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs1/manager.conf (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs1/sip.conf (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs2/
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs2/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs2/sip.conf (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs_common/
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/configs_common/logger.conf (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/run-test (with props)
asterisk/trunk/tests/cdr/console_fork_after_busy_forward/test-config.yaml (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/
asterisk/trunk/tests/cdr/console_fork_before_dial/configs1/
asterisk/trunk/tests/cdr/console_fork_before_dial/configs1/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/configs1/manager.conf (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/configs1/sip.conf (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/configs2/
asterisk/trunk/tests/cdr/console_fork_before_dial/configs2/extensions.conf (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/configs2/sip.conf (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/configs_common/
asterisk/trunk/tests/cdr/console_fork_before_dial/configs_common/logger.conf (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/run-test (with props)
asterisk/trunk/tests/cdr/console_fork_before_dial/test-config.yaml (with props)
asterisk/trunk/tests/cdr/nocdr/
asterisk/trunk/tests/cdr/nocdr/configs/
asterisk/trunk/tests/cdr/nocdr/configs/cdr.conf (with props)
asterisk/trunk/tests/cdr/nocdr/configs/extensions.conf (with props)
asterisk/trunk/tests/cdr/nocdr/configs/logger.conf (with props)
asterisk/trunk/tests/cdr/nocdr/configs/manager.conf (with props)
asterisk/trunk/tests/cdr/nocdr/run-test (with props)
asterisk/trunk/tests/cdr/nocdr/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/tests.yaml
Added: asterisk/trunk/lib/python/asterisk/ami.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/ami.py?view=auto&rev=269
==============================================================================
--- asterisk/trunk/lib/python/asterisk/ami.py (added)
+++ asterisk/trunk/lib/python/asterisk/ami.py Thu Apr 29 17:48:03 2010
@@ -1,0 +1,40 @@
+from twisted.internet import reactor, protocol
+from starpy import manager
+import datetime
+import sys
+
+class AMI:
+ def __init__(self, on_login, on_error, timeout=60, user="mark", secret="mysecret", host="127.0.0.1", port=5038):
+ self.on_login = on_login
+ self.on_error = on_error
+ self.login_timeout = timeout
+ self.user = user
+ self.secret = secret
+ self.host = host
+ self.port = port
+ self.__attempts = 0
+ self.__start = None
+ self.ami_factory = manager.AMIFactory(self.user, self.secret)
+
+ def login(self):
+ self.__attempts = self.__attempts + 1
+ print "AMI Login attempt #%d" % (self.__attempts)
+ if not self.__start:
+ self.__start = datetime.datetime.now()
+ self.ami_factory.login(self.host, self.port).addCallbacks(self.on_login_success, self.on_login_error)
+
+ def on_login_success(self, ami):
+ self.ami = ami
+ print "AMI Login succesful"
+ return self.on_login(ami)
+
+ def on_login_error(self, reason):
+ runtime = (datetime.datetime.now() - self.__start).seconds
+ if runtime >= self.login_timeout:
+ print "AMI login failed after %d second timeout" % (self.login_timeout)
+ return self.on_error()
+ delay = 2 ** self.__attempts
+ if delay + runtime >= self.login_timeout:
+ delay = self.login_timeout - runtime
+ reactor.callLater(delay, self.login)
+
Propchange: asterisk/trunk/lib/python/asterisk/ami.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/lib/python/asterisk/ami.py
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/lib/python/asterisk/ami.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,7 @@
+[general]
+unanswered=yes
+[csv]
+usegmtime=yes ; log date/time in GMT. Default is "no"
+loguniqueid=yes ; log uniqueid. Default is "no"
+loguserfield=yes ; log user field. Default is "no"
+
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/cdr.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,8 @@
+[general]
+writeprotect=no
+clearglobalvars=no
+
+[globals]
+
+[default]
+exten => 1,1,Hangup
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,11 @@
+[general]
+[logfiles]
+;console => notice,warning,error
+;console => notice,warning,error,debug
+;messages => notice,warning,error
+full => notice,warning,error,debug,verbose
+
+;syslog keyword : This special keyword logs to syslog facility
+;
+;syslog.local0 => notice,warning,error
+;
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/logger.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,10 @@
+[general]
+enabled = yes
+port = 5038
+bindaddr = 0.0.0.0
+
+[mark]
+secret = mysecret
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
+
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/configs/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test (added)
+++ asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test Thu Apr 29 17:48:03 2010
@@ -1,0 +1,73 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+Terry Wilson <twilson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+from time import sleep
+import os
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.cdr import AsteriskCSVCDR, AsteriskCSVCDRLine
+from asterisk.ami import AMI
+from twisted.internet import reactor
+import logging
+
+workingdir = "/tmp/asterisk-testsuite/cdr_unanswered_yes"
+testdir = "tests/cdr/cdr_unanswered_yes"
+
+class Test:
+ def __init__(self):
+ self.passed = False
+ asterisk1 = Asterisk(base=workingdir)
+ asterisk1.install_config("%s/configs/manager.conf" % (testdir))
+ asterisk1.install_config("%s/configs/extensions.conf" % (testdir))
+ asterisk1.install_config("%s/configs/logger.conf" % (testdir))
+ asterisk1.install_config("%s/configs/cdr.conf" % (testdir))
+
+ asterisk1.start()
+ self.asterisk1 = asterisk1
+ self.ami = AMI(self.start, self.abort, timeout=20)
+ self.ami.login()
+
+ def start(self, ami):
+ ami.registerEvent('Hangup', self.end)
+ self.asterisk1.cli_exec("console dial 1 at default")
+
+ def stop_asterisk(self):
+ self.asterisk1.stop()
+
+ def abort(self):
+ self.stop_asterisk()
+ reactor.stop()
+
+ def end(self, ami, event):
+ self.stop_asterisk()
+ cdr1 = AsteriskCSVCDR(fn="%s/var/log/asterisk/cdr-csv/Master.csv" % (self.asterisk1.base))
+
+ cdr1_expect = AsteriskCSVCDR(records=[AsteriskCSVCDRLine(accountcode="",
+ source="", destination="1", dcontext="default", callerid="",
+ channel="Console/dsp", dchannel="", lastapp="Hangup", lastarg="",
+ disposition="NO ANSWER", amaflags="DOCUMENTATION")])
+
+ if cdr1_expect.match(cdr1):
+ print "Success"
+ self.passed = True
+ else:
+ print "Failure"
+
+ reactor.stop()
+
+
+def main():
+ logging.basicConfig()
+ test = Test()
+ reactor.run()
+ return not test.passed
+
+if __name__ == '__main__':
+ sys.exit(main())
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml (added)
+++ asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml Thu Apr 29 17:48:03 2010
@@ -1,0 +1,11 @@
+testinfo:
+ summary: 'Test the unanswered=yes cdr.conf option'
+ description: |
+ 'Do a simple unanswered call and check for a CDR'
+
+properties:
+ minversion: '1.4'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_unanswered_yes/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,6 @@
+[general]
+[csv]
+usegmtime=yes ; log date/time in GMT. Default is "no"
+loguniqueid=yes ; log uniqueid. Default is "no"
+loguserfield=yes ; log user field. Default is "no"
+
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/cdr.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,10 @@
+[general]
+writeprotect=no
+clearglobalvars=no
+
+[globals]
+
+[default]
+exten => 1,1,Answer
+exten => 1,n,Set(CDR(userfield)=bazinga)
+exten => 1,n,Hangup
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,11 @@
+[general]
+[logfiles]
+;console => notice,warning,error
+;console => notice,warning,error,debug
+;messages => notice,warning,error
+full => notice,warning,error,debug,verbose
+
+;syslog keyword : This special keyword logs to syslog facility
+;
+;syslog.local0 => notice,warning,error
+;
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/logger.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf (added)
+++ asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,10 @@
+[general]
+enabled = yes
+port = 5038
+bindaddr = 0.0.0.0
+
+[mark]
+secret = mysecret
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
+
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/configs/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_userfield/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_userfield/run-test?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_userfield/run-test (added)
+++ asterisk/trunk/tests/cdr/cdr_userfield/run-test Thu Apr 29 17:48:03 2010
@@ -1,0 +1,74 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+Terry Wilson <twilson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+from time import sleep
+import os
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.cdr import AsteriskCSVCDR, AsteriskCSVCDRLine
+from asterisk.ami import AMI
+from twisted.internet import reactor
+import logging
+
+workingdir = "/tmp/asterisk-testsuite/cdr_userfield"
+testdir = "tests/cdr/cdr_userfield"
+
+class Test:
+ def __init__(self):
+ self.passed = False
+ asterisk1 = Asterisk(base=workingdir)
+ asterisk1.install_config("%s/configs/manager.conf" % (testdir))
+ asterisk1.install_config("%s/configs/extensions.conf" % (testdir))
+ asterisk1.install_config("%s/configs/logger.conf" % (testdir))
+ asterisk1.install_config("%s/configs/cdr.conf" % (testdir))
+
+ asterisk1.start()
+
+ self.asterisk1 = asterisk1
+ self.ami = AMI(self.start, self.abort, timeout=20)
+ self.ami.login()
+
+ def start(self, ami):
+ ami.registerEvent('Hangup', self.end)
+ self.asterisk1.cli_exec("console dial 1 at default")
+
+ def stop_asterisk(self):
+ self.asterisk1.stop()
+
+ def abort(self):
+ self.stop_asterisk()
+ reactor.stop()
+
+ def end(self, ami, event):
+ self.stop_asterisk()
+ cdr1 = AsteriskCSVCDR(fn="%s/var/log/asterisk/cdr-csv/Master.csv" % (self.asterisk1.base))
+
+ cdr1_expect = AsteriskCSVCDR(records=[AsteriskCSVCDRLine(accountcode="",
+ source="", destination="1", dcontext="default", callerid="",
+ channel="Console/dsp", dchannel="", lastapp="Hangup", lastarg="",
+ disposition="ANSWERED", amaflags="DOCUMENTATION", userfield="bazinga")])
+
+ if cdr1_expect.match(cdr1):
+ print "Success"
+ self.passed = True
+ else:
+ print "Failure"
+
+ reactor.stop()
+
+
+def main():
+ logging.basicConfig()
+ test = Test()
+ reactor.run()
+ return not test.passed
+
+if __name__ == '__main__':
+ sys.exit(main())
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml (added)
+++ asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml Thu Apr 29 17:48:03 2010
@@ -1,0 +1,10 @@
+testinfo:
+ summary: 'Test that Set(CDR(userfield)=...) works'
+ description: |
+ 'Test that the setting the userfield field in the CDR works'
+
+properties:
+ minversion: '1.4'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/cdr_userfield/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf (added)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,8 @@
+[general]
+writeprotect=no
+clearglobalvars=no
+
+[globals]
+
+[default]
+exten => 1,1,Dial(SIP/1 at test)
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf (added)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,10 @@
+[general]
+enabled = yes
+port = 5038
+bindaddr = 0.0.0.0
+
+[mark]
+secret = mysecret
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
+
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf (added)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,12 @@
+[general]
+context=default
+bindaddr=0.0.0.0
+bindport=5065
+
+[test]
+type=peer
+host=127.0.0.1
+port=5070
+canreinvite=no
+disallow=all
+allow=ulaw
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs1/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf (added)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,10 @@
+[general]
+writeprotect=no
+clearglobalvars=no
+
+[globals]
+
+[default]
+exten => 1,1,Answer
+exten => 1,n,Wait(5)
+exten => 1,n,Hangup
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf (added)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,4 @@
+[general]
+context=default
+bindaddr=0.0.0.0
+bindport=5070
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs2/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf (added)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf Thu Apr 29 17:48:03 2010
@@ -1,0 +1,11 @@
+[general]
+[logfiles]
+;console => notice,warning,error
+;console => notice,warning,error,debug
+;messages => notice,warning,error
+full => notice,warning,error,debug,verbose
+
+;syslog keyword : This special keyword logs to syslog facility
+;
+;syslog.local0 => notice,warning,error
+;
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/cdr/console_dial_sip_answer/configs_common/logger.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/cdr/console_dial_sip_answer/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/cdr/console_dial_sip_answer/run-test?view=auto&rev=269
==============================================================================
--- asterisk/trunk/tests/cdr/console_dial_sip_answer/run-test (added)
+++ asterisk/trunk/tests/cdr/console_dial_sip_answer/run-test Thu Apr 29 17:48:03 2010
@@ -1,0 +1,92 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+Terry Wilson <twilson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+from time import sleep
+import os
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.cdr import AsteriskCSVCDR, AsteriskCSVCDRLine
+from asterisk.ami import AMI
+from twisted.internet import reactor
+import logging
+
+workingdir = "/tmp/testsuite/console_dial_sip_answer"
+testdir = "tests/cdr/console_dial_sip_answer"
+
+class Test:
+ def __init__(self):
+ self.passed = False
+ asterisk1 = Asterisk(base=workingdir)
+ asterisk1.install_config("%s/configs1/sip.conf" % (testdir))
+ asterisk1.install_config("%s/configs1/extensions.conf" % (testdir))
+ asterisk1.install_config("%s/configs1/manager.conf" % (testdir))
+ asterisk1.install_config("%s/configs_common/logger.conf" % (testdir))
+
+ asterisk2 = Asterisk(base=workingdir)
+ asterisk2.install_config("%s/configs2/sip.conf" % (testdir))
+ asterisk2.install_config("%s/configs2/extensions.conf" % (testdir))
+
+ asterisk2.install_config("%s/configs_common/logger.conf" % (testdir))
+
+ asterisk1.start()
+ asterisk2.start()
+ self.asterisk1 = asterisk1
+ self.asterisk2 = asterisk2
+ self.ami = AMI(self.start, self.abort, timeout=20)
+ self.ami.login()
+
+ def start(self, ami):
+ ami.registerEvent('Hangup', self.end)
+ self.asterisk1.cli_exec("console dial 1 at default")
+
+ def stop_asterisk(self):
+ self.asterisk1.stop()
+ self.asterisk2.stop()
+
+ def abort(self):
+ self.stop_asterisk()
+ reactor.stop()
+
+ def end(self, ami, event):
+ if event.get("channel").lower() != "console/dsp":
+ return
+ self.stop_asterisk()
+
+ cdr1 = AsteriskCSVCDR(fn="%s/var/log/asterisk/cdr-csv/Master.csv" % (self.asterisk1.base))
+ cdr2 = AsteriskCSVCDR(fn="%s/var/log/asterisk/cdr-csv/Master.csv" % (self.asterisk2.base))
+
+ cdr1_expect = AsteriskCSVCDR(records=[AsteriskCSVCDRLine(accountcode="",
+ source="", destination="1", dcontext="default", callerid="",
+ channel="Console/dsp", dchannel="SIP/test-00000000", lastapp="Dial",
+ lastarg="SIP/1 at test", disposition="ANSWERED",
+ amaflags="DOCUMENTATION")])
+ cdr2_expect = AsteriskCSVCDR(records=[AsteriskCSVCDRLine(accountcode="",
+ source="asterisk", destination="1", dcontext="default",
+ callerid='"asterisk" <asterisk>', channel="SIP/.*5065-.*",
+ dchannel="", lastapp="Hangup", lastarg="", disposition="ANSWERED",
+ amaflags="DOCUMENTATION")])
+
+ if cdr1_expect.match(cdr1) and cdr2_expect.match(cdr2):
+ print "Success"
+ self.passed = True
+ else:
+ print "Failure"
+
+ reactor.stop()
+
+
+def main():
+ logging.basicConfig()
+ test = Test()
+ reactor.run()
+ return not test.passed
+
+if __name__ == '__main__':
+ sys.exit(main())
[... 1891 lines stripped ...]
More information about the asterisk-commits
mailing list