[svn-commits] mjordan: testsuite/asterisk/trunk r5441 - in /asterisk/trunk/tests/manager: ....

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 14 15:08:50 CDT 2014


Author: mjordan
Date: Thu Aug 14 15:08:43 2014
New Revision: 5441

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5441
Log:
tests/manager: Add MixMonitor AMI test

This patch adds a test for the MixMonitor AMI action. It attaches a MixMonitor
to a Local channel and playback audio through the other side of the Local
channel. When the playback is complete, the resulting sound file is passed
through the SoundChecker pluggable module and verified to be of approximately
the correct size and that it has energy within it.

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

ASTERISK-24028 #close
patches:
  mixmonitor_record.diff uploaded by tcambron (License 6611)

Added:
    asterisk/trunk/tests/manager/mixmonitor/
    asterisk/trunk/tests/manager/mixmonitor/configs/
    asterisk/trunk/tests/manager/mixmonitor/configs/ast1/
    asterisk/trunk/tests/manager/mixmonitor/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/manager/mixmonitor/start_mix.py   (with props)
    asterisk/trunk/tests/manager/mixmonitor/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/manager/tests.yaml

Added: asterisk/trunk/tests/manager/mixmonitor/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/mixmonitor/configs/ast1/extensions.conf?view=auto&rev=5441
==============================================================================
--- asterisk/trunk/tests/manager/mixmonitor/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/manager/mixmonitor/configs/ast1/extensions.conf Thu Aug 14 15:08:43 2014
@@ -1,0 +1,19 @@
+[default]
+exten => s,1,Answer()
+    same => n,Playback(tt-monkeys)
+    same => n,Hangup()
+
+exten => echo,1,Answer()
+    same => n,Echo()
+    same => n,Hangup()
+
+[soundtest]
+exten => audio,1,Answer()
+    same => n,Set(TALK_DETECTED=0)
+    same => n,BackgroundDetect(${SOUNDFILE},1,20,,20000)
+    same => n,GoToIf($[${TALK_DETECTED}=0]?true:false)
+    same => n(false),UserEvent(soundcheck, status: pass)
+    same => n,Hangup()
+
+    same => n(true),UserEvent(soundcheck, status: fail)
+    same => n,Hangup()

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

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

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

Added: asterisk/trunk/tests/manager/mixmonitor/start_mix.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/mixmonitor/start_mix.py?view=auto&rev=5441
==============================================================================
--- asterisk/trunk/tests/manager/mixmonitor/start_mix.py (added)
+++ asterisk/trunk/tests/manager/mixmonitor/start_mix.py Thu Aug 14 15:08:43 2014
@@ -1,0 +1,29 @@
+"""
+Copyright (C) 2014, Digium, Inc.
+Tyler Cambron <tcambron at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+"""
+
+import logging
+
+LOGGER = logging.getLogger(__name__)
+
+
+def record(ami, event):
+    """
+    When the event specified in the test-config is triggered, the variable
+    'channel' is set to the channelid of the channel where the event occurs.
+    'channel' is then used to create the MixMonitor command message that is
+    sent to asterisk to begin the recording of the playback.
+    """
+    channel = event.get('destchannel')
+    if not channel:
+        channel = event.get('channel')
+    if not channel:
+        return False
+    message = {'Action': 'MixMonitor', 'Channel': '%s' % channel,
+               'File': 'theRecording.wav', 'options': 'r'}
+    ami.sendMessage(message)
+    return True

Propchange: asterisk/trunk/tests/manager/mixmonitor/start_mix.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/manager/mixmonitor/start_mix.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/manager/mixmonitor/start_mix.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/manager/mixmonitor/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/mixmonitor/test-config.yaml?view=auto&rev=5441
==============================================================================
--- asterisk/trunk/tests/manager/mixmonitor/test-config.yaml (added)
+++ asterisk/trunk/tests/manager/mixmonitor/test-config.yaml Thu Aug 14 15:08:43 2014
@@ -1,0 +1,93 @@
+testinfo:
+    summary:     'Test MixMonitor recording functionality applications'
+    description: |
+        'This test verifies basic functionality of the recording feature in
+         MixMonitor by creating a local channel that upon being answered triggers
+         the MixMonitor and records the playback of tt-monkeys. The test passes
+         when the SoundChecker pluggable module verifies that the file is the
+         correct size and contains energy, meaning a file was created and stored
+         the recording correctly.'
+test-modules:
+        add-test-to-search-path: True
+        test-object:
+            config-section: test-object-config
+            typename: 'test_case.TestCaseModule'
+        modules:
+          - config-section: ami-config-11
+            typename: 'ami.AMIEventModule'
+            minversion: '11.0.0'
+            maxversion: '12.0.0'
+          - config-section: ami-config-12
+            typename: 'ami.AMIEventModule'
+            minversion: '12.0.0'
+          - config-section: start-call
+            typename: 'pluggable_modules.Originator'
+
+          - config-section: sound-file-analyzer
+            typename: 'pluggable_modules.SoundChecker'
+
+test-object-config:
+    asterisk-instances: 1
+    connect-ami: true
+
+start-call:
+    channel: 'Local/s at default'
+    context: 'default'
+    exten: 'echo'
+    priority: 1
+    trigger: 'ami_connect'
+    async: True
+
+ami-config-11:
+    -
+        type: 'callback'
+        conditions:
+            match:
+                Event: 'Newchannel'
+                Channel: 'Local/s at default-00000000;1'
+        callbackModule: 'start_mix'
+        callbackMethod: 'record'
+
+ami-config-12:
+    -
+        type: 'callback'
+        conditions:
+            match:
+                Event: 'DialEnd'
+                DestChannel: 'Local/s at default-.*'
+        callbackModule: 'start_mix'
+        callbackMethod: 'record'
+
+sound-file-analyzer:
+    auto-stop: True
+    sound-file-config:
+        -
+            trigger:
+                match:
+                        id: 0
+                        event: 'Hangup'
+                        channel: 'Local/s at default-.*'
+            id: 0
+            sound-file:
+                    file-name: 'monitor/theRecording.wav'
+                    file-path-type: 'relative'
+                    actions:
+                        -
+                            type: 'size_check'
+                            size: 258000
+                            tolerance: 5000
+                        -
+                            type: 'energy_check'
+                            channel: 'Local/audio at soundtest'
+                            context: 'default'
+                            exten: 's'
+                            priority: '1'
+
+properties:
+    minversion: '11.0.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk: 'app_mixmonitor'
+    tags:
+        - mixmonitor

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

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

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

Modified: asterisk/trunk/tests/manager/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/tests.yaml?view=diff&rev=5441&r1=5440&r2=5441
==============================================================================
--- asterisk/trunk/tests/manager/tests.yaml (original)
+++ asterisk/trunk/tests/manager/tests.yaml Thu Aug 14 15:08:43 2014
@@ -13,6 +13,7 @@
     - test: 'exten_state_list'
     - test: 'presence_state_changed'
     - test: 'presence_state_list'
+    - test: 'mixmonitor'
     - test: 'manager_vars'
     - test: 'status'
     - test: 'userevent'




More information about the svn-commits mailing list