Get a registered provider by name.
Optional name: VoiceProviderNameRegister a handler for call events.
Unsubscribe function.
Initiate an outbound phone call.
Creates a CallRecord in 'initiated' state, delegates to the provider to place the call, and returns the internal call ID.
Optional fromOptional mode?: CallModeOptional message?: stringOptional seedOptional providerHang up a call. Transitions to 'hangup-bot' terminal state.
A call persisted with persistCall or read by processWebhookDurable ends in its store: the
end, with any bot speech not yet committed, commits there before the carrier is asked to hang up, so the
completion callback the hangup causes, like any callback after the commit, finds the call ended and changes
nothing, whichever manager processes it. call:ended is emitted after the carrier request returns. The carrier
is asked even when that commit fails, and the promise then rejects with the commit's error. A call the store
already holds as ended keeps its stored outcome and emits nothing.
Add a bot speech entry to the transcript and transition to speaking.
On a call persisted with persistCall or read by processWebhookDurable, the entry and the speaking state also commit to the call's store, after the manager's earlier store transactions; until one commits them, every later transaction for the call carries them, so a callback does not drop them from the manager's record. When another manager has ended the call in the store meanwhile, the entry still commits to its transcript and the call keeps its stored outcome. A failed commit is written to the console and left to the next transaction.
Process an incoming webhook from a telephony provider.
Verifies the signature, parses events, and applies state transitions. Idempotent — duplicate event IDs are silently skipped.
Process a single normalized call event.
With eventHandling: 'carrier' the event is matched to a call by its
provider and call id (or its request id), bound to that call's carrier
identity and applied once per record: a state the call has passed emits
nothing, a call emits one terminal notification, and the record stays in
the manager. This repairs transitions in process and adds no restart
durability; see processWebhookDurable. Otherwise the original
handling below applies.
Inserts an admitted call once. A callback that races admission must be retried, never acknowledged.
Verifies, binds and applies callbacks in the store transaction. State and dedupe commit together. Unknown admission throws so the host returns a retryable response. Notifications happen only after commit and are best-effort; financial/external effects must consume durable records, not handlers. A call's bot speech not yet committed commits first, and the manager's record of each call becomes the committed one with the speech recorded since on top; the manager's store transactions run one at a time.
Get a call by internal ID.
Find a call by provider-assigned call ID.
Get all active (non-terminal) calls.
Handle an inbound call based on the configured policy. Creates a CallRecord if the call is accepted.
Optional seed
Register a telephony provider.