Jason 1 年之前
父節點
當前提交
2d7c1baf1b

+ 2 - 1
src/CallCenter.Api/appsettings.json

@@ -323,7 +323,8 @@
     "IsDown": false
   },
   "SendCallRecord": {
-    "FwUrl": "http://192.168.100.195:8066/api/call/insertcalls"
+    "FwUrl": "http://192.168.100.195:8066/api/call/insertcalls",
+    "NotReceivedUrl": "http://192.168.100.195:8066/api/call/insertringnotanswered"
   },
   "IdentityConfiguration": {
     "Password": {

+ 1 - 1
src/CallCenter.Application/Handlers/CallState/DtmfNotificationHandler.cs

@@ -36,7 +36,7 @@ namespace CallCenter.Application.Handlers
             string info = string.Empty;
             var model = await _callRepository.GetAsync(
                 x => x.ConversationId == notification.Visitor.Id && x.FromNo == notification.Visitor.From &&
-                     x.ToNo == notification.Visitor.To, cancellationToken);
+                     x.CreationTime >= DateTime.Now.AddHours(-2), cancellationToken);
             if (model == null)
             {
                 model = await _callRepository.GetAsync(

+ 19 - 8
src/CallCenter.Application/Handlers/FlowControl/CdrNotificationHandler.cs

@@ -66,7 +66,7 @@ namespace CallCenter.Application.Handlers
             else
             {
                 var callDetail = await
-               _callDetailRepository.GetAsync(x => x.OMCallId == notification.CallId, true, x => x.CreationTime, cancellationToken);
+               _callDetailRepository.GetAsync(x => x.OMCallId == notification.CallId && x.CreationTime >= DateTime.Now.AddHours(-2), true, x => x.CreationTime, cancellationToken);
 
                 if (callDetail != null)
                 {
@@ -178,25 +178,35 @@ namespace CallCenter.Application.Handlers
                             }
                             catch (Exception ex)
                             {
-                                throw new UserFriendlyException(ex.Message);
+                                _logger.LogInformation("推送通话报告失败:" + ex.Message);
+                                //throw new UserFriendlyException(ex.Message);
                             }
                             #endregion
 
                             #region 推送超时未接记录报告
                             //准备报告
                             //查询是否有15秒未接
-                             var ringList = call.CallDetails?.Where(x => x.CallStatus == ECallStatus.Ring).ToList();
+                            var CallDetails = call.CallDetails;
+
+                             var ringList = CallDetails?.Where(x => x.CallStatus == ECallStatus.Ring).ToList();
                             //多个振铃,包括转接(需要验证转接分机)
                             if (ringList!=null && ringList.Count>1)
                             {
                                 List<OutCallNotReceivedDto> NotReceivedList = new List<OutCallNotReceivedDto>();
+
+                                int count = CallDetails?.Count(x => x.CallStatus == ECallStatus.Answer)??0;
+                                if (count>0)
+                                {
+                                    ringList.RemoveRange(ringList.Count-2,count);
+                                }
                                 //验证是否被接过
                                 for (int i = 0; i < ringList.Count; i++)
                                 {
-                                    bool IsReceived = call.CallDetails?.Any(x => x.CallStatus == ECallStatus.Answer && x.AnswerNo == ringList[i].AnswerNo)??false;
+                                    
+                                    //bool IsReceived = CallDetails?.Any(x => x.CallStatus == ECallStatus.Answer && x.AnswerNo == ringList[i].AnswerNo)??false;
                                     //未接听 加入到集合中
-                                    if (!IsReceived)
-                                    {
+                                    //if (!IsReceived)
+                                    //{
                                         var notReceivedEntity = new OutCallNotReceivedDto();
                                         notReceivedEntity.CallId = ringList[i].CallId;
                                         notReceivedEntity.Cpn = ringList[i].FromNo;
@@ -207,7 +217,7 @@ namespace CallCenter.Application.Handlers
                                         var iswork = await _workRepository.AnyAsync(x => x.TelNo == notReceivedEntity.Answered && !x.EndTime.HasValue);
                                         notReceivedEntity.IsWorkRing = iswork;
                                         NotReceivedList.Add(notReceivedEntity);
-                                    }
+                                    //}
                                 }
                                 if (NotReceivedList.Count>0)
                                 {
@@ -227,7 +237,8 @@ namespace CallCenter.Application.Handlers
                                     }
                                     catch (Exception ex)
                                     {
-                                        throw new UserFriendlyException(ex.Message);
+                                        _logger.LogInformation("推送未接听报告失败:" + ex.Message);
+                                        //throw new UserFriendlyException(ex.Message);
                                     }
                                 }
 

+ 4 - 3
src/CallCenter.Repository.SqlSugar/SqlSugarStartupExtensions.cs

@@ -120,9 +120,10 @@ namespace CallCenter.Repository.SqlSugar
                             //db.Ado.SqlStackTrace.MyStackTraceList[1].xxx 获取上层方法的信息
 
                             Log.Warning("slow query ==> fileName: {fileName}, fileLine: {fileLine}, FirstMethodName: {FirstMethodName}",
-                                fileName, fileLine, FirstMethodName);
-                            Log.Warning("slow query sql: ", sql);
-                            Log.Warning("slow query params: ", string.Join(',', p.ToList()));
+                        fileName, fileLine, FirstMethodName);
+                            Log.Warning("slow query sql: {sql}", sql);
+                            Log.Warning("slow query params: {params}", string.Join(',', p.Select(d => d.Value)));
+                            Log.Warning("slow query totalSeconds: {sec}", db.Ado.SqlExecutionTime.TotalSeconds);
                         }
                         //相当于EF的 PrintToMiniProfiler
                     };