aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-06 19:19:18 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-06 19:19:18 +0000
commit818c5e7f652d41c8c672fb84cfadd5d6d3ba502a (patch)
treebf3b03868ee498c99e7fafb1af84134996461c00 /res
parent28ac723a337536809c6d8f363ff84037a548f690 (diff)
Recorded merge of revisions 222273 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r222273 | tilghman | 2009-10-06 14:17:11 -0500 (Tue, 06 Oct 2009) | 5 lines When we call a gosub routine, the variables should be scoped to avoid contaminating the caller. This affected the ~~EXTEN~~ hack, where a subroutine might have changed the value before it was used in the caller. Patch by myself, tested by ebroad on #asterisk ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@222279 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/ael/pval.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/res/ael/pval.c b/res/ael/pval.c
index a5cae099e..dc5d057d7 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -3360,30 +3360,44 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
if (contains_switch(statement)) { /* only run contains_switch if you haven't checked before */
if (mother_exten) {
if (!mother_exten->has_switch) {
- switch_set = new_prio();
- switch_set->type = AEL_APPCALL;
- switch_set->app = strdup("Set");
- switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
- linkprio(exten, switch_set, mother_exten);
- mother_exten->has_switch = 1;
- mother_exten->checked_switch = 1;
- if (exten) {
- exten->has_switch = 1;
- exten->checked_switch = 1;
+ for (first = 1; first >= 0; first--) {
+ switch_set = new_prio();
+ switch_set->type = AEL_APPCALL;
+ switch_set->app = strdup("Set");
+ if (!strcmp(mother_exten->name, "s") && first) {
+ switch_set->appargs = strdup("LOCAL(~~EXTEN~~)=${EXTEN}");
+ } else {
+ switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
+ first = 0;
+ }
+ linkprio(exten, switch_set, mother_exten);
+ mother_exten->has_switch = 1;
+ mother_exten->checked_switch = 1;
+ if (exten) {
+ exten->has_switch = 1;
+ exten->checked_switch = 1;
+ }
}
}
} else if (exten) {
if (!exten->has_switch) {
- switch_set = new_prio();
- switch_set->type = AEL_APPCALL;
- switch_set->app = strdup("Set");
- switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
- linkprio(exten, switch_set, mother_exten);
- exten->has_switch = 1;
- exten->checked_switch = 1;
- if (mother_exten) {
- mother_exten->has_switch = 1;
- mother_exten->checked_switch = 1;
+ for (first = 1; first >= 0; first--) {
+ switch_set = new_prio();
+ switch_set->type = AEL_APPCALL;
+ switch_set->app = strdup("Set");
+ if (!strcmp(mother_exten->name, "s") && first) {
+ switch_set->appargs = strdup("LOCAL(~~EXTEN~~)=${EXTEN}");
+ } else {
+ switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
+ first = 0;
+ }
+ linkprio(exten, switch_set, mother_exten);
+ exten->has_switch = 1;
+ exten->checked_switch = 1;
+ if (mother_exten) {
+ mother_exten->has_switch = 1;
+ mother_exten->checked_switch = 1;
+ }
}
}
}