Skip to content

Commit 1fc1bd3

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
app_sendtext: Add test for ReceiveText
Adds test for new ReceiveText application. ASTERISK-29759 Change-Id: Ic65424b85d1bb2ff4cedb062ee7f23295377d1cc
1 parent 6d70318 commit 1fc1bd3

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
[default]
3+
exten => s,1,Answer()
4+
same => n,Set(GLOBAL(sendtext1)=Hello world)
5+
same => n,Set(GLOBAL(sendtext2)=Something cool.)
6+
same => n,Set(GLOBAL(sendtext3)=Hi, Joe! What's for lunch?)
7+
same => n,Set(GLOBAL(sendtext4)=http://example.com)
8+
same => n,Set(GLOBAL(sendtext5)={"city": "Anytown", "state": "USA"})
9+
same => n,Set(i=0)
10+
same => n,While($[${INC(i)}<=5])
11+
same => n,Originate(Local/${i}@send-text,exten,receive-text,${i},1,,a)
12+
same => n,EndWhile()
13+
same => n,Hangup()
14+
15+
[nothing]
16+
exten => 0,1,Answer()
17+
same => n,Wait(8)
18+
same => n,Hangup()
19+
20+
[send-text]
21+
exten => _X!,1,Answer(0.5)
22+
same => n,SendText(${sendtext${EXTEN}})
23+
same => n,Wait(2) ; needed so ReceiveText has time to finish.
24+
same => n,Hangup()
25+
26+
[receive-text]
27+
exten => _X!,1,Answer()
28+
same => n,ReceiveText(3)
29+
same => n,GotoIf($["${RECEIVETEXTMESSAGE}"="${sendtext${EXTEN}}"]?success,1:fail,1)
30+
exten => success,1,Answer(1)
31+
same => n,UserEvent(ReceiveTextSuccess,Result: Pass)
32+
same => n,Hangup()
33+
exten => fail,1,Answer(1)
34+
same => n,UserEvent(ReceiveTextSuccess,Result: Fail ${RECEIVETEXTSTATUS},Reason: ${RECEIVETEXTMESSAGE})
35+
same => n,Hangup()

Diff for: tests/apps/sendtext/receive/test-config.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
testinfo:
2+
summary: 'Ensure that ReceiveText functions correctly.'
3+
description: |
4+
'This tests the ReceiveText application to ensure
5+
that it works correctly as the inverse to SendText.'
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: 'ReceiveTextSuccess'
42+
requirements:
43+
match:
44+
Result: 'Pass'
45+
count: 5
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_sendtext'
59+
- asterisk: 'pbx_config'

Diff for: tests/apps/sendtext/tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
tests:
33
- test: 'basic'
44
- test: 'enhanced'
5+
- test: 'receive'

0 commit comments

Comments
 (0)