public static ConferenceDetailsResponse MapConferenceToResponse(Conference conference, string pexipSelfTestNode) { var allInterpreterRooms = conference.Rooms.OfType <ParticipantRoom>().ToList(); var interpreterRooms = allInterpreterRooms.Select(RoomToCivilianRoomResponseMapper.MapToResponse).ToList(); var response = new ConferenceDetailsResponse { Id = conference.Id, HearingId = conference.HearingRefId, CaseType = conference.CaseType, CaseNumber = conference.CaseNumber, CaseName = conference.CaseName, ScheduledDateTime = conference.ScheduledDateTime, StartedDateTime = conference.ActualStartTime, ClosedDateTime = conference.ClosedDateTime, ScheduledDuration = conference.ScheduledDuration, CurrentStatus = conference.GetCurrentStatus().MapToContractEnum(), Participants = MapParticipants(conference.Participants, allInterpreterRooms), MeetingRoom = MeetingRoomToResponseMapper.MapVirtualCourtToResponse(conference.GetMeetingRoom()), Endpoints = conference.GetEndpoints().Select(EndpointToResponseMapper.MapEndpointResponse).ToList(), HearingVenueName = conference.HearingVenueName, AudioRecordingRequired = conference.AudioRecordingRequired, CivilianRooms = interpreterRooms }; if (response.MeetingRoom != null) { response.MeetingRoom.PexipSelfTestNode = pexipSelfTestNode; } return(response); }
private ConferenceEventRequest BuildRequest(EventType eventType, Conference conference = null, string phone = null) { var request = Builder <ConferenceEventRequest> .CreateNew() .With(x => x.ConferenceId = Guid.NewGuid().ToString()) .With(x => x.ParticipantId = Guid.NewGuid().ToString()) .With(x => x.EventId = Guid.NewGuid().ToString()) .With(x => x.EventType = eventType) .With(x => x.TransferFrom = RoomType.WaitingRoom) .With(x => x.TransferTo = RoomType.ConsultationRoom1) .With(x => x.Reason = "Automated") .With(x => x.Phone = phone) .Build(); if (conference == null) { return(request); } request.ConferenceId = conference.Id.ToString(); var isEndpointEvent = eventType.IsEndpointEvent(); var participantId = isEndpointEvent ? conference.GetEndpoints().First().Id: conference.GetParticipants().First().Id; request.ParticipantId = participantId.ToString(); _context.Test.ParticipantId = participantId; return(request); }
public async Task should_start_private_consultation_with_endpoint() { var room = RoomType.ConsultationRoom1; var endpointWithDefenceAdvocate = _testConference.GetEndpoints().First(x => !string.IsNullOrWhiteSpace(x.DefenceAdvocate)); var defenceAdvocate = _testConference.GetParticipants().First(x => x.Username.Equals(endpointWithDefenceAdvocate.DefenceAdvocate, StringComparison.CurrentCultureIgnoreCase)); endpointWithDefenceAdvocate.UpdateCurrentRoom(RoomType.WaitingRoom); defenceAdvocate.UpdateCurrentRoom(RoomType.WaitingRoom); await _kinlyPlatformService.StartEndpointPrivateConsultationAsync(_testConference, endpointWithDefenceAdvocate, defenceAdvocate); _kinlyApiClientMock.Verify(x => x.TransferParticipantAsync(_testConference.Id.ToString(), It.Is <TransferParticipantParams>(r => r.Part_id == endpointWithDefenceAdvocate.Id.ToString() && r.From == endpointWithDefenceAdvocate.GetCurrentRoom().ToString() && r.To == room.ToString()) ) , Times.Once); _kinlyApiClientMock.Verify(x => x.TransferParticipantAsync(_testConference.Id.ToString(), It.Is <TransferParticipantParams>(r => r.Part_id == defenceAdvocate.Id.ToString() && r.From == endpointWithDefenceAdvocate.GetCurrentRoom().ToString() && r.To == room.ToString()) ) , Times.Once); }
public async Task StopPrivateConsultationAsync(Conference conference, RoomType consultationRoom) { var participants = conference.GetParticipants() .Where(x => x.GetCurrentStatus().ParticipantState == ParticipantState.InConsultation && x.GetCurrentRoom() == consultationRoom); foreach (var participant in participants) { await TransferParticipantAsync(conference.Id, participant.Id, consultationRoom, RoomType.WaitingRoom); } var endpoints = conference.GetEndpoints() .Where(x => x.State == EndpointState.InConsultation && x.GetCurrentRoom() == consultationRoom); foreach (var endpoint in endpoints) { await TransferParticipantAsync(conference.Id, endpoint.Id, consultationRoom, RoomType.WaitingRoom); } }
private void AssertConference(Conference actual, Conference expected, bool ignoreParticipants = false) { actual.Should().NotBeNull(); actual.CaseType.Should().Be(expected.CaseType); actual.CaseNumber.Should().Be(expected.CaseNumber); actual.ScheduledDuration.Should().Be(expected.ScheduledDuration); actual.ScheduledDateTime.Should().Be(expected.ScheduledDateTime); actual.HearingRefId.Should().Be(expected.HearingRefId); if (ignoreParticipants) { return; } var participants = actual.GetParticipants(); participants.Should().NotBeNullOrEmpty(); foreach (var participant in participants) { participant.Name.Should().NotBeNullOrEmpty(); participant.Username.Should().NotBeNullOrEmpty(); participant.DisplayName.Should().NotBeNullOrEmpty(); participant.ParticipantRefId.Should().NotBeEmpty(); participant.UserRole.Should().NotBe(UserRole.None); participant.CaseTypeGroup.Should().NotBeNullOrEmpty(); } var endpoints = actual.GetEndpoints(); endpoints.Should().NotBeNullOrEmpty(); foreach (var endpoint in endpoints) { endpoint.DisplayName.Should().NotBeNullOrEmpty(); endpoint.Pin.Should().NotBeNullOrEmpty(); endpoint.SipAddress.Should().NotBeNullOrEmpty(); endpoint.DefenceAdvocate.Should().NotBeEmpty(); } }