Skip to content

VoiceConnectionLimiter

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Limits concurrent voice connections per tenant.

public sealed class VoiceConnectionLimiter

objectVoiceConnectionLimiter

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The counter is in memory and per process. In a multi-instance deployment, each instance applies its own limit, so the aggregate limit scales by the instance count. This is deliberate: voice connections already bind to one instance through sticky sessions, and a distributed counter would require coordination that costs more than the protection provides.

The same reason applies to rate limiting.

Initializes a new limiter.

public VoiceConnectionLimiter(int limit)

limit int

The maximum concurrent connections per tenant.

Gets the maximum connections allowed per tenant.

public int Limit { get; }

int

Gets a tenant’s active connection count.

public int CountFor(string tenantId)

tenantId string

The tenant.

int

The active connection count.

Attempts to reserve a connection slot.

public VoiceConnectionLease? TryAcquire(string tenantId)

tenantId string

The tenant.

VoiceConnectionLease?

The reserved slot, or null when the limit is reached. Disposing the returned object releases the slot.

ArgumentException

tenantId is empty.