From 4c8e7d86e355cc02a87685882f9d11d6bb5138e0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 23 Jun 2020 05:52:14 +0000 Subject: [PATCH] [core, mod_verto] check for camera change and trigger new constraints --- src/include/switch_types.h | 1 + src/mod/endpoints/mod_verto/mod_verto.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 0435a9f81f..a4e4059176 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1634,6 +1634,7 @@ typedef enum { CF_REATTACHED, CF_VIDEO_READ_TAPPED, CF_VIDEO_WRITE_TAPPED, + CF_DEVICES_CHANGED, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 32480ac9cc..3fdf01b186 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3611,7 +3611,7 @@ static switch_bool_t verto__ping_func(const char *method, cJSON *params, jsock_t static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { cJSON *msg = NULL, *dialog = NULL, *txt = NULL, *jevent = NULL; - const char *call_id = NULL, *dtmf = NULL; + const char *call_id = NULL, *dtmf = NULL, *type = NULL; switch_bool_t r = SWITCH_TRUE; char *proto = VERTO_CHAT_PROTO; char *pproto = NULL; @@ -3624,9 +3624,12 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t err = 1; goto cleanup; } + type = cJSON_GetObjectCstr(params, "type"); + if ((dialog = cJSON_GetObjectItem(params, "dialogParams")) && (call_id = cJSON_GetObjectCstr(dialog, "callID"))) { switch_core_session_t *session = NULL; - + switch_channel_t *channel = NULL; + if ((session = switch_core_session_locate(call_id))) { verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY); @@ -3636,8 +3639,13 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t err = 1; goto cleanup; } + channel = switch_core_session_get_channel(session); parse_user_vars(dialog, session); + if (type && !strcasecmp(type, "mediaSettings")) { + switch_channel_set_flag(channel, CF_DEVICES_CHANGED); + } + if ((jevent = cJSON_GetObjectItem(params, "command"))) { switch_event_t *event = NULL;