|
@@ -322,9 +322,17 @@ namespace CallCenter.Api.Controllers
|
|
|
var toWork = _userCacheManager.GetWorkByTel(dto.TelNo);
|
|
|
if (toWork is null)
|
|
|
throw new UserFriendlyException("转接分机未进行工作");
|
|
|
- var tel = await _deviceManager.QueryTelAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
- if (tel.TelStatus != Share.Enums.ETelStatus.Ready)
|
|
|
+
|
|
|
+
|
|
|
+ var telState = await _deviceManager.QueryTelState(dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ if (telState != Share.Enums.ETelStatus.Ready)
|
|
|
throw new UserFriendlyException("被叫分机不在线或正在通话中");
|
|
|
+
|
|
|
+ bool isRest = await _telRepository.IsRestingAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ if (isRest)
|
|
|
+ throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
+
|
|
|
+
|
|
|
await _deviceManager.ExtToExtAsync(work.TelNo, dto.TelNo, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
@@ -358,10 +366,15 @@ namespace CallCenter.Api.Controllers
|
|
|
if (toWork is null)
|
|
|
throw new UserFriendlyException("转接分机未进行工作");
|
|
|
|
|
|
- var totel = await _deviceManager.QueryTelAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
- if (totel.TelStatus != Share.Enums.ETelStatus.Ready)
|
|
|
+ var telState = await _deviceManager.QueryTelState(dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ if (telState != Share.Enums.ETelStatus.Ready)
|
|
|
throw new UserFriendlyException("被叫分机不在线或正在通话中");
|
|
|
|
|
|
+
|
|
|
+ bool isRest = await _telRepository.IsRestingAsync(dto.TelNo,HttpContext.RequestAborted);
|
|
|
+ if (isRest)
|
|
|
+ throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
+
|
|
|
var tel = await _deviceManager.QueryTelAsync(work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
await _deviceManager.VisitorToExtAsync(tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|
|
@@ -442,10 +455,14 @@ namespace CallCenter.Api.Controllers
|
|
|
if (toWork is null)
|
|
|
throw new UserFriendlyException("转接分机未进行工作");
|
|
|
|
|
|
- var totel = await _deviceManager.QueryTelAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
- if (totel.TelStatus != Share.Enums.ETelStatus.Ready)
|
|
|
+ var telState = await _deviceManager.QueryTelState(dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ if (telState != Share.Enums.ETelStatus.Ready)
|
|
|
throw new UserFriendlyException("被叫分机不在线或正在通话中");
|
|
|
|
|
|
+ bool isRest = await _telRepository.IsRestingAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
+ if (isRest)
|
|
|
+ throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
+
|
|
|
var tel = await _deviceManager.QueryTelAsync(work.TelNo, HttpContext.RequestAborted);
|
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
|
await _deviceManager.OuterToExtAsync(tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|