From: Sean Bright Date: Thu, 11 Apr 2019 20:29:20 +0000 (-0400) Subject: res_ael: Use Gosub in for loop expressions X-Git-Tag: 16.4.0-rc1~28^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea3109beaabdc96e6bb64d962334fc1ca2eec75f;p=thirdparty%2Fasterisk.git res_ael: Use Gosub in for loop expressions In AEL2, if a 'for' statement contains macro* calls, like: for (&iterator(${TRY},A); "${A}" != ""; &iterate(A)) { The AEL2 parser will translate these into calls to the deprecated Macro dialplan application and use the antiquated pipe delimiter. Instead, convert these into calls to the Gosub dialplan application and use commas as argument separators. ASTERISK-18593 #close Reported by: Luke-Jr * 'macro' in this context means AEL2 macros, not the 'Macro' application Change-Id: I3d73716033b8e3e42e0209d355bf5f10c97045fc --- diff --git a/res/ael/pval.c b/res/ael/pval.c index f927077a83..4e9a5255ed 100644 --- a/res/ael/pval.c +++ b/res/ael/pval.c @@ -3540,18 +3540,14 @@ static int gen_prios(struct ael_extension *exten, char *label, pval *statement, strcpy(buf2, strp3); strp3 = strchr(buf2,'('); if (strp3) { - *strp3 = '|'; - } - while ((strp3=strchr(buf2,','))) { - *strp3 = '|'; + *strp3 = ','; } strp3 = strrchr(buf2, ')'); if (strp3) *strp3 = 0; /* remove the closing paren */ - for_init->appargs = strdup(buf2); free(for_init->app); - for_init->app = strdup("Macro"); + for_init->app = strdup("Gosub"); } else { /* must be a regular app call */ char *strp3; strcpy(buf2, strp2); @@ -3598,7 +3594,7 @@ static int gen_prios(struct ael_extension *exten, char *label, pval *statement, for_inc->appargs = strdup(buf2); - for_inc->app = strdup("Macro"); + for_inc->app = strdup("Gosub"); } else { /* must be a regular app call */ char *strp3; strcpy(buf2, strp2);