Bitzsoft.Integrations.OutboundCall.Vonage 1.0.0

dotnet add package Bitzsoft.Integrations.OutboundCall.Vonage --version 1.0.0
                    
NuGet\Install-Package Bitzsoft.Integrations.OutboundCall.Vonage -Version 1.0.0
                    
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.Vonage" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.OutboundCall.Vonage" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.OutboundCall.Vonage" />
                    
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.Vonage --version 1.0.0
                    
#r "nuget: Bitzsoft.Integrations.OutboundCall.Vonage, 1.0.0"
                    
#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.Vonage@1.0.0
                    
#: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.Vonage&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.OutboundCall.Vonage&version=1.0.0
                    
Install as a Cake Tool

Bitzsoft.Integrations.OutboundCall.Vonage

Vonage(原 Nexmo)Voice API 外呼实现,手写 HttpClient + RS256 JWT 鉴权(Application 私钥签名)+ NCCO 呼叫控制,实现 IOutboundCallService 统一接口。

功能

  • 实现 IOutboundCallService 统一接口(创建/启动/暂停/恢复/停止活动 + 活动列表/详情 + 话单查询)
  • Vonage 为 per-call 模型(无原生 campaign):campaign 元数据与联系人维护在本库内存中,StartCampaign 经共享 CampaignDialer 按 CPS 节流逐个发起外呼
  • 支持暂停/恢复/停止(代次守卫,防止循环重叠与重复记账)
  • 内联 NCCO 或 AnswerUrl 指定呼叫内容
  • RS256 JWT 鉴权:用 Application 的 RSA 私钥(PEM)签 application_id claim,作 Bearer token;RSA.ImportFromPem 为主、BouncyCastle PemReader 兜底
  • 白名单/黑名单过滤(复用 CallListFilter
  • 手写 HttpClient,不依赖 Vonage SDK(net5.0 兼容)

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

安装

dotnet add package Bitzsoft.Integrations.OutboundCall.Vonage

配置

{
  "VonageOutboundCall": {
    "ApplicationId": "your-application-id",
    "PrivateKeyPem": "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----",
    "From": "12025550123",
    "Ncco": "[{\"action\":\"talk\",\"text\":\"您好\",\"language\":\"cmn-CN\"}]",
    "Cps": 1,
    "Domain": "api.nexmo.com"
  }
}
配置项 说明 必填 默认值
ApplicationId Vonage Application ID -
PrivateKeyPem Application RSA 私钥(PEM 文本,签 RS256 JWT) -
From 默认主叫号码(E.164,不含前导 +) -
Ncco 内联 NCCO JSON 数组字符串(与 AnswerUrl 二选一) -
AnswerUrl 应答回调 URL(与 Ncco 二选一) -
Cps 每秒并发呼叫数(客户端 CPS 节流) 1
Domain API 域名 api.nexmo.com

PrivateKeyPem 为 Vonage Application 的私钥(控制台创建 Application 时生成,PKCS#1/PKCS#8 PEM 均可)。生产环境建议从密文配置/密钥库读取,勿明文入库。

注册

services.AddVonageOutboundCall(options =>
{
    options.ApplicationId = "your-application-id";
    options.PrivateKeyPem = privateKeyPem; // PEM 文本
    options.From = "12025550123";
    options.Ncco = "[{\"action\":\"talk\",\"text\":\"您好\",\"language\":\"cmn-CN\"}]";
    options.Cps = 1;
});

第三方请求日志

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

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

// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxInMemoryBodyBytes = 64 * 1024; // 仅控制内存/加密临时文件切换,不截断正文
    opts.SensitiveFields.Add("PrivateKeyPem"); // 额外脱敏字段
});
services.AddVonageOutboundCall(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 });

// 查询话单(从 Vonage 账号级 call 列表拉取)
var records = await outboundCall.QueryCallRecordsAsync(new QueryCallRecordsRequest { PageSize = 50 });

安全说明

  • PrivateKeyPem:Vonage Application 的 RSA 私钥,用于签 RS256 JWT 作 Bearer token 鉴权。通过密文配置 / 密钥库注入,禁止明文入库;务必加入 RequestLogging 脱敏字段。
  • campaign 状态存内存:进程重启后丢失;StartCampaign 可凭已导入联系人重跑。

依赖

说明
Bitzsoft.Integrations.OutboundCall 外呼抽象层(IOutboundCallService
Bitzsoft.Integrations.Compatibility 基础工具库
Bitzsoft.Integrations.RequestLogging 出站请求审计

相关包

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.Vonage:

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 49 7/26/2026
1.0.0-alpha.9 61 7/12/2026
1.0.0-alpha.8 63 7/1/2026
1.0.0-alpha.7 78 6/16/2026