Forráskód Böngészése

Merge branch 'test' of http://110.188.24.182:10023/Fengwo/hotline into test

xfe 2 hónapja
szülő
commit
7967fac4ce
28 módosított fájl, 578 hozzáadás és 75 törlés
  1. 16 16
      src/Hotline.Api/Controllers/Bi/BiOrderController.cs
  2. 39 41
      src/Hotline.Api/Controllers/IPPbxController.cs
  3. 32 3
      src/Hotline.Api/Controllers/TestController.cs
  4. 1 0
      src/Hotline.Api/Controllers/WebPortalController.cs
  5. 1 0
      src/Hotline.Api/Hotline.Api.csproj
  6. 2 2
      src/Hotline.Api/StartupExtensions.cs
  7. 5 0
      src/Hotline.Application/CallCenter/DefaultCallApplication.cs
  8. 1 0
      src/Hotline.Application/CallCenter/ICallApplication.cs
  9. 11 0
      src/Hotline.Application/CallCenter/IIPPbxApplication.cs
  10. 62 0
      src/Hotline.Application/CallCenter/IPPbxApplication.cs
  11. 5 0
      src/Hotline.Application/CallCenter/TianRunCallApplication.cs
  12. 0 1
      src/Hotline.Application/Hotline.Application.csproj
  13. 6 0
      src/Hotline.Application/Orders/OrderApplication.cs
  14. 2 0
      src/Hotline.Share/Dtos/CallCenter/BiSeatCallsDto.cs
  15. 1 1
      src/Hotline.Share/Dtos/CallCenter/TelDto.cs
  16. 2 8
      src/Hotline.Share/Dtos/Order/OrderDto.cs
  17. 8 1
      src/Hotline.Share/Dtos/Order/QueryOrderDto.cs
  18. 5 0
      src/Hotline.Share/Dtos/WebPortal/GetOrderCodePwd.cs
  19. 20 0
      src/Hotline.XingTang/CallTelClient.cs
  20. 50 0
      src/Hotline.XingTang/Dto/NotifyDto.cs
  21. 1 0
      src/Hotline.XingTang/Hotline.XingTang.csproj
  22. 12 0
      src/Hotline.XingTang/INotifyService.cs
  23. 32 0
      src/Hotline.XingTang/NotifyService.cs
  24. 19 1
      src/Hotline.XingTang/ServiceCollectionExtensions.cs
  25. 87 0
      src/Hotline/CallCenter/Tels/CallTelDomain/QueryTelRequest.cs
  26. 128 1
      src/Hotline/CallCenter/Tels/CallTelDomain/QueryTelResponse.cs
  27. 8 0
      src/Hotline/CallCenter/Tels/ICallTelClient.cs
  28. 22 0
      src/Tr.Sdk/CallTelClient.cs

+ 16 - 16
src/Hotline.Api/Controllers/Bi/BiOrderController.cs

@@ -2996,14 +2996,14 @@ namespace Hotline.Api.Controllers.Bi
 
             foreach (var item in items)
             {
-                item.ZxAllTimes = Math.Round(((double)item.ZxAllTimes / 3600), 2);
-                item.JyAllTimes = Math.Round(((double)item.JyAllTimes / 3600), 2);
-                item.QzAllTimes = Math.Round(((double)item.QzAllTimes / 3600), 2);
-                item.ByAllTimes = Math.Round(((double)item.ByAllTimes / 3600), 2);
-                item.JbAllTimes = Math.Round(((double)item.JbAllTimes / 3600), 2);
-                item.TsAllTimes = Math.Round(((double)item.TsAllTimes / 3600), 2);
-                item.QtAllTimes = Math.Round(((double)item.QtAllTimes / 3600), 2);
-                item.YjAllTimes = Math.Round(((double)item.YjAllTimes / 3600), 2);
+                item.ZxAllTimes = Math.Round(((double)item.ZxAllTimes / 3600/24), 2);
+                item.JyAllTimes = Math.Round(((double)item.JyAllTimes / 3600 / 24), 2);
+                item.QzAllTimes = Math.Round(((double)item.QzAllTimes / 3600 / 24), 2);
+                item.ByAllTimes = Math.Round(((double)item.ByAllTimes / 3600 / 24), 2);
+                item.JbAllTimes = Math.Round(((double)item.JbAllTimes / 3600 / 24), 2);
+                item.TsAllTimes = Math.Round(((double)item.TsAllTimes / 3600 / 24), 2);
+                item.QtAllTimes = Math.Round(((double)item.QtAllTimes / 3600 / 24), 2);
+                item.YjAllTimes = Math.Round(((double)item.YjAllTimes / 3600 / 24), 2);
             }
 
 
