134 int tries = 1, to = 0, x = 0;
136 char *argcopy = NULL;
139 const char *
status =
"ERROR";
165 tries = atoi(arglist.attempts);
171 tosec = atof(arglist.timeout);
179 arglist.filename = NULL;
182 maxdigits = atoi(arglist.maxdigits);
183 if ((maxdigits < 1) || (maxdigits > 255)) {
186 ast_verb(3,
"Accepting a maximum of %d digits.\n", maxdigits);
189 ast_log(
LOG_WARNING,
"Invalid! Usage: Read(variable[,filename][,maxdigits][,option][,attempts][,timeout])\n\n");
209 while (tries && !res) {
211 if (ts && ts->
data[0]) {
215 for (x = 0; x < maxdigits; ) {
225 if (tmp[x-1] ==
'#') {
230 if (x >= maxdigits) {
241 status =
"INTERRUPTED";
246 ast_verb(3,
"User entered '%s'\n", tmp);
251 ast_verb(3,
"User entered nothing, %d chance%s left\n", tries, (tries != 1) ?
"s" :
"");
253 ast_verb(3,
"User entered nothing.\n");
int ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout)
Plays a stream and gets DTMF data from a channel.
struct ast_tone_zone * zone
#define ast_test_flag(p, flag)
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.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
#define ast_verb(level,...)
static force_inline int attribute_pure ast_strlen_zero(const char *s)
static struct ast_tone_zone_sound * ast_tone_zone_sound_unref(struct ast_tone_zone_sound *ts)
Release a reference to an ast_tone_zone_sound.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
#define ast_strdupa(s)
duplicate a string in memory from the stack
enum ast_channel_state _state
struct ast_tone_zone_sound * ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication)
Locate a tone zone sound.
static struct ast_app_option read_app_options[128]
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Structure used to handle boolean flags.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
int ast_answer(struct ast_channel *chan)
Answer a channel.
int ast_playtones_start(struct ast_channel *chan, int vol, const char *tonelist, int interruptible)
Start playing a list of tones on a channel.
const char * data
Description of a tone.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_stopstream(struct ast_channel *c)
Stops a stream.