32 #if !defined(STANDALONE)
41 #ifdef HAVE_MTX_PROFILE
42 static int mtx_prof = -1;
56 #include "asterisk/argdesc.h"
81 #define DEBUG_READ (1 << 0)
82 #define DEBUG_TOKENS (1 << 1)
83 #define DEBUG_MACROS (1 << 2)
84 #define DEBUG_CONTEXTS (1 << 3)
86 static char *
config =
"extensions.ael";
99 int option_matches_j(
struct argdesc *should,
pval *is,
struct argapp *
app);
100 int option_matches(
struct argdesc *should,
pval *is,
struct argapp *
app);
101 int ael_is_funcname(
char *
name);
146 snprintf(buf,
sizeof(buf),
"%s,~~s~~,1(%s)",
args.name,
args.args);
157 int errs=0, sem_err=0, sem_warn=0, sem_note=0;
162 struct pval *parse_tree;
165 if (config[0] ==
'/')
166 rfilename = (
char *)config;
171 if (access(rfilename,R_OK) != 0) {
177 ast_log(
LOG_NOTICE,
"AEL load process: parsed config file name '%s'.\n", rfilename);
179 if (errs == 0 && sem_err == 0) {
180 ast_log(
LOG_NOTICE,
"AEL load process: checked config file name '%s'.\n", rfilename);
187 ast_log(
LOG_NOTICE,
"AEL load process: compiled config file name '%s'.\n", rfilename);
191 local_contexts = NULL;
192 ast_log(
LOG_NOTICE,
"AEL load process: merged config file name '%s'.\n", rfilename);
195 ast_log(
LOG_NOTICE,
"AEL load process: verified config file name '%s'.\n", rfilename);
197 ast_log(
LOG_ERROR,
"Sorry, but %d syntax errors and %d semantic errors were detected. It doesn't make sense to compile.\n", errs, sem_err);
211 e->
command =
"ael set debug {read|tokens|macros|contexts|off}";
213 "Usage: ael set debug {read|tokens|macros|contexts|off}\n"
214 " Enable AEL read, token, macro, or context debugging,\n"
215 " or disable all AEL debugging messages. Note: this\n"
216 " currently does nothing.\n";
225 if (!strcasecmp(a->
argv[3],
"read"))
227 else if (!strcasecmp(a->
argv[3],
"tokens"))
229 else if (!strcasecmp(a->
argv[3],
"macros"))
231 else if (!strcasecmp(a->
argv[3],
"contexts"))
233 else if (!strcasecmp(a->
argv[3],
"off"))
247 "Usage: ael reload\n"
248 " Reloads AEL configuration.\n";
290 #define AST_MODULE "ael"
291 int ael_external_load_module(
void);
292 int ael_external_load_module(
void)
306 static const char *
const ael_funclist[] =
343 "QUEUE_MEMBER_COUNT",
365 int ael_is_funcname(
char *
name)
368 t =
sizeof(ael_funclist)/
sizeof(
char*);
370 while ((s < t) && strcasecmp(name, ael_funclist[s]))
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
hashtable functions for contexts
void check_pval_item(pval *item, struct argapp *apps, int in_globals)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
void destroy_pval_item(pval *item)
#define AST_CLI_DEFINE(fn, txt,...)
void check_switch_expr(pval *item, struct argapp *apps)
void check_pval(pval *item, struct argapp *apps, int in_globals)
struct ael_priority * new_prio(void)
Asterisk main include file. File version handling, generic pbx functions.
int ast_hashtab_newsize_java(struct ast_hashtab *tab)
Create a prime number roughly 2x the current table size.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
descriptor for a cli entry.
Generic (perhaps overly so) hashtable implementation Hash Table support in Asterisk.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
void add_extensions(struct ael_extension *exten)
Configuration File Parser.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
int ast_unregister_application(const char *app)
Unregister an application.
int ast_hashtab_resize_java(struct ast_hashtab *tab)
Determines if a table resize should occur using the Java algorithm (if the table load factor is 75% o...
int args
This gets set in ast_cli_register()
struct ael_extension * new_exten(void)
static char * handle_cli_ael_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct ast_hashtab * ast_hashtab_create(int initial_buckets, int(*compare)(const void *a, const void *b), int(*resize)(struct ast_hashtab *), int(*newsize)(struct ast_hashtab *tab), unsigned int(*hash)(const void *obj), int do_locking)
Create the hashtable list.
struct ast_context * ast_walk_contexts(struct ast_context *con)
Core PBX routines and definitions.
void destroy_pval(pval *item)
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_expr_clear_extra_error_info(void)
int ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root)
const char * ast_config_AST_CONFIG_DIR
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
Merge the temporary contexts into a global contexts list and delete from the global list the ones tha...
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...
static struct ast_hashtab * local_table
unsigned int ast_hashtab_hash_contexts(const void *obj)
Structures for AEL - the Asterisk extension language.
static char * handle_cli_ael_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct pval * find_context(char *name)
void ast_expr_register_extra_error_info(char *errmsg)
Support for logging to various files, console and syslog Configuration in file logger.conf.
void destroy_extensions(struct ael_extension *exten)
void set_priorities(struct ael_extension *exten)
Standard Command Line Interface.
ast_app: A registered application
int check_app_args(pval *appcall, pval *arglist, struct argapp *app)
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
static struct ast_context * local_contexts
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct pval * find_macro(char *name)
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context (or ANY context if NULL)
#define AST_STANDARD_RAW_ARGS(args, parse)
struct pval * ael2_parse(char *fname, int *errs)
void ael2_semantic_check(pval *item, int *errs, int *warns, int *notes)
#define AST_APP_ARG(name)
Define an application argument.
int ast_context_verify_includes(struct ast_context *con)
Verifies includes in an ast_contect structure.
static int unload_module(void)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static int aelsub_exec(struct ast_channel *chan, const char *vdata)
static int load_module(void)
ast_context: An extension context
static struct ast_cli_entry cli_ael[]
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
static int pbx_load_module(void)