Skip to main content

Interface: IVoiceCallProvider

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:117

Core interface for telephony providers.

Implementations wrap provider-specific SDKs (Twilio REST API, Telnyx Call Control v2, Plivo Voice API) and normalize all interactions to this contract.

Example

class TwilioProvider implements IVoiceCallProvider {
readonly name = 'twilio';

async initiateCall(input: InitiateCallInput): Promise<InitiateCallResult> {
const call = await this.client.calls.create({
to: input.toNumber,
from: input.fromNumber,
url: input.webhookUrl,
statusCallback: input.statusCallbackUrl,
});
return { providerCallId: call.sid, success: true };
}
// ...
}

Properties

name

readonly name: VoiceProviderName

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:119

Provider identifier.

Methods

hangupCall()

hangupCall(input): Promise<void>

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:152

Hang up an active call.

Parameters

input

HangupCallInput

Returns

Promise<void>


initiateCall()

initiateCall(input): Promise<InitiateCallResult>

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:147

Initiate an outbound phone call. For 'notify' mode, the provider generates TwiML/SSML to speak the message and hang up. For 'conversation' mode, the provider sets up a bidirectional media stream.

Parameters

input

InitiateCallInput

Returns

Promise<InitiateCallResult>


parseWebhookEvent()

parseWebhookEvent(ctx): WebhookParseResult

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:137

Parse a verified webhook payload into normalized call events. Transforms provider-specific event formats into the common NormalizedCallEvent discriminated union.

Parameters

ctx

WebhookContext

Returns

WebhookParseResult


playTts()?

optional playTts(input): Promise<void>

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:159

Play TTS audio into an active call (non-streaming). Used by providers that support in-call TTS via their API (e.g., Twilio's verb, Telnyx speak command).

Parameters

input

PlayTtsInput

Returns

Promise<void>


startListening()?

optional startListening(input): Promise<void>

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:165

Start STT listening on an active call (non-streaming). Used by providers that support in-call speech recognition.

Parameters

input

StartListeningInput

Returns

Promise<void>


stopListening()?

optional stopListening(input): Promise<void>

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:170

Stop STT listening on an active call.

Parameters

input

StopListeningInput

Returns

Promise<void>


verifyWebhook()

verifyWebhook(ctx): WebhookVerificationResult

Defined in: packages/agentos/src/voice/IVoiceCallProvider.ts:130

Verify the authenticity of an incoming webhook request. Each provider has its own signature scheme:

  • Twilio: HMAC-SHA1 signature header
  • Telnyx: Ed25519 public key verification
  • Plivo: HMAC-SHA256 verification

Parameters

ctx

WebhookContext

Returns

WebhookVerificationResult