How It Works
- Plivo handles phone call routing and streams real-time audio over WebSocket
- Pipecat receives audio and orchestrates the AI pipeline
- STT service converts speech to text
- LLM processes the text and generates a response
- TTS service converts the response back to speech
- Plivo plays the audio to the caller
Choose Your Stack
Pipecat supports multiple AI service combinations. Choose based on your requirements:Standard Pipelines (STT → LLM → TTS)
| Guide | STT | LLM | TTS | Best For |
|---|---|---|---|---|
| OpenAI + Cartesia | Deepgram | OpenAI GPT-4o | Cartesia | Low latency, expressive voices |
| OpenAI + ElevenLabs | Deepgram | OpenAI GPT-4o | ElevenLabs | Natural voices, voice cloning |
| Gemini + Cartesia | Deepgram | Google Gemini | Cartesia | Cost-effective, fast responses |
| Gemini + ElevenLabs | Deepgram | Google Gemini | ElevenLabs | Balance of cost and voice quality |
Speech-to-Speech (Direct Audio Processing)
| Guide | Model | Best For |
|---|---|---|
| OpenAI Realtime | GPT-4o Realtime | Lowest latency, native multimodal |
| Gemini Live | Gemini Live | Multimodal with video support |
Prerequisites
| Requirement | Description |
|---|---|
| Plivo Account | Sign up and get Auth ID and Auth Token |
| Phone Number | Purchase a voice-enabled number |
| Pipecat | Install via pip install pipecat-ai |
| AI Service Accounts | Credentials for your chosen STT, LLM, and TTS providers |
Quick Start
1. Clone the Examples
2. Choose Inbound or Outbound
- Inbound calls:
cd inbound- Receive calls on your Plivo number - Outbound calls:
cd outbound- Initiate calls programmatically
3. Configure Environment
.env with your credentials (varies by provider stack).
4. Start the Server
5. Expose for Development (Inbound Only)
https://your-ngrok-url.ngrok.io/
Inbound vs Outbound Calls
Inbound Calls
Your Plivo number receives calls and connects them to your Pipecat bot. Setup:- Configure Answer URL on your Plivo number
- Plivo sends call to your server
- Server returns XML with
<Stream>element - WebSocket connection established with Pipecat
Outbound Calls
Your application initiates calls to phone numbers. Setup:- Start your Pipecat server
- Call the
/startendpoint with target phone number - Plivo places the call and connects to your bot
runner_args.body.
Troubleshooting
| Issue | Solution |
|---|---|
| Call doesn’t connect | Verify ngrok URL matches Plivo Answer URL |
| No audio | Check WebSocket connection in Pipecat logs |
| Bot not responding | Verify AI service API keys in .env |
| Authentication errors | Check Plivo Auth ID and Token |
- Server logs: Terminal running
server.py - Bot logs:
bot_<room_name>.logfiles - Plivo logs: Console > Logs > Calls
Related
- Pipecat Documentation - Complete Pipecat setup
- Pipecat Plivo Examples - Source code
- Audio Streaming Overview - Plivo Audio Streaming docs