[asterisk-commits] mjordan: branch mjordan/longcat r3612 - in /asterisk/team/mjordan/longcat: co...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 10:12:32 CST 2013


Author: mjordan
Date: Tue Jan 22 10:12:27 2013
New Revision: 3612

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3612
Log:
Commit a bunch of tests to the staging branch

This probably should have been done a long time ago.

Added:
    asterisk/team/mjordan/longcat/tests/apps/control_playback/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/configs/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_reverse/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/configs/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/control_stop/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/configs/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/nominal/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/control_playback/tests.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/
    asterisk/team/mjordan/longcat/tests/apps/playback/nominal/
    asterisk/team/mjordan/longcat/tests/apps/playback/nominal/configs/
    asterisk/team/mjordan/longcat/tests/apps/playback/nominal/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/playback/nominal/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/nominal/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/configs/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_forward/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/configs/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_pause/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/configs/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_restart/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/configs/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_reverse/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/configs/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/configs/ast1/
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/remote_stop/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/apps/playback/tests.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/asyncagi/
    asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/
    asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/asyncagi_break.py   (with props)
    asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/configs/
    asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/configs/ast1/
    asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/configs/ast1/extensions.conf   (with props)
    asterisk/team/mjordan/longcat/tests/asyncagi/asyncagi_break/test-config.yaml   (with props)
    asterisk/team/mjordan/longcat/tests/asyncagi/tests.yaml   (with props)
Modified:
    asterisk/team/mjordan/longcat/configs/manager.conf
    asterisk/team/mjordan/longcat/lib/python/asterisk/SimpleTestCase.py
    asterisk/team/mjordan/longcat/lib/python/asterisk/apptest.py
    asterisk/team/mjordan/longcat/lib/python/asterisk/asterisk.py
    asterisk/team/mjordan/longcat/tests/apps/tests.yaml
    asterisk/team/mjordan/longcat/tests/tests.yaml

Modified: asterisk/team/mjordan/longcat/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/configs/manager.conf?view=diff&rev=3612&r1=3611&r2=3612
==============================================================================
--- asterisk/team/mjordan/longcat/configs/manager.conf (original)
+++ asterisk/team/mjordan/longcat/configs/manager.conf Tue Jan 22 10:12:27 2013
@@ -8,7 +8,7 @@
 
 [user]
 secret = mysecret
-read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan,test
-write = system,call,agent,user,config,command,reporting,originate
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan,test,agi
+write = system,call,agent,user,config,command,reporting,originate,agi
 
 #include "manager.users.conf.inc"

Modified: asterisk/team/mjordan/longcat/lib/python/asterisk/SimpleTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/lib/python/asterisk/SimpleTestCase.py?view=diff&rev=3612&r1=3611&r2=3612
==============================================================================
--- asterisk/team/mjordan/longcat/lib/python/asterisk/SimpleTestCase.py (original)
+++ asterisk/team/mjordan/longcat/lib/python/asterisk/SimpleTestCase.py Tue Jan 22 10:12:27 2013
@@ -172,7 +172,8 @@
                 self.passed = True
                 LOGGER.info("Test ending, hanging up current channels")
                 for chan in self._tracking_channels:
-                    self.ami[0].hangup(chan['channel']).addCallbacks(self.hangup)
+                    self.ami[0].hangup(chan['channel']).addCallbacks(self.hangup,
+                                                                     self.hangup_error)
             else:
                 self._current_run += 1
                 self.__start_new_call(ami)
@@ -184,6 +185,11 @@
         LOGGER.info("Hangup complete, stopping reactor")
         self.stop_reactor()
 
+    def hangup_error(self, result):
+        ''' Called when an error occurs during a hangup '''
+        # Ignore the hangup error - in this case, the channel was disposed of
+        # prior to our hangup request, which is okay
+        self.stop_reactor()
 
     def verify_event(self, event):
         ''' Virtual method used to verify values in the event. '''

Modified: asterisk/team/mjordan/longcat/lib/python/asterisk/apptest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/lib/python/asterisk/apptest.py?view=diff&rev=3612&r1=3611&r2=3612
==============================================================================
--- asterisk/team/mjordan/longcat/lib/python/asterisk/apptest.py (original)
+++ asterisk/team/mjordan/longcat/lib/python/asterisk/apptest.py Tue Jan 22 10:12:27 2013
@@ -61,7 +61,7 @@
         self._scenarios = self.test_config['scenarios']
 
         self.register_ami_observer(self.__ami_connect_handler)
