voice
Outbound phone calls through POST /v1/sessions/phone.
Use speko.voice.dial() to place an outbound PSTN call. The API creates a voice session, dispatches the configured worker, and dials the destination over LiveKit SIP.
const call = await speko.voice.dial({
to: '+12015551234',
from: '+12015550199',
agentId: 'agent_123',
telephony: {
region: 'us-east',
amd: { mode: 'agent', timeoutSeconds: 8 },
},
});
console.log(call.sessionId, call.status);Signature
speko.voice.dial(params: VoiceDialParams): Promise<VoiceDialResult>Parameters
| Field | Type | Description |
|---|---|---|
to | string | Destination in E.164 format. |
from | string? | Caller ID. Must be registered to the organization unless it is the server default. |
agentId | string? | Persisted agent to run. Required unless intent is supplied. |
intent | RoutingIntent? | Routing intent for ad hoc calls. Required unless agentId is supplied. |
constraints | PipelineConstraints? | Provider allow-list constraints. |
voice | string? | TTS voice id override. |
systemPrompt | string? | Agent instructions for this call. |
firstMessage | string? | Optional first utterance. |
llm | { temperature?: number; maxTokens?: number }? | LLM tuning. |
ttsOptions | { sampleRate?: number; speed?: number }? | TTS options. |
sttOptions | { keywords?: string[] }? | STT keyword hints. |
telephony | { region?: string; amd?: { mode?: 'agent' | 'carrier' | 'disabled'; timeoutSeconds?: number } }? | SIP routing and voicemail-detection hints. |
metadata | Record<string, unknown>? | Free-form metadata surfaced in webhooks and call events. |
Returns
| Field | Type | Description |
|---|---|---|
sessionId | string | Voice session id. |
callControlId | string | LiveKit SIP participant identity for the outbound leg. |
roomName | string | LiveKit room name. |
status | 'dialing' | 'dialing-stub' | Dial status. Stub appears when SIP is not configured in the deployment. |
to | string | Destination number. |
from | string | Resolved caller ID. |