Ejemplo n.º 1
0
        public async Task <IActionResult> DismissWitnessAsync(Guid conferenceId, Guid participantId)
        {
            _logger.LogDebug("DismissWitness");
            var validatedRequest = await ValidateWitnessInConference(conferenceId, participantId);

            if (validatedRequest != null)
            {
                return(validatedRequest);
            }

            try
            {
                _logger.LogDebug("Sending request to dismiss witness {Participant} from video hearing {Conference}",
                                 participantId, conferenceId);
                await _videoApiClient.TransferParticipantAsync(conferenceId, new TransferParticipantRequest
                {
                    Participant_id = participantId,
                    Transfer_type  = TransferType.Dismiss
                });
            }
            catch (VideoApiException ex)
            {
                _logger.LogError(ex, "Unable to dismiss witness {Participant} from video hearing {Conference}",
                                 participantId, conferenceId);
                return(StatusCode(ex.StatusCode, ex.Response));
            }

            try
            {
                _logger.LogDebug("Sending alert to vho witness {Participant} dismissed from video hearing {Conference}",
                                 participantId, conferenceId);
                await _videoApiClient.AddTaskAsync(conferenceId, new AddTaskRequest
                {
                    Participant_id = participantId,
                    Body           = "Witness dismissed",
                    Task_type      = TaskType.Participant
                });
            }
            catch (VideoApiException ex)
            {
                _logger.LogError(ex, "Unable to add a dismiss witness alert for {Participant} in video hearing {Conference}",
                                 participantId, conferenceId);
                return(StatusCode(ex.StatusCode, ex.Response));
            }
            return(Accepted());
        }