xf 9 сар өмнө
parent
commit
c601324d88
34 өөрчлөгдсөн 383 нэмэгдсэн , 263 устгасан
  1. 7 0
      Hotline.sln
  2. 3 1
      src/Hotline.Api/Controllers/ReportController.cs
  3. 1 0
      src/Hotline.Api/Controllers/TestController.cs
  4. 82 81
      src/Hotline.Api/Controllers/TestSdkController.cs
  5. 44 22
      src/Hotline.Api/StartupExtensions.cs
  6. 14 2
      src/Hotline.Api/config/appsettings.Development.json
  7. 10 9
      src/Hotline.Application/Handlers/CallCenter/BaseHandler.cs
  8. 1 0
      src/Hotline.Application/Handlers/CallCenter/CallState/DtmfNotificationHandler.cs
  9. 1 0
      src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnOuterToMenuNotificationHandler.cs
  10. 1 0
      src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnVisitorToMenuNotificationHandler.cs
  11. 3 2
      src/Hotline.Application/Handlers/CallCenter/FlowControl/IncomingNotificationHandler.cs
  12. 3 2
      src/Hotline.Application/Handlers/CallCenter/FlowControl/InviteNotificationHandler.cs
  13. 1 0
      src/Hotline.Application/Hotline.Application.csproj
  14. 8 7
      src/Hotline.Application/Jobs/GetCallsJob.cs
  15. 95 86
      src/Hotline.NewRock/DeviceManager.cs
  16. 9 7
      src/Hotline.NewRock/Handlers/DeviceEventHandler.cs
  17. 13 0
      src/Hotline.NewRock/IDeviceEventHandler.cs
  18. 7 4
      src/Hotline.NewRock/NewRockStartupExtensions.cs
  19. 24 0
      src/Hotline.Repository.SqlSugar/Extensions/XingTangDbExtensions.cs
  20. 8 0
      src/Hotline.Repository.SqlSugar/XingTangDbContext.cs
  21. 5 3
      src/Hotline.Wex/WexStartupExtensions.cs
  22. 1 1
      src/Hotline.Wex/WexTokenManager.cs
  23. 14 0
      src/Hotline/CallCenter/Configs/CallCenterConfiguration.cs
  24. 2 2
      src/Hotline/CallCenter/Configs/NewRockConfiguration.cs
  25. 2 2
      src/Hotline/CallCenter/Configs/TianrunConfiguration.cs
  26. 1 1
      src/Hotline/CallCenter/Configs/WexConfiguration.cs
  27. 7 0
      src/Hotline/CallCenter/Configs/XingTangConfiguration.cs
  28. 0 10
      src/Hotline/CallCenter/Devices/CallCenterConfiguration.cs
  29. 0 8
      src/Hotline/CallCenter/Devices/WexConfiguration.cs
  30. 0 12
      src/Hotline/CallCenter/IDeviceEventHandler.cs
  31. 1 0
      src/Hotline/CallCenter/Tels/TelDomainService.cs
  32. 5 0
      src/Hotline/Users/User.cs
  33. 1 1
      src/NewRock.Sdk/Security/AuthorizeGenerator.cs
  34. 9 0
      src/XingTang.Sdk/XingTang.Sdk.csproj

+ 7 - 0
Hotline.sln

@@ -49,6 +49,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.Ai.Jths", "src\Hotl
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.YbEnterprise.Sdk", "src\Hotline.YbEnterprise.Sdk\Hotline.YbEnterprise.Sdk.csproj", "{C3F289D5-C50B-46DB-852C-9543EF9B0355}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XingTang.Sdk", "src\XingTang.Sdk\XingTang.Sdk.csproj", "{CF2A8B80-FF4E-4291-B383-D735BB629F32}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -123,6 +125,10 @@ Global
 		{C3F289D5-C50B-46DB-852C-9543EF9B0355}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{C3F289D5-C50B-46DB-852C-9543EF9B0355}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{C3F289D5-C50B-46DB-852C-9543EF9B0355}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CF2A8B80-FF4E-4291-B383-D735BB629F32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CF2A8B80-FF4E-4291-B383-D735BB629F32}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CF2A8B80-FF4E-4291-B383-D735BB629F32}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CF2A8B80-FF4E-4291-B383-D735BB629F32}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -149,6 +155,7 @@ Global
 		{EEF30056-A626-43B2-9762-632935C1AF31} = {25C73963-4D5E-4654-804A-D2E2D360134B}
 		{1634234A-379C-44DC-BFEC-7BBDEF50B47B} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 		{C3F289D5-C50B-46DB-852C-9543EF9B0355} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
+		{CF2A8B80-FF4E-4291-B383-D735BB629F32} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {4B8EA790-BD13-4422-8D63-D6DBB77B823F}

+ 3 - 1
src/Hotline.Api/Controllers/ReportController.cs

@@ -1,5 +1,7 @@
 using Hotline.CallCenter;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
+using Hotline.NewRock;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;
@@ -23,6 +25,6 @@ public class ReportController : ControllerBase
     [HttpGet]
     public async Task ReceiveEvents()
     {
-        await _deviceEventHandler.HandleAsync(Request.Body, _options.Value, HttpContext.RequestAborted);
+        await _deviceEventHandler.HandleAsync(Request.Body, _options.Value.NewRock, HttpContext.RequestAborted);
     }
 }

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

@@ -11,6 +11,7 @@ using Hotline.Application.JudicialManagement;
 using Hotline.Application.Quality;
 using Hotline.CallCenter.BlackLists;
 using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Ivrs;
 using Hotline.FlowEngine.WorkflowModules;

+ 82 - 81
src/Hotline.Api/Controllers/TestSdkController.cs

@@ -1,4 +1,5 @@
-using Hotline.CallCenter.Devices;
+using Hotline.CallCenter.Configs;
+using Hotline.CallCenter.Devices;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;
@@ -48,8 +49,8 @@ namespace Hotline.Api.Controllers
         {
             var result = await _client.QueryDeviceInfo(
                 new QueryDeviceInfoRequest { Attribute = "Query", DeviceInfo = string.Empty },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<QueryDeviceInfoResponse?>(result));
         }