@@ -3069,14 +3069,14 @@ namespace Hotline.Api.Controllers.Bi
             }
             foreach (var item in list)
             {
-                item.ZxAllTimes = Math.Round(((double)item.ZxAllTimes / 3600), 2);
-                item.JyAllTimes = Math.Round(((double)item.JyAllTimes / 3600), 2);
-                item.QzAllTimes = Math.Round(((double)item.QzAllTimes / 3600), 2);
-                item.ByAllTimes = Math.Round(((double)item.ByAllTimes / 3600), 2);
-                item.JbAllTimes = Math.Round(((double)item.JbAllTimes / 3600), 2);
-                item.TsAllTimes = Math.Round(((double)item.TsAllTimes / 3600), 2);
-                item.QtAllTimes = Math.Round(((double)item.QtAllTimes / 3600), 2);
-                item.YjAllTimes = Math.Round(((double)item.YjAllTimes / 3600), 2);
+                item.ZxAllTimes = Math.Round(((double)item.ZxAllTimes / 3600 / 24), 2);
+                item.JyAllTimes = Math.Round(((double)item.JyAllTimes / 3600 / 24), 2);
+                item.QzAllTimes = Math.Round(((double)item.QzAllTimes / 3600 / 24), 2);
+                item.ByAllTimes = Math.Round(((double)item.ByAllTimes / 3600 / 24), 2);
+                item.JbAllTimes = Math.Round(((double)item.JbAllTimes / 3600 / 24), 2);
+                item.TsAllTimes = Math.Round(((double)item.TsAllTimes / 3600 / 24), 2);
+                item.QtAllTimes = Math.Round(((double)item.QtAllTimes / 3600 / 24), 2);
+                item.YjAllTimes = Math.Round(((double)item.YjAllTimes / 3600 / 24), 2);
             }
             //增加合计
             list.Add(new DepartmentAcceptanceTypeStatisticsDto

+ 39 - 41
src/Hotline.Api/Controllers/IPPbxController.cs

@@ -1,4 +1,5 @@
 using DotNetCore.CAP;
+using Hotline.CallCenter.Tels.CallTelDomain;
 using ExtendedNumerics.Exceptions;
 using Hotline.Ai.Quality;
 using Hotline.Application.CallCenter.Calls;
@@ -27,9 +28,6 @@ using Microsoft.Extensions.Options;
 using Newtonsoft.Json;
 using System.Threading;
 using Hotline.EventBus;
-using Tr.Sdk;
-using Tr.Sdk.Blacklist;
-using Tr.Sdk.Tels;
 using XF.Domain.Authentications;
 using XF.Domain.Exceptions;
 using XF.Domain.Filters;
@@ -44,17 +42,17 @@ using SqlSugar;
 using Hotline.Tools;
 using Hotline.Api.Filter;
 using XF.Domain.Cache;
+using Hotline.Application.CallCenter;
 
 namespace Hotline.Api.Controllers
 {
     public class IPPbxController : BaseController
     {
-        private readonly ITrClient _trClient;
         private readonly IMapper _mapper;
         private readonly IUserDomainService _userDomainService;
         private readonly ISessionContext _sessionContext;
         private readonly IRepository<TrCallRecord> _trCallRecordRepository;
-        private readonly ITrApplication _trApplication;
+        private readonly ICallApplication _callApplication;
         private readonly IRepository<TrCallEvaluate> _trCallEvaluate;
         private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
         private readonly ILogger<IPPbxController> _logger;
@@ -75,10 +73,12 @@ namespace Hotline.Api.Controllers
         private readonly IRepository<Work> _workRepository;
         private readonly Publisher _publisher;
         private readonly ITrCallRecordRepository _callRecordRepository;
+        private readonly IIPPbxApplication _iPPbxApplication;
+        private readonly ICallTelClient _callTelClient;
 
-        public IPPbxController(ITrClient trClient, IMapper mapper, IUserDomainService userDomainService,
+        public IPPbxController(IMapper mapper, IUserDomainService userDomainService,
             ISessionContext sessionContext, IRepository<TrCallRecord> trCallRecordRepository,
-            ITrApplication trApplication, IRepository<TrCallEvaluate> trCallRecord,
+            ICallApplication callApplication, IRepository<TrCallEvaluate> trCallRecord,
             ISystemDicDataCacheManager systemDicDataCacheManager, ILogger<IPPbxController> logger,
             IOrderRepository orderRepository, IRepository<OrderVisit> orderVisitRepository,
             IUserCacheManager userCacheManager, ICapPublisher capPublisher,
@@ -86,14 +86,13 @@ namespace Hotline.Api.Controllers
             ITelApplication telApplication, IRepository<Quality.Quality> qualiteyRepository,
             IAiQualityService aiQualityService, IRepository<QualityTemplate> qualityTemplate,
             ISystemSettingCacheManager systemSettingCacheManager, IRepository<TelActionRecord> telActionRecordRepository,
-            ISystemMobilAreaApplication systemMobilAreaApplication, IRepository<Work> workRepository, Publisher publisher, ITrCallRecordRepository callRecordRepository, ITypedCache<Work> cacheWork)
+            ISystemMobilAreaApplication systemMobilAreaApplication, IRepository<Work> workRepository, Publisher publisher, ITrCallRecordRepository callRecordRepository, ITypedCache<Work> cacheWork, IIPPbxApplication iPPbxApplication, ICallTelClient callTelClient)
         {
-            _trClient = trClient;
             _mapper = mapper;
             _userDomainService = userDomainService;
             _sessionContext = sessionContext;
             _trCallRecordRepository = trCallRecordRepository;
-            _trApplication = trApplication;
+            _callApplication = callApplication;
             _trCallEvaluate = trCallRecord;
             _systemDicDataCacheManager = systemDicDataCacheManager;
             _logger = logger;
@@ -114,6 +113,8 @@ namespace Hotline.Api.Controllers
             _publisher = publisher;
             _callRecordRepository = callRecordRepository;
             _cacheWork = cacheWork;
+            _iPPbxApplication = iPPbxApplication;
+            _callTelClient = callTelClient;
         }
 
         #region 添添呼
@@ -126,7 +127,7 @@ namespace Hotline.Api.Controllers
         [HttpGet("query-tels")]
         public async Task<List<TrTelDto>> TrQueryTels()
         {
-            var tels = await _trClient.QueryTelsAsync(new QueryTelRequest() { }, HttpContext.RequestAborted);
+            var tels = await _callTelClient.QueryTelsAsync(new QueryTelRequest() { }, HttpContext.RequestAborted);
             var listenTels = _systemSettingCacheManager.GetSetting(SettingConstants.ListenTels)?.SettingValue;
             tels = tels.Where(m => listenTels.Contains(m.TelNo) ==  false).ToList();
             var returnlist = _mapper.Map<List<TrTelDto>>(tels);
@@ -147,7 +148,7 @@ namespace Hotline.Api.Controllers
         [AllowAnonymous]
         public async Task<IReadOnlyList<TrTelStateDto>> TrQueryTelState([FromQuery] string? state, bool hasListen)
         {
-            var tels = await _trClient.QueryTelStateAsync(new QueryTelStateRequest() { State = state }, HttpContext.RequestAborted);
+            var tels = await _callTelClient.QueryTelStateAsync(new QueryTelStateRequest() { State = state }, HttpContext.RequestAborted);
             var listenTels = _systemSettingCacheManager.GetSetting(SettingConstants.ListenTels)?.SettingValue;
             var workList = await _workRepository.Queryable().Where(d=> 1 == 1 && !d.EndTime.HasValue).ToListAsync();
             var query = from tel in tels.AgentList
@@ -194,7 +195,7 @@ namespace Hotline.Api.Controllers
         [AllowAnonymous]
         public async Task<TrTelStateDto> TrQueryTelStateByTelNo([FromQuery]string? telno)
         {
-            var tels = await _trClient.QueryTelStateAsync(new QueryTelStateRequest() { TelNo = telno }, HttpContext.RequestAborted);
+            var tels = await _callTelClient.QueryTelStateAsync(new QueryTelStateRequest() { TelNo = telno }, HttpContext.RequestAborted);
 
             var listenTels = _systemSettingCacheManager.GetSetting(SettingConstants.ListenTels)?.SettingValue;
             tels.Agents = tels.Agents?.Where(m => listenTels.Contains(m.TelNo) == false).ToList();
@@ -249,7 +250,7 @@ namespace Hotline.Api.Controllers
         [HttpPost("add-blacklist")]
         public async Task AddBlacklist([FromBody] TrAddBlacklistDto dto)
         {
-            await _trClient.AddBlacklistAsync(new AddBlacklistRequest() { Phone = dto.Phone, SpecialFlag = dto.SpecialFlag }, HttpContext.RequestAborted);
+            await _callTelClient.AddBlacklistAsync(new AddBlacklistRequest() { Phone = dto.Phone, SpecialFlag = dto.SpecialFlag }, HttpContext.RequestAborted);
         }
 
         /// <summary>
@@ -261,7 +262,7 @@ namespace Hotline.Api.Controllers
         [HttpPost("remove-blacklist")]
         public async Task DelBlacklist([FromBody] TrDelBlacklistDto dto)
         {
-            await _trClient.DelBlacklistAsync(new DelBlacklistRequest() { Phone = dto.Phone, SpecialFlag = dto.SpecialFlag }, HttpContext.RequestAborted);
+            await _callTelClient.DelBlacklistAsync(new DelBlacklistRequest() { Phone = dto.Phone, SpecialFlag = dto.SpecialFlag }, HttpContext.RequestAborted);
         }
 
         /// <summary>
@@ -271,7 +272,7 @@ namespace Hotline.Api.Controllers
         [HttpGet("query-blacklist")]
         public async Task<IReadOnlyList<TrQueryBlacklistResponseDto>> QueryBlacklist([FromQuery] TrQueryBlacklistDto dto)
         {
-            var blacklist = await _trClient.QueryBlacklistAsync(new QueryBlacklistRequest() { Phone = dto.Phone, SpecialFlag = dto.SpecialFlag }, HttpContext.RequestAborted);
+            var blacklist = await _callTelClient.QueryBlacklistAsync(new QueryBlacklistRequest() { Phone = dto.Phone, SpecialFlag = dto.SpecialFlag }, HttpContext.RequestAborted);
             return _mapper.Map<IReadOnlyList<TrQueryBlacklistResponseDto>>(blacklist);
         }
 
@@ -287,8 +288,7 @@ namespace Hotline.Api.Controllers
         [HttpPost("on-duty")]
         public async Task<TrOnDutyResponseDto> OnDuty([FromBody] TrOnDutyDto dto)
         {
-            //return await _userDomainService.TrOnDutyAsync(_sessionContext.RequiredUserId,dto.TelNo, HttpContext.RequestAborted);
-            return await _trApplication.OnSign(_sessionContext.RequiredUserId, dto.TelNo,(ETelModel)dto.TelModelState, HttpContext.RequestAborted);
+            return await _callApplication.SignInAsync(new SignInDto() { TelNo = dto.TelNo, TelModelState = dto.TelModelState}, HttpContext.RequestAborted);
         }
 
         /// <summary>
@@ -309,10 +309,9 @@ namespace Hotline.Api.Controllers
         [HttpGet("tel-state")]
         public async Task<TrOnDutyResponseDto> TelState()
         {
-            return await _trApplication.TelState(_sessionContext.RequiredUserId,HttpContext.RequestAborted);
+            return await _callApplication.GetTelStateAsync(HttpContext.RequestAborted);
         }
 
-
         /// <summary>
         /// 切换状态
         /// </summary>
@@ -322,11 +321,9 @@ namespace Hotline.Api.Controllers
         [HttpPost("change-telmodel")]
         public async Task ChangeTelModel([FromBody] ChangeTelModelDto dto)
         {
-            await _trApplication.ChangeTelModel(_sessionContext.RequiredUserId, dto.isCallOut,HttpContext.RequestAborted);
+            await _callApplication.ChangeTelModel(dto.isCallOut,HttpContext.RequestAborted);
         }
 
-
-
         /// <summary>
         /// 下班-管理手动操作
         /// </summary>
@@ -900,7 +897,7 @@ namespace Hotline.Api.Controllers
             try
             {
                 var list = await _workRepository.Queryable().Where(x => 1 == 1 && !x.EndTime.HasValue).ToListAsync();
-                var tellist = await _trClient.QueryTelStateAsync(new Tr.Sdk.Tels.QueryTelStateRequest { },HttpContext.RequestAborted);
+                var tellist = await _callTelClient.QueryTelStateAsync(new QueryTelStateRequest { },HttpContext.RequestAborted);
                 foreach (var item in list)
                 {
                     var telmodel = tellist.AgentList.First(x => x.TelNo == item.TelNo);
@@ -908,23 +905,24 @@ namespace Hotline.Api.Controllers
                     {
                         if (telmodel.State == "logout")
                         {
-                            var telRest = await _telRestRepository.GetAsync(x => x.TelNo == item.TelNo && !x.EndTime.HasValue, HttpContext.RequestAborted);
-                            if (telRest is not null)
-                            {
-                                telRest.EndRest();
-                                await _telRestRepository.UpdateAsync(telRest, HttpContext.RequestAborted);
-                            }
-
-                            item.OffDuty();
-                            await _workRepository.UpdateAsync(item, HttpContext.RequestAborted);
-                            _cacheWork.Remove(item.GetKey(KeyMode.UserId));
-                            _cacheWork.Remove(item.GetKey(KeyMode.TelNo));
-                            var listx = await _telActionRecordRepository.Queryable().Where(x => x.TelNo == item.TelNo && !x.EndTime.HasValue).ToListAsync();
-                            foreach (var itemx in listx)
-                            {
-                                itemx.EndAction();
-                                await _telActionRecordRepository.UpdateAsync(itemx);
-                            }
+                            await _iPPbxApplication.ResetTelStatus(item.Id,null, HttpContext.RequestAborted);
+                            //var telRest = await _telRestRepository.GetAsync(x => x.TelNo == item.TelNo && !x.EndTime.HasValue, HttpContext.RequestAborted);
+                            //if (telRest is not null)
+                            //{
+                            //    telRest.EndRest();
+                            //    await _telRestRepository.UpdateAsync(telRest, HttpContext.RequestAborted);
+                            //}
+
+                            //item.OffDuty();
+                            //await _workRepository.UpdateAsync(item, HttpContext.RequestAborted);
+                            //_cacheWork.Remove(item.GetKey(KeyMode.UserId));
+                            //_cacheWork.Remove(item.GetKey(KeyMode.TelNo));
+                            //var listx = await _telActionRecordRepository.Queryable().Where(x => x.TelNo == item.TelNo && !x.EndTime.HasValue).ToListAsync();
+                            //foreach (var itemx in listx)
+                            //{
+                            //    itemx.EndAction();
+                            //    await _telActionRecordRepository.UpdateAsync(itemx);
+                            //}
                         }
                     }
                 }

+ 32 - 3
src/Hotline.Api/Controllers/TestController.cs

@@ -83,6 +83,7 @@ using Hotline.EventBus;
 using Hotline.JudicialManagement.Notifies;
 using Hotline.Snapshot.Notifications;
 using XF.Domain.Entities;
+using Hotline.Repository.SqlSugar.Orders;
 
 namespace Hotline.Api.Controllers;
 
@@ -155,6 +156,7 @@ public class TestController : BaseController
 	private readonly IRepository<OrderVisit> _orderVisitRepository;
     private readonly IThirdIdentiyService _thirdIdentiyService;
 	private readonly IServiceProvider _serviceProvider;
+	private readonly IRepository<OrderDelay> _orderDelayRepository;
 
 
 	public TestController(
@@ -206,9 +208,9 @@ IOrderDomainService orderDomainService,
 ICallApplication callApplication,
         IOptionsSnapshot<AppConfiguration> appOptions,
         ISystemSettingCacheManager systemSettingCacheManager,
-        ICalcExpireTime expireTime
-,
-        ICallNativeRepository callNativeRepository,
+        ICalcExpireTime expireTime,
+		IRepository<OrderDelay> orderDelayRepository,
+		ICallNativeRepository callNativeRepository,
         IRepository<OldSendProData> oldSendProDataRepository,
         IThirdIdentiyService thirdIdentiyService,
 		IOrderScreenRepository orderScreenRepository,
@@ -268,6 +270,7 @@ ICallApplication callApplication,
         _orderScreenRepository = orderScreenRepository;
         _orderVisitRepository = orderVisitRepository;
         _serviceProvider = serviceProvider;
+		_orderDelayRepository = orderDelayRepository; 
 	}
 
     /// <summary>
@@ -1430,4 +1433,30 @@ ICallApplication callApplication,
 		//if (isOpenJudicialManagement == "true")
 		//	await _publisher.PublishAsync(new JudicialManagementOrderNotify(order), PublishStrategy.ParallelWhenAll, HttpContext.RequestAborted);
 	}
+
+
+	/// <summary>
+	/// 延期EndHandle错误数据处理
+	/// </summary>
+	/// <returns></returns>
+	[HttpPost("end_order_delay")]
+	[AllowAnonymous]
+	public async Task EndOrderDelay([FromBody] OrderDelayEndHandleDto dto) {
+
+		var delay = await _orderDelayRepository.GetAsync(dto.DelayId);
+		if (delay != null)
+		{
+			//delay.Flowed(workflow.FlowedUserIds, workflow.FlowedOrgIds, workflow.HandlerUsers, workflow.HandlerOrgs);
+			delay.DelayState = dto.IsReviewPass ? EDelayState.Pass : EDelayState.NoPass;
+			await _orderDelayRepository.Updateable(delay)
+				.UpdateColumns(d => d.DelayState)
+				.ExecuteCommandAsync();
+			if (dto.IsReviewPass)
+			{
+				//处理工单延期
+				await _orderApplication.DelayOrderExpiredTimeAsync(delay.OrderId, delay.DelayNum,
+					delay.DelayUnit, delay.IsProDelay, HttpContext.RequestAborted);
+			}
+		}
+	}
 }

+ 1 - 0
src/Hotline.Api/Controllers/WebPortalController.cs

@@ -1966,6 +1966,7 @@ namespace Hotline.Api.Controllers
                     orderDetail.FlowResult = orderPublish.ArrangeOpinion;
                     if (orderPublish.PublishState)
                         orderDetail.FlowPubFlagName = "公开";
+                    orderDetail.FirstVisitResult = data.FirstVisitResult;
                 }
 
                 //能否进行评价

+ 1 - 0
src/Hotline.Api/Hotline.Api.csproj

@@ -29,6 +29,7 @@
     <ProjectReference Include="..\Hotline.Application\Hotline.Application.csproj" />
     <ProjectReference Include="..\Hotline.Logger\Hotline.Logger.csproj" />
     <ProjectReference Include="..\Hotline.WeChat\Hotline.WeChat.csproj" />
+    <ProjectReference Include="..\Hotline.XingTang\Hotline.XingTang.csproj" />
     <ProjectReference Include="..\TianQue.Sdk\TianQue.Sdk.csproj" />
   </ItemGroup>
 

+ 2 - 2
src/Hotline.Api/StartupExtensions.cs

@@ -29,7 +29,6 @@ using Hotline.Configurations;
 using Hotline.DI;
 using Hotline.Settings.TimeLimitDomain.ExpireTimeSupplier;
 using XF.Domain.Authentications;
-using Hotline.XingTang;
 using HotPot.Mvc.Filters;
 using Hotline.WeChat;
 using Hotline.Snapshot.Interfaces;
@@ -39,6 +38,7 @@ using XF.Domain.Repository.Events;
 using Hotline.Orders.DatabaseEventHandler;
 using Hotline.Ai.XingTang;
 using Hotline.Pdf;
+using Hotline.XingTang;
 
 
 namespace Hotline.Api;
@@ -106,7 +106,6 @@ internal static class StartupExtensions
             {
                 options.Filters.Add<UnifyResponseFilter>();
                 options.Filters.Add<UserFriendlyExceptionFilter>();
-                options.Filters.Add<ErrorHandlingFilter>();
             })
             ;
 
@@ -264,6 +263,7 @@ internal static class StartupExtensions
         //app.UseRequestResponseLogging(app.Configuration);
 
         app.UseResponseCompression();
+        app.UseXingTangApiEndpoints();
 
         return app;
     }

+ 5 - 0
src/Hotline.Application/CallCenter/DefaultCallApplication.cs

@@ -639,5 +639,10 @@ public abstract class DefaultCallApplication : ICallApplication
         throw new NotImplementedException();
     }
 
+    public virtual Task ChangeTelModel(bool isCallOut, CancellationToken requestAborted)
+    {
+        throw new NotImplementedException();
+    }
+
     #endregion
 }

