Skip to content

Commit

Permalink
app_sf: Add tests for app_sf module
Browse files Browse the repository at this point in the history
Adds tests for SendSF, ReceiveSF, and SF
dial integration.

ASTERISK-29802

Change-Id: Ieacd700811b26d336e9ce8422a7785547fd40c6f
  • Loading branch information
InterLinked1 authored and Friendly Automation committed Jan 5, 2022
1 parent db40fcc commit 8a79a6e
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/apps/sf/configs/ast1/extensions.conf
@@ -0,0 +1,43 @@

[default]
exten => s,1,Answer()
same => n,Set(GLOBAL(sendsf1)=111111)
same => n,Set(GLOBAL(sendsf2)=1234567890)
same => n,Set(GLOBAL(sendsf3)=4652544465)
same => n,Set(GLOBAL(sendsf4)=996512350)
same => n,Set(GLOBAL(sendsf5)=10104345)
same => n,Set(GLOBAL(sendsf6)=056863456)
same => n,Set(GLOBAL(sendsf7)=723503763)
same => n,Set(GLOBAL(sendsf8)=567565967)
same => n,Set(GLOBAL(sendsf9)=6565546)
same => n,Set(i=0)
same => n,While($[${INC(i)}<=8])
same => n,Originate(Local/${i}@send-sf,exten,receive-sf,${i},1,,a)
same => n,EndWhile()
same => n,Dial(Local/9@receive-sf,,D(:::::${sendsf9}))
same => n,Hangup()

[nothing]
exten => 0,1,Answer()
same => n,Wait(15) ; enough time for sendsf9 to send. must be greater than ReceiveSF timeout.
same => n,Hangup()

[send-sf]
exten => _X!,1,Answer(0.5)
same => n,SendSF(${sendsf${EXTEN}})
same => n,Wait(44) ; needed so ReceiveSF has time to finish.
same => n,Hangup()

[receive-sf]
exten => _X!,1,Answer()
same => n,ReceiveSF(digits,${LEN(${sendsf${EXTEN}})})
same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
exten => 9,1,Progress()
same => n,ReceiveSF(digits,,10)
same => n,GotoIf($["${digits}"="${sendsf${EXTEN}}"]?success,1:fail,1)
exten => success,1,Answer(1)
same => n,UserEvent(ReceiveSFSuccess,Result: Pass)
same => n,Hangup()
exten => fail,1,Answer(1)
same => n,UserEvent(ReceiveSFSuccess,Result: Fail ${RECEIVESFSTATUS} ${digits},Reason: ${digits})
same => n,Hangup()
59 changes: 59 additions & 0 deletions tests/apps/sf/test-config.yaml
@@ -0,0 +1,59 @@
testinfo:
summary: 'Ensure that app_sf module functions correctly.'
description: |
'This tests the SendSF and ReceiveSF applications as
well as Dial D option work correctly.'
test-modules:
test-object:
config-section: test-object-config
typename: 'test_case.TestCaseModule'
modules:
-
config-section: caller-originator
typename: 'pluggable_modules.Originator'
-
config-section: hangup-monitor
typename: 'pluggable_modules.HangupMonitor'
-
config-section: ami-config
typename: 'pluggable_modules.EventActionModule'

test-object-config:
connect-ami: True

caller-originator:
channel: 'Local/s@default'
context: 'nothing'
exten: '0'
priority: '1'
trigger: 'ami_connect'

hangup-monitor:
ids: '0'

ami-config:
-
ami-events:
conditions:
match:
Event: 'UserEvent'
UserEvent: 'ReceiveSFSuccess'
requirements:
match:
Result: 'Pass'
count: 9
stop_test:

properties:
tags:
- dial
- apps
dependencies:
- python: 'twisted'
- python: 'starpy'
- asterisk: 'app_dial'
- asterisk: 'app_userevent'
- asterisk: 'app_originate'
- asterisk: 'app_sf'
- asterisk: 'pbx_config'
1 change: 1 addition & 0 deletions tests/apps/tests.yaml
Expand Up @@ -27,4 +27,5 @@ tests:
- test: 'waitdigit'
- dir: 'sendtext'
- test: 'mf'
- test: 'sf'
- test: 'read'

0 comments on commit 8a79a6e

Please sign in to comment.