]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_verto] pass in audio flags
authorAnthony Minessale <anthm@signalwire.com>
Mon, 7 Dec 2020 23:09:52 +0000 (23:09 +0000)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:01:03 +0000 (22:01 +0300)
src/mod/endpoints/mod_verto/mod_verto.c

index dc352bcb0c9e3d5d58a04cb6b106b5a10cbacf3b..2b702911fc8b3efd3ec63032b87647f070e96b9a 100644 (file)
@@ -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);