func_evalexten: Extension evaluation function.

This adds the EVAL_EXTEN function, which may be used to retrieve
the variable-substituted data at any extension.

ASTERISK-29486

Change-Id: Iad81019689674c9f4ac77d235f5d7234adbb1432
This commit is contained in:
Naveen Albert
2021-06-21 08:49:16 -04:00
committed by Friendly Automation
parent ce7846e658
commit 6ddb0ec939
5 changed files with 219 additions and 27 deletions

View File

@@ -736,7 +736,7 @@ void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct
/* Substitute if necessary */
if (needsub) {
pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL);
pbx_substitute_variables_helper_full_location(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL, context, exten, pri);
vars = ltmp;
} else {
vars = var;
@@ -770,10 +770,13 @@ void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct
/* For dialplan location, if we were told what to substitute explicitly, use that instead */
if (exten && !strcmp(vars, "EXTEN")) {
ast_copy_string(workspace, exten, VAR_BUF_SIZE);
cp4 = workspace;
} else if (context && !strcmp(vars, "CONTEXT")) {
ast_copy_string(workspace, context, VAR_BUF_SIZE);
cp4 = workspace;
} else if (pri && !strcmp(vars, "PRIORITY")) {
snprintf(workspace, VAR_BUF_SIZE, "%d", pri);
cp4 = workspace;
} else {
pbx_retrieve_variable(c, vars, &cp4, workspace, VAR_BUF_SIZE, headp);
}
@@ -829,7 +832,7 @@ void pbx_substitute_variables_helper_full_location(struct ast_channel *c, struct
/* Substitute if necessary */
if (needsub) {
pbx_substitute_variables_helper_full(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL);
pbx_substitute_variables_helper_full_location(c, headp, var, ltmp, VAR_BUF_SIZE - 1, NULL, context, exten, pri);
vars = ltmp;
} else {
vars = var;