Bitzsoft.Integrations.TencentCcc 1.0.0-alpha.5

This is a prerelease version of Bitzsoft.Integrations.TencentCcc.
dotnet add package Bitzsoft.Integrations.TencentCcc --version 1.0.0-alpha.5
                    
NuGet\Install-Package Bitzsoft.Integrations.TencentCcc -Version 1.0.0-alpha.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.TencentCcc" Version="1.0.0-alpha.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.TencentCcc" Version="1.0.0-alpha.5" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.TencentCcc" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.TencentCcc --version 1.0.0-alpha.5
                    
#r "nuget: Bitzsoft.Integrations.TencentCcc, 1.0.0-alpha.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.TencentCcc@1.0.0-alpha.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.TencentCcc&version=1.0.0-alpha.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.TencentCcc&version=1.0.0-alpha.5&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.TencentCcc

腾讯云呼叫中心集成客户端 — TCLOUD SDK 封装、多租户配置、调用日志拦截。

功能特性

  • TCLOUD SDK 封装 — 基于 TencentCloudSDK.Common 封装 70+ 个 API 端点,覆盖自动外呼、预测式外呼、座席管理、话机管理、通话会话、号码管理、公司资质、SDK 鉴权、实时指标等模块
  • 多租户支持 — 通过 ITencentCccOptionsProvider 按租户动态解析配置(SecretId/SecretKey/Region),默认实现从静态配置读取,宿主层可替换为数据库解析
  • 调用日志拦截 — 可选 ITencentCccCallLogger 拦截器,统一记录每次 API 调用的请求/响应/耗时/异常,便于排查与审计
  • 异常统一包装 — 腾讯云 SDK 内部异常自动包装为 TencentCccException,宿主层无需直接引用 TencentCloudSDK.Common
  • 工厂模式创建客户端ITencentCccClientFactory 按租户动态创建客户端实例,客户端无状态,可安全频繁创建
  • SDK 鉴权集成 — 内置管理端 URL 生成、SDK Login Token 创建、UserSig 签名等鉴权方法

安装

dotnet add package Bitzsoft.Integrations.TencentCcc
<PackageReference Include="Bitzsoft.Integrations.TencentCcc" Version="*" />

配置

{
  "TencentCcc": {
    "SecretId": "YOUR_SECRET_ID",
    "SecretKey": "YOUR_SECRET_KEY",
    "Region": "ap-guangzhou",
    "SdkAppId": "1400000000",
    "CnIvrId": "100",
    "EnIvrId": "200",
    "Callers": "020-12345678,020-87654321",
    "Callees": "",
    "OverseaSdkAppId": null,
    "OverseaCnIvrId": null,
    "OverseaEnIvrId": null,
    "OverseaCallers": null,
    "OverseaCallees": null
  }
}
配置项 类型 默认值 说明
SecretId string "" 腾讯云 SecretId
SecretKey string "" 腾讯云 SecretKey
Region string "ap-guangzhou" 地域
SdkAppId string "" SDK 应用 ID
CnIvrId string "" 中文 IVR 流程 ID
EnIvrId string "" 英文 IVR 流程 ID
Callers string "" 主叫号码列表(逗号分隔)
Callees string "" 被叫号码列表(逗号分隔)
OverseaSdkAppId string? null 海外 SDK 应用 ID
OverseaCnIvrId string? null 海外中文 IVR 流程 ID
OverseaEnIvrId string? null 海外英文 IVR 流程 ID
OverseaCallers string? null 海外主叫号码列表
OverseaCallees string? null 海外被叫号码列表

注册服务

单租户(静态配置)

using Bitzsoft.Integrations.TencentCcc;
using Bitzsoft.Integrations.TencentCcc.DependencyInjection;

// 方式一:使用默认配置(从 appsettings.json 读取)
services.AddTNTTencentCcc();

// 方式二:代码配置
services.AddTNTTencentCcc(options =>
{
    options.SecretId = "YOUR_SECRET_ID";
    options.SecretKey = "YOUR_SECRET_KEY";
    options.Region = "ap-guangzhou";
    options.SdkAppId = "1400000000";
    options.CnIvrId = "100";
    options.Callers = "020-12345678";
});

多租户(动态配置)

