aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-26 17:39:39 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-26 17:39:39 +0000
commit15b76d347eae9ee3ad3a6664608796608d677013 (patch)
tree684099f02056498804e98698f642101c1af2ebfa /utils
parent8649193a72973adbd45983cf90cbaccbd40f4d51 (diff)
Merged revisions 87168 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r87168 | murf | 2007-10-26 10:34:02 -0600 (Fri, 26 Oct 2007) | 1 line closes issue #11086 where a user complains that references to following contexts report a problem; The problem was REALLy that he was referring to empty contexts, which were being ignored. Reporter stated that empty contexts should be OK. I checked it out against extensions.conf, and sure enough, empty contexts ARE ok. So, I removed the restriction from AEL. This, though, highlighted a problem with multiple contexts of the same name. This should be OK, also. So, I added the extend keyword to AEL, and it can preceed the 'context' keyword (mixed with 'abstract', if nec.). This will turn off the warnings in AEL if the same context name is used 2 or more times. Also, I now call ast_context_find_or_create for contexts now, instead of just ast_context_create; I did this because pbx_config does this. The 'extend' keyword thus becomes a statement of intent. AEL can now duplicate the behavior of pbx_config, ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@87187 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils')
-rw-r--r--utils/ael_main.c16
-rw-r--r--utils/conf2ael.c7
2 files changed, 23 insertions, 0 deletions
diff --git a/utils/ael_main.c b/utils/ael_main.c
index 58939f9a0..8955aa045 100644
--- a/utils/ael_main.c
+++ b/utils/ael_main.c
@@ -91,6 +91,7 @@ int ast_add_extension2(struct ast_context *con,
const char *registrar);
void pbx_builtin_setvar(void *chan, void *data);
struct ast_context * ast_context_create(void **extcontexts, const char *name, const char *registrar);
+struct ast_context * ast_context_find_or_create(void **extcontexts, const char *name, const char *registrar);
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);
void ast_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar);
@@ -359,6 +360,21 @@ struct ast_context * ast_context_create(void **extcontexts, const char *name, co
return x;
}
+struct ast_context * ast_context_find_or_create(void **extcontexts, const char *name, const char *registrar)
+{
+ struct ast_context *x = calloc(1, sizeof(*x));
+ if (!x)
+ return NULL;
+ x->next = context_list;
+ context_list = x;
+ if (!no_comp)
+ printf("Executed ast_context_find_or_create(conts, name=%s, registrar=%s);\n", name, registrar);
+ conts++;
+ strncpy(x->name, name, sizeof(x->name) - 1);
+ strncpy(x->registrar, registrar, sizeof(x->registrar) - 1);
+ return x;
+}
+
void ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
{
if(!no_comp)
diff --git a/utils/conf2ael.c b/utils/conf2ael.c
index 312ed700f..02e78297e 100644
--- a/utils/conf2ael.c
+++ b/utils/conf2ael.c
@@ -630,6 +630,13 @@ struct ast_context *ast_context_create(struct ast_context **extcontexts, const c
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);
+
+ return localized_context_create(extcontexts, name, registrar);
+}
+
void ast_cli_register_multiple(void);
void ast_cli_register_multiple(void)