@@ -64,8 +65,8 @@ namespace Hotline.Api.Controllers
         {
             var result = await _client.QueryExt(
                 new QueryExtRequest() { Attribute = "Query", Ext = new Ext() { Id = extid } },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted
             );
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<QueryExtResponse?>(result));
@@ -83,8 +84,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Query",
                 Group = new QueryExtGroup() { Id = groupid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<QueryExtGroupResponse?>(result));
         }
@@ -101,8 +102,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Query",
                 Menu = new QueryMenuMenu() { Id = menuid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<QueryMenuResponse?>(result));
         }
@@ -121,8 +122,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Query",
                 Trunk = new QueryTrunkTrunk() { Id = trunkid }
             },
-               _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+               _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<QueryTrunkResponse?>(result));
         }
@@ -139,8 +140,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Query",
                 Visitor = new QueryVisitorVisitor() { Id = visitorid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<QueryVisitorResponse?>(result));
         }
@@ -158,8 +159,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Query",
                 Outer = new QueryOuterOuter() { Id = outerid }
             },
-               _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+               _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<QueryOuterResponse?>(result));
         }
@@ -183,8 +184,8 @@ namespace Hotline.Api.Controllers
                 {
                     Id = extid
                 },
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -203,8 +204,8 @@ namespace Hotline.Api.Controllers
                 {
                     Id = visitorId
                 }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -223,8 +224,8 @@ namespace Hotline.Api.Controllers
                 {
                     Id = outerId
                 }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -261,8 +262,8 @@ namespace Hotline.Api.Controllers
                     Api = "7"
                 }
             },
-           _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+           _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
             HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<AssginConfigExtResponse?>(result));
         }
@@ -289,8 +290,8 @@ namespace Hotline.Api.Controllers
                         "210"
                     }
                 }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
             HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<AssginConfigGroupResponse?>(result));
         }
@@ -313,8 +314,8 @@ namespace Hotline.Api.Controllers
                     Repeat = "3",
                     InfoLength = "5",
                 }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -333,8 +334,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Hold",
                 Ext = new Ext() { Id = extid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             //_logger.LogInformation(result.Manufacturer);
         }
@@ -350,8 +351,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Unhold",
                 Ext = new Ext() { Id = extid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -371,8 +372,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Mute",
                 Ext = new Ext() { Id = extid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -388,8 +389,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Unmute",
                 Ext = new Ext() { Id = extid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -414,8 +415,8 @@ namespace Hotline.Api.Controllers
                         new ExtToExtExt() { Id = fromextid },
                         new ExtToExtExt() { Id = toextid }
                     }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize(result));
         }
@@ -433,8 +434,8 @@ namespace Hotline.Api.Controllers
                 Ext = new ExtToOuterExtRequest() { Id = fromextid },
                 Outer = new ExtToOuterOuterRequest() { To = to }
             },
-               _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+               _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -450,8 +451,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Connect",
                 Visitor = new VisitorToExtVisitor() { Id = visid },
                 Ext = new VisitorToExtExt() { Id = toextid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -471,8 +472,8 @@ namespace Hotline.Api.Controllers
                 Visitor = new VisitorToOuterVisitor() { Id = visid },
                 Outer = new VisitorToOuterOuter() { To = outerphonenum, Display = display },
 
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -490,8 +491,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Connect",
                 Visitor = new VisitorToMenuVisitor() { Id = visid },
                 Menu = new VisitorToMenuMenu() { Id = menuid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -510,8 +511,8 @@ namespace Hotline.Api.Controllers
                 Outer = new OuterToExtOuter() { Id = outer },
                 Ext = new OuterToExtExt() { Id = extid }
             },
-               _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+               _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -529,8 +530,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Connect",
                 Outer = new List<OuterToOuterOuterModel>() { new OuterToOuterOuterModel() { Id = outerid }, new OuterToOuterOuterModel() { To = outerphonenum } },
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -548,8 +549,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Connect",
                 Outer = new OuterToMenuOuter() { Id = outerid },
                 Menu = new OuterToMenuMenu() { Id = menuid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -567,8 +568,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Connect",
                 Menu = new MenuToExtMenu() { Id = menuid },
                 Ext = new MenuToExtExt() { Id = extid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -586,8 +587,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Connect",
                 Menu = new MenuToOuterMenu() { Id = menuid },
                 Outer = new MenuToOuterOuter() { To = outernum }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -609,8 +610,8 @@ namespace Hotline.Api.Controllers
                         new TwoWayOuterOuter(){ To = outerone},
                         new TwoWayOuterOuter(){ To = outertwo}
                     }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -630,8 +631,8 @@ namespace Hotline.Api.Controllers
                 Ext = new VoiceNewsFlashExt() { Id = extid }
             };
 
-            var result = await _client.VoiceNewsFlash(model, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            var result = await _client.VoiceNewsFlash(model, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -651,8 +652,8 @@ namespace Hotline.Api.Controllers
                 Visitor = new VoiceNewsFlashVisitor() { Id = visiitorid }
             };
 
-            var result = await _client.VoiceNewsFlash(model, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            var result = await _client.VoiceNewsFlash(model, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -672,8 +673,8 @@ namespace Hotline.Api.Controllers
                 Outer = new VoiceNewsFlashOuter() { Id = outerid }
             };
 
-            var result = await _client.VoiceNewsFlash(model, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            var result = await _client.VoiceNewsFlash(model, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -695,8 +696,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Conference",
                 Ext = new ConferenceMeetingExt() { Id = extid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -719,8 +720,8 @@ namespace Hotline.Api.Controllers
                 Attribute = "Queue",
                 Visitor = new VisitorToExtQueueVisitor() { Id = visitorid },
                 Ext = new VisitorToExtQueueExt() { Id = extid }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -739,8 +740,8 @@ namespace Hotline.Api.Controllers
                 Visitor = new VisitorToGroupQueueVisitor() { Id = visitorid },
                 Group = new VisitorToGroupQueueGroup() { Id = groupid }
             },
-               _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+               _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -762,8 +763,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Query",
                 VoiceFile = ""
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
             _logger.LogInformation(System.Text.Json.JsonSerializer.Serialize<VoiceQueryListResponse?>(result));
         }
@@ -780,8 +781,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Remove",
                 VoiceFile = voiceFile
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 HttpContext.RequestAborted);
         }
 
@@ -802,8 +803,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Monitor",
                 Exts = new List<Ext>() { new Ext() { Id = firstTelNo }, new Ext() { Id = secondTelNo } }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
              HttpContext.RequestAborted) ;
         }
 
