14 #define ASTMM_LIBC ASTMM_IGNORE 64 #define ADD_LAST(headptr,memptr) if(!headptr){ headptr=(memptr); (headptr##_last)=(memptr);} else {(headptr##_last)->next = (memptr); (headptr##_last) = (memptr);} 84 strncpy(x->
name, name,
sizeof(x->
name) - 1);
104 const char *application,
void *data,
void (*datad)(
void *),
117 void ast_log(
int level,
const char *
file,
int line,
const char *
function,
const char *fmt, ...);
119 void __ast_verbose(
const char *
file,
int line,
const char *func,
int level,
const char *fmt, ...);
130 void ast_log(
int level,
const char *
file,
int line,
const char *
function,
const char *fmt, ...)
135 printf(
"LOG: lev:%d file:%s line:%d func: %s ",
136 level, file, line,
function);
149 const char *callerid,
159 const char *callerid,
181 printf(
"Executed ast_add_profile();\n");
207 printf(
"Executed ast_cli_register_multiple();\n");
222 int replace,
const char *extension,
int priority,
const char *label,
const char *callerid,
223 const char *application,
void *data,
void (*datad)(
void *),
239 application =
"(null)";
243 printf(
"Executed ast_add_extension2(context=%s, rep=%d, exten=%s, priority=%d, label=%s, callerid=%s, appl=%s, data=%s, FREE, registrar=%s);\n",
244 con->
name, replace, extension, priority, label, callerid, application, (data?(
char*)data:
"(null)"), registrar);
246 if( dump_extensions && dumpfile ) {
253 fprintf(dumpfile,
"[globals]\n");
255 for(n=globalvars;n;n=n->
next) {
256 fprintf(dumpfile,
"%s\n", n->
name);
261 if( con != last_context ) {
262 fprintf(dumpfile,
"\n\n[%s]\n", con->
name);
265 fprintf(dumpfile,
"ignorepat => %s\n", n->
name);
268 fprintf(dumpfile,
"include => %s\n", n->
name);
271 fprintf(dumpfile,
"switch => %s/%s\n", n->
name, n->
name2);
274 fprintf(dumpfile,
"eswitch => %s/%s\n", n->
name, n->
name2);
286 if( strcmp(label,
"(null)") != 0 )
287 fprintf(dumpfile,
"exten => %s,%d(%s),%s(%s)\n", extension, priority, label, application, (
char*)data);
289 fprintf(dumpfile,
"exten => %s,%d,%s(%s)\n", extension, priority, application, (
char*)data);
293 if( strcmp(label,
"(null)") != 0 )
294 fprintf(dumpfile,
"exten => %s,%d(%s),%s\n", extension, priority, label, application);
296 fprintf(dumpfile,
"exten => %s,%d,%s\n", extension, priority, application);
309 printf(
"Executed pbx_builtin_setvar(chan, data=%s);\n", (
char*)data);
311 if( dump_extensions ) {
326 printf(
"Executed ast_context_create(conts, name=%s, registrar=%s);\n", name, registrar);
328 strncpy(x->
name, name,
sizeof(x->
name) - 1);
341 printf(
"Executed ast_context_find_or_create(conts, name=%s, registrar=%s);\n", name, registrar);
343 strncpy(x->
name, name,
sizeof(x->
name) - 1);
351 printf(
"Executed ast_context_add_ignorepat2(con, value=%s, registrar=%s);\n", value, registrar);
352 if( dump_extensions ) {
362 printf(
"Executed ast_context_add_include2(con, value=%s, registrar=%s);\n", value, registrar);
363 if( dump_extensions ) {
373 printf(
"Executed ast_context_add_switch2(con, value=%s, data=%s, eval=%d, registrar=%s);\n", value, data, eval, registrar);
374 if( dump_extensions ) {
377 strncpy(x->
name2, data, 99);
392 printf(
"Executed ast_merge_contexts_and_delete();\n");
398 printf(
"Executed ast_context_verify_includes();\n");
404 printf(
"Executed ast_walk_contexts();\n");
411 printf(
"Executed ast_cli_unregister_multiple();\n");
417 printf(
"Executed ast_context_destroy();\n");
453 char *t, *v, *u =
str;
457 if( *u ==
'$' && *(u+1) ==
'[' ) {
459 while( *t ==
'\n' || *t ==
'\r' || *t ==
'\t' || *t ==
' ' ) {
477 if( *t ==
'\n' || *t ==
'\r' ) {
487 extern struct module_symbols mod_data;
491 int main(
int argc,
char **argv)
497 for(i=1;i<argc;i++) {
498 if( argv[i][0] ==
'-' && argv[i][1] ==
'n' )
500 if( argv[i][0] ==
'-' && argv[i][1] ==
'q' ) {
504 if( argv[i][0] ==
'-' && argv[i][1] ==
'd' )
506 if( argv[i][0] ==
'-' && argv[i][1] ==
'w' )
511 printf(
"\n(If you find progress and other non-error messages irritating, you can use -q to suppress them)\n");
513 printf(
"\n(You can use the -n option if you aren't interested in seeing all the instructions generated by the compiler)\n\n");
515 printf(
"\n(You can use the -d option if you want to use the current working directory as the CONFIG_DIR. I will look in this dir for extensions.ael* and its included files)\n\n");
516 if( !dump_extensions )
517 printf(
"\n(You can use the -w option to dump extensions.conf format to extensions.conf.aeldump)\n");
528 strcpy(
var_dir,
"/var/lib/asterisk");
530 if( dump_extensions ) {
531 dumpfile = fopen(
"extensions.conf.aeldump",
"w");
533 printf(
"\n\nSorry, cannot open extensions.conf.aeldump for writing! Correct the situation and try again!\n\n");
545 if( dump_extensions && dumpfile ) {
547 for( lp = context_list; lp; lp = lp->
next ) {
551 fprintf(dumpfile,
"\n\n[%s]\n", lp->
name);
554 fprintf(dumpfile,
"ignorepat => %s\n", n->
name);
557 fprintf(dumpfile,
"include => %s\n", n->
name);
560 fprintf(dumpfile,
"switch => %s/%s\n", n->
name, n->
name2);
563 fprintf(dumpfile,
"eswitch => %s/%s\n", n->
name, n->
name2);
569 if( dump_extensions && dumpfile )
572 for( lp = context_list; lp; lp = lp2 ) {
610 int line_num,
const char *func,
const char *lock_name,
void *lock_addr,
struct ast_bt *bt)
ast_include: include= support in extensions.conf
struct ast_vector_string * __ast_bt_get_symbols(void **addresses, size_t num_frames)
unsigned int ast_hashtab_hash_contexts(const void *obj)
struct ast_context * ast_context_create(void **extcontexts, const char *name, const char *registrar)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
void ast_context_destroy(void)
struct ast_ignorepats ignorepats
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
Asterisk backtrace generation.
struct ast_context * ast_walk_contexts(void)
struct namelist * eswitches
void ast_module_unregister(const struct ast_module_info *x)
int ast_loader_register(int(*updater)(void))
Add a procedure to be run when modules have been updated.
void pbx_builtin_setvar(void *chan, void *data)
static char config_dir[PATH_MAX]
struct ast_include * ast_walk_context_includes(struct ast_context *con, struct ast_include *inc)
struct ast_app * pbx_findapp(const char *app)
Look up an application.
Generic (perhaps overly so) hashtable implementation Hash Table support in Asterisk.
void __ast_verbose(const char *file, int line, const char *func, int level, const char *fmt,...)
Send a verbose message (based on verbose level)
int main(int argc, char **argv)
void __ast_cli_register_multiple(void)
struct namelist * eswitches_last
void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt)
remove lock info for the current thread
void ast_cli_unregister_multiple(void)
struct ast_context * context_list
struct ast_exten * localized_find_extension(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_ignorepat * ast_walk_context_ignorepats(struct ast_context *con, struct ast_ignorepat *ip)
int ael_external_load_module(void)
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)
static char var_dir[PATH_MAX]
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)
struct ast_context * next
void localized_use_local_dir(void)
struct namelist * globalvars_last
ast_sw: Switch statement in extensions.conf
General Asterisk PBX channel definitions.
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
hashtable functions for contexts
struct namelist * switches
static int dump_extensions
struct ast_custom_function * ast_custom_function_find(const char *name)
void ast_context_verify_includes(void)
Data structure associated with a custom dialplan function.
#define AST_MAX_EXTENSION
structure to hold extensions
void ast_module_register(const struct ast_module_info *x)
#define ADD_LAST(headptr, memptr)
struct ast_includes includes
void ast_merge_contexts_and_delete(void)
External configuration handlers (realtime and static configuration)
struct namelist * switches_last
const char * ast_get_context_name(struct ast_context *con)
struct namelist * globalvars
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.
struct ast_context * last_context
ast_ignorepat: Ignore patterns in dial plan
const char * ast_config_AST_VAR_DIR
void ast_mark_lock_acquired(void *lock_addr)
Mark the last lock as acquired.
void ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
int ast_loader_unregister(int(*updater)(void))
Remove a procedure to be run when modules are updated.
void filter_newlines(char *str)
Structures for AEL - the Asterisk extension language.
void ast_restore_lock_info(void *lock_addr)
struct ast_exten * ast_walk_context_extensions(struct ast_context *con, struct ast_exten *exten)
int ast_add_profile(const char *x, uint64_t scale)
support for event profiling
void destroy_namelist(struct namelist *x)
struct namelist * create_name(const char *name)
void ast_context_add_include2(struct ast_context *con, const char *value, const char *registrar)
Add a context include.
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
void filter_leading_space_from_exprs(char *str)
void ast_suspend_lock_info(void *lock_addr)
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
struct namelist * includes
struct namelist * includes_last
char * ast_process_quotes_and_slashes(char *start, char find, char replace_with)
Process a string to find and replace characters.
ast_app: A registered application
const char * ast_config_AST_CONFIG_DIR
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...
struct ast_context * ast_context_find_or_create(void **extcontexts, void *tab, const char *name, const char *registrar)
static char context[AST_MAX_CONTEXT]
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)
Asterisk module definitions.
struct namelist * ignorepats_last
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
ast_context: An extension context - must remain in sync with fake_context
int __ast_bt_get_addresses(struct ast_bt *bt)
struct ast_sw * ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw)
struct namelist * ignorepats
void localized_use_conf_dir(void)