Bitzsoft.Integrations.OutboundCall.Twilio 1.0.0-alpha.7

This is a prerelease version of Bitzsoft.Integrations.OutboundCall.Twilio.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Bitzsoft.Integrations.OutboundCall.Twilio --version 1.0.0-alpha.7
                    
NuGet\Install-Package Bitzsoft.Integrations.OutboundCall.Twilio -Version 1.0.0-alpha.7
                    
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.OutboundCall.Twilio" Version="1.0.0-alpha.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.OutboundCall.Twilio" Version="1.0.0-alpha.7" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.OutboundCall.Twilio" />
                    
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.OutboundCall.Twilio --version 1.0.0-alpha.7
                    
#r "nuget: Bitzsoft.Integrations.OutboundCall.Twilio, 1.0.0-alpha.7"
                    
#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.OutboundCall.Twilio@1.0.0-alpha.7
                    
#: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.OutboundCall.Twilio&version=1.0.0-alpha.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.OutboundCall.Twilio&version=1.0.0-alpha.7&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.OutboundCall.Twilio

Twilio Programmable Voice 外呼实现,手写 HttpClient + HTTP Basic 鉴权,实现 IOutboundCallService 统一接口。

功能

  • 实现 IOutboundCallService 统一接口(创建/启动/暂停/恢复/停止活动 + 活动列表/详情 + 话单查询)
  • Twilio 为 per-call 模型(无原生 campaign):campaign 元数据与联系人维护在本库内存中,StartCampaign 经共享 CampaignDialer 按 CPS 节流逐个发起外呼
  • 支持暂停/恢复/停止(代次守卫,防止循环重叠与重复记账)
  • 内联 TwiML 或回调 URL 指定呼叫内容;可选答答检测(AMD)
  • 白名单/黑名单过滤(复用 CallListFilter
  • 手写 HttpClient,不依赖 Twilio SDK(net5.0 兼容)

限制:campaign 状态存内存,进程重启后丢失;StartCampaign 可凭已导入联系人重跑,话单仍可从 Twilio 查询。

安装

dotnet add package Bitzsoft.Integrations.OutboundCall.Twilio

配置

{
  "TwilioOutboundCall": {
    "AccountSid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "AuthToken": "your-auth-token",
    "From": "+12025550123",
    "Twiml": "<Response><Say language=\"zh-CN\">您好</Say></Response>",
    "Cps": 1,
    "EnableMachineDetection": false,
    "StatusCallback": "https://your-host/twilio/status"
  }
}

注册

services.AddTwilioOutboundCall(options =>
{
    options.AccountSid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    options.AuthToken = "your-auth-token";
    options.From = "+12025550123";
    options.Twiml = TwilioOutboundCallOptions.BuildInlineTwiml("您好");
    options.Cps = 1;
});

第三方请求日志

内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认 NullRequestLogStore 不持久化。

// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddTwilioOutboundCall(options => { /* ... */ });

// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxBodyLength = 8192;            // 单条正文截断上限
    opts.SensitiveFields.Add("AuthToken"); // 额外脱敏字段
});
services.AddTwilioOutboundCall(options => { /* ... */ });

使用

// 创建活动并导入联系人(campaign 状态存内存)
var resp = await outboundCall.CreateCampaignAsync(new CreateCampaignRequest
{
    Name = "通知外呼",
    Region = PhoneRegion.Overseas,
    Callees = new() { "+12025550123", "+12025550124" }
});

// 启动:后台按 CPS 节流逐个拨号
await outboundCall.StartCampaignAsync(new StartCampaignRequest { CampaignId = resp.CampaignId });

// 查询话单(从 Twilio 账号级 call 列表拉取)
var records = await outboundCall.QueryCallRecordsAsync(new QueryCallRecordsRequest { PageSize = 50 });
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.OutboundCall.Twilio:

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.1 134 8/3/2026
1.0.0 132 8/2/2026
1.0.0-alpha.10 58 7/26/2026
1.0.0-alpha.9 66 7/12/2026
1.0.0-alpha.8 65 7/1/2026
1.0.0-alpha.7 75 6/16/2026