[Asterisk-code-review] app_directory: add test for ability to specify configuration file (testsuite[20])
George Joseph
asteriskteam at digium.com
Mon Jan 30 06:35:00 CST 2023
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/19864 )
Change subject: app_directory: add test for ability to specify configuration file
......................................................................
app_directory: add test for ability to specify configuration file
Adds new test for the ability to read a voicemail.conf style
configuration file separate from voicemail.conf:
apps/directory/directory_file
ASTERISK-30404
Change-Id: I03b68d3e106b6c8829eb8437209c34ff17256f9b
---
A tests/apps/directory/directory_file/configs/ast1/directory.conf
A tests/apps/directory/directory_file/configs/ast1/extensions.conf
A tests/apps/directory/directory_file/test-config.yaml
M tests/apps/directory/tests.yaml
4 files changed, 172 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/64/19864/1
diff --git a/tests/apps/directory/directory_file/configs/ast1/directory.conf b/tests/apps/directory/directory_file/configs/ast1/directory.conf
new file mode 100644
index 0000000..0c5eefe
--- /dev/null
+++ b/tests/apps/directory/directory_file/configs/ast1/directory.conf
@@ -0,0 +1,2 @@
+[default]
+2020=2020,Dog Dog,,,,attach=no|saycid=no|envelope=no|delete=no
diff --git a/tests/apps/directory/directory_file/configs/ast1/extensions.conf b/tests/apps/directory/directory_file/configs/ast1/extensions.conf
new file mode 100644
index 0000000..a70d1f3
--- /dev/null
+++ b/tests/apps/directory/directory_file/configs/ast1/extensions.conf
@@ -0,0 +1,80 @@
+; Confbridge contexts and extensions
+
+[directory]
+exten => standard,1,NoOp()
+ same => n,Directory(,,c(directory.conf))
+
+exten => timeout,1,NoOp()
+ same => n,Answer()
+ same => n,Goto(standard,1)
+
+exten => operator,1,NoOp()
+ same => n,Answer()
+ same => n,UserEvent(QueueOperator)
+ same => n,Goto(standard,1)
+
+exten => assistant,1,NoOp()
+ same => n,Answer()
+ same => n,UserEvent(QueueAssistant)
+ same => n,Goto(standard,1)
+
+exten => select,1,NoOp()
+ same => n,Answer()
+ same => n,UserEvent(QueueSelect)
+ same => n,Goto(standard,1)
+
+exten => exit,1,NoOp()
+ same => n,Answer()
+ same => n,UserEvent(QueueExit)
+ same => n,Goto(standard,1)
+
+exten => hangup,1,NoOp()
+ same => n,Answer()
+ same => n,UserEvent(QueueHangup)
+ same => n,Goto(standard,1)
+
+exten => failselect,1,NoOp()
+ same => n,Answer()
+ same => n,UserEvent(QueueSelect)
+ same => n,Directory(,bogocontext,c(directory.conf))
+
+exten => h,1,NoOp()
+ same => n,UserEvent(TestStatus,Status: ${DIRECTORY_RESULT})
+
+exten => o,1,NoOp()
+ same => n,UserEvent(OperatorExtension)
+
+exten => a,1,NoOp()
+ same => n,UserEvent(AssistantExtension)
+
+exten => 2020,1,NoOp()
+ same => n,UserEvent(DogExtension)
+
+[default]
+
+exten => 2020,1,NoOp()
+ same => n,goto(directory,2020,1)
+
+exten => sendDTMF,1,NoOp()
+ same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+ same => n,SendDTMF(${DTMF_TO_SEND})
+ same => n,Goto(wait,1)
+
+exten => sendAudio,1,NoOp()
+ same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+ same => n,Playback(${TALK_AUDIO})
+ same => n,Goto(wait,1)
+
+exten => sendAudioWithDTMF,1,NoOp()
+ same => n,Verbose(1, Sending audio file ${TALK_AUDIO})
+ same => n,Playback(${TALK_AUDIO})
+ same => n,Verbose(1, Sending DTMF Signal ${DTMF_TO_SEND})
+ same => n,SendDTMF(${DTMF_TO_SEND})
+ same => n,Goto(wait,1)
+
+exten => hangup,1,NoOp()
+ same => n,Verbose(1, Hanging up)
+ same => n,Hangup()
+
+exten => wait,1,NoOp()
+ same => n,Wait(10000)
diff --git a/tests/apps/directory/directory_file/test-config.yaml b/tests/apps/directory/directory_file/test-config.yaml
new file mode 100644
index 0000000..ef04ae8
--- /dev/null
+++ b/tests/apps/directory/directory_file/test-config.yaml
@@ -0,0 +1,73 @@
+testinfo:
+ summary: 'Test that app_directory can read from a specified conf file.'
+ description: |
+ Tests that directory app can read extension configuration from a
+ specified file, in this test 'directory.conf'
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'apptest.AppTest'
+
+test-object-config:
+ app: 'Directory'
+ scenarios:
+ -
+ # Send DTMF for extension's name
+ channels:
+ -
+ channel-id: 'selectchan'
+ channel-name: 'LOCAL/select at directory'
+ context: 'default'
+ exten: 'wait'
+ start-on-create: True
+ events:
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'QueueSelect'
+ Channel: 'Local/select at directory-.*'
+ actions:
+ # select user 'dog'
+ -
+ action-type: 'send-dtmf'
+ delay: '1'
+ dtmf: '364'
+ # choose to direct to selected user
+ -
+ action-type: 'send-dtmf'
+ delay: '4'
+ dtmf: '1'
+ -
+ action-type: 'set-expected-result'
+ expected-result: 'Send DTMF'
+
+ -
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'TestStatus'
+ Status: 'SELECTED'
+ actions:
+ -
+ action-type: 'set-expected-result'
+ expected-result: 'Success'
+
+properties:
+ tags:
+ - apps
+ - directory
+ dependencies:
+ - buildoption: 'TEST_FRAMEWORK'
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'app_directory'
+ - asterisk : 'app_playback'
+ - asterisk : 'app_senddtmf'
+ - asterisk : 'app_userevent'
+ - asterisk : 'app_verbose'
+ - asterisk : 'pbx_config'
+
diff --git a/tests/apps/directory/tests.yaml b/tests/apps/directory/tests.yaml
index c895480..1c9ce7a 100644
--- a/tests/apps/directory/tests.yaml
+++ b/tests/apps/directory/tests.yaml
@@ -4,3 +4,4 @@
- test: 'directory_context_operator_exit'
- test: 'directory_attendant_exit'
- test: 'directory_result'
+ - test: 'directory_file'
--
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19864
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 20
Gerrit-Change-Id: I03b68d3e106b6c8829eb8437209c34ff17256f9b
Gerrit-Change-Number: 19864
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230130/fc148f08/attachment-0001.html>
More information about the asterisk-code-review
mailing list