aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-22 16:41:43 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-22 16:41:43 +0000
commiteac8afb144a7ccc90b4a39bbe8703a1dbc9ce6fd (patch)
treef2d395dde9004a7f92b008e7c2a909c4d24ebe3d /pbx
parent02c2b2e2c1f00151ac2099ff68efda2ac89271a0 (diff)
This closes issue #10788 -- the 3rd arg in the for statement is now wrapped in Set() only if there's an '=' in that string. Otherwise, if it begins with '&', then a Macro call is generated; otherwise it is made into an app call. A bit more accomodating, keeps the new guys happy, and the guys with ael-1 code should be happy, too
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@83558 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_ael.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c
index 4859c9d8d..6ad43c88b 100644
--- a/pbx/pbx_ael.c
+++ b/pbx/pbx_ael.c
@@ -2993,20 +2993,55 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
} else
for_init->appargs = strdup(p->u1.for_init);
- for_inc->app = strdup("Set");
strcpy(buf2,p->u3.for_inc);
remove_spaces_before_equals(buf2);
strp = strchr(buf2, '=');
- strp2 = strchr(p->u3.for_inc, '=');
- if (strp) {
+ if (strp) { /* there's an = in this part; that means an assignment. set it up */
+ strp2 = strchr(p->u3.for_inc, '=');
*(strp+1) = 0;
strcat(buf2,"$[");
strncat(buf2,strp2+1, sizeof(buf2)-strlen(strp2+1)-2);
strcat(buf2,"]");
for_inc->appargs = strdup(buf2);
- } else
- for_inc->appargs = strdup(p->u3.for_inc);
+ for_inc->app = strdup("Set");
+ } else {
+ strp2 = p->u3.for_inc;
+ while (*strp2 && isspace(*strp2))
+ strp2++;
+ if (*strp2 == '&') { /* itsa macro call */
+ char *strp3 = strp2+1;
+ while (*strp3 && isspace(*strp3))
+ strp3++;
+ strcpy(buf2, strp3);
+ strp3 = strchr(buf2,'(');
+ if (strp3) {
+ *strp3 = '|';
+ }
+ while ((strp3=strchr(buf2,','))) {
+ *strp3 = '|';
+ }
+ strp3 = strrchr(buf2, ')');
+ if (strp3)
+ *strp3 = 0; /* remove the closing paren */
+
+ for_inc->appargs = strdup(buf2);
+
+ for_inc->app = strdup("Macro");
+ } else { /* must be a regular app call */
+ char *strp3;
+ strcpy(buf2, strp2);
+ strp3 = strchr(buf2,'(');
+ if (strp3) {
+ *strp3 = 0;
+ for_inc->app = strdup(buf2);
+ for_inc->appargs = strdup(strp3+1);
+ strp3 = strrchr(for_inc->appargs, ')');
+ if (strp3)
+ *strp3 = 0; /* remove the closing paren */
+ }
+ }
+ }
snprintf(buf1,sizeof(buf1),"$[%s]",p->u2.for_test);
for_test->app = 0;
for_test->appargs = strdup(buf1);