summaryrefslogtreecommitdiff
path: root/apps/app_senddtmf.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-09-28 03:06:53 +0000
committerMatthew Jordan <mjordan@digium.com>2012-09-28 03:06:53 +0000
commitacb3a5f76fd5ceb8a9f9beef066759ff70194eb2 (patch)
tree3c97ec5d7347e7e65b11cf60b7804304be2f9cc3 /apps/app_senddtmf.c
parent5c946d98ba566e765e4fb956faf8945da62d298f (diff)
Add Duration header for PlayDTMF AMI Action
This patch adds an optional header to the PlayDTMF AMI action, Duration. It allows the duration of the DTMF digit to be played on the channel to be specified in milliseconds. (closes issue ASTERISK-18172) Reported by: Renato dos Santos patches: send-dtmf.patch uploaded by Renato dos Santos (license #6267) Modified slightly for this commit for Asterisk 12. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373979 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_senddtmf.c')
-rw-r--r--apps/app_senddtmf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c
index e1e8ee92f..7db9a3f4b 100644
--- a/apps/app_senddtmf.c
+++ b/apps/app_senddtmf.c
@@ -79,6 +79,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<parameter name="Digit" required="true">
<para>The DTMF digit to play.</para>
</parameter>
+ <parameter name="Duration" required="false">
+ <para>The duration, in milliseconds, of the digit to be played.</para>
+ </parameter>
</syntax>
<description>
<para>Plays a dtmf digit on the specified channel.</para>
@@ -145,7 +148,9 @@ 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");
struct ast_channel *chan;
+ unsigned int duration_ms = 0;
if (!(chan = ast_channel_get_by_name(channel))) {
astman_send_error(s, m, "Channel not found");
@@ -157,8 +162,14 @@ static int manager_play_dtmf(struct mansession *s, const struct message *m)
chan = ast_channel_unref(chan);
return 0;
}
+
+ if (!ast_strlen_zero(duration) && (sscanf(duration, "%30u", &duration_ms) != 1)) {
+ astman_send_error(s, m, "Could not convert Duration parameter");
+ chan = ast_channel_unref(chan);
+ return 0;
+ }
- ast_senddigit(chan, *digit, 0);
+ ast_senddigit(chan, *digit, duration_ms);
chan = ast_channel_unref(chan);