Go from zero to a working voice agent you can call from your phone. By the end, you’ll have a LiveKit agent deployed on Telnyx infrastructure, connected to a real phone number.
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
Verify your CLI version:
Set your environment variables to point at a Telnyx LiveKit region:
export LIVEKIT_URL=https://<region>.livekit-telnyx.com
export LIVEKIT_API_KEY=<your-telnyx-api-key>
export LIVEKIT_API_SECRET=<your-secret>
Available regions
| Region | URL |
|---|
| New York | nyc1.livekit-telnyx.com |
| San Francisco | sfo3.livekit-telnyx.com |
| Atlanta | atl1.livekit-telnyx.com |
| Sydney | syd1.livekit-telnyx.com |
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
- Log in to the Telnyx portal
- Go to Real Time Communcations → Numbers → Buy Numbers
- Purchase a number by checking out
Create a SIP connection
NOTE: You’ll need to do this step separately
- In the portal, go to Real Time Communcations → Voice → SIP Connections → Create
- Set the connection type to FQDN
- Point it at your region’s SIP endpoint:
| Region | SIP FQDN |
|---|
| New York | nyc1.sip.livekit-telnyx.com |
| San Francisco | sfo3.sip.livekit-telnyx.com |
| Atlanta | atl1.sip.livekit-telnyx.com |
| Sydney | syd1.sip.livekit-telnyx.com |
- Assign your phone number to this SIP connection
Once your DID is configured in the portal, register it with the LiveKit platform so inbound calls route to your agent:
lk sip inbound create --from <your-phone-number>
lk sip dispatch create --from <your-phone-number>
The SIP connection routes calls from Telnyx’s network to the LiveKit platform. The platform then matches the phone number to your tenant and dispatches the call to your agent.
Step 3: Clone an example agent
Clone the example agents repo and navigate to the restaurant agent:
git clone https://github.com/team-telnyx/telnyx-livekit-agent-examples.git
cd telnyx-livekit-agent-examples/restaurant
This is a fully working voice agent — an Italian restaurant ordering assistant built with livekit-plugins-telnyx for STT, TTS, and LLM.
Step 4: Deploy
Deploy the agent to your Telnyx LiveKit region:
lk agent deploy . --url $LIVEKIT_URL
The CLI uploads your agent code, builds a container image, and deploys it. You’ll see build logs streaming in real-time.
Check that your agent is running:
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 status to confirm the agent is running. Check logs with lk 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