Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
|
#include "asterisk.h"
#include <locale.h>
#include <ctype.h>
#include <regex.h>
#include <limits.h>
#include "asterisk/backtrace.h"
#include "asterisk/channel.h"
#include "asterisk/ast_expr.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/lock.h"
#include "asterisk/hashtab.h"
#include "asterisk/ael_structs.h"
#include "asterisk/extconf.h"
Go to the source code of this file.
Data Structures | |
struct | ast_context |
ast_context: An extension context More... | |
struct | namelist |
Macros | |
#define | ADD_LAST(headptr, memptr) if(!headptr){ headptr=(memptr); (headptr##_last)=(memptr);} else {(headptr##_last)->next = (memptr); (headptr##_last) = (memptr);} |
#define | ASTMM_LIBC ASTMM_IGNORE |
Functions | |
void | __ast_cli_register_multiple (void) |
void | __ast_verbose (const char *file, int line, const char *func, int level, const char *fmt,...) |
Send a verbose message (based on verbose level) More... | |
int | ael_external_load_module (void) |
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) |
int | ast_add_profile (const char *x, uint64_t scale) |
support for event profiling More... | |
void | ast_cli_unregister_multiple (void) |
void | ast_context_add_ignorepat2 (struct ast_context *con, const char *value, const char *registrar) |
void | ast_context_add_include2 (struct ast_context *con, const char *value, const char *registrar) |
Add a context include. More... | |
void | ast_context_add_switch2 (struct ast_context *con, const char *value, const char *data, int eval, const char *registrar) |
Adds a switch (first param is a ast_context) More... | |
struct ast_context * | ast_context_create (void **extcontexts, const char *name, const char *registrar) |
void | ast_context_destroy (void) |
struct ast_context * | ast_context_find_or_create (void **extcontexts, void *tab, const char *name, const char *registrar) |
void | ast_context_verify_includes (void) |
struct ast_custom_function * | ast_custom_function_find (const char *name) |
const char * | ast_get_context_name (struct ast_context *con) |
int | ast_hashtab_compare_contexts (const void *ah_a, const void *ah_b) |
hashtable functions for contexts More... | |
unsigned int | ast_hashtab_hash_contexts (const void *obj) |
int | ast_loader_register (int(*updater)(void)) |
Add a procedure to be run when modules have been updated. More... | |
int | ast_loader_unregister (int(*updater)(void)) |
Remove a procedure to be run when modules are updated. More... | |
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 invoke it would be something like this: ast_log(AST_LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?\n", "flux capacitor", 10); where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending on which log you wish to output to. These are implemented as macros, that will provide the function with the needed arguments. More... | |
void | ast_merge_contexts_and_delete (void) |
void | ast_module_register (const struct ast_module_info *x) |
void | ast_module_unregister (const struct ast_module_info *x) |
char * | ast_process_quotes_and_slashes (char *start, char find, char replace_with) |
Process a string to find and replace characters. More... | |
struct ast_exten * | ast_walk_context_extensions (struct ast_context *con, struct ast_exten *exten) |
struct ast_ignorepat * | ast_walk_context_ignorepats (struct ast_context *con, struct ast_ignorepat *ip) |
struct ast_include * | ast_walk_context_includes (struct ast_context *con, struct ast_include *inc) |
struct ast_sw * | ast_walk_context_switches (struct ast_context *con, struct ast_sw *sw) |
struct ast_context * | ast_walk_contexts (void) |
struct namelist * | create_name (const char *name) |
void | destroy_namelist (struct namelist *x) |
void | filter_leading_space_from_exprs (char *str) |
void | filter_newlines (char *str) |
int | main (int argc, char **argv) |
void | pbx_builtin_setvar (void *chan, void *data) |
struct ast_exten * | pbx_find_extension (struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action) |
struct ast_app * | pbx_findapp (const char *app) |
Look up an application. More... | |
void | pbx_substitute_variables_helper (struct ast_channel *c, const char *cp1, char *cp2, int count) |
Variables | |
const char * | ast_config_AST_CONFIG_DIR = config_dir |
const char * | ast_config_AST_VAR_DIR = var_dir |
static char | config_dir [PATH_MAX] |
struct ast_context * | context_list |
int | conts =0 |
static int | dump_extensions = 0 |
static FILE * | dumpfile |
int | extens =0 |
static int | FIRST_TIME = 0 |
struct namelist * | globalvars |
struct namelist * | globalvars_last |
struct ast_context * | last_context |
char | last_exten [18000] |
struct module_symbols | mod_data |
static int | no_comp = 0 |
int | option_debug = 0 |
int | option_verbose = 0 |
int | priors =0 |
static int | quiet = 0 |
static int | use_curr_dir = 0 |
static char | var_dir [PATH_MAX] |
#define ADD_LAST | ( | headptr, | |
memptr | |||
) | if(!headptr){ headptr=(memptr); (headptr##_last)=(memptr);} else {(headptr##_last)->next = (memptr); (headptr##_last) = (memptr);} |
Definition at line 64 of file ael_main.c.
#define ASTMM_LIBC ASTMM_IGNORE |
Definition at line 14 of file ael_main.c.
void __ast_cli_register_multiple | ( | void | ) |
Definition at line 204 of file ael_main.c.
References no_comp.
void __ast_verbose | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
int | level, | ||
const char * | fmt, | ||
... | |||
) |
Send a verbose message (based on verbose level)
This works like ast_log, but prints verbose messages to the console depending on verbosity level set.
ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing");
This will print the message to the console if the verbose level is set to a level >= 3
Note the absence of a comma after the VERBOSE_PREFIX_3. This is important. VERBOSE_PREFIX_1 through VERBOSE_PREFIX_10 are defined.
Definition at line 2550 of file logger.c.
int ael_external_load_module | ( | void | ) |
Referenced by main().
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(*)(void *) | datad, | ||
const char * | registrar | ||
) |
Definition at line 221 of file ael_main.c.
References dump_extensions, dumpfile, ast_context::eswitches, extens, ast_context::extension_count, filter_leading_space_from_exprs(), filter_newlines(), FIRST_TIME, free(), globalvars, ast_context::ignorepats, ast_context::includes, last_context, last_exten, ast_context::name, namelist::name, namelist::name2, namelist::next, no_comp, priority, priors, registrar, replace(), and ast_context::switches.
int ast_add_profile | ( | const char * | x, |
uint64_t | scale | ||
) |
support for event profiling
(note, this must be documented a lot more) ast_add_profile allocates a generic 'counter' with a given name, which can be shown with the command 'core show profile <name>'
The counter accumulates positive or negative values supplied by
support for event profiling
Definition at line 178 of file ael_main.c.
References no_comp.
void ast_cli_unregister_multiple | ( | void | ) |
Definition at line 408 of file ael_main.c.
References no_comp.
void ast_context_add_ignorepat2 | ( | struct ast_context * | con, |
const char * | value, | ||
const char * | registrar | ||
) |
Definition at line 348 of file ael_main.c.
References ADD_LAST, create_name(), dump_extensions, ast_context::ignorepats, no_comp, registrar, and value.
Referenced by ast_compile_ael2(), and pbx_load_config().
void ast_context_add_include2 | ( | struct ast_context * | con, |
const char * | value, | ||
const char * | registrar | ||
) |
Add a context include.
Adds an include taking a struct ast_context as the first parameter
Definition at line 359 of file ael_main.c.
References ADD_LAST, create_name(), dump_extensions, ast_context::includes, no_comp, registrar, and value.
Referenced by ast_compile_ael2(), and pbx_load_config().
void ast_context_add_switch2 | ( | struct ast_context * | con, |
const char * | value, | ||
const char * | data, | ||
int | eval, | ||
const char * | registrar | ||
) |
Adds a switch (first param is a ast_context)
Definition at line 370 of file ael_main.c.
References ADD_LAST, create_name(), dump_extensions, ast_context::eswitches, namelist::name2, no_comp, registrar, ast_context::switches, and value.
Referenced by ast_compile_ael2(), lua_register_switches(), and pbx_load_config().
struct ast_context * ast_context_create | ( | void ** | extcontexts, |
const char * | name, | ||
const char * | registrar | ||
) |
Definition at line 318 of file ael_main.c.
References calloc, context_list, conts, name, ast_context::name, ast_context::next, no_comp, NULL, ast_context::registrar, and registrar.
void ast_context_destroy | ( | void | ) |
Definition at line 414 of file ael_main.c.
References no_comp.
struct ast_context * ast_context_find_or_create | ( | void ** | extcontexts, |
void * | tab, | ||
const char * | name, | ||
const char * | registrar | ||
) |
Definition at line 333 of file ael_main.c.
References calloc, context_list, conts, name, ast_context::name, ast_context::next, no_comp, NULL, ast_context::registrar, and registrar.
void ast_context_verify_includes | ( | void | ) |
Definition at line 395 of file ael_main.c.
References no_comp.
struct ast_custom_function * ast_custom_function_find | ( | const char * | name | ) |
Definition at line 173 of file ael_main.c.
const char * ast_get_context_name | ( | struct ast_context * | con | ) |
Definition at line 421 of file ael_main.c.
References ast_context::name, and NULL.
Referenced by add_extension(), ast_compile_ael2(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), context_included(), dundi_precache_full(), extension_is_compatible(), find_matching_endif(), find_matching_endwhile(), find_matching_priority(), and handle_cli_dialplan_save().
int ast_hashtab_compare_contexts | ( | const void * | ah_a, |
const void * | ah_b | ||
) |
hashtable functions for contexts
Definition at line 589 of file ael_main.c.
Referenced by lua_register_hints(), lua_register_switches(), and pbx_load_module().
unsigned int ast_hashtab_hash_contexts | ( | const void * | obj | ) |
Definition at line 596 of file ael_main.c.
Referenced by lua_register_hints(), lua_register_switches(), and pbx_load_module().
int ast_loader_register | ( | int(*)(void) | updater | ) |
Add a procedure to be run when modules have been updated.
updater | The function to run when modules have been updated. |
This function adds the given function to a linked list of functions to be run when the modules are updated.
0 | on success |
-1 | on failure. |
Definition at line 186 of file ael_main.c.
References AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_malloc, and tmp().
int ast_loader_unregister | ( | int(*)(void) | updater | ) |
Remove a procedure to be run when modules are updated.
updater | The updater function to unregister. |
This removes the given function from the updater list.
0 | on success |
-1 | on failure. |
Definition at line 191 of file ael_main.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, and loadupdate::updater.
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 invoke it would be something like this: ast_log(AST_LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?\n", "flux capacitor", 10); where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending on which log you wish to output to. These are implemented as macros, that will provide the function with the needed arguments.
level | Type of log event |
file | Will be provided by the AST_LOG_* macro |
line | Will be provided by the AST_LOG_* macro |
function | Will be provided by the AST_LOG_* macro |
fmt | This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-) |
Definition at line 130 of file ael_main.c.
Referenced by main().
void ast_merge_contexts_and_delete | ( | void | ) |
Definition at line 389 of file ael_main.c.
References no_comp.
void ast_module_register | ( | const struct ast_module_info * | x | ) |
Definition at line 195 of file ael_main.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_find, ao2_link, ao2_ref, ao2_t_alloc_options, ast_debug, AST_DLLIST_INSERT_TAIL, AST_DLLIST_LOCK, AST_DLLIST_UNLOCK, AST_LIST_HEAD_INIT, ast_opt_ref_debug, ast_std_calloc(), AST_VECTOR_INIT, ast_module::builtin, builtin_module_list, ast_module::enhances, ast_module::flags, sip_to_pjsip::info(), ast_module::info, loader_ready, NULL, OBJ_SEARCH_KEY, ast_module::optional_modules, ast_module::ref_debug, ast_module::reffed_deps, ast_module::requires, ast_module::resource, resource_being_loaded, and ast_module::users.
void ast_module_unregister | ( | const struct ast_module_info * | x | ) |
Definition at line 199 of file ael_main.c.
References ast_debug, AST_DLLIST_LOCK, AST_DLLIST_REMOVE_CURRENT, AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN, AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END, AST_DLLIST_UNLOCK, sip_to_pjsip::info(), ast_module::info, module_destroy(), NULL, and ast_module::usecount.
char * ast_process_quotes_and_slashes | ( | char * | start, |
char | find, | ||
char | replace_with | ||
) |
Process a string to find and replace characters.
start | The string to analyze |
find | The character to find |
replace_with | The character that will replace the one we are looking for |
Definition at line 2352 of file utils.c.
struct ast_exten * ast_walk_context_extensions | ( | struct ast_context * | con, |
struct ast_exten * | exten | ||
) |
Definition at line 427 of file ael_main.c.
References NULL.
Referenced by complete_dialplan_remove_extension(), context_used(), dundi_precache_full(), find_matching_priority(), and handle_cli_dialplan_save().
static struct ast_ignorepat * ast_walk_context_ignorepats | ( | struct ast_context * | con, |
struct ast_ignorepat * | ip | ||
) |
static struct ast_include * ast_walk_context_includes | ( | struct ast_context * | con, |
struct ast_include * | inc | ||
) |
static struct ast_sw * ast_walk_context_switches | ( | struct ast_context * | con, |
struct ast_sw * | sw | ||
) |
struct ast_context * ast_walk_contexts | ( | void | ) |
Definition at line 401 of file ael_main.c.
References no_comp.
struct namelist * create_name | ( | const char * | name | ) |
Definition at line 79 of file ael_main.c.
References calloc, namelist::name, name, and NULL.
Referenced by ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), and pbx_builtin_setvar().
void destroy_namelist | ( | struct namelist * | x | ) |
Definition at line 67 of file ael_main.c.
References free(), and namelist::next.
Referenced by main().
void filter_leading_space_from_exprs | ( | char * | str | ) |
Definition at line 450 of file ael_main.c.
References str.
Referenced by ast_add_extension2().
void filter_newlines | ( | char * | str | ) |
Definition at line 472 of file ael_main.c.
References str.
Referenced by ast_add_extension2().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 491 of file ael_main.c.
References ael_external_load_module(), ast_log(), config_dir, context_list, conts, destroy_namelist(), dump_extensions, dumpfile, ast_context::eswitches, extens, ast_context::extension_count, FIRST_TIME, free(), ast_context::ignorepats, ast_context::includes, localized_use_conf_dir(), localized_use_local_dir(), ast_context::name, namelist::name, namelist::name2, ast_context::next, namelist::next, no_comp, priors, quiet, ast_context::switches, use_curr_dir, and var_dir.
void pbx_builtin_setvar | ( | void * | chan, |
void * | data | ||
) |
Definition at line 305 of file ael_main.c.
References ADD_LAST, create_name(), dump_extensions, globalvars, and no_comp.
struct ast_exten * pbx_find_extension | ( | struct ast_channel * | chan, |
struct ast_context * | bypass, | ||
struct pbx_find_info * | q, | ||
const char * | context, | ||
const char * | exten, | ||
int | priority, | ||
const char * | label, | ||
const char * | callerid, | ||
enum ext_match_t | action | ||
) |
Definition at line 152 of file ael_main.c.
References voicemailpwcheck::context, ast_exten::exten, ast_exten::label, localized_find_extension(), and priority.
Referenced by add_extension(), ast_sip_persistent_endpoint_update_state(), check_goto(), check_pval_item(), conf_ended(), delete_extens(), parking_blind_transfer_park(), parking_duration_callback(), parking_is_exten_park(), parking_lot_cfg_create_extensions(), and test_exten().
struct ast_app * pbx_findapp | ( | const char * | app | ) |
Look up an application.
app | name of the app |
This function searches for the ast_app structure within the apps that are registered for the one with the name you passed in.
Definition at line 165 of file ael_main.c.
Referenced by aelsub_exec(), ari_channel_thread(), ari_originate_dial(), AST_TEST_DEFINE(), bridge_stasis_run_cb(), conf_run(), conf_start_record(), exec_exec(), execif_exec(), forward_message(), handle_exec(), iax2_exec(), lua_pbx_exec(), page_exec(), pbx_extension_helper(), pbx_outgoing_exec(), realtime_exec(), try_calling(), and tryexec_exec().
void pbx_substitute_variables_helper | ( | struct ast_channel * | c, |
const char * | cp1, | ||
char * | cp2, | ||
int | count | ||
) |
Definition at line 211 of file ael_main.c.
References AST_MAX_EXTENSION.
Referenced by add_extensions(), ast_add_extension2_lockopt(), dtmf_store_framehook(), escape_and_substitute(), function_eval(), get_mapping_weight(), import_helper(), launch_monitor_thread(), manager_log(), pbx_extension_helper(), pbx_find_extension(), pbx_load_config(), realtime_exec(), rotate_file(), substituted(), test_chan_function(), test_chan_integer(), test_chan_integer_accessor(), test_chan_string(), test_chan_variable(), waitforcond_exec(), write_cdr(), and write_cel().
const char* ast_config_AST_CONFIG_DIR = config_dir |
Definition at line 98 of file ael_main.c.
Referenced by action_createconfig(), ast_module_reload(), ast_str_retrieve_variable(), AST_TEST_DEFINE(), compile_script(), config_text_file_load(), delete_config_file(), handle_cli_dialplan_save(), handle_show_settings(), launch_script(), lua_read_extensions_file(), make_fn(), message_template_parse_filebody(), pbx_load_module(), restrictedFile(), set_fn(), setup_filestack(), while(), and write_config_file().
const char* ast_config_AST_VAR_DIR = var_dir |
Definition at line 99 of file ael_main.c.
Referenced by ael2_semantic_check(), ast_str_retrieve_variable(), handle_show_settings(), launch_script(), and ustmtext().
|
static |
Definition at line 96 of file ael_main.c.
Referenced by main().
struct ast_context* context_list |
Definition at line 88 of file ael_main.c.
Referenced by ast_context_create(), ast_context_find_or_create(), and main().
int conts =0 |
Definition at line 93 of file ael_main.c.
Referenced by ast_context_create(), ast_context_find_or_create(), and main().
|
static |
Definition at line 126 of file ael_main.c.
Referenced by ast_add_extension2(), ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), main(), and pbx_builtin_setvar().
|
static |
Definition at line 128 of file ael_main.c.
Referenced by ast_add_extension2(), and main().
int extens =0 |
Definition at line 93 of file ael_main.c.
Referenced by ast_add_extension2(), AST_TEST_DEFINE(), and main().
|
static |
Definition at line 127 of file ael_main.c.
Referenced by ast_add_extension2(), and main().
struct namelist* globalvars |
Definition at line 90 of file ael_main.c.
Referenced by ast_add_extension2(), and pbx_builtin_setvar().
struct namelist* globalvars_last |
Definition at line 91 of file ael_main.c.
struct ast_context* last_context |
Definition at line 89 of file ael_main.c.
Referenced by ast_add_extension2().
char last_exten[18000] |
Definition at line 94 of file ael_main.c.
Referenced by ast_add_extension2().
|
extern |
|
static |
Definition at line 124 of file ael_main.c.
Referenced by __ast_cli_register_multiple(), ast_add_extension2(), ast_add_profile(), ast_cli_unregister_multiple(), ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_create(), ast_context_destroy(), ast_context_find_or_create(), ast_context_verify_includes(), ast_merge_contexts_and_delete(), ast_walk_contexts(), main(), and pbx_builtin_setvar().
int priors =0 |
Definition at line 93 of file ael_main.c.
Referenced by ast_add_extension2(), and main().
|
static |
Definition at line 123 of file ael_main.c.
Referenced by confbridge_exec(), and main().
|
static |
Definition at line 125 of file ael_main.c.
Referenced by main().
|
static |
Definition at line 97 of file ael_main.c.
Referenced by main().