Skip to main content
Telnyx is a programmable telephony provider. The telnyx plugin bridges PSTN phone calls into a Vision Agents + Stream call through Telnyx Call Control webhooks and bidirectional Media Streaming.
Vision Agents uses Stream Video for real-time WebRTC transport by default. External WebRTC transports are supported as well. Most AI providers offer free tiers to get started.

What the plugin provides

  • Call Control webhook handling pattern (via your FastAPI server)
  • Bidirectional Telnyx Media Streaming over WebSocket
  • CallRegistry for call/session/token tracking
  • attach_phone_to_call to bridge Telnyx audio ↔ Stream WebRTC
  • Audio conversion: PCMU, PCMA (8 kHz), L16 (16 kHz)

Prerequisites

Telnyx media streaming for programmable calls requires a Call Control App with a webhook URL. A regular phone-number connection — including a forwarding-only connection — is not enough. The Call Control App ID is also the connection_id used by the outbound Dial API.

Installation

Or install the plugin package directly:

Environment Variables

Telnyx account setup

Quick local dev (--setup-telnyx) — the plugin examples auto-create a temporary Call Control App, set the webhook URL, route the inbound number, and clean up on shutdown. Manual setup:
  1. Create a Telnyx Call Control App.
  2. Set the app webhook URL to https://<NGROK_URL>/telnyx/events.
  3. Route your inbound phone number to that Call Control App.
  4. For outbound calls, ensure the app has an outbound voice profile for your target country. On restricted accounts, verify destination numbers before dialing.
See the full setup guide in the Telnyx plugin examples on GitHub.

Quick Start

The plugin gives you registry, media stream, and bridge primitives. Your FastAPI server wires them to Telnyx webhooks and WebSockets:
Webhook signature verification is shown in the plugin examples (example_helpers.parse_verified_telnyx_webhook) but is application-level — not exported from the plugin’s public API. See the inbound example source for the Ed25519 verification pattern.

Inbound calls

Telnyx sends webhooks to POST /telnyx/events. On call.initiated with direction incoming, register the call and answer with a media stream URL:

Outbound calls

Pre-register the call in the registry, start your server, then dial via the Telnyx Call Control API with connection_id set to your Call Control App ID:
The WebSocket media handler is the same as inbound.

Key Components

Audio formats

To send agent audio back to the caller, start Telnyx streaming with stream_bidirectional_mode=rtp.

Common setup errors

Next Steps

Telnyx Plugin Examples

Minimal inbound and outbound phone examples

Phone Calling

Provider overview and learning path

Twilio

Alternative telephony provider

Stream Video RTC

Default edge transport for agent calls

RAG for Agents

Add knowledge base to phone agents

Build a Voice Agent

Get started with voice