Verbara.Sdk.VoiceAi.AudioSocket
2.6.1
See the version list below for details.
dotnet add package Verbara.Sdk.VoiceAi.AudioSocket --version 2.6.1
NuGet\Install-Package Verbara.Sdk.VoiceAi.AudioSocket -Version 2.6.1
<PackageReference Include="Verbara.Sdk.VoiceAi.AudioSocket" Version="2.6.1" />
<PackageVersion Include="Verbara.Sdk.VoiceAi.AudioSocket" Version="2.6.1" />
<PackageReference Include="Verbara.Sdk.VoiceAi.AudioSocket" />
paket add Verbara.Sdk.VoiceAi.AudioSocket --version 2.6.1
#r "nuget: Verbara.Sdk.VoiceAi.AudioSocket, 2.6.1"
#:package Verbara.Sdk.VoiceAi.AudioSocket@2.6.1
#addin nuget:?package=Verbara.Sdk.VoiceAi.AudioSocket&version=2.6.1
#tool nuget:?package=Verbara.Sdk.VoiceAi.AudioSocket&version=2.6.1
Verbara.Sdk.VoiceAi.AudioSocket
AudioSocket transport for Verbara.Sdk.VoiceAi — bridges Asterisk AudioSocket streams into the Voice AI pipeline.
Installation
dotnet add package Verbara.Sdk.VoiceAi.AudioSocket
Quick Start
// Register as a hosted service (DI lifecycle managed)
services.AddAudioSocketServer(opts =>
{
opts.ListenAddress = "0.0.0.0";
opts.Port = 9092;
opts.MaxConcurrentSessions = 100;
});
// Handle sessions manually (without VoiceAi pipeline)
var server = app.Services.GetRequiredService<AudioSocketServer>();
server.OnSessionStarted += async session =>
{
await foreach (var frame in session.ReadAudioAsync(ct))
{
// process 20 ms PCM16 frames from Asterisk
}
await session.WriteAudioAsync(responseAudio, ct);
};
Features
AudioSocketServer—IHostedServiceTCP server; accepts Asterisk AudioSocket connectionsAudioSocketSession— per-call session withReadAudioAsync()andWriteAudioAsync()for 20 ms PCM16 frames- UUID handshake: automatically reads the channel UUID frame from Asterisk on connection
OnSessionStartedevent for routing sessions to custom handlersAddAudioSocketServer()DI extension for one-line registration- Zero-copy
System.IO.Pipelinesframing; Native AOT compatible
A call that comes back with the same UUID
Asterisk does not keep the AudioSocket UUID unique. A dialplan that runs AudioSocket() or
Dial(AudioSocket/…) again with the UUID it saved, a transfer, or a redirect that re-enters the bot
connects again with the same UUID, often before the previous session has finished ending.
- The call is served. The new connection waits for the previous session with that UUID to end,
for at most 1 second, and is then served.
OnSessionStartedis raised for it only after everyOnHanguphandler of the previous session has returned, so state you key byChannelIdnever holds two live sessions under one UUID. KeepOnHanguphandlers short: while they run, the session still holds its UUID and counts inActiveSessionCount, and a handler that takes longer than the wait makes the call that comes back be refused. - A UUID still live after 1 second is refused. Two concurrent calls configured with one UUID are
a dialplan error: the second connection receives a hangup frame, is closed, and the server logs the
ChannelIdInUseWarning naming the UUID and how long it waited. The first call is untouched. - What the caller hears after a refusal. Every refusal, for a UUID in use or for
MaxConcurrentSessions, writes a hangup frame before closing. On Asterisk 20 and later,AudioSocket()then returns and the dialplan goes on. On Asterisk 18 any end from the server, a hangup frame included, fails the application and the call is hung up.
Give every concurrent AudioSocket call its own UUID, for example Set(BOTID=${UUID()}) once per
call, and reuse it only when the same call comes back to the bot.
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
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Verbara.Sdk.Audio (>= 2.6.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Verbara.Sdk.VoiceAi.AudioSocket:
| Package | Downloads |
|---|---|
|
Verbara.Sdk.VoiceAi
Voice AI pipeline for Verbara.Sdk — orchestration layer for STT, TTS and conversation with turn-taking and barge-in detection. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.8.0 | 38 | 10/9/2026 |
| 2.7.0 | 766 | 10/3/2026 |
| 2.6.1 | 516 | 9/30/2026 |
| 2.6.0 | 746 | 9/24/2026 |
| 2.5.3 | 631 | 9/13/2026 |
| 2.5.2 | 302 | 9/13/2026 |
| 2.5.1 | 317 | 9/12/2026 |
| 2.5.0 | 386 | 8/25/2026 |
| 2.4.0 | 1,989 | 7/27/2026 |
| 2.3.2 | 682 | 7/20/2026 |
| 2.3.1 | 298 | 7/14/2026 |
| 2.3.0 | 437 | 7/6/2026 |
| 2.2.1 | 886 | 5/23/2026 |
| 2.2.0 | 198 | 5/20/2026 |
| 2.1.2 | 193 | 5/8/2026 |
| 2.1.1 | 184 | 5/7/2026 |
| 2.1.0 | 3,443 | 5/7/2026 |
| 2.0.0 | 173 | 5/6/2026 |