|
@@ -318,9 +318,16 @@ namespace Hotline.Api.Controllers
|
|
var toWork = _userCacheManager.GetWorkByTel(dto.TelNo);
|
|
var toWork = _userCacheManager.GetWorkByTel(dto.TelNo);
|
|
if (toWork is null)
|
|
if (toWork is null)
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
- var tel = await _deviceManager.QueryTelAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
|
- if (tel.TelStatus != ETelStatus.Ready)
|
|
|
|
|
|
+
|
|
|
|
+ //判断分机状态
|
|
|
|
+ var telState =await _deviceManager.QueryTelState(dto.TelNo,HttpContext.RequestAborted);
|
|
|
|
+ if (telState != ETelStatus.Ready)
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
|
|
+
|
|
|
|
+ bool isRest = await _telRepository.IsRestingAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
|
+ if (isRest)
|
|
|
|
+ throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
|
+
|
|
await _deviceManager.ExtToExtAsync(work.TelNo, dto.TelNo, HttpContext.RequestAborted);
|
|
await _deviceManager.ExtToExtAsync(work.TelNo, dto.TelNo, HttpContext.RequestAborted);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -372,10 +379,15 @@ namespace Hotline.Api.Controllers
|
|
if (toWork is null)
|
|
if (toWork is null)
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
|
|
|
|
- var totel = await _deviceManager.QueryTelAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
|
- if (totel.TelStatus != ETelStatus.Ready)
|
|
|
|
|
|
+ var totelState = await _deviceManager.QueryTelState(dto.TelNo, HttpContext.RequestAborted);
|
|
|
|
+ if (totelState != ETelStatus.Ready)
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
|
|
|
|
|
|
+ bool isRest = await _telRepository.IsRestingAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
|
+ if (isRest)
|
|
|
|
+ throw new UserFriendlyException("被叫分机正在休息不能转接");
|
|
|
|
+
|
|
|
|
+
|
|
var tel = await _deviceManager.QueryTelAsync(work.TelNo, HttpContext.RequestAborted);
|
|
var tel = await _deviceManager.QueryTelAsync(work.TelNo, HttpContext.RequestAborted);
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
if (!string.IsNullOrEmpty(tel.ConversationId))
|
|
await _deviceManager.VisitorToExtAsync(tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|
|
await _deviceManager.VisitorToExtAsync(tel.ConversationId, dto.TelNo, HttpContext.RequestAborted);
|
|
@@ -459,8 +471,8 @@ namespace Hotline.Api.Controllers
|
|
if (toWork is null)
|
|
if (toWork is null)
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
throw UserFriendlyException.SameMessage("转接分机未进行工作");
|
|
|
|
|
|
- var totel = await _deviceManager.QueryTelAsync(dto.TelNo, HttpContext.RequestAborted);
|
|
|
|
- if (totel.TelStatus != ETelStatus.Ready)
|
|
|
|
|
|
+ var totelState = await _deviceManager.QueryTelState(dto.TelNo, HttpContext.RequestAborted);
|
|
|
|
+ if (totelState != ETelStatus.Ready)
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
throw UserFriendlyException.SameMessage("被叫分机不在线或正在通话中");
|
|
|
|
|
|
var tel = await _deviceManager.QueryTelAsync(work.TelNo, HttpContext.RequestAborted);
|
|
var tel = await _deviceManager.QueryTelAsync(work.TelNo, HttpContext.RequestAborted);
|