Appearance
Complete Action Reference
Complete reference for all actions in the SDK.
Base Action Structure
All actions require a session_id and type field:
typescript
interface BaseAction {
session_id: string; // UUID from the event's session.id
type: string; // Action type identifier
}All Action Types
| Action Type | Description | Primary Use Case |
|---|---|---|
speak | Speak text or SSML | Respond to user with synthesized speech |
audio | Play pre-recorded audio | Play hold music, pre-recorded messages |
hangup | End the call | Terminate conversation |
transfer | Transfer to another number | Route to human agent or department |
barge_in | Manually interrupt playback | Stop current audio immediately |
Action Type Definitions
speak - Text-to-speech response
typescript
interface AiFlowActionSpeak {
type: "speak";
session_id: string;
// Provide either text OR ssml (not both)
text?: string;
ssml?: string;
// Optional TTS configuration
tts?: {
provider: "azure";
language?: string; // e.g., "en-US", "de-DE"
voice?: string; // Azure voice name
} | {
provider: "eleven_labs";
voice?: string; // ElevenLabs voice ID (optional, uses default if omitted)
};
barge_in?: {
strategy: "none" | "manual" | "minimum_characters";
minimum_characters?: number; // Default: 3
allow_after_ms?: number; // Delay before allowing interruption
};
}audio - Play pre-recorded audio
typescript
interface AiFlowActionAudio {
type: "audio";
session_id: string;
audio: string; // Base64 encoded WAV (16kHz, mono, 16-bit PCM)
barge_in?: {
strategy: "none" | "manual" | "minimum_characters";
minimum_characters?: number;
allow_after_ms?: number;
};
}hangup - End call
typescript
interface AiFlowActionHangup {
type: "hangup";
session_id: string;
}transfer - Transfer call
typescript
interface AiFlowActionTransfer {
type: "transfer";
session_id: string;
target_phone_number: string; // E.164 format recommended
caller_id_name: string;
caller_id_number: string;
}barge_in - Manual interrupt
typescript
interface AiFlowActionBargeIn {
type: "barge_in";
session_id: string;
}Type Safety
All actions are fully typed. Import types from the SDK:
typescript
import type {
AiFlowAction,
AiFlowActionSpeak,
AiFlowActionAudio,
AiFlowActionHangup,
AiFlowActionTransfer,
AiFlowActionBargeIn,
} from "@sipgate/ai-flow-sdk";Next Steps
- Complete Event Reference - All event types
- Direct Integration - Working without the wrapper