Skip to content

Commit c36b6e0

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
app_signal: Add tests for Signal and WaitForSignal
Adds tests for the Signal and WaitForSignal applications to ensure proper functionality. ASTERISK-29810 Change-Id: I314a7f704def5ecf2e4eac008aebfdc3077d08cd
1 parent 381c701 commit c36b6e0

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
[default]
3+
exten => s,1,Answer()
4+
same => n,Signal(nothing)
5+
same => n,GotoIf($["${SIGNALSTATUS}"!="FAILURE"]?fail,1)
6+
same => n,Dial(Local/s@spawn-hangup,5)
7+
same => n,GotoIf($["${DIALSTATUS}"="TIMEOUT"]?fail,1)
8+
same => n,Originate(Local/1@spawn,app,Wait,5,,4)
9+
same => n,Wait(1.${RAND(5,9)})
10+
same => n,Signal(testsig1,payload1)
11+
same => n,GotoIf($["${SIGNALSTATUS}"!="SUCCESS"]?fail,1)
12+
same => n,Originate(Local/2@spawn,app,Wait,5,,4)
13+
same => n,Originate(Local/2@spawn,app,Wait,5,,4)
14+
same => n,Wait(1.${RAND(5,9)})
15+
same => n,Signal(testsig2,payload2)
16+
same => n,Hangup()
17+
18+
[spawn-hangup]
19+
exten => s,1,WaitForSignal(mysignal,2)
20+
same => n,Hangup()
21+
22+
[spawn]
23+
exten => _[12],1,Answer()
24+
same => n,WaitForSignal(testsig${EXTEN})
25+
same => n,UserEvent(SignalSuccess,Result: ${IF($["${WAITFORSIGNALSTATUS}"="SIGNALED"]?Pass:Failure)})
26+
same => n,ExecIf($["${WAITFORSIGNALPAYLOAD}"!="payload${EXTEN}"]?UserEvent(SignalSuccess,Result:Failure))
27+
same => n,Hangup()
28+
29+
[nothing]
30+
exten => 0,1,Answer()
31+
same => n,Wait(10)
32+
same => n,Hangup()

tests/apps/signal/test-config.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
testinfo:
2+
summary: 'Ensure that app_signal functions correctly.'
3+
description: |
4+
'This tests the Signal and WaitForSignal applications to make sure
5+
that signaling works correctly. This includes sending signals when
6+
there are listeners as well as when there aren't any listeners, as
7+
well as sending optional payloads.'
8+
9+
test-modules:
10+
test-object:
11+
config-section: test-object-config
12+
typename: 'test_case.TestCaseModule'
13+
modules:
14+
-
15+
config-section: caller-originator
16+
typename: 'pluggable_modules.Originator'
17+
-
18+
config-section: hangup-monitor
19+
typename: 'pluggable_modules.HangupMonitor'
20+
-
21+
config-section: ami-config
22+
typename: 'pluggable_modules.EventActionModule'
23+
24+
test-object-config:
25+
connect-ami: True
26+
27+
caller-originator:
28+
channel: 'Local/s@default'
29+
context: 'nothing'
30+
exten: '0'
31+
priority: '1'
32+
trigger: 'ami_connect'
33+
34+
hangup-monitor:
35+
ids: '0'
36+
37+
ami-config:
38+
-
39+
ami-events:
40+
conditions:
41+
match:
42+
Event: 'UserEvent'
43+
UserEvent: 'SignalSuccess'
44+
requirements:
45+
match:
46+
Result: 'Pass'
47+
count: 3
48+
stop_test:
49+
50+
properties:
51+
tags:
52+
- dial
53+
- apps
54+
dependencies:
55+
- python: 'twisted'
56+
- python: 'starpy'
57+
- asterisk: 'app_dial'
58+
- asterisk: 'app_userevent'
59+
- asterisk: 'app_originate'
60+
- asterisk: 'app_signal'
61+
- asterisk: 'pbx_config'

tests/apps/tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ tests:
2929
- test: 'sf'
3030
- test: 'read'
3131
- test: 'if'
32+
- test: 'signal'

0 commit comments

Comments
 (0)