Asterisk - The Open Source Telephony Project
18.5.0
|
#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 - must remain in sync with fake_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 | |
int | __ast_bt_get_addresses (struct ast_bt *bt) |
struct ast_vector_string * | __ast_bt_get_symbols (void **addresses, size_t num_frames) |
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_mark_lock_acquired (void *lock_addr) |
Mark the last lock as acquired. 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... | |
void | ast_remove_lock_info (void *lock_addr, struct ast_bt *bt) |
remove lock info for the current thread More... | |
void | ast_restore_lock_info (void *lock_addr) |
void | ast_store_lock_info (enum ast_lock_type type, const char *filename, int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt) |
Store lock info for the current thread. More... | |
void | ast_suspend_lock_info (void *lock_addr) |
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.
Referenced by ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), and pbx_builtin_setvar().
#define ASTMM_LIBC ASTMM_IGNORE |
Definition at line 14 of file ael_main.c.
int __ast_bt_get_addresses | ( | struct ast_bt * | bt | ) |
Definition at line 615 of file ael_main.c.
struct ast_vector_string* __ast_bt_get_symbols | ( | void ** | addresses, |
size_t | num_frames | ||
) |
Definition at line 620 of file ael_main.c.
References NULL.
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)
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_4 are defined.
Definition at line 2198 of file logger.c.
References __ast_verbose_ap(), and ast_read_threadstorage_callid().
int ael_external_load_module | ( | void | ) |
Referenced by filter_newlines(), main(), and reload().
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 ast_context::eswitches, extens, ast_context::extension_count, filter_leading_space_from_exprs(), filter_newlines(), free(), ast_context::ignorepats, ast_context::includes, last_exten, namelist::name, ast_context::name, namelist::name2, namelist::next, priors, 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.
void ast_cli_unregister_multiple | ( | void | ) |
Definition at line 408 of file ael_main.c.
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(), and ast_context::ignorepats.
void ast_context_add_include2 | ( | struct ast_context * | con, |
const char * | value, | ||
const char * | registrar | ||
) |
Add a context include.
con | context to add the include to |
value | include value to add |
registrar | who registered the context |
Adds an include taking a struct ast_context as the first parameter
0 | on success |
-1 | on failure |
Definition at line 359 of file ael_main.c.
References ADD_LAST, create_name(), and ast_context::includes.
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(), ast_context::eswitches, namelist::name2, and ast_context::switches.
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, ast_context::name, ast_context::next, NULL, and ast_context::registrar.
void ast_context_destroy | ( | void | ) |
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, ast_context::name, ast_context::next, NULL, and ast_context::registrar.
void ast_context_verify_includes | ( | void | ) |
Definition at line 395 of file ael_main.c.
struct ast_custom_function* ast_custom_function_find | ( | const char * | name | ) |
Definition at line 173 of file ael_main.c.
Referenced by pbx_findapp().
const char* ast_get_context_name | ( | struct ast_context * | con | ) |
Definition at line 421 of file ael_main.c.
References ast_walk_context_extensions(), ast_context::name, and NULL.
Referenced by ast_context_destroy().
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.
References ast_hashtab_hash_contexts().
Referenced by main().
unsigned int ast_hashtab_hash_contexts | ( | const void * | obj | ) |
Definition at line 596 of file ael_main.c.
Referenced by ast_hashtab_compare_contexts().
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.
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.
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.
References context, exten, and pbx_find_extension().
Referenced by main().
void ast_mark_lock_acquired | ( | void * | lock_addr | ) |
void ast_merge_contexts_and_delete | ( | void | ) |
Definition at line 389 of file ael_main.c.
void ast_module_register | ( | const struct ast_module_info * | x | ) |
Definition at line 195 of file ael_main.c.
void ast_module_unregister | ( | const struct ast_module_info * | x | ) |
Definition at line 199 of file ael_main.c.
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 2104 of file main/utils.c.
void ast_remove_lock_info | ( | void * | lock_addr, |
struct ast_bt * | bt | ||
) |
remove lock info for the current thread
this gets called by ast_mutex_unlock so that information on the lock can be removed from the current thread's lock info struct.
Definition at line 605 of file ael_main.c.
void ast_restore_lock_info | ( | void * | lock_addr | ) |
Definition at line 628 of file ael_main.c.
void ast_store_lock_info | ( | enum ast_lock_type | type, |
const char * | filename, | ||
int | line_num, | ||
const char * | func, | ||
const char * | lock_name, | ||
void * | lock_addr, | ||
struct ast_bt * | bt | ||
) |
Store lock info for the current thread.
This function gets called in ast_mutex_lock() and ast_mutex_trylock() so that information about this lock can be stored in this thread's lock info struct. The lock is marked as pending as the thread is waiting on the lock. ast_mark_lock_acquired() will mark it as held by this thread.
Definition at line 609 of file ael_main.c.
void ast_suspend_lock_info | ( | void * | lock_addr | ) |
Definition at line 625 of file ael_main.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 ast_walk_context_includes(), and NULL.
Referenced by ast_get_context_name().
static struct ast_ignorepat * ast_walk_context_ignorepats | ( | struct ast_context * | con, |
struct ast_ignorepat * | ip | ||
) |
Definition at line 439 of file ael_main.c.
References ast_walk_context_switches(), and NULL.
Referenced by ast_walk_context_includes().
static struct ast_include * ast_walk_context_includes | ( | struct ast_context * | con, |
struct ast_include * | inc | ||
) |
Definition at line 433 of file ael_main.c.
References ast_walk_context_ignorepats(), and NULL.
Referenced by ast_walk_context_extensions().
static struct ast_sw * ast_walk_context_switches | ( | struct ast_context * | con, |
struct ast_sw * | sw | ||
) |
Definition at line 445 of file ael_main.c.
References NULL.
Referenced by ast_walk_context_ignorepats().
struct ast_context * ast_walk_contexts | ( | void | ) |
Definition at line 401 of file ael_main.c.
struct namelist * create_name | ( | const char * | name | ) |
Definition at line 79 of file ael_main.c.
References calloc, namelist::name, and NULL.
Referenced by ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), destroy_namelist(), and pbx_builtin_setvar().
void destroy_namelist | ( | struct namelist * | x | ) |
Definition at line 67 of file ael_main.c.
References create_name(), free(), namelist::name, and namelist::next.
Referenced by main().
void filter_leading_space_from_exprs | ( | char * | str | ) |
void filter_newlines | ( | char * | str | ) |
Definition at line 472 of file ael_main.c.
References ael_external_load_module(), and 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_hashtab_compare_contexts(), ast_log(), config_dir, conts, destroy_namelist(), ast_context::eswitches, extens, ast_context::extension_count, free(), ast_context::ignorepats, ast_context::includes, localized_use_conf_dir(), localized_use_local_dir(), namelist::name, ast_context::name, namelist::name2, namelist::next, ast_context::next, priors, ast_context::switches, and var_dir.
void pbx_builtin_setvar | ( | void * | chan, |
void * | data | ||
) |
Definition at line 305 of file ael_main.c.
References ADD_LAST, and create_name().
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 localized_find_extension().
Referenced by ast_log().
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.
References ast_custom_function_find(), and namelist::name.
Referenced by aelsub_exec(), answer_exec_run(), ari_channel_thread(), ari_originate_dial(), ast_app_exec_macro(), AST_TEST_DEFINE(), bridge_check_monitor(), bridge_stasis_run_cb(), conf_run(), conf_start_record(), disa_exec(), do_magic_pickup(), dundi_exec(), exec_exec(), execif_exec(), forward_message(), handle_exec(), iax2_exec(), lua_pbx_exec(), page_exec(), pbx_builtin_execiftime(), pbx_extension_helper(), pbx_outgoing_exec(), realtime_exec(), run_app_helper(), snoop_stasis_thread(), 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 __ast_cli_register_multiple().
const char* ast_config_AST_CONFIG_DIR = config_dir |
Definition at line 98 of file ael_main.c.
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(), and ast_context_find_or_create().
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.
|
static |
Definition at line 128 of file ael_main.c.
int extens =0 |
Definition at line 93 of file ael_main.c.
Referenced by ast_add_extension2(), check_retrieve_call_extensions(), and main().
|
static |
Definition at line 127 of file ael_main.c.
struct namelist* globalvars |
Definition at line 90 of file ael_main.c.
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.
char last_exten[18000] |
Definition at line 94 of file ael_main.c.
Referenced by ast_add_extension2().
struct module_symbols mod_data |
|
static |
Definition at line 124 of file ael_main.c.
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().
|
static |
Definition at line 125 of file ael_main.c.
|
static |
Definition at line 97 of file ael_main.c.
Referenced by main().