This is a sample application that demonstrates how to use Bandwidth's Programmable Voice API with OpenAI's GPT-Live-1 model via the Live API SIP interface to create a real-time AI-powered voice assistant. Unlike the WebSocket integration, the Live SIP integration uses OpenAI's SIP Connector to handle media directly — your application only needs to handle webhooks and send commands via the sideband.
In order to use this integration you need:
- A Bandwidth Universal Platform account with a Voice Configuration Package and SIP Connector enabled
- Your OpenAI Project ID — used to configure your Bandwidth trunk destination
- Your OpenAI API Key
- A publicly accessible server to host your webhook application (e.g., using ngrok)
- Docker (optional)
Your Bandwidth trunk must point to sip:$PROJECT_ID@sip.api.openai.com;transport=tls as the termination destination.
The sample app uses the below environmental variables.
OPENAI_API_KEY # Your OpenAI API Key (must have access to the Live API)
REFER_TO # The phone number to transfer calls to (E.164 format, e.g. +19195554321)
LOG_LEVEL # The logging level for the application (e.g. INFO, DEBUG)
LOCAL_PORT # (optional) The local port for the application (default: 3000)Create a .env file in the root of the project:
OPENAI_API_KEY="your_openai_api_key_here"
REFER_TO="+19195554321"
LOG_LEVEL="INFO"
LOCAL_PORT=3000This application is built using Python 3.13. You can use pip to install the required packages, or Docker Compose to run the application.
# Using Docker Compose
docker compose up --build# Using Python
python -m venv .venv
source .venv/bin/activate
cd app
pip install -r requirements.txt
python main.pyA successful startup will log:
INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO: Application startup complete.Below are the callback paths exposed by this application:
/health/webhooks/openai/live/transport/inbound— receiveslive.transport.incomingevents from OpenAI
A simple way to set up a local callback URL for testing is to use the free tool ngrok.
After you have downloaded and installed ngrok run the following command to open a public tunnel to your port ($LOCAL_PORT)
ngrok http $LOCAL_PORTYou can view your public URL at http://127.0.0.1:4040 after ngrok is running.
Configure your OpenAI project's webhook URL to https://<your-ngrok-url>/webhooks/openai/live/transport/inbound.