Merge "app_senddtmf: Add receive mode to AMI Action PlayDTMF" into 13

This commit is contained in:
George Joseph
2019-11-21 09:20:10 -06:00
committed by Gerrit Code Review

View File

@@ -82,6 +82,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<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>
@@ -149,6 +152,7 @@ static int manager_play_dtmf(struct mansession *s, const struct message *m)
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;
@@ -169,7 +173,14 @@ static int manager_play_dtmf(struct mansession *s, const struct message *m)
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);