using Bitzsoft.Integrations.TencentCcc;
using Bitzsoft.Integrations.TencentCcc.DependencyInjection;
using Bitzsoft.Integrations.TencentCcc.Interfaces;

// 注册核心服务
services.AddTNTTencentCcc();

// 替换默认配置解析器为数据库实现
services.Replace(new ServiceDescriptor(
    typeof(ITencentCccOptionsProvider),
    typeof(DatabaseTencentCccOptionsProvider),
    ServiceLifetime.Transient));

注意AddTNTTencentCcc 注册 ITencentCccOptionsProvider(默认从静态配置读取)和 ITencentCccClientFactory(Transient 生命周期)。腾讯云 CCC SDK 使用内置 HTTP 管道,不经过 IHttpClientFactory

可选:注册调用日志拦截器

using Bitzsoft.Integrations.TencentCcc.Interfaces;

// 注册日志拦截器(可选)
services.AddTransient<ITencentCccCallLogger, MyCallLogger>();

使用示例

创建自动外呼任务

using Bitzsoft.Integrations.TencentCcc.Interfaces;
using Bitzsoft.Integrations.TencentCcc.Models.Dtos;

public class OutboundCallService
{
    private readonly ITencentCccClientFactory _clientFactory;

    public OutboundCallService(ITencentCccClientFactory clientFactory)
    {
        _clientFactory = clientFactory;
    }

    public async Task CreateCalloutTaskAsync(string tenantId, CancellationToken ct)
    {
        // 按租户创建客户端
        var client = await _clientFactory.CreateAsync(tenantId, ct);

        // 构建外呼任务请求
        var request = new CreateAutoCalloutTaskRequest
        {
            SdkAppId = 1400000000,
            Name = "客户回访任务",
            Description = "2024年Q4客户满意度回访",
            NotBefore = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
            Callers = new[] { "020-12345678" },
            Callees = new[] { "13800138001", "13800138002", "13800138003" },
            IvrId = 100,
            Tries = 3
        };

        var response = await client.CreateAutoCalloutTask(request);
        Console.WriteLine($"外呼任务已创建,TaskId: {response?.TaskId}");
    }
}

查询通话记录

using Bitzsoft.Integrations.TencentCcc.Interfaces;
using Bitzsoft.Integrations.TencentCcc.Models.Dtos;

public class CallRecordService
{
    private readonly ITencentCccClientFactory _clientFactory;

    public CallRecordService(ITencentCccClientFactory clientFactory)
    {
        _clientFactory = clientFactory;
    }

    public async Task QueryCallRecordsAsync(string tenantId, CancellationToken ct)
    {
        var client = await _clientFactory.CreateAsync(tenantId, ct);

        var request = new DescribeTelCdrRequest
        {
            SdkAppId = 1400000000,
            PageSize = 50,
            PageNumber = 0,
            StartTimeStamp = DateTimeOffset.UtcNow.AddDays(-7).ToUnixTimeSeconds(),
            EndTimeStamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
        };

        var response = await client.DescribeTelCdr(request);
        Console.WriteLine($"查询到 {response?.TotalCount ?? 0} 条通话记录");
    }
}

座席管理与实时指标

using Bitzsoft.Integrations.TencentCcc.Interfaces;
using Bitzsoft.Integrations.TencentCcc.Models.Dtos;

public class StaffManagementService
{
    private readonly ITencentCccClientFactory _clientFactory;

    public StaffManagementService(ITencentCccClientFactory clientFactory)
    {
        _clientFactory = clientFactory;
    }

    public async Task ManageStaffAsync(string tenantId, CancellationToken ct)
    {
        var client = await _clientFactory.CreateAsync(tenantId, ct);

        // 创建座席
        var createResult = await client.CreateStaff(new CreateStaffRequest
        {
            SdkAppId = 1400000000,
            // 填入座席信息
        });

        // 绑定技能组
        await client.BindStaffSkillGroupList(new BindStaffSkillGroupListRequest
        {
            SdkAppId = 1400000000,
            // 填入绑定参数
        });

        // 查询座席实时状态
        var metrics = await client.DescribeStaffStatusMetrics(
            new DescribeStaffStatusMetricsRequest
            {
                SdkAppId = 1400000000
            });
    }
}

多租户配置解析器实现

using Bitzsoft.Integrations.TencentCcc;
using Bitzsoft.Integrations.TencentCcc.Interfaces;

