Example #1
0
        /// <summary>
        /// This updates the VMRs for a conference when a participant joins or leaves a VMR
        /// </summary>
        /// <param name="conference"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task UpdateConferenceRoomParticipants(Conference conference, ConferenceEventRequest request)
        {
            if (!request.IsParticipantAndVmrEvent())
            {
                return;
            }

            var roomId        = long.Parse(request.ParticipantRoomId);
            var participantId = Guid.Parse(request.ParticipantId);


            switch (request.EventType)
            {
            case EventType.Joined:
                conference.AddParticipantToRoom(roomId, participantId);
                break;

            case EventType.Disconnected:
                await _consultationResponseTracker.ClearResponses(conference, participantId);

                conference.RemoveParticipantFromRoom(roomId, participantId);
                break;

            default: return;
            }

            await _conferenceCache.UpdateConferenceAsync(conference);
        }