-
+        self.register_stop_observer(self.end_scenario)
         self.create_asterisk()
 
         # Created successfully - set the singleton instance to this object
@@ -143,7 +143,7 @@
                 self.set_passed(True)
 
 
-    def end_scenario(self):
+    def end_scenario(self, result=None):
         ''' End the current scenario '''
         self.__evaluate_expected_results()
         if len(self._scenarios) == 0:
@@ -250,12 +250,12 @@
         else:
             delay = 0
 
-        self._ami = ami
-        self._ami.registerEvent('Hangup', self.__hangup_event_handler)
-        self._ami.registerEvent('VarSet', self.__varset_event_handler)
-        self._ami.registerEvent('TestEvent', self.__test_event_handler)
-        self._ami.registerEvent('Newexten', self.__new_exten_handler)
-        self._ami.registerEvent('Newchannel', self.__new_channel_handler)
+        self.ami = ami
+        self.ami.registerEvent('Hangup', self.__hangup_event_handler)
+        self.ami.registerEvent('VarSet', self.__varset_event_handler)
+        self.ami.registerEvent('TestEvent', self.__test_event_handler)
+        self.ami.registerEvent('Newexten', self.__new_exten_handler)
+        self.ami.registerEvent('Newchannel', self.__new_channel_handler)
         self._all_channels = []         # All channels we've detected
         self._candidate_channels = []   # The local pair that are ours
         self.app_channel = ''           # The local half in the application
@@ -273,7 +273,7 @@
     def spawn_call(self, delay=0):
         ''' Spawn the call! '''
         def __spawn_call_callback(spawn_call_deferred):
