diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-15 13:14:07 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-15 13:14:07 +0000 |
commit | 0fe0bac06aee27353c279009b1c2dc74b20043c2 (patch) | |
tree | bdef23b6cbba2974e714c2b74c02ec455e70f1b2 /include/asterisk | |
parent | 560edcd1346f6ecaf7f39c48bb096bcaf039d5a8 (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.6.0@130946 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/pbx.h | 40 | ||||
-rw-r--r-- | include/asterisk/pval.h | 3 |
2 files changed, 24 insertions, 19 deletions
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index d8fcbae07..574a4b312 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -25,6 +25,7 @@ #include "asterisk/sched.h" #include "asterisk/chanvars.h" +#include "asterisk/hashtab.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" { @@ -167,45 +168,36 @@ struct ast_app *pbx_findapp(const char *app); 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 * * \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 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 * 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_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 * 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 * that belong to that registrar; if NULL only the contexts that are specified * 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) @@ -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_switch_name(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 */ @@ -997,8 +991,18 @@ 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); + + +/* 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) } diff --git a/include/asterisk/pval.h b/include/asterisk/pval.h index 2dff24ddc..acc9b30e1 100644 --- a/include/asterisk/pval.h +++ b/include/asterisk/pval.h @@ -1,6 +1,7 @@ #ifndef _ASTERISK_PVAL_H #define _ASTERISK_PVAL_H +/* whatever includes this, better include asterisk/lock.h and asterisk/hashtab.h */ 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 ); */ void set_priorities(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_item(pval *item); int is_float(char *arg ); |