+ 1 - 0
src/Hotline.Application/CallCenter/ICallApplication.cs

@@ -195,5 +195,6 @@ namespace Hotline.Application.CallCenter
         /// <param name="orderId"></param>
         /// <returns></returns>
         Task<ESeatEvaluate> GetSeatDefaultByOrderIdAsync(string orderId);
+        Task ChangeTelModel(bool isCallOut, CancellationToken requestAborted);
     }
 }

+ 11 - 0
src/Hotline.Application/CallCenter/IIPPbxApplication.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.Application.CallCenter;
+public interface IIPPbxApplication
+{
+    Task ResetTelStatus(string? workId, string? telNo, CancellationToken token = default);
+}

+ 62 - 0
src/Hotline.Application/CallCenter/IPPbxApplication.cs

@@ -0,0 +1,62 @@
+using DocumentFormat.OpenXml.Office.CustomUI;
+using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Tels;
+using Hotline.Users;
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Cache;
+using XF.Domain.Dependency;
+using XF.Domain.Repository;
+
+namespace Hotline.Application.CallCenter;
+public class IPPbxApplication : IIPPbxApplication, IScopeDependency
+{
+    private readonly ITelRestRepository _telRestRepository;
+    private readonly IRepository<Work> _workRepository;
+    private readonly ITypedCache<Work> _cacheWork;
+    private readonly IRepository<TelActionRecord> _telActionRecordRepository;
+
+    public IPPbxApplication(ITelRestRepository telRestRepository, IRepository<Work> workRepository, ITypedCache<Work> cacheWork, IRepository<TelActionRecord> telActionRecordRepository)
+    {
+        _telRestRepository = telRestRepository;
+        _workRepository = workRepository;
+        _cacheWork = cacheWork;
+        _telActionRecordRepository = telActionRecordRepository;
+    }
+
+    public async Task ResetTelStatus(string? workId, string? telNo, CancellationToken token = default)
+    {
+        Work? item = null;
+        if (workId != null)
+        {
+            item = await _workRepository.GetAsync(workId, token);
+        }
+        else if (telNo != null)
+        {
+            item = await _workRepository.Queryable().Where(m => m.TelNo == telNo && !m.EndTime.HasValue).FirstAsync(token);
+        }
+        if (item == null) return;
+        var telRest = await _telRestRepository.GetAsync(x => x.TelNo == item.TelNo && !x.EndTime.HasValue, token);
+        if (telRest is not null)
+        {
+            telRest.EndRest();
+            await _telRestRepository.UpdateAsync(telRest, token);
+        }
+
+        item.OffDuty();
+        await _workRepository.UpdateAsync(item, token);
+        _cacheWork.Remove(item.GetKey(KeyMode.UserId));
+        _cacheWork.Remove(item.GetKey(KeyMode.TelNo));
+        var listx = await _telActionRecordRepository.Queryable().Where(x => x.TelNo == item.TelNo && !x.EndTime.HasValue).ToListAsync();
+        foreach (var itemx in listx)
+        {
+            itemx.EndAction();
+            await _telActionRecordRepository.UpdateAsync(itemx);
+        }
+
+    }
+}

