214 if (!otherapp && level == 0) {
236 const char *if_pri =
NULL;
237 char *my_name =
NULL;
240 char end_varname[
sizeof(varname) + 4];
241 const char *
prefix =
"IF";
243 int used_index_i = -1, x = 0;
258 snprintf(used_index,
sizeof(used_index),
"%d", used_index_i);
259 snprintf(new_index,
sizeof(new_index),
"%d", used_index_i + 1);
263 memset(my_name, 0, size);
273 snprintf(varname,
sizeof(varname),
"%s_%s",
prefix,
label);
276 snprintf(end_varname,
sizeof(end_varname),
"END_%s",varname);
282 const char *goto_str;
286 snprintf(end_varname,
sizeof(end_varname),
"END_%s",varname);
300 ast_verb(3,
"Taking conditional false branch, jumping to priority %d\n", pri);
305 ast_verb(3,
"Taking absolute false branch, jumping to priority %d\n", pri);
310 ast_verb(3,
"Exiting conditional, jumping to priority %d\n", pri);
312 }
else if (
end == 4) {
320 if (
end <= 1 && !if_pri) {
324 memset(goto_str, 0, size);
327 }
else if (
end > 1 && if_pri) {
329 snprintf(end_varname,
sizeof(end_varname),
"END_%s", varname);
334 memset(goto_str, 0, size);
static const char * get_index(struct ast_channel *chan, const char *prefix, int idx)
static struct ast_exten * find_matching_priority(struct ast_context *c, const char *exten, int priority, const char *callerid)
static int if_exec(struct ast_channel *chan, const char *data)
static int if_helper(struct ast_channel *chan, const char *data, int end)
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "If Branch and Conditional Execution")
static int find_matching_endif(struct ast_channel *chan, const char *otherapp)
static int elseif_exec(struct ast_channel *chan, const char *data)
static int load_module(void)
static int end_exec(struct ast_channel *chan, const char *data)
static int unload_module(void)
static int else_exec(struct ast_channel *chan, const char *data)
static int exit_exec(struct ast_channel *chan, const char *data)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdupa(s)
duplicate a string in memory from the stack
General Asterisk PBX channel definitions.
#define ast_channel_lock(chan)
int ast_channel_priority(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_priority_set(struct ast_channel *chan, int value)
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
static char prefix[MAX_PREFIX]
#define ast_verb(level,...)
Asterisk module definitions.
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
struct ast_context * ast_walk_contexts(struct ast_context *con)
int ast_get_extension_priority(struct ast_exten *exten)
int ast_get_extension_matchcid(struct ast_exten *e)
const char * ast_get_extension_app(struct ast_exten *e)
const char * ast_get_extension_cidmatch(struct ast_exten *e)
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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.
const char * ast_get_include_name(const struct ast_include *include)
int ast_unlock_context(struct ast_context *con)
struct ast_exten * ast_walk_extension_priorities(struct ast_exten *exten, struct ast_exten *priority)
const char * ast_get_context_name(struct ast_context *con)
int ast_extension_match(const char *pattern, const char *extension)
Determine if a given extension matches a given pattern (in NXX format)
int ast_rdlock_contexts(void)
Read locks the context list.
const struct ast_include * ast_context_includes_get(const struct ast_context *con, int idx)
struct ast_exten * ast_walk_context_extensions(struct ast_context *con, struct ast_exten *priority)
int pbx_checkcondition(const char *condition)
Evaluate a condition.
int ast_unlock_contexts(void)
Unlocks contexts.
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string)
int ast_context_includes_count(const struct ast_context *con)
const char * ast_get_extension_name(struct ast_exten *exten)
int ast_rdlock_context(struct ast_context *con)
Read locks a given context.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Main Channel structure associated with a channel.
ast_context: An extension context
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
ast_include: include= support in extensions.conf