Bridge
Teler-Bridge enables real-time, bidirectional audio streaming between a caller and an AI Agent over a persistent WebSocket connection. This guide explains how inbound and outbound voice calls work and clarifies the responsibilities of each component in the process.
1. What is a Bridge?
A Bridge is a structure that connects two points, allowing vehicles to pass over rivers and roads. Similarly, in the case of Teler-Bridge, it is a medium responsible for streaming audio between Teler and the AI Agent in real time. The structure is a WebSocket connection used to send and receive audio from both sides during a call and the vehicles are audio chunks.
2. What is a WebSocket Connection?
A WebSocket connection is a communication protocol that supports full-duplex (two-way) data transmission over a long-lived connection. This is essential for voice calls, where audio must be exchanged continuously without delays.
Inbound call flow:
-
Caller dials a Teler phone number.
-
Teler sends a POST request to the Incoming Call URL (configured on the Teler Platform).
-
The Bridge responds with a Call Flow, including the WebSocket URL (
ws_url) that Teler should connect to for audio streaming. -
Teler establishes a WebSocket connection to the Bridge using the provided
ws_url. -
Once connected, the Bridge establishes a WebSocket connection to the AI Agent.
-
Real-time audio streaming takes place between the Caller and the AI Agent.
Outbound call flow:
-
Your application sends a POST request:
curl -X POST "http://localhost:8000/api/v1/calls/initiate-call" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"from_number": "+91xxxxx",
"to_number": "+91xxxxx"
}' -
The Bridge makes an API request to Teler with the required authorization and parameters. All requirements are listed here.
-
Teler initiates the call to the callee.
-
Teler retrieves the WebSocket URL (
ws_url) from the Flow URL. -
Teler establishes a WebSocket connection to the Bridge (
ws_url). -
Once the connection is active, the Bridge establishes a WebSocket connection to the AI Agent.
-
The conversation between the Callee and the AI Agent begins in real time.