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

Friendly Automation asteriskteam at digium.com
Thu Nov 21 08:34:34 CST 2019


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

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

app_senddtmf: Add receive mode to AMI Action PlayDTMF

ASTERISK-28614

Change-Id: I183501297ae1dc294ae56b34acac9b0343eb2664
---
M apps/app_senddtmf.c
1 file changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c
index e0362e7..ea75a9e 100644
--- a/apps/app_senddtmf.c
+++ b/apps/app_senddtmf.c
@@ -80,6 +80,9 @@
 			<parameter name="Duration" required="false">
 				<para>The duration, in milliseconds, of the digit to be played.</para>
 			</parameter>
+			<parameter name="Receive" required="false">
+				<para>Emulate receiving DTMF on this channel instead of sending it out.</para>
+			</parameter>
 		</syntax>
 		<description>
 			<para>Plays a dtmf digit on the specified channel.</para>
@@ -147,6 +150,7 @@
 	const char *channel = astman_get_header(m, "Channel");
 	const char *digit = astman_get_header(m, "Digit");
 	const char *duration = astman_get_header(m, "Duration");
+	const char *receive_s = astman_get_header(m, "Receive");
 	struct ast_channel *chan;
 	unsigned int duration_ms = 0;
 
@@ -167,7 +171,14 @@
 		return 0;
 	}
 
-	ast_senddigit_external(chan, *digit, duration_ms);
+	if (ast_true(receive_s)) {
+		struct ast_frame f = { AST_FRAME_DTMF, };
+		f.len = duration_ms;
+		f.subclass.integer = *digit;
+		ast_queue_frame(chan, &f);
+	} else {
+		ast_senddigit_external(chan, *digit, duration_ms);
+	}
 
 	chan = ast_channel_unref(chan);
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I183501297ae1dc294ae56b34acac9b0343eb2664
Gerrit-Change-Number: 13163
Gerrit-PatchSet: 4
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.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/20191121/da767fef/attachment.html>


More information about the asterisk-code-review mailing list