Merged revisions 130145 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

Merging this rev from trunk to 1.6.0 was not
simple. Why? Because we've enhanced trunk to
do a [fast] merge-and-delete operation which 
also solved problems with contexts having 
entries from different registrars.
Fast as in the amount of time the contexts
are locked down. That *is* fast, but traversing
the entire dialplan looking for priorities to
delete takes more time overall.
This particular fix involved pulling in those
enhancements from trunk, along with all the
various fixes and refinements made along the
way.

Merging all this from trunk into 1.6 involved:
a. mergetrunk6 in the stuff from 130145;
b. revert all but the prop changes
c. catalog all revisions to pbx.c since 1.6.0 was forked
   (at rev 105596).
d. catalog all revisions to pbx.c in trunk since 1.6.0
   was forked, making special note of all revs that
   were not merged into 1.6.0.
e. study each rev in trunk not applied to 1.6.0, and
   determine if it was involved in the merge_and_delete
   enhancements in trunk. 25 commits were done in 1.6.0,
   all but one (106306) was a merge from trunk.
   Trunk had 22 additional changes, of which 7 were
   involved in the merge_and_delete enhancements:
    106757
    108894
    109169
    116461
    123358
    130145
    130297
f. Go to trunk and collect patches, one by one,
   of the changes made by each rev across the
   entire source tree, using svn diff -c <num> > pfile
g. Apply each patch in order to 1.6.0, and 
   resolve all failures and compilation problems
   before proceding to the next patch.
h. test the stuff.
i. profit!


........
r130145 | murf | 2008-07-11 12:24:31 -0600 (Fri, 11 Jul 2008) | 40 lines

