Prerequisites
Before you start, make sure you have:- A Telnyx account
- A Telnyx API key (generate one in the portal)
- A secret key you create and keep safe — this is your
LIVEKIT_API_SECRET - Python ≥ 3.10
- LiveKit CLI (
lk) version 2.16.0 or later
Step 1: Configure the CLI
Set your environment variables to point at a Telnyx LiveKit region:LIVEKIT_API_KEY is your Telnyx API key — the same one you use everywhere else on the platform. Set TELNYX_API_KEY once and reference it throughout.This creates your tenant record on the platform. You only need to do this once per region.
Available regions
Choose the region closest to your users for the lowest latency.
Step 2: Set up telephony
To receive phone calls, you need a phone number (DID) pointed at the Telnyx LiveKit SIP servers. No third-party SIP fees — Telnyx is the carrier.Buy a phone number
- With our APIs
- With the portal
Search for an available number in your area code and order it:1. Browse available numbers (replace 2. Order the number you want:3. Confirm the order completed:Wait for
512 with your area code):Note the number you want before exiting — you’ll need it below.
"success" before moving on.If your order didn’t complete successfully, chat with us — we’re happy to help.
Create a SIP connection
A SIP connection tells Telnyx how to route inbound calls. You’ll point it at one of our regional LiveKit SIP servers so calls land on the right infrastructure.- With our APIs
- With the portal
1. Create the FQDN connection (replace 2. Attach the regional SIP FQDN (replace 3. Assign your phone number to the connection (replace
{slug} with your region slug):CONNECTION_ID and {slug} with your region slug):CONNECTION_ID and phone number):Register the number with the platform
Set up an inbound trunk for your number and a dispatch rule to route calls to your agent. 1. Create an inbound SIP trunk:sid in the response — you’ll need it in the next step.
allowed_addresses restricts which source IPs can send SIP traffic to this trunk. 192.76.120.0/22 is Telnyx’s SIP network — since Telnyx is your carrier, all inbound calls will originate from this range.Step 3: Clone an example agent
Clone the example agents repo and navigate to the restaurant agent:livekit-plugins-telnyx for STT, TTS, and LLM.
Step 4: Deploy
Register the agent with the platform, then deploy it to your Telnyx LiveKit region:lk agent status reads the agent ID from your livekit.toml file — you don’t need to specify it manually. If you skip lk agent create, there’s no ID in the file and the command will fail.Step 5: Call your agent
Pick up your phone and dial the number you purchased. You should hear:“Thanks for calling Bella’s Kitchen!”Try ordering some pasta. The agent handles the full conversation — browsing the menu, answering questions, and taking your order.
Troubleshooting
- Call doesn’t connect — Verify your SIP connection is pointed at the correct regional FQDN and your DID is assigned to it.
- Agent doesn’t pick up — Run
lk agent statusto confirm the agent is running. Check logs withlk agent logs. - Audio quality issues — Make sure you’re using the region closest to you.
Next steps
You’ve deployed your first agent. Here’s where to go from here:- Build — Write your own agent from scratch
- Deploy — Regions, scaling, secrets, and production deployment
- Models — STT, TTS, and LLM options available on Telnyx
- Telephony — Inbound/outbound calls, dispatch rules, multiple numbers
- Compatibility — What’s the same and different from LiveKit Cloud