App to send DTMF digits. More...
#include "asterisk.h"#include "asterisk/pbx.h"#include "asterisk/module.h"#include "asterisk/app.h"#include "asterisk/manager.h"#include "asterisk/channel.h"
Go to the source code of this file.
Functions | |
| static void | __reg_module (void) |
| static void | __unreg_module (void) |
| static int | load_module (void) |
| static int | manager_play_dtmf (struct mansession *s, const struct message *m) |
| static int | senddtmf_exec (struct ast_channel *chan, void *vdata) |
| static int | unload_module (void) |
Variables | |
| static struct ast_module_info __MODULE_INFO_SECTION | __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Send DTMF digits Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } |
| static char * | app = "SendDTMF" |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static char | mandescr_playdtmf [] = " Digit: The dtmf digit to play\n" |
App to send DTMF digits.
Definition in file app_senddtmf.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 143 of file app_senddtmf.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 143 of file app_senddtmf.c.
| static int load_module | ( | void | ) | [static] |
Definition at line 133 of file app_senddtmf.c.
References ast_manager_register2(), ast_register_application_xml, EVENT_FLAG_CALL, manager_play_dtmf(), and senddtmf_exec().
{
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_xml(app, senddtmf_exec);
return res;
}
| static int manager_play_dtmf | ( | struct mansession * | s, |
| const struct message * | m | ||
| ) | [static] |
Definition at line 99 of file app_senddtmf.c.
References ast_channel_unlock, ast_get_channel_by_name_locked(), ast_senddigit(), ast_strlen_zero(), astman_get_header(), astman_send_ack(), astman_send_error(), and chan.
Referenced by load_module().
{
const char *channel = astman_get_header(m, "Channel");
const char *digit = astman_get_header(m, "Digit");
struct ast_channel *chan = ast_get_channel_by_name_locked(channel);
if (!chan) {
astman_send_error(s, m, "Channel not specified");
return 0;
}
if (ast_strlen_zero(digit)) {
astman_send_error(s, m, "No digit specified");
ast_channel_unlock(chan);
return 0;
}
ast_senddigit(chan, *digit, 0);
ast_channel_unlock(chan);
astman_send_ack(s, m, "DTMF successfully queued");
return 0;
}
| static int senddtmf_exec | ( | struct ast_channel * | chan, |
| void * | vdata | ||
| ) | [static] |
Definition at line 65 of file app_senddtmf.c.
References AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_dtmf_stream(), ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), and LOG_WARNING.
Referenced by load_module().
{
int res = 0;
char *data;
int timeout = 0, duration = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(digits);
AST_APP_ARG(timeout);
AST_APP_ARG(duration);
);
if (ast_strlen_zero(vdata)) {
ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n");
return 0;
}
data = ast_strdupa(vdata);
AST_STANDARD_APP_ARGS(args, data);
if (!ast_strlen_zero(args.timeout))
timeout = atoi(args.timeout);
if (!ast_strlen_zero(args.duration))
duration = atoi(args.duration);
res = ast_dtmf_stream(chan, NULL, args.digits, timeout <= 0 ? 250 : timeout, duration);
return res;
}
| static int unload_module | ( | void | ) | [static] |
Definition at line 123 of file app_senddtmf.c.
References ast_manager_unregister(), and ast_unregister_application().
{
int res;
res = ast_unregister_application(app);
res |= ast_manager_unregister("PlayDTMF");
return res;
}
struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Send DTMF digits Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
Definition at line 143 of file app_senddtmf.c.
char* app = "SendDTMF" [static] |
Definition at line 63 of file app_senddtmf.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 143 of file app_senddtmf.c.
char mandescr_playdtmf[] = " Digit: The dtmf digit to play\n" [static] |
Definition at line 93 of file app_senddtmf.c.