diff options
author | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-14 01:00:59 +0000 |
---|---|---|
committer | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-14 01:00:59 +0000 |
commit | 83d85670c2e7f3da34dbe7752e10e5cd7b9bf743 (patch) | |
tree | 3e0a14f393772aa8f679545721bb1b6c2dd31de8 /pbx | |
parent | 3408a428d51b020eab9b472759f781d914f077bc (diff) |
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@45139 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_ael.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c index 0ab588679..f40e114ef 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -474,6 +474,29 @@ static char *argument_end(char *str) return NULL; } +static void gen_match_to_pattern(const char *pattern, char *result) +{ + /* the result will be a string that will be matched by pattern */ + char *p=(char *)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 int build_step(const char *what, const char *name, const char *filename, int lineno, struct ast_context *con, char *exten, int *pos, char *data, struct fillin **fillout, char **label); static int __build_step(const char *what, const char *name, const char *filename, int lineno, struct ast_context *con, char *exten, int *pos, char *data, struct fillin **fillout, char **label) { @@ -541,9 +564,12 @@ static int __build_step(const char *what, const char *name, const char *filename if (aeldebug & DEBUG_TOKENS) ast_verbose("--NEWCASE: '%s'!\n", newcase); if (curcase) { + char zbuf[256]; + /* Handle fall through */ char tmp[strlen(newcase) + strlen(name) + 40]; - sprintf(tmp, "sw-%d-%s|%d", *pos - 2, newcase, 1); + gen_match_to_pattern(newcase,zbuf); + sprintf(tmp, "sw-%d-%s|%d", *pos - 2, zbuf, 1); ast_add_extension2(con, 0, margs, cpos, NULL, NULL, "Goto", strdup(tmp), FREE, registrar); } curcase = newcase; |