[svn-commits] kmoore: testsuite/asterisk/trunk r5506 - in /asterisk/trunk/tests/rest_api/br...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 22 08:45:59 CDT 2014


Author: kmoore
Date: Fri Aug 22 08:45:49 2014
New Revision: 5506

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5506
Log:
Testsuite: Update ARI blind transfer test

This updates the ARI blind transfer test (rest_api/bridges/blind_transfer)
for the changes in review 3921 so that it handles messages that are now
being emitted. This also simplifies the test by eliminating a channel
that was unnecessary.

Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3922/

Modified:
    asterisk/trunk/tests/rest_api/bridges/blind_transfer/blind_transfer.py
    asterisk/trunk/tests/rest_api/bridges/blind_transfer/configs/ast1/pjsip.conf
    asterisk/trunk/tests/rest_api/bridges/blind_transfer/test-config.yaml

Modified: asterisk/trunk/tests/rest_api/bridges/blind_transfer/blind_transfer.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/blind_transfer/blind_transfer.py?view=diff&rev=5506&r1=5505&r2=5506
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/blind_transfer/blind_transfer.py (original)
+++ asterisk/trunk/tests/rest_api/bridges/blind_transfer/blind_transfer.py Fri Aug 22 08:45:49 2014
@@ -15,11 +15,9 @@
     def __init__(self):
         self.channels = 0
         self.bridge_id = None
+        self.originated_id = None
         self.pja = subprocess.Popen(['pjsua', '--local-port=5065', '--null-audio',
             '--id=sip:bob at 127.0.0.1'],
-            stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-        self.pjb = subprocess.Popen(['pjsua', '--local-port=5066', '--null-audio',
-            '--id=sip:alice at 127.0.0.1'],
             stdin=subprocess.PIPE, stdout=subprocess.PIPE)
 
 TEST = TestLogic()
@@ -28,10 +26,6 @@
     TEST.pja.stdin.write("m\n")
     TEST.pja.stdin.write("sip:stasis at 127.0.0.1:5060\n")
 
-def b_call_stasis():
-    TEST.pjb.stdin.write("m\n")
-    TEST.pjb.stdin.write("sip:stasis at 127.0.0.1:5060\n")
-
 def a_call_transfer():
     TEST.pja.stdin.write("x\n")
     TEST.pja.stdin.write("sip:1000 at 127.0.0.1:5060\n")
@@ -39,9 +33,11 @@
 def on_kickoff_start(ari, event, test_object):
     LOGGER.debug("on_kickoff_start(%r)" % event)
     TEST.bridge_id = ari.post('bridges').json()['id']
+
+    TEST.originated_id = event['channel']['id']
+    ari.post('bridges', TEST.bridge_id, 'addChannel', channel=TEST.originated_id)
+
     a_call_stasis()
-    b_call_stasis()
-    ari.delete('channels', event['channel']['id'])
     return True
 
 def on_test_start(ari, event, test_object):
@@ -53,16 +49,20 @@
 def on_channel_entered_bridge(ari, event, test_object):
 
     TEST.channels += 1
-    if TEST.channels == 2:
+    if TEST.channels == 1:
         a_call_transfer()
 
     return True
 
+def on_replace_channel_enter(ari, event, test_object):
+
+    ari.delete('channels', event['channel']['id'])
+    return True
 
 def on_blind_transfer(ari, event, test_object):
     LOGGER.debug("on_blind_transfer(%r)" % event)
     ari.delete('bridges', TEST.bridge_id)
-    TEST.pjb.stdin.write("h\n")
+    ari.delete('channels', TEST.originated_id)
 
     if event.get('result') != 'Success':
         LOGGER.error('Blind transfer failed: %s' % event.get('result'))

Modified: asterisk/trunk/tests/rest_api/bridges/blind_transfer/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/blind_transfer/configs/ast1/pjsip.conf?view=diff&rev=5506&r1=5505&r2=5506
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/blind_transfer/configs/ast1/pjsip.conf (original)
+++ asterisk/trunk/tests/rest_api/bridges/blind_transfer/configs/ast1/pjsip.conf Fri Aug 22 08:45:49 2014
@@ -10,10 +10,3 @@
 allow=ulaw
 direct_media=no
 
-[alice]
-type=endpoint
-context=default
-disallow=all
-allow=ulaw
-direct_media=no
-

Modified: asterisk/trunk/tests/rest_api/bridges/blind_transfer/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/rest_api/bridges/blind_transfer/test-config.yaml?view=diff&rev=5506&r1=5505&r2=5506
==============================================================================
--- asterisk/trunk/tests/rest_api/bridges/blind_transfer/test-config.yaml (original)
+++ asterisk/trunk/tests/rest_api/bridges/blind_transfer/test-config.yaml Fri Aug 22 08:45:49 2014
@@ -20,6 +20,8 @@
                     type: StasisStart
                     application: testsuite
                     args: []
+                    channel:
+                        name: 'Local/s at default-00000000;2'
             count: 1
             callback:
                 module: blind_transfer
@@ -28,18 +30,45 @@
                 match:
                     type: StasisStart
                     application: testsuite
+                    args: []
+                    channel:
+                        name: 'Local/1000 at default-00000001;1'
+                    replace_channel:
+                        name: 'PJSIP/bob-0000000.'
+            count: 1
+        -   conditions:
+                match:
+                    type: StasisStart
+                    application: testsuite
                     args: ['test']
-            count: 2
+            count: 1
             callback:
                 module: blind_transfer
                 method: on_test_start
         -   conditions:
                 match:
                     type: ChannelEnteredBridge
-            count: 2
+                    channel:
+                        name: 'PJSIP/.*'
+            count: 1
             callback:
                 module: blind_transfer
                 method: on_channel_entered_bridge
+        -   conditions:
+                match:
+                    type: ChannelEnteredBridge
+                    channel:
+                        name: 'Local/s at default-00000000;2'
+            count: 1
+        -   conditions:
+                match:
+                    type: ChannelEnteredBridge
+                    channel:
+                        name: 'Local/1000 at default-.*'
+            count: 1
+            callback:
+                module: blind_transfer
+                method: on_replace_channel_enter
         -   conditions:
                 match:
                     type: BridgeBlindTransfer




More information about the svn-commits mailing list