[core] Add app_disable_expand_variables channel variable. When true, application args are not expanded by FreeSWITCH and are passed to the application unchanged.

This commit is contained in:
Chris Rienzo 2021-01-15 08:37:09 -05:00 committed by Andrey Volk
parent 594963a3ca
commit e6cd6391ff
1 changed files with 7 additions and 2 deletions

View File

@ -2849,6 +2849,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
int scope = 0; int scope = 0;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
char *app_uuid = uuid_str; char *app_uuid = uuid_str;
switch_bool_t expand_variables = !switch_true(switch_channel_get_variable(session->channel, "app_disable_expand_variables"));
if ((app_uuid_var = switch_channel_get_variable(channel, "app_uuid"))) { if ((app_uuid_var = switch_channel_get_variable(channel, "app_uuid"))) {
app_uuid = (char *)app_uuid_var; app_uuid = (char *)app_uuid_var;
@ -2866,10 +2867,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
app = application_interface->interface_name; app = application_interface->interface_name;
if (arg) { if (arg) {
if (expand_variables) {
expanded = switch_channel_expand_variables(session->channel, arg); expanded = switch_channel_expand_variables(session->channel, arg);
} else {
expanded = (char *)arg;
}
} }
if (expanded && *expanded == '%' && (*(expanded+1) == '[' || *(expanded+2) == '[')) { if (expand_variables && expanded && *expanded == '%' && (*(expanded+1) == '[' || *(expanded+2) == '[')) {
char *p, *dup; char *p, *dup;
switch_event_t *ovars = NULL; switch_event_t *ovars = NULL;