[asterisk-commits] trunk r24805 - /trunk/apps/app_senddtmf.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu May 4 17:43:29 MST 2006
Author: russell
Date: Thu May 4 19:43:28 2006
New Revision: 24805
URL: http://svn.digium.com/view/asterisk?rev=24805&view=rev
Log:
- formatting fixes
- don't declare a variable in the middle of a block
- keep track of the result of registration functions in load_module()
Modified:
trunk/apps/app_senddtmf.c
Modified: trunk/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_senddtmf.c?rev=24805&r1=24804&r2=24805&view=diff
==============================================================================
--- trunk/apps/app_senddtmf.c (original)
+++ trunk/apps/app_senddtmf.c Thu May 4 19:43:28 2006
@@ -84,7 +84,7 @@
timeout = atoi(to);
}
- if(timeout <= 0)
+ if (timeout <= 0)
timeout = 250;
res = ast_dtmf_stream(chan,NULL,digits,timeout);
@@ -102,22 +102,26 @@
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");
+ char *channel = astman_get_header(m, "Channel");
+ char *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");
+
+ if (!chan) {
+ astman_send_error(s, m, "Channel not specified");
+ ast_mutex_unlock(&chan->lock);
return 0;
}
- if (digit == NULL) {
+ if (!digit) {
astman_send_error(s, m, "No digit specified");
+ ast_mutex_unlock(&chan->lock);
return 0;
}
+
ast_senddigit(chan, *digit);
+
ast_mutex_unlock(&chan->lock);
astman_send_ack(s, m, "DTMF successfully queued");
+
return 0;
}
@@ -135,8 +139,12 @@
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);
+ int res;
+
+ res = ast_manager_register2( "PlayDTMF", EVENT_FLAG_CALL, manager_play_dtmf, "Play DTMF signal on a specific channel.", mandescr_playdtmf );
+ res |= ast_register_application(app, senddtmf_exec, synopsis, descrip);
+
+ return res;
}
static const char *description(void)
More information about the asterisk-commits
mailing list