[Asterisk-code-review] app_senddtmf: Add receive mode to AMI Action PlayDTMF (testsuite[17])

Friendly Automation asteriskteam at digium.com
Tue Jan 7 08:24:17 CST 2020


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

Change subject: app_senddtmf: Add receive mode to AMI Action PlayDTMF
......................................................................

app_senddtmf: Add receive mode to AMI Action PlayDTMF

Change-Id: I50f29a7c86ad10ef0f94d1aebb6eca4d905b4ec4
---
A tests/manager/playdtmf/configs/ast1/extensions.conf
A tests/manager/playdtmf/configs/ast1/pjsip.conf
A tests/manager/playdtmf/sipp/invite.xml
A tests/manager/playdtmf/test-config.yaml
M tests/manager/tests.yaml
5 files changed, 186 insertions(+), 0 deletions(-)

Approvals:
  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/manager/playdtmf/configs/ast1/extensions.conf b/tests/manager/playdtmf/configs/ast1/extensions.conf
new file mode 100644
index 0000000..d673b0f
--- /dev/null
+++ b/tests/manager/playdtmf/configs/ast1/extensions.conf
@@ -0,0 +1,13 @@
+[default]
+exten => dialplan,1,Answer()
+      same => n,UserEvent(ready)
+      same => n,WaitExten(2)
+      same => n,Hangup()
+
+exten => 1,1,UserEvent(invalid)
+    same => n,Wait(1)
+    same => n,Hangup()
+
+exten => 2,1,UserEvent(valid)
+    same => n,Wait(1)
+    same => n,Hangup()
diff --git a/tests/manager/playdtmf/configs/ast1/pjsip.conf b/tests/manager/playdtmf/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..b5a8e95
--- /dev/null
+++ b/tests/manager/playdtmf/configs/ast1/pjsip.conf
@@ -0,0 +1,33 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[endpoint_t](!)
+type=endpoint
+context=default
+transport=local
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_t](!)
+type=aor
+max_contacts=1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; alice
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[alice](aor_t)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint_t)
+aors=alice
diff --git a/tests/manager/playdtmf/sipp/invite.xml b/tests/manager/playdtmf/sipp/invite.xml
new file mode 100644
index 0000000..7d65577
--- /dev/null
+++ b/tests/manager/playdtmf/sipp/invite.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Invite with variables">
+	<send retrans="500">
+		<![CDATA[
+			INVITE sip:dialplan@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[call_number]
+			To: "bob" <sip:dialplan@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Contact: sip:alice@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP4 [local_ip]
+			s=-
+			c=IN IP4 [local_ip]
+			t=0 0
+			m=audio 2226 RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+
+		]]>
+	</send>
+
+	<recv response="100" optional="true" />
+
+	<recv response="180" optional="true" />
+
+	<recv response="200" />
+
+	<send>
+		<![CDATA[
+			ACK sip:dialplan@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:alice@[local_ip]>;tag=[call_number]
+			To: <sip:dialplan@[remote_ip]:[remote_port]>[peer_tag_param]
+			CSeq: [cseq] ACK
+			Call-ID: [call_id]
+			Contact: <sip:alice@[local_ip]>
+			Allow: INVITE, ACK, MESSAGE, BYE
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="BYE" crlf="true" />
+
+	<send retrans="500">
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+			Allow: INVITE, ACK, MESSAGE, BYE
+			Content-Type: application/sdp
+			Content-Length: 0
+
+		]]>
+	</send>
+
+</scenario>
diff --git a/tests/manager/playdtmf/test-config.yaml b/tests/manager/playdtmf/test-config.yaml
new file mode 100644
index 0000000..939e416
--- /dev/null
+++ b/tests/manager/playdtmf/test-config.yaml
@@ -0,0 +1,68 @@
+testinfo:
+    summary: 'Test the receive parameter for the AMI PlayDTMF'
+    description: |
+        This testcase will call into a dialplan that immediately waits for DTMF input via WaitExten()
+        The caller will first call PlayDtmf(digit=1), which should have no effect since this will only
+        send DTMF to the Pjsip channel and not affect the dialplan side. Then, the caller will call
+        PlayDtmf(digit=2, receive=1) which will make the dialplan side receive the DTMF digit 2.
+
+properties:
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'app_senddtmf'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        -
+             scenarios:
+                - { 'key-args': { 'scenario':'invite.xml', '-p':'5061' } }
+
+ami-config:
+    -
+        ami-events:
+            count: 1
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'ready'
+        ami-actions:
+            # without the "Receive" parameter, DTMF will be sent out on this channel and won't impact the PBX/dialplan side
+            -
+                action:
+                    Action: 'PlayDtmf'
+                    Channel: '{channel}'
+                    Digit: '1'
+            # with the "Receive" parameter, DTMF will be received on this channel and be caught by WaitExten() in the dialplan
+            -
+                action:
+                    Action: 'PlayDtmf'
+                    Channel: '{channel}'
+                    Digit: '2'
+                    Receive: '1'
+    -
+        ami-events:
+            count: 1
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'valid'
+    -
+        ami-events:
+            count: 0
+            conditions:
+                match:
+                    Event: 'UserEvent'
+                    UserEvent: 'invalid'
diff --git a/tests/manager/tests.yaml b/tests/manager/tests.yaml
index eab0ef4..6e6f8d5 100644
--- a/tests/manager/tests.yaml
+++ b/tests/manager/tests.yaml
@@ -23,3 +23,4 @@
     - test: 'response-time'
     - test: 'escaped_values'
     - dir:  'redirect'
+    - test: 'playdtmf'

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

Gerrit-Project: testsuite
Gerrit-Branch: 17
Gerrit-Change-Id: I50f29a7c86ad10ef0f94d1aebb6eca4d905b4ec4
Gerrit-Change-Number: 13266
Gerrit-PatchSet: 2
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200107/219681f0/attachment-0001.html>


More information about the asterisk-code-review mailing list