|
@@ -1,7 +1,6 @@
|
|
|
using Hotline.Application.FlowEngine;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
using Hotline.CallCenter.Calls;
|
|
|
-using Hotline.CallCenter.Devices;
|
|
|
using Hotline.CallCenter.Ivrs;
|
|
|
using Hotline.CallCenter.Tels;
|
|
|
using Hotline.Permissions;
|
|
@@ -24,7 +23,9 @@ using XF.Domain.Exceptions;
|
|
|
using XF.Utility.EnumExtensions;
|
|
|
using System.Linq;
|
|
|
using Hotline.CallCenter.Configs;
|
|
|
+using Hotline.CallCenter.Devices;
|
|
|
using Hotline.FlowEngine.WorkflowModules;
|
|
|
+using Hotline.NewRock;
|
|
|
using Hotline.Share.Dtos;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.Extensions.Options;
|
|
@@ -46,7 +47,7 @@ namespace Hotline.Api.Controllers
|
|
|
private readonly ITelGroupRepository _telGroupRepository;
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly IWorkRepository _workRepository;
|
|
|
- private readonly IDeviceManager _deviceManager;
|
|
|
+ private readonly INewRockDeviceManager _newRockDeviceManager;
|
|
|
private readonly IUserCacheManager _userCacheManager;
|
|
|
private readonly ISessionContext _sessionContext;
|
|
|
private readonly ICallRepository _callRepository;
|
|
@@ -66,6 +67,7 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
|
|
|
public PbxController(
|
|
|
+ IServiceProvider serviceProvider,
|
|
|
ITelRepository telRepository,
|
|
|
ITelRestRepository telRestRepository,
|
|
|
ITelDomainService telDomainService,
|
|
@@ -74,7 +76,6 @@ namespace Hotline.Api.Controllers
|
|
|
ITelGroupRepository telGroupRepository,
|
|
|
IMapper mapper,
|
|
|
IWorkRepository workRepository,
|
|
|
- IDeviceManager deviceManager,
|
|
|
IUserCacheManager userCacheManager,
|
|
|
ISessionContext sessionContext,
|
|
|
ICallRepository callRepository,
|
|
@@ -89,6 +90,7 @@ namespace Hotline.Api.Controllers
|
|
|
IRepository<User> userRepository,
|
|
|
IWexClient wexClient,
|
|
|
IWexTelGroupRepository wexTelGroupRepository,
|
|
|
+ IOptionsSnapshot<AppConfiguration> appOptions,
|
|
|
IOptionsSnapshot<CallCenterConfiguration> options,
|
|
|
ISystemDicDataCacheManager systemDicDataCacheManager)
|
|
|
{
|
|
@@ -100,7 +102,6 @@ namespace Hotline.Api.Controllers
|
|
|
_telGroupRepository = telGroupRepository;
|
|
|
_mapper = mapper;
|
|
|
_workRepository = workRepository;
|
|
|
- _deviceManager = deviceManager;
|
|
|
_userCacheManager = userCacheManager;
|
|
|
_sessionContext = sessionContext;
|
|
|
_callRepository = callRepository;
|
|
@@ -117,6 +118,10 @@ namespace Hotline.Api.Controllers
|
|
|
_wexTelGroupRepository = wexTelGroupRepository;
|
|
|
_options = options;
|
|
|
_systemDicDataCacheManager = systemDicDataCacheManager;
|
|
|
+ if (appOptions.Value.GetDefaultAppScopeConfiguration().CallCenterType == AppDefaults.CallCenterType.XunShi)
|
|
|
+ {
|
|
|
+ _newRockDeviceManager = serviceProvider.GetRequiredService<INewRockDeviceManager>();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -201,7 +206,7 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
var works = await _workRepository.QueryAsync(d => dto.TelNos.Contains(d.TelNo) && !d.EndTime.HasValue);
|
|
|
|
|
|
- await _deviceManager.AssginConfigGroupAsync(
|
|
|
+ await _newRockDeviceManager.AssginConfigGroupAsync(
|
|
|
_options.Value.NewRock, dto.No,
|
|
|
dto.Distribution,
|
|
|
ext: works.Select(d => d.TelNo).ToList(),
|
|
@@ -225,7 +230,7 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
var works = await _workRepository.QueryAsync(d => dto.TelNos.Contains(d.TelNo) && !d.EndTime.HasValue);
|
|
|
|
|
|
- await _deviceManager.AssginConfigGroupAsync(
|
|
|
+ await _newRockDeviceManager.AssginConfigGroupAsync(
|
|
|
_options.Value.NewRock, dto.No,
|
|
|
dto.Distribution,
|
|
|
ext: works.Select(d => d.TelNo).ToList(),
|
|
@@ -484,7 +489,7 @@ namespace Hotline.Api.Controllers
|
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
|
|
|
|
//判断分机状态
|
|
|
- var telState = await _deviceManager.QueryTelState(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ var telState = await _newRockDeviceManager.QueryTelState(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
if (telState != ETelStatus.Ready)
|
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
|
|
|
@@ -492,7 +497,7 @@ namespace Hotline.Api.Controllers
|
|
|
if (isRest)
|
|
|
throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
|
|
|
- await _deviceManager.ExtToExtAsync(_options.Value.NewRock, work.TelNo, dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.ExtToExtAsync(_options.Value.NewRock, work.TelNo, dto.TelNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -506,7 +511,7 @@ namespace Hotline.Api.Controllers
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- await _deviceManager.ExtToOuterAsync(_options.Value.NewRock, work.TelNo, dto.OuterNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.ExtToOuterAsync(_options.Value.NewRock, work.TelNo, dto.OuterNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -522,7 +527,7 @@ namespace Hotline.Api.Controllers
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
string newOuter = dto.LineId + "," + dto.OuterNo;
|
|
|
- await _deviceManager.ExtToOuterAsync(_options.Value.NewRock, work.TelNo, newOuter, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.ExtToOuterAsync(_options.Value.NewRock, work.TelNo, newOuter, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -540,7 +545,7 @@ namespace Hotline.Api.Controllers
|
|
|
if (toWork is null)
|
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
|
|
|
|
- var totelState = await _deviceManager.QueryTelState(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ var totelState = await _newRockDeviceManager.QueryTelState(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
if (totelState != ETelStatus.Ready)
|
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
|
|
|
@@ -549,9 +554,9 @@ namespace Hotline.Api.Controllers
|
|
|
throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
|
|
|
|
|
|
- var tel = await _deviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ var tel = await _newRockDeviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
- await _deviceManager.VisitorToExtAsync(_options.Value.NewRock, tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.VisitorToExtAsync(_options.Value.NewRock, tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|
|
|
else
|
|
|
throw UserFriendlyException.SameMessage("当前分机没有通话");
|
|
|
}
|
|
@@ -567,9 +572,9 @@ namespace Hotline.Api.Controllers
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- var tel = await _deviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ var tel = await _newRockDeviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
- await _deviceManager.VisitorToOuterAsync(_options.Value.NewRock, tel.ConversationId, dto.OuterNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.VisitorToOuterAsync(_options.Value.NewRock, tel.ConversationId, dto.OuterNo, HttpContext.RequestAborted);
|
|
|
else
|
|
|
throw UserFriendlyException.SameMessage("当前分机没有通话");
|
|
|
}
|
|
@@ -586,9 +591,9 @@ namespace Hotline.Api.Controllers
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- var tel = await _deviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ var tel = await _newRockDeviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
- await _deviceManager.VisitorToGroupAsync(_options.Value.NewRock, tel.ConversationId, dto.groupid, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.VisitorToGroupAsync(_options.Value.NewRock, tel.ConversationId, dto.groupid, HttpContext.RequestAborted);
|
|
|
else
|
|
|
throw UserFriendlyException.SameMessage("当前分机没有通话");
|
|
|
}
|
|
@@ -605,9 +610,9 @@ namespace Hotline.Api.Controllers
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- var tel = await _deviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ var tel = await _newRockDeviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
- await _deviceManager.OuterToOuterAsync(_options.Value.NewRock, tel.ConversationId, dto.OuterNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.OuterToOuterAsync(_options.Value.NewRock, tel.ConversationId, dto.OuterNo, HttpContext.RequestAborted);
|
|
|
else
|
|
|
throw UserFriendlyException.SameMessage("当前分机没有通话");
|
|
|
}
|
|
@@ -628,7 +633,7 @@ namespace Hotline.Api.Controllers
|
|
|
if (toWork is null)
|
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
|
|
|
|
- var totelState = await _deviceManager.QueryTelState(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ var totelState = await _newRockDeviceManager.QueryTelState(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
if (totelState != ETelStatus.Ready)
|
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
|
|
|
@@ -636,9 +641,9 @@ namespace Hotline.Api.Controllers
|
|
|
if (isRest)
|
|
|
throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
|
|
|
- var tel = await _deviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ var tel = await _newRockDeviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
- await _deviceManager.OuterToExtAsync(_options.Value.NewRock, tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.OuterToExtAsync(_options.Value.NewRock, tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|
|
|
else
|
|
|
throw UserFriendlyException.SameMessage("当前分机没有通话");
|
|
|
}
|
|
@@ -660,9 +665,9 @@ namespace Hotline.Api.Controllers
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- var tel = await _deviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ var tel = await _newRockDeviceManager.QueryTelAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
- await _deviceManager.ConferenceMeetingAsync(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.ConferenceMeetingAsync(_options.Value.NewRock, dto.TelNo, HttpContext.RequestAborted);
|
|
|
else
|
|
|
throw UserFriendlyException.SameMessage("当前分机没有通话");
|
|
|
}
|
|
@@ -678,7 +683,7 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpPost("monitor-ext")]
|
|
|
public async Task MonitorExt([FromBody] MonitorExtRequest request)
|
|
|
{
|
|
|
- await _deviceManager.MonitorExtAsync(_options.Value.NewRock, request.firstTelNo, request.secondTelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.MonitorExtAsync(_options.Value.NewRock, request.firstTelNo, request.secondTelNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -693,7 +698,7 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpPost("monitor-ext-to-talk")]
|
|
|
public async Task MonitorExtToTalk([FromBody] MonitorExtToTalkRequest request)
|
|
|
{
|
|
|
- await _deviceManager.MonitorExtToTalkAsync(_options.Value.NewRock, request.telNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.MonitorExtToTalkAsync(_options.Value.NewRock, request.telNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -708,7 +713,7 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpPost("monitor-ext-to-listen")]
|
|
|
public async Task MonitorExtToListen([FromBody] MonitorExtToListenRequest request)
|
|
|
{
|
|
|
- await _deviceManager.MonitorExtToListenAsync(_options.Value.NewRock, request.telNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.MonitorExtToListenAsync(_options.Value.NewRock, request.telNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -727,7 +732,7 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpPost("bargein-ext")]
|
|
|
public async Task BargeinExt([FromBody] BargeinExtRequest request)
|
|
|
{
|
|
|
- await _deviceManager.BargeinExtAsync(_options.Value.NewRock, request.firstTelNo, request.secondTelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.BargeinExtAsync(_options.Value.NewRock, request.firstTelNo, request.secondTelNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -749,7 +754,7 @@ namespace Hotline.Api.Controllers
|
|
|
//if (call.CallStatus == ECallStatus.Bye)
|
|
|
// throw UserFriendlyException.SameMessage("通话已结束");
|
|
|
|
|
|
- await _deviceManager.ClearExtAsync(_options.Value.NewRock, request.CallId, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.ClearExtAsync(_options.Value.NewRock, request.CallId, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -766,7 +771,7 @@ namespace Hotline.Api.Controllers
|
|
|
throw UserFriendlyException.SameMessage("无效通话,无法挂断");
|
|
|
if (call.CallStatus == ECallStatus.Bye)
|
|
|
throw UserFriendlyException.SameMessage("通话已结束");
|
|
|
- await _deviceManager.ClearVisitorAsync(_options.Value.NewRock, call.ConversationId, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.ClearVisitorAsync(_options.Value.NewRock, call.ConversationId, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -783,7 +788,7 @@ namespace Hotline.Api.Controllers
|
|
|
throw UserFriendlyException.SameMessage("无效通话,无法挂断");
|
|
|
if (call.CallStatus == ECallStatus.Bye)
|
|
|
throw UserFriendlyException.SameMessage("通话已结束");
|
|
|
- await _deviceManager.ClearOuterAsync(_options.Value.NewRock, call.ConversationId, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.ClearOuterAsync(_options.Value.NewRock, call.ConversationId, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -800,7 +805,7 @@ namespace Hotline.Api.Controllers
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- await _deviceManager.MuteAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.MuteAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -813,7 +818,7 @@ namespace Hotline.Api.Controllers
|
|
|
var work = _userCacheManager.GetWorkByUser(_sessionContext.RequiredUserId);
|
|
|
if (work is null)
|
|
|
throw UserFriendlyException.SameMessage("当前坐席暂未进行工作");
|
|
|
- await _deviceManager.UnMuteAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.UnMuteAsync(_options.Value.NewRock, work.TelNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -969,7 +974,7 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
await _callDetailRepository.AddAsync(detail, HttpContext.RequestAborted);
|
|
|
|
|
|
- await _deviceManager.VisitorToMenuAsync(_options.Value.NewRock, call.ConversationId, ivr.No, HttpContext.RequestAborted);
|
|
|
+ await _newRockDeviceManager.VisitorToMenuAsync(_options.Value.NewRock, call.ConversationId, ivr.No, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
|
#endregion
|