[Home]

Summary:ASTERISK-24010: Testsuite: Create a general pluggable module that performs energy detection on a specified file
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2014-07-09 11:17:46Date Closed:2014-08-12 15:06:16
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Tests/testsuite
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:A large number of tests have to record a file. Examples include the {{tests/apps/mixmonitor}} test, as well as the {{chanspy_w_mixmonitor}} test.

Many of these tests have to verify two properties:
# That some energy was recorded in the file. This is typically done using the [BackgroundDetect|https://wiki.asterisk.org/wiki/display/AST/Application_BackgroundDetect?src=search] application, and is performed after the test runs. When the test has completed, a Local channel is typically started which - on one half of the Local channel, performs a Playback of the recorded file, while the other half sits in BackgroundDetect. If talking is detected, an AGI (or UserEvent) is fired.
# That the file is of a certain size, within some expected tolerance. This verifies that the entire file was written out to disk.

We need a pluggable module to verify this. This module should be able to do the following:
# Find either a specific file (given by a hard coded path) or a file in a relative location to some instance of Asterisk's location. That is, if there are two instances of Asterisk in a test, and the test being executed is run 4, and we need to find a file named 'talking.wav' in the {{monitor}} directory of the second Asterisk instance, then the module should construct this as:
{noformat}
/tmp/asterisk-testsuite/[test path]/run_4/ast2/var/spool/asterisk/monitor/talking.wav
{noformat}
# If the file does not exist, fail the test.
# For the specified file, optionally check the file size within some expected tolerance.
# For the specified file, optionally Originate a channel into a location in the dialplan and perform a BackgroundDetect on the specified file. This can use the Originator module directly from this pluggable module. The documentation for the pluggable module should specify directly the dialplan that must exist for it to work. The location of the extensions for the Local channel that performs the analysis should be configurable.
# Support doing all of the above for one or more files

A proposed YAML schema:

{code}
file-analyzer:
   id: '2' # Asterisk instance to look at
   files:
       -
           file_name: 'monitor/talking.wav'
           file_path_type: 'relative'
           actions:
               -
                   type: 'size_check'
                   size: '50000'
                   tolerance: '5000'
               -
                   type: 'energy_check'
                   channel: 'Local/sound_check@default'
                   context: 'default'
                   exten: 'play_file'
                   priority: '1'
{code}
Comments: