aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/pbx_ael.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-13 20:52:17 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-13 20:52:17 +0000
commitba5defcffd4ad765ddaecbd448a7fc991579b29a (patch)
treee23889b9833b8006e2085218f384f2320c877535 /pbx/pbx_ael.c
parent3a1efbfc46c9628460b5ff3e930335ae25d419e7 (diff)
Bug 8128 fixed in this release via these changes
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@45103 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/pbx_ael.c')
-rw-r--r--pbx/pbx_ael.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c
index 2dc8b37ad..b68322726 100644
--- a/pbx/pbx_ael.c
+++ b/pbx/pbx_ael.c
@@ -2785,6 +2785,29 @@ static void remove_spaces_before_equals(char *str)
}
}
+static void gen_match_to_pattern(char *pattern, char *result)
+{
+ /* the result will be a string that will be matched by pattern */
+ char *p=pattern, *t=result;
+ while (*p) {
+ if (*p == 'x' || *p == 'n' || *p == 'z' || *p == 'X' || *p == 'N' || *p == 'Z')
+ *t++ = '9';
+ else if (*p == '[') {
+ char *z = p+1;
+ while (*z != ']')
+ z++;
+ if (*(z+1)== ']')
+ z++;
+ *t++=*(p+1); /* use the first char in the set */
+ p = z;
+ } else {
+ *t++ = *p;
+ }
+ p++;
+ }
+ *t++ = 0; /* cap it off */
+}
+
static void gen_prios(struct ael_extension *exten, char *label, pval *statement, struct ael_extension *mother_exten, struct ast_context *this_context )
{
pval *p,*p2,*p3;
@@ -3031,14 +3054,15 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+ gen_match_to_pattern(p2->next->u1.str, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1", local_control_statement_count, buf2);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
@@ -3092,14 +3116,15 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+ gen_match_to_pattern(p2->next->u1.str, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",local_control_statement_count, buf2);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
@@ -3155,14 +3180,15 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-%s|1",local_control_statement_count, p2->next->u1.str);
+ gen_match_to_pattern(p2->next->u1.str, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s|1",local_control_statement_count, buf2);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"_sw-%d-.|1",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.|1",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {