Sfoglia il codice sorgente

修改话机业务逻辑

Dun.Jason 2 anni fa
parent
commit
457062b190

+ 12 - 3
src/CallCenter.Api/Controllers/CallController.cs

@@ -106,15 +106,24 @@ namespace CallCenter.Api.Controllers
                 outCallDto.Direction = item.CallDirection;
                 outCallDto.Cpn = item.FromNo??"";
                 outCallDto.Cdpn = item.ToNo ?? "";
-                outCallDto.Answered = item.CallDetails?.FirstOrDefault(x => x.EventName == "ANSWERED")?.AnswerNo ?? "";
+                if (outCallDto.Direction == ECallDirection.In)
+                {
+                    outCallDto.Answered = item.CallDetails?.FirstOrDefault(x => x.EventName == "ANSWER")?.AnswerNo ?? "";
+                    outCallDto.OnTime = item.CallDetails?.FirstOrDefault(x => x.EventName == "ANSWER")?.CreationTime;
+                    outCallDto.OnState = item.CallDetails?.Any(x => x.EventName == "ANSWER") ==true ? EOnState.On : EOnState.NoOn;
+                }
+                else
+                {
+                    outCallDto.Answered = item.CallDetails?.FirstOrDefault(x => x.EventName == "ANSWERED")?.AnswerNo ?? "";
+                    outCallDto.OnTime = item.CallDetails?.FirstOrDefault(x => x.EventName == "ANSWERED")?.CreationTime;//TODO 接通时间是否可以为空
+                    outCallDto.OnState = item.CallDetails?.Any(x => x.EventName == "ANSWERED") == true ? EOnState.On : EOnState.NoOn;
+                }
                 outCallDto.BeginTime = item.CreationTime;
-                outCallDto.OnTime = item.CallDetails?.FirstOrDefault(x => x.EventName == "ANSWERED")?.CreationTime;//TODO 接通时间是否可以为空
                 outCallDto.ByeTime = item.CallDetails?.FirstOrDefault(x => x.EventName == "BYE")?.CreationTime;
                 outCallDto.TalkTime = item.Duration;
                 outCallDto.SoundFileName = item.CallDetails?.FirstOrDefault(x => x.EventName == "BYE")?.Recording ?? "";
                 outCallDto.EvaluateResult = "";
                 outCallDto.EndBy = item.EndBy;
-                outCallDto.OnState = item.CallDetails?.Any(x => x.EventName == "ANSWERED")==true? EOnState.On : EOnState.NoOn;
                 outCallList.Add(outCallDto);
             }
             return outCallList;

+ 0 - 1
src/CallCenter.Api/Controllers/ReportController.cs

@@ -1,5 +1,4 @@
 using CallCenter.Devices;
-using MediatR;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;
 

+ 1 - 1
src/CallCenter.Api/StartupExtensions.cs

@@ -35,7 +35,7 @@ internal static class StartupExtensions
         services.AddHttpContextAccessor();
 
 #if DEBUG
-        builder.WebHost.UseUrls("http://192.168.100.62:50001", "http://localhost:50001");
+        builder.WebHost.UseUrls("http://192.168.100.36:50001", "http://localhost:50001");
 #endif
 
         services.Configure<DeviceConfigs>(d => configuration.GetSection("DeviceConfigs").Bind(d));

+ 4 - 3
src/CallCenter.Application/Handlers/Transient/TransientOuterNotificationHandler.cs

@@ -22,7 +22,8 @@ namespace CallCenter.Application.Handlers
         {
             if (!string.IsNullOrEmpty(notification.Outer.Id))
             {
-                var workModel = _userCacheManager.GetWorkByTel(notification.Outer.From);
+                string telNo = notification.Outer.From != "" ? notification.Outer.From : notification.TelNo;
+                var workModel = _userCacheManager.GetWorkByTel(telNo);
                 var isp = PhoneIspTool.GetPhoneIsp(notification.Outer.To);
                 var callModel = new Call()
                 {
@@ -30,7 +31,7 @@ namespace CallCenter.Application.Handlers
                     CallDirection = ECallDirection.Out,
                     CallType = ECallType.ExtToOuter,
                     ConversationId = notification.Outer.Id,
-                    FromNo = notification.Outer.From,
+                    FromNo = telNo,
                     ToNo = notification.Outer.To,
                     Trunk = notification.Outer.Trunk,
                     UserId = workModel.UserId,
@@ -47,7 +48,7 @@ namespace CallCenter.Application.Handlers
                     ConversationId = notification.Outer.Id,
                     OMCallId = notification.Outer.CallId,
                     EventName =  "ExtOuterReady", //去电
-                    FromNo = notification.Outer.From,
+                    FromNo = telNo,
                     ToNo = notification.Outer.To,
                 };
                 await _callDetailRepository.AddAsync(detail, cancellationToken);