VoIPBin documentation currently lacks a guide for customers who want to build custom AI voice agents using VoIPBin's individual /speakings (TTS) and /transcribes (STT) APIs. The existing ai_overview.rst documents only the managed ai_talk pipeline. Customers who want to use their own AI backend need a separate integration guide.
Add a new documentation section "AI Voice Agent Integration" under "AI & Automation" in index.rst, following the standard 2-file RST pattern (overview + tutorial) plus an index file.
- Toctree that includes overview and tutorial files.
Structure:
- AI Context block — Complexity: Medium, Cost: Chargeable (STT + TTS per-minute), Async: Yes
- What is Custom AI Voice Agent Integration — Use VoIPBin's STT/TTS APIs individually with your own AI backend. Contrast with managed
ai_talk. - Architecture Flow — ASCII diagram: Caller ↔ VoIPBin (SIP/RTP) ↔ Customer AI Backend. Three-step loop: (1) transcript_created webhook, (2) AI processes, (3) POST /speakings/{id}/say
- API Components —
/transcribesfor STT (ref: transcribe_overview),/speakingsfor TTS (new content since no speaking docs exist yet) - Integration Workflow — 6-step cycle: create call → start transcribe → receive transcripts → AI process → create speaking + say → repeat
- Voice Detection (Barge-in) — How to handle caller interruptions: flush/stop current speaking, new transcript arrives
- When to Use This vs ai_talk — Comparison table
- Best Practices — Latency, error handling, session lifecycle
- Troubleshooting — Common issues with cause/fix pairs
Structure:
- Prerequisites — API token, phone number, webhook URL
- Step 1: Create an outbound call —
POST /callswith curl example - Step 2: Start transcription on the call —
POST /transcribeswith reference_type: "call" - Step 3: Receive transcript events — Webhook payload example (transcript_created)
- Step 4: Process with your AI backend — Pseudo-code for LLM call
- Step 5: Create a speaking session —
POST /speakingswith reference_type: "call" - Step 6: Send AI response as speech —
POST /speakings/{id}/say - Step 7: Handle ongoing conversation — Loop, flush, stop patterns
- Complete example — End-to-end flow combining all steps
- Add
ai_voice_agent_integrationunder "AI & Automation" section afterai.
POST /v1/speakings— Create session (reference_type: "call", reference_id: call UUID)POST /v1/speakings/{id}/say— Send text to speak (body: {"text": "..."})POST /v1/speakings/{id}/stop— Stop sessionPOST /v1/speakings/{id}/flush— Flush queued text- Status: initiating → active → stopped
- Providers: elevenlabs, deepgram, openai, aws, google, etc.
- Events: speaking_started, speaking_stopped
POST /v1/transcribes— Create session (reference_type: "call", reference_id: call UUID)POST /v1/transcribes/{id}/stop— Stop session- Status: progressing → done
- Providers: gcp, aws
- Events: transcribe_created, transcribe_progressing, transcribe_done, transcript_created
{
"type": "transcript_created",
"data": {
"id": "UUID",
"transcribe_id": "UUID",
"direction": "in",
"message": "transcribed text",
"tm_transcript": "timestamp",
"tm_create": "timestamp"
}
}- Decided: Overview + Tutorial 2-file split follows existing documentation patterns
- Not included: Speaking struct reference doc (can be added later as separate task)
- Cross-references: Link to existing transcribe_overview.rst and call docs rather than duplicating content
- Build docs with Sphinx after writing RST files
- Verify cross-references resolve correctly
- Check ASCII diagrams render properly