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

lvl asteriskteam at digium.com
Thu Nov 7 11:09:48 CST 2019


lvl has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/13164 )


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



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/64/13164/1

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..3aa13c7
--- /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..958587f
--- /dev/null
+++ b/tests/manager/playdtmf/test-config.yaml
@@ -0,0 +1,57 @@
+testinfo:
+    summary: 'PlayDTMF testcase'
+    description: |
+        'asdf'
+
+properties:
+    dependencies:
+        - app : 'sipp'
+        - 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'
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/+/13164
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I50f29a7c86ad10ef0f94d1aebb6eca4d905b4ec4
Gerrit-Change-Number: 13164
Gerrit-PatchSet: 1
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191107/732c7154/attachment-0001.html>


More information about the asterisk-code-review mailing list