Skip to content

Commit 8a79a6e

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
app_sf: Add tests for app_sf module
Adds tests for SendSF, ReceiveSF, and SF dial integration. ASTERISK-29802 Change-Id: Ieacd700811b26d336e9ce8422a7785547fd40c6f
1 parent db40fcc commit 8a79a6e

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
[default]
3+
exten => s,1,Answer()
4+
same => n,Set(GLOBAL(sendsf1)=111111)
5+
same => n,Set(GLOBAL(sendsf2)=1234567890)
6+
same => n,Set(GLOBAL(sendsf3)=4652544465)
7+
same => n,Set(GLOBAL(sendsf4)=996512350)
8+
same => n,Set(GLOBAL(sendsf5)=10104345)
9+
same => n,Set(GLOBAL(sendsf6)=056863456)
10+
same => n,Set(GLOBAL(sendsf7)=723503763)
11+
same => n,Set(GLOBAL(sendsf8)=567565967)
12+
same => n,Set(GLOBAL(sendsf9)=6565546)
13+
same => n,Set(i=0)
14+
same => n,While($[${INC(i)}<=8])
15+
same => n,Originate(Local/${i}@send-sf,exten,receive-sf,${i},1,,a)
16+
same => n,EndWhile()
17+
same => n,Dial(Local/9@receive-sf,,D(:::::${sendsf9}))
18+
same => n,Hangup()
19+
20+
[nothing]
21+
exten => 0,1,Answer()
22+
same => n,Wait(15) ; enough time for sendsf9 to send. must be greater than ReceiveSF timeout.
23+
same => n,Hangup()
24+
25+
[send-sf]
26+
exten => _X!,1,Answer(0.5)
27+
same => n,SendSF(${sendsf${EXTEN}})
28+
same => n,Wait(44) ; needed so ReceiveSF has time to finish.
29+
same => n,Hangup()
30+
31+
[receive-sf]
32+
exten => _X!,1,Answer()
33+
same => n,ReceiveSF(digits,${LEN(${sendsf${EXTEN}})})
34+
same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
35+
exten => 9,1,Progress()
36+
same => n,ReceiveSF(digits,,10)
37+
same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
38+
exten => success,1,Answer(1)
39+
same => n,UserEvent(ReceiveSFSuccess,Result: Pass)
40+
same => n,Hangup()
41+
exten => fail,1,Answer(1)
42+
same => n,UserEvent(ReceiveSFSuccess,Result: Fail ${RECEIVESFSTATUS} ${digits},Reason: ${digits})
43+
same => n,Hangup()

tests/apps/sf/test-config.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
testinfo:
2+
summary: 'Ensure that app_sf module functions correctly.'
3+
description: |
4+
'This tests the SendSF and ReceiveSF 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: 'ReceiveSFSuccess'
42+
requirements:
43+
match:
44+
Result: 'Pass'
45+
count: 9
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_sf'
59+
- asterisk: 'pbx_config'

tests/apps/tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ tests:
2727
- test: 'waitdigit'
2828
- dir: 'sendtext'
2929
- test: 'mf'
30+
- test: 'sf'
3031
- test: 'read'

0 commit comments

Comments
 (0)