@@ -822,8 +823,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Talk",
                 Ext = new Ext() { Id=telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
               HttpContext.RequestAborted);
         }
 
@@ -842,8 +843,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "Listen",
                 Ext = new Ext() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
              HttpContext.RequestAborted);
         }
 
@@ -869,8 +870,8 @@ namespace Hotline.Api.Controllers
             {
                 Attribute = "BargeinExt",
                 Exts = new List<Ext>() { new Ext() { Id=firstTelNo },new Ext() { Id=secondTelNo } }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
              HttpContext.RequestAborted);
         }
 

+ 44 - 22
src/Hotline.Api/StartupExtensions.cs

@@ -19,8 +19,10 @@ using XF.EasyCaching;
 using XF.Utility.MQ;
 using Hotline.Ai.Jths;
 using Hotline.Api.Sdk;
+using Hotline.CallCenter.Configs;
 using Hotline.YbEnterprise.Sdk;
 using Hotline.Share.Dtos.SendSms;
+using Hotline.Wex;
 
 namespace Hotline.Api;
 
@@ -37,8 +39,8 @@ internal static class StartupExtensions
 #if DEBUG
         builder.WebHost.UseUrls("http://*:50100");
 #endif
-        
-        //services.Configure<DeviceConfigs>(d => configuration.GetSection(nameof(DeviceConfigs)).Bind(d));
+
+        //services.Configure<NewRock>(d => configuration.GetSection(nameof(NewRock)).Bind(d));
         services.Configure<IdentityConfiguration>(d => configuration.GetSection(nameof(IdentityConfiguration)).Bind(d));
         services.Configure<CallCenterConfiguration>(d => configuration.GetSection(nameof(CallCenterConfiguration)).Bind(d));
         services.Configure<AiVisitConfig>(d => configuration.GetSection("AiVisit").Bind(d));
@@ -94,35 +96,55 @@ internal static class StartupExtensions
             d.RegisterServicesFromAssembly(typeof(ApplicationStartupExtensions).Assembly);
         });
 
-        var callCenterConfiguration = configuration.GetSection("CallCenterConfiguration").Get<CallCenterConfiguration>();
-        //迅时IPPBX
-        services.AddNewRock(callCenterConfiguration.DeviceConfigs.Address);
-  
-        ////wex
-        //services.AddWex(callCenterConfiguration.Wex.Address);
-  
-        //tr
-        var trConfig = configuration.GetRequiredSection("Tr").Get<TrConfiguration>();
-        services.AddTrSdk(trConfig.Address, trConfig.Username, trConfig.Password);
-  
-		//jths 
-		services.AddAiJths(configuration.GetSection("AiQuality").Get<AiQualityConfig>().Url);
-  
+        //callcenter
+        var callCenterConfiguration = configuration
+            .GetRequiredSection(nameof(CallCenterConfiguration))
+            .Get<CallCenterConfiguration>();
+        switch (callCenterConfiguration.CallCenterType)
+        {
+            case "XunShi":
+                services.AddNewRock(callCenterConfiguration.NewRock);
+                break;
+            case "WerErXin":
+                services.AddWex(callCenterConfiguration.Wex);
+                services.AddWexDb(configuration);
+                break;
+            case "TianRun":
+                services.AddTrSdk(callCenterConfiguration.TianRun.Address,
+                    callCenterConfiguration.TianRun.Username,
+                    callCenterConfiguration.TianRun.Password);
+                break;
+            case "XingTang":
+                services.AddXingTangDb(callCenterConfiguration.XingTang);
+                break;
+            default:
+                break;
+        }
+
+
+
+
+        ////tr
+        //var trConfig = configuration.GetRequiredSection("Tr").Get<TianrunConfiguration>();
+
+
+        //jths 
+        services.AddAiJths(configuration.GetSection("AiQuality").Get<AiQualityConfig>().Url);
+
         //宜宾企业服务
         services.Configure<EnterpriseConfig>(d => configuration.GetSection("Enterprise").Bind(d));
         var enterpriseConfig = configuration.GetSection("Enterprise").Get<EnterpriseConfig>();
         services.AddYbEnterpriseSdk(enterpriseConfig?.AddressUrl);
-  
+
         var aiVisitConfig = configuration.GetSection("AiVisit").Get<AiVisitConfig>();
         services.AddAiVisitService(
-            aiVisitConfig.Url, 
-            aiVisitConfig.Appkey, 
+            aiVisitConfig.Url,
+            aiVisitConfig.Appkey,
             aiVisitConfig.ServiceVersion);
 
         //sqlsugar
         services.AddSqlSugar(configuration);
-        //services.AddWexDb(configuration);
-        
+
         //validator
         services.AddFluentValidationAutoValidation(config =>
         {
@@ -157,7 +179,7 @@ internal static class StartupExtensions
                 //c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
             });
         }
-       
+
         app.UseCors(CorsOrigins);
 
         app.UseAuthentication();

+ 14 - 2
src/Hotline.Api/config/appsettings.Development.json

