diff options
Diffstat (limited to 'pbx/pbx_config.c')
-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 b9a40f4ce..16e58cea5 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1497,13 +1497,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); |