(closes issue #13041)
Reported by: eliel
Tested by: murf

(closes issue #12960)
Reported by: mnicholson

In this 'omnibus' fix, I **think** I solved both
the problem in 13041, where unloading pbx_ael.so
caused crashes, or incomplete removal of previous
registrar'ed entries. And I added code to completely
remove all includes, switches, and ignorepats that
had a matching registrar entry, which should
appease 12960.

I also added a lot of seemingly useless brackets
around single statement if's, which helped debug 
so much that I'm leaving them there.

I added a routine to check the correlation between
the extension tree lists and the hashtab 
tables. It can be amazingly helpful when you have
lots of dialplan stuff, and need to narrow
down where a problem is occurring. It's ifdef'd
out by default.

I cleaned up the code around the new CIDmatch code.
It was leaving hanging extens with bad ptrs, getting confused
over which objects to remove, etc. I tightened
up the code and changed the call to remove_exten
in the merge_and_delete code.

I added more conditions to check for empty context
worthy of deletion. It's not empty if there are
any includes, switches, or ignorepats present.

If I've missed anything, please re-open this bug,
and be prepared to supply example dialplan code.


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@130946 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Steve Murphy 17 years ago
parent d962a11e55
commit e45d4f3bf1

@ -2084,9 +2084,7 @@ static int load_module(void)
int res; int res;
struct ast_context *con; struct ast_context *con;
con = ast_context_find("app_dial_gosub_virtual_context"); con = ast_context_find_or_create(NULL, NULL, "app_dial_gosub_virtual_context", "app_dial");
if (!con)
con = ast_context_create(NULL, "app_dial_gosub_virtual_context", "app_dial");
if (!con) if (!con)
ast_log(LOG_ERROR, "Dial virtual context 'app_dial_gosub_virtual_context' does not exist and unable to create\n"); ast_log(LOG_ERROR, "Dial virtual context 'app_dial_gosub_virtual_context' does not exist and unable to create\n");
else else

@ -5298,7 +5298,7 @@ static int sla_build_trunk(struct ast_config *cfg, const char *cat)
if (!ast_strlen_zero(trunk->autocontext)) { if (!ast_strlen_zero(trunk->autocontext)) {
struct ast_context *context; struct ast_context *context;
context = ast_context_find_or_create(NULL, trunk->autocontext, sla_registrar); context = ast_context_find_or_create(NULL, NULL, trunk->autocontext, sla_registrar);
if (!context) { if (!context) {
ast_log(LOG_ERROR, "Failed to automatically find or create " ast_log(LOG_ERROR, "Failed to automatically find or create "
"context '%s' for SLA!\n", trunk->autocontext); "context '%s' for SLA!\n", trunk->autocontext);
@ -5435,7 +5435,7 @@ static int sla_build_station(struct ast_config *cfg, const char *cat)
if (!ast_strlen_zero(station->autocontext)) { if (!ast_strlen_zero(station->autocontext)) {
struct ast_context *context; struct ast_context *context;
struct sla_trunk_ref *trunk_ref; struct sla_trunk_ref *trunk_ref;
context = ast_context_find_or_create(NULL, station->autocontext, sla_registrar); context = ast_context_find_or_create(NULL, NULL, station->autocontext, sla_registrar);
if (!context) { if (!context) {
ast_log(LOG_ERROR, "Failed to automatically find or create " ast_log(LOG_ERROR, "Failed to automatically find or create "
"context '%s' for SLA!\n", station->autocontext); "context '%s' for SLA!\n", station->autocontext);

@ -6368,9 +6368,7 @@ static int load_module(void)
if (!reload_queues(0)) if (!reload_queues(0))
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
con = ast_context_find("app_queue_gosub_virtual_context"); con = ast_context_find_or_create(NULL, NULL, "app_queue_gosub_virtual_context", "app_queue");
if (!con)
con = ast_context_create(NULL, "app_queue_gosub_virtual_context", "app_queue");
if (!con) if (!con)
ast_log(LOG_ERROR, "Queue virtual context 'app_queue_gosub_virtual_context' does not exist and unable to create\n"); ast_log(LOG_ERROR, "Queue virtual context 'app_queue_gosub_virtual_context' does not exist and unable to create\n");
else else

@ -520,7 +520,7 @@ static int load_module(void)
} }
if (agi_loaded) { if (agi_loaded) {
con = ast_context_find_or_create(NULL, "app_stack_gosub_virtual_context", "app_stack"); con = ast_context_find_or_create(NULL, NULL, "app_stack_gosub_virtual_context", "app_stack");
if (!con) { if (!con) {
ast_log(LOG_ERROR, "Virtual context 'app_stack_gosub_virtual_context' does not exist and unable to create\n"); ast_log(LOG_ERROR, "Virtual context 'app_stack_gosub_virtual_context' does not exist and unable to create\n");
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;

@ -11023,8 +11023,7 @@ static int set_config(char *config_file, int reload)
} else if (!strcasecmp(v->name, "regcontext")) { } else if (!strcasecmp(v->name, "regcontext")) {
ast_copy_string(regcontext, v->value, sizeof(regcontext)); ast_copy_string(regcontext, v->value, sizeof(regcontext));
/* Create context if it doesn't exist already */ /* Create context if it doesn't exist already */
if (!ast_context_find(regcontext)) ast_context_find_or_create(NULL, NULL, regcontext, "IAX2");
ast_context_create(NULL, regcontext, "IAX2");
} else if (!strcasecmp(v->name, "tos")) { } else if (!strcasecmp(v->name, "tos")) {
if (ast_str2tos(v->value, &tos)) if (ast_str2tos(v->value, &tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno); ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);

@ -3441,6 +3441,7 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
{ {
char multi[256]; char multi[256];
char *stringp, *ext, *context; char *stringp, *ext, *context;
struct pbx_find_info q = { .stacklen = 0 };
/* XXX note that global_regcontext is both a global 'enable' flag and /* XXX note that global_regcontext is both a global 'enable' flag and
* the name of the global regexten context, if not specified * the name of the global regexten context, if not specified
@ -3461,11 +3462,12 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
} else { } else {
context = global_regcontext; context = global_regcontext;
} }
if (onoff) if (onoff) {
ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop", ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop",
ast_strdup(peer->name), ast_free_ptr, "SIP"); ast_strdup(peer->name), ast_free_ptr, "SIP");
else } else if (pbx_find_extension(NULL, NULL, &q, context, ext, 1, NULL, "", E_MATCH)) {
ast_context_remove_extension(context, ext, 1, NULL); ast_context_remove_extension(context, ext, 1, NULL);
}
} }
} }
@ -20616,8 +20618,7 @@ static int reload_config(enum channelreloadreason reason)
/* Create contexts if they don't exist already */ /* Create contexts if they don't exist already */
while ((context = strsep(&stringp, "&"))) { while ((context = strsep(&stringp, "&"))) {
ast_copy_string(used_context, context, sizeof(used_context)); ast_copy_string(used_context, context, sizeof(used_context));
if (!ast_context_find(context)) ast_context_find_or_create(NULL, NULL, context, "SIP");
ast_context_create(NULL, context, "SIP");
} }
ast_copy_string(global_regcontext, v->value, sizeof(global_regcontext)); ast_copy_string(global_regcontext, v->value, sizeof(global_regcontext));
} else if (!strcasecmp(v->name, "regextenonqualify")) { } else if (!strcasecmp(v->name, "regextenonqualify")) {

@ -5913,8 +5913,7 @@ static int reload_config(void)
/* Create contexts if they don't exist already */ /* Create contexts if they don't exist already */
while ((context = strsep(&stringp, "&"))) { while ((context = strsep(&stringp, "&"))) {
ast_copy_string(used_context, context, sizeof(used_context)); ast_copy_string(used_context, context, sizeof(used_context));
if (!ast_context_find(context)) ast_context_find_or_create(NULL, NULL, context, "Skinny");
ast_context_create(NULL, context, "Skinny");
} }
ast_copy_string(regcontext, v->value, sizeof(regcontext)); ast_copy_string(regcontext, v->value, sizeof(regcontext));
} else if (!strcasecmp(v->name, "dateformat")) { } else if (!strcasecmp(v->name, "dateformat")) {

@ -25,6 +25,7 @@
#include "asterisk/sched.h" #include "asterisk/sched.h"
#include "asterisk/chanvars.h" #include "asterisk/chanvars.h"
#include "asterisk/hashtab.h"
#if defined(__cplusplus) || defined(c_plusplus) #if defined(__cplusplus) || defined(c_plusplus)
extern "C" { extern "C" {
@ -166,46 +167,37 @@ struct ast_app *pbx_findapp(const char *app);
*/ */
int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data); int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data);
/*!
* \brief Register a new context
*
* \param extcontexts pointer to the ast_context structure pointer
* \param name name of the new context
* \param registrar registrar of the context
*
* This will first search for a context with your name. If it exists already, it will not
* create a new one. If it does not exist, it will create a new one with the given name
* and registrar.
*
* \return NULL on failure, and an ast_context structure on success
*/
struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
/*! /*!
* \brief Register a new context or find an existing one * \brief Register a new context or find an existing one
* *
* \param extcontexts pointer to the ast_context structure pointer * \param extcontexts pointer to the ast_context structure pointer
* \param exttable pointer to the hashtable that contains all the elements in extcontexts
* \param name name of the new context * \param name name of the new context
* \param registrar registrar of the context * \param registrar registrar of the context
* *
* This function allows you to play in two environments: the global contexts (active dialplan)
* or an external context set of your choosing. To act on the external set, make sure extcontexts
* and exttable are set; for the globals, make sure both extcontexts and exttable are NULL.
*
* This will first search for a context with your name. If it exists already, it will not * This will first search for a context with your name. If it exists already, it will not
* create a new one. If it does not exist, it will create a new one with the given name * create a new one. If it does not exist, it will create a new one with the given name
* and registrar. * and registrar.
* *
* \return NULL on failure, and an ast_context structure on success * \return NULL on failure, and an ast_context structure on success
*/ */
struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, const char *name, const char *registrar); struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar);
/*! /*!
* \brief Merge the temporary contexts into a global contexts list and delete from the * \brief Merge the temporary contexts into a global contexts list and delete from the
* global list the ones that are being added * global list the ones that are being added
* *
* \param extcontexts pointer to the ast_context structure pointer * \param extcontexts pointer to the ast_context structure
* \param exttable pointer to the ast_hashtab structure that contains all the elements in extcontexts
* \param registrar of the context; if it's set the routine will delete all contexts * \param registrar of the context; if it's set the routine will delete all contexts
* that belong to that registrar; if NULL only the contexts that are specified * that belong to that registrar; if NULL only the contexts that are specified
* in extcontexts * in extcontexts
*/ */
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar); void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar);
/*! /*!
* \brief Destroy a context (matches the specified context (or ANY context if NULL) * \brief Destroy a context (matches the specified context (or ANY context if NULL)
@ -775,6 +767,8 @@ const char *ast_get_include_name(struct ast_include *include);
const char *ast_get_ignorepat_name(struct ast_ignorepat *ip); const char *ast_get_ignorepat_name(struct ast_ignorepat *ip);
const char *ast_get_switch_name(struct ast_sw *sw); const char *ast_get_switch_name(struct ast_sw *sw);
const char *ast_get_switch_data(struct ast_sw *sw); const char *ast_get_switch_data(struct ast_sw *sw);
int ast_get_switch_eval(struct ast_sw *sw);
/*! @} */ /*! @} */
/*! @name Other Extension stuff */ /*! @name Other Extension stuff */
@ -997,8 +991,18 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
struct ast_context *bypass, struct pbx_find_info *q, struct ast_context *bypass, struct pbx_find_info *q,
const char *context, const char *exten, int priority, const char *context, const char *exten, int priority,
const char *label, const char *callerid, enum ext_match_t action); const char *label, const char *callerid, enum ext_match_t action);
/* every time a write lock is obtained for contexts,
a counter is incremented. You can check this via the
following func */
int ast_wrlock_contexts_version(void);
/* hashtable functions for contexts */
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);
unsigned int ast_hashtab_hash_contexts(const void *obj);
#if defined(__cplusplus) || defined(c_plusplus) #if defined(__cplusplus) || defined(c_plusplus)
} }

@ -1,6 +1,7 @@
#ifndef _ASTERISK_PVAL_H #ifndef _ASTERISK_PVAL_H
#define _ASTERISK_PVAL_H #define _ASTERISK_PVAL_H
/* whatever includes this, better include asterisk/lock.h and asterisk/hashtab.h */
typedef enum typedef enum
{ {
@ -143,7 +144,7 @@ void destroy_extensions(struct ael_extension *exten);
static void gen_prios(struct ael_extension *exten, char *label, pval *statement, struct ael_extension *mother_exten, struct ast_context *context ); */ static void gen_prios(struct ael_extension *exten, char *label, pval *statement, struct ael_extension *mother_exten, struct ast_context *context ); */
void set_priorities(struct ael_extension *exten); void set_priorities(struct ael_extension *exten);
void add_extensions(struct ael_extension *exten); void add_extensions(struct ael_extension *exten);
void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root); void ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root);
void destroy_pval(pval *item); void destroy_pval(pval *item);
void destroy_pval_item(pval *item); void destroy_pval_item(pval *item);
int is_float(char *arg ); int is_float(char *arg );

@ -490,9 +490,7 @@ static int park_call_full(struct ast_channel *chan, struct ast_channel *peer, in
ast_adsi_unload_session(peer); ast_adsi_unload_session(peer);
} }
con = ast_context_find(parking_con); con = ast_context_find_or_create(NULL, NULL, parking_con, registrar);
if (!con)
con = ast_context_create(NULL, parking_con, registrar);
if (!con) /* Still no context? Bad */ if (!con) /* Still no context? Bad */
ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con); ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
/* Tell the peer channel the number of the parking space */ /* Tell the peer channel the number of the parking space */
@ -2205,12 +2203,9 @@ static void *do_parking_thread(void *ignore)
if (peername_flat[i] == '/') if (peername_flat[i] == '/')
peername_flat[i]= '0'; peername_flat[i]= '0';
} }
con = ast_context_find(parking_con_dial); con = ast_context_find_or_create(NULL, NULL, parking_con_dial, registrar);
if (!con) { if (!con)
con = ast_context_create(NULL, parking_con_dial, registrar); ast_log(LOG_ERROR, "Parking dial context '%s' does not exist and unable to create\n", parking_con_dial);
if (!con)
ast_log(LOG_ERROR, "Parking dial context '%s' does not exist and unable to create\n", parking_con_dial);
}
if (con) { if (con) {
char returnexten[AST_MAX_EXTENSION]; char returnexten[AST_MAX_EXTENSION];
struct ast_datastore *features_datastore; struct ast_datastore *features_datastore;
@ -2799,7 +2794,7 @@ static int load_config(void)
ast_debug(1, "Removed old parking extension %s@%s\n", old_parking_ext, old_parking_con); ast_debug(1, "Removed old parking extension %s@%s\n", old_parking_ext, old_parking_con);
} }
if (!(con = ast_context_find(parking_con)) && !(con = ast_context_create(NULL, parking_con, registrar))) { if (!(con = ast_context_find_or_create(NULL, NULL, parking_con, registrar))) {
ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con); ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
return -1; return -1;
} }

