|
@@ -166,6 +166,49 @@ namespace Hotline.Api.Controllers
|
|
|
return list;// _mapper.Map<IReadOnlyList<TrTelStateDto>>(tels.AgentList);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 查询坐席分机状态及通话信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="telno"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("query-telstate/{telno}")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<TrTelStateDto> TrQueryTelStateByTelNo([FromQuery]string? telno)
|
|
|
+ {
|
|
|
+ var tels = await _trClient.QueryTelStateAsync(new QueryTelStateRequest() { TelNo = telno }, HttpContext.RequestAborted);
|
|
|
+ var tel = tels.AgentList.FirstOrDefault();
|
|
|
+ if (tel != null)
|
|
|
+ {
|
|
|
+ var work = _userCacheManager.GetWorkByTel(tel.TelNo);
|
|
|
+ var result = new TrTelStateDto
|
|
|
+ {
|
|
|
+ Id = tel.Id,
|
|
|
+ TelNo = tel.TelNo,
|
|
|
+ ChannelUUid = tel.ChannelUUid,
|
|
|
+ TelName = tel.TelName,
|
|
|
+ Type = tel.Type,
|
|
|
+ Weight = tel.Weight,
|
|
|
+ Queue = tel.Queue,
|
|
|
+ State = tel.State,
|
|
|
+ OldState = tel.OldState,
|
|
|
+ Device = tel.Device,
|
|
|
+ SipIp = tel.SipIp,
|
|
|
+ PrivateData = tel.PrivateData,
|
|
|
+ SipState = tel.SipState,
|
|
|
+ CreatedAt = tel.CreatedAt,
|
|
|
+ UpdatedAt = tel.UpdatedAt,
|
|
|
+ CallDirection = tel.CallDirection,
|
|
|
+ OtherNumber = tel.OtherNumber,
|
|
|
+ GateWay = tel.GateWay,
|
|
|
+ AnsweredAt = tel.AnsweredAt,
|
|
|
+ WorkUserId = (work != null) ? work.UserId : "",
|
|
|
+ WorkUserName = (work != null) ? work.UserName : "",
|
|
|
+ };
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|