[asterisk-commits] mjordan: trunk r373979 - in /trunk: CHANGES apps/app_senddtmf.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 27 22:06:57 CDT 2012
Author: mjordan
Date: Thu Sep 27 22:06:53 2012
New Revision: 373979
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373979
Log:
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.
Modified:
trunk/CHANGES
trunk/apps/app_senddtmf.c
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=373979&r1=373978&r2=373979
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Sep 27 22:06:53 2012
@@ -16,6 +16,9 @@
* The SIPqualifypeer action now acknowledges the request once it has established
that the request is against a known peer. It also issues a new event,
'SIPqualifypeerdone', once the qualify action has been completed.
+
+ * The PlayDTMF action now supports an optional 'Duration' parameter. This
+ specifies the duration of the digit to be played, in milliseconds.
* Added VoicemailRefresh action to allow an external entity to trigger mailbox
updates when changes occur instead of requiring the use of pollmailboxes.
Modified: trunk/apps/app_senddtmf.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_senddtmf.c?view=diff&rev=373979&r1=373978&r2=373979
==============================================================================
--- trunk/apps/app_senddtmf.c (original)
+++ trunk/apps/app_senddtmf.c Thu Sep 27 22:06:53 2012
@@ -79,6 +79,9 @@
<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 @@
{
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 @@
chan = ast_channel_unref(chan);
return 0;
}
-
- ast_senddigit(chan, *digit, 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, duration_ms);
chan = ast_channel_unref(chan);
More information about the asterisk-commits
mailing list