@@ -1,8 +1,8 @@
 {
   "AllowedHosts": "*",
   "CallCenterConfiguration": {
-    "CallCenterType": "WeiErXin", //XunShi、WeiErXin、TianRun
-    "DeviceConfigs": {
+    "CallCenterType": "XingTang", //XunShi、WeiErXin、TianRun、XingTang
+    "NewRock": {
       "Address": "http://192.168.100.100/xml",
       "Authorize": true,
       "ReceiveKey": "E1BBD1BB-A269-44",
@@ -13,6 +13,18 @@
       "Address": "http://222.212.82.225:8083",
       "Username": "admin",
       "Password": "Wex@12345"
+    },
+    "TianRun": {
+      //"Address": "http://internal.ttf-cti.com:8080",
+      //"Username": "yscs",
+      //"Password": "123456",
+      "Address": "http://222.213.23.229:29003/",
+      "Username": "root",
+      "Password": "12345678aa",
+      "Ip": "222.213.23.229"
+    },
+    "XingTang": {
+      "DbConnectionString": "server=123.56.10.71;Database=callcenter_db;Uid=root;Pwd=Lhw1981!(*!"
     }
   },
   "ConnectionStrings": {

+ 10 - 9
src/Hotline.Application/Handlers/CallCenter/BaseHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.Realtimes;
 using Hotline.Share.Dtos.CallCenter;
@@ -47,7 +48,7 @@ namespace Hotline.Application.Handlers.CallCenter
                                     Menu = new OuterToMenuMenu() { Id = tomenuId },
                                     Outer = new OuterToMenuOuter() { Id = model.ConversationId },
                                     //VoiceFile = string.IsNullOrEmpty(ivrAnswer.PreVoice) ? "" : ivrAnswer.PreVoice,
-                                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                             case ECallType.VisitorCallIn:
                                 await _newRockClient.VisitorToMenu(new VisitorToMenuRequest()
@@ -56,7 +57,7 @@ namespace Hotline.Application.Handlers.CallCenter
                                     Menu = new VisitorToMenuMenu() { Id = tomenuId },
                                     Visitor = new VisitorToMenuVisitor() { Id = model.ConversationId },
                                     //VoiceFile = string.IsNullOrEmpty(ivrAnswer.PreVoice) ? "" : ivrAnswer.PreVoice,
-                                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                             default:
                                 throw new ArgumentOutOfRangeException();
@@ -80,7 +81,7 @@ namespace Hotline.Application.Handlers.CallCenter
                                     Attribute = "Queue",
                                     Ext = new VisitorToExtQueueExt() { Id = telNo },
                                     Visitor = new VisitorToExtQueueVisitor() { Id = model.ConversationId }
-                                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                             case ECallType.ExtToOuter:
                                 await _newRockClient.OuterToExt(new OuterToExtRequest()
@@ -88,7 +89,7 @@ namespace Hotline.Application.Handlers.CallCenter
                                     Attribute = "Connect",
                                     Ext = new OuterToExtExt() { Id = telNo },
                                     Outer = new OuterToExtOuter() { Id = model.ConversationId }
-                                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                             default:
                                 throw new ArgumentOutOfRangeException();
@@ -103,7 +104,7 @@ namespace Hotline.Application.Handlers.CallCenter
                             Attribute = "Queue",
                             Group = new VisitorToGroupQueueGroup() { Id = groupId },
                             Visitor = new VisitorToGroupQueueVisitor() { Id = model.ConversationId }
-                        }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                        }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
 
                         //处理队列记录
                         _callCacheManager.AddCallCache(model);
@@ -125,7 +126,7 @@ namespace Hotline.Application.Handlers.CallCenter
                                         //TODO DISPLAY属性待定
                                     }
                                 },
-                                    _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                    _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                             case ECallType.ExtToOuter:
                                 await _newRockClient.OuterToOuter(new OuterToOuterRequest()
@@ -135,7 +136,7 @@ namespace Hotline.Application.Handlers.CallCenter
                                         new(){Id = model.ConversationId},
                                             new(){To = phoneNo},
                                         }
-                                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                             default:
                                 throw new ArgumentOutOfRangeException();
@@ -150,14 +151,14 @@ namespace Hotline.Application.Handlers.CallCenter
                                 {
                                     Attribute = "Clear",
                                     Visitor = new ClearCallVisitor() { Id = model.ConversationId },
-                                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                             case ECallType.ExtToOuter:
                                 await _newRockClient.ClearCall(new ClearCallRequest()
                                 {
                                     Attribute = "Clear",
                                     Outer = new ClearCallOuter() { Id = model.ConversationId },
-                                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                                 break;
                         }
                         break;

+ 1 - 0
src/Hotline.Application/Handlers/CallCenter/CallState/DtmfNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Ivrs;
 using Hotline.Realtimes;

+ 1 - 0
src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnOuterToMenuNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Ivrs;
 using Hotline.Realtimes;

+ 1 - 0
src/Hotline.Application/Handlers/CallCenter/FlowControl/EndOfAnnVisitorToMenuNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.CallCenter.Ivrs;
 using Hotline.Realtimes;

+ 3 - 2
src/Hotline.Application/Handlers/CallCenter/FlowControl/IncomingNotificationHandler.cs

@@ -1,5 +1,6 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.Realtimes;
 using Hotline.Settings;
@@ -104,7 +105,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                                     Menu = new VisitorToMenuMenu() { Id = ivr.No },
                                     Visitor = new VisitorToMenuVisitor() { Id = notification.Visitor.Id }
                                 },
-                                _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                                _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
 
                             //写入进入IVR流程
                             model.InIvrTime = DateTime.Now;
@@ -130,7 +131,7 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                                 Visitor = new VisitorToGroupQueueVisitor() { Id = notification.Visitor.Id },
                                 Group = new VisitorToGroupQueueGroup() { Id = correct.ReturnValue }
                             },
-                            _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                            _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
                             model.InQueueTime = DateTime.Now;
                             await _callRepository.UpdateAsync(model, cancellationToken);
                             //处理队列记录

+ 3 - 2
src/Hotline.Application/Handlers/CallCenter/FlowControl/InviteNotificationHandler.cs

@@ -1,6 +1,7 @@
 using Hotline.Caching.Interfaces;
 using Hotline.CallCenter.BlackLists;
 using Hotline.CallCenter.Calls;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.Settings;
 using Hotline.Share.Enums.CallCenter;
@@ -89,14 +90,14 @@ namespace Hotline.Application.Handlers.CallCenter.FlowControl
                     {
                         Id = notification.Visitor.Id
                     }
-                }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
             }
             else
             {
                 await _newRockClient.AcceptVisitor(
                     new AcceptVisitorRequest()
                     { Attribute = "Accept", Visitor = new AcceptVisitorModel() { Id = notification.Visitor.Id } },
-                    _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                    _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
             }
         }
     }

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

@@ -22,6 +22,7 @@
     <ProjectReference Include="..\Hotline\Hotline.csproj" />
     <ProjectReference Include="..\Tr.Sdk\Tr.Sdk.csproj" />
     <ProjectReference Include="..\XF.EasyCaching\XF.EasyCaching.csproj" />
+    <ProjectReference Include="..\XingTang.Sdk\XingTang.Sdk.csproj" />
   </ItemGroup>
 
 </Project>

+ 8 - 7
src/Hotline.Application/Jobs/ReloadTotalsJob.cs → src/Hotline.Application/Jobs/GetCallsJob.cs

