Dograh

How to Build a Voice Agent With Telnyx, From Number to Test Call

How to Build a Voice Agent With Telnyx, From Number to Test Call
TutorialNovember 23, 2026·9 min read

How to Build a Voice Agent With Telnyx, From Number to Test Call

Abhishek Kumar
Abhishek Kumar·Co-founder, Dograh AI

Co-founder of Dograh, building the future of open-source voice AI agents. Own your voice AI stack.

To build a voice agent with Telnyx, create an API key, buy a number, add an Outbound Voice Profile, and point the number's Voice API application at an agent that streams the call. For teams that want to keep Telnyx and own the agent, Dograh, the open-source AI voice agent platform, runs it on your existing Telnyx account.

Key Takeaways

  • Telnyx needs an Outbound Voice Profile on the application, or outbound calls fail.
  • Telnyx webhooks are verified with your account's public key.
  • Dograh can create the Telnyx application for you when you save.

Telnyx supplies the number, the network and the call audio, and the agent does the listening and talking. We cover how a Telnyx call reaches an agent, build one in Dograh step by step on your own account, then we talk about test calls, a transfer and go-live checks.

How a Telnyx call reaches an AI agent

A Telnyx call reaches an agent through a Voice API application, which Telnyx also calls a Call Control connection. Each number is assigned to an application, and the application keeps a webhook URL. When someone dials the number, Telnyx sends the call's events to that webhook, and the software behind it answers the call and asks Telnyx to stream the audio.

That stream is where call quality is decided. Telnyx's media streaming guide lists PCMU at 8 kHz as the default codec, with PCMA, G722, OPUS, AMR-WB and 16 kHz L16 as options, and warns that mismatched audio is transcoded, which may degrade quality. The agent should ask for the format it actually uses.

Outbound calls need one more piece. Telnyx's get-started guide has you attach an Outbound Voice Profile to the application, which sets up outbound billing and controls the destinations you can call. Dialing from a number that is not on your account fails with error D35.

Telnyx offers two ways to put an agent on that call itself. AI Assistants are built in its portal with no code, and a LiveKit plugin lets you write the agent in Python, though Telnyx notes LiveKit on Telnyx is being retired. Our Telnyx review covers both. The third path keeps Telnyx as your carrier and runs an open-source agent layer you control. Dograh is that layer, on your servers or on Dograh Cloud, with the Telnyx account and its bill staying yours.

What you need before you start

You need a Telnyx account with billing set up, and a place to run Dograh, either a Dograh Cloud account or a server you control. Keep your mobile phone nearby for the inbound test and a second phone for the transfer in Step 7.

Set aside time in the Telnyx portal before you touch Dograh. Two of the three things Telnyx needs from you come before the Dograh steps, and getting them right first saves a failed first call.

Step 1: Set up the Telnyx side

Start in the Telnyx Mission Control Portal. Open API Keys and create a key for Dograh, then search for and buy a voice number in the country your callers are in.

Next, create an Outbound Voice Profile and make sure it is enabled. You do not need to attach it to anything yet. When Dograh creates the Voice API application in Step 4, it binds an existing enabled profile to it. Dograh never creates a profile itself, because a profile affects billing, so this step stays with you.

If the agent will only take inbound calls, the profile can wait. The first outbound call is where its absence shows, as Telnyx error D38.

Check: You have an API key saved, a number under Numbers, My Numbers, and an enabled Outbound Voice Profile.

Step 2: Run Dograh on Cloud or your own server

Choose where the agent layer runs. Dograh Cloud needs only a sign-up at app.dograh.com. To self-host, run Docker Compose on a server with at least 8 GB of RAM and 4 vCPUs, and our guide to self-host a voice AI agent with Docker covers the install.

Telnyx sends every call event to a webhook, so a self-hosted Dograh backend must be reachable from the internet over HTTPS. Allow Telnyx's traffic through any firewall in front of it.

Check: You can sign in and see Voice Agents, Telephony and Tools in the sidebar.

Dograh

Open Source Alternative to Vapi / Retell

Self-hosted voice agent platform — no per-minute fees

dograh-hq/dograh

Star on GitHub

Step 3: Build the agent

Open Voice Agents in the sidebar, choose Create Agent and describe the agent in plain words, starting from "Build me an agent that…". Say who calls, what the agent should collect and when a person should take over.

The builder may ask a few questions, then shows "Your agent requirements". Select Approve & build, or Request changes if something is wrong. When the draft looks right, Test agent saves it and publishes version 1. On a self-hosted install, the builder needs a Dograh Service Key in Model Configurations, and without one you build the agent on the canvas.

Check: The agent opens in the editor with version 1 published.

Step 4: Connect Telnyx to Dograh

Open Telephony in the sidebar and choose Add configuration. In the Add telephony configuration dialog, name it, pick Telnyx as the provider and paste your API Key.

Leave Call Control App ID blank. On save, Dograh creates a Voice API application named dograh- plus a random suffix, sets its webhook to Dograh, and binds the enabled Outbound Voice Profile from Step 1. If you paste the ID of an application you already have, attach the profile to it yourself in Telnyx.

