<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/testsuite/+/13266">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_senddtmf: Add receive mode to AMI Action PlayDTMF<br><br>Change-Id: I50f29a7c86ad10ef0f94d1aebb6eca4d905b4ec4<br>---<br>A tests/manager/playdtmf/configs/ast1/extensions.conf<br>A tests/manager/playdtmf/configs/ast1/pjsip.conf<br>A tests/manager/playdtmf/sipp/invite.xml<br>A tests/manager/playdtmf/test-config.yaml<br>M tests/manager/tests.yaml<br>5 files changed, 186 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/manager/playdtmf/configs/ast1/extensions.conf b/tests/manager/playdtmf/configs/ast1/extensions.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..d673b0f</span><br><span>--- /dev/null</span><br><span>+++ b/tests/manager/playdtmf/configs/ast1/extensions.conf</span><br><span>@@ -0,0 +1,13 @@</span><br><span style="color: hsl(120, 100%, 40%);">+[default]</span><br><span style="color: hsl(120, 100%, 40%);">+exten => dialplan,1,Answer()</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,UserEvent(ready)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,WaitExten(2)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 1,1,UserEvent(invalid)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Wait(1)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+exten => 2,1,UserEvent(valid)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Wait(1)</span><br><span style="color: hsl(120, 100%, 40%);">+ same => n,Hangup()</span><br><span>diff --git a/tests/manager/playdtmf/configs/ast1/pjsip.conf b/tests/manager/playdtmf/configs/ast1/pjsip.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..b5a8e95</span><br><span>--- /dev/null</span><br><span>+++ b/tests/manager/playdtmf/configs/ast1/pjsip.conf</span><br><span>@@ -0,0 +1,33 @@</span><br><span style="color: hsl(120, 100%, 40%);">+[system]</span><br><span style="color: hsl(120, 100%, 40%);">+type=system</span><br><span style="color: hsl(120, 100%, 40%);">+timer_t1=100</span><br><span style="color: hsl(120, 100%, 40%);">+timer_b=6400</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[local]</span><br><span style="color: hsl(120, 100%, 40%);">+type=transport</span><br><span style="color: hsl(120, 100%, 40%);">+protocol=udp</span><br><span style="color: hsl(120, 100%, 40%);">+bind=0.0.0.0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[endpoint_t](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+context=default</span><br><span style="color: hsl(120, 100%, 40%);">+transport=local</span><br><span style="color: hsl(120, 100%, 40%);">+direct_media=no</span><br><span style="color: hsl(120, 100%, 40%);">+disallow=all</span><br><span style="color: hsl(120, 100%, 40%);">+allow=ulaw</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[aor_t](!)</span><br><span style="color: hsl(120, 100%, 40%);">+type=aor</span><br><span style="color: hsl(120, 100%, 40%);">+max_contacts=1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br><span style="color: hsl(120, 100%, 40%);">+;;; alice</span><br><span style="color: hsl(120, 100%, 40%);">+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](aor_t)</span><br><span style="color: hsl(120, 100%, 40%);">+contact=sip:alice@127.0.0.1:5061</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+[alice](endpoint_t)</span><br><span style="color: hsl(120, 100%, 40%);">+aors=alice</span><br><span>diff --git a/tests/manager/playdtmf/sipp/invite.xml b/tests/manager/playdtmf/sipp/invite.xml</span><br><span>new file mode 100644</span><br><span>index 0000000..7d65577</span><br><span>--- /dev/null</span><br><span>+++ b/tests/manager/playdtmf/sipp/invite.xml</span><br><span>@@ -0,0 +1,71 @@</span><br><span style="color: hsl(120, 100%, 40%);">+<?xml version="1.0" encoding="ISO-8859-1" ?></span><br><span style="color: hsl(120, 100%, 40%);">+<!DOCTYPE scenario SYSTEM "sipp.dtd"></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+<scenario name="Invite with variables"></span><br><span style="color: hsl(120, 100%, 40%);">+ <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+ <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+ INVITE sip:dialplan@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+ From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+ To: "bob" <sip:dialplan@[remote_ip]:[remote_port]></span><br><span style="color: hsl(120, 100%, 40%);">+ Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+ CSeq: [cseq] INVITE</span><br><span style="color: hsl(120, 100%, 40%);">+ Contact: sip:alice@[local_ip]:[local_port]</span><br><span style="color: hsl(120, 100%, 40%);">+ Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+ Content-Type: application/sdp</span><br><span style="color: hsl(120, 100%, 40%);">+ Content-Length: [len]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ v=0</span><br><span style="color: hsl(120, 100%, 40%);">+ o=- 1324901698 1324901698 IN IP4 [local_ip]</span><br><span style="color: hsl(120, 100%, 40%);">+ s=-</span><br><span style="color: hsl(120, 100%, 40%);">+ c=IN IP4 [local_ip]</span><br><span style="color: hsl(120, 100%, 40%);">+ t=0 0</span><br><span style="color: hsl(120, 100%, 40%);">+ m=audio 2226 RTP/AVP 0 101</span><br><span style="color: hsl(120, 100%, 40%);">+ a=sendrecv</span><br><span style="color: hsl(120, 100%, 40%);">+ a=rtpmap:0 PCMU/8000</span><br><span style="color: hsl(120, 100%, 40%);">+ a=rtpmap:101 telephone-event/8000</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ]]></span><br><span style="color: hsl(120, 100%, 40%);">+ </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ <recv response="100" optional="true" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ <recv response="180" optional="true" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ <recv response="200" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ <send></span><br><span style="color: hsl(120, 100%, 40%);">+ <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+ ACK sip:dialplan@[remote_ip]:[remote_port] SIP/2.0</span><br><span style="color: hsl(120, 100%, 40%);">+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]</span><br><span style="color: hsl(120, 100%, 40%);">+ From: <sip:alice@[local_ip]>;tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+ To: <sip:dialplan@[remote_ip]:[remote_port]>[peer_tag_param]</span><br><span style="color: hsl(120, 100%, 40%);">+ CSeq: [cseq] ACK</span><br><span style="color: hsl(120, 100%, 40%);">+ Call-ID: [call_id]</span><br><span style="color: hsl(120, 100%, 40%);">+ Contact: <sip:alice@[local_ip]></span><br><span style="color: hsl(120, 100%, 40%);">+ Allow: INVITE, ACK, MESSAGE, BYE</span><br><span style="color: hsl(120, 100%, 40%);">+ Max-Forwards: 70</span><br><span style="color: hsl(120, 100%, 40%);">+ Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ]]></span><br><span style="color: hsl(120, 100%, 40%);">+ </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ <recv request="BYE" crlf="true" /></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ <send retrans="500"></span><br><span style="color: hsl(120, 100%, 40%);">+ <![CDATA[</span><br><span style="color: hsl(120, 100%, 40%);">+ SIP/2.0 200 OK</span><br><span style="color: hsl(120, 100%, 40%);">+ [last_Via:]</span><br><span style="color: hsl(120, 100%, 40%);">+ [last_From:]</span><br><span style="color: hsl(120, 100%, 40%);">+ [last_To:];tag=[call_number]</span><br><span style="color: hsl(120, 100%, 40%);">+ [last_Call-ID:]</span><br><span style="color: hsl(120, 100%, 40%);">+ [last_CSeq:]</span><br><span style="color: hsl(120, 100%, 40%);">+ Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]></span><br><span style="color: hsl(120, 100%, 40%);">+ Allow: INVITE, ACK, MESSAGE, BYE</span><br><span style="color: hsl(120, 100%, 40%);">+ Content-Type: application/sdp</span><br><span style="color: hsl(120, 100%, 40%);">+ Content-Length: 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ]]></span><br><span style="color: hsl(120, 100%, 40%);">+ </send></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</scenario></span><br><span>diff --git a/tests/manager/playdtmf/test-config.yaml b/tests/manager/playdtmf/test-config.yaml</span><br><span>new file mode 100644</span><br><span>index 0000000..939e416</span><br><span>--- /dev/null</span><br><span>+++ b/tests/manager/playdtmf/test-config.yaml</span><br><span>@@ -0,0 +1,68 @@</span><br><span style="color: hsl(120, 100%, 40%);">+testinfo:</span><br><span style="color: hsl(120, 100%, 40%);">+ summary: 'Test the receive parameter for the AMI PlayDTMF'</span><br><span style="color: hsl(120, 100%, 40%);">+ description: |</span><br><span style="color: hsl(120, 100%, 40%);">+ This testcase will call into a dialplan that immediately waits for DTMF input via WaitExten()</span><br><span style="color: hsl(120, 100%, 40%);">+ The caller will first call PlayDtmf(digit=1), which should have no effect since this will only</span><br><span style="color: hsl(120, 100%, 40%);">+ send DTMF to the Pjsip channel and not affect the dialplan side. Then, the caller will call</span><br><span style="color: hsl(120, 100%, 40%);">+ PlayDtmf(digit=2, receive=1) which will make the dialplan side receive the DTMF digit 2.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+properties:</span><br><span style="color: hsl(120, 100%, 40%);">+ dependencies:</span><br><span style="color: hsl(120, 100%, 40%);">+ - app : 'sipp'</span><br><span style="color: hsl(120, 100%, 40%);">+ - asterisk : 'app_senddtmf'</span><br><span style="color: hsl(120, 100%, 40%);">+ - asterisk : 'res_pjsip'</span><br><span style="color: hsl(120, 100%, 40%);">+ tags:</span><br><span style="color: hsl(120, 100%, 40%);">+ - pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-modules:</span><br><span style="color: hsl(120, 100%, 40%);">+ test-object:</span><br><span style="color: hsl(120, 100%, 40%);">+ config-section: test-object-config</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'sipp.SIPpTestCase'</span><br><span style="color: hsl(120, 100%, 40%);">+ modules:</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ config-section: 'ami-config'</span><br><span style="color: hsl(120, 100%, 40%);">+ typename: 'pluggable_modules.EventActionModule'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test-object-config:</span><br><span style="color: hsl(120, 100%, 40%);">+ memcheck-delay-stop: 7</span><br><span style="color: hsl(120, 100%, 40%);">+ test-iterations:</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ scenarios:</span><br><span style="color: hsl(120, 100%, 40%);">+ - { 'key-args': { 'scenario':'invite.xml', '-p':'5061' } }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ami-config:</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 1</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'ready'</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-actions:</span><br><span style="color: hsl(120, 100%, 40%);">+ # without the "Receive" parameter, DTMF will be sent out on this channel and won't impact the PBX/dialplan side</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ action:</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'PlayDtmf'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: '{channel}'</span><br><span style="color: hsl(120, 100%, 40%);">+ Digit: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ # with the "Receive" parameter, DTMF will be received on this channel and be caught by WaitExten() in the dialplan</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ action:</span><br><span style="color: hsl(120, 100%, 40%);">+ Action: 'PlayDtmf'</span><br><span style="color: hsl(120, 100%, 40%);">+ Channel: '{channel}'</span><br><span style="color: hsl(120, 100%, 40%);">+ Digit: '2'</span><br><span style="color: hsl(120, 100%, 40%);">+ Receive: '1'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 1</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'valid'</span><br><span style="color: hsl(120, 100%, 40%);">+ -</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-events:</span><br><span style="color: hsl(120, 100%, 40%);">+ count: 0</span><br><span style="color: hsl(120, 100%, 40%);">+ conditions:</span><br><span style="color: hsl(120, 100%, 40%);">+ match:</span><br><span style="color: hsl(120, 100%, 40%);">+ Event: 'UserEvent'</span><br><span style="color: hsl(120, 100%, 40%);">+ UserEvent: 'invalid'</span><br><span>diff --git a/tests/manager/tests.yaml b/tests/manager/tests.yaml</span><br><span>index eab0ef4..6e6f8d5 100644</span><br><span>--- a/tests/manager/tests.yaml</span><br><span>+++ b/tests/manager/tests.yaml</span><br><span>@@ -23,3 +23,4 @@</span><br><span> - test: 'response-time'</span><br><span> - test: 'escaped_values'</span><br><span> - dir: 'redirect'</span><br><span style="color: hsl(120, 100%, 40%);">+ - test: 'playdtmf'</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/testsuite/+/13266">change 13266</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/testsuite/+/13266"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: I50f29a7c86ad10ef0f94d1aebb6eca4d905b4ec4 </div>
<div style="display:none"> Gerrit-Change-Number: 13266 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: lvl <digium@lvlconsultancy.nl> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>