+ 5 - 0
src/Hotline.Application/CallCenter/TianRunCallApplication.cs

@@ -302,5 +302,10 @@ namespace Hotline.Application.CallCenter
             }
             return ESeatEvaluate.DefaultSatisfied;
         }
+
+        public override async Task ChangeTelModel(bool isCallOut, CancellationToken requestAborted)
+        {
+            await _trApplication.ChangeTelModel(_sessionContext.RequiredUserId, isCallOut, requestAborted);
+        }
     }
 }

+ 0 - 1
src/Hotline.Application/Hotline.Application.csproj

@@ -23,7 +23,6 @@
     <ProjectReference Include="..\Hotline.Pdf\Hotline.Pdf.csproj" />
     <ProjectReference Include="..\Hotline.Repository.SqlSugar\Hotline.Repository.SqlSugar.csproj" />
     <ProjectReference Include="..\Hotline.Wex\Hotline.Wex.csproj" />
-    <ProjectReference Include="..\Hotline.XingTang\Hotline.XingTang.csproj" />
     <ProjectReference Include="..\Hotline.YbEnterprise.Sdk\Hotline.YbEnterprise.Sdk.csproj" />
     <ProjectReference Include="..\Hotline\Hotline.csproj" />
     <ProjectReference Include="..\Tr.Sdk\Tr.Sdk.csproj" />