Paste the Webhook Public Key too. You find it in the portal under Keys & Credentials, then Public Key, and Dograh uses it to check that each webhook really came from Telnyx. Without it, Dograh rejects Telnyx's webhooks and calls never reach the agent. Add your number under Phone Numbers in E.164 form, such as +1415555XXXX, then select Create. The Telnyx setup page shows the same fields.

Check: The saved configuration shows the Connection ID of the new dograh- application.

Step 5: Assign the number and route it

A Telnyx number only reaches an application once it is assigned there. In the portal, open Numbers, then My Numbers, and assign your number to the dograh- application.

Back in Dograh, open the Telnyx configuration and choose Add phone number. Enter the number in E.164 form as the Address, pick your agent as the Inbound workflow, leave Active on and select Add. Saving also pushes the inbound address to the application's webhook, https://api.dograh.com/api/v1/telephony/inbound/run with POST on Dograh Cloud, or the same path on your own backend domain.

That webhook sits on the application, so every number assigned to it shares one address. Dograh matches each call to its agent by the number dialed. If the dialog shows "Saved, but failed to sync inbound webhook to the provider.", open Call Control, then Applications in Telnyx, and paste the address under Webhook Settings with POST.

Check: The application's Webhook Settings show the Dograh address, and your number is listed on the application.

Step 6: Make test calls

Test both directions from real phones. Call the Telnyx number from your mobile and speak to the agent as a customer would, including one interruption.

For outbound, open the agent, select Phone Call in the editor header, pick the Telnyx configuration and number, enter the number to call and select Start Call. If Telnyx returns D38, the application has no enabled Outbound Voice Profile, so go back to Step 1.

Dograh asks Telnyx for PCMU, so the agent hears 8 kHz audio. Most phone calls still reach the agent as 8 kHz audio, while a browser demo runs at 16 kHz. The independent WildASR benchmark found simulated phone audio barely moved most modern speech-to-text models but broke one, so judge your model on these calls.

Check: Both calls appear under Agent Runs with a transcript and a recording.

Join the Dograh Community

Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.

Step 7: Add Transfer Call and test it

Transfer Call works on Telnyx and hands the caller to a person on a real number. Open Tools, select Create Tool and choose Transfer Call. Enter the staff number in E.164 form as the Transfer Destination and keep the 30-second Transfer Timeout, or set 5 to 120 seconds.

Attach the tool to the agent's node under Tools, and add a prompt line that says when to use it, such as when the caller asks for a person. On Telnyx, Dograh calls the destination first and connects the caller only when someone answers, bridging both legs through a Telnyx conference. If nobody answers, the line is busy or the call fails, the agent hears why and the call continues with the agent. The Transfer Call page lists the other settings.

A caller is on a call with the voice agent. The agent rings a staff member's phone, the staff member answers and joins a meeting room labeled both legs bridged, a Telnyx conference, and only then the caller's line joins the same room.
The person answers first, and only then does the caller join them in the same conference.

Transfers run on phone calls, so call the agent from one phone, ask for a person and answer on the second.

Check: The second phone rings, you answer, and the caller joins you.

Before you ship it

A clean test call means the setup works, and a few checks remain before customers call. Your Outbound Voice Profile controls which destinations you can dial, so confirm it allows every country on your call list.

Add a QA node so calls are scored after they end, and see how to run post-call analysis on voice calls for what to score. If callers need a link or confirmation in writing, see how to send SMS from a voice agent.

The running cost comes in two bills. Telnyx's Call Control pricing lists the Voice API at $0.002 a minute plus a $0.0032 inbound SIP fee, media streaming at $0.0035 a minute and $0.10 per transfer, and our guide to Telnyx voice AI pricing prices a full call. Hosting Dograh on your own server adds no per-minute platform fee on top. You still pay for that server, your model keys and the Telnyx minutes above, and your team handles the database and each upgrade. Support comes through the open-source community, and Enterprise adds custom SLAs. Dograh Cloud takes the hosting off your hands for a 1¢-a-minute platform fee, with 10 concurrent calls included on pay as you go, while a self-hosted install runs 10 by default, a limit you can raise.

To recap, you set up the Telnyx key, number and profile, ran the agent layer, built the agent, connected Telnyx with its public key, assigned and routed the number, tested both directions and added a transfer. The agent itself never depended on Telnyx, so it can move carriers later.

Glossary

Voice API application
Telnyx's container for call handling, also called a Call Control connection. Numbers are assigned to it, and it keeps the webhook that receives call events.
Outbound Voice Profile
A Telnyx setting attached to an application that handles outbound billing and allowed destinations. Without an enabled one, outbound calls fail with D38.
Webhook Public Key
The key Telnyx publishes so receivers can verify its webhook signatures. Dograh needs it to accept Telnyx call events.
PCMU
The G.711 mu-law codec at 8 kHz, Telnyx's default for media streams. Dograh asks Telnyx for it on every call.

Frequently Asked Questions

Get started with Dograh

Build, deploy, and scale AI agents with Dograh. Join the community of developers building the future.