File diff suppressed because it is too large Load Diff

@ -41,6 +41,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/cli.h" #include "asterisk/cli.h"
#include "asterisk/app.h" #include "asterisk/app.h"
#include "asterisk/callerid.h" #include "asterisk/callerid.h"
#include "asterisk/hashtab.h"
#include "asterisk/ael_structs.h" #include "asterisk/ael_structs.h"
#include "asterisk/pval.h" #include "asterisk/pval.h"
#ifdef AAL_ARGCHECK #ifdef AAL_ARGCHECK
@ -87,7 +88,7 @@ struct ael_extension *new_exten(void);
void destroy_extensions(struct ael_extension *exten); void destroy_extensions(struct ael_extension *exten);
void set_priorities(struct ael_extension *exten); void set_priorities(struct ael_extension *exten);
void add_extensions(struct ael_extension *exten); void add_extensions(struct ael_extension *exten);
void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root); void ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root);
void destroy_pval(pval *item); void destroy_pval(pval *item);
void destroy_pval_item(pval *item); void destroy_pval_item(pval *item);
int is_float(char *arg ); int is_float(char *arg );
@ -107,6 +108,8 @@ static int pbx_load_module(void)
int errs=0, sem_err=0, sem_warn=0, sem_note=0; int errs=0, sem_err=0, sem_warn=0, sem_note=0;
char *rfilename; char *rfilename;
struct ast_context *local_contexts=NULL, *con; struct ast_context *local_contexts=NULL, *con;
struct ast_hashtab *local_table=NULL;
struct pval *parse_tree; struct pval *parse_tree;
ast_log(LOG_NOTICE, "Starting AEL load process.\n"); ast_log(LOG_NOTICE, "Starting AEL load process.\n");
@ -126,10 +129,13 @@ static int pbx_load_module(void)
ael2_semantic_check(parse_tree, &sem_err, &sem_warn, &sem_note); ael2_semantic_check(parse_tree, &sem_err, &sem_warn, &sem_note);
if (errs == 0 && sem_err == 0) { if (errs == 0 && sem_err == 0) {
ast_log(LOG_NOTICE, "AEL load process: checked config file name '%s'.\n", rfilename); ast_log(LOG_NOTICE, "AEL load process: checked config file name '%s'.\n", rfilename);
ast_compile_ael2(&local_contexts, parse_tree); local_table = ast_hashtab_create(11, ast_hashtab_compare_contexts, ast_hashtab_resize_java, ast_hashtab_newsize_java, ast_hashtab_hash_contexts, 0);
ast_compile_ael2(&local_contexts, local_table, parse_tree);
ast_log(LOG_NOTICE, "AEL load process: compiled config file name '%s'.\n", rfilename); ast_log(LOG_NOTICE, "AEL load process: compiled config file name '%s'.\n", rfilename);
ast_merge_contexts_and_delete(&local_contexts, registrar); ast_merge_contexts_and_delete(&local_contexts, local_table, registrar);
local_table = NULL; /* it's the dialplan global now */
local_contexts = NULL;
ast_log(LOG_NOTICE, "AEL load process: merged config file name '%s'.\n", rfilename); ast_log(LOG_NOTICE, "AEL load process: merged config file name '%s'.\n", rfilename);
for (con = ast_walk_contexts(NULL); con; con = ast_walk_contexts(con)) for (con = ast_walk_contexts(NULL); con; con = ast_walk_contexts(con))
ast_context_verify_includes(con); ast_context_verify_includes(con);

@ -51,7 +51,7 @@ static int extenpatternmatchnew_config = 0;
AST_MUTEX_DEFINE_STATIC(save_dialplan_lock); AST_MUTEX_DEFINE_STATIC(save_dialplan_lock);
static struct ast_context *local_contexts = NULL; static struct ast_context *local_contexts = NULL;
static struct ast_hashtab *local_table = NULL;
/* /*
* Prototypes for our completion functions * Prototypes for our completion functions
*/ */
@ -1402,7 +1402,6 @@ static int pbx_load_config(const char *config_file)
const char *aft; const char *aft;
const char *newpm; const char *newpm;
struct ast_flags config_flags = { 0 }; struct ast_flags config_flags = { 0 };
cfg = ast_config_load(config_file, config_flags); cfg = ast_config_load(config_file, config_flags);
if (!cfg) if (!cfg)
return 0; return 0;
@ -1430,7 +1429,7 @@ static int pbx_load_config(const char *config_file)
/* All categories but "general" or "globals" are considered contexts */ /* All categories but "general" or "globals" are considered contexts */
if (!strcasecmp(cxt, "general") || !strcasecmp(cxt, "globals")) if (!strcasecmp(cxt, "general") || !strcasecmp(cxt, "globals"))
continue; continue;
con=ast_context_find_or_create(&local_contexts,cxt, registrar); con=ast_context_find_or_create(&local_contexts, local_table, cxt, registrar);
if (con == NULL) if (con == NULL)
continue; continue;
@ -1642,7 +1641,7 @@ static void pbx_load_users(void)
/* Only create a context here when it is really needed. Otherwise default empty context /* Only create a context here when it is really needed. Otherwise default empty context
created by pbx_config may conflict with the one explicitly created by pbx_ael */ created by pbx_config may conflict with the one explicitly created by pbx_ael */
if (!con) if (!con)
con = ast_context_find_or_create(&local_contexts, userscontext, registrar); con = ast_context_find_or_create(&local_contexts, local_table, userscontext, registrar);
if (!con) { if (!con) {
ast_log(LOG_ERROR, "Can't find/create user context '%s'\n", userscontext); ast_log(LOG_ERROR, "Can't find/create user context '%s'\n", userscontext);
@ -1667,12 +1666,17 @@ static int pbx_load_module(void)
{ {
struct ast_context *con; struct ast_context *con;
if(!pbx_load_config(config)) if (!local_table)
local_table = ast_hashtab_create(17, ast_hashtab_compare_contexts, ast_hashtab_resize_java, ast_hashtab_newsize_java, ast_hashtab_hash_contexts, 0);
if (!pbx_load_config(config))
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
pbx_load_users(); pbx_load_users();
ast_merge_contexts_and_delete(&local_contexts, registrar); ast_merge_contexts_and_delete(&local_contexts, local_table, registrar);
local_table = NULL; /* the local table has been moved into the global one. */
local_contexts = NULL;
for (con = NULL; (con = ast_walk_contexts(con));) for (con = NULL; (con = ast_walk_contexts(con));)
ast_context_verify_includes(con); ast_context_verify_includes(con);

@ -60,6 +60,7 @@
%option bison-locations %option bison-locations
%{ %{
#include <asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/types.h> #include <sys/types.h>
@ -70,9 +71,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define GLOB_ABORTED GLOB_ABEND #define GLOB_ABORTED GLOB_ABEND
#endif #endif
# include <glob.h> # include <glob.h>
#include "asterisk/logger.h" #include "asterisk/logger.h"
#include "asterisk/utils.h" #include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/hashtab.h"
#include "ael/ael.tab.h" #include "ael/ael.tab.h"
#include "asterisk/ael_structs.h" #include "asterisk/ael_structs.h"

File diff suppressed because it is too large Load Diff

@ -120,7 +120,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
#line 54 "ael.y" #line 56 "ael.y"
{ {
int intval; /* integer value, typically flags */ int intval; /* integer value, typically flags */
char *str; /* strings */ char *str; /* strings */

@ -31,6 +31,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <string.h> #include <string.h>
#include "asterisk/logger.h" #include "asterisk/logger.h"
#include "asterisk/lock.h"
#include "asterisk/hashtab.h"
#include "asterisk/ael_structs.h" #include "asterisk/ael_structs.h"
pval * linku1(pval *head, pval *tail); pval * linku1(pval *head, pval *tail);

@ -804,9 +804,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define GLOB_ABORTED GLOB_ABEND #define GLOB_ABORTED GLOB_ABEND
#endif #endif
# include <glob.h> # include <glob.h>
#include "asterisk/logger.h" #include "asterisk/logger.h"
#include "asterisk/utils.h" #include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/hashtab.h"
#include "ael/ael.tab.h" #include "ael/ael.tab.h"
#include "asterisk/ael_structs.h" #include "asterisk/ael_structs.h"
@ -907,7 +908,7 @@ static void pbcwhere(const char *text, int *line, int *col )
#define STORE_POS #define STORE_POS
#define STORE_LOC #define STORE_LOC
#endif #endif
#line 909 "ael_lex.c" #line 911 "ael_lex.c"
#define INITIAL 0 #define INITIAL 0
#define paren 1 #define paren 1
@ -1146,10 +1147,10 @@ YY_DECL
register int yy_act; register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
#line 187 "ael.flex" #line 189 "ael.flex"
#line 1151 "ael_lex.c" #line 1153 "ael_lex.c"
yylval = yylval_param; yylval = yylval_param;
@ -1240,260 +1241,260 @@ do_action: /* This label is used only to access EOF actions. */
case 1: case 1:
YY_RULE_SETUP YY_RULE_SETUP
#line 189 "ael.flex" #line 191 "ael.flex"
{ STORE_POS; return LC;} { STORE_POS; return LC;}
YY_BREAK YY_BREAK
case 2: case 2:
YY_RULE_SETUP YY_RULE_SETUP
#line 190 "ael.flex" #line 192 "ael.flex"
{ STORE_POS; return RC;} { STORE_POS; return RC;}
YY_BREAK YY_BREAK
case 3: case 3:
YY_RULE_SETUP YY_RULE_SETUP
#line 191 "ael.flex" #line 193 "ael.flex"
{ STORE_POS; return LP;} { STORE_POS; return LP;}
YY_BREAK YY_BREAK
case 4: case 4:
YY_RULE_SETUP YY_RULE_SETUP
#line 192 "ael.flex" #line 194 "ael.flex"
{ STORE_POS; return RP;} { STORE_POS; return RP;}
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
#line 193 "ael.flex" #line 195 "ael.flex"
{ STORE_POS; return SEMI;} { STORE_POS; return SEMI;}
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
#line 194 "ael.flex" #line 196 "ael.flex"
{ STORE_POS; return EQ;} { STORE_POS; return EQ;}
YY_BREAK YY_BREAK
case 7: case 7:
YY_RULE_SETUP YY_RULE_SETUP
#line 195 "ael.flex" #line 197 "ael.flex"
{ STORE_POS; return COMMA;} { STORE_POS; return COMMA;}
YY_BREAK YY_BREAK
case 8: case 8:
YY_RULE_SETUP YY_RULE_SETUP
#line 196 "ael.flex" #line 198 "ael.flex"
{ STORE_POS; return COLON;} { STORE_POS; return COLON;}
YY_BREAK YY_BREAK
case 9: case 9:
YY_RULE_SETUP YY_RULE_SETUP
#line 197 "ael.flex" #line 199 "ael.flex"
{ STORE_POS; return AMPER;} { STORE_POS; return AMPER;}
YY_BREAK YY_BREAK
case 10: case 10:
YY_RULE_SETUP YY_RULE_SETUP
#line 198 "ael.flex" #line 200 "ael.flex"
{ STORE_POS; return BAR;} { STORE_POS; return BAR;}
YY_BREAK YY_BREAK
case 11: case 11:
YY_RULE_SETUP YY_RULE_SETUP
#line 199 "ael.flex" #line 201 "ael.flex"
{ STORE_POS; return EXTENMARK;} { STORE_POS; return EXTENMARK;}
YY_BREAK YY_BREAK
case 12: case 12:
YY_RULE_SETUP YY_RULE_SETUP
#line 200 "ael.flex" #line 202 "ael.flex"
{ STORE_POS; return AT;} { STORE_POS; return AT;}
YY_BREAK YY_BREAK
case 13: case 13:
YY_RULE_SETUP YY_RULE_SETUP
#line 201 "ael.flex" #line 203 "ael.flex"
{/*comment*/} {/*comment*/}
YY_BREAK YY_BREAK
case 14: case 14:
YY_RULE_SETUP YY_RULE_SETUP
#line 202 "ael.flex" #line 204 "ael.flex"
{ STORE_POS; return KW_CONTEXT;} { STORE_POS; return KW_CONTEXT;}
YY_BREAK YY_BREAK
case 15: case 15:
YY_RULE_SETUP YY_RULE_SETUP
#line 203 "ael.flex" #line 205 "ael.flex"
{ STORE_POS; return KW_ABSTRACT;} { STORE_POS; return KW_ABSTRACT;}
YY_BREAK YY_BREAK
case 16: case 16:
YY_RULE_SETUP YY_RULE_SETUP
#line 204 "ael.flex" #line 206 "ael.flex"
{ STORE_POS; return KW_EXTEND;} { STORE_POS; return KW_EXTEND;}
YY_BREAK YY_BREAK
case 17: case 17:
YY_RULE_SETUP YY_RULE_SETUP
#line 205 "ael.flex" #line 207 "ael.flex"
{ STORE_POS; return KW_MACRO;}; { STORE_POS; return KW_MACRO;};
YY_BREAK YY_BREAK
case 18: case 18:
YY_RULE_SETUP YY_RULE_SETUP
#line 206 "ael.flex" #line 208 "ael.flex"
{ STORE_POS; return KW_GLOBALS;} { STORE_POS; return KW_GLOBALS;}
YY_BREAK YY_BREAK
case 19: case 19:
YY_RULE_SETUP YY_RULE_SETUP
#line 207 "ael.flex" #line 209 "ael.flex"
{ STORE_POS; return KW_LOCAL;} { STORE_POS; return KW_LOCAL;}
YY_BREAK YY_BREAK
case 20: case 20:
YY_RULE_SETUP YY_RULE_SETUP
#line 208 "ael.flex" #line 210 "ael.flex"
{ STORE_POS; return KW_IGNOREPAT;} { STORE_POS; return KW_IGNOREPAT;}
YY_BREAK YY_BREAK
case 21: case 21:
YY_RULE_SETUP YY_RULE_SETUP
#line 209 "ael.flex" #line 211 "ael.flex"
{ STORE_POS; return KW_SWITCH;} { STORE_POS; return KW_SWITCH;}
YY_BREAK YY_BREAK
case 22: case 22:
YY_RULE_SETUP YY_RULE_SETUP
#line 210 "ael.flex" #line 212 "ael.flex"
{ STORE_POS; return KW_IF;} { STORE_POS; return KW_IF;}
YY_BREAK YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
#line 211 "ael.flex" #line 213 "ael.flex"
{ STORE_POS; return KW_IFTIME;} { STORE_POS; return KW_IFTIME;}
YY_BREAK YY_BREAK
case 24: case 24:
YY_RULE_SETUP YY_RULE_SETUP
#line 212 "ael.flex" #line 214 "ael.flex"
{ STORE_POS; return KW_RANDOM;} { STORE_POS; return KW_RANDOM;}
YY_BREAK YY_BREAK
case 25: case 25:
YY_RULE_SETUP YY_RULE_SETUP
#line 213 "ael.flex" #line 215 "ael.flex"
{ STORE_POS; return KW_REGEXTEN;} { STORE_POS; return KW_REGEXTEN;}
YY_BREAK YY_BREAK
case 26: case 26:
YY_RULE_SETUP YY_RULE_SETUP
#line 214 "ael.flex" #line 216 "ael.flex"
{ STORE_POS; return KW_HINT;} { STORE_POS; return KW_HINT;}
YY_BREAK YY_BREAK
case 27: case 27:
YY_RULE_SETUP YY_RULE_SETUP
#line 215 "ael.flex" #line 217 "ael.flex"
{ STORE_POS; return KW_ELSE;} { STORE_POS; return KW_ELSE;}
YY_BREAK YY_BREAK
case 28: case 28:
YY_RULE_SETUP YY_RULE_SETUP
#line 216 "ael.flex" #line 218 "ael.flex"
{ STORE_POS; return KW_GOTO;} { STORE_POS; return KW_GOTO;}
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
#line 217 "ael.flex" #line 219 "ael.flex"
{ STORE_POS; return KW_JUMP;} { STORE_POS; return KW_JUMP;}
YY_BREAK YY_BREAK
case 30: case 30:
YY_RULE_SETUP YY_RULE_SETUP
#line 218 "ael.flex" #line 220 "ael.flex"
{ STORE_POS; return KW_RETURN;} { STORE_POS; return KW_RETURN;}
YY_BREAK YY_BREAK
case 31: case 31:
YY_RULE_SETUP YY_RULE_SETUP
#line 219 "ael.flex" #line 221 "ael.flex"
{ STORE_POS; return KW_BREAK;} { STORE_POS; return KW_BREAK;}
YY_BREAK YY_BREAK
case 32: case 32:
YY_RULE_SETUP YY_RULE_SETUP
#line 220 "ael.flex" #line 222 "ael.flex"
{ STORE_POS; return KW_CONTINUE;} { STORE_POS; return KW_CONTINUE;}
YY_BREAK YY_BREAK
case 33: case 33:
YY_RULE_SETUP YY_RULE_SETUP
#line 221 "ael.flex" #line 223 "ael.flex"
{ STORE_POS; return KW_FOR;} { STORE_POS; return KW_FOR;}
YY_BREAK YY_BREAK
case 34: case 34:
YY_RULE_SETUP YY_RULE_SETUP
#line 222 "ael.flex" #line 224 "ael.flex"
{ STORE_POS; return KW_WHILE;} { STORE_POS; return KW_WHILE;}
YY_BREAK YY_BREAK
case 35: case 35:
YY_RULE_SETUP YY_RULE_SETUP
#line 223 "ael.flex" #line 225 "ael.flex"
{ STORE_POS; return KW_CASE;} { STORE_POS; return KW_CASE;}
YY_BREAK YY_BREAK
case 36: case 36:
YY_RULE_SETUP YY_RULE_SETUP
#line 224 "ael.flex" #line 226 "ael.flex"
{ STORE_POS; return KW_DEFAULT;} { STORE_POS; return KW_DEFAULT;}
YY_BREAK YY_BREAK
case 37: case 37:
YY_RULE_SETUP YY_RULE_SETUP
#line 225 "ael.flex" #line 227 "ael.flex"
{ STORE_POS; return KW_PATTERN;} { STORE_POS; return KW_PATTERN;}
YY_BREAK YY_BREAK
case 38: case 38:
YY_RULE_SETUP YY_RULE_SETUP
#line 226 "ael.flex" #line 228 "ael.flex"
{ STORE_POS; return KW_CATCH;} { STORE_POS; return KW_CATCH;}
YY_BREAK YY_BREAK
case 39: case 39:
YY_RULE_SETUP YY_RULE_SETUP
#line 227 "ael.flex" #line 229 "ael.flex"
{ STORE_POS; return KW_SWITCHES;} { STORE_POS; return KW_SWITCHES;}
YY_BREAK YY_BREAK
case 40: case 40:
YY_RULE_SETUP YY_RULE_SETUP
#line 228 "ael.flex" #line 230 "ael.flex"
{ STORE_POS; return KW_ESWITCHES;} { STORE_POS; return KW_ESWITCHES;}
YY_BREAK YY_BREAK
case 41: case 41:
YY_RULE_SETUP YY_RULE_SETUP
#line 229 "ael.flex" #line 231 "ael.flex"
{ STORE_POS; return KW_INCLUDES;} { STORE_POS; return KW_INCLUDES;}
YY_BREAK YY_BREAK
case 42: case 42:
YY_RULE_SETUP YY_RULE_SETUP
#line 230 "ael.flex" #line 232 "ael.flex"
{ BEGIN(comment); my_col += 2; } { BEGIN(comment); my_col += 2; }
YY_BREAK YY_BREAK
case 43: case 43:
YY_RULE_SETUP YY_RULE_SETUP
#line 232 "ael.flex" #line 234 "ael.flex"
{ my_col += yyleng; } { my_col += yyleng; }
YY_BREAK YY_BREAK
case 44: case 44:
/* rule 44 can match eol */ /* rule 44 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 233 "ael.flex" #line 235 "ael.flex"
{ ++my_lineno; my_col=1;} { ++my_lineno; my_col=1;}
YY_BREAK YY_BREAK
case 45: case 45:
YY_RULE_SETUP YY_RULE_SETUP
#line 234 "ael.flex" #line 236 "ael.flex"
{ my_col += yyleng; } { my_col += yyleng; }
YY_BREAK YY_BREAK
case 46: case 46:
/* rule 46 can match eol */ /* rule 46 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 235 "ael.flex" #line 237 "ael.flex"
{ ++my_lineno; my_col=1;} { ++my_lineno; my_col=1;}
YY_BREAK YY_BREAK
case 47: case 47:
YY_RULE_SETUP YY_RULE_SETUP
#line 236 "ael.flex" #line 238 "ael.flex"
{ my_col += 2; BEGIN(INITIAL); } { my_col += 2; BEGIN(INITIAL); }
YY_BREAK YY_BREAK
case 48: case 48:
/* rule 48 can match eol */ /* rule 48 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 238 "ael.flex" #line 240 "ael.flex"
{ my_lineno++; my_col = 1; } { my_lineno++; my_col = 1; }
YY_BREAK YY_BREAK
case 49: case 49:
YY_RULE_SETUP YY_RULE_SETUP
#line 239 "ael.flex" #line 241 "ael.flex"
{ my_col += yyleng; } { my_col += yyleng; }
YY_BREAK YY_BREAK
case 50: case 50:
YY_RULE_SETUP YY_RULE_SETUP
#line 240 "ael.flex" #line 242 "ael.flex"
{ my_col += (yyleng*8)-(my_col%8); } { my_col += (yyleng*8)-(my_col%8); }
YY_BREAK YY_BREAK
case 51: case 51:
YY_RULE_SETUP YY_RULE_SETUP
#line 242 "ael.flex" #line 244 "ael.flex"
{ {
STORE_POS; STORE_POS;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
@ -1511,7 +1512,7 @@ YY_RULE_SETUP
case 52: case 52:
/* rule 52 can match eol */ /* rule 52 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 258 "ael.flex" #line 260 "ael.flex"
{ {
if ( pbcpop(')') ) { /* error */ if ( pbcpop(')') ) { /* error */
STORE_LOC; STORE_LOC;
@ -1537,7 +1538,7 @@ YY_RULE_SETUP
case 53: case 53:
/* rule 53 can match eol */ /* rule 53 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 280 "ael.flex" #line 282 "ael.flex"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
if (c == '(') if (c == '(')
@ -1549,7 +1550,7 @@ YY_RULE_SETUP
case 54: case 54:
/* rule 54 can match eol */ /* rule 54 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 288 "ael.flex" #line 290 "ael.flex"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
if ( pbcpop(c)) { /* error */ if ( pbcpop(c)) { /* error */
@ -1574,7 +1575,7 @@ YY_RULE_SETUP
case 55: case 55:
/* rule 55 can match eol */ /* rule 55 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 310 "ael.flex" #line 312 "ael.flex"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
if (c == '(') if (c == '(')
@ -1586,7 +1587,7 @@ YY_RULE_SETUP
case 56: case 56:
/* rule 56 can match eol */ /* rule 56 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 318 "ael.flex" #line 320 "ael.flex"
{ {
if ( pbcpop(')') ) { /* error */ if ( pbcpop(')') ) { /* error */
STORE_LOC; STORE_LOC;
@ -1614,7 +1615,7 @@ YY_RULE_SETUP
case 57: case 57:
/* rule 57 can match eol */ /* rule 57 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 342 "ael.flex" #line 344 "ael.flex"
{ {
if( parencount != 0) { /* printf("Folding in a comma!\n"); */ if( parencount != 0) { /* printf("Folding in a comma!\n"); */
yymore(); yymore();
@ -1632,7 +1633,7 @@ YY_RULE_SETUP
case 58: case 58:
/* rule 58 can match eol */ /* rule 58 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 356 "ael.flex" #line 358 "ael.flex"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
if ( pbcpop(c) ) { /* error */ if ( pbcpop(c) ) { /* error */
@ -1653,7 +1654,7 @@ YY_RULE_SETUP
case 59: case 59:
/* rule 59 can match eol */ /* rule 59 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 373 "ael.flex" #line 375 "ael.flex"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
yymore(); yymore();
@ -1663,7 +1664,7 @@ YY_RULE_SETUP
case 60: case 60:
/* rule 60 can match eol */ /* rule 60 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 379 "ael.flex" #line 381 "ael.flex"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
if ( pbcpop(c) ) { /* error */ if ( pbcpop(c) ) { /* error */
@ -1679,7 +1680,7 @@ YY_RULE_SETUP
case 61: case 61:
/* rule 61 can match eol */ /* rule 61 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 391 "ael.flex" #line 393 "ael.flex"
{ {
STORE_LOC; STORE_LOC;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
@ -1692,7 +1693,7 @@ YY_RULE_SETUP
case 62: case 62:
/* rule 62 can match eol */ /* rule 62 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 400 "ael.flex" #line 402 "ael.flex"
{ {
char fnamebuf[1024],*p1,*p2; char fnamebuf[1024],*p1,*p2;
int glob_ret; int glob_ret;
@ -1742,7 +1743,7 @@ case YY_STATE_EOF(paren):
case YY_STATE_EOF(semic): case YY_STATE_EOF(semic):
case YY_STATE_EOF(argg): case YY_STATE_EOF(argg):
case YY_STATE_EOF(comment): case YY_STATE_EOF(comment):
#line 445 "ael.flex" #line 447 "ael.flex"
{ {
char fnamebuf[2048]; char fnamebuf[2048];
if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) { if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
@ -1777,10 +1778,10 @@ case YY_STATE_EOF(comment):
YY_BREAK YY_BREAK
case 63: case 63:
YY_RULE_SETUP YY_RULE_SETUP
#line 479 "ael.flex" #line 481 "ael.flex"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 1784 "ael_lex.c" #line 1786 "ael_lex.c"
case YY_END_OF_BUFFER: case YY_END_OF_BUFFER:
{ {
@ -2905,7 +2906,7 @@ void *ael_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables" #define YYTABLES_NAME "yytables"
#line 479 "ael.flex" #line 481 "ael.flex"

@ -4006,7 +4006,7 @@ static void fix_gotos_in_extensions(struct ael_extension *exten)
} }
void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root) void ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root)
{ {
pval *p,*p2; pval *p,*p2;
struct ast_context *context; struct ast_context *context;
@ -4037,7 +4037,7 @@ void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root)
switch (p->type) { switch (p->type) {
case PV_MACRO: case PV_MACRO:
context = ast_context_create(local_contexts, p->u1.str, registrar); context = ast_context_find_or_create(local_contexts, local_table, p->u1.str, registrar);
exten = new_exten(); exten = new_exten();
exten->context = context; exten->context = context;
@ -4075,7 +4075,7 @@ void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root)
break; break;
case PV_CONTEXT: case PV_CONTEXT:
context = ast_context_find_or_create(local_contexts, p->u1.str, registrar); context = ast_context_find_or_create(local_contexts, local_table, p->u1.str, registrar);
/* contexts contain: ignorepat, includes, switches, eswitches, extensions, */ /* contexts contain: ignorepat, includes, switches, eswitches, extensions, */
for (p2=p->u2.statements; p2; p2=p2->next) { for (p2=p->u2.statements; p2; p2=p2->next) {

@ -130,7 +130,7 @@ aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c
aelparse.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res -DSTANDALONE_AEL -Wno-unused aelparse.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res -DSTANDALONE_AEL -Wno-unused
aelparse: aelparse.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o pval.o extconf.o aelparse: aelparse.o aelbison.o pbx_ael.o hashtab.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o pval.o extconf.o
astobj2.c: $(ASTTOPDIR)/main/astobj2.c astobj2.c: $(ASTTOPDIR)/main/astobj2.c
@cp $< $@ @cp $< $@
@ -154,7 +154,7 @@ hashtest.o: ASTCFLAGS+=-O0
extconf.o: extconf.c extconf.o: extconf.c
conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o hashtab.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o
testexpr2s: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h testexpr2s: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h
$(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE_AEL $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2f.o $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE_AEL $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2f.o

@ -19,6 +19,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/ast_expr.h" #include "asterisk/ast_expr.h"
#include "asterisk/module.h" #include "asterisk/module.h"
#include "asterisk/app.h" #include "asterisk/app.h"
#include "asterisk/lock.h"
#include "asterisk/hashtab.h"
#include "asterisk/ael_structs.h" #include "asterisk/ael_structs.h"
#include "asterisk/extconf.h" #include "asterisk/extconf.h"
@ -557,3 +559,33 @@ int main(int argc, char **argv)
return 0; return 0;
} }
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
{
return 0;
}
unsigned int ast_hashtab_hash_contexts(const void *obj);
unsigned int ast_hashtab_hash_contexts(const void *obj)
{
return 0;
}
#ifdef DEBUG_THREADS
void ast_mark_lock_acquired(void *lock_addr)
{
}
void ast_remove_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)
{
}
#endif

@ -47,6 +47,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/config.h" #include "asterisk/config.h"
#include "asterisk/options.h" #include "asterisk/options.h"
#include "asterisk/callerid.h" #include "asterisk/callerid.h"
#include "asterisk/lock.h"
#include "asterisk/hashtab.h"
#include "asterisk/ael_structs.h" #include "asterisk/ael_structs.h"
#include "asterisk/devicestate.h" #include "asterisk/devicestate.h"
#include "asterisk/stringfields.h" #include "asterisk/stringfields.h"
@ -607,14 +609,7 @@ int ast_context_add_include2(struct ast_context *con, const char *value,
return localized_context_add_include2(con, value,registrar); return localized_context_add_include2(con, value,registrar);
} }
struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar) struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
{
printf("Creating context %s, registrar=%s\n", name, registrar);
return localized_context_create(extcontexts, name, registrar);
}
struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, const char *name, const char *registrar)
{ {
printf("find/Creating context %s, registrar=%s\n", name, registrar); printf("find/Creating context %s, registrar=%s\n", name, registrar);
@ -661,9 +656,9 @@ int ast_context_verify_includes(struct ast_context *con)
return localized_context_verify_includes(con); return localized_context_verify_includes(con);
} }
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar); void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar);
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar) void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
{ {
localized_merge_contexts_and_delete(extcontexts, registrar); localized_merge_contexts_and_delete(extcontexts, registrar);
} }
@ -691,3 +686,33 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action); return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
} }
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
{
return 0;
}
unsigned int ast_hashtab_hash_contexts(const void *obj);
unsigned int ast_hashtab_hash_contexts(const void *obj)
{
return 0;
}
#ifdef DEBUG_THREADS
void ast_mark_lock_acquired(void *lock_addr)
{
}
void ast_remove_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)
{
}
#endif

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save