119 enum read_option_flags {
120 OPT_ANSWER = (1 << 0),
132 static const char senddtmf_name[] =
"SendDTMF";
134 static int senddtmf_exec(
struct ast_channel *chan,
const char *vdata)
138 int dinterval = 0, duration = 0;
142 char *opt_args[OPT_ARG_ARRAY_SIZE];
152 if (ast_strlen_zero(vdata)) {
153 ast_log(LOG_WARNING,
"SendDTMF requires an argument\n");
160 if (ast_strlen_zero(args.digits)) {
161 ast_log(LOG_WARNING,
"The digits argument is required (0-9,*#,a-d,A-D,wfF)\n");
164 if (!ast_strlen_zero(args.dinterval)) {
167 if (!ast_strlen_zero(args.duration)) {
170 if (!ast_strlen_zero(args.channel)) {
173 ast_log(LOG_WARNING,
"No such channel: %s\n", args.channel);
176 chan_dest = chan_found;
177 if (chan_found != chan) {
178 chan_autoservice = chan;
181 if (!ast_strlen_zero(args.options)) {
184 if (ast_test_flag(&flags, OPT_ANSWER)) {
188 dinterval <= 0 ? 250 : dinterval, duration);
193 return chan_autoservice ? 0 : res;
203 unsigned int duration_ms = 0;
210 if (ast_strlen_zero(digit)) {
216 if (!ast_strlen_zero(duration) && (sscanf(duration,
"%30u", &duration_ms) != 1)) {
223 struct ast_frame f = { AST_FRAME_DTMF, };
256 ast_channel_lock(chan);
258 ast_channel_unlock(chan);
266 static int unload_module(
void)
277 static int load_module(
void)
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration)
Send a string of DTMF digits to a channel.
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
int ast_auto_answer(struct ast_channel *chan)
Answer a channel, if it's not already answered.
#define ast_channel_unref(c)
Decrease channel reference count.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_senddigit_external(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel from an external thread.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
int ast_unregister_application(const char *app)
Unregister an application.
struct ast_frame_subclass subclass
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
General Asterisk PBX channel definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
In case you didn't read that giant block of text above the mansession_session struct, the mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Core PBX routines and definitions.
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_parse_timelen(const char *timestr, int *result, enum ast_timelen defunit)
Common routine to parse time lengths, with optional time unit specifier.
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
#define ASTERISK_GPL_KEY
The text the key() function should return.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
Asterisk module definitions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define AST_APP_ARG(name)
Define an application argument.