+ 6 - 0
src/Hotline.Application/Orders/OrderApplication.cs

@@ -801,6 +801,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                 d.SourceChannelCode == "SZMHD" && d.IsProvince == true) //政民互动
             .WhereIF(!string.IsNullOrEmpty(dto.ProvinceChannel) && dto.ProvinceChannel == "3", d => d.Source == ESource.ProvinceStraight &&
                 d.SourceChannelCode == "S12345" && d.IsProvince == true) //省12345
+            .OrderBy(d => new { IsUrgent = d.IsUrgent }, OrderByType.Desc)
             .OrderByDescending(d => d.FiledTime);
     }
 
@@ -1022,9 +1023,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
                     _mapper.Map(detaildto, visit.OrderVisitDetails[i]);
                 }
             }
+            var seat = visit.OrderVisitDetails.FirstOrDefault(x => x.VisitTarget == EVisitTarget.Seat);
+            seat.SeatEvaluate = ESeatEvaluate.DefaultSatisfied;
+            seat.VoiceEvaluate = EVoiceEvaluate.DefaultSatisfied;
 
             await _orderVisitRepository.UpdateAsync(visit, cancellationToken);
             await _orderVisitDetailRepository.UpdateRangeAsync(visit.OrderVisitDetails, cancellationToken);
