35 #include "asterisk/file.h"
131 static char *
app =
"ReadExten";
136 char exten[256] =
"";
137 int maxdigits =
sizeof(
exten) - 1;
138 int timeout = 0, digit_timeout = 0, x = 0;
139 char *argcopy = NULL, *
status =
"";
161 ast_log(
LOG_WARNING,
"Usage: ReadExten(variable[,filename[,context[,options[,timeout]]]])\n");
167 arglist.filename = NULL;
170 arglist.context = chan->
context;
176 timeout = atoi(arglist.timeout);
184 if (digit_timeout <= 0)
212 if (ts && ts->
data[0]) {
214 }
else if (arglist.filename) {
228 for (x = 0; x < maxdigits; x++) {
229 ast_debug(3,
"extension so far: '%s', timeout: %d\n", exten, timeout);
234 timeout = digit_timeout;
263 ast_debug(3,
"User entered valid extension '%s'\n", exten);
267 ast_debug(3,
"User dialed invalid extension '%s' in context '%s' on %s\n", exten, arglist.context, chan->
name);
280 return status[0] ==
'H' ? -1 : 0;
303 ast_log(
LOG_WARNING,
"Syntax: VALID_EXTEN([<context>],<extension>[,<priority>]) - missing argument <extension>!\n");
310 priority_int = atoi(
args.priority);
323 .
name =
"VALID_EXTEN",
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch) ...
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
char * str
Subscriber phone number (Malloced)
#define AST_MODULE_INFO_STANDARD(keystr, desc)
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
Asterisk main include file. File version handling, generic pbx functions.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
struct ast_party_caller caller
Channel Caller ID information.
struct ast_tone_zone * zone
#define ast_test_flag(p, flag)
char context[AST_MAX_CONTEXT]
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.
static int acf_isexten_exec(struct ast_channel *chan, const char *cmd, char *parse, char *buffer, size_t buflen)
void ast_playtones_stop(struct ast_channel *chan)
Stop playing tones on a channel.
int ast_unregister_application(const char *app)
Unregister an application.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static int load_module(void)
struct ast_party_id id
Caller party ID.
static int unload_module(void)
static int readexten_exec(struct ast_channel *chan, const char *data)
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Data structure associated with a custom dialplan function.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
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_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
Core PBX routines and definitions.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
static struct ast_app_option readexten_app_options[128]
#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.
const ast_string_field name
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...
static void parse(struct mgcp_request *req)
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.
static struct ast_custom_function acf_isexten
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int ast_fileexists(const char *filename, const char *fmt, const char *preflang)
Checks for the existence of a given file.
int ast_answer(struct ast_channel *chan)
Answer a channel.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
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.
static char context[AST_MAX_CONTEXT]
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
unsigned char valid
TRUE if the number information is valid/present.
#define ast_custom_function_register(acf)
Register a custom function.
const ast_string_field language
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
struct ast_party_number number
Subscriber phone number.