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

Michael Bradeen asteriskteam at digium.com
Mon Feb 27 10:23:26 CST 2023


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


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(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/07/19907/1

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/+/19907
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 20
Gerrit-Change-Id: I3f76b047e97e52e362e5475711c08bb4053b67b3
Gerrit-Change-Number: 19907
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/20230227/ae3bf62d/attachment-0001.html>


More information about the asterisk-code-review mailing list