|
@@ -14,6 +14,9 @@ using CallCenter.Settings;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using NewRock.Sdk.Transfer.Queue.Request;
|
|
|
using CallCenter.Realtimes;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using NewRock.Sdk.Control.Request;
|
|
|
+using NewRock.Sdk.Control.Response;
|
|
|
|
|
|
namespace CallCenter.Application.Handlers
|
|
|
{
|
|
@@ -26,6 +29,7 @@ namespace CallCenter.Application.Handlers
|
|
|
private readonly IIvrCacheManager _ivrCacheManager;
|
|
|
private readonly INewRockClient _newRockClient;
|
|
|
private readonly IOptionsSnapshot<DeviceConfigs> _options;
|
|
|
+ private readonly IOptionsSnapshot<QueueVoiceConfig> _queueVoiceConfig;
|
|
|
private readonly ILogger<IncomingNotificationHandler> _logger;
|
|
|
private readonly ICallCacheManager _callCacheManager;
|
|
|
private readonly IIvrDomainService _ivrDomainService;
|
|
@@ -36,7 +40,7 @@ namespace CallCenter.Application.Handlers
|
|
|
ICallRepository callRepository, ICallDetailRepository callDetailRepository,
|
|
|
ISystemSettingCacheManager systemSettingCacheManager, IIvrCacheManager ivrCacheManager,
|
|
|
INewRockClient newRockClient, IOptionsSnapshot<DeviceConfigs> options,
|
|
|
- ILogger<IncomingNotificationHandler> logger, ICallCacheManager callCacheManager,
|
|
|
+ IOptionsSnapshot<QueueVoiceConfig> queueVoiceConfig,ILogger<IncomingNotificationHandler> logger, ICallCacheManager callCacheManager,
|
|
|
IIvrDomainService ivrDomainService,IRealtimeService realtimeService)
|
|
|
{
|
|
|
_callRepository = callRepository;
|
|
@@ -108,7 +112,7 @@ namespace CallCenter.Application.Handlers
|
|
|
Attribute = "Connect",
|
|
|
Menu = new VisitorToMenuMenu() { Id = ivr.No },
|
|
|
Visitor = new VisitorToMenuVisitor() { Id = notification.Visitor.Id }
|
|
|
- },
|
|
|
+ },
|
|
|
_options.Value.ReceiveKey, _options.Value.Expired, cancellationToken);
|
|
|
model.InIvrTime = DateTime.Now;
|
|
|
await _callRepository.UpdateAsync(model, cancellationToken);
|
|
@@ -121,13 +125,22 @@ namespace CallCenter.Application.Handlers
|
|
|
Attribute = "Queue",
|
|
|
Visitor = new VisitorToGroupQueueVisitor() { Id = notification.Visitor.Id },
|
|
|
Group = new VisitorToGroupQueueGroup() { Id = correct.ReturnValue }
|
|
|
- },
|
|
|
+ },
|
|
|
_options.Value.ReceiveKey, _options.Value.Expired, cancellationToken);
|
|
|
model.InGroupTime = DateTime.Now;
|
|
|
await _callRepository.UpdateAsync(model, cancellationToken);
|
|
|
//处理队列记录 TODO
|
|
|
- _callCacheManager.AddCallCache(model);
|
|
|
+ _callCacheManager.AddCallCache(model,correct.ReturnValue);
|
|
|
await _realtimeService.CallQueueAsync(_callCacheManager.GetCallQueueList(), cancellationToken);
|
|
|
+
|
|
|
+ // TODO插播排队语音
|
|
|
+ //var groupResult = await _newRockClient.QueryExtGroup(new QueryExtGroupRequest() { Attribute = "Query", Group = new QueryExtGroup() { Id = correct.ReturnValue } }, _options.Value.ReceiveKey, _options.Value.Expired, cancellationToken);
|
|
|
+ //if (groupResult.Group[0].Visitor.Count > 0)
|
|
|
+ //{
|
|
|
+ // string voiceStr = _queueVoiceConfig.Value.QueueVoice;
|
|
|
+ // voiceStr = String.Format(voiceStr, groupResult.Group[0].Visitor.Count, groupResult.Group[0].Visitor.Count);
|
|
|
+ // await _newRockClient.VoiceNewsFlash(new VoiceNewsFlashRequest() { Attribute = "Connect", Visitor = new VoiceNewsFlashVisitor() { Id = model.ConversationId }, VoiceFile = voiceStr }, _options.Value.ReceiveKey, _options.Value.Expired, cancellationToken);
|
|
|
+ //}
|
|
|
break;
|
|
|
default:
|
|
|
break;
|