Bitzsoft.Integrations.OutboundCall.Aliyun
1.0.0
dotnet add package Bitzsoft.Integrations.OutboundCall.Aliyun --version 1.0.0
NuGet\Install-Package Bitzsoft.Integrations.OutboundCall.Aliyun -Version 1.0.0
<PackageReference Include="Bitzsoft.Integrations.OutboundCall.Aliyun" Version="1.0.0" />
<PackageVersion Include="Bitzsoft.Integrations.OutboundCall.Aliyun" Version="1.0.0" />
<PackageReference Include="Bitzsoft.Integrations.OutboundCall.Aliyun" />
paket add Bitzsoft.Integrations.OutboundCall.Aliyun --version 1.0.0
#r "nuget: Bitzsoft.Integrations.OutboundCall.Aliyun, 1.0.0"
#:package Bitzsoft.Integrations.OutboundCall.Aliyun@1.0.0
#addin nuget:?package=Bitzsoft.Integrations.OutboundCall.Aliyun&version=1.0.0
#tool nuget:?package=Bitzsoft.Integrations.OutboundCall.Aliyun&version=1.0.0
Bitzsoft.Integrations.OutboundCall.Aliyun
阿里云 CCC(云联络中心)外呼实现 — 基于 CCC REST API(ACS3-Legacy / V1.0 RPC 签名,HMAC-SHA1),实现 IOutboundCallService 统一接口。
功能特性
- 实现
IOutboundCallService统一接口:创建 / 启动 / 暂停 / 恢复 / 停止活动 + 活动列表 / 详情查询 + 话单查询(ListSessionsDetail) - 完整 Campaign 生命周期:
CreateCampaign→AddCampaignNumbers(导入)→SubmitCampaign(启动)→PauseCampaign/ResumeCampaign/AbortCampaign - 阿里云 V1.0 RPC 签名:ACS3-Legacy 风格,
HMAC-SHA1计算签名(stringToSign = host/?canonicalQuery),不依赖阿里云 SDK - 境内外主叫分离:基于
CreateCampaignRequest.Region选择Callers/OverseaCallers - 白名单 / 黑名单过滤:创建活动前自动过滤号码(复用
CallListFilter),过滤后无可用号码直接返回失败 - 活动状态映射:将阿里云活动状态(
idle/running/paused/completed/aborted/failed等)映射为统一CampaignStatus - 策略可配:支持
StrategyType(默认PID预测式)与StrategyJson透传阿里云专有策略参数
安装
.NET CLI
dotnet add package Bitzsoft.Integrations.OutboundCall.Aliyun
PackageReference
<PackageReference Include="Bitzsoft.Integrations.OutboundCall.Aliyun" Version="1.0.0" />
配置
appsettings.json
{
"OutboundCall": {
"AccessKeyId": "LTAI5txxxxxxxxxxxx",
"AccessKeySecret": "xxxxxxxxxxxxxxxxxxxxxxxx",
"Region": "cn-hangzhou",
"SdkAppId": "ccc-test",
"Callers": [ "0571xxxx" ],
"OverseaCallers": [],
"Whitelist": [ "5678" ],
"RequireWhitelistInNonProduction": true
}
}
| 配置项 | 说明 | 必填 | 默认值 |
|---|---|---|---|
AccessKeyId |
阿里云 AccessKeyId | 是 | 空字符串 |
AccessKeySecret |
阿里云 AccessKeySecret | 是 | 空字符串 |
Region |
地域(如 cn-hangzhou) |
否 | cn-hangzhou |
SdkAppId |
阿里云 CCC 实例 ID(InstanceId) | 是 | null |
Callers |
境内主叫号码列表 | 是 | 空列表 |
OverseaCallers |
境外主叫号码列表 | 否 | 空列表 |
Whitelist |
白名单(防误呼,支持后缀匹配) | 否 | null |
RequireWhitelistInNonProduction |
非生产环境强制白名单 | 否 | true |
注册服务
委托配置
using Bitzsoft.Integrations.OutboundCall;
// 命名空间 Microsoft.Extensions.DependencyInjection
builder.Services.AddAliyunOutboundCall(options =>
{
options.AccessKeyId = "LTAI5txxxxxxxxxxxx";
options.AccessKeySecret = "xxxxxxxxxxxxxxxxxxxxxxxx";
options.Region = "cn-hangzhou";
options.SdkAppId = "ccc-test"; // CCC 实例 ID(InstanceId)
options.Callers = new() { "0571xxxx" };
});
从 IConfiguration 绑定
builder.Services.AddAliyunOutboundCall(
builder.Configuration.GetSection("OutboundCall"));
说明:
AddAliyunOutboundCall接收Action<OutboundCallOptions>配置委托,绑定到OutboundCallOptions,注册AliyunOutboundCallService为 typed client(挂载请求审计日志),并注册为IOutboundCallService单例。
使用示例
完整 Campaign 生命周期
using Bitzsoft.Integrations.OutboundCall;
using Bitzsoft.Integrations.OutboundCall.Dtos;
using Bitzsoft.Integrations.OutboundCall.PhoneNumber;
public class AliyunCallService
{
private readonly IOutboundCallService _outbound;
public AliyunCallService(IOutboundCallService outbound) => _outbound = outbound;
public async Task RunAsync(string[] rawPhones)
{
var (mainland, _) = PhoneNumberClassifier.Classify(rawPhones);
// 1. 创建活动(CreateCampaign)
var resp = await _outbound.CreateCampaignAsync(new CreateCampaignRequest
{
Name = "催办活动",
Region = PhoneRegion.Mainland,
Callees = mainland.ToList(),
MaxAttempts = 2,
StrategyType = "PID", // 预测式外呼策略
QueueId = "skill-group-001" // 技能组 ID
});
// 2. 追加号码(AddCampaignNumbers)
await _outbound.ImportContactsAsync(new ImportContactsRequest
{
CampaignId = resp.CampaignId,
Contacts = new() { "0086139xxxxxxxx" }
});
// 3. 提交启动(SubmitCampaign)
await _outbound.StartCampaignAsync(new StartCampaignRequest { CampaignId = resp.CampaignId });
// 4. 暂停 / 恢复 / 终止(Pause / Resume / Abort)
await _outbound.PauseCampaignAsync(resp.CampaignId);
await _outbound.ResumeCampaignAsync(resp.CampaignId);
await _outbound.StopCampaignAsync(resp.CampaignId);
}
}
查询活动与话单
// 查询活动列表
var campaigns = await _outbound.ListCampaignsAsync(pageIndex: 1, pageSize: 20);
// 查询单个活动详情
var detail = await _outbound.GetCampaignAsync(campaignId);
// 查询话单(ListSessionsDetail)
var records = await _outbound.QueryCallRecordsAsync(new QueryCallRecordsRequest
{
StartTime = DateTimeOffset.UtcNow.AddDays(-1),
EndTime = DateTimeOffset.UtcNow,
PageSize = 100
});
请求审计
内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认使用 NullRequestLogStore 不持久化。
// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddAliyunOutboundCall(options => { /* ... */ });
// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
opts.MaxInMemoryBodyBytes = 64 * 1024; // 仅控制内存/加密临时文件切换,不截断正文
opts.SensitiveFields.Add("AccessKeySecret"); // 额外脱敏字段
});
services.AddAliyunOutboundCall(options => { /* ... */ });
安全说明
- AccessKeyId / AccessKeySecret:阿里云密钥必须通过环境变量或 Secret Manager 注入,禁止硬编码;签名使用
HMAC-SHA1(AccessKeySecret + "&", stringToSign),密钥不出现在 URL - 签名机制:阿里云 V1.0 RPC 签名(ACS3-Legacy)将
Signature追加到查询串,请求经 HTTPS 发送,端点为{region}.ccc.aliyuncs.com - InstanceId(SdkAppId):CCC 实例 ID 标识租户隔离的联络中心实例,务必使用生产环境对应实例
- 白名单防护:开发 / 测试环境务必配置
Whitelist,避免误呼叫真实客户
依赖
| 包 | 说明 |
|---|---|
Bitzsoft.Integrations.OutboundCall |
外呼抽象层(IOutboundCallService + OutboundCallOptions) |
Bitzsoft.Integrations.RequestLogging |
出站请求审计日志管道 |
Microsoft.Extensions.Http |
IHttpClientFactory(typed client 连接池) |
Microsoft.Extensions.Logging.Abstractions |
日志抽象 |
Microsoft.Extensions.Options |
选项模式(IOptionsMonitor<OutboundCallOptions>) |
相关包
- Bitzsoft.Integrations.OutboundCall -- 外呼抽象层
- Bitzsoft.Integrations.OutboundCall.Tencent -- 腾讯云 CCC 实现
- Bitzsoft.Integrations.OutboundCall.Huawei -- 华为云 CEC 实现
- Bitzsoft.Integrations.OutboundCall.Volcengine -- 火山引擎智能外呼实现
- Bitzsoft.Integrations.OutboundCall.Yuntongxun -- 容联云通讯实现
- Bitzsoft.Integrations.OutboundCall.All -- 聚合包(全部供应商)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
-
net10.0
- Bitzsoft.Integrations.OutboundCall (>= 1.0.0)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
-
net5.0
- Bitzsoft.Integrations.OutboundCall (>= 1.0.0)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.OutboundCall (>= 1.0.0)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.OutboundCall.Aliyun:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.OutboundCall.All
外呼服务聚合包 — 包含全部供应商实现(腾讯云/阿里云/火山引擎/容联云/华为云/国际 Twilio/Vonage) |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 0 | 8/2/2026 |
| 1.0.0-alpha.10 | 48 | 7/26/2026 |
| 1.0.0-alpha.9 | 54 | 7/12/2026 |
| 1.0.0-alpha.8 | 57 | 7/1/2026 |
| 1.0.0-alpha.7 | 72 | 6/16/2026 |
| 1.0.0-alpha.6 | 76 | 6/16/2026 |