#include <sys/types.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include "asterisk.h"
#include "asterisk/lock.h"
#include "asterisk/cli.h"
#include "asterisk/pbx.h"
#include "asterisk/channel.h"
#include "asterisk/options.h"
#include "asterisk/logger.h"
#include "asterisk/file.h"
#include "asterisk/callerid.h"
#include "asterisk/cdr.h"
#include "asterisk/config.h"
#include "asterisk/term.h"
#include "asterisk/manager.h"
#include "asterisk/ast_expr.h"
#include "asterisk/linkedlists.h"
#include "asterisk/say.h"
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/musiconhold.h"
#include "asterisk/app.h"
#include "asterisk/devicestate.h"
#include "asterisk/compat.h"
Include dependency graph for pbx.c:

Go to the source code of this file.
Data Structures | |
| struct | app_tmp |
| struct | ast_app |
| ast_app: A registered application More... | |
| struct | ast_context |
| ast_context: An extension context More... | |
| struct | ast_exten |
| ast_exten: An extension The dialplan is saved as a linked list with each context having it's own linked list of extensions - one item per priority. More... | |
| struct | ast_hint |
| Structure for dial plan hints. More... | |
| struct | ast_ignorepat |
| ast_ignorepat: Ignore patterns in dial plan More... | |
| struct | ast_include |
| ast_include: include= support in extensions.conf More... | |
| struct | ast_state_cb |
| ast_state_cb: An extension state notify register item More... | |
| struct | ast_sw |
| ast_sw: Switch statement in extensions.conf More... | |
| struct | async_stat |
| struct | dialplan_counters |
| struct | pbx_builtin |
| Declaration of builtin applications. More... | |
| struct | store_hint |
Defines | |
| #define | AST_PBX_MAX_STACK 128 |
| #define | BACKGROUND_MATCHEXTEN (1 << 2) |
| #define | BACKGROUND_NOANSWER (1 << 1) |
| #define | BACKGROUND_PLAYBACK (1 << 3) |
| #define | BACKGROUND_SKIP (1 << 0) |
| #define | DONT_HAVE_LENGTH 0x80000000 |
| #define | EXT_DATA_SIZE 8192 |
| #define | EXTENSION_MATCH_CORE(data, pattern, match) |
| #define | FIND_NEXT |
| #define | HELPER_CANMATCH 3 |
| #define | HELPER_EXEC 2 |
| #define | HELPER_EXISTS 0 |
| #define | HELPER_FINDLABEL 5 |
| #define | HELPER_MATCHMORE 4 |
| #define | HELPER_SPAWN 1 |
| #define | LOG |
| #define | STATUS_NO_CONTEXT 1 |
| #define | STATUS_NO_EXTENSION 2 |
| #define | STATUS_NO_LABEL 4 |
| #define | STATUS_NO_PRIORITY 3 |
| #define | STATUS_SUCCESS 5 |
| #define | SWITCH_DATA_LENGTH 256 |
| #define | VAR_BUF_SIZE 4096 |
| #define | VAR_HARDTRAN 3 |
| #define | VAR_NORMAL 1 |
| #define | VAR_SOFTTRAN 2 |
| #define | WAITEXTEN_MOH (1 << 0) |
Functions | |
| void | __ast_context_destroy (struct ast_context *con, const char *registrar) |
| static int | __ast_goto_if_exists (struct ast_channel *chan, char *context, char *exten, int priority, int async) |
| static int | __ast_pbx_run (struct ast_channel *c) |
| int | ast_active_calls (void) |
| int | ast_add_extension (const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar) |
| int | ast_add_extension2 (struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar) |
| static int | ast_add_hint (struct ast_exten *e) |
| ast_add_hint: Add hint to hint list, check initial extension state | |
| AST_APP_OPTIONS (resetcdr_opts,{AST_APP_OPTION('w', AST_CDR_FLAG_POSTED), AST_APP_OPTION('a', AST_CDR_FLAG_LOCKED), AST_APP_OPTION('v', AST_CDR_FLAG_KEEP_VARS),}) | |
| AST_APP_OPTIONS (waitexten_opts,{AST_APP_OPTION_ARG('m', WAITEXTEN_MOH, 1),}) | |
| AST_APP_OPTIONS (background_opts,{AST_APP_OPTION('s', BACKGROUND_SKIP), AST_APP_OPTION('n', BACKGROUND_NOANSWER), AST_APP_OPTION('m', BACKGROUND_MATCHEXTEN), AST_APP_OPTION('p', BACKGROUND_PLAYBACK),}) | |
| int | ast_async_goto (struct ast_channel *chan, const char *context, const char *exten, int priority) |
| int | ast_async_goto_by_name (const char *channame, const char *context, const char *exten, int priority) |
| int | ast_async_goto_if_exists (struct ast_channel *chan, char *context, char *exten, int priority) |
| int | ast_build_timing (struct ast_timing *i, char *info_in) |
| int | ast_canmatch_extension (struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid) |
| static int | ast_change_hint (struct ast_exten *oe, struct ast_exten *ne) |
| ast_change_hint: Change hint for an extension | |
| int | ast_check_timing (struct ast_timing *i) |
| int | ast_context_add_ignorepat (const char *con, const char *value, const char *registrar) |
| int | ast_context_add_ignorepat2 (struct ast_context *con, const char *value, const char *registrar) |
| int | ast_context_add_include (const char *context, const char *include, const char *registrar) |
| int | ast_context_add_include2 (struct ast_context *con, const char *value, const char *registrar) |
| int | ast_context_add_switch (const char *context, const char *sw, const char *data, int eval, const char *registrar) |
| int | ast_context_add_switch2 (struct ast_context *con, const char *value, const char *data, int eval, const char *registrar) |
| ast_context * | ast_context_create (struct ast_context **extcontexts, const char *name, const char *registrar) |
| void | ast_context_destroy (struct ast_context *con, const char *registrar) |
| ast_context * | ast_context_find (const char *name) |
| int | ast_context_remove_extension (const char *context, const char *extension, int priority, const char *registrar) |
| int | ast_context_remove_extension2 (struct ast_context *con, const char *extension, int priority, const char *registrar) |
| This functionc locks given context, search for the right extension and fires out all peer in this extensions with given priority. If priority is set to 0, all peers are removed. After that, unlock context and return. | |
| int | ast_context_remove_ignorepat (const char *context, const char *ignorepat, const char *registrar) |
| int | ast_context_remove_ignorepat2 (struct ast_context *con, const char *ignorepat, const char *registrar) |
| int | ast_context_remove_include (const char *context, const char *include, const char *registrar) |
| int | ast_context_remove_include2 (struct ast_context *con, const char *include, const char *registrar) |
| int | ast_context_remove_switch (const char *context, const char *sw, const char *data, const char *registrar) |
| int | ast_context_remove_switch2 (struct ast_context *con, const char *sw, const char *data, const char *registrar) |
| This function locks given context, removes switch, unlock context and return. | |
| int | ast_context_verify_includes (struct ast_context *con) |
| ast_custom_function * | ast_custom_function_find (char *name) |
| int | ast_custom_function_register (struct ast_custom_function *acf) |
| int | ast_custom_function_unregister (struct ast_custom_function *acf) |
| int | ast_exec_extension (struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid) |
| int | ast_exists_extension (struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid) |
| int | ast_explicit_goto (struct ast_channel *chan, const char *context, const char *exten, int priority) |
| int | ast_extension_close (const char *pattern, const char *data, int needmore) |
| int | ast_extension_match (const char *pattern, const char *data) |
| int | ast_extension_state (struct ast_channel *c, char *context, char *exten) |
| ast_extension_state: Check extension state for an extension by using hint | |
| static int | ast_extension_state2 (struct ast_exten *e) |
| ast_extensions_state2: Check state of extension by using hints | |
| const char * | ast_extension_state2str (int extension_state) |
| ast_extension_state2str: Return extension_state as string | |
| int | ast_extension_state_add (const char *context, const char *exten, ast_state_cb_type callback, void *data) |
| ast_extension_state_add: Add watcher for extension states | |
| int | ast_extension_state_del (int id, ast_state_cb_type callback) |
| ast_extension_state_del: Remove a watcher from the callback list | |
| int | ast_findlabel_extension (struct ast_channel *c, const char *context, const char *exten, const char *label, const char *callerid) |
| int | ast_findlabel_extension2 (struct ast_channel *c, struct ast_context *con, const char *exten, const char *label, const char *callerid) |
| char * | ast_func_read (struct ast_channel *chan, const char *in, char *workspace, size_t len) |
| void | ast_func_write (struct ast_channel *chan, const char *in, const char *value) |
| const char * | ast_get_context_name (struct ast_context *con) |
| const char * | ast_get_context_registrar (struct ast_context *c) |
| const char * | ast_get_extension_app (struct ast_exten *e) |
| void * | ast_get_extension_app_data (struct ast_exten *e) |
| const char * | ast_get_extension_cidmatch (struct ast_exten *e) |
| const char * | ast_get_extension_label (struct ast_exten *exten) |
| int | ast_get_extension_matchcid (struct ast_exten *e) |
| const char * | ast_get_extension_name (struct ast_exten *exten) |
| int | ast_get_extension_priority (struct ast_exten *exten) |
| const char * | ast_get_extension_registrar (struct ast_exten *e) |
| int | ast_get_hint (char *hint, int hintsize, char *name, int namesize, struct ast_channel *c, const char *context, const char *exten) |
| ast_get_hint: Get hint for channel | |
| const char * | ast_get_ignorepat_name (struct ast_ignorepat *ip) |
| const char * | ast_get_ignorepat_registrar (struct ast_ignorepat *ip) |
| const char * | ast_get_include_name (struct ast_include *inc) |
| const char * | ast_get_include_registrar (struct ast_include *i) |
| const char * | ast_get_switch_data (struct ast_sw *sw) |
| const char * | ast_get_switch_name (struct ast_sw *sw) |
| const char * | ast_get_switch_registrar (struct ast_sw *sw) |
| int | ast_goto_if_exists (struct ast_channel *chan, char *context, char *exten, int priority) |
| static struct ast_exten * | ast_hint_extension (struct ast_channel *c, const char *context, const char *exten) |
| ast_hint_extension: Find hint for given extension in context | |
| void | ast_hint_state_changed (const char *device) |
| int | ast_ignore_pattern (const char *context, const char *pattern) |
| AST_LIST_HEAD (store_hints, store_hint) | |
| int | ast_lock_context (struct ast_context *con) |
| int | ast_lock_contexts () |
| int | ast_matchmore_extension (struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid) |
| void | ast_merge_contexts_and_delete (struct ast_context **extcontexts, const char *registrar) |
| AST_MUTEX_DEFINE_STATIC (hintlock) | |
| AST_MUTEX_DEFINE_STATIC (switchlock) | |
| AST_MUTEX_DEFINE_STATIC (applock) | |
| AST_MUTEX_DEFINE_STATIC (conlock) | |
| AST_MUTEX_DEFINE_STATIC (acflock) | |
| AST_MUTEX_DEFINE_STATIC (maxcalllock) | |
| AST_MUTEX_DEFINE_STATIC (globalslock) | |
| int | ast_parseable_goto (struct ast_channel *chan, const char *goto_string) |
| int | ast_pbx_outgoing_app (const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel) |
| int | ast_pbx_outgoing_cdr_failed (void) |
| int | ast_pbx_outgoing_exten (const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel) |
| enum ast_pbx_result | ast_pbx_run (struct ast_channel *c) |
| static void * | ast_pbx_run_app (void *data) |
| enum ast_pbx_result | ast_pbx_start (struct ast_channel *c) |
| int | ast_register_application (const char *app, int(*execute)(struct ast_channel *, void *), const char *synopsis, const char *description) |
| Dynamically register a new dial plan application. | |
| int | ast_register_switch (struct ast_switch *sw) |
| static int | ast_remove_hint (struct ast_exten *e) |
| ast_remove_hint: Remove hint from extension | |
| int | ast_spawn_extension (struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid) |
| int | ast_unlock_context (struct ast_context *con) |
| int | ast_unlock_contexts () |
| int | ast_unregister_application (const char *app) |
| void | ast_unregister_switch (struct ast_switch *sw) |
| ast_exten * | ast_walk_context_extensions (struct ast_context *con, struct ast_exten *exten) |
| ast_ignorepat * | ast_walk_context_ignorepats (struct ast_context *con, struct ast_ignorepat *ip) |
| ast_include * | ast_walk_context_includes (struct ast_context *con, struct ast_include *inc) |
| ast_sw * | ast_walk_context_switches (struct ast_context *con, struct ast_sw *sw) |
| ast_context * | ast_walk_contexts (struct ast_context *con) |
| ast_exten * | ast_walk_extension_priorities (struct ast_exten *exten, struct ast_exten *priority) |
| static void * | async_wait (void *data) |
| static char * | complete_show_application (char *line, char *word, int pos, int state) |
| static char * | complete_show_applications (char *line, char *word, int pos, int state) |
| static char * | complete_show_dialplan_context (char *line, char *word, int pos, int state) |
| static char * | complete_show_function (char *line, char *word, int pos, int state) |
| static void | decrease_call_count (void) |
| static void | destroy_exten (struct ast_exten *e) |
| static int | ext_strncpy (char *dst, const char *src, int len) |
| static unsigned int | get_day (char *day) |
| static unsigned int | get_dow (char *dow) |
| get_dow: Get day of week | |
| static unsigned int | get_month (char *mon) |
| static void | get_timerange (struct ast_timing *i, char *times) |
| static int | handle_show_application (int fd, int argc, char *argv[]) |
| static int | handle_show_applications (int fd, int argc, char *argv[]) |
| static int | handle_show_dialplan (int fd, int argc, char *argv[]) |
| static int | handle_show_function (int fd, int argc, char *argv[]) |
| static int | handle_show_functions (int fd, int argc, char *argv[]) |
| static int | handle_show_hints (int fd, int argc, char *argv[]) |
| handle_show_hints: CLI support for listing registred dial plan hints | |
| static int | handle_show_switches (int fd, int argc, char *argv[]) |
| handle_show_switches: CLI support for listing registred dial plan switches | |
| static int | include_valid (struct ast_include *i) |
| static int | increase_call_count (const struct ast_channel *c) |
| int | load_pbx (void) |
| static int | matchcid (const char *cidpattern, const char *callerid) |
| static void | null_datad (void *foo) |
| static int | parse_variable_name (char *var, int *offset, int *length, int *isfunc) |
| static int | pbx_builtin_answer (struct ast_channel *, void *) |
| static int | pbx_builtin_atimeout (struct ast_channel *, void *) |
| static int | pbx_builtin_background (struct ast_channel *, void *) |
| static int | pbx_builtin_busy (struct ast_channel *, void *) |
| void | pbx_builtin_clear_globals (void) |
| static int | pbx_builtin_congestion (struct ast_channel *, void *) |
| static int | pbx_builtin_dtimeout (struct ast_channel *, void *) |
| static int | pbx_builtin_execiftime (struct ast_channel *, void *) |
| char * | pbx_builtin_getvar_helper (struct ast_channel *chan, const char *name) |
| static int | pbx_builtin_goto (struct ast_channel *, void *) |
| static int | pbx_builtin_gotoif (struct ast_channel *, void *) |
| static int | pbx_builtin_gotoiftime (struct ast_channel *, void *) |
| static int | pbx_builtin_hangup (struct ast_channel *, void *) |
| static int | pbx_builtin_importvar (struct ast_channel *, void *) |
| static int | pbx_builtin_noop (struct ast_channel *, void *) |
| static int | pbx_builtin_progress (struct ast_channel *, void *) |
| void | pbx_builtin_pushvar_helper (struct ast_channel *chan, const char *name, const char *value) |
| static int | pbx_builtin_resetcdr (struct ast_channel *, void *) |
| static int | pbx_builtin_ringing (struct ast_channel *, void *) |
| static int | pbx_builtin_rtimeout (struct ast_channel *, void *) |
| static int | pbx_builtin_saycharacters (struct ast_channel *, void *) |
| static int | pbx_builtin_saydigits (struct ast_channel *, void *) |
| static int | pbx_builtin_saynumber (struct ast_channel *, void *) |
| static int | pbx_builtin_sayphonetic (struct ast_channel *, void *) |
| int | pbx_builtin_serialize_variables (struct ast_channel *chan, char *buf, size_t size) |
| static int | pbx_builtin_setaccount (struct ast_channel *, void *) |
| static int | pbx_builtin_setamaflags (struct ast_channel *, void *) |
| static int | pbx_builtin_setglobalvar (struct ast_channel *, void *) |
| static int | pbx_builtin_setlanguage (struct ast_channel *, void *) |
| int | pbx_builtin_setvar (struct ast_channel *, void *) |
| void | pbx_builtin_setvar_helper (struct ast_channel *chan, const char *name, const char *value) |
| static int | pbx_builtin_setvar_old (struct ast_channel *, void *) |
| static int | pbx_builtin_wait (struct ast_channel *, void *) |
| static int | pbx_builtin_waitexten (struct ast_channel *, void *) |
| int | pbx_checkcondition (char *condition) |
| static void | pbx_destroy (struct ast_pbx *p) |
| int | pbx_exec (struct ast_channel *c, struct ast_app *app, void *data, int newstack) |
| static int | pbx_extension_helper (struct ast_channel *c, struct ast_context *con, const char *context, const char *exten, int priority, const char *label, const char *callerid, int action) |
| static struct ast_exten * | pbx_find_extension (struct ast_channel *chan, struct ast_context *bypass, const char *context, const char *exten, int priority, const char *label, const char *callerid, int action, char *incstack[], int *stacklen, int *status, struct ast_switch **swo, char **data, const char **foundcontext) |
| ast_app * | pbx_findapp (const char *app) |
| Find application handle in linked list. | |
| static struct ast_switch * | pbx_findswitch (const char *sw) |
| void | pbx_retrieve_variable (struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp) |
| pbx_retrieve_variable: Support for Asterisk built-in variables --- | |
| int | pbx_set_autofallthrough (int newval) |
| static void | pbx_substitute_variables (char *passdata, int datalen, struct ast_channel *c, struct ast_exten *e) |
| void | pbx_substitute_variables_helper (struct ast_channel *c, const char *cp1, char *cp2, int count) |
| static void | pbx_substitute_variables_helper_full (struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int count) |
| void | pbx_substitute_variables_varshead (struct varshead *headp, const char *cp1, char *cp2, int count) |
| static void * | pbx_thread (void *data) |
| static int | show_dialplan_helper (int fd, char *context, char *exten, struct dialplan_counters *dpc, struct ast_include *rinclude, int includecount, char *includes[]) |
| static char * | substring (const char *value, int offset, int length, char *workspace, size_t workspace_len) |
| takes a substring. It is ok to call with value == workspace. | |
| static void | wait_for_hangup (struct ast_channel *chan, void *data) |
Variables | |
| static struct ast_custom_function * | acf_root = NULL |
| static struct ast_app * | apps = NULL |
| static int | autofallthrough = 0 |
| static struct pbx_builtin | builtins [] |
| Declaration of builtin applications. | |
| static struct ast_context * | contexts = NULL |
| static int | countcalls = 0 |
| static char * | days [] |
| static struct varshead | globals |
| ast_hint * | hints = NULL |
| static char * | months [] |
| static struct ast_cli_entry | pbx_cli [] |
| static char | show_application_help [] |
| static char | show_applications_help [] |
| static char | show_dialplan_help [] |
| static char | show_function_help [] |
| static char | show_functions_help [] |
| static char | show_hints_help [] |
| static char | show_switches_help [] |
| ast_state_cb * | statecbs = NULL |
| static int | stateid = 1 |
| ast_switch * | switches = NULL |
Definition in file pbx.c.
| #define AST_PBX_MAX_STACK 128 |
Go no deeper than this through includes (not counting loops)
Definition at line 586 of file pbx.c.
Referenced by ast_hint_extension(), handle_show_dialplan(), pbx_extension_helper(), pbx_find_extension(), and show_dialplan_helper().
| #define BACKGROUND_MATCHEXTEN (1 << 2) |
| #define BACKGROUND_NOANSWER (1 << 1) |
| #define BACKGROUND_PLAYBACK (1 << 3) |
| #define BACKGROUND_SKIP (1 << 0) |
| #define DONT_HAVE_LENGTH 0x80000000 |
| #define EXT_DATA_SIZE 8192 |
Definition at line 74 of file pbx.c.
Referenced by pbx_extension_helper(), and realtime_exec().
| #define EXTENSION_MATCH_CORE | ( | data, | |||
| pattern, | |||||
| match | ) |
Definition at line 646 of file pbx.c.
Referenced by ast_extension_close(), and ast_extension_match().
| #define FIND_NEXT |
Value:
do { \ c = info; \ while(*c && (*c != '|')) c++; \ if (*c) { *c = '\0'; c++; } else c = NULL; \ } while(0)
Definition at line 3855 of file pbx.c.
Referenced by ast_build_timing().
| #define HELPER_CANMATCH 3 |
Definition at line 591 of file pbx.c.
Referenced by ast_canmatch_extension(), pbx_extension_helper(), and pbx_find_extension().
| #define HELPER_EXEC 2 |
Definition at line 590 of file pbx.c.
Referenced by ast_exec_extension(), and pbx_extension_helper().
| #define HELPER_EXISTS 0 |
Definition at line 588 of file pbx.c.
Referenced by ast_exists_extension(), ast_hint_extension(), and pbx_extension_helper().
| #define HELPER_FINDLABEL 5 |
Definition at line 593 of file pbx.c.
Referenced by ast_findlabel_extension(), ast_findlabel_extension2(), pbx_extension_helper(), and pbx_find_extension().
| #define HELPER_MATCHMORE 4 |
Definition at line 592 of file pbx.c.
Referenced by ast_matchmore_extension(), pbx_extension_helper(), and pbx_find_extension().
| #define HELPER_SPAWN 1 |
Definition at line 589 of file pbx.c.
Referenced by ast_spawn_extension(), and pbx_extension_helper().
| #define LOG |
Referenced by ast_add_extension2().
| #define STATUS_NO_CONTEXT 1 |
Definition at line 774 of file pbx.c.
Referenced by pbx_extension_helper(), and pbx_find_extension().
| #define STATUS_NO_EXTENSION 2 |
Definition at line 775 of file pbx.c.
Referenced by pbx_extension_helper(), and pbx_find_extension().
| #define STATUS_NO_LABEL 4 |
Definition at line 777 of file pbx.c.
Referenced by pbx_extension_helper(), and pbx_find_extension().
| #define STATUS_NO_PRIORITY 3 |
Definition at line 776 of file pbx.c.
Referenced by pbx_extension_helper(), and pbx_find_extension().
| #define STATUS_SUCCESS 5 |
| #define SWITCH_DATA_LENGTH 256 |
| #define VAR_BUF_SIZE 4096 |
Definition at line 79 of file pbx.c.
Referenced by ast_add_extension2(), pbx_builtin_importvar(), and pbx_substitute_variables_helper_full().
| #define WAITEXTEN_MOH (1 << 0) |
| void __ast_context_destroy | ( | struct ast_context * | con, | |
| const char * | registrar | |||
| ) |
Definition at line 5341 of file pbx.c.
References ast_context::alts, ast_log(), ast_mutex_destroy(), ast_mutex_lock(), ast_mutex_unlock(), contexts, destroy_exten(), el, free, ast_context::ignorepats, ast_context::includes, ast_context::lock, LOG_WARNING, ast_context::name, ast_exten::next, ast_sw::next, ast_ignorepat::next, ast_include::next, ast_context::next, ast_exten::peer, ast_context::registrar, and ast_context::root.
Referenced by ast_context_destroy().
05342 { 05343 struct ast_context *tmp, *tmpl=NULL; 05344 struct ast_include *tmpi, *tmpil= NULL; 05345 struct ast_sw *sw, *swl= NULL; 05346 struct ast_exten *e, *el, *en; 05347 struct ast_ignorepat *ipi, *ipl = NULL; 05348 05349 ast_mutex_lock(&conlock); 05350 tmp = contexts; 05351 while(tmp) { 05352 if (((tmp->name && con && con->name && !strcasecmp(tmp->name, con->name)) || !con) && 05353 (!registrar || !strcasecmp(registrar, tmp->registrar))) { 05354 /* Okay, let's lock the structure to be sure nobody else 05355 is searching through it. */ 05356 if (ast_mutex_lock(&tmp->lock)) { 05357 ast_log(LOG_WARNING, "Unable to lock context lock\n"); 05358 return; 05359 } 05360 if (tmpl) 05361 tmpl->next = tmp->next; 05362 else 05363 contexts = tmp->next; 05364 /* Okay, now we're safe to let it go -- in a sense, we were 05365 ready to let it go as soon as we locked it. */ 05366 ast_mutex_unlock(&tmp->lock); 05367 for (tmpi = tmp->includes; tmpi; ) { 05368 /* Free includes */ 05369 tmpil = tmpi; 05370 tmpi = tmpi->next; 05371 free(tmpil); 05372 } 05373 for (ipi = tmp->ignorepats; ipi; ) { 05374 /* Free ignorepats */ 05375 ipl = ipi; 05376 ipi = ipi->next; 05377 free(ipl); 05378 } 05379 for (sw = tmp->alts; sw; ) { 05380 /* Free switches */ 05381 swl = sw; 05382 sw = sw->next; 05383 free(swl); 05384 swl = sw; 05385 } 05386 for (e = tmp->root; e;) { 05387 for (en = e->peer; en;) { 05388 el = en; 05389 en = en->peer; 05390 destroy_exten(el); 05391 } 05392 el = e; 05393 e = e->next; 05394 destroy_exten(el); 05395 } 05396 ast_mutex_destroy(&tmp->lock); 05397 free(tmp); 05398 if (!con) { 05399 /* Might need to get another one -- restart */ 05400 tmp = contexts; 05401 tmpl = NULL; 05402 tmpil = NULL; 05403 continue; 05404 } 05405 ast_mutex_unlock(&conlock); 05406 return; 05407 } 05408 tmpl = tmp; 05409 tmp = tmp->next; 05410 } 05411 ast_mutex_unlock(&conlock); 05412 }
| static int __ast_goto_if_exists | ( | struct ast_channel * | chan, | |
| char * | context, | |||
| char * | exten, | |||
| int | priority, | |||
| int | async | |||
| ) | [static] |
Definition at line 6478 of file pbx.c.
References ast_async_goto(), ast_exists_extension(), ast_explicit_goto(), and ast_channel::context.
Referenced by ast_async_goto_if_exists(), and ast_goto_if_exists().
06479 { 06480 int (*goto_func)(struct ast_channel *chan, const char *context, const char *exten, int priority); 06481 06482 if (!chan) 06483 return -2; 06484 06485 goto_func = (async) ? ast_async_goto : ast_explicit_goto; 06486 if (ast_exists_extension(chan, context ? context : chan->context, 06487 exten ? exten : chan->exten, priority, 06488 chan->cid.cid_num)) 06489 return goto_func(chan, context ? context : chan->context, 06490 exten ? exten : chan->exten, priority); 06491 else 06492 return -3; 06493 }
| static int __ast_pbx_run | ( | struct ast_channel * | c | ) | [static] |
Definition at line 2258 of file pbx.c.
References ast_channel::_softhangup, ast_channel::amaflags, ast_cdr_alloc(), ast_cdr_init(), ast_cdr_start(), ast_cdr_update(), ast_exists_extension(), AST_FLAG_IN_AUTOLOOP, ast_log(), AST_PBX_KEEPALIVE, ast_set_flag, AST_SOFTHANGUP_ASYNCGOTO, AST_SOFTHANGUP_TIMEOUT, ast_spawn_extension(), ast_test_flag, ast_verbose(), ast_channel::cdr, ast_channel::cid, ast_callerid::cid_num, ast_channel::context, ast_pbx::dtimeout, ast_channel::exten, exten, free, LOG_DEBUG, LOG_ERROR, LOG_WARNING, malloc, ast_channel::name,