+            await _orderVisitedDetailRepository.UpdateAsync(seat, cancellationToken);
             await _orderRepository.UpdateAsync(visit.Order, cancellationToken);
             var orderDto = _mapper.Map<OrderDto>(visit.Order);
             if (first != null)
@@ -3431,6 +3436,7 @@ public class OrderApplication : IOrderApplication, IScopeDependency
             .WhereIF(dto.IsAiVisit.HasValue && dto.IsAiVisit == true, x => x.AiVisitCount > 0)
             .OrderByDescending(x => x.PublishTime)
             .WhereIF(!string.IsNullOrEmpty(dto.Channel), d => d.Order.SourceChannelCode == dto.Channel)
+            .OrderByIF(dto.VisitStateQuery!= EVisitStateQuery.Visited,x=> new { IsUrgent = x.Order.IsUrgent }, OrderByType.Desc)
             .OrderByDescending(d => d.PublishTime);
         return query;
     }

+ 2 - 0
src/Hotline.Share/Dtos/CallCenter/BiSeatCallsDto.cs

@@ -150,6 +150,8 @@ public class BiSeatRestDto
 
     public double RestDuration { get; set; }
 
+    public string RestDurationTxt => RestDuration.ToString("f2");
+
     /// <summary>
     /// 小休累计时长 (单元: 分)
     /// </summary>

+ 1 - 1
src/Hotline.Share/Dtos/CallCenter/TelDto.cs

@@ -105,7 +105,7 @@ namespace Hotline.Share.Dtos.CallCenter
         /// <summary>
         /// 应用秘钥
         /// </summary>
-        public string AppSecert { get; set; }
+        public string AppSecret { get; set; }
 
         /// <summary>
         /// 分机号

+ 2 - 8
src/Hotline.Share/Dtos/Order/OrderDto.cs

@@ -144,17 +144,11 @@ namespace Hotline.Share.Dtos.Order
 
         public string GetAllDurationHour()
         {
-            if (AllDuration > 0)
+            if (CreationTimeHandleDurationWorkday != null && CreationTimeHandleDurationWorkday > 0)
             {
-                return Math.Round(Math.Round(AllDuration) / 60 / 60, 2).ToString() + "";
+                return Math.Round(Math.Round(CreationTimeHandleDurationWorkday.Value) / 60 / 60, 2).ToString() + "";
             }
             return "0.00";
-            //if (Status >= EOrderStatus.Filed && FiledTime.HasValue)
-            //{
-            //    return Math.Round(Math.Round((FiledTime - CreationTime).Value.TotalSeconds) / 60 / 60, 2).ToString() + "小时";
-            //}
-
-            //return "-";
         }
 
         /// <summary>

+ 8 - 1
src/Hotline.Share/Dtos/Order/QueryOrderDto.cs

@@ -278,7 +278,14 @@ namespace Hotline.Share.Dtos.Order
 
     }
 
-    public class PublishOrderDelayDto
+	public record OrderDelayEndHandleDto
+	{
+        public string DelayId {  get; set; }
+
+        public bool IsReviewPass { get; set; }
+	}
+
+	public class PublishOrderDelayDto
     {
         public string Id { get; set; }
 

+ 5 - 0
src/Hotline.Share/Dtos/WebPortal/GetOrderCodePwd.cs

@@ -345,6 +345,11 @@ namespace Hotline.Share.Dtos.WebPortal
         /// </summary>
         public string? OrgLevelOneName { get; set; }
 
+        /// <summary>
+        /// 首次评价结果
+        /// </summary>
+        public string? FirstVisitResult { get; set; }
+
         /// <summary>
         /// 附件
         /// </summary>

+ 20 - 0
src/Hotline.XingTang/CallTelClient.cs

@@ -5,8 +5,28 @@ namespace Hotline.XingTang;
 
 internal class CallTelClient : ICallTelClient
 {
+    public Task AddBlacklistAsync(AddBlacklistRequest request, CancellationToken token)
+    {
+        throw new NotImplementedException();
+    }
+
+    public Task DelBlacklistAsync(DelBlacklistRequest request, CancellationToken token)
+    {
+        throw new NotImplementedException();
+    }
+
+    public Task<List<QueryBlacklistResponse>> QueryBlacklistAsync(QueryBlacklistRequest request, CancellationToken token)
+    {
+        throw new NotImplementedException();
+    }
+
     public async Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken)
     {
         return new List<QueryTelResponse>();
     }
+
+    public Task<QueryTelStateResponse> QueryTelStateAsync(QueryTelStateRequest request, CancellationToken token)
+    {
+        throw new NotImplementedException();
+    }
 }

+ 50 - 0
src/Hotline.XingTang/Dto/NotifyDto.cs

@@ -0,0 +1,50 @@
+using Hotline.Share.Enums.CallCenter;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.XingTang.Dto;
+public class NotifyInDto
+{
+    /// <summary>
+    /// 应用ID
+    /// </summary>
+    public string AppId { get; set; }
+
+    /// <summary>
+    /// 应用密钥
+    /// </summary>
+    public string AppSecret { get; set; }
+
+    /// <summary>
+    /// 分机号
+    /// </summary>
+    public string TelNo { get; set; }
+
+    /// <summary>
+    /// 工号
+    /// </summary>
+    public string StaffNo { get; set; }
+
+    /// <summary>
+    /// 分机状态
+    /// - '0': '签出'
+    /// - '100': '签入'
+    /// - '200': '空闲'
+    /// - '201': '小休'
+    /// - '202': '繁忙'
+    /// - '300': '呼入振铃'
+    /// - '301': '呼入通话'
+    /// - '302': '呼出振铃'
+    /// - '303': '呼出通话'
+    /// - '310': '通话保持'
+    /// - '320': '会议'
+    /// - '330': '咨询'
+    /// - '400': '整理'
+    /// - '900': '注册'
+    /// - '901': '注销'
+    /// </summary>
+    public int Status { get; set; }
+}

