This project provides a production-ready solution for making outbound AI phone calls using LiveKit and Vobiz SIP trunks. The AI agent can place calls, wait for an answer, and hold a natural conversation with the recipient.
| File | Description |
|---|---|
agent.py |
The main AI worker. It runs in the background, waits for dispatch jobs, and places outbound calls. |
make_call.py |
A utility script to trigger calls. It dispatches the agent to a unique room with the target phone number. |
setup_trunk.py |
Script to configure the LiveKit SIP Trunk with Vobiz credentials. |
transfer_call.md |
Guide for configuring and using SIP transfers. |
.env.example |
Template for environment variables and secrets. |
requirements.txt |
List of Python dependencies. |
Ensure you have the following installed:
- Python 3.9+
- uv (recommended for fast package management) - Install uv
You will need the following accounts:
- LiveKit Cloud Account: Get your Project URL, API Key, and Secret from cloud.livekit.io.
- Vobiz Account:
- Log in to the Vobiz Console Platform.
- Navigate to your SIP Trunk settings to find:
- SIP Domain (e.g.,
xxx.sip.vobiz.ai) - Username & Password
- SIP Domain (e.g.,
- Get your DID Number (e.g.,
+91...).
- OpenAI / Deepgram Keys:
- OpenAI API Key (for LLM and optional TTS)
- Deepgram API Key (for STT)
-
Clone/Copy the project to your local machine.
-
Open a terminal in the project folder (
livekit-outbound-calls). -
Install dependencies using
uv:# Create virtual environment uv venv # Install required packages uv pip install -r requirements.txt
- Create your env file:
cp .env.example .env.local
- Edit
.env.localand fill in your keys:LIVEKIT_URL=wss://... LIVEKIT_API_KEY=... LIVEKIT_API_SECRET=... OPENAI_API_KEY=... DEEPGRAM_API_KEY=... # SIP Config VOBIZ_SIP_DOMAIN=... VOBIZ_USERNAME=... VOBIZ_PASSWORD=... VOBIZ_OUTBOUND_NUMBER=+91...
- Set Trunk ID in
agent.py:- If you haven't created a trunk yet, you'll need to create one using the LiveKit CLI or setup script.
- Once created, get the
TRUNK_ID(starts withST_...). - Open
agent.pyand update line 25:OUTBOUND_TRUNK_ID = "ST_xxxxxxxxx"
Open a PowerShell terminal and run:
uv run python agent.py start- Wait until you see the message:
INFO:livekit.agents:registered worker ... - Keep this terminal open. This agent will listen for call requests.
Open a separate terminal window (keep the first one running) and run:
uv run python make_call.py --to +919988776655 (your number)(Replace +919988776655 with the actual number you want to call)
make_call.pysends a "dispatch" request to LiveKit.- LiveKit assigns the job to your running
agent.py. - The agent joins a secure room (e.g.,
call-9148...). - The agent dials the phone number via the Vobiz SIP trunk.
- When the user answers, the agent will start listening and speaking.
- Call Transfer: You can ask the agent to transfer you.
- Default: "Transfer me." -> Transfers to the configured default number.
- Custom: "Transfer me to +1..." -> Transfers to the specific number.
- For detailed setup and troubleshooting, see transfer_call.md.
-
Agent not starting?
- Check
.env.localis correct. - Ensure dependencies are installed (
uv pip install ...).
- Check
-
Call not connecting?
- Check
OUTBOUND_TRUNK_IDinagent.py. - Verify your Vobiz SIP credentials and balance.
- Ensure the phone number includes the country code (e.g.,
+91).
- Check
-
No audio?
- Check OpenAI/Deepgram API keys.
- Check the agent logs for errors.