Connecting FreePBX to Telnyx — SIP trunk setup walkthrough
Telnyx is one of the most popular SIP-trunk carriers for FreePBX® deployments — API-first, credit-based pricing, strong US/Canada coverage. This article walks the full setup: creating a SIP Connection in the Telnyx portal, configuring the FreePBX trunk, adding outbound and inbound routes, and the first test call. Assumes you've already followed Configuring a new FreePBX install and have extensions registered.
1. Sign up for Telnyx and load credit
Create an account at telnyx.com. The free trial gives you a small credit; for production usage you'll need to add a payment method. Telnyx is post-paid for established accounts, prepaid until then.
You'll also need to complete the Regulatory Profile under Account → Regulatory Requirements before you can buy DIDs. Takes 5 minutes; required by FCC for US numbers.
2. Create a SIP Connection
In the Telnyx portal: Voice → SIP Connections → Add SIP Connection.
- Connection Type: Credentials (simpler than IP auth and works behind NAT). IP auth is an option if you have a static IP — slightly more secure since no password to leak, but less convenient.
- Connection Name: anything memorable, e.g.
lylix-freepbx - Save. Telnyx generates a username and asks you to set a password (long random string — use a password manager).
Once created, click the connection and note these settings for later:
- Username
- Password
- SIP URI (something like
sip.telnyx.com)
Connection settings to verify
On the SIP Connection's Settings tab:
- Outbound Voice Profile: create one if you don't have one (Voice → Outbound Voice Profiles → Add). Set a daily/monthly spending limit so a misconfiguration can't run away with your bank account.
- SIP Region: pick US East 1 (Ashburn) — same US East Coast location as LYLIX, lowest latency.
- DTMF Type: RFC 2833 (default).
- Codec preferences: G.711 (ulaw for US, alaw for EU). Skip G.729 unless you really need bandwidth savings and your customers don't mind paying the licensing.
3. Buy a DID number
In the Telnyx portal: Numbers → Search & Buy Numbers. Pick a region, area code, search, buy. Once you own the number, go to Numbers → My Numbers, click the DID, and on the Voice tab set the Connection to the SIP Connection you created.
This is the routing: inbound calls to this DID get sent over SIP to the FreePBX server registered against the connection.
4. Add the trunk in FreePBX
In FreePBX: Connectivity → Trunks → Add Trunk → Add SIP (chan_pjsip) Trunk.
General tab:
- Trunk Name:
telnyx - Outbound CallerID:
"Your Company" <15551234567>using your Telnyx DID in E.164 format (no plus, 11 digits for US/Canada)
pjsip Settings → General tab:
- Username: the Telnyx connection username
- Secret: the connection password
- Authentication:
Outbound - Registration:
Send - SIP Server:
sip.telnyx.com(or the region-specific one Telnyx shows in the connection details) - SIP Server Port:
5060
pjsip Settings → Advanced tab:
- From Domain:
sip.telnyx.com - From User: your Telnyx connection username
- DTMF Mode:
RFC 4733 - Match (Permit): leave blank unless using IP auth, in which case put the Telnyx peering IPs here
Click Submit, then Apply Config.
5. Verify trunk registration
Wait ~10 seconds, then check Reports → Asterisk Info → PJSIP Endpoints. Your telnyx trunk should show Available with the Telnyx SIP server's IP.
If it shows Unavailable, the most common fixes:
- Username/password mismatch — copy/paste again, check no leading/trailing whitespace.
- Firewall — your FreePBX firewall might be blocking Telnyx's IPs. Telnyx publishes its peering ranges; add them to FreePBX's Connectivity → Firewall → Networks as Trusted.
- NAT — if your VPS has a private IP behind a NAT (rare on LYLIX VPS — yours has a public IP), Telnyx sees one IP, the SIP packet says another. LYLIX VPSes don't have this problem; if you do, check your Settings → Asterisk SIP Settings → External Address matches your public IP.
6. Add an outbound route
Connectivity → Outbound Routes → Add Outbound Route:
- Route Name:
telnyx-us - Route CID: leave blank (uses trunk default)
- Trunk Sequence:
telnyx
Dial Patterns tab — patterns are what FreePBX sends to the trunk. For US/Canada 10-digit dialing with auto-add of the leading 1:
| prepend | prefix | match pattern |
|---|---|---|
| 1 | NXXNXXXXXX | |
| 1NXXNXXXXXX |
This lets users dial either 5551234567 or 15551234567 and both work. For international, add patterns starting with 011 or use E.164 (+ + country code).
Submit, Apply Config.
7. Add an inbound route for your DID
Connectivity → Inbound Routes → Add Inbound Route:
- Description: anything descriptive
- DID Number:
15551234567(E.164 without the +, matching what Telnyx sends) - Set Destination: pick an extension, IVR, or ring group
Submit, Apply Config.
8. Test outbound, then inbound
From your registered softphone:
- Outbound: dial your mobile. You should hear ringback, then your mobile rings, then two-way audio.
- Inbound: call your DID from your mobile. The destination extension should ring.
Watch Reports → Asterisk Logfiles live while testing. Useful Telnyx response codes:
200 OK— call established. Good.403 Forbidden— auth failure or DID not owned.404 Not Found— Telnyx doesn't recognize the destination number (check the dialed digits).503 Service Unavailable— Telnyx-side issue, usually transient.603 Decline— call declined; often a regulatory or fraud-detection rejection (international, premium-rate).
Recommended Telnyx-side hardening
- Spending limit on the Outbound Voice Profile. Hard cap your monthly exposure.
- Geographic restrictions on the profile — block calls to high-toll-fraud destinations (Cuba, North Korea, satellite ranges, premium-rate numbers).
- IP auth instead of credentials if you can — eliminates the password-leak risk. Requires your VPS to have a static IP (which LYLIX VPSes do).
- SIP TLS instead of UDP — encrypts signaling in transit. Set it up after you have a Let's Encrypt cert on the FreePBX server.
If something doesn't work
Telnyx has a useful Debugging → SIP Call Flow tool that shows the SIP exchange for a recent call — INVITE, BYE, provisional responses, the whole thing. Filter to the time of your failed test call; you'll usually see exactly where the negotiation broke down.
If you're still stuck, open a LYLIX ticket with the test date/time and we can dig into the FreePBX side. Telnyx's own support is fast and good for carrier-side questions.
FreePBX®, Asterisk®, and FreePBX modules are registered or common-law trademarks of Sangoma Technologies Corporation; LYLIX hosts FreePBX and Asterisk but is not affiliated with Sangoma. Telnyx is a trademark of Telnyx LLC.
Also Read
Powered by WHMCompleteSolution