Verbara.Sdk.Sessions.Postgres
2.2.1
dotnet add package Verbara.Sdk.Sessions.Postgres --version 2.2.1
NuGet\Install-Package Verbara.Sdk.Sessions.Postgres -Version 2.2.1
<PackageReference Include="Verbara.Sdk.Sessions.Postgres" Version="2.2.1" />
<PackageVersion Include="Verbara.Sdk.Sessions.Postgres" Version="2.2.1" />
<PackageReference Include="Verbara.Sdk.Sessions.Postgres" />
paket add Verbara.Sdk.Sessions.Postgres --version 2.2.1
#r "nuget: Verbara.Sdk.Sessions.Postgres, 2.2.1"
#:package Verbara.Sdk.Sessions.Postgres@2.2.1
#addin nuget:?package=Verbara.Sdk.Sessions.Postgres&version=2.2.1
#tool nuget:?package=Verbara.Sdk.Sessions.Postgres&version=2.2.1
Verbara.Sdk.Sessions.Postgres
Postgres-backed SessionStoreBase implementation for Verbara.Sdk.Sessions. Persists active and
completed call sessions as JSONB rows in a shared Postgres database, enabling multi-instance
deployments where multiple SDK hosts share a single durable session store.
Install
dotnet add package Verbara.Sdk.Sessions.Postgres
Configure
services.AddAsteriskSessionsBuilder()
.UsePostgres(opts =>
{
opts.ConnectionString = "Host=localhost;Database=asterisk;Username=postgres;Password=secret";
opts.TableName = "asterisk_call_sessions"; // default
opts.SchemaName = "public"; // default
});
Or pass a pre-built NpgsqlDataSource (recommended when you want to share pooling/logging configuration):
var dataSource = NpgsqlDataSource.Create("Host=localhost;Database=asterisk;Username=postgres;Password=secret");
services.AddAsteriskSessionsBuilder()
.UsePostgres(dataSource);
Migrations
The package ships a starter migration at
contentFiles/any/any/Migrations/001_create_sessions_table.sql. Apply it to your database before
the application starts (e.g. via your migration runner, psql, or a deployment script):
CREATE TABLE IF NOT EXISTS asterisk_call_sessions (
session_id TEXT PRIMARY KEY,
linked_id TEXT NOT NULL,
server_id TEXT NOT NULL,
state SMALLINT NOT NULL,
direction SMALLINT NOT NULL,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL,
completed_at TIMESTAMPTZ NULL,
snapshot JSONB NOT NULL
);
CREATE INDEX IF NOT EXISTS ix_asterisk_sessions_linked_id
ON asterisk_call_sessions (linked_id);
CREATE INDEX IF NOT EXISTS ix_asterisk_sessions_active
ON asterisk_call_sessions (state) WHERE completed_at IS NULL;
Notes
- AOT-safe: uses source-generated JSON (
SessionJsonContext) and parameterized SQL only. - UPSERT via
INSERT ... ON CONFLICT (session_id) DO UPDATE. SchemaName/TableNameare embedded as SQL identifiers — they are validated against^[A-Za-z_][A-Za-z0-9_]*$at registration time and must be trusted inputs.- Partial index on
statewithWHERE completed_at IS NULLkeeps the active scan fast even at scale.
| 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.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
- Npgsql (>= 10.0.2)
- Verbara.Sdk.Data.Npgsql (>= 2.2.1)
- Verbara.Sdk.Sessions (>= 2.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.