Asterisk Unable to Create Channel: Causes and CLI Fixes
Asterisk unable to create channel means the dial attempt failed before or during the INVITE: wrong endpoint name, no AOR contact, unavailable contact, DNS failure, or an unreachable provider. Run five CLI checks in order to find which.
- 'Unable to create channel of type PJSIP' is a dial-time failure, usually a wrong endpoint name, a missing AOR contact, or a contact marked Unavail.
- 'Max retries exceeded' and 'Retransmission timeout reached' are chan_sip messages meaning the provider never replied; on PJSIP the same fault shows as a 408 or Timeout.
- Triage in a fixed order: pjsip show endpoints, pjsip show aors/contacts, pjsip show registrations, pjsip set logger on, then tcpdump or sngrep.
- After fixing DNS, retest with 'pjsip show contacts' and a test call first; a plain AOR contact is resolved when Asterisk sends to it, so only outbound registrations and transports with an address cached at load need 'module reload res_pjsip.so'.
- Set qualify_frequency=0 for providers that ignore OPTIONS, or Asterisk marks the contact Unavail and refuses to dial it.
What does "Asterisk unable to create channel" actually mean?
Three different layers produce the messages people lump together as "asterisk unable to create channel". Knowing which layer spoke tells you where to look.
'Unable to create channel of type PJSIP' comes from Dial() before any packet is sent. Asterisk could not build the outgoing channel because the endpoint does not exist, has no usable contact, or the contact is Unavail. 'Everyone is busy/congested' is only the Dial application's summary of the result (DIALSTATUS CHANUNAVAIL or CONGESTION). 'Max retries exceeded' and 'Retransmission timeout reached on transmission' are chan_sip messages: the INVITE was sent but the provider never answered. chan_sip was removed in Asterisk 21, so on current systems the same fault shows in PJSIP as an INVITE with no response, a 408, and a hangup cause 18 or 19 or a timeout.
| Log line | Layer | Likely cause | First command |
|---|---|---|---|
| Unable to create channel of type PJSIP (cause 20 - Subscriber absent) | Dialplan/endpoint | Endpoint name wrong, or no contact on AOR | pjsip show endpoints |
| Unable to create channel of type PJSIP (cause 1 - Unallocated) | Endpoint/DNS | Number or host unresolvable, bad URI | pjsip show endpoint NAME |
| Everyone is busy/congested at this time (1:0/0/1) | Dial result | Summary only; see the line above it or a 503/34 | core set verbose 5 |
| Max retries exceeded / Retransmission timeout (chan_sip) | Network/provider | No reply: firewall, wrong port, IP allowlist, DNS | pjsip set logger on (sip set debug on) |
| Failed to resolve / DNS error | DNS | Resolver broken or provider name wrong | dig +short provider.com |
| Contact ... is now Unreachable | Qualify | Provider ignores OPTIONS | pjsip show contacts |
How do I triage it in five commands?
Run these in order and stop at the first one that fails. Each one eliminates a layer. First raise logging so you see the reason:
- Dialplan and endpoint: pjsip show endpoint trunkname. It must exist with the right aors, outbound_auth and transport.
- AOR and contact: pjsip show aors and pjsip show contacts. An outbound trunk needs a contact that is Avail or NonQual, never Unavail.
- Registration: pjsip show registrations. Status should be Registered if the provider requires registration.
- SIP signalling: pjsip set logger on, place a call, and read the INVITE and the reply.
- Network: tcpdump -ni any port 5060 -w /tmp/sip.pcap or sngrep, to prove whether packets leave and return.
asterisk -rvvvvv
core set verbose 5
core set debug 3
pjsip set logger on
# failing: endpoint exists but contact is down
# Contact: trunk1/sip:203.0.113.10:5060 abc123 Unavail
# healthy:
# Contact: trunk1/sip:203.0.113.10:5060 abc123 Avail 12.345
# full log: /etc/asterisk/logger.conf
# full => notice,warning,error,debug,verbose
# then: logger reload ; tail -f /var/log/asterisk/fullWhy does Dial say the endpoint or contact is missing?
Endpoint names are case-sensitive. Dial(PJSIP/${EXTEN}) with no endpoint treats the number as the endpoint name and fails with cause 20. The correct trunk forms are shown below.
If the endpoint exists but has no contact, the dial fails with Subscriber absent. For an outbound trunk the AOR must carry a static contact, and the endpoint's aors= must match the AOR section name exactly. With no aors= set, Asterisk looks for an AOR with the same name as the endpoint.
; dialplan
same => n,Dial(PJSIP/${EXTEN}@trunk1) ; uses the AOR contact
same => n,Dial(PJSIP/trunk1/sip:${EXTEN}@sip.provider.com) ; explicit URI
; pjsip.conf
[trunk1]
type=endpoint
transport=transport-udp
context=from-trunk
disallow=all
allow=ulaw,alaw
outbound_auth=trunk1
aors=trunk1
[trunk1]
type=aor
contact=sip:sip.provider.com:5060
qualify_frequency=60
[trunk1]
type=auth
auth_type=userpass
username=ACCOUNT
password=SECRET Why does the contact show Unavail or registration fail?
With qualify_frequency set, Asterisk sends OPTIONS to the contact. If the provider does not answer, the contact becomes Unavail and Dial refuses it without sending an INVITE. Set qualify_frequency=0 for such providers, then run module reload res_pjsip.so.
If the provider requires registration, pjsip show registrations must say Registered. A 401 or 403 loop means wrong credentials or a mismatch between outbound_auth, server_uri and client_uri. A Rejected or Unregistered state means the trunk is not usable until fixed.
| SIP response | Meaning | Fix |
|---|---|---|
| 401 / 407 | Authentication required or rejected | Check username, password, realm, outbound_auth |
| 403 | Forbidden: IP not allowed or bad credentials | Add your public IP to the provider allowlist |
| 404 | Number not found | Fix the number format |
| 408 / timeout | No answer from provider | Check network, port, transport |
| 503 | Provider out of capacity or down | Retry, try the secondary trunk |
pjsip show registrations
# failing: trunk1/sip:reg.provider.com trunk1-auth Rejected
# healthy: trunk1/sip:reg.provider.com trunk1-auth Registered How do I fix DNS and unreachable provider problems?
For a plain AOR contact, PJSIP generally resolves the hostname when it sends the OPTIONS or INVITE. A DNS fix therefore often works without a reload. Retest with pjsip show contacts and a test call first. Test resolution from the same host and container as Asterisk:
If the problem persists, reload. Outbound registrations and transports whose resolved address was cached at load will keep using the old result until you run module reload res_pjsip.so. Putting the provider's IP in contact= is a stopgap. Check /etc/resolv.conf, systemd-resolved (resolvectl status), and the container's own resolver, since a chroot or Docker network often has none.
If DNS works but the INVITE gets no reply, run the capture. Outgoing packets with nothing returning point to a firewall, wrong port, a TLS versus UDP transport mismatch, or your public IP missing from the provider allowlist. Test from the PBX itself, since a laptop on another network proves nothing.
dig +short _sip._udp.provider.com SRV
dig +short provider.com
host provider.com
nc -vzu sip.provider.com 5060
sipsak -s sip:sip.provider.com
tcpdump -ni any port 5060 -w /tmp/sip.pcap
sngrep -d any port 5060What transport and NAT settings stop INVITEs from leaving?
Run pjsip show transports. If your transport is missing, the bind failed (port in use, bad address) or the config did not load, so no INVITE can leave. A TLS trunk with a bad certificate or mismatched hostname fails the same way.
Behind NAT, set local_net, external_signaling_address and external_media_address on the transport so the provider sees your public IP in Via and SDP.
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=192.168.1.0/24
external_signaling_address=198.51.100.5
external_media_address=198.51.100.5 What changes on FreePBX, and how do I read the hangup cause?
On FreePBX, edit trunks and routes in the GUI, not pjsip.conf, which is regenerated; custom changes belong in pjsip.endpoint_custom.conf and similar files. After changes, run fwconsole reload. Check that the Outbound Route's trunk sequence points at the right trunk and that the trunk name matches the endpoint in pjsip show endpoints. The generated Dial Trunk logic lives in extensions_additional.conf.
Read the results in the dialplan with ${DIALSTATUS} and ${HANGUPCAUSE}.
| Value | Meaning | Typical cause |
|---|---|---|
| CHANUNAVAIL | Channel could not be created | Missing endpoint/contact, Unavail |
| CONGESTION | Network or provider refused | 503, no route, cause 34 |
| NOANSWER | Rang but unanswered | Far end issue |
| Cause 1 | Unallocated number | Bad number format |
| Cause 20 | Subscriber absent | No contact or endpoint |
| Cause 34 | No circuit available | Provider congestion |
| Cause 38 | Network out of order | Provider or path down |
Common questions
What is the correct number format for a SIP trunk?
It depends on the provider: E.164 with or without the plus sign, or a prefix such as 00 or 011. A 404 or cause 1 usually means the format was wrong, so compare the user part of the INVITE in the SIP log with the provider's requirements.
Is Max retries exceeded the same as unable to create channel?
No. Max retries exceeded came from chan_sip after the INVITE was sent and went unanswered. Unable to create channel happens before sending, in Dial.
Do I need to reload after changing pjsip.conf?
Yes for config edits: run module reload res_pjsip.so or, on FreePBX, fwconsole reload. A DNS fix is different: for a plain AOR contact, retest with pjsip show contacts and a test call first, since the hostname is resolved when Asterisk sends. Reload only if an outbound registration or transport is still using an address cached at load.
Why does a trunk work for registrations but fail on outbound calls?
Registration only proves credentials and reachability to the registrar. The endpoint may still lack an AOR contact, have the wrong outbound proxy, or the outbound route may point at a different trunk.
Can I stop Asterisk marking the trunk Unavail?
Yes. Set qualify_frequency=0 on the AOR so no OPTIONS are sent, then reload res_pjsip.so. The contact then shows NonQual and stays dialable.