private async Task <Result <CallRecordInfoDto> > GetParticipantRecordInfo(
            List <CallTimeInfoClientDto> participantCalls,
            AudioRecordClientDto participantRecord,
            AudioRecordClientDto fullRecord)
        {
            var participantCallInfo = participantCalls.FirstOrDefault(x => x.CallId == participantRecord.CallId);

            if (participantCallInfo == null)
            {
                _logger.Warning($"GenerateParticipantsList. Participant call not found. CallId: {participantRecord.CallId}");
                return(Result.Failure <CallRecordInfoDto>(ErrorCodes.UnableToGetAudioRecords));
            }

            var participant = await GetParticipant(participantCallInfo.ParticipantId.Value);

            var participantInfo = ParticipantInfoCreator.GetParticipantInfoDto(participant);

            FillParticipantTimeStamps(participantInfo, participantRecord, fullRecord);

            var participantRecordInfo = new CallRecordInfoDto
            {
                Id = participantRecord.Id,
                ParticipantInfo = participantInfo,
                IsEmercoreUser  = participant is User,
                CallId          = participantCallInfo.CallId,
                IsFullRecord    = false
            };

            return(Result.Success(participantRecordInfo));
        }
示例#2
0
        /// <summary>
        /// Получить линии по caseFolderId
        /// </summary>
        /// <param name="caseFolderId"></param>
        /// <returns></returns>
        public async Task <Result <List <LineByCaseFolderViewDto> > > GetLinesByCaseFolderId(Guid caseFolderId)
        {
            var getLinesByCaseFolderIdResult = await _callManagementServiceClient.GetLinesByCaseFolderId(caseFolderId);

            if (getLinesByCaseFolderIdResult.IsFailure)
            {
                _logger.Warning(getLinesByCaseFolderIdResult.ErrorMessage);
                return(Result.Failure <List <LineByCaseFolderViewDto> >(ErrorCodes.UnableToGetLines));
            }

            using (_unitOfWork.Begin())
            {
                var lineDtos = getLinesByCaseFolderIdResult.Value.Select(x => _mapper.Map <LineByCaseFolderDto>(x)).ToList();

                var linesByCaseFolderView = new List <LineByCaseFolderViewDto>();

                foreach (var lineDto in lineDtos)
                {
                    var lineByCaseFolder = new LineByCaseFolderViewDto
                    {
                        Id             = lineDto.Id,
                        CaseFolderId   = lineDto.CaseFolderId,
                        CreateDateTime = lineDto.CreateDateTime,
                        FirstCallType  = lineDto.FirstCallType
                    };

                    var caller = await GetParticipant(lineDto.CallerId);

                    lineByCaseFolder.CallInitiator  = ParticipantInfoCreator.GetParticipantInfoDto(caller);
                    lineByCaseFolder.IsEmercoreUser = caller is User;

                    linesByCaseFolderView.Add(lineByCaseFolder);
                }

                return(Result.Success(linesByCaseFolderView));
            }
        }