+ 1 - 0
src/Hotline.XingTang/Hotline.XingTang.csproj

@@ -7,6 +7,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <ProjectReference Include="..\Hotline.Application\Hotline.Application.csproj" />
     <ProjectReference Include="..\Hotline\Hotline.csproj" />
     <ProjectReference Include="..\XingTang.Sdk\XingTang.Sdk.csproj" />
   </ItemGroup>

+ 12 - 0
src/Hotline.XingTang/INotifyService.cs

@@ -0,0 +1,12 @@
+using Hotline.XingTang.Dto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.XingTang;
+public interface INotifyService
+{
+    Task NotifyStatus(NotifyInDto dto);
+}

+ 32 - 0
src/Hotline.XingTang/NotifyService.cs

@@ -0,0 +1,32 @@
+using Hotline.Application.CallCenter;
+using Hotline.Settings;
+using Hotline.Share.Tools;
+using Hotline.XingTang.Dto;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Hotline.XingTang;
+public class NotifyService : INotifyService
+{
+    private readonly IIPPbxApplication _IPPbxApplication;
+    private readonly ISystemLogRepository _systemLogRepository;
+
+    public NotifyService(IIPPbxApplication iPPbxApplication, ISystemLogRepository systemLogRepository)
+    {
+        _IPPbxApplication = iPPbxApplication;
+        _systemLogRepository = systemLogRepository;
+    }
+
+    public async Task NotifyStatus(NotifyInDto dto)
+    {
+        _systemLogRepository.Add("兴唐分机状态通知", dto);
+        if (dto.Status == 0)
+        {
+            await _IPPbxApplication.ResetTelStatus(null, dto.TelNo, CancellationToken.None);
+        }
+    }
+}

+ 19 - 1
src/Hotline.XingTang/ServiceCollectionExtensions.cs

@@ -1,10 +1,16 @@
-using Hotline.CallCenter.Tels;
+using Fw.Utility.UnifyResponse;
+using Hotline.CallCenter.Tels;
+using Hotline.XingTang.Dto;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.DependencyInjection;
+using NPOI.SS.Formula.Functions;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using static System.Runtime.InteropServices.JavaScript.JSType;
 
 namespace Hotline.XingTang;
 public static class ServiceCollectionExtensions
@@ -12,6 +18,18 @@ public static class ServiceCollectionExtensions
     public static IServiceCollection AddXingTangSDK(this IServiceCollection services)
     {
         services.AddScoped<ICallTelClient, CallTelClient>();
+        services.AddScoped<INotifyService, NotifyService>();
         return services;
     }
+
+    public static void UseXingTangApiEndpoints(this WebApplication app)
+    {
+        // 注册 POST 接口
+        app.MapPost("/api/v1/XingTang/notify/status", async (INotifyService service, HttpContext context) =>
+        {
+            var input = await context.Request.ReadFromJsonAsync<NotifyInDto>();
+            await service.NotifyStatus(input!);
+            return Results.Ok(new ApiResponse(0, "ok", ""));
+        });
+    }
 }

+ 87 - 0
src/Hotline/CallCenter/Tels/CallTelDomain/QueryTelRequest.cs

@@ -3,6 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Text.Json.Serialization;
 using System.Threading.Tasks;
 
 namespace Hotline.CallCenter.Tels.CallTelDomain;
@@ -15,3 +16,89 @@ public class QueryTelRequest
     public string? TelNo { get; set; }
 
 }
+
+public class QueryBlacklistRequest
+{
+    public string Path() => "api/special_phone/special_phone_detail";
+
+    public Method HttpMethod() => Method.Get;
+
+    [RequestProperty(Name = "phone")]
+    public string? Phone { get; set; }
+
+    /// <summary>
+    /// 1:白名单;2:呼入黑名单;3:呼出黑名单;4:呼入呼出黑名单;
+    /// </summary>
+    [RequestProperty(Name = "special_flag")]
+    public int? SpecialFlag { get; set; }
+}
+public class QueryBlacklistResponse
+{
+    [JsonPropertyName("uuid")]
+    public string Id { get; set; }
+
+    [JsonPropertyName("user_uuid")]
+    public string UserId { get; set; }
+
+    [JsonPropertyName("created_at")]
+    public string CreationTime { get; set; }
+
+    public string Phone { get; set; }
+
+    [JsonPropertyName("special_flag")]
+    public int SpecialFlag { get; set; }
+
+    public int? Priority { get; set; }
+}
+
+public class DelBlacklistRequest
+{
+    public string Path() => "api/special_phone/delete";
+
+    public Method HttpMethod() => Method.Post;
+
+
+    [RequestProperty(Name = "phone")]
+    public string Phone { get; set; }
+
+    /// <summary>
+    /// 1:白名单;2:呼入黑名单;3:呼出黑名单;4:呼入呼出黑名单;
+    /// </summary>
+    [RequestProperty(Name = "special_flag")]
+    public int? SpecialFlag { get; set; }
+}
+
+public class AddBlacklistRequest
+{
+    [RequestProperty(Name = "phone")]
+    public string Phone { get; set; }
+
+    /// <summary>
+    /// 1:白名单;2:呼入黑名单;3:呼出黑名单;4:呼入呼出黑名单;
+    /// </summary>
+    [RequestProperty(Name = "special_flag")]
+    public int SpecialFlag { get; set; }
+
+    public string Path() => "api/special_phone/insert";
+
+    public Method HttpMethod() => Method.Post;
+}
+
+public class QueryTelStateRequest
+{
+    public Method HttpMethod() => Method.Get;
+
+    public string Path() => $"api/ola/agents/{TelNo}";
+
+    /// <summary>
+    /// 分机号
+    /// </summary>
+    [RequestProperty(Name = "extn")]
+    public string? TelNo { get; set; }
+
+    /// <summary>
+    /// 需查询状态
+    /// </summary>
+    [RequestProperty(Name = "state")]
+    public string? State { get; set; }
+}

