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

Friendly Automation asteriskteam at digium.com
Mon Feb 27 13:48:41 CST 2023


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/19916 )

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/voicemail.conf
A tests/apps/directory/directory_skip/test-config.yaml
M tests/apps/directory/tests.yaml
4 files changed, 148 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




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/voicemail.conf b/tests/apps/directory/directory_skip/configs/ast1/voicemail.conf
new file mode 100644
index 0000000..0c5eefe
--- /dev/null
+++ b/tests/apps/directory/directory_skip/configs/ast1/voicemail.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_skip/test-config.yaml b/tests/apps/directory/directory_skip/test-config.yaml
new file mode 100644
index 0000000..ba22548
--- /dev/null
+++ b/tests/apps/directory/directory_skip/test-config.yaml
@@ -0,0 +1,72 @@
+testinfo:
+    summary: 'Test the skip calling directory option'
+    description: |
+        Tests that the directory 's' option sets the selected extension as
+        the channel variable 'DIRECTORY_EXTEN' instead of dialing it.
+
+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 1c9ce7a..c9c4ef4 100644
--- a/tests/apps/directory/tests.yaml
+++ b/tests/apps/directory/tests.yaml
@@ -5,3 +5,4 @@
     - test: 'directory_attendant_exit'
     - test: 'directory_result'
     - test: 'directory_file'
+    - test: 'directory_skip'

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

Gerrit-Project: testsuite
Gerrit-Branch: certified/18.9
Gerrit-Change-Id: I19e34d52ecbd40c03fc1e74247e6e83aa0f28948
Gerrit-Change-Number: 19916
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230227/5acfb26b/attachment-0001.html>


More information about the asterisk-code-review mailing list