public class DatabaseTencentCccOptionsProvider : ITencentCccOptionsProvider
{
    private readonly ITenantConfigRepository _repository;

    public DatabaseTencentCccOptionsProvider(ITenantConfigRepository repository)
    {
        _repository = repository;
    }

    public async Task<TencentCccOptions> GetOptionsAsync(
        string? tenantId = null, CancellationToken ct = default)
    {
        var config = await _repository.GetByTenantIdAsync(tenantId!, ct);

        return new TencentCccOptions
        {
            SecretId = config.SecretId,
            SecretKey = config.SecretKey,
            Region = config.Region ?? "ap-guangzhou",
            SdkAppId = config.SdkAppId,
            CnIvrId = config.CnIvrId,
            EnIvrId = config.EnIvrId,
            Callers = config.Callers,
            Callees = config.Callees
        };
    }
}

API 一览

模块 方法 说明
自动外呼 CreateAutoCalloutTask 创建自动外呼任务
DescribeAutoCalloutTask 查询自动外呼任务详情
DescribeAutoCalloutTasks 批量查询自动外呼任务
StopAutoCalloutTask 停止自动外呼任务
预测式外呼 CreatePredictiveDialingCampaign 创建预测式外呼任务
DescribePredictiveDialingCampaign 查询预测式外呼任务
DescribePredictiveDialingCampaigns 查询预测式外呼任务列表
DescribePredictiveDialingSessions 查询预测式外呼呼叫列表
PausePredictiveDialingCampaign 暂停预测式外呼任务
ResumePredictiveDialingCampaign 恢复预测式外呼任务
AbortPredictiveDialingCampaign 停止预测式外呼任务
UpdatePredictiveDialingCampaign 更新预测式外呼任务
DeletePredictiveDialingCampaign 删除预测式外呼任务
座席管理 CreateStaff 创建客服账号
ModifyStaff 修改客服账号
DeleteStaff 删除客服账号
DescribeStaffInfoList 获取座席信息列表
DescribeStaffStatusMetrics 获取座席实时状态指标
BindStaffSkillGroupList 绑定座席技能组
UnbindStaffSkillGroupList 解绑座席技能组
技能组 CreateCCCSkillGroup 创建技能组
DescribeSkillGroupInfoList 获取技能组列表
UpdateCCCSkillGroup 更新技能组
话机管理 CreateExtension 创建话机账号
ModifyExtension 修改话机账号
DeleteExtension 删除话机账号
DescribeExtension 获取话机信息
DescribeExtensions 查询话机列表
ResetExtensionPassword 重置话机注册密码
号码管理 DescribeNumbers 查询号码列表
BindNumberCallOutSkillGroup 绑定号码外呼技能组
UnbindNumberCallOutSkillGroup 解绑号码外呼技能组
DisableCCCPhoneNumber 停用号码
通话会话 CreateCallOutSession 创建外呼会话
HangUpCall 挂断电话
DescribePSTNActiveSessionList 获取正在通话的会话列表
DescribeTelSession 获取 PSTN 会话信息
DescribeTelCdr 获取电话服务记录与录音
DescribeProtectedTelCdr 获取主被叫脱敏的电话记录
DescribeTelCallInfo 获取电话消耗统计
DescribeIMCdrs 获取全媒体会话服务记录
DescribeIMCdrList 获取全媒体会话记录列表
DescribeChatMessages 获取文本聊天内容
公司与运营商 CreateCompanyApply 创建公司资质申请
DescribeCompanyList 查询公司资质列表
ModifyCompanyApply 修改公司资质申请
CreateCarrierPrivilegeNumberApplicant 创建运营商白名单申请
DescribeCarrierPrivilegeNumberApplicants 查询白名单申请状态
DescribeActiveCarrierPrivilegeNumber 查询生效白名单号码
SDK 鉴权 CreateAdminURL 创建管理端访问链接
CreateSDKLoginToken 创建 SDK 登录 Token
CreateUserSig 创建用户数据签名
实时指标 DescribeCallInMetrics 获取呼入实时数据统计
DescribeCCCBuyInfoList 查询购买信息

相关包

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.5 55 6/14/2026
1.0.0-alpha.3 54 6/7/2026
1.0.0-alpha.2 56 5/29/2026
1.0.0-alpha.1 56 5/28/2026