Telnyx Connector
A Telnyx connector streams live audio from a Telnyx call into a VideoSDK room using TeXML media streaming. You point a Telnyx TeXML application at the connector, and Telnyx opens a bidirectional WebSocket that carries the call audio into the room. No SIP trunk is required.
Setup takes three steps: create the connector, configure your TeXML application, and route the call to a room. If you are new to connectors, read the Connectors Overview first.
How It Works
- A caller dials your Telnyx number.
- Telnyx sends a TeXML voice webhook to your connector's webhook URL.
- VideoSDK resolves routing and responds with TeXML that tells Telnyx where to stream the audio:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Stream url="wss://ingest.videosdk.live/telnyx?ref=<callRef>" track="both_tracks" bidirectionalMode="rtp" bidirectionalCodec="PCMU" />
</Start>
<Pause length="86400" />
</Response> - Telnyx opens that WebSocket and streams audio. VideoSDK claims the call, joins the room, and bridges audio in both directions. The
<Pause>element keeps the call alive while streaming.
You do not implement the WebSocket protocol; Telnyx handles it. Audio is PCMU (G.711 μ-law) at 8 kHz, in 20 ms frames of 160 bytes. The call is identified by the ref value in the stream URL, because Telnyx exposes a call_control_id in its stream start event rather than the TeXML CallSid.
Prerequisites
- A VideoSDK account and API token. See Generate a VideoSDK Token.
- An active Telnyx phone number.
- A Telnyx TeXML application, created under Voice > TeXML in the Telnyx Portal.
Step 1: Create a Connector
Create the connector with a single API call. Setting defaultRoomId here is the fastest path to a working call, since every call then joins that room.
curl -X POST https://api.videosdk.live/v2/connectors \
-H "Authorization: Bearer $VIDEOSDK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"provider": "telnyx",
"name": "Main Telnyx Connector",
"defaultRoomId": "abcd-efgh-ijkl",
"region": "us002"
}'
| Field | Type | Required | Description |
|---|---|---|---|
provider | string | Yes | Must be telnyx. |
name | string | No | A label to help you recognize the connector later. |
defaultRoomId | string | No | Room that calls join when no routing rule matches. Set this for the simplest setup. |
defaultRuleId | string | No | Fallback routing rule ID, for dynamic routing. |
region | string | No | Pins the media and ingest region (e.g., us002 or in002). When omitted, the region is derived from the caller. |
The response contains the connector, including the webhookUrl you need for the next step:
{
"message": "Connector created successfully",
"data": {
"id": "cn_c9t4k2m8x1p5r3v7",
"provider": "telnyx",
"name": "Main Telnyx Connector",
"webhookUrl": "https://api.videosdk.live/v2/hooks/telnyx/whk_9Qz2kP7mL3xR8vC1yB4nT6gW5dS0hF2",
"defaultRoomId": "abcd-efgh-ijkl",
"defaultRuleId": null,
"region": "us002",
"createdAt": "2026-06-21T14:30:45.123Z"
}
}
| Field | Description |
|---|---|
id | Connector ID, prefixed with cn_. Use it to fetch, rotate, or delete the connector. |
webhookUrl | The URL you set as the TeXML application's voice webhook in the next step. It embeds the secret webhook key (whk_...). |
Copy the webhookUrl from the response. You will set it on the TeXML application in Step 2.
Anyone who has the webhook URL can route calls into your room, because the key is part of the URL. If it leaks, rotate the key to invalidate the old URL.
Step 2: Configure Telnyx
Telnyx routes calls through a TeXML application. Point its voice webhook at the webhookUrl from Step 1, then assign your number to that application.
- Open the Telnyx Portal and go to Voice > TeXML Applications.
- Create or edit a TeXML application.
- Set the inbound Voice webhook URL to the
webhookUrl, with the HTTP method set to POST. - Save the application.
- Go to Numbers > My Numbers, open your number, and assign it to the TeXML application.
- Save your changes.
That is the entire provider-side setup. When the number rings, Telnyx posts to the webhook and VideoSDK replies with the <Start><Stream> TeXML automatically.
Step 3: Route the Call
Routing decides which room a call joins. You have three options, from simplest to most flexible:
- Connector default. The
defaultRoomIdyou set in Step 1 sends every call to one fixed room. Best for a single destination or for testing. - Per-call override. Append a
roomIdquery parameter to the webhook URL (...whk_xxx?roomId=<roomId>) to target a specific room for that number. - Routing rules. For different callers or numbers landing in different rooms, or to attach an AI agent, create a routing rule and reference it with
defaultRuleId.
If you set defaultRoomId in Step 1, you can skip this step and move straight to testing.
Step 4: Test an Inbound Call
- Add a participant or AI agent to the target room, so there is audio to exchange.
- Call your Telnyx number from any phone.
- Confirm that the caller hears the room and the room hears the caller.
If you registered lifecycle webhooks, you will see call-started, then call-answered, and finally call-hangup when the call ends. These are the quickest way to confirm the flow end to end.
Manage the Connector
List your connectors:
curl https://api.videosdk.live/v2/connectors \
-H "Authorization: Bearer $VIDEOSDK_TOKEN"
Fetch a single connector:
curl https://api.videosdk.live/v2/connectors/cn_c9t4k2m8x1p5r3v7 \
-H "Authorization: Bearer $VIDEOSDK_TOKEN"
Rotate the Webhook Key
Rotating the key invalidates the current webhook URL immediately and returns a new one. Update the TeXML application with the new URL right after, or calls will stop reaching VideoSDK.
curl -X POST https://api.videosdk.live/v2/connectors/cn_c9t4k2m8x1p5r3v7/rotate-key \
-H "Authorization: Bearer $VIDEOSDK_TOKEN"
Delete a connector:
curl -X DELETE https://api.videosdk.live/v2/connectors/cn_c9t4k2m8x1p5r3v7 \
-H "Authorization: Bearer $VIDEOSDK_TOKEN"
Lifecycle Webhooks
To track calls on your server, register a webhook URL and listen for events such as call-started, call-answered, and call-hangup. Each request carries a videosdk-signature header (a base64 RSA-SHA256 signature of the body) so you can verify it. Connectors use the same webhook system as SIP, so see SIP Webhooks for the full event list, payloads, and registration.
Troubleshooting
| Symptom | Likely cause and fix |
|---|---|
| Call connects but there is no audio | No one is in the target room, or defaultRoomId is wrong. Add a participant or agent and verify the room ID. |
| Call ends immediately after answering | The number is not assigned to the TeXML application, or the webhook method is not POST. Recheck the application configuration and number assignment. |
| The stream never starts | The claim expired (more than 90 seconds), or routing resolved no room. Confirm the voice webhook is the current webhook URL and that a room is resolved. |
| Connector API calls return 401 or 403 | The Authorization token is missing or expired. See Generate a VideoSDK Token. |
| Audio works but quality is low | Telephony audio is 8 kHz narrowband μ-law and PCMU by design. This is expected for PSTN calls. |
API Reference
Connector APIs used in this guide:
Got a Question? Ask us on discord

