Skip to content
Tracon

ILiveVoiceProvider

Namespace Tracon · Assembly Tracon.Abstractions.dll

Creates and supervises a provider-hosted live voice session.

public interface ILiveVoiceProvider

A live session is not the conversation layer behind UseVoiceConversation. There, Tracon receives the audio, transcribes it, runs the agent and synthesizes the answer. Here the provider hosts the whole conversation and carries the media directly to the media peer; Tracon stands in two places only: it creates the session, so tenancy, role and concurrency gates apply and the raw API key never reaches the browser, and it attaches a server-side control connection, so the work the model delegates becomes an ordinary Tracon run.

Lifetime: registered singleton. One instance serves every session in the process, so an implementation must be thread-safe and must hold no per-session state of its own — ILiveVoiceSideband is where a session’s state lives.

Tenant: tenant-independent, like ISpeechSynthesizer. The caller has already resolved and gated the tenant before a session is created: Tracon applies the tenant’s egress policy to ILiveVoiceProvider.ProviderName and resolves the tenant’s own credential from its provider binding, exactly as for a model call. The provider neither reads nor enforces a tenant, and must not key any cache or credential by tenant; a tenant credential reaches it only through the request (LiveVoiceCreateRequest.Credential, LiveVoiceAttachRequest.Credential), and only when ILiveVoiceProvider.SupportsTenantCredentials is true.

Delivery: best-effort. Creating a session and attaching to it are ordinary network calls with no retry and no idempotency key: a failure is surfaced to the caller, never retried silently, because a retried create is a second billed session.

Gets the largest number of characters a single ILiveVoiceSideband.AppendAsync may carry.

int MaxAppendCharacters { get; }

int

The ceiling is in characters, not tokens: Tracon ships no tokenizer and must not take one on (AOT, and no new package). An implementation whose provider states the limit in tokens converts it once, conservatively, and documents the ratio in a single place.

Gets the model identifier written to the session record.

string ModelId { get; }

string

Gets the provider name written to the session record, e.g. openai.

string ProviderName { get; }

string

Gets whether the provider honours a tenant credential passed in LiveVoiceCreateRequest.Credential and LiveVoiceAttachRequest.Credential.

bool SupportsTenantCredentials { get; }

bool

The default is false. Tracon then refuses a session for a tenant that has its own binding for ILiveVoiceProvider.ProviderName rather than open it on the provider’s configured credential, which would bill the wrong account. An implementation that returns true uses the credential for both calls of the session and never falls back to its configured one.

Opens a server-side control connection to an existing session.

ValueTask<ILiveVoiceSideband> AttachAsync(string providerSessionId, CancellationToken cancellationToken = default)

providerSessionId string

The identifier returned by ILiveVoiceProvider.CreateSessionAsync.

cancellationToken CancellationToken

The cancellation token.

ValueTask<ILiveVoiceSideband>

The sideband connection.

The connection carries no primary audio: WebRTC or SIP carries that. Both connections share one session.

AttachSessionAsync(LiveVoiceAttachRequest, CancellationToken)

Section titled “ AttachSessionAsync(LiveVoiceAttachRequest, CancellationToken)”

Opens a server-side control connection to an existing session.

ValueTask<ILiveVoiceSideband> AttachSessionAsync(LiveVoiceAttachRequest request, CancellationToken cancellationToken = default)

request LiveVoiceAttachRequest

The provider’s session identifier and the credential to connect with.

cancellationToken CancellationToken

The cancellation token.

ValueTask<ILiveVoiceSideband>

The sideband connection.

The default implementation calls ILiveVoiceProvider.AttachAsync when no credential is given and throws NotSupportedException when one is: an implementation that cannot use the tenant’s credential must not connect with its own instead. Tracon calls this method, the pair of ILiveVoiceProvider.CreateSessionAsync.

NotSupportedException

LiveVoiceAttachRequest.Credential is set and the implementation does not override this method.

CreateSessionAsync(LiveVoiceCreateRequest, CancellationToken)

Section titled “ CreateSessionAsync(LiveVoiceCreateRequest, CancellationToken)”

Relays the media peer’s SDP offer and creates the session.

ValueTask<LiveVoiceSessionHandle> CreateSessionAsync(LiveVoiceCreateRequest request, CancellationToken cancellationToken = default)

request LiveVoiceCreateRequest

The offer and the session settings.

cancellationToken CancellationToken

The cancellation token.

ValueTask<LiveVoiceSessionHandle>

The provider’s session identifier and its SDP answer.