[Asterisk-code-review] app_senddtmf: Add receive mode to AMI Action PlayDTMF (asterisk[16])
lvl
asteriskteam at digium.com
Thu Nov 7 11:07:56 CST 2019
lvl has uploaded this change for review. ( 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
Change-Id: I183501297ae1dc294ae56b34acac9b0343eb2664
---
M apps/app_senddtmf.c
1 file changed, 19 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/63/13163/1
diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c
index e0362e7..ec08bb2 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,8 +150,10 @@
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;
+ int receive = 0;
if (!(chan = ast_channel_get_by_name(channel))) {
astman_send_error(s, m, "Channel not found");
@@ -167,7 +172,20 @@
return 0;
}
- ast_senddigit_external(chan, *digit, duration_ms);
+ if (ast_strlen_zero(receive_s)) {
+ receive = 0;
+ } else {
+ receive = abs(ast_true(receive_s));
+ }
+
+ if (receive) {
+ 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: 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/57abe07f/attachment.html>
More information about the asterisk-code-review
mailing list