Skip to content

Commit 85f8051

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
app_originate: Tests for variables
Tests to ensure correct behavior of Caller ID and variable functionality added to Originate. ASTERISK-29450 Change-Id: Ia63cf95a5a06257d4cfd856c029d6296abd82d9b
1 parent fe43b8c commit 85f8051

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[default]
2+
exten => s,1,Answer(1)
3+
same => n,Set(CALLERID(num)=13115552368)
4+
same => n,Set(CALLERID(name)=Bell Labs)
5+
same => n,Set(CALLERID(pres)=prohib_not_screened)
6+
same => n,Originate(Local/0@orig-dest,exten,orig-dest,1,1,,av(mytestvar=42))
7+
same => n,Originate(Local/0@orig-dest,exten,orig-dest,2,1,,av(__mytestvar=24))
8+
same => n,Originate(Local/0@orig-dest,exten,orig-dest,3,1,,av(bunny=bear^dog=cat^mytestvar=ice-cream))
9+
same => n,Originate(Local/0@orig-dest,exten,orig-dest,4,1,,av(fish=salmon^CALLERID(num)=${CALLERID(num)}^arctic=polar_bear))
10+
same => n,Originate(Local/0@orig-dest,exten,orig-dest,5,1,,av(CALLERID(pres)=${CALLERID(pres)}^CALLERID(name)=${CALLERID(name)}))
11+
same => n,Originate(Local/0@orig-dest,exten,orig-dest,6,1,,av(CALLERID(pres)=${CALLERID(pres)}^CALLERID(name)=${CALLERID(name)}))
12+
same => n,Originate(Local/7@orig-dest,app,Wait,2,,,acn)
13+
same => n,Originate(Local/8@orig-dest,app,Wait,2,,,ac(18005551212)n(Directory Assis))
14+
same => n,GotoIf($["${ORIGINATE_STATUS}"="SUCCESS"]?orig-dest,pass,1:orig-dest,fail,1)
15+
16+
[orig-dest]
17+
exten => 0,1,Answer(1)
18+
same => n,Wait(2)
19+
same => n,Hangup()
20+
exten => 1,1,GotoIf($["${mytestvar}"="42"]?pass,1:fail,1)
21+
exten => 2,1,GotoIf($["${mytestvar}"="24"]?pass,1:fail,1)
22+
exten => 3,1,GotoIf($["${mytestvar}"="ice-cream"]?pass,1:fail,1)
23+
exten => 4,1,GotoIf($["${CALLERID(num)}"="13115552368"]?pass,1:fail,1)
24+
exten => 5,1,GotoIf($["${CALLERID(name)}"="Bell Labs"]?pass,1:fail,1)
25+
exten => 6,1,GotoIf($["${CALLERID(pres)}"="prohib_not_screened"]?pass,1:fail,1)
26+
exten => 7,1,GotoIf($["${CALLERID(num)}"!="13115552368"]?fail,1)
27+
same => n,GotoIf($["${CALLERID(name)}"="Bell Labs"]?pass,1:fail,1)
28+
exten => 8,1,GotoIf($["${CALLERID(num)}"!="18005551212"]?fail,1)
29+
same => n,GotoIf($["${CALLERID(name)}"="Directory Assis"]?pass,1:fail,1)
30+
exten => pass,1,Answer(1)
31+
same => n,UserEvent(OriginateVariableSet,Result: Pass)
32+
same => n,Hangup()
33+
exten => fail,1,Answer(1)
34+
same => n,UserEvent(OriginateVariableSet,Result: Fail ${ORIGINATE_STATUS},Reason: ${mytestvar})
35+
same => n,Hangup()

tests/apps/originate/test-config.yaml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
testinfo:
2+
summary: 'Ensure that Originate work as intended.'
3+
description: |
4+
'This tests multiple Originate scenarios with
5+
Caller ID and variables on each channel to
6+
ensure that they are set properly.'
7+
8+
test-modules:
9+
test-object:
10+
config-section: test-object-config
11+
typename: 'test_case.TestCaseModule'
12+
modules:
13+
-
14+
config-section: caller-originator
15+
typename: 'pluggable_modules.Originator'
16+
-
17+
config-section: hangup-monitor
18+
typename: 'pluggable_modules.HangupMonitor'
19+
-
20+
config-section: ami-config
21+
typename: 'pluggable_modules.EventActionModule'
22+
23+
test-object-config:
24+
connect-ami: True
25+
26+
caller-originator:
27+
channel: 'Local/s@default'
28+
context: 'orig-dest'
29+
exten: '0'
30+
priority: '1'
31+
trigger: 'ami_connect'
32+
33+
hangup-monitor:
34+
ids: '0'
35+
36+
ami-config:
37+
-
38+
ami-events:
39+
conditions:
40+
match:
41+
Event: 'UserEvent'
42+
UserEvent: 'OriginateVariableSet'
43+
requirements:
44+
match:
45+
Result: 'Pass'
46+
count: 9
47+
stop_test:
48+
49+
properties:
50+
tags:
51+
- dial
52+
- apps
53+
dependencies:
54+
- python: 'twisted'
55+
- python: 'starpy'
56+
- asterisk: 'app_dial'
57+
- asterisk: 'app_userevent'
58+
- asterisk: 'app_originate'
59+
- asterisk: 'pbx_config'

tests/apps/tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ tests:
44
- dir: 'directory'
55
- dir: 'bridge'
66
- dir: 'dial'
7+
- test: 'originate'
78
- dir: 'voicemail'
89
- dir: 'incomplete'
910
- dir: 'confbridge'

0 commit comments

Comments
 (0)