[asterisk-commits] mmichelson: testsuite/asterisk/trunk r558 - in /asterisk/trunk: ./ tests/ tes...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 23 10:35:03 CDT 2010


Author: mmichelson
Date: Fri Jul 23 10:34:59 2010
New Revision: 558

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=558
Log:
New set of tests that exercise IPv6 support in Asterisk.

* sip_attended_transfer_v6
* sip_one_legged_transfer_v6
* sip_register
* udptl
* udptl_v6

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


Added:
    asterisk/trunk/tests/sip_attended_transfer_v6/
    asterisk/trunk/tests/sip_attended_transfer_v6/configs/
    asterisk/trunk/tests/sip_attended_transfer_v6/configs/extensions.conf   (with props)
    asterisk/trunk/tests/sip_attended_transfer_v6/configs/manager.conf   (with props)
    asterisk/trunk/tests/sip_attended_transfer_v6/configs/sip.conf   (with props)
    asterisk/trunk/tests/sip_attended_transfer_v6/run-test   (with props)
    asterisk/trunk/tests/sip_attended_transfer_v6/test-config.yaml   (with props)
    asterisk/trunk/tests/sip_one_legged_transfer_v6/
    asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/
    asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/extensions.conf   (with props)
    asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf   (with props)
    asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf   (with props)
    asterisk/trunk/tests/sip_one_legged_transfer_v6/run-test   (with props)
    asterisk/trunk/tests/sip_one_legged_transfer_v6/test-config.yaml   (with props)
    asterisk/trunk/tests/sip_register/
    asterisk/trunk/tests/sip_register/configs/
    asterisk/trunk/tests/sip_register/configs/manager.conf   (with props)
    asterisk/trunk/tests/sip_register/configs/sip.conf   (with props)
    asterisk/trunk/tests/sip_register/run-test   (with props)
    asterisk/trunk/tests/sip_register/sipp/
    asterisk/trunk/tests/sip_register/sipp/registerv4.xml   (with props)
    asterisk/trunk/tests/sip_register/sipp/registerv6.xml   (with props)
    asterisk/trunk/tests/sip_register/test-config.yaml   (with props)
    asterisk/trunk/tests/udptl/
    asterisk/trunk/tests/udptl/1page.tif   (with props)
    asterisk/trunk/tests/udptl/configs1/
    asterisk/trunk/tests/udptl/configs1/logger.conf   (with props)
    asterisk/trunk/tests/udptl/configs1/manager.conf   (with props)
    asterisk/trunk/tests/udptl/configs1/sip.conf   (with props)
    asterisk/trunk/tests/udptl/configs2/
    asterisk/trunk/tests/udptl/configs2/extensions.conf   (with props)
    asterisk/trunk/tests/udptl/configs2/logger.conf   (with props)
    asterisk/trunk/tests/udptl/configs2/manager.conf   (with props)
    asterisk/trunk/tests/udptl/configs2/sip.conf   (with props)
    asterisk/trunk/tests/udptl/run-test   (with props)
    asterisk/trunk/tests/udptl/test-config.yaml   (with props)
    asterisk/trunk/tests/udptl_v6/
    asterisk/trunk/tests/udptl_v6/1page.tif   (with props)
    asterisk/trunk/tests/udptl_v6/configs1/
    asterisk/trunk/tests/udptl_v6/configs1/logger.conf   (with props)
    asterisk/trunk/tests/udptl_v6/configs1/manager.conf   (with props)
    asterisk/trunk/tests/udptl_v6/configs1/sip.conf   (with props)
    asterisk/trunk/tests/udptl_v6/configs2/
    asterisk/trunk/tests/udptl_v6/configs2/extensions.conf   (with props)
    asterisk/trunk/tests/udptl_v6/configs2/logger.conf   (with props)
    asterisk/trunk/tests/udptl_v6/configs2/manager.conf   (with props)
    asterisk/trunk/tests/udptl_v6/configs2/sip.conf   (with props)
    asterisk/trunk/tests/udptl_v6/run-test   (with props)
    asterisk/trunk/tests/udptl_v6/test-config.yaml   (with props)
Modified:
    asterisk/trunk/   (props changed)
    asterisk/trunk/README.txt
    asterisk/trunk/runtests.py
    asterisk/trunk/tests/sip_attended_transfer/run-test
    asterisk/trunk/tests/sip_one_legged_transfer/run-test
    asterisk/trunk/tests/tests.yaml

Propchange: asterisk/trunk/
------------------------------------------------------------------------------
    automerge = *

Propchange: asterisk/trunk/
------------------------------------------------------------------------------
    automerge-email = mmichelson at digium.com