+ 128 - 1
src/Hotline/CallCenter/Tels/CallTelDomain/QueryTelResponse.cs

@@ -1,4 +1,5 @@
-using System;
+using Consul;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -21,3 +22,129 @@ public class QueryTelResponse
     public string QueueId { get; set; }
 
 }
+
+public class QueryTelStateResponse
+{
+    [JsonPropertyName("count")]
+    public string Count { get; set; }
+
+    [JsonPropertyName("agents")]
+    public List<Agent>? AgentList { get; set; }
+
+    [JsonPropertyName("agent")]
+    public List<Agent>? Agents { get; set; }
+}
+
+public class Agent
+{
+    /// <summary>
+    /// ID
+    /// </summary>
+    [JsonPropertyName("id")]
+    public string? Id { get; set; }
+
+    /// <summary>
+    /// 分机号
+    /// </summary>
+    [JsonPropertyName("extn")]
+    public string? TelNo { get; set; }
+    /// <summary>
+    /// 通道流水
+    /// </summary>
+    [JsonPropertyName("channel_uuid")]
+    public string? ChannelUUid { get; set; }
+    /// <summary>
+    /// 鉴权用户名
+    /// </summary>
+    [JsonPropertyName("name")]
+    public string? TelName { get; set; }
+    /// <summary>
+    /// 分机状态机类型
+    /// </summary>
+    [JsonPropertyName("type")]
+    public string? Type { get; set; }
+    /// <summary>
+    /// 权重
+    /// </summary>
+    [JsonPropertyName("weight")]
+    public string? Weight { get; set; }
+
+    /// <summary>
+    /// 所在呼叫组
+    /// </summary>
+    [JsonPropertyName("queue")]
+    public string? Queue { get; set; }
+
+    /// <summary>
+    /// 分机状态
+    /// </summary>
+    [JsonPropertyName("state")]
+    public string? State { get; set; }
+
+    /// <summary>
+    /// 前一状态
+    /// </summary>
+    [JsonPropertyName("old_state")]
+    public string? OldState { get; set; }
+
+    /// <summary>
+    /// 注册设备
+    /// </summary>
+    [JsonPropertyName("device")]
+    public string? Device { get; set; }
+
+    /// <summary>
+    /// 注册IP
+    /// </summary>
+    [JsonPropertyName("sip_ip")]
+    public string? SipIp { get; set; }
+
+    /// <summary>
+    /// 二级状态
+    /// </summary>
+    [JsonPropertyName("private_data")]
+    public string? PrivateData { get; set; }
+
+    /// <summary>
+    /// 是否注册
+    /// </summary>
+    [JsonPropertyName("sip_state")]
+    public string? SipState { get; set; }
+
+    /// <summary>
+    /// 签入时间
+    /// </summary>
+    [JsonPropertyName("created_at")]
+    public string? CreatedAt { get; set; }
+
+    /// <summary>
+    /// 状态变更时间
+    /// </summary>
+    [JsonPropertyName("updated_at")]
+    public string? UpdatedAt { get; set; }
+
+    /// <summary>
+    /// 呼叫方向
+    /// </summary>
+    [JsonPropertyName("call_direction")]
+    public string? CallDirection { get; set; }
+
+    /// <summary>
+    /// 呼叫号码
+    /// </summary>
+    [JsonPropertyName("other_number")]
+    public string? OtherNumber { get; set; }
+
+    /// <summary>
+    /// 使用线路
+    /// </summary>
+    [JsonPropertyName("gateway")]
+    public string? GateWay { get; set; }
+
+    /// <summary>
+    /// 接听时间
+    /// </summary>
+    [JsonPropertyName("answered_at")]
+    public string? AnsweredAt { get; set; }
+}
+

+ 8 - 0
src/Hotline/CallCenter/Tels/ICallTelClient.cs

@@ -9,4 +9,12 @@ namespace Hotline.CallCenter.Tels;
 public interface ICallTelClient
 {
     Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken);
+
+    Task<QueryTelStateResponse> QueryTelStateAsync(QueryTelStateRequest request, CancellationToken token);
+
+    Task AddBlacklistAsync(AddBlacklistRequest request, CancellationToken token);
+
+    Task DelBlacklistAsync(DelBlacklistRequest request, CancellationToken token);
+
+    Task<List<QueryBlacklistResponse>> QueryBlacklistAsync(QueryBlacklistRequest request, CancellationToken token);
 }

+ 22 - 0
src/Tr.Sdk/CallTelClient.cs

@@ -17,9 +17,31 @@ public class CallTelClient : ICallTelClient
         _trClient = trClient;
     }
 
+    public async Task AddBlacklistAsync(AddBlacklistRequest request, CancellationToken token)
+    {
+        await _trClient.AddBlacklistAsync(request.Adapt<Blacklist.AddBlacklistRequest>(), token);
+    }
+
+    public async Task DelBlacklistAsync(DelBlacklistRequest request, CancellationToken token)
+    {
+        await _trClient.DelBlacklistAsync(request.Adapt<Blacklist.DelBlacklistRequest>(), token);
+    }
+
+    public async Task<List<QueryBlacklistResponse>> QueryBlacklistAsync(QueryBlacklistRequest request, CancellationToken token)
+    {
+        var result = await _trClient.QueryBlacklistAsync(request.Adapt<Blacklist.QueryBlacklistRequest>(), token);
+        return request.Adapt<List<QueryBlacklistResponse>>();
+    }
+
     public async Task<List<QueryTelResponse>> QueryTelsAsync(QueryTelRequest request, CancellationToken cancellationToken)
     {
         var result = await _trClient.QueryTelsAsync(request.Adapt<Tels.QueryTelRequest>(), cancellationToken);
         return result.Adapt<List<QueryTelResponse>>();
     }
+
+    public async Task<QueryTelStateResponse> QueryTelStateAsync(QueryTelStateRequest request, CancellationToken token)
+    {
+        var result = await _trClient.QueryTelStateAsync(request.Adapt<Tels.QueryTelStateRequest>(), token);
+        return result.Adapt<QueryTelStateResponse>();
+    }
 }