Asterisk.Sdk.Push.Nats
1.15.3
dotnet add package Asterisk.Sdk.Push.Nats --version 1.15.3
NuGet\Install-Package Asterisk.Sdk.Push.Nats -Version 1.15.3
<PackageReference Include="Asterisk.Sdk.Push.Nats" Version="1.15.3" />
<PackageVersion Include="Asterisk.Sdk.Push.Nats" Version="1.15.3" />
<PackageReference Include="Asterisk.Sdk.Push.Nats" />
paket add Asterisk.Sdk.Push.Nats --version 1.15.3
#r "nuget: Asterisk.Sdk.Push.Nats, 1.15.3"
#:package Asterisk.Sdk.Push.Nats@1.15.3
#addin nuget:?package=Asterisk.Sdk.Push.Nats&version=1.15.3
#tool nuget:?package=Asterisk.Sdk.Push.Nats&version=1.15.3
Asterisk.Sdk.Push.Nats
NATS bridge for Asterisk.Sdk.Push. The bridge subscribes to the in-process Push bus and republishes every event to a NATS subject derived from the event's TopicPath. This unlocks multi-node deployments: one NATS cluster, N SDK instances, each fans out local events to the cluster for topic-based filtering by remote subscribers.
This is the .NET answer to the Go-based ari-proxy pattern: keep the SDK's local Rx bus as the source of truth, let NATS be the transport when you need horizontal scale.
Usage
using Asterisk.Sdk.Push.Hosting;
using Asterisk.Sdk.Push.Nats;
builder.Services.AddAsteriskPush()
.AddPushNats(opts =>
{
opts.Url = "nats://nats.internal:4222";
opts.SubjectPrefix = "asterisk.sdk";
opts.Username = "sdk-bridge";
opts.Password = builder.Configuration["NATS_PASSWORD"];
opts.ConnectTimeoutSeconds = 10;
});
Subject translation
The bridge maps Push topic paths to NATS subjects by replacing separators with ., skipping empty segments, and sanitizing characters that NATS forbids. Example:
Push TopicPath |
NATS subject (prefix asterisk.sdk) |
|---|---|
push.channels.uniqueid-42 |
asterisk.sdk.push.channels.uniqueid-42 |
push/channels/uniqueid-42 |
asterisk.sdk.push.channels.uniqueid-42 |
queues/42/agent state |
asterisk.sdk.queues.42.agent_state |
calls.*.ended |
asterisk.sdk.calls._.ended (wildcards are disallowed in subjects — they become _) |
Both . and / are accepted as input separators so callers are not locked into one convention.
Extension points
- Custom payload shape: implement
INatsPayloadSerializerand register as singleton beforeAddPushNats. The default serializer emits the same envelope asAsterisk.Sdk.Push.Webhooks, so downstream consumers can treat both transports interchangeably.
Observability
Counters on the Asterisk.Sdk.Push.Nats meter:
asterisk.push.nats.events.publishedasterisk.push.nats.events.failed
Enroll via Asterisk.Sdk.OpenTelemetry.WithAllSources() once the meter name is added to AsteriskTelemetry.MeterNames.
Roadmap
PublishOnly = false— subscribe to remote NATS subjects and republish inbound events onto the local Push bus (planned for a later v1.12.x release, tracked indocs/research/2026-04-19-v1.12.0-product-opportunities.md).- JetStream durable subscriptions + ordered consumer support.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Asterisk.Sdk.Push (>= 1.15.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
- NATS.Client.Core (>= 2.7.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.