Skip to main content

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:

  1. Caller dials a Teler phone number.

  2. Teler sends a POST request to the Incoming Call URL (configured on the Teler Platform).

  3. The Bridge responds with a Call Flow, including the WebSocket URL (ws_url) that Teler should connect to for audio streaming.

  4. Teler establishes a WebSocket connection to the Bridge using the provided ws_url.

  5. Once connected, the Bridge establishes a WebSocket connection to the AI Agent.

  6. Real-time audio streaming takes place between the Caller and the AI Agent.

Outbound call flow:

  1. 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"
    }'
  2. The Bridge makes an API request to Teler with the required authorization and parameters. All requirements are listed here.

  3. Teler initiates the call to the callee.

  4. Teler retrieves the WebSocket URL (ws_url) from the Flow URL.

  5. Teler establishes a WebSocket connection to the Bridge (ws_url).

  6. Once the connection is active, the Bridge establishes a WebSocket connection to the AI Agent.

  7. The conversation between the Callee and the AI Agent begins in real time.