aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnick <mnick@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-04 16:59:21 +0000
committermnick <mnick@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-04 16:59:21 +0000
commit31b9dddcd8784878af3306eb83212ecaf8cbcbde (patch)
tree207f412163e84ce6762eab39a4c8ffef7cc92f86
parent0fce04baf403fff67858aa35a5cf1617a7978a7c (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: http://svn.digium.com/svn/asterisk/branches/1.4@233091 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--pbx/pbx_config.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index fd79cc48d..9c51b130c 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -2266,16 +2266,30 @@ static int pbx_load_config(const char *config_file)
/* Neither found */
data = "";
} else {
+ char *orig_appl = strdup(appl);
+
+ if (!orig_appl)
+ return -1;
+
/* Final remaining case is parenthesis found first */
appl = strsep(&stringp, "(");
- data = stringp;
- end = strrchr(data, ')');
- 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);
+ data = "";
} else {
- ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data);
+ data = stringp;
+ end = strrchr(data, ')');
+ if ((end = strrchr(data, ')'))) {
+ *end = '\0';
+ } else {
+ ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data);
+ }
+ ast_process_quotes_and_slashes(data, ',', '|');
}
- ast_process_quotes_and_slashes(data, ',', '|');
+ ast_free(orig_appl);
}
if (!data)