[asterisk-commits] kmoore: testsuite/asterisk/trunk r3469 - in /asterisk/trunk/tests/channels/SI...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 18 09:57:43 CDT 2012


Author: kmoore
Date: Tue Sep 18 09:57:37 2012
New Revision: 3469

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3469
Log:
Remove dependence on pjsua in broken situations

Previously, the PJSUA binary receiving a call would cause it to fail to
release its socket properly. This replaces the failing instances of
PJSUA with SIPp instances that handle their sockets correctly. PJSUA is
still used for the scenario in which it was working properly.

(closes issue SWP-4660)

Added:
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml   (with props)
Modified:
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/configs/ast1/sip.conf
    asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test

Modified: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/configs/ast1/sip.conf?view=diff&rev=3469&r1=3468&r2=3469
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/configs/ast1/sip.conf (original)
+++ asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/configs/ast1/sip.conf Tue Sep 18 09:57:37 2012
@@ -6,18 +6,14 @@
 [end_a]
 context=transfertest
 type=friend
-host=127.0.0.1
-port=5075
 insecure=invite
-disallow=all
-allow=ulaw
 transport=tcp
 
 [end_b]
 context=transfertest
 type=friend
 host=127.0.0.1
-port=5076
+port=5066
 insecure=invite
 disallow=all
 allow=ulaw
@@ -27,7 +23,7 @@
 context=transfertest
 type=friend
 host=127.0.0.1
-port=5077
+port=5067
 insecure=invite
 disallow=all
 allow=ulaw

Modified: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test?view=diff&rev=3469&r1=3468&r2=3469
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/run-test Tue Sep 18 09:57:37 2012
@@ -15,9 +15,11 @@
 
 sys.path.append("lib/python")
 from asterisk.TestCase import TestCase
+from asterisk.sipp import SIPpScenario
 import logging
 
 LOGGER = logging.getLogger(__name__)
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
 
 class AttTransferTestTcp(TestCase):
     '''This class handles the testing of attended transfers when using
@@ -27,25 +29,22 @@
         TestCase.__init__(self)
         self.reactor_timeout = 20
         self.create_asterisk()
-	self.chans = []
+        self.chans = []
         self.final_bridge = 0
 
-        # start pjsua clients
-        self.pja = subprocess.Popen(['pjsua', '--local-port=5075',
-                            '--auto-answer=200', '--null-audio', '--no-udp'],
-                            stdin=subprocess.PIPE,
-                            stdout=subprocess.PIPE)
-        self.pjb = subprocess.Popen(['pjsua', '--local-port=5076',
-                            '--auto-answer=200', '--null-audio', '--no-udp'],
-                            stdin=subprocess.PIPE,
-                            stdout=subprocess.PIPE)
-        self.pjc = subprocess.Popen(['pjsua', '--local-port=5077',
+        # start pjsua client
+        self.pja = subprocess.Popen(['pjsua', '--local-port=5065',
                             '--auto-answer=200', '--null-audio', '--no-udp'],
                             stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE)
 
     def run(self):
         '''Handle completion of Asterisk startup.'''
+        # start up sipp scenarios
+        self.sippb = SIPpScenario(TEST_DIR, {'scenario': 'uas-no-hangup.xml', '-t': 't1', '-p': '5066'})
+        self.sippc = SIPpScenario(TEST_DIR, {'scenario': 'uas-no-hangup.xml', '-t': 't1', '-p': '5067'})
+        self.sippb.run(self)
+        self.sippc.run(self)
         TestCase.run(self)
         self.create_ami_factory()
 
@@ -56,18 +55,13 @@
         self.ami[0].registerEvent('Bridge', self.bridge_callback)
         self.ami[0].registerEvent('VarSet', self.bridgepeer_callback)
 
-        # allow pjsua time to setup so that it can actually accept calls
-	reactor.callLater(5, self.callAToB)
-
-    def callAToB(self):
-        '''Kick off the A to B call.'''
         LOGGER.info("Kicking off A-to-B call")
         self.pja.stdin.write("m\n")
         self.pja.stdin.write("sip:call_b at 127.0.0.1:5060;transport=TCP\n")
 
     def bridge_callback(self, ami, event):
         '''Handle Bridge events to catch.'''
-	self.chans.append(event['channel2'])
+        self.chans.append(event['channel2'])
         numchans = len(self.chans)
         if numchans == 1:
             LOGGER.info("Kicking off A-to-C call")
@@ -98,13 +92,11 @@
 
     def doCleanup(self):
         '''Do final cleanup, output debugging, kill off pjsua processes.'''
-	self.ami[0].hangup(self.chans[1])
+        self.ami[0].hangup(self.chans[1])
         self.ast[0].cli_exec("core show locks")   # get lock output in case of deadlock before tearing down.
         self.ast[0].cli_exec("core show channels")# if channels are still up for some reason, we want to know that as well
         os.kill(self.pja.pid, signal.SIGKILL)
-        os.kill(self.pjb.pid, signal.SIGKILL)
-        os.kill(self.pjc.pid, signal.SIGKILL)
-	self.stop_reactor()
+        self.stop_reactor()
 
 def main():
     '''Run SIP TCP attended transfer test.'''

Added: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml?view=auto&rev=3469
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml (added)
+++ asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml Tue Sep 18 09:57:37 2012
@@ -1,0 +1,78 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        optional="true"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="BYE">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <timewait milliseconds="4000"/>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/sip_attended_transfer_tcp/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list