Propchange: asterisk/trunk/
------------------------------------------------------------------------------
    svnmerge-integrated = /asterisk/trunk:1-542

Modified: asterisk/trunk/README.txt
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/README.txt?view=diff&rev=558&r1=557&r2=558
==============================================================================
--- asterisk/trunk/README.txt (original)
+++ asterisk/trunk/README.txt Fri Jul 23 10:34:59 2010
@@ -124,6 +124,14 @@
               pjsip-apps/bin/ directory to 'pjsua', and place the 'pjsua'
               executable into a directory located in the execution path.
               $ cp pjsip-apps/bin/pjsua-x86-unknown-linux-gnu /usr/sbin/pjsua 
+	    - pjsuav6
+            - If you require IPv6 support in pjsua, then after running
+              the configure script, open the pjlib/include/pj/config_site.h
+              file in the pjsip source and add the line
+
+              #define PJ_HAS_IPV6 1
+
+              before running the `make dep && make` command.
 
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------

Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=558&r1=557&r2=558
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Fri Jul 23 10:34:59 2010
@@ -89,6 +89,20 @@
         except:
             return False
 
+    def depend_pjsuav6(self):
+        '''
+        This tests if pjsua was compiled with IPv6 support. To do this,
+        we run pjsua --help and parse the output to determine if --ipv6
+        is a valid option
+        '''
+        if self.__which('pjsua') is None:
+            return False
+
+        help_output = subprocess.check_output(['pjsua', '--help'])
+        if help_output.find('--ipv6') == -1:
+            return False
+        return True
+
     def depend_fax(self):
         fax_providers = [
             "app_fax.so",

Modified: asterisk/trunk/tests/sip_attended_transfer/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_attended_transfer/run-test?view=diff&rev=558&r1=557&r2=558
==============================================================================
--- asterisk/trunk/tests/sip_attended_transfer/run-test (original)
+++ asterisk/trunk/tests/sip_attended_transfer/run-test Fri Jul 23 10:34:59 2010
@@ -71,17 +71,15 @@
 
     def checkBridgeResult(self, result):
         print 'Result', result
-        try:
-            if result[0]['bridgedchannel'] == 'SIP/end_b-00000001':
-                self.passed = True
-        except KeyError:
+        if "bridgedchannel" not in result[0]:
             print "bridgedchannel was not a valid key."
+        elif result[0]['bridgedchannel'] == 'SIP/end_b-00000001':
+            self.passed = True
 
-        try:
-            if result[0]['link'] == 'SIP/end_b-00000001': # check link for older versions of asterisk
-                self.passed = True
-        except KeyError:
+        if "link" not in result[0]:
             print "'link' was not a valid key."
+        elif result[0]['link'] == 'SIP/end_b-00000001': # check link for older versions of asterisk
+            self.passed = True
 
         if self.passed == True:
             self.logLastStep("Found Bridge!!!")
@@ -115,9 +113,17 @@
     def startProcesses(self):
         self.logLastStep("Starting Processes")
         self.asterisk.start()
-        self.pja = subprocess.Popen(['pjsua', '--local-port=5065', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE)
-        self.pjb = subprocess.Popen(['pjsua', '--local-port=5066', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-        self.pjc = subprocess.Popen(['pjsua', '--local-port=5067', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+        self.pja = subprocess.Popen(['pjsua', '--local-port=5065',
+                                     '--auto-answer=200', '--null-audio'],
+                                     stdin=subprocess.PIPE)
+        self.pjb = subprocess.Popen(['pjsua', '--local-port=5066',
+                                     '--auto-answer=200', '--null-audio'],
+                                     stdin=subprocess.PIPE,
+                                     stdout=subprocess.PIPE)
+        self.pjc = subprocess.Popen(['pjsua', '--local-port=5067',
+                                     '--auto-answer=200', '--null-audio'],
+                                     stdin=subprocess.PIPE,
+                                     stdout=subprocess.PIPE)
 
     def stopProcesses(self):
         self.logLastStep("Stopping Processes")

Added: asterisk/trunk/tests/sip_attended_transfer_v6/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_attended_transfer_v6/configs/extensions.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_attended_transfer_v6/configs/extensions.conf (added)
+++ asterisk/trunk/tests/sip_attended_transfer_v6/configs/extensions.conf Fri Jul 23 10:34:59 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/trunk/tests/sip_attended_transfer_v6/configs/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: asterisk/trunk/tests/sip_attended_transfer_v6/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_attended_transfer_v6/configs/manager.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_attended_transfer_v6/configs/manager.conf (added)
+++ asterisk/trunk/tests/sip_attended_transfer_v6/configs/manager.conf Fri Jul 23 10:34:59 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/trunk/tests/sip_attended_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_attended_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip_attended_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip_attended_transfer_v6/configs/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_attended_transfer_v6/configs/sip.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_attended_transfer_v6/configs/sip.conf (added)
+++ asterisk/trunk/tests/sip_attended_transfer_v6/configs/sip.conf Fri Jul 23 10:34:59 2010
@@ -1,0 +1,30 @@
+[general]
+directmedia=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/trunk/tests/sip_attended_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_attended_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip_attended_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip_attended_transfer_v6/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_attended_transfer_v6/run-test?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_attended_transfer_v6/run-test (added)
+++ asterisk/trunk/tests/sip_attended_transfer_v6/run-test Fri Jul 23 10:34:59 2010
@@ -1,0 +1,169 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+David Vossel <dvossel at digium.com>
+Mark Michelson <mmichelson 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
+        if "bridgedchannel" not in result[0]:
+            print "bridgedchannel was not a valid key."
+        elif result[0]['bridgedchannel'] == 'SIP/end_b-00000001':
+            self.passed = True
+
+        if "link" not in result[0]:
+            print "'link' was not a valid key."
+        elif result[0]['link'] == 'SIP/end_b-00000001': # check link for older versions of asterisk
+            self.passed = True
+
+        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/trunk/tests/sip_attended_transfer_v6/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_attended_transfer_v6/run-test
------------------------------------------------------------------------------
    svn:executable = *

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

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

Added: asterisk/trunk/tests/sip_attended_transfer_v6/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_attended_transfer_v6/test-config.yaml?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_attended_transfer_v6/test-config.yaml (added)
+++ asterisk/trunk/tests/sip_attended_transfer_v6/test-config.yaml Fri Jul 23 10:34:59 2010
@@ -1,0 +1,13 @@
+testinfo:
+    summary:     'Test SIP Attended Transfer'
+    description: |
+        'This test verifies the SIP_REFER with Replaces attended transfer routine.'
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - app : 'pjsua'
+        - custom : 'ipv6'
+        - custom : 'pjsuav6'

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

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

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

Modified: asterisk/trunk/tests/sip_one_legged_transfer/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_one_legged_transfer/run-test?view=diff&rev=558&r1=557&r2=558
==============================================================================
--- asterisk/trunk/tests/sip_one_legged_transfer/run-test (original)
+++ asterisk/trunk/tests/sip_one_legged_transfer/run-test Fri Jul 23 10:34:59 2010
@@ -71,18 +71,16 @@
 
     def checkBridgeResult(self, result):
         print 'Result', result
-        try:
-            if result[0]['bridgedchannel'] == 'SIP/end_a-00000001':
-                self.passed = True
-        except KeyError:
+        if "bridgedchannel" not in result[0]:
             print "bridgedchannel was not a valid key."
+        elif result[0]['bridgedchannel'] == 'SIP/end_b-00000001':
+            self.passed = True
 
-        try:
-            if result[0]['link'] == 'SIP/end_a-00000001': # check link for older versions of asterisk
-                self.passed = True
-        except KeyError:
+        if "link" not in result[0]:
             print "'link' was not a valid key."
-
+        elif result[0]['link'] == 'SIP/end_b-00000001': # check link for older versions of asterisk
+            self.passed = True
+        
         if self.passed == True:
             self.logLastStep("Found Bridge!!!")
         else:
@@ -116,9 +114,18 @@
     def startProcesses(self):
         self.logLastStep("Starting Processes")
         self.asterisk.start()
-        self.pja = subprocess.Popen(['pjsua', '--local-port=5065', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-        self.pjb = subprocess.Popen(['pjsua', '--local-port=5066', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-        self.pjc = subprocess.Popen(['pjsua', '--local-port=5067', '--auto-answer=200', '--null-audio'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+        self.pja = subprocess.Popen(['pjsua', '--local-port=5065',
+                                     '--auto-answer=200', '--null-audio'],
+                                     stdin=subprocess.PIPE,
+                                     stdout=subprocess.PIPE)
+        self.pjb = subprocess.Popen(['pjsua', '--local-port=5066',
+                                     '--auto-answer=200', '--null-audio'],
+                                     stdin=subprocess.PIPE,
+                                     stdout=subprocess.PIPE)
+        self.pjc = subprocess.Popen(['pjsua', '--local-port=5067',
+                                     '--auto-answer=200', '--null-audio'],
+                                     stdin=subprocess.PIPE,
+                                     stdout=subprocess.PIPE)
 
     def stopProcesses(self):
         self.logLastStep("Stopping Processes")

Added: asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/extensions.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/extensions.conf (added)
+++ asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/extensions.conf Fri Jul 23 10:34:59 2010
@@ -1,0 +1,6 @@
+[general]
+
+[globals]
+
+[transfertest]
+exten => call_a,1,Dial(SIP/end_a)

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

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

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

Added: asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf (added)
+++ asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf Fri Jul 23 10:34:59 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/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/manager.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf (added)
+++ asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf Fri Jul 23 10:34:59 2010
@@ -1,0 +1,30 @@
+[general]
+directmedia=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/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip_one_legged_transfer_v6/configs/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip_one_legged_transfer_v6/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_one_legged_transfer_v6/run-test?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_one_legged_transfer_v6/run-test (added)
+++ asterisk/trunk/tests/sip_one_legged_transfer_v6/run-test Fri Jul 23 10:34:59 2010
@@ -1,0 +1,172 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+David Vossel <dvossel at digium.com>
+Mark Michelson <mmichelson 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_one_legged_transfer_v6")
+        self.asterisk.install_config("tests/sip_one_legged_transfer_v6/configs/extensions.conf")
+        self.asterisk.install_config("tests/sip_one_legged_transfer_v6/configs/sip.conf")
+        self.asterisk.install_config("tests/sip_one_legged_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
+        if "bridgedchannel" not in result[0]:
+            print "bridgedchannel was not a valid key."
+        elif result[0]['bridgedchannel'] == 'SIP/end_b-00000001':
+            self.passed = True
+
+        if "link" not in result[0]:
+            print "'link' was not a valid key."
+        elif result[0]['link'] == 'SIP/end_b-00000001': # check link for older versions of asterisk
+            self.passed = True
+        
+        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-00000002').addCallbacks(self.checkBridgeResult, self.checkBridgeError)
+
+    def cCallB(self):
+        self.logLastStep("C Calling B")
+        self.pjc.stdin.write("m\n")
+        self.pjc.stdin.write("sip:[::1]:5066\n")
+
+    def bCallA(self):
+        self.logLastStep("B Calling A")
+        self.pjb.stdin.write("m\n")
+        self.pjb.stdin.write("sip:call_a@[::1]:5060\n")
+
+    def bTransferAToC(self):
+        self.logLastStep("B Transfering A to C")
+        self.pjb.stdin.write("X\n")
+        self.pjb.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,
+                                     stdout=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.cCallB)
+        reactor.callLater(10, self.bCallA)
+        reactor.callLater(15, self.bTransferAToC)
+        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/trunk/tests/sip_one_legged_transfer_v6/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_one_legged_transfer_v6/run-test
------------------------------------------------------------------------------
    svn:executable = *

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

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

Added: asterisk/trunk/tests/sip_one_legged_transfer_v6/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_one_legged_transfer_v6/test-config.yaml?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_one_legged_transfer_v6/test-config.yaml (added)
+++ asterisk/trunk/tests/sip_one_legged_transfer_v6/test-config.yaml Fri Jul 23 10:34:59 2010
@@ -1,0 +1,13 @@
+testinfo:
+    summary:     'Test SIP One-legged Transfer'
+    description: |
+        'This test verifies a SIP One-legged transfer.'
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - app : 'pjsua'
+        - custom: 'ipv6'
+        - custom: 'pjsuav6'

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

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

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

Added: asterisk/trunk/tests/sip_register/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_register/configs/manager.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_register/configs/manager.conf (added)
+++ asterisk/trunk/tests/sip_register/configs/manager.conf Fri Jul 23 10:34:59 2010
@@ -1,0 +1,9 @@
+[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/trunk/tests/sip_register/configs/manager.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_register/configs/manager.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip_register/configs/manager.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip_register/configs/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_register/configs/sip.conf?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_register/configs/sip.conf (added)
+++ asterisk/trunk/tests/sip_register/configs/sip.conf Fri Jul 23 10:34:59 2010
@@ -1,0 +1,10 @@
+[general]
+bindaddr=[::]:5060
+
+[v4-in]
+type=friend
+host=dynamic
+
+[v6-in]
+type=friend
+host=dynamic

Propchange: asterisk/trunk/tests/sip_register/configs/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/sip_register/configs/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/sip_register/configs/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/sip_register/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/sip_register/run-test?view=auto&rev=558
==============================================================================
--- asterisk/trunk/tests/sip_register/run-test (added)
+++ asterisk/trunk/tests/sip_register/run-test Fri Jul 23 10:34:59 2010
@@ -1,0 +1,131 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+Mark Michelson <mmichelson 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
+

[... 1017 lines stripped ...]



More information about the asterisk-commits mailing list