dss 2 年 前
コミット
76b7b8e40f

+ 11 - 0
src/CallCenter.Api/Controllers/TestController.cs

@@ -130,6 +130,17 @@ namespace CallCenter.Api.Controllers
             await _realtimeService.ByeAsync(_sessionContext.RequiredUserId, new ByeDto() { Id = "123" }, HttpContext.RequestAborted);
         }
 
+        /// <summary>
+        /// signalR测试(method:CallQueue)
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("callqueue")]
+        public async Task CallQueueTest()
+        {
+            await _realtimeService.CallQueueAsync(HttpContext.RequestAborted);
+        }
+
+
 
         [HttpGet("t2")]
         public async Task GetVoiceEndAnswerAsyncTest()

+ 2 - 1
src/CallCenter.Api/Realtimes/RealtimeService.cs

@@ -11,6 +11,7 @@ namespace CallCenter.Api.Realtimes
         private readonly IHubContext<CallCenterHub> _hubContext;
         private readonly IUserCacheManager _userCacheManager;
 
+
         public RealtimeService(IHubContext<CallCenterHub> hubContext,IUserCacheManager userCacheManager)
         {
             _hubContext= hubContext;
@@ -77,7 +78,7 @@ namespace CallCenter.Api.Realtimes
             var works = _userCacheManager.GetWorks();
             if (works!=null)
             {
-                await _hubContext.Clients.Clients(works.Select(x => x.SignalRId).ToList()).SendAsync(RealtimeMethods.CallQueue, 1, cancellationToken);
+                await _hubContext.Clients.Clients(works.Where(x=>x.SignalRId!=null && x.SignalRId!="").Select(x => x.SignalRId).ToList()).SendAsync(RealtimeMethods.CallQueue, 1, cancellationToken);
             }
         }
     }

+ 0 - 2
src/CallCenter.Application/Handlers/FlowControl/ByeVisitorAndExtNotificationHandler.cs

@@ -62,8 +62,6 @@ namespace CallCenter.Application.Handlers
                         await _realtimeService.ByeAsync(workModel.UserId, new ByeDto() { Id = model.Id }, cancellationToken);
                     }
                 }
-
-                
             }
         }
     }