Jason 1 yıl önce
ebeveyn
işleme
8e3a48b213

+ 13 - 4
src/CallCenter.Application/Handlers/CallState/RingVisitorToExtNotificationHandler.cs

@@ -4,6 +4,8 @@ using CallCenter.Notifications;
 using CallCenter.Realtimes;
 using CallCenter.Share.Enums;
 using MediatR;
+using Microsoft.Extensions.Logging;
+using System.Text.Json;
 
 namespace CallCenter.Application.Handlers
 {
@@ -13,14 +15,17 @@ namespace CallCenter.Application.Handlers
         private readonly ICallDetailRepository _callDetailRepository;
         private readonly IRealtimeService _realtimeService;
         private readonly IUserCacheManager _userCacheManager;
-        
-        public RingVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IRealtimeService realtimeService, IUserCacheManager userCacheManager)
+        private readonly ICallCacheManager _callCacheManager;
+        private readonly ILogger<RingVisitorToExtNotificationHandler> _logger;
+
+        public RingVisitorToExtNotificationHandler(ICallRepository callRepository, ICallDetailRepository callDetailRepository,IRealtimeService realtimeService, IUserCacheManager userCacheManager, ICallCacheManager callCacheManager, ILogger<RingVisitorToExtNotificationHandler> logger)
         {
             _callRepository = callRepository;
             _callDetailRepository = callDetailRepository;
             _realtimeService = realtimeService;
             _userCacheManager = userCacheManager;
-            
+            _callCacheManager = callCacheManager;
+            _logger = logger;
         }
 
 
@@ -48,7 +53,11 @@ namespace CallCenter.Application.Handlers
                 };
                 await _callDetailRepository.AddAsync(detail, cancellationToken);
 
-               
+
+                //处理排队缓存数据
+                _callCacheManager.RemoveCallCache(model.Id);
+                _logger.LogInformation(JsonSerializer.Serialize(_callCacheManager.GetCallQueueList()));
+                await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
 
                 //调用业务弹屏 通知前端
                 var workModel = _userCacheManager.GetWorkByTel(notification.TelNo);

+ 3 - 3
src/CallCenter.Application/Handlers/FlowControl/AnsweredVisitorToExtNotificationHandler.cs

@@ -54,9 +54,9 @@ namespace CallCenter.Application.Handlers
 
 
                 //处理排队缓存数据 TODO
-                _callCacheManager.RemoveCallCache(model.Id);
-                _logger.LogInformation(JsonSerializer.Serialize(_callCacheManager.GetCallQueueList()));
-                await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
+                //_callCacheManager.RemoveCallCache(model.Id);
+                //_logger.LogInformation(JsonSerializer.Serialize(_callCacheManager.GetCallQueueList()));
+                //await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
 
                 //var callDetail = _callDetailRepository.GetAsync(x => x.CallId == model.Id && x.EventName == "ANSWER" && x.CreationTime >= model.CreationTime);
                 var callDetail = model.CallDetails.Where(x => x.CallId == model.Id && x.EventName == "ANSWER");

+ 1 - 1
src/CallCenter.Application/Handlers/FlowControl/IncomingNotificationHandler.cs

@@ -128,7 +128,7 @@ namespace CallCenter.Application.Handlers
 #endif
                         {
                             int count = _callCacheManager.GetCallQueueListByTrunk(notification.TrunkId);
-                            if (count>=2)
+                            if (count>=1)
                             {
                                 if (!string.IsNullOrEmpty(correct.BusyGroup))
                                 {