[Asterisk-code-review] app_directory: add test for skip call option (testsuite[18])

Michael Bradeen asteriskteam at digium.com
Fri Jan 27 14:27:13 CST 2023


Michael Bradeen has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/19799 )


Change subject: app_directory: add test for skip call option
......................................................................

app_directory: add test for skip call option

Adds new test for the ability to skip calling the extension when
selected from a directory.

apps/directory/directory_skip

ASTERISK-30405

Change-Id: I19e34d52ecbd40c03fc1e74247e6e83aa0f28948
---
A tests/apps/directory/directory_skip/configs/ast1/extensions.conf
A tests/apps/directory/directory_skip/configs/ast1/users.conf
A tests/apps/directory/directory_skip/test-config.yaml
M tests/apps/directory/tests.yaml
4 files changed, 161 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/99/19799/1

diff --git a/tests/apps/directory/directory_skip/configs/ast1/extensions.conf b/tests/apps/directory/directory_skip/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5d548e1
--- /dev/null
+++ b/tests/apps/directory/directory_skip/configs/ast1/extensions.conf
@@ -0,0 +1,57 @@
+; Confbridge contexts and extensions
+
+[directory]
+exten => standard,1,NoOp()
+	same => n,Directory(,,s)
+
+exten => select,1,NoOp()
+	same => n,Answer()
+	same => n,UserEvent(DirectoryEnter)
+	same => n,Directory(,,s)
+
+exten => exit,1,NoOp()
+	same => n,Answer()
+	same => n,UserEvent(QueueExit)
+	same => n,Hangup()
+
+exten => h,1,NoOp()
+	same => n,UserEvent(ExtensionSelect,Status: ${DIRECTORY_EXTEN})
+	same => n,Hangup()
+
+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(6000)
diff --git a/tests/apps/directory/directory_skip/configs/ast1/users.conf b/tests/apps/directory/directory_skip/configs/ast1/users.conf
new file mode 100644
index 0000000..e044d1f
--- /dev/null
+++ b/tests/apps/directory/directory_skip/configs/ast1/users.conf
@@ -0,0 +1,5 @@
+[2020]
+fullname=Dog Dog
+description=easy test DTMF string with no overlaps - 364
+userbase=2020
+hasdirectory=true
diff --git a/tests/apps/directory/directory_skip/test-config.yaml b/tests/apps/directory/directory_skip/test-config.yaml
new file mode 100644
index 0000000..77892a5
--- /dev/null
+++ b/tests/apps/directory/directory_skip/test-config.yaml
@@ -0,0 +1,82 @@
+testinfo:
+    summary: 'Test DIRECTORY_RESULT for common routes through app_directory.'
+    description: |
+        Tests common usage of the directory app to make sure the correct value
+        for channel variable DIRECTORY_RESULT is set in each of the following
+        conditions
+        * User allows directory application to timeout from initial prompt
+        * User issues DTMF '0' for operator
+        * User issues DTMF '*' for assistant
+        * User selects item from the directory and issues DTMF '1' to connect
+        * User selects item from the directory and issues DTMF '#' to exit
+        * User hangs up the phone at at the initial prompt
+        * User selects item from the directory and issues DTMF '1' to connect,
+          but can not connect because the extension is not in the dialplan at
+          the requested context
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'apptest.AppTest'
+
+test-object-config:
+  app: 'Directory'
+  scenarios:
+     -
+      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: 'DirectoryEnter'
+                  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: 'ExtensionSelect'
+                  Status: '2020'
+              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..0aaff49 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_skip'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19799
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: I19e34d52ecbd40c03fc1e74247e6e83aa0f28948
Gerrit-Change-Number: 19799
Gerrit-PatchSet: 1
Gerrit-Owner: 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/20230127/7853ddd1/attachment-0001.html>


More information about the asterisk-code-review mailing list