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

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


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

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, 100 insertions(+), 0 deletions(-)

Approvals:
  N A: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve
  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 8ce8fac..92a93e2 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -31,3 +31,4 @@
     - test: 'read'
     - test: 'if'
     - test: 'signal'
+    - test: 'senddtmf'
\ No newline at end of file

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

Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: I3f76b047e97e52e362e5475711c08bb4053b67b3
Gerrit-Change-Number: 19895
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: N A <asterisk at phreaknet.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230227/25e74152/attachment-0001.html>


More information about the asterisk-code-review mailing list