[asterisk-commits] trunk r24776 - in /trunk: apps/app_senddtmf.c doc/manager.txt

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu May 4 14:33:46 MST 2006


Author: bweschke
Date: Thu May  4 16:33:45 2006
New Revision: 24776

URL: http://svn.digium.com/view/asterisk?rev=24776&view=rev
Log:
 New manager action SendDTMF #6682 (squinky86)


Modified:
    trunk/apps/app_senddtmf.c
    trunk/doc/manager.txt

Modified: trunk/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_senddtmf.c?rev=24776&r1=24775&r2=24776&view=diff
==============================================================================
--- trunk/apps/app_senddtmf.c (original)
+++ trunk/apps/app_senddtmf.c Thu May  4 16:33:45 2006
@@ -43,6 +43,7 @@
 #include "asterisk/options.h"
 #include "asterisk/utils.h"
 #include "asterisk/app.h"
+#include "asterisk/manager.h"
 
 static char *tdesc = "Send DTMF digits Application";
 
@@ -93,11 +94,39 @@
 	return res;
 }
 
+static char mandescr_playdtmf[] =
+"Description: Plays a dtmf digit on the specified channel.\n"
+"Variables: (all are required)\n"
+"	Channel: Channel name to send digit to\n"
+"	Digit: The dtmf digit to play\n";
+
+static int manager_play_dtmf(struct mansession *s, struct message *m)
+{
+	char *channel, *digit;
+
+	channel = astman_get_header(m, "Channel");
+	digit = astman_get_header(m, "Digit");
+	struct ast_channel *chan = ast_get_channel_by_name_locked(channel);
+	if (chan == NULL) {
+		astman_send_error(s, m, "No such channel");
+		return 0;
+	}
+	if (digit == NULL) {
+		astman_send_error(s, m, "No digit specified");
+		return 0;
+	}
+	ast_senddigit(chan, *digit);
+	ast_mutex_unlock(&chan->lock);
+	astman_send_ack(s, m, "DTMF successfully queued");
+	return 0;
+}
+
 static int unload_module(void *mod)
 {
 	int res;
 
 	res = ast_unregister_application(app);
+	res |= ast_manager_unregister("PlayDTMF");
 
 	STANDARD_HANGUP_LOCALUSERS;
 
@@ -106,6 +135,7 @@
 
 static int load_module(void *mod)
 {
+	ast_manager_register2( "PlayDTMF", EVENT_FLAG_CALL, manager_play_dtmf, "Play DTMF signal on a specific channel.", mandescr_playdtmf );
 	return ast_register_application(app, senddtmf_exec, synopsis, descrip);
 }
 

Modified: trunk/doc/manager.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/manager.txt?rev=24776&r1=24775&r2=24776&view=diff
==============================================================================
--- trunk/doc/manager.txt (original)
+++ trunk/doc/manager.txt Thu May  4 16:33:45 2006
@@ -100,6 +100,9 @@
 
 Command: Ping
 Parameters: None
+
+Command: PlayDTMF
+Parameters: Channel, Digit
 
 Command: Redirect
 Parameters: Channel, ExtraChannel, Exten, Context, Priority



More information about the asterisk-commits mailing list