Skip to content

Commit 621b1df

Browse files
committed
rest_api/channels: Add test for whispering with no underlying stream
Adds a test to detect whispered audio when there is no underlying stream being sent to the channel.
1 parent a80f779 commit 621b1df

4 files changed

Lines changed: 112 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'''
2+
Copyright (C) 2013, Digium, Inc.
3+
Joshua Colp <jcolp@digium.com>
4+
5+
This program is free software, distributed under the terms of
6+
the GNU General Public License Version 2.
7+
'''
8+
9+
import logging
10+
11+
LOGGER = logging.getLogger(__name__)
12+
13+
14+
def on_start(ari, event, test_object):
15+
LOGGER.debug("on_start(%r)" % event)
16+
ari.post('channels', event['channel']['id'], 'snoop',
17+
spy='none', whisper='out', app='testsuite', appArgs='snoop')
18+
return True
19+
20+
21+
def on_snoop_start(ari, event, test_object):
22+
LOGGER.debug("on_snoop_start(%r)" % event)
23+
ari.post('channels', event['channel']['id'], 'play',
24+
media='sound:demo-congrats')
25+
return True
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[default]
2+
3+
exten => s,1,NoOp()
4+
same => n,Answer()
5+
same => n,Stasis(testsuite)
6+
same => n,Hangup()
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
testinfo:
2+
summary: Test whispering calls using ARI without an underlying stream on the hooked channel.
3+
description: |
4+
Originate a call and whisper to it using ARI.
5+
6+
test-modules:
7+
add-test-to-search-path: True
8+
test-object:
9+
config-section: test-object-config
10+
typename: ari.AriTestObject
11+
modules:
12+
- config-section: ari-config
13+
typename: ari.WebSocketEventModule
14+
-
15+
config-section: ami-uut
16+
typename: 'ami.AMIEventModule'
17+
18+
test-object-config:
19+
test-iterations:
20+
-
21+
- channel: Local/s@default
22+
application: AMD
23+
24+
ami-uut:
25+
-
26+
type: 'headermatch'
27+
id: '0'
28+
conditions:
29+
match:
30+
Event: 'VarSet'
31+
Variable: 'AMDSTATUS'
32+
Value: 'MACHINE'
33+
count: '1'
34+
-
35+
type: 'headermatch'
36+
id: '0'
37+
conditions:
38+
match:
39+
Event: 'ChanSpyStart'
40+
count: '1'
41+
-
42+
type: 'headermatch'
43+
id: '0'
44+
conditions:
45+
match:
46+
Event: 'ChanSpyStop'
47+
count: '1'
48+
49+
ari-config:
50+
apps: testsuite
51+
events:
52+
- conditions:
53+
match:
54+
type: StasisStart
55+
application: testsuite
56+
args: []
57+
count: 1
58+
callback:
59+
module: channel_whisper
60+
method: on_start
61+
- conditions:
62+
match:
63+
type: StasisStart
64+
application: testsuite
65+
args: ['snoop']
66+
count: 1
67+
callback:
68+
module: channel_whisper
69+
method: on_snoop_start
70+
71+
properties:
72+
dependencies:
73+
- python : autobahn.websocket
74+
- python : requests
75+
- python : twisted
76+
- python : starpy
77+
- asterisk : res_ari_channels
78+
- asterisk : app_amd
79+
tags:
80+
- ARI

tests/rest_api/channels/tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ tests:
66
- test: 'originate_then_continue'
77
- test: 'originate_to_pjsip_endpoint'
88
- test: 'snoop_whisper'
9+
- test: 'snoop_whisper_no_normal_flowing_audio'
910
- test: 'snoop_spy'
1011
- test: 'snoop_id'
1112
- dir: 'playback'

0 commit comments

Comments
 (0)