Skip to content

Commit 4b6370a

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
app_mf: Add tests for app_mf module
Adds tests for the following functionality: - SendMF application - ReceiveMF application - Dial D MF option Change-Id: I95a20b869933afc3fb43b6f31e81811d3a913494
1 parent d2affa9 commit 4b6370a

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
[default]
3+
4+
[default]
5+
exten => s,1,Answer()
6+
same => n,MSet(GLOBAL(sendmf1)=*123#)
7+
same => n,MSet(GLOBAL(sendmf2)=*123A)
8+
same => n,MSet(GLOBAL(sendmf3)=**123#)
9+
same => n,MSet(GLOBAL(sendmf4)=*1254*123#)
10+
same => n,MSet(GLOBAL(sendmf5)=*009####)
11+
same => n,Set(i=0)
12+
same => n,While($[${INC(i)}<=5])
13+
same => n,Originate(Local/${i}@send-mf,exten,receive-mf,${i},1,,a)
14+
same => n,EndWhile()
15+
same => n,Dial(Local/6@receive-mf,,D(:::*987#))
16+
same => n,Hangup()
17+
18+
[nothing]
19+
exten => 0,1,Answer()
20+
same => n,Wait(8)
21+
same => n,Hangup()
22+
23+
[send-mf]
24+
exten => _X!,1,Answer(0.5)
25+
same => n,SendMF(${sendmf${EXTEN}})
26+
same => n,Wait(99) ; needed so ReceiveMF has time to finish.
27+
same => n,Hangup()
28+
29+
[receive-mf]
30+
exten => _X!,1,Answer()
31+
same => n,ReceiveMF(digits)
32+
same => n,GotoIf($["${digits}"="${sendmf${EXTEN}}"]?success,1:fail,1)
33+
exten => 5,1,Answer()
34+
same => n,ReceiveMF(digits)
35+
same => n,GotoIf($["${digits}"="*009#"]?success,1:fail,1)
36+
exten => 6,1,Progress()
37+
same => n,ReceiveMF(digits,,kos)
38+
same => n,GotoIf($["${digits}"="987"]?success,1:fail,1)
39+
exten => success,1,Answer(1)
40+
same => n,UserEvent(ReceiveMFSuccess,Result: Pass)
41+
same => n,Hangup()
42+
exten => fail,1,Answer(1)
43+
same => n,UserEvent(ReceiveMFSuccess,Result: Fail ${RECEIVEMFSTATUS} ${digits},Reason: ${digits})
44+
same => n,Hangup()

tests/apps/mf/test-config.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
testinfo:
2+
summary: 'Ensure that app_mf module functions correctly.'
3+
description: |
4+
'This tests the SendMF and ReceiveMF applications as
5+
well as Dial D option work correctly.'
6+
7+
test-modules:
8+
test-object:
9+
config-section: test-object-config
10+
typename: 'test_case.TestCaseModule'
11+
modules:
12+
-
13+
config-section: caller-originator
14+
typename: 'pluggable_modules.Originator'
15+
-
16+
config-section: hangup-monitor
17+
typename: 'pluggable_modules.HangupMonitor'
18+
-
19+
config-section: ami-config
20+
typename: 'pluggable_modules.EventActionModule'
21+
22+
test-object-config:
23+
connect-ami: True
24+
25+
caller-originator:
26+
channel: 'Local/s@default'
27+
context: 'nothing'
28+
exten: '0'
29+
priority: '1'
30+
trigger: 'ami_connect'
31+
32+
hangup-monitor:
33+
ids: '0'
34+
35+
ami-config:
36+
-
37+
ami-events:
38+
conditions:
39+
match:
40+
Event: 'UserEvent'
41+
UserEvent: 'ReceiveMFSuccess'
42+
requirements:
43+
match:
44+
Result: 'Pass'
45+
count: 6
46+
stop_test:
47+
48+
properties:
49+
tags:
50+
- dial
51+
- apps
52+
dependencies:
53+
- python: 'twisted'
54+
- python: 'starpy'
55+
- asterisk: 'app_dial'
56+
- asterisk: 'app_userevent'
57+
- asterisk: 'app_originate'
58+
- asterisk: 'app_mf'
59+
- asterisk: 'pbx_config'

tests/apps/tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ tests:
2626
- dir: 'statsd'
2727
- test: 'waitdigit'
2828
- dir: 'sendtext'
29+
- test: 'mf'

0 commit comments

Comments
 (0)