Asterisk PJSIP Trunk to a Cloud Dialer: Setup Guide
Connect Asterisk to a cloud dialer over a PJSIP trunk: endpoint, AOR, identify and NAT sections, codec and DTMF settings, and a test plan before going live.
Kurze Antwort
To connect Asterisk to a cloud dialer over PJSIP, define a transport, then an endpoint with its context and codecs, an aor pointing at the dialer, and an identify section that matches the dialer's IP address to that endpoint. Set the NAT options on the transport, align codecs and DTMF mode with the dialer, then test OPTIONS, a call each way, DTMF and recording.
Many teams that run Asterisk do not want to replace it. The extensions, queues, IVRs and carrier contracts work, and what is missing is a campaign engine: lists, pacing, compliance checks and a supervisor view. The pattern in this guide keeps Asterisk as the PBX and lets a cloud dialer originate the campaign calls. This is a configuration walk-through for the Asterisk side of that link, using the PJSIP channel driver and the official Asterisk documentation.
The pattern: Asterisk stays, the cloud dialer originates
DialerBee's deployment page describes this as Pattern B, your own PBX. You operate your own PBX or SBC, Asterisk among others, and DialerBee sends outbound originate traffic to your gateway. The platform provides the campaign engine, pacing, compliance enforcement, agent desktop, supervisor tools and reporting, while your voice stays on your infrastructure and your carrier contracts stay in force. The page states this pattern is running in production today.
Two call paths follow from it:
- Dialer to Asterisk: the dialer sends its outbound originate traffic to your Asterisk, which sends it out your carrier trunk. This is the direction the deployment page describes, and agents work the answered calls from the Agenten-Desktop.
- Asterisk to dialer: if you also want your own dialplan to hand calls to the dialer endpoint, agree that path with DialerBee during setup. The deployment page describes the outbound originate direction, so treat this second path as something to confirm, not assume.
If you are still deciding between this and a full cloud setup, the architecture guide to adding a predictive dialer to an existing PBX covers the choice. For people coming from a self-hosted open-source dialer, the VICIdial alternative comparison describes the differences. This post is only the Asterisk configuration.
What you gather first
The Pattern B section of the deployment page lists what a DialerBee gateway needs about your PBX, and the same list tells you what to decide on the Asterisk side:
| Artikel | Decide on the Asterisk side |
|---|---|
| Endpunkt | The public host or FQDN of your Asterisk or SBC and its SIP port |
| Transport | UDP, TCP or TLS (the deployment page recommends TLS in guidance) |
| Authentifizierung | IP allow-list, digest credentials, or registration |
| Codecs | Your preferred order, with a codec both sides support |
| DTMF | RFC 2833, in-band or SIP INFO, to match what your platform expects |
| Kapazität | A concurrent-call ceiling and a calls-per-second limit your Asterisk can carry |
| Health checks and failover | A SIP OPTIONS probe, and a failover gateway if you have one |
PJSIP building blocks
PJSIP configuration lives in pjsip.conf and is built from typed sections. The Asterisk documentation lists the section types and their relationships. (Asterisk documentation, checked November 7, 2026.)
| Abschnitt | What it does for a dialer trunk |
|---|---|
| transport | UDP, TCP, WebSocket or TLS settings, and where NAT options live |
| endpoint | The profile of the remote server: context, codecs, DTMF, link to aor, auth and transport |
| aor | Where the endpoint can be reached; a static contact for a trunk |
| auth | Username and password, only if you use digest authentication |
| identify | Matches inbound traffic from an IP address to an endpoint |
| registration | Outbound registration, only if the other side requires it |
The documented relationships to remember: an endpoint can have zero or one auth and is listed as associated with at least one transport, and an identify section points to at most one endpoint. An endpoint needs at least one aor before Asterisk can contact it.
IP-based or digest authentication
The Asterisk documentation explains why identify matters for trunks. The configuration reference describes the username identification method as matching the endpoint or AOR ID to the username in the From header, so without an identify section the endpoint name has to match that user. The trunk example notes that the user portion of the provider's From header may vary with each call, so it uses an identify section to map all traffic from the provider's IP address to one endpoint. The documentation's own trunk example uses outbound_auth rather than auth for the same reason: the provider typically does not authenticate inbound calls.
- IP-based: transport, endpoint, aor and identify. No auth section. This suits a dialer with fixed signalling addresses, which your dialer vendor should give you for the allow-list.
- Digest credentials: add an auth section and reference it from the endpoint. Use this if the dialer cannot present fixed addresses or your policy requires credentials.
- Registration: only if one side must register to the other, using a registration section. Not needed for IP-based originate traffic.
A starting configuration (illustrative)
The skeleton below follows the structure of the examples in the Asterisk documentation. All names and addresses are placeholders from documentation ranges, and you must replace them with your own values. Check option names against the Asterisk version you run.
[dialer-transport]
type=transport
protocol=udp
bind=0.0.0.0
[cloud-dialer]
type=endpoint
transport=dialer-transport
context=from-dialer
disallow=all
allow=ulaw
allow=alaw
aors=cloud-dialer
direct_media=no
[cloud-dialer]
type=aor
contact=sip:dialer.example.com:5060
[cloud-dialer]
type=identify
endpoint=cloud-dialer
match=203.0.113.10 What each part is doing:
- Der transport binds UDP on all interfaces. Use TCP or TLS if your dialer endpoint and security policy call for it.
- Der endpoint sets
context, the dialplan context calls from the dialer land in;disallow=allfollowed byallowlines is the documented way to set a codec list; anddirect_media=nokeeps Asterisk in the media path. The Asterisk reference notes that direct_media defaults to yes, which lets media flow directly between endpoints. - Der aor carries a static
contactso Asterisk knows where to send calls it originates towards the dialer. - Der identify maps the dialer's address (a documentation-range placeholder here) to the endpoint. Ask the dialer vendor for the real signalling addresses and add one
matchline per address.
NAT: external addresses and local networks
If Asterisk sits behind a router, the documented NAT options go on the transport. (Asterisk documentation on res_pjsip and NAT, checked November 7, 2026.)
- local_net: addresses in this range get no NAT rewriting. List your private networks.
- external_media_address: the public address used for RTP. When Asterisk sends to a destination outside local_net and the SDP media address is inside it, the SDP address is rewritten to this value.
- external_signaling_address: the signalling counterpart. The documentation says the two should normally match unless you split signalling and media.
- direct_media=no on the endpoint, because the private address is not routable from the other side.
For remote phones behind NAT the documentation also describes rtp_symmetric, force_rport and rewrite_contact. A dialer trunk talking to a fixed public address generally does not need them, but they are the next thing to try for registered remote phones. Whatever you choose, open the RTP port range and the SIP port to the dialer's addresses on your firewall. A router feature that rewrites SIP, often called SIP ALG, is a frequent source of trouble and is usually better disabled.
Codecs and DTMF
The two sides must share a codec or the call fails at setup. The SIP 488 codec mismatch guide explains why. The practical rule for this trunk is: choose the list on the Asterisk endpoint, then give the dialer gateway the same list. G.711 (ulaw and alaw in Asterisk naming) is the safe common ground.
For DTMF, Asterisk's dtmf_mode option on the endpoint defaults to rfc4733, which sends digits outside the audio stream. Other values are inband, info (SIP INFO), auto, auto_info and none. (Asterisk res_pjsip configuration reference, checked November 7, 2026.) The dialer gateway form calls its default RFC 2833 (telephone-event), so setting Asterisk to rfc4733 and the dialer to RFC 2833 gives you out-of-band digits on both sides. If the two disagree, keypresses vanish and IVR navigation and opt-out presses fail without any error.
A dialplan context for calls from the dialer
The context on the endpoint names where inbound calls from the dialer enter your dialplan. Keep it separate from your internal and carrier contexts so that dialer traffic can reach only what you intend. The example below is illustrative and the extension patterns are placeholders. See the Asterisk documentation page on dialing PJSIP channels for the syntax of your version.
[from-dialer]
; calls the dialer sends to your carrier trunk
exten => _X.,1,NoOp(Dialer call to ${EXTEN})
same => n,Dial(PJSIP/${EXTEN}@your-carrier-endpoint)
same => n,Hangup() If you also route calls from the dialer to your own extensions, queues or IVRs, add that routing to the same context and agree it with DialerBee first. Decide this before the first test, because it determines what "success" looks like in the test plan.
Test plan
Do this in order, with one test number and no live campaign:
- Erreichbarkeit. On the dialer side, click Test Connection on the gateway's Routing tab; the deployment page describes gateway health checks as a SIP OPTIONS probe. On Asterisk, the aor option
qualify_frequencysets how often Asterisk checks a contact; its default of 0 means it never qualifies, so set a value if you want Asterisk to report reachability. - Dialer to Asterisk to carrier. Place one test call from the dialer. Confirm it arrives in the
from-dialercontext and reaches the carrier. - Asterisk to dialer. Route one test call from a desk phone to the dialer endpoint and confirm it connects.
- Audio both ways. One-way audio points at NAT, the external media address or the RTP port range.
- DTMF. Call a menu and press digits in both directions.
- Recording. If you record, play a call back. If Asterisk and the dialer both record, decide which copy is authoritative.
- Capacity. Run a small burst and confirm your concurrency and calls-per-second limits hold before a full campaign.
- Failover. If you have a second gateway, disable the first and confirm calls move.
Troubleshooting pointers
- Instant failure on every call: check the identify match address and the firewall. If the dialer's source address is not matched, Asterisk moves on to its other identification methods, such as From-user matching, and rejects the call if no endpoint matches.
- 488 Not Acceptable Here: codec mismatch, covered in the SIP 488 guide.
- No audio: NAT options, RTP range, SIP ALG.
- Digits ignored: DTMF mode mismatch.
For the dialer-side fields, values and defaults, the BYOC SIP trunk setup guide und die BYOC-Funktionsseite cover them step by step.
Quellen
- Asterisk documentation, Configuring res_pjsip. docs.asterisk.org (abgerufen am 7. November 2026)
- Asterisk documentation, PJSIP Configuration Sections and Relationships. docs.asterisk.org (abgerufen am 7. November 2026)
- Asterisk documentation, Configuring res_pjsip to work through NAT. docs.asterisk.org (abgerufen am 7. November 2026)
- Asterisk documentation, res_pjsip configuration examples. docs.asterisk.org (abgerufen am 7. November 2026)
- Asterisk documentation, res_pjsip configuration reference (endpoint dtmf_mode, direct_media; aor qualify_frequency, contact, max_contacts). docs.asterisk.org (abgerufen am 7. November 2026)
Häufig gestellte Fragen
Do I need an identify section for a dialer trunk?
Yes, if the dialer authenticates by source IP instead of a username. Without an identify section, Asterisk matches inbound traffic to an endpoint by the user in the From header, which may vary from call to call. An identify section maps traffic from the dialer's address to one endpoint, whatever the From user is.
Should the dialer register to Asterisk or should Asterisk register to the dialer?
For a dialer that originates calls into your Asterisk, neither is needed with IP-based authentication: the dialer sends INVITEs to your public address and the identify section recognises it. Use registration or digest credentials only if your security policy requires them, and then add an auth section and the matching setting on the dialer side.
Why do calls connect but have no audio?
The usual cause is NAT. Asterisk behind a router advertises its private address in the SDP unless external_media_address and local_net are set on the transport, and the RTP port range must be open to the dialer's media addresses. Setting direct_media to no on the endpoint keeps Asterisk in the media path.
Which codec should I allow on the endpoint?
Start with the codec both sides support, normally G.711. In Asterisk, use disallow=all followed by an allow line for each codec you want, and make the same list available on the dialer gateway. If the two sides share no codec the call fails with a 488, which the codec mismatch guide covers.
How do I check the trunk is up before sending real traffic?
Use SIP OPTIONS. The dialer can probe your Asterisk on a schedule, and on the Asterisk side the qualify_frequency option on the aor sets how often Asterisk checks a contact, with 0 meaning it never qualifies. Then place a test call in each direction and check DTMF and recording.
Does this replace my Asterisk dialplan?
No. The dialer sends its campaign calls to your Asterisk as outbound originate traffic, and your own dialplan context decides where they go, normally out your carrier trunk. You keep your PBX, your extensions and your carrier contracts; the dialer adds the campaign engine, pacing, compliance controls, agent desktop and reporting on top.
Weiterführende Lektüre
- Bereitstellungsmuster
- Fügen Sie einer bestehenden PBX einen Predictive Dialer hinzu
- Nutzen Sie Ihren eigenen Anbieter
- How to connect your SIP trunk (BYOC setup)
- VICIdial alternative
- Agenten-Desktop
- SIP one-way audio: a step-by-step troubleshooting guide
- DTMF not working on a SIP trunk? How to fix keypresses
- Session Border Controller (SBC)
- SIP trunk CPS limits for predictive dialers explained
Weiterführende Lektüre: SIP Trunk Registration Failed: How to Fix It
Verwandte Artikel
Bereit, DialerBee in Aktion zu sehen?
Fordern Sie eine 15-minütige Live-Demo an oder starten Sie eine 14-tägige kostenlose Testphase – ohne Folien, ohne Verpflichtung. Das Telefonieren beginnt, sobald Ihr eigener SIP-Trunk oder Ihre TK-Anlage verbunden und freigegeben ist.
14-tägige kostenlose Testphase · kostenloses KI-Guthaben · keine Kreditkarte · 11 Sprachen · BYOC · Kontrollen zur Unterstützung der Compliance