<p>Sébastien Duthil has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/testsuite/+/15502">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">manager/mixmonitor: test AMI events<br><br>ASTERISK-29244<br><br>Change-Id: I5f0a20517c7d1d5707a6ed03ceedad5fb8c72b4d<br>---<br>M tests/manager/mixmonitor/configs/ast1/extensions.conf<br>D tests/manager/mixmonitor/start_mix.py<br>M tests/manager/mixmonitor/test-config.yaml<br>3 files changed, 103 insertions(+), 45 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/02/15502/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/manager/mixmonitor/configs/ast1/extensions.conf b/tests/manager/mixmonitor/configs/ast1/extensions.conf</span><br><span>index 0874417..a48ab70 100644</span><br><span>--- a/tests/manager/mixmonitor/configs/ast1/extensions.conf</span><br><span>+++ b/tests/manager/mixmonitor/configs/ast1/extensions.conf</span><br><span>@@ -1,6 +1,13 @@</span><br><span> [default]</span><br><span style="color: hsl(0, 100%, 40%);">-exten => s,1,Answer()</span><br><span style="color: hsl(0, 100%, 40%);">- same => n,Playback(tt-monkeys)</span><br><span style="color: hsl(120, 100%, 40%);">+exten => talk,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,UserEvent(test-manager-monitor,Action: start)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,SayDigits(1)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,UserEvent(test-manager-monitor,Action: mute)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,SayDigits(2)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,UserEvent(test-manager-monitor,Action: unmute)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,SayDigits(3)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,UserEvent(test-manager-monitor,Action: stop)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Wait(5)</span><br><span> same => n,Hangup()</span><br><span> </span><br><span> exten => echo,1,Answer()</span><br><span>diff --git a/tests/manager/mixmonitor/start_mix.py b/tests/manager/mixmonitor/start_mix.py</span><br><span>deleted file mode 100644</span><br><span>index 55b22f0..0000000</span><br><span>--- a/tests/manager/mixmonitor/start_mix.py</span><br><span>+++ /dev/null</span><br><span>@@ -1,29 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-"""</span><br><span style="color: hsl(0, 100%, 40%);">-Copyright (C) 2014, Digium, Inc.</span><br><span style="color: hsl(0, 100%, 40%);">-Tyler Cambron <tcambron@digium.com></span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-This program is free software, distributed under the terms of</span><br><span style="color: hsl(0, 100%, 40%);">-the GNU General Public License Version 2.</span><br><span style="color: hsl(0, 100%, 40%);">-"""</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-import logging</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-LOGGER = logging.getLogger(__name__)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-def record(ami, event):</span><br><span style="color: hsl(0, 100%, 40%);">- """</span><br><span style="color: hsl(0, 100%, 40%);">- When the event specified in the test-config is triggered, the variable</span><br><span style="color: hsl(0, 100%, 40%);">- 'channel' is set to the channelid of the channel where the event occurs.</span><br><span style="color: hsl(0, 100%, 40%);">- 'channel' is then used to create the MixMonitor command message that is</span><br><span style="color: hsl(0, 100%, 40%);">- sent to asterisk to begin the recording of the playback.</span><br><span style="color: hsl(0, 100%, 40%);">- """</span><br><span style="color: hsl(0, 100%, 40%);">- channel = event.get('destchannel')</span><br><span style="color: hsl(0, 100%, 40%);">- if not channel:</span><br><span style="color: hsl(0, 100%, 40%);">- channel = event.get('channel')</span><br><span style="color: hsl(0, 100%, 40%);">- if not channel:</span><br><span style="color: hsl(0, 100%, 40%);">- return False</span><br><span style="color: hsl(0, 100%, 40%);">- message = {'Action': 'MixMonitor', 'Channel': '%s' % channel,</span><br><span style="color: hsl(0, 100%, 40%);">- 'File': 'theRecording.wav', 'options': 'r'}</span><br><span style="color: hsl(0, 100%, 40%);">- ami.sendMessage(message)</span><br><span style="color: hsl(0, 100%, 40%);">- return True</span><br><span>diff --git a/tests/manager/mixmonitor/test-config.yaml b/tests/manager/mixmonitor/test-config.yaml</span><br><span>index 65c94e1..7a91b8d 100644</span><br><span>--- a/tests/manager/mixmonitor/test-config.yaml</span><br><span>+++ b/tests/manager/mixmonitor/test-config.yaml</span><br><span>@@ -13,35 +13,82 @@</span><br><span> config-section: test-object-config</span><br><span> typename: 'test_case.TestCaseModule'</span><br><span> modules:</span><br><span style="color: hsl(0, 100%, 40%);">- - config-section: ami-config-12</span><br><span style="color: hsl(0, 100%, 40%);">- typename: 'ami.AMIEventModule'</span><br><span> - config-section: start-call</span><br><span> typename: 'pluggable_modules.Originator'</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+ - config-section: ami-actions</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'pluggable_modules.EventActionModule'</span><br><span> - config-section: sound-file-analyzer</span><br><span> typename: 'pluggable_modules.SoundChecker'</span><br><span style="color: hsl(120, 100%, 40%);">+ - config-section: expected-ami-events</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'ami.AMIEventModule'</span><br><span> </span><br><span> test-object-config:</span><br><span> asterisk-instances: 1</span><br><span> connect-ami: true</span><br><span> </span><br><span> start-call:</span><br><span style="color: hsl(0, 100%, 40%);">- channel: 'Local/s@default'</span><br><span style="color: hsl(120, 100%, 40%);">+ channel: 'Local/talk@default'</span><br><span> context: 'default'</span><br><span> exten: 'echo'</span><br><span> priority: 1</span><br><span> trigger: 'ami_connect'</span><br><span> async: True</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-ami-config-12:</span><br><span style="color: hsl(120, 100%, 40%);">+ami-actions:</span><br><span> -</span><br><span style="color: hsl(0, 100%, 40%);">- type: 'callback'</span><br><span style="color: hsl(0, 100%, 40%);">- conditions:</span><br><span style="color: hsl(0, 100%, 40%);">- match:</span><br><span style="color: hsl(0, 100%, 40%);">- Event: 'DialEnd'</span><br><span style="color: hsl(0, 100%, 40%);">- DestChannel: 'Local/s@default-.*'</span><br><span style="color: hsl(0, 100%, 40%);">- callbackModule: 'start_mix'</span><br><span style="color: hsl(0, 100%, 40%);">- callbackMethod: 'record'</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'test-manager-monitor'</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'start'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 1</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+ action:</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'MixMonitor'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: '{channel}'</span><br><span style="color: hsl(120, 100%, 40%);">+ File: 'theRecording.wav'</span><br><span style="color: hsl(120, 100%, 40%);">+ Options: 'r'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'test-manager-monitor'</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'mute'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 1</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+ action:</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'MixMonitorMute'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: '{channel}'</span><br><span style="color: hsl(120, 100%, 40%);">+ Direction: 'both'</span><br><span style="color: hsl(120, 100%, 40%);">+ State: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'test-manager-monitor'</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'unmute'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 1</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+ action:</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'MixMonitorMute'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: '{channel}'</span><br><span style="color: hsl(120, 100%, 40%);">+ Direction: 'both'</span><br><span style="color: hsl(120, 100%, 40%);">+ State: '0'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'test-manager-monitor'</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'stop'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 1</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+ action:</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'StopMixMonitor'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: '{channel}'</span><br><span> </span><br><span> sound-file-analyzer:</span><br><span> auto-stop: True</span><br><span>@@ -59,14 +106,47 @@</span><br><span> actions:</span><br><span> -</span><br><span> type: 'size_check'</span><br><span style="color: hsl(0, 100%, 40%);">- size: 258000</span><br><span style="color: hsl(0, 100%, 40%);">- tolerance: 5000</span><br><span style="color: hsl(120, 100%, 40%);">+ size: 40400</span><br><span style="color: hsl(120, 100%, 40%);">+ tolerance: 2000</span><br><span> -</span><br><span> type: 'energy_check'</span><br><span> channel: 'Local/audio@soundtest'</span><br><span> context: 'default'</span><br><span> exten: 's'</span><br><span> priority: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+expected-ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ type: 'headermatch'</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'MixMonitorStart'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: 'Local/talk@default-.*'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ type: 'headermatch'</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'MixMonitorMute'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: 'Local/talk@default-.*'</span><br><span style="color: hsl(120, 100%, 40%);">+ Direction: 'both'</span><br><span style="color: hsl(120, 100%, 40%);">+ State: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ type: 'headermatch'</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'MixMonitorMute'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: 'Local/talk@default-.*'</span><br><span style="color: hsl(120, 100%, 40%);">+ Direction: 'both'</span><br><span style="color: hsl(120, 100%, 40%);">+ State: '0'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ type: 'headermatch'</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'MixMonitorStop'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: 'Local/talk@default-.*'</span><br><span style="color: hsl(120, 100%, 40%);">+ count: '1'</span><br><span> </span><br><span> properties:</span><br><span> dependencies:</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/testsuite/+/15502">change 15502</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/testsuite/+/15502"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I5f0a20517c7d1d5707a6ed03ceedad5fb8c72b4d </div>
<div style="display:none"> Gerrit-Change-Number: 15502 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sébastien Duthil <sduthil@wazo.community> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>