-            self._ami.originate(channel=self._channel_name,
+            self.ami.originate(channel=self._channel_name,
                     context=self._controller_context,
                     exten=self._controller_initial_exten,
                     priority='1',
@@ -304,7 +304,7 @@
             LOGGER.debug("Ignoring redirect to %s; channel %s is hungup" %
                          (extension, self.controller_channel))
             return
-        self._ami.redirect(self.controller_channel,
+        self.ami.redirect(self.controller_channel,
                            self._controller_context,
                            extension,
                            1).addErrback(self.__handle_redirect_failure)
@@ -367,11 +367,11 @@
         The callback parameter will be this object.
         '''
 
-        def __send_dtmf_initial(dtmf, __dtmf_deferred):
+        def __send_dtmf_initial(dtmf):
             ''' Initial callback called by the reactor.  This sets the dialplan
             variable DTMF_TO_SEND to the dtmf value to stream '''
             if (self._previous_dtmf != dtmf):
-                self._ami.setVar(channel=self.controller_channel,
+                self.ami.setVar(channel=self.controller_channel,
                                  variable='DTMF_TO_SEND',
                                  value=dtmf).addCallback(__send_dtmf_redirect)
                 self._previous_dtmf = dtmf
@@ -409,7 +409,7 @@
             ''' Initial callback called by the reactor.  This sets the dialplan
             variable TALK_AUDIO to the file to stream '''
             if (self._previous_sound_file != sound_file):
-                self._ami.setVar(channel=self.controller_channel,
+                self.ami.setVar(channel=self.controller_channel,
                                  variable="TALK_AUDIO",
                                  value=sound_file).addCallback(
                                                         __stream_audio_redirect)
@@ -780,6 +780,26 @@
         return None
 
 
+class ActionSendMessage(object):
+    ''' Functor that sends some AMI message '''
+
+    def __init__(self, action_config):
+        self.add_app_channel = False if 'add-app-channel' not in action_config \
+            else action_config['add-app-channel']
+        self.add_control_channel = False if 'add-control-channel' not in action_config \
+            else action_config['add-control-channel']
+        if (self.add_app_channel and self.add_control_channel):
+            raise Exception('Only one channel can be added to the message!')
+        self.message_fields = action_config['fields']
+
+    def __call__(self, channel_object):
+        if self.add_app_channel:
+            self.message_fields['Channel'] = channel_object.app_channel
+        elif self.add_control_channel:
+            self.message_fields['Channel'] = channel_object.controller_channel
+        LOGGER.debug('Sending message: %s' % str(self.message_fields))
+        channel_object.ami.sendMessage(self.message_fields)
+
 class ActionFactory(object):
     ''' A static class factory that maps action objects to text descriptions of
     those objects, and provides a factory method for creating them '''
@@ -791,7 +811,8 @@
                             'set-expected-result': ActionSetExpectedResult,
                             'hangup': ActionHangup,
                             'fail-test': ActionFailTest,
-                            'end-scenario': ActionEndScenario,}
+                            'end-scenario': ActionEndScenario,
+                            'send-ami-message': ActionSendMessage,}
 
     @staticmethod
     def create_action(action_def):

Modified: asterisk/team/mjordan/longcat/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/lib/python/asterisk/asterisk.py?view=diff&rev=3612&r1=3611&r2=3612
==============================================================================
--- asterisk/team/mjordan/longcat/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/mjordan/longcat/lib/python/asterisk/asterisk.py Tue Jan 22 10:12:27 2013
@@ -60,7 +60,6 @@
             """ Callback from getProcessOutputAndValue """
             self.__set_properties(result)
             logger.debug("Asterisk CLI %s exited %d" % (self.host, self.exitcode))
-            logger.debug(self.output)
             if self.err:
                 logger.debug(self.err)
             if self.exitcode:
@@ -72,7 +71,6 @@
             """ Errback from getProcessOutputAndValue """
             self.__set_properties(result)
             logger.warning("Asterisk CLI %s exited %d with error: %s" % (self.host, self.exitcode, self.err))
-            logger.debug(self.output)
             if self.err:
                 logger.debug(self.err)
             self.__deferred.errback(self)
@@ -115,7 +113,6 @@
 
     def outReceived(self, data):
         """ Override of ProcessProtocol.outReceived """
-        logger.debug("Asterisk %s received: %s" % (self.__host, data))
         self.output += data
 
     def connectionMade(self):

Added: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf?view=auto&rev=3612
==============================================================================
--- asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf (added)
+++ asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf Tue Jan 22 10:12:27 2013
@@ -1,0 +1,34 @@
+[default]
+
+exten => test_user,1,NoOp()
+	; Use DTMF 1 to FF 5 seconds
+	same => n,ControlPlayback(tt-monkeys,5000,1)
+	same => n,ExecIf($[${CPLAYBACKOFFSET}=-1]?UserEvent(TestResult,result:pass_eof)
+	same => n,ExecIf($[${CPLAYBACKSTATUS}=SUCCESS]?UserEvent(TestResult,result:pass_user)
+	same => n,Hangup()
+
+exten => test_default_user,1,NoOp()
+	; Test default skipms of 3000; default FF of #
+	same => n,ControlPlayback(tt-monkeys)
+	same => n,ExecIf($[${CPLAYBACKOFFSET}=-1]?UserEvent(TestResult,result:pass_default_eof)
+	same => n,ExecIf($[${CPLAYBACKSTATUS}=SUCCESS]?UserEvent(TestResult,result:pass_default_user)
+	same => n,Hangup()
+
+exten => test_remote,1,NoOp()
+	; Remote AMI connection controls test
+	same => n,ControlPlayback(tt-monkeys)
+	same => n,ExecIf($[${CPLAYBACKOFFSET}=-1]?UserEvent(TestResult,result:pass_remote_eof)
+	same => n,ExecIf($[${CPLAYBACKSTATUS}=SUCCESS]?UserEvent(TestResult,result:pass_remote)
+	same => n,Hangup()
+
+exten => sendDTMF,1,NoOp()
+	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+	same => n,SendDTMF(${DTMF_TO_SEND})
+	same => n,Goto(default,wait,1)
+
+exten => hangup,1,NoOp()
+	same => n,Verbose(1, Hanging up)
+	same => n,Hangup()
+
+exten => wait,1,NoOp()
+	same => n,Wait(10000)

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml?view=auto&rev=3612
==============================================================================
--- asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml (added)
+++ asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml Tue Jan 22 10:12:27 2013
@@ -1,0 +1,236 @@
+testinfo:
+    summary: 'Test ControlPlayback with Fast Forward'
+    description: |
+        'This tests three scenarios:
+          1. In the first scenario, a user with parameters passed to the
+             application attempts to fast forward 5 seconds.
+          2. In the second scenario, a user with no parameters attempts to
+             fast forward. This uses the default DTMF key # and the skip ms
+             time of 3000.
+          3. In the third scenario, a remote connection fast forwards the
+             playback.
+
+          In all cases, the tests check that Asterisk sends a test event
+          indicating that the stream has moved forward the expected time, and
+          that at the end of the test the entire file was played back to the
+          user.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'apptest.AppTest'
+
+test-object-config:
+  app: 'ControlPlayback'
+  scenarios:
+    -
+      # Scenario 1: Verify user can control a playback
+      channels:
+        -
+          channel-id: 'Test-User'
+          channel-name: 'Local/test_user at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Context: 'default'
+                  Extension: 'wait'
+              actions:
+                -
+                  action-type: 'send-dtmf'
+                  dtmf: '1'
+                  delay: '2'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Control: 'FastForward'
+                  SkipMs: '5000'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Asterisk confirms user fast forwarded'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_eof'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Matched expected user EOF'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_user'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Detected user played back successfully'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/test_user at default-00000000;2'
+              actions:
+                -
+                  action-type: 'end-scenario'
+    -
+      # Scenario 2: Verify default values
+      channels:
+        -
+          channel-id: 'Test-User'
+          channel-name: 'Local/test_default_user at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Context: 'default'
+                  Extension: 'wait'
+              actions:
+                -
+                  action-type: 'send-dtmf'
+                  dtmf: '#'
+                  delay: '2'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Control: 'FastForward'
+                  SkipMs: '3000'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Asterisk confirms default user fast forwarded'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_default_eof'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Matched expected default user EOF'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_default_user'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Detected default user played back successfully'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/test_default_user at default-00000001;2'
+              actions:
+                -
+                  action-type: 'end-scenario'
+    -
+      # Scenario 3: Verify an AMI connection can control a playback
+      channels:
+        -
+          channel-id: 'Test-Remote'
+          channel-name: 'Local/test_remote at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Context: 'default'
+                  Extension: 'wait'
+              actions:
+                -
+                  action-type: 'send-ami-message'
+                  add-app-channel: True
+                  fields:
+                      action: 'ControlPlayback'
+                      control: 'Forward'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Control: 'FastForward'
+                  SkipMs: '3000'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Asterisk confirms remote fast forwarded'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_remote_eof'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Matched expected remote EOF'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_remote'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Detected remote played back successfully'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/test_remote at default-00000002;2'
+              actions:
+                -
+                  action-type: 'end-scenario'
+
+
+properties:
+    minversion: '12.0.0'
+    tags:
+      - playback
+      - apps
+    dependencies:
+      - buildoption: 'TEST_FRAMEWORK'
+      - python : 'twisted'
+      - python : 'starpy'
+      - asterisk : 'app_senddtmf'
+      - asterisk : 'app_controlplayback'
+

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_forward/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf?view=auto&rev=3612
==============================================================================
--- asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf (added)
+++ asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf Tue Jan 22 10:12:27 2013
@@ -1,0 +1,27 @@
+[default]
+
+exten => test_user,1,NoOp()
+	; Use DTMF 3 to pause playback
+	same => n,ControlPlayback(tt-monkeys,,,,,3)
+	same => n,ExecIf($[${CPLAYBACKOFFSET}=-1]?UserEvent(TestResult,result:pass_eof)
+	same => n,ExecIf($[${CPLAYBACKSTATUS}=SUCCESS]?UserEvent(TestResult,result:pass_user)
+	same => n,Hangup()
+
+exten => test_remote,1,NoOp()
+	; Remote AMI connection controls test
+	same => n,ControlPlayback(tt-monkeys)
+	same => n,ExecIf($[${CPLAYBACKOFFSET}=-1]?UserEvent(TestResult,result:pass_remote_eof)
+	same => n,ExecIf($[${CPLAYBACKSTATUS}=SUCCESS]?UserEvent(TestResult,result:pass_remote)
+	same => n,Hangup()
+
+exten => sendDTMF,1,NoOp()
+	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+	same => n,SendDTMF(${DTMF_TO_SEND})
+	same => n,Goto(default,wait,1)
+
+exten => hangup,1,NoOp()
+	same => n,Verbose(1, Hanging up)
+	same => n,Hangup()
+
+exten => wait,1,NoOp()
+	same => n,Wait(10000)

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml?view=auto&rev=3612
==============================================================================
--- asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml (added)
+++ asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml Tue Jan 22 10:12:27 2013
@@ -1,0 +1,198 @@
+testinfo:
+    summary: 'Test ControlPlayback with Pause'
+    description: |
+        'This tests two scenarios:
+          1. In the first scenario, a user with parameters passed to the
+             application pauses the playback. Upon successful pause, they
+             unpause the playback.
+          2. In the second scenario, a remote connection pauses the
+             playback. Upon successful pause, it unpauses the playback.
+
+          In all cases, the tests check that Asterisk sends a test event
+          indicating that the stream has paused and unpaused, and that at the
+          end of the test the entire file was played back to the user.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'apptest.AppTest'
+
+test-object-config:
+  app: 'ControlPlayback'
+  scenarios:
+    -
+      # Scenario 1: Verify user can control a playback
+      channels:
+        -
+          channel-id: 'Test-User'
+          channel-name: 'Local/test_user at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Context: 'default'
+                  Extension: 'wait'
+              actions:
+                -
+                  action-type: 'send-dtmf'
+                  dtmf: '3'
+                  delay: '2'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Control: 'Pause'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Asterisk confirms user paused playback'
+                -
+                  action-type: 'send-dtmf'
+                  dtmf: '3'
+                  delay: '1'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Control: 'Unpause'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Asterisk confirms user unpaused playback'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_eof'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Matched expected user EOF'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_user'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Detected user played back successfully'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/test_user at default-00000000;2'
+              actions:
+                -
+                  action-type: 'end-scenario'
+    -
+      # Scenario 2: Verify an AMI connection can control a playback
+      channels:
+        -
+          channel-id: 'Test-Remote'
+          channel-name: 'Local/test_remote at default'
+          context: 'default'
+          exten: 'wait'
+          start-on-create: True
+          events:
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Newexten'
+                  Context: 'default'
+                  Extension: 'wait'
+              actions:
+                -
+                  action-type: 'send-ami-message'
+                  add-app-channel: True
+                  fields:
+                      action: 'ControlPlayback'
+                      control: 'Pause'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Control: 'Pause'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Asterisk confirms remote paused playback'
+                -
+                  action-type: 'send-ami-message'
+                  add-app-channel: True
+                  fields:
+                      action: 'ControlPlayback'
+                      control: 'Pause'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'TestEvent'
+                  State: 'PLAYBACK'
+                  Control: 'Unpause'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Asterisk confirms remote unpaused playback'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_remote_eof'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Matched expected remote EOF'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'UserEvent'
+                  UserEvent: 'TestResult'
+                  Result: 'pass_remote'
+              actions:
+                -
+                  action-type: 'set-expected-result'
+                  expected-result: 'Detected remote played back successfully'
+            -
+              type: 'headermatch'
+              conditions:
+                match:
+                  Event: 'Hangup'
+                  Channel: 'Local/test_remote at default-00000001;2'
+              actions:
+                -
+                  action-type: 'end-scenario'
+
+
+properties:
+    minversion: '12.0.0'
+    tags:
+      - playback
+      - apps
+    dependencies:
+      - buildoption: 'TEST_FRAMEWORK'
+      - python : 'twisted'
+      - python : 'starpy'
+      - asterisk : 'app_senddtmf'
+      - asterisk : 'app_controlplayback'
+

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_pause/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf?view=auto&rev=3612
==============================================================================
--- asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf (added)
+++ asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf Tue Jan 22 10:12:27 2013
@@ -1,0 +1,27 @@
+[default]
+
+exten => test_user,1,NoOp()
+	; Use DTMF 8 to restart playback
+	same => n,ControlPlayback(tt-monkeys,,,,,,8)
+	same => n,ExecIf($[${CPLAYBACKOFFSET}=-1]?UserEvent(TestResult,result:pass_eof)
+	same => n,ExecIf($[${CPLAYBACKSTATUS}=SUCCESS]?UserEvent(TestResult,result:pass_user)
+	same => n,Hangup()
+
+exten => test_remote,1,NoOp()
+	; Remote AMI connection controls test
+	same => n,ControlPlayback(tt-monkeys)
+	same => n,ExecIf($[${CPLAYBACKOFFSET}=-1]?UserEvent(TestResult,result:pass_remote_eof)
+	same => n,ExecIf($[${CPLAYBACKSTATUS}=SUCCESS]?UserEvent(TestResult,result:pass_remote)
+	same => n,Hangup()
+
+exten => sendDTMF,1,NoOp()
+	same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+	same => n,SendDTMF(${DTMF_TO_SEND})
+	same => n,Goto(default,wait,1)
+
+exten => hangup,1,NoOp()
+	same => n,Verbose(1, Hanging up)
+	same => n,Hangup()
+
+exten => wait,1,NoOp()
+	same => n,Wait(10000)

Propchange: asterisk/team/mjordan/longcat/tests/apps/control_playback/control_restart/configs/ast1/extensions.conf

[... 1887 lines stripped ...]



More information about the asterisk-commits mailing list