[asterisk-commits] mmichelson: branch mmichelson/v6tests r479 - in /asterisk/team/mmichelson/v6t...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 12 10:18:41 CDT 2010
Author: mmichelson
Date: Mon Jul 12 10:18:37 2010
New Revision: 479
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=479
Log:
Add SIP attended transfer test for IPv6.
This is pretty much a copy and paste job of the original
sip_attended_transfer test but with addresses changed to
IPv6 for all SIP goings-on.
Added:
asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/
asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/
asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf (with props)
asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf (with props)
asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf (with props)
asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test (with props)
asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml (with props)
Added: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf?view=auto&rev=479
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf Mon Jul 12 10:18:37 2010
@@ -1,0 +1,9 @@
+[general]
+
+[globals]
+
+[transfertest]
+exten => call_b,1,Dial(SIP/end_b)
+exten => call_c,1,Dial(SIP/end_c)
+
+
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf?view=auto&rev=479
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf Mon Jul 12 10:18:37 2010
@@ -1,0 +1,10 @@
+[general]
+enabled = yes
+port = 5038
+bindaddr = 127.0.0.1
+
+[user]
+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/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf?view=auto&rev=479
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf Mon Jul 12 10:18:37 2010
@@ -1,0 +1,30 @@
+[general]
+canreinvite=no
+bindaddr=[::1]:5060
+
+[end_a]
+context=transfertest
+type=friend
+host=::1
+port=5065
+insecure=invite
+disallow=all
+allow=ulaw
+
+[end_b]
+context=transfertest
+type=friend
+host=::1
+port=5066
+insecure=invite
+disallow=all
+allow=ulaw
+
+[end_c]
+context=transfertest
+type=friend
+host=::1
+port=5067
+insecure=invite
+disallow=all
+allow=ulaw
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test?view=auto&rev=479
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test Mon Jul 12 10:18:37 2010
@@ -1,0 +1,162 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+David Vossel <dvossel at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import signal
+import subprocess
+from optparse import OptionParser
+from twisted.application import service, internet
+from twisted.internet import reactor, defer
+from starpy import manager
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.version import AsteriskVersion
+
+class AttTransferTest:
+ def __init__(self, argv):
+ self.last_step = ""
+ self.passed = False
+
+ # get version info
+ parser = OptionParser()
+ parser.add_option("-v", "--version", dest="ast_version",
+ help="Asterisk version string")
+ (options, args) = parser.parse_args(argv)
+ self.ast_version = AsteriskVersion(options.ast_version)
+
+ reactor.callWhenRunning(self.run)
+
+ print self.ast_version
+ self.asterisk = Asterisk(base="/tmp/asterisk-testsuite/sip_attended_transfer_v6")
+ self.asterisk.install_config("tests/sip_attended_transfer_v6/configs/extensions.conf")
+ self.asterisk.install_config("tests/sip_attended_transfer_v6/configs/sip.conf")
+ self.asterisk.install_config("tests/sip_attended_transfer_v6/configs/manager.conf")
+
+
+ def readResult(self):
+ self.logLastStep("Reading results")
+ self.asterisk.cli_exec("core show locks") # get lock output in case of deadlock before tearing down.
+ self.asterisk.cli_exec("core show channels")# if channels are still up for some reason, we want to know that as well
+ self.stopProcesses()
+
+ if self.passed == True:
+ print 'SIP Attended Transfer Test Passed!'
+ else:
+ print 'SIP Attended Transfer Test Failed'
+
+ if reactor.running:
+ print "Stopping Reactor ..."
+ reactor.stop()
+
+ def amiOnConnect(self, ami):
+ self.logLastStep("Connected to the AMI")
+ self.ami = ami
+
+ def amiLoginError(self, ami):
+ self.logLastStep("AMI login failed")
+ reactor.callLater(1, self.readResult)
+
+ def amiLogin(self):
+ self.logLastStep("Logging in to the AMI")
+ self.ami_factory = manager.AMIFactory("user", "mysecret")
+ self.ami_factory.login('127.0.0.1', 5038).addCallbacks(self.amiOnConnect, self.amiLoginError)
+
+ def checkBridgeResult(self, result):
+ print 'Result', result
+ try:
+ if result[0]['bridgedchannel'] == 'SIP/end_b-00000001':
+ self.passed = True
+ except KeyError:
+ print "bridgedchannel was not a valid key."
+
+ try:
+ if result[0]['link'] == 'SIP/end_b-00000001': # check link for older versions of asterisk
+ self.passed = True
+ except KeyError:
+ print "'link' was not a valid key."
+
+ if self.passed == True:
+ self.logLastStep("Found Bridge!!!")
+ else:
+ self.logLastStep("Detecting Bridge failed")
+
+ def checkBridgeError(self, reason):
+ print reason.getTraceback()
+ self.logLastStep("Checking Bridge failed. Channel did not exist.")
+ reactor.callLater(1, self.readResult)
+
+ def amiCheckBridge(self):
+ self.logLastStep("Get AMI results")
+ self.ami.status('SIP/end_c-00000003').addCallbacks(self.checkBridgeResult, self.checkBridgeError)
+
+ def aCallB(self):
+ self.logLastStep("A Calling B")
+ self.pja.stdin.write("m\n")
+ self.pja.stdin.write("sip:call_b@[::1]:5060\n")
+
+ def aCallC(self):
+ self.logLastStep("A Calling C")
+ self.pja.stdin.write("m\n")
+ self.pja.stdin.write("sip:call_c@[::1]:5060\n")
+
+ def aTransferBToC(self):
+ self.logLastStep("A Transfering B to C")
+ self.pja.stdin.write("X\n")
+ self.pja.stdin.write("1\n")
+
+ def startProcesses(self):
+ self.logLastStep("Starting Processes")
+ self.asterisk.start()
+ self.pja = subprocess.Popen(['pjsua', '--ipv6', '--local-port=5065', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE)
+ self.pjb = subprocess.Popen(['pjsua', '--ipv6', '--local-port=5066', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ self.pjc = subprocess.Popen(['pjsua', '--ipv6', '--local-port=5067', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+
+ def stopProcesses(self):
+ self.logLastStep("Stopping Processes")
+ self.asterisk.stop()
+ os.kill(self.pja.pid, signal.SIGKILL)
+ os.kill(self.pjb.pid, signal.SIGKILL)
+ os.kill(self.pjc.pid, signal.SIGKILL)
+
+ def logLastStep(self, step):
+ print step
+ self.lastStep = step
+
+ def run(self):
+
+ # start up the processes
+ self.startProcesses()
+
+ # call extensions
+ self.amiLogin()
+ reactor.callLater(5, self.aCallB)
+ reactor.callLater(10, self.aCallC)
+ reactor.callLater(15, self.aTransferBToC)
+ reactor.callLater(20, self.amiCheckBridge)
+
+ # stop and read results after timeout
+ reactor.callLater(25, self.readResult)
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+
+ # Run Attended Transfer Test
+ att_transfer_test = AttTransferTest(argv)
+ reactor.run()
+ att_transfer_test.stopProcesses()
+ if att_transfer_test.passed != True:
+ return 1
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
+
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml?view=auto&rev=479
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml Mon Jul 12 10:18:37 2010
@@ -1,0 +1,11 @@
+testinfo:
+ summary: 'Test SIP Attended Transfer'
+ description: |
+ 'This test verifies the SIP_REFER with Replaces attended transfer routine.'
+
+properties:
+ minversion: '1.4'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - app : 'pjsua'
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_attended_transfer_v6/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the asterisk-commits
mailing list