diff options
author | Matthias Nick <mnick@digium.com> | 2009-12-04 17:15:47 +0000 |
---|---|---|
committer | Matthias Nick <mnick@digium.com> | 2009-12-04 17:15:47 +0000 |
commit | 89b02b583aeb29f5d19af153d0cf37c1139f8505 (patch) | |
tree | 6c7eee170c763636d6e7e025fc908590b32271f2 /pbx | |
parent | 74c5417696d16eae20a1569716492a9bb4aed5b2 (diff) |
Parse global variables or expressions in hint extensions
Parse global variables or expressions in hint extensions. Like: exten => 400,hint,DAHDI/i2/${GLOBAL(var)}
(closes issue #16166)
Reported by: rmudgett
Tested by: mnick, rmudgett
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@233093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_config.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index a14ad694c..6e4fa5702 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1496,13 +1496,29 @@ process_extension: /* No arguments */ data = ""; } else { + char *orig_appl = ast_strdup(appl); + + if (!orig_appl) + return -1; + appl = strsep(&stringp, "("); - data = S_OR(stringp, ""); - if ((end = strrchr(data, ')'))) { - *end = '\0'; + + /* check if there are variables or expressions without an application, like: exten => 100,hint,DAHDI/g0/${GLOBAL(var)} */ + if (strstr(appl, "${") || strstr(appl, "$[")){ + /* set appl to original one */ + strcpy(appl, orig_appl); + /* set no data */ + data = ""; + /* no variable before application found -> go ahead */ } else { - ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data); + data = S_OR(stringp, ""); + if ((end = strrchr(data, ')'))) { + *end = '\0'; + } else { + ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data); + } } + ast_free(orig_appl); } appl = ast_skip_blanks(appl); |