aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/pbx_ael.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-13 17:49:54 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-13 17:49:54 +0000
commitc338e83712467731d7a9f46b53e5f2b164aac7a8 (patch)
tree703907296f31ff993339ccc4745a734737bfbe50 /pbx/pbx_ael.c
parent9092da6fa7106209d19598f25c47402a3760ec3e (diff)
This patch fixes bug 10411. I added a new regression test, some regression test cleanups
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@79255 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/pbx_ael.c')
-rw-r--r--pbx/pbx_ael.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c
index 7ccc5e82d..30267757e 100644
--- a/pbx/pbx_ael.c
+++ b/pbx/pbx_ael.c
@@ -3568,15 +3568,18 @@ void add_extensions(struct ael_extension *exten)
{
struct ael_priority *pr;
char *label=0;
+ char realext[256]="";
if (!exten) {
ast_log(LOG_WARNING, "This file is Empty!\n" );
return;
}
do {
struct ael_priority *last = 0;
-
+
+ realext[0] = 0; /* make sure this is properly initialized */
+ pbx_substitute_variables_helper(NULL, exten->name, realext, sizeof(realext) - 1);
if (exten->hints) {
- if (ast_add_extension2(exten->context, 0 /*no replace*/, exten->name, PRIORITY_HINT, NULL, exten->cidmatch,
+ if (ast_add_extension2(exten->context, 0 /*no replace*/, realext, PRIORITY_HINT, NULL, exten->cidmatch,
exten->hints, NULL, ast_free, registrar)) {
ast_log(LOG_WARNING, "Unable to add step at priority 'hint' of extension '%s'\n",
exten->name);
@@ -3656,7 +3659,7 @@ void add_extensions(struct ael_extension *exten)
else
label = 0;
- if (ast_add_extension2(exten->context, 0 /*no replace*/, exten->name, pr->priority_num, (label?label:NULL), exten->cidmatch,
+ if (ast_add_extension2(exten->context, 0 /*no replace*/, realext, pr->priority_num, (label?label:NULL), exten->cidmatch,
app, strdup(appargs), ast_free, registrar)) {
ast_log(LOG_WARNING, "Unable to add step at priority '%d' of extension '%s'\n", pr->priority_num,
exten->name);
@@ -3756,6 +3759,22 @@ void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root)
struct ael_extension *exten;
struct ael_extension *exten_list = 0;
+ for (p=root; p; p=p->next ) { /* do the globals first, so they'll be there
+ when we try to eval them */
+ switch (p->type) {
+ case PV_GLOBALS:
+ /* just VARDEC elements */
+ for (p2=p->u1.list; p2; p2=p2->next) {
+ char buf2[2000];
+ snprintf(buf2,sizeof(buf2),"%s=%s", p2->u1.str, p2->u2.val);
+ pbx_builtin_setvar(NULL, buf2);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
for (p=root; p; p=p->next ) {
pval *lp;
int argc;
@@ -3820,12 +3839,7 @@ void ast_compile_ael2(struct ast_context **local_contexts, struct pval *root)
break;
case PV_GLOBALS:
- /* just VARDEC elements */
- for (p2=p->u1.list; p2; p2=p2->next) {
- char buf2[2000];
- snprintf(buf2,sizeof(buf2),"%s=%s", p2->u1.str, p2->u2.val);
- pbx_builtin_setvar(NULL, buf2);
- }
+ /* already done */
break;
case PV_CONTEXT: