Asterisk.Sdk.VoiceAi
1.15.3
dotnet add package Asterisk.Sdk.VoiceAi --version 1.15.3
NuGet\Install-Package Asterisk.Sdk.VoiceAi -Version 1.15.3
<PackageReference Include="Asterisk.Sdk.VoiceAi" Version="1.15.3" />
<PackageVersion Include="Asterisk.Sdk.VoiceAi" Version="1.15.3" />
<PackageReference Include="Asterisk.Sdk.VoiceAi" />
paket add Asterisk.Sdk.VoiceAi --version 1.15.3
#r "nuget: Asterisk.Sdk.VoiceAi, 1.15.3"
#:package Asterisk.Sdk.VoiceAi@1.15.3
#addin nuget:?package=Asterisk.Sdk.VoiceAi&version=1.15.3
#tool nuget:?package=Asterisk.Sdk.VoiceAi&version=1.15.3
Asterisk.Sdk.VoiceAi
Voice AI pipeline for Asterisk.Sdk — orchestration layer for STT, TTS, and conversation with turn-taking and barge-in detection.
Installation
dotnet add package Asterisk.Sdk.VoiceAi
Quick Start
// Implement your conversation handler (called once per user utterance)
public class MyHandler : IConversationHandler
{
public ValueTask<string> HandleAsync(
string transcript, ConversationContext context, CancellationToken ct)
{
return ValueTask.FromResult($"You said: {transcript}");
}
}
// Register in DI
services.AddAudioSocketServer(opts => opts.Port = 9092);
services.AddVoiceAiPipeline<MyHandler>(opts =>
{
opts.InputFormat = AudioFormat.Slin16Mono8kHz;
opts.OutputFormat = AudioFormat.Slin16Mono8kHz;
opts.EndOfUtteranceSilence = TimeSpan.FromMilliseconds(600);
});
// Subscribe to pipeline events
var pipeline = app.Services.GetRequiredService<VoiceAiPipeline>();
pipeline.Events.Subscribe(evt => Console.WriteLine(evt));
Features
VoiceAiPipeline— full VAD → STT →IConversationHandler→ TTS loop per AudioSocket session- Barge-in detection: cancels TTS playback when the caller speaks
IConversationHandler— scoped per session; implement to plug in any LLM or business logicISessionHandler— low-level interface; implement for fully custom session handlingVoiceAiSessionBroker— hosted service that routesAudioSocketSessioninstances to the active handler- Observable
Eventsstream (SpeechStartedEvent,TranscriptReceivedEvent,BargInDetectedEvent, etc.) - Native AOT compatible
Custom STT / TTS Providers
When writing your own SpeechRecognizer or SpeechSynthesizer subclass, override ProviderName with a stable literal to avoid the per-utterance GetType().Name allocation on the pipeline hot path (used as a tag on STT/TTS activities):
public sealed class MyCustomRecognizer : SpeechRecognizer
{
public override string ProviderName => "MyCustom";
public override IAsyncEnumerable<SpeechRecognitionResult> StreamAsync(
IAsyncEnumerable<ReadOnlyMemory<byte>> audioFrames,
AudioFormat format,
CancellationToken ct = default)
{
// ...
}
}
If you don't override ProviderName the default falls back to GetType().Name — functional, but incurs one reflection call per utterance.
Observability
- Metrics:
VoiceAiMetrics(sessions started/completed/failed, session duration),SpeechRecognitionMetrics(transcriptions started/completed/failed, latency),SpeechSynthesisMetrics(syntheses started/completed/failed, latency, characters). - Tracing:
VoiceAiActivitySource— session / recognition / synthesis spans. - Health:
VoiceAiHealthCheck,SttHealthCheck,TtsHealthCheckauto-registered byAddVoiceAiPipeline<THandler>(). - Discover names via
AsteriskTelemetry.ActivitySourceNames/MeterNamesfromAsterisk.Sdk.Hosting.
Documentation
See the main README for full documentation.
| 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.Audio (>= 1.15.3)
- Asterisk.Sdk.VoiceAi.AudioSocket (>= 1.15.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
- System.Reactive (>= 6.1.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Asterisk.Sdk.VoiceAi:
| Package | Downloads |
|---|---|
|
Asterisk.Sdk.VoiceAi.Stt
STT providers for Asterisk.Sdk.VoiceAi — Deepgram, Cartesia, AssemblyAI (WebSocket streaming), OpenAI Whisper, Azure Whisper, Google Speech (REST batch). Zero third-party dependencies. |
|
|
Asterisk.Sdk.VoiceAi.Tts
TTS providers for Asterisk.Sdk.VoiceAi — ElevenLabs (WebSocket streaming) and Azure TTS (REST). Zero third-party dependencies. |
|
|
Asterisk.Sdk.VoiceAi.Testing
Test fakes for Asterisk.Sdk.VoiceAi -- FakeSpeechRecognizer, FakeSpeechSynthesizer, FakeConversationHandler for testing Voice AI apps without API keys. |
|
|
Asterisk.Sdk.VoiceAi.OpenAiRealtime
OpenAI Realtime API bridge for Asterisk.Sdk.VoiceAi — connects Asterisk AudioSocket directly to GPT-4o in real time, with function calling and observability. Zero third-party dependencies. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.15.3 | 175 | 5/3/2026 | |
| 1.15.2 | 166 | 4/27/2026 | |
| 1.15.1 | 175 | 4/26/2026 | |
| 1.15.0 | 211 | 4/20/2026 | |
| 1.14.0 | 148 | 4/20/2026 | |
| 1.13.0 | 160 | 4/20/2026 | |
| 1.12.0 | 147 | 4/19/2026 | |
| 1.11.1 | 149 | 4/19/2026 | |
| 1.11.0 | 151 | 4/19/2026 | |
| 1.10.2 | 158 | 4/18/2026 | |
| 1.10.1 | 151 | 4/18/2026 | |
| 1.10.0 | 181 | 4/18/2026 | |
| 1.9.0 | 156 | 4/17/2026 | |
| 1.8.1 | 156 | 4/16/2026 | |
| 1.8.0 | 170 | 4/13/2026 | |
| 1.7.0 | 150 | 4/13/2026 | |
| 1.6.0 | 147 | 4/13/2026 | |
| 1.5.5 | 185 | 4/9/2026 | |
| 1.5.3 | 1,133 | 3/30/2026 | |
| 1.5.2 | 166 | 3/30/2026 |