[Asterisk-code-review] app_senddtmf: add test for option to answer channel (testsuite[certified/18.9])

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


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

Change subject: app_senddtmf: add test for option to answer channel
......................................................................

app_senddtmf: add test for option to answer channel

adds a test for the 'a' option to make sure that both the new
feature works (channel is answered when set) and the existing
functionality (do not answer when not set) is maintained

ASTERISK-30422

Change-Id: I3f76b047e97e52e362e5475711c08bb4053b67b3
---
A tests/apps/senddtmf/configs/ast1/extensions.conf
A tests/apps/senddtmf/test-config.yaml
M tests/apps/tests.yaml
3 files changed, 101 insertions(+), 0 deletions(-)

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




diff --git a/tests/apps/senddtmf/configs/ast1/extensions.conf b/tests/apps/senddtmf/configs/ast1/extensions.conf
new file mode 100644
index 0000000..17347cf
--- /dev/null
+++ b/tests/apps/senddtmf/configs/ast1/extensions.conf
@@ -0,0 +1,20 @@
+[default]
+exten => noanswer,1,Answer()
+	same => n,Dial(Local/noanswer at send-dtmf/n,4,G(default^fail^1))
+	same => n,Goto(default,pass,1)
+exten => answer,1,Answer()
+	same => n,Dial(Local/answer at send-dtmf/n,4,G(default^pass^1))
+	same => n,Goto(default,fail,1)
+exten => fail,1,UserEvent(SendDtmfNoAnswer,Result: Fail,Reason: ${DIALSTATUS})
+	same => n,Hangup()
+exten => pass,1,UserEvent(SendDtmfNoAnswer,Result: Pass)
+	same => n,Hangup()
+
+
+[send-dtmf]
+exten => noanswer,1,NoOp()
+	same => n,SendDTMF(1#)
+	same => n,Hangup()
+exten => answer,1,NoOp()
+	same => n,SendDTMF(1#,,,,a)
+	same => n,Hangup()
\ No newline at end of file
diff --git a/tests/apps/senddtmf/test-config.yaml b/tests/apps/senddtmf/test-config.yaml
new file mode 100644
index 0000000..7395c75
--- /dev/null
+++ b/tests/apps/senddtmf/test-config.yaml
@@ -0,0 +1,64 @@
+testinfo:
+    summary: 'Ensure that Senddtmf no answer option works as expected'
+    description: |
+        'We expect that a call to senddtmf by default will not be
+         answered while calls to senddtmf with the 'a' = answer flag
+         should.'
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            config-section: noanswer-originator
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: answer-originator
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: hangup-monitor
+            typename: 'pluggable_modules.HangupMonitor'
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    connect-ami: True
+
+noanswer-originator:
+    channel: 'Local/noanswer at default'
+    application: 'Echo'
+    trigger: 'ami_connect'
+
+answer-originator:
+    channel: 'Local/answer at default'
+    application: 'Echo'
+    trigger: 'ami_connect'
+
+hangup-monitor:
+    ids: '0'
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'SendDtmfNoAnswer'
+        requirements:
+            match:
+                Result: 'Pass'
+        count: 2
+
+properties:
+    tags:
+        - senddtmf
+        - apps
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'app_dial'
+        - asterisk: 'app_userevent'
+        - asterisk: 'app_originate'
+        - asterisk: 'app_read'
+        - asterisk: 'pbx_config'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index a00c9d1..dba50c8 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -26,3 +26,5 @@
     - dir: 'statsd'
     - test: 'waitdigit'
     - dir: 'sendtext'
+    - test: 'senddtmf'
+

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19931
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: I3f76b047e97e52e362e5475711c08bb4053b67b3
Gerrit-Change-Number: 19931
Gerrit-PatchSet: 3
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/d41e7f12/attachment-0001.html>


More information about the asterisk-code-review mailing list