@@ -1,29 +1,30 @@
 using Quartz;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Hotline.Repository.SqlSugar;
 using XF.Domain.Cache;
 
 namespace Hotline.Application.Jobs
 {
     /// <summary>
-    /// 刷新总数
+    /// 查询通话记录
     /// </summary>
-    public class ReloadTotalsJob : IJob, IDisposable
+    public class GetCallsJob : IJob, IDisposable
     {
-        private const string totalCachePrefix = "TotalsCache:";
-        private readonly ITypedCache<int> _totalsCache;
+        private readonly ISugarUnitOfWork<XingTangDbContext> _uow;
 
-        public ReloadTotalsJob(ITypedCache<int> totalsCache)
+        public GetCallsJob(ISugarUnitOfWork<XingTangDbContext> uow)
         {
-            _totalsCache = totalsCache;
+            _uow = uow;
         }
 
         public async Task Execute(IJobExecutionContext context)
         {
-            throw new NotImplementedException();
+            
         }
 
         /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>

+ 95 - 86
src/Hotline.NewRock/DeviceManager.cs

@@ -19,6 +19,7 @@ using Group = NewRock.Sdk.Control.Request.Group;
 using Hotline.Share.Dtos.CallCenter;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Caching.Interfaces;
+using Hotline.CallCenter.Configs;
 
 namespace Hotline.NewRock
 {
@@ -33,7 +34,15 @@ namespace Hotline.NewRock
         private readonly ITelRestRepository _telRestRepository;
         private readonly ITelCacheManager _telCacheManager;
 
-        public DeviceManager(INewRockClient newRockClient, IOptionsSnapshot<CallCenterConfiguration> options, IMapper mapper, ICallRepository callRepository, ITelGroupRepository telGroupRepository,IUserCacheManager userCacheManager, ITelRestRepository telRestRepository, ITelCacheManager telCacheManager)
+        public DeviceManager(
+            INewRockClient newRockClient, 
+            IOptionsSnapshot<CallCenterConfiguration> options, 
+            IMapper mapper, 
+            ICallRepository callRepository, 
+            ITelGroupRepository telGroupRepository,
+            IUserCacheManager userCacheManager, 
+            ITelRestRepository telRestRepository,
+            ITelCacheManager telCacheManager)
         {
             _newRockClient = newRockClient;
             _options = options;
@@ -53,7 +62,7 @@ namespace Hotline.NewRock
             {
                 var result = await _newRockClient.QueryExt(
                 new QueryExtRequest() { Attribute = "Query", Ext = new Ext { Id = TelNo } },
-                _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
 
                 if (result?.Ext.Outer != null)
                 {
@@ -127,7 +136,7 @@ namespace Hotline.NewRock
         {
             var result = await _newRockClient.QueryExt(
                 new QueryExtRequest() { Attribute = "Query", Ext = new Ext { Id = TelNo } },
-                _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+                _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
 
             switch (result.Ext.State)
             {
@@ -156,8 +165,8 @@ namespace Hotline.NewRock
         {
             var result = await _newRockClient.QueryDeviceInfo(
                 new QueryDeviceInfoRequest { Attribute = "Query", DeviceInfo = string.Empty },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
             var exts = result.Devices.Ext;
             return _mapper.Map<List<Tel>>(exts);
@@ -172,8 +181,8 @@ namespace Hotline.NewRock
         {
             var result = await _newRockClient.QueryDeviceInfo(
                 new QueryDeviceInfoRequest { Attribute = "Query", DeviceInfo = string.Empty },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
 
             var groups = result.Devices.Group;
@@ -191,8 +200,8 @@ namespace Hotline.NewRock
                 {
                     Attribute = "Query",
                     VoiceFile = "",
-                }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
             return result?.VoiceFile;
         }
@@ -201,8 +210,8 @@ namespace Hotline.NewRock
         {
             await _newRockClient.QueryExtGroup(new QueryExtGroupRequest()
                 { Attribute = "Query", Group = new QueryExtGroup() { Id = groupId } },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken
             );
         }
@@ -223,8 +232,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Query",
                 Ext = new Ext() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-            _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+            _options.Value.NewRock.Expired,
             cancellationToken);
 
             if (telModel == null)
@@ -232,8 +241,8 @@ namespace Hotline.NewRock
 
             await _newRockClient.ConfigExt(
                 new AssginConfigExtRequest() { Attribute = "Assign", Ext = new ConfigExt() { Lineid = telModel.Ext.LineId, Groups=Enumerable.Select<QueryExtGroup, string>(telModel.Ext.Group, x=>x.Id).ToList(), No_Disturb = "On" } },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -249,8 +258,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Query",
                 Ext = new Ext() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
 
             if (telModel == null)
@@ -258,8 +267,8 @@ namespace Hotline.NewRock
 
             await _newRockClient.ConfigExt(
                 new AssginConfigExtRequest() { Attribute = "Assign", Ext = new ConfigExt() { Lineid = telModel.Ext.LineId, Groups = Enumerable.Select<QueryExtGroup, string>(telModel.Ext.Group, x => x.Id).ToList(), No_Disturb = "Off" } },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -275,8 +284,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Remove",
                 VoiceFile = voiceName
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -318,8 +327,8 @@ namespace Hotline.NewRock
                     Exit = exit,
                     Repeat = repeat,
                 }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -367,8 +376,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Assign",
                 Group = groupModel
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -391,7 +400,7 @@ namespace Hotline.NewRock
 
             #region 清除分机组设置
 
-            await _newRockClient.ConfigExtGroup(new AssginConfigGroupRequest() { Attribute = "Assign", Group = new Group() { Id = groupId } }, _options.Value.DeviceConfigs.ReceiveKey, _options.Value.DeviceConfigs.Expired, cancellationToken);
+            await _newRockClient.ConfigExtGroup(new AssginConfigGroupRequest() { Attribute = "Assign", Group = new Group() { Id = groupId } }, _options.Value.NewRock.ReceiveKey, _options.Value.NewRock.Expired, cancellationToken);
 
             #endregion
 
@@ -445,8 +454,8 @@ namespace Hotline.NewRock
             groupModel.Ext = exts;
             await _newRockClient.ConfigExtGroup(
                 new AssginConfigGroupRequest() { Attribute = "Assign", Group = groupModel, },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken
                 );
         }
@@ -464,8 +473,8 @@ namespace Hotline.NewRock
                 {
                     Attribute = "Query",
                     Ext = new Ext() { Id = telNo }
-                }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
 
             if (telModel == null)
@@ -473,8 +482,8 @@ namespace Hotline.NewRock
 
             await _newRockClient.ConfigExt(
                 new AssginConfigExtRequest() { Attribute = "Assign", Ext = new ConfigExt() { Id = telNo,Lineid = lineId, Staffid = staffNo } },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
         #endregion
@@ -490,8 +499,8 @@ namespace Hotline.NewRock
         public async Task HoldAsync(string telNo, CancellationToken cancellationToken)
         {
             await _newRockClient.HoldOrUnHold(
-                new HoldSetRequest() { Attribute = "Hold", Ext = new Ext() { Id = telNo } }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                new HoldSetRequest() { Attribute = "Hold", Ext = new Ext() { Id = telNo } }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -504,8 +513,8 @@ namespace Hotline.NewRock
         public async Task UnHoldAsync(string telNo, CancellationToken cancellationToken)
         {
             await _newRockClient.HoldOrUnHold(
-                new HoldSetRequest() { Attribute = "Unhold", Ext = new Ext() { Id = telNo } }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                new HoldSetRequest() { Attribute = "Unhold", Ext = new Ext() { Id = telNo } }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -518,8 +527,8 @@ namespace Hotline.NewRock
         public async Task MuteAsync(string telNo, CancellationToken cancellationToken)
         {
             await _newRockClient.MuteOrUnMute(
-                new MuteSetRequest() { Attribute = "Mute", Ext = new Ext() { Id = telNo } }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                new MuteSetRequest() { Attribute = "Mute", Ext = new Ext() { Id = telNo } }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -533,8 +542,8 @@ namespace Hotline.NewRock
         {
             await _newRockClient.MuteOrUnMute(
                 new MuteSetRequest() { Attribute = "Unmute", Ext = new Ext() { Id = telNo } },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -553,8 +562,8 @@ namespace Hotline.NewRock
                 {
                     Id = extId
                 }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -570,8 +579,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Clear",
                 Visitor = new ClearCallVisitor() { Id = visitorId }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -587,8 +596,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Clear",
                 Outer = new ClearCallOuter() { Id = outerId }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -604,8 +613,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Accept",
                 Visitor = new AcceptVisitorModel() { Id = visitorId }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
         #endregion
@@ -626,8 +635,8 @@ namespace Hotline.NewRock
                 {
                     Attribute = "Connect",
                     Exts = new List<ExtToExtExt>() { new ExtToExtExt() { Id = from }, new ExtToExtExt() { Id = to } }
-                }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -649,8 +658,8 @@ namespace Hotline.NewRock
                         Outer = new ExtToOuterOuterRequest() { To = to },
                         Trunk = new ExtToOuterTrunkRequest() { Id = trunkid }
                     },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -669,8 +678,8 @@ namespace Hotline.NewRock
                 Attribute = "Connect",
                 Visitor = new VisitorToExtVisitor() { Id = visitorId },
                 Ext = new VisitorToExtExt() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -691,8 +700,8 @@ namespace Hotline.NewRock
                 Visitor = new VisitorToOuterVisitor() { Id = visitorId },
                 Outer = new VisitorToOuterOuter() { To = outerPhoneNum, Display = display },
 
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -711,8 +720,8 @@ namespace Hotline.NewRock
                 Attribute = "Connect",
                 Visitor = new VisitorToMenuVisitor() { Id = visitorId },
                 Menu = new VisitorToMenuMenu() { Id = menuId }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -730,8 +739,8 @@ namespace Hotline.NewRock
                 Attribute = "Queue",
                 Visitor = new VisitorToGroupQueueVisitor() { Id = visitorId },
                 Group = new VisitorToGroupQueueGroup() { Id = groupId }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -750,8 +759,8 @@ namespace Hotline.NewRock
                 Outer = new OuterToExtOuter() { Id = outerId },
                 Ext = new OuterToExtExt() { Id = telNo }
             },
-                _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -772,8 +781,8 @@ namespace Hotline.NewRock
                         new OuterToOuterOuterModel() { Id = outerId },
                         new OuterToOuterOuterModel() { To = outerPhoneNum }
                     },
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -792,8 +801,8 @@ namespace Hotline.NewRock
                 Attribute = "Connect",
                 Menu = new MenuToExtMenu() { Id = menuId },
                 Ext = new MenuToExtExt() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -812,8 +821,8 @@ namespace Hotline.NewRock
                 Attribute = "Connect",
                 Menu = new MenuToOuterMenu() { Id = menuId },
                 Outer = new MenuToOuterOuter() { To = outerPhoneNum }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -834,8 +843,8 @@ namespace Hotline.NewRock
                         new TwoWayOuterOuter(){ To = outerOne},
                         new TwoWayOuterOuter(){ To = outerTwo}
                     }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -853,8 +862,8 @@ namespace Hotline.NewRock
                 Attribute = "Connect",
                 VoiceFile = voiceFileName,
                 Ext = new VoiceNewsFlashExt() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -874,8 +883,8 @@ namespace Hotline.NewRock
                     Attribute = "Connect",
                     VoiceFile = voiceFileName,
                     Visitor = new VoiceNewsFlashVisitor() { Id = visitorId }
-                }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -894,8 +903,8 @@ namespace Hotline.NewRock
                     Attribute = "Connect",
                     VoiceFile = voiceFileName,
                     Outer = new VoiceNewsFlashOuter() { Id = outerId }
-                }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+                }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -911,8 +920,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Conference",
                 Ext = new ConferenceMeetingExt() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-                _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+                _options.Value.NewRock.Expired,
                 cancellationToken);
         }
 
@@ -950,8 +959,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Monitor",
                 Exts = new List<Ext>() { new Ext() { Id=firstTelNo },new Ext() { Id=secondTelNo } }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-             _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+             _options.Value.NewRock.Expired,
              cancellationToken) ;
         }
 
@@ -970,8 +979,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Talk",
                 Ext = new Ext() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-              _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+              _options.Value.NewRock.Expired,
               cancellationToken) ;
         }
 
@@ -991,8 +1000,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Listen",
                 Ext = new Ext() { Id = telNo }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-              _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+              _options.Value.NewRock.Expired,
               cancellationToken);
         }
 
@@ -1017,8 +1026,8 @@ namespace Hotline.NewRock
             {
                 Attribute = "Bargein",
                 Exts = new List<Ext>() { new Ext() { Id = firstTelNo },new Ext() { Id=secondTelNo } }
-            }, _options.Value.DeviceConfigs.ReceiveKey,
-              _options.Value.DeviceConfigs.Expired,
+            }, _options.Value.NewRock.ReceiveKey,
+              _options.Value.NewRock.Expired,
               cancellationToken);
         }
 

+ 9 - 7
src/Hotline.NewRock/Handlers/DeviceEventHandler.cs

@@ -1,10 +1,12 @@
 using System.Security.Authentication;
 using Hotline.CallCenter;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Hotline.Share.Notifications.NewRockCallCenter;
 using MapsterMapper;
 using MediatR;
 using Microsoft.Extensions.Logging;
+using NewRock.Sdk;
 using NewRock.Sdk.Events;
 using NewRock.Sdk.Extensions;
 using NewRock.Sdk.Security;
@@ -29,7 +31,7 @@ namespace Hotline.NewRock.Handlers
             _logger = logger;
         }
 
-        public async Task HandleAsync(Stream eventStream, CallCenterConfiguration deviceConfigs,
+        public async Task HandleAsync(Stream eventStream, NewRockConfiguration newRockConfiguration,
             CancellationToken cancellationToken)
         {
             var sr = new StreamReader(eventStream);
@@ -42,8 +44,8 @@ namespace Hotline.NewRock.Handlers
                 //通话记录报告
                 var eventBase = content.DeserializeWithAuthorize<NewRockCdrEvent>();
                 if (eventBase.value == null) return;
-                if (deviceConfigs.DeviceConfigs.Authorize && (eventBase.authorize == null ||
-                                                !eventBase.authorize.IsAuthorized(deviceConfigs.DeviceConfigs.SendKey)))
+                if (newRockConfiguration.Authorize && (eventBase.authorize == null ||
+                                                       !eventBase.authorize.IsAuthorized(newRockConfiguration.SendKey)))
                     throw new AuthenticationException("无有效身份认证信息");
 
                 var cdrRcv = content.DeserializeWithAuthorize<CdrEvent>();
@@ -53,8 +55,8 @@ namespace Hotline.NewRock.Handlers
             {
                 var eventBase = content.DeserializeWithAuthorize<NewRockEvent>();
                 if (eventBase.value == null) return;
-                if (deviceConfigs.DeviceConfigs.Authorize && (eventBase.authorize == null ||
-                                                !eventBase.authorize.IsAuthorized(deviceConfigs.DeviceConfigs.SendKey)))
+                if (newRockConfiguration.Authorize && (eventBase.authorize == null ||
+                                                       !eventBase.authorize.IsAuthorized(newRockConfiguration.SendKey)))
                     throw new AuthenticationException("无有效身份认证信息");
 
                 switch (eventBase.value.Attribute)
@@ -191,7 +193,7 @@ namespace Hotline.NewRock.Handlers
                     case Event.BYE:
                         var byeRcv = content.DeserializeWithAuthorize<ByeEvent>();
                         //来电和分机的通话结束,来电挂断
-                        if (byeRcv.value?.Ext.Count==1 && byeRcv.value?.Visitor != null)
+                        if (byeRcv.value?.Ext.Count == 1 && byeRcv.value?.Visitor != null)
                         {
                             await _mediator.Publish(_mapper.Map<ByeVisitorAndExtNotification>(byeRcv.value!),
                                 cancellationToken);
@@ -209,7 +211,7 @@ namespace Hotline.NewRock.Handlers
                                 cancellationToken);
                         }
                         //分机和分机结束通话,挂断
-                        else if(byeRcv.value?.Ext.Count==2)
+                        else if (byeRcv.value?.Ext.Count == 2)
                         {
                             await _mediator.Publish(_mapper.Map<ByeExtAndExtNotification>(byeRcv.value!), cancellationToken);
                         }

+ 13 - 0
src/Hotline.NewRock/IDeviceEventHandler.cs

@@ -0,0 +1,13 @@
+using Hotline.CallCenter.Configs;
+using NewRock.Sdk;
+
+namespace Hotline.NewRock
+{
+    /// <summary>
+    /// 处理设备事件
+    /// </summary>
+    public interface IDeviceEventHandler
+    {
+        Task HandleAsync(Stream eventStream, NewRockConfiguration newRockConfiguration, CancellationToken cancellationToken);
+    }
+}

+ 7 - 4
src/Hotline.NewRock/NewRockStartupExtensions.cs

@@ -1,20 +1,23 @@
-using Hotline.NewRock.Mappers;
+using Hotline.CallCenter.Configs;
+using Hotline.NewRock.Mappers;
 using Mapster;
+using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using NewRock.Sdk;
+using XF.Domain.Options;
 
 namespace Hotline.NewRock
 {
     public static class NewRockStartupExtensions
     {
-        public static IServiceCollection AddNewRock(this IServiceCollection services, string deviceAddress)
+        public static IServiceCollection AddNewRock(this IServiceCollection services, NewRockConfiguration newrockConfig)
         {
             services
-                .AddNewRockSdk(deviceAddress)
+                .AddNewRockSdk(newrockConfig.Address)
                 ;
 
             TypeAdapterConfig.GlobalSettings.Scan(typeof(EventConfigs).Assembly);
-
+            
             return services;
         }
     }

+ 24 - 0
src/Hotline.Repository.SqlSugar/Extensions/XingTangDbExtensions.cs

@@ -0,0 +1,24 @@
+using Hotline.CallCenter.Configs;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using SqlSugar;
+
+namespace Hotline.Repository.SqlSugar.Extensions;
+
+public static class XingTangDbExtensions
+{
+    public static void AddXingTangDb(this IServiceCollection services, XingTangConfiguration xingTangConfiguration)
+    {
+        SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig()
+        {
+            DbType = DbType.MySql,
+            ConnectionString = xingTangConfiguration.DbConnectionString,
+            IsAutoCloseConnection = true,
+        },
+             db => { }
+         );
+
+        ISugarUnitOfWork<XingTangDbContext> context = new SugarUnitOfWork<XingTangDbContext>(sqlSugar);
+        services.AddSingleton(context);
+    }
+}

+ 8 - 0
src/Hotline.Repository.SqlSugar/XingTangDbContext.cs

@@ -0,0 +1,8 @@
+using SqlSugar;
+
+namespace Hotline.Repository.SqlSugar;
+
+public class XingTangDbContext : SugarUnitOfWork
+{
+
+}

+ 5 - 3
src/Hotline.Wex/WexStartupExtensions.cs

@@ -3,6 +3,8 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Hotline.CallCenter.Configs;
+using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Wex.Sdk;
 
@@ -10,10 +12,10 @@ namespace Hotline.Wex
 {
     public static class WexStartupExtensions
     {
-        public static IServiceCollection AddWex(this IServiceCollection services, string wexAddress)
+        public static IServiceCollection AddWex(this IServiceCollection services, WexConfiguration wexConfig)
         {
-            services.AddWexSdk(wexAddress);
-
+            services.AddWexSdk(wexConfig.Address);
+            
             return services;
         }
     }

+ 1 - 1
src/Hotline.Wex/WexTokenManager.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Hotline.CallCenter.Configs;
 using Hotline.CallCenter.Devices;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Options;
@@ -10,7 +11,6 @@ using Wex.Sdk;
 using XF.Domain.Cache;
 using XF.Domain.Dependency;
 using XF.Domain.Exceptions;
-using static System.Formats.Asn1.AsnWriter;
 
 namespace Hotline.Wex
 {

+ 14 - 0
src/Hotline/CallCenter/Configs/CallCenterConfiguration.cs

@@ -0,0 +1,14 @@
+namespace Hotline.CallCenter.Configs;
+
+public class CallCenterConfiguration
+{
+    public string CallCenterType { get; set; }
+
+    public NewRockConfiguration NewRock { get; set; }
+
+    public WexConfiguration Wex { get; set; }
+
+    public TianrunConfiguration TianRun { get; set; }
+
+    public XingTangConfiguration XingTang { get; set; }
+}

+ 2 - 2
src/Hotline/CallCenter/Devices/DeviceConfigs.cs → src/Hotline/CallCenter/Configs/NewRockConfiguration.cs

@@ -1,6 +1,6 @@
-namespace Hotline.CallCenter.Devices
+namespace Hotline.CallCenter.Configs
 {
-    public class DeviceConfigs
+    public class NewRockConfiguration
     {
         public string Address { get; set; }
         public bool Authorize { get; set; }

+ 2 - 2
src/Tr.Sdk/TrConfiguration.cs → src/Hotline/CallCenter/Configs/TianrunConfiguration.cs

@@ -1,6 +1,6 @@
-namespace Tr.Sdk;
+namespace Hotline.CallCenter.Configs;
 
-public class TrConfiguration
+public class TianrunConfiguration
 {
     public string Address { get; set; }
     public string Username { get; set; }

+ 1 - 1
src/Wex.Sdk/WexConfiguration.cs → src/Hotline/CallCenter/Configs/WexConfiguration.cs

@@ -1,4 +1,4 @@
-namespace Wex.Sdk;
+namespace Hotline.CallCenter.Configs;
 
 public class WexConfiguration
 {

+ 7 - 0
src/Hotline/CallCenter/Configs/XingTangConfiguration.cs

@@ -0,0 +1,7 @@
+namespace Hotline.CallCenter.Configs
+{
+    public class XingTangConfiguration
+    {
+        public string DbConnectionString { get; set; }
+    }
+}

+ 0 - 10
src/Hotline/CallCenter/Devices/CallCenterConfiguration.cs

@@ -1,10 +0,0 @@
-namespace Hotline.CallCenter.Devices;
-
-public class CallCenterConfiguration
-{
-    public string CallCenterType { get; set; }
-
-    public DeviceConfigs DeviceConfigs { get; set; }
-
-    public WexConfiguration Wex { get; set; }
-}

+ 0 - 8
src/Hotline/CallCenter/Devices/WexConfiguration.cs

@@ -1,8 +0,0 @@
-namespace Hotline.CallCenter.Devices;
-
-public class WexConfiguration
-{
-    public string Address { get; set; }
-    public string Username { get; set; }
-    public string Password { get; set; }
-}

+ 0 - 12
src/Hotline/CallCenter/IDeviceEventHandler.cs

@@ -1,12 +0,0 @@
-using Hotline.CallCenter.Devices;
-
-namespace Hotline.CallCenter
-{
-    /// <summary>
-    /// 处理设备事件
-    /// </summary>
-    public interface IDeviceEventHandler
-    {
-        Task HandleAsync(Stream eventStream, CallCenterConfiguration deviceConfigs, CancellationToken cancellationToken);
-    }
-}

+ 1 - 0
src/Hotline/CallCenter/Tels/TelDomainService.cs

@@ -8,6 +8,7 @@ using XF.Domain.Dependency;
 using XF.Domain.Exceptions;
 using Hotline.Share.Enums.CallCenter;
 using Hotline.Caching.Interfaces;
+using Hotline.CallCenter.Configs;
 using Microsoft.Extensions.Options;
 using Hotline.Share.Dtos.CallCenter;
 

+ 5 - 0
src/Hotline/Users/User.cs

@@ -48,6 +48,11 @@ namespace Hotline.Users
         /// </summary>
         public string? DefaultTelNo { get; set; }
 
+        /// <summary>
+        /// 默认分机组(技能组)
+        /// </summary>
+        public string? DefaultTelGroup { get; set; }
+
         /// <summary>
         /// 用户类型
         /// </summary>

+ 1 - 1
src/NewRock.Sdk/Security/AuthorizeGenerator.cs

@@ -22,7 +22,7 @@ namespace NewRock.Sdk.Security
         public NewRockAuthorize GetAuthorize(string key, int expired)
         {
             using var scope = _serviceScopeFactory.CreateScope();
-            //var options = scope.ServiceProvider.GetService<IOptionsSnapshot<DeviceConfigs>>();
+            //var options = scope.ServiceProvider.GetService<IOptionsSnapshot<NewRockConfiguration>>();
             var mapper = scope.ServiceProvider.GetService<IMapper>();
             //var key = options.Value.ReceiveKey;
 

+ 9 - 0
src/XingTang.Sdk/XingTang.Sdk.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net7.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>