What you get
A FreePBX trunk to CallNode gives you three things on one trunk: calls to your CallNode numbers delivered straight into FreePBX and routed by its inbound routes; outbound calls from your extensions to the public network, on accounts where termination is enabled; and, optionally, calls from your extensions into the AI agents that answer your CallNode numbers. This page is the full walkthrough for the FreePBX-style example on the SIP trunking page, using the FreePBX GUI and chan_pjsip.
It uses an IP-authenticated trunk, which needs a static public IP on the FreePBX side. If your PBX sits behind NAT or its address changes, use a registration trunk instead; the FreePBX steps differ only in the trunk's authentication fields.
Before you start
- A CallNode account that has passed business verification, and at least one CallNode number.
- FreePBX 16 or 17 with
chan_pjsip(the default), on a host with a static public IP. - Admin access to both the FreePBX firewall and the host's own firewall, if it runs one.
- For outbound calls to the public network: a wholesale account with termination enabled. Without it, outbound calls on the trunk reach your CallNode agents only, never the public network.
1. Create the trunk in CallNode
- Open /dashboard/trunks and create a trunk. Name it after the PBX.
- Under allowed source IPs, enter the public IP FreePBX sends from. Calls from any other address are dropped, so list every address if the PBX has more than one.
- Turn on ingress.
- Pick a default agent number. Calls from FreePBX to a number that is not one of yours reach this number's agent (unless termination is enabled, in which case they go to the public network).
- Set the trunk's Outbound caller ID to one of your CallNode numbers. Every outbound call must present a number on your account; this is the fallback when FreePBX sends something else.
2. Add the trunk in FreePBX
Connectivity → Trunks → Add Trunk → Add SIP (chan_pjsip) Trunk, then fill in the tabs below. Anything not listed keeps its default.
General tab
| Setting | Value |
|---|---|
| Trunk Name | CallNode |
| Hide CallerID | No |
| Outbound CallerID | One of your CallNode numbers in E.164, e.g. +12512022010 (or leave blank and rely on the trunk's Outbound caller ID in CallNode) |
| CID Options | Allow Any CID |
| Maximum Channels | Your contracted channel cap, or blank |
pjsip Settings tab → General
| Setting | Value |
|---|---|
| Username / Secret | Blank |
| Authentication | None |
| Registration | None |
| Language Code | Default |
| SIP Server | sip.callnode.io |
| SIP Server Port | 5062 |
| Context | from-pstn |
| Transport | 0.0.0.0-udp (UDP) |
pjsip Settings tab → Advanced
| Setting | Value |
|---|---|
| Match (Permit) | 198.27.122.194, 192.95.44.47, 192.99.90.89, 198.27.122.204 — all four, one per line or comma-separated. These are the addresses CallNode delivers calls from; see where delivery calls come from. |
| From Domain | sip.callnode.io |
| Codecs | ulaw and alaw; clear the rest |
| DTMF Mode | RFC 4733 |
| Qualify Frequency | 60 |
Submit, then Apply Config. For reference, this is the configuration FreePBX writes for that trunk:
; What FreePBX writes for the trunk configured below (pjsip.endpoint.conf,
; pjsip.aor.conf, pjsip.identify.conf). Shown so you can check the result;
; configure it through the GUI rather than pasting this.
[CallNode]
type=endpoint
context=from-pstn
disallow=all
allow=ulaw
allow=alaw
aors=CallNode
from_domain=sip.callnode.io
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
[CallNode]
type=aor
contact=sip:sip.callnode.io:5062
qualify_frequency=60
[CallNode]
type=identify
endpoint=CallNode
match=198.27.122.194
match=192.95.44.47
match=192.99.90.89
match=198.27.122.2043. Open both firewalls
Most FreePBX installs run two firewalls: the FreePBX firewall module and the operating system's own (firewalld or iptables). Signalling and audio must be allowed in both.
- Connectivity → Firewall → Networks: add
198.27.122.194,192.95.44.47,192.99.90.89and198.27.122.204to the Trusted zone. - On the host: allow UDP 5060 (SIP) and your RTP range (FreePBX default
10000–20000) from the same four addresses. With firewalld:firewall-cmd --permanent --zone=trusted --add-source=198.27.122.194(repeat for the other three), thenfirewall-cmd --reload. - Outbound from FreePBX needs nothing special: it sends to
sip.callnode.io:5062over UDP. - If FreePBX is behind a router, set Settings → Asterisk SIP Settings → External Address and Local Networks so audio is not sent to a private address. One-way audio on an otherwise working call is almost always this.
4. Deliver your numbers to FreePBX
Delivery is set per number, so you can move numbers to the PBX one at a time.
- In the dashboard, open the number and set Deliver to trunk to the trunk you created (or
PATCH /api/v1/numbers/:idwith{ "voice": { "trunkId": "..." } }). Details under deliver a number to a trunk. - In FreePBX, Connectivity → Inbound Routes → Add Inbound Route. DID Number is the number in E.164 with the plus, e.g.
+12512022010: that is how it appears in the request URI. Set the destination to an extension, ring group, queue or IVR. - The original caller's number is presented as caller ID, so CID-based routing and your phones' displays work as they would with any carrier.
5. Outbound calls (termination)
Outbound calls to the public network require a wholesale account with termination enabled: it is off until our team enables it, and there is no API call to make. Until then, an outbound call to a number you do not own reaches your trunk's default agent. To ask for it, contact us.
Connectivity → Outbound Routes → Add Outbound Route: name it, put the CallNode trunk first in Trunk Sequence, and add dial patterns that produce an E.164 number with a leading plus:
prepend prefix match pattern result
+ (none) 1NXXNXXXXXX +1NXXNXXXXXX (11-digit dialling)
+1 (none) NXXNXXXXXX +1NXXNXXXXXX (10-digit dialling)
+ 011 X. +X. (international, where enabled on your account)Leave Route CIDblank unless every call from this route should present one specific number. Whatever FreePBX sends as caller ID must be a number on your CallNode account; if it is not, the trunk's Outbound caller ID from step 1 is presented instead, and if neither resolves the call is refused with 403.
Each completed call is charged to your prepaid balance at the rate for the destination when it ends, rounded up to the whole minute; unanswered calls cost nothing. Per-country rates are published on the wholesale page. The full list of SIP responses and what to do about each is under trunk-level outbound caller ID.
6. Test it
- Inbound:call one of the delivered numbers from a mobile. The routed extension should ring with the mobile's number as caller ID. If it rings out silently, recheck Match and both firewalls (step 3).
- Outbound: from an extension, dial a number you can answer. The call appears under Billing in the dashboard as a wholesale outbound call once it ends. A
403means the caller ID is not a number on your account; a503usually means termination is not enabled yet. - Into an agent: from an extension, dial one of your CallNode numbers that is not delivered to the trunk. Its AI agent or call routing answers, exactly as it would a call from the public network.
Behind NAT: the registration variant
Create a registration trunk instead and copy the shown-once username and password. In the FreePBX trunk, the pjsip General tab becomes:
| Setting | Value |
|---|---|
| Username | The trunk’s generated username |
| Secret | The shown-once password |
| Authentication | Outbound |
| Registration | Send |
| SIP Server | sip.callnode.io |
| SIP Server Port | 5061 |
| Transport | A TLS transport (enable one under Asterisk SIP Settings → SIP Settings [chan_pjsip] first) |
| Context | from-pstn |
No Match list and no inbound firewall rules are needed: calls to your delivered numbers go to wherever the PBX last registered from. Set the trunk's Outbound caller ID in CallNode, because a registration trunk's From carries the username rather than a number.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Inbound call rings out, nothing in the Asterisk log | A delivery address is missing from Match or from one of the two firewalls. Add all four in all three places. |
| Inbound call reaches FreePBX but no inbound route matches | The DID in the route lacks the leading plus. Use +E.164. |
| Outbound refused with 403 | Caller ID is not a number on your account, verification is incomplete, or the destination class is not enabled. Set Outbound CallerID to one of your numbers, or set the trunk’s Outbound caller ID in CallNode. |
| Outbound gets 503 | Termination is not enabled on the account, the channel cap is full, or no route is available right now. |
| One-way or no audio | NAT: set External Address and Local Networks in Asterisk SIP Settings, and allow the RTP range from the four delivery addresses in the host firewall. |
| Trunk shows unreachable on qualify | Qualify uses OPTIONS to sip.callnode.io:5062; confirm UDP 5062 outbound is not blocked and the SIP Server port is 5062, not 5060. |
For the API side of everything above — creating trunks, listing them, delivering numbers — see manage trunks via the API. For what CallNode provides on the wholesale line, see SBC-as-a-Service.