From 40229a5f7ea3bd4b25271fc90bde3addced85dfc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 7 Dec 2020 23:09:52 +0000 Subject: [PATCH] [mod_verto] pass in audio flags --- src/mod/endpoints/mod_verto/mod_verto.c | 30 ++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index dc352bcb0c..2b702911fc 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3606,16 +3606,40 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock return SWITCH_FALSE; } + static void parse_user_vars(cJSON *obj, switch_core_session_t *session) { - cJSON *json_ptr; - + cJSON *json_ptr, *var; + switch_channel_t *channel; + switch_assert(obj); switch_assert(session); + channel = switch_core_session_get_channel(session); + + + if ((json_ptr = cJSON_GetObjectItem(obj, "audio"))) { + if ((var = cJSON_GetObjectItem(json_ptr, "echoCancellation")) && var->type == cJSON_True) { + switch_channel_set_variable(channel, "verto_echoCancellation", "true"); + } else { + switch_channel_set_variable(channel, "verto_echoCancellation", "false"); + } + + if ((var = cJSON_GetObjectItem(json_ptr, "noiseSuppression")) && var->type == cJSON_True) { + switch_channel_set_variable(channel, "verto_noiseSuppression", "true"); + } else { + switch_channel_set_variable(channel, "verto_noiseSuppression", "false"); + } + + if ((var = cJSON_GetObjectItem(json_ptr, "autoGainControl")) && var->type == cJSON_True) { + switch_channel_set_variable(channel, "verto_autoGainControl", "true"); + } else { + switch_channel_set_variable(channel, "verto_autoGainControl", "false"); + } + } + if ((json_ptr = cJSON_GetObjectItem(obj, "userVariables"))) { cJSON * i; - switch_channel_t *channel = switch_core_session_get_channel(session); for(i = json_ptr->child; i; i = i->next) { char *varname = switch_core_session_sprintf(session, "verto_dvar_%s", i->string);