public CreateConsultationRoomCommand(Guid conferenceId, string label, VirtualCourtRoomType type, bool locked) { ConferenceId = conferenceId; Label = label; Type = type; Locked = locked; }
private async Task <long> CreateInterpreterRoom(Guid conferenceId, VirtualCourtRoomType type) { var createRoomCommand = new CreateParticipantRoomCommand(conferenceId, type); await _commandHandler.Handle(createRoomCommand); return(createRoomCommand.NewRoomId); }
protected Room(Guid conferenceId, string label, VirtualCourtRoomType type, bool locked) { ConferenceId = conferenceId; Label = label; Type = type; Status = RoomStatus.Live; RoomParticipants = new List <RoomParticipant>(); RoomEndpoints = new List <RoomEndpoint>(); Locked = locked; }
private async Task <ParticipantRoom> CreateAVmrAndRoom(Conference conference, int existingRooms, VirtualCourtRoomType roomType, KinlyRoomType kinlyRoomType) { _logger.LogInformation("Creating a new interpreter room for conference {Conference}", conference.Id); var roomId = await CreateInterpreterRoom(conference.Id, roomType); var ingestUrl = roomType == VirtualCourtRoomType.JudicialShared? null : $"{conference.IngestUrl}/{roomId}"; var vmr = await CreateVmr(conference, roomId, ingestUrl, roomType, existingRooms, kinlyRoomType); await UpdateRoomConnectionDetails(conference, roomId, vmr, ingestUrl); _logger.LogDebug("Updated room {Room} for conference {Conference} with joining details", roomId, conference.Id); return(await GetUpdatedRoom(conference, roomId)); }
private ParticipantRoom GetInterpreterRoomForParticipant(Guid conferenceId, IReadOnlyCollection <ParticipantRoom> rooms, Participant participant, VirtualCourtRoomType roomType) { _logger.LogInformation( "Checking for an existing interpreter room for participant {Participant} in conference {Conference}", participant.Id, conferenceId); var participantIds = participant.LinkedParticipants.Select(lp => lp.LinkedId).ToList(); participantIds.Add(participant.Id); var matchingRooms = participantIds .Select(l => rooms.SingleOrDefault(r => r.DoesParticipantExist(new RoomParticipant(l)))) .Where(m => m?.Type == roomType) .ToList(); var existingRoom = matchingRooms.FirstOrDefault(); return(existingRoom ?? rooms.FirstOrDefault(x => x.Type == roomType && !x.RoomParticipants.Any())); }
private Task <BookedParticipantRoomResponse> CreateVmr(Conference conference, long roomId, string ingestUrl, VirtualCourtRoomType roomType, int existingRooms, KinlyRoomType kinlyRoomType) { var ingest = kinlyRoomType == KinlyRoomType.Panel_Member ? string.Empty : ingestUrl; var kinlyParticipantType = roomType == VirtualCourtRoomType.Witness ? "Witness" : "Civilian"; var roomPrefix = kinlyRoomType == KinlyRoomType.Panel_Member ? PanelMemberRoomPrefix : InterpreterRoomPrefix; var newRoomParams = new CreateParticipantRoomParams { Audio_recording_url = ingest, Participant_room_id = roomId.ToString(), Participant_type = kinlyParticipantType, Room_label_prefix = roomPrefix, Room_type = kinlyRoomType, Display_name = $"{roomPrefix}{existingRooms + 1}" }; return(_kinlyApiClient.CreateParticipantRoomAsync(conference.Id.ToString(), newRoomParams)); }
private async Task <ParticipantRoom> GetOrCreateInterpreterRoom(Conference conference, Participant participant, VirtualCourtRoomType type) { var conferenceId = conference.Id; var interpreterRooms = await RetrieveAllInterpreterRooms(conferenceId); var interpreterRoom = GetInterpreterRoomForParticipant(conferenceId, interpreterRooms, participant, type); if (interpreterRoom != null) { return(interpreterRoom); } var count = interpreterRooms .Select(x => int.TryParse(x.Label.Replace(InterpreterRoomPrefix, string.Empty), out var n) ? n : 0) .DefaultIfEmpty() .Max(); interpreterRoom = await CreateAVmrAndRoom(conference, count, type, KinlyRoomType.Interpreter); return(interpreterRoom); }
public GetAvailableConsultationRoomsByRoomTypeQuery(VirtualCourtRoomType courtRoomType, Guid conferenceId) { CourtRoomType = courtRoomType; ConferenceId = conferenceId; }
public async Task <ConsultationRoom> GetAvailableConsultationRoomAsync(Guid conferenceId, VirtualCourtRoomType roomType) { var query = new GetAvailableConsultationRoomsByRoomTypeQuery(roomType, conferenceId); var listOfRooms = await _queryHandler.Handle <GetAvailableConsultationRoomsByRoomTypeQuery, List <ConsultationRoom> >(query); var room = listOfRooms?.FirstOrDefault(x => x.Type.Equals(roomType)); if (room == null) { var consultationRoomParams = new CreateConsultationRoomParams { Room_label_prefix = roomType.ToString() }; var createConsultationRoomResponse = await CreateConsultationRoomAsync(conferenceId.ToString(), consultationRoomParams); var createRoomCommand = new CreateConsultationRoomCommand(conferenceId, createConsultationRoomResponse.Room_label, roomType, false); await _commandHandler.Handle(createRoomCommand); room = new ConsultationRoom(conferenceId, createConsultationRoomResponse.Room_label, roomType, false); } return(room); }
public async Task <ConsultationRoom> CreateNewConsultationRoomAsync(Guid conferenceId, VirtualCourtRoomType roomType = VirtualCourtRoomType.Participant, bool locked = false) { var consultationRoomParams = new CreateConsultationRoomParams { Room_label_prefix = roomType.ToString() }; var createConsultationRoomResponse = await CreateConsultationRoomAsync(conferenceId.ToString(), consultationRoomParams); var createRoomCommand = new CreateConsultationRoomCommand(conferenceId, createConsultationRoomResponse.Room_label, roomType, locked); await _commandHandler.Handle(createRoomCommand); var room = new ConsultationRoom(conferenceId, createConsultationRoomResponse.Room_label, roomType, locked); return(room); }
public CreateParticipantRoomCommand(Guid conferenceId, VirtualCourtRoomType type) { ConferenceId = conferenceId; Type = type; }
protected Room(Guid conferenceId, VirtualCourtRoomType type, bool locked) : this(conferenceId, null, type, locked) { }
public ConsultationRoom(Guid conferenceId, string label, VirtualCourtRoomType type, bool locked) : base( conferenceId, label, type, locked) { }
public ConsultationRoom(Guid conferenceId, VirtualCourtRoomType type, bool locked) : this(conferenceId, null, type, locked) { }
private Task <ParticipantRoom> CreateRoom(Conference conference, Participant participant, VirtualCourtRoomType type, string label, string joinUri) { var ids = participant.LinkedParticipants.Select(x => x.Id).ToList(); ids.Add(participant.Id); foreach (var(key, value) in _rooms) { var roomParticipantIds = value.Select(x => x.Id); if (!roomParticipantIds.Any(rpid => ids.Contains(rpid))) { continue; } _rooms[key].Add(participant); return(Task.FromResult(key)); } var ingest = $"{conference.IngestUrl}/{_roomCount}"; var node = "sip.node.com"; var room = new ParticipantRoom(Guid.NewGuid(), type); room.UpdateConnectionDetails(label, ingest, node, joinUri); _roomCount++; _rooms.Add(room, new List <Participant> { participant }); return(Task.FromResult(room)); }
public Task <ConsultationRoom> CreateNewConsultationRoomAsync(Guid conferenceId, VirtualCourtRoomType roomType = VirtualCourtRoomType.Participant, bool locked = false) { var room = new ConsultationRoom(Guid.NewGuid(), "Label", roomType, locked); return(Task.FromResult(room)); }
public Task <ConsultationRoom> GetAvailableConsultationRoomAsync(Guid conferenceId, VirtualCourtRoomType roomType) { var room = new ConsultationRoom(Guid.NewGuid(), "Judge", VirtualCourtRoomType.JudgeJOH, false); return(Task.FromResult(room)); }
private async Task <SharedParticipantRoomResponse> GetVmr(Conference conference, Participant participant, VirtualCourtRoomType roomType) { ParticipantRoom participantRoom; switch (roomType) { case VirtualCourtRoomType.Witness: participantRoom = await _roomService.GetOrCreateAWitnessVirtualRoom(conference, participant); break; case VirtualCourtRoomType.JudicialShared: participantRoom = await _roomService.GetOrCreateAJudicialVirtualRoom(conference, participant); break; default: participantRoom = await _roomService.GetOrCreateAnInterpreterVirtualRoom(conference, participant); break; } _logger.LogDebug( "Returning participant room {Room} for participant {Participant} in conference {Conference}", participantRoom.Id, participant.Id, conference.Id); return(SharedParticipantRoomResponseMapper.MapRoomToResponse(participantRoom)); }
public ParticipantRoom(Guid conferenceId, VirtualCourtRoomType type) : base(conferenceId, type, false) { }