Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vobiz.ai/llms.txt

Use this file to discover all available pages before exploring further.

This integration connects inbound SIP calls through Vobiz directly to the OpenAI Realtime API, enabling AI-powered voice conversations. When someone calls your Vobiz number, the AI answers and converses with the caller in real time over SIP.

Architecture

Caller → Vobiz SIP trunk → OpenAI SIP endpoint → Webhook → Your service → OpenAI Realtime API
Flow overview:
  1. Caller dials your Vobiz number (for example, +918046733659).
  2. Vobiz routes the call to OpenAI’s SIP endpoint.
  3. OpenAI sends a webhook notification to your service.
  4. Your service accepts the call via the OpenAI API.
  5. A WebSocket connection is established for audio streaming.
  6. The AI converses with the caller in real time.

Prerequisites

  • OpenAI account - you need your API key, project ID, and webhook secret from the OpenAI Platform.
  • Vobiz account - a SIP trunk configured and a phone number assigned.
  • Development environment - Python 3.8+ and ngrok installed to handle webhooks locally.

Step 1: Configure Vobiz

Before receiving calls, create an origination URI and point your Vobiz SIP trunk to the OpenAI SIP endpoint.
1

Create the origination URI

Navigate to Origination URIs.Add a new URI with the destination set to proj_xyz123@sip.api.openai.com:5061.
It is critical to explicitly include port 5061.
2

Create the inbound trunk

Navigate to Inbound Trunks.Create a new trunk and attach the Origination URI you just created. Ensure the trunk is associated with your active Vobiz phone number.

Step 2: Install the service

Install Python dependencies

# Create virtual environment
python -m venv venv

# Activate (Windows)
venv\Scripts\activate
# Activate (macOS/Linux)
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Configure environment variables

Copy .env.example to .env and fill in:
OPENAI_API_KEY=sk-...
OPENAI_PROJECT_ID=proj_...
OPENAI_WEBHOOK_SECRET=whsec_...
SKIP_SIGNATURE_VALIDATION=false

Run the service

python app.py
The service automatically starts an ngrok tunnel, displays the webhook endpoint for OpenAI configuration, and launches the server.

Step 3: Production deployment

For production, deploy to a server with a static public URL such as Render, Railway, AWS EC2, or Google Cloud Run.
  • Ensure HTTPS is enabled (required by OpenAI).
  • Use a production WSGI server (for example, gunicorn -w 4 -b 0.0.0.0:8000 app:app).
  • Ensure SKIP_SIGNATURE_VALIDATION=false.

Step 4: Test the integration

Test webhook endpoint

  1. In the OpenAI webhooks page, click Send test event.
  2. Select event type realtime.call.incoming and click Send.
Expected result: service logs should show Received webhook and OpenAI should report Received HTTP 200.

Test a real call

  1. Call your assigned Vobiz number.
  2. The AI should answer within 2-3 seconds and open a conversational loop.

Troubleshooting

Webhook returns 401 (invalid signature)

Webhook secret mismatch.
  • Verify OPENAI_WEBHOOK_SECRET in .env matches the OpenAI platform value.
  • Check there are no extra spaces or quotes.
  • Restart the service.
  • Use SKIP_SIGNATURE_VALIDATION=true for debugging only.

Call returns 500 error from OpenAI

Webhook not configured or unreachable via the ngrok tunnel.
  • Verify the webhook is configured in OpenAI.
  • Ensure the ngrok URL is online and reachable.
  • Test the webhook with Send test event and inspect logs.

”No session found for call_id”

Expected behavior for test events - OpenAI uses fake call IDs for testing. Place a real phone call to test actual streaming functionality.

Next steps