Howwise RSS
VoIP & Phone Systems7 min read

Asterisk Unable to Create Channel: Causes and CLI Fixes

Short answer

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.

Key takeaways
  • '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 lineLayerLikely causeFirst command
Unable to create channel of type PJSIP (cause 20 - Subscriber absent)Dialplan/endpointEndpoint name wrong, or no contact on AORpjsip show endpoints
Unable to create channel of type PJSIP (cause 1 - Unallocated)Endpoint/DNSNumber or host unresolvable, bad URIpjsip show endpoint NAME
Everyone is busy/congested at this time (1:0/0/1)Dial resultSummary only; see the line above it or a 503/34core set verbose 5
Max retries exceeded / Retransmission timeout (chan_sip)Network/providerNo reply: firewall, wrong port, IP allowlist, DNSpjsip set logger on (sip set debug on)
Failed to resolve / DNS errorDNSResolver broken or provider name wrongdig +short provider.com
Contact ... is now UnreachableQualifyProvider ignores OPTIONSpjsip show contacts
Tip: chan_sip equivalents: sip show peers maps to pjsip show endpoints and contacts, sip show registry maps to pjsip show registrations, and sip set debug on maps to pjsip set logger on.

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:

  1. Dialplan and endpoint: pjsip show endpoint trunkname. It must exist with the right aors, outbound_auth and transport.
  2. AOR and contact: pjsip show aors and pjsip show contacts. An outbound trunk needs a contact that is Avail or NonQual, never Unavail.
  3. Registration: pjsip show registrations. Status should be Registered if the provider requires registration.
  4. SIP signalling: pjsip set logger on, place a call, and read the INVITE and the reply.
  5. 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/full
Warning: Debug logging and packet captures expose SIP credentials and phone numbers, and verbose debug on a busy server adds load. Turn them off (pjsip set logger off, core set debug 0) when finished.

Why 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 responseMeaningFix
401 / 407Authentication required or rejectedCheck username, password, realm, outbound_auth
403Forbidden: IP not allowed or bad credentialsAdd your public IP to the provider allowlist
404Number not foundFix the number format
408 / timeoutNo answer from providerCheck network, port, transport
503Provider out of capacity or downRetry, 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 5060
Tip: Provider replies reaching you but call audio missing is a different problem (NAT media settings), not a channel creation failure.

What 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}.

ValueMeaningTypical cause
CHANUNAVAILChannel could not be createdMissing endpoint/contact, Unavail
CONGESTIONNetwork or provider refused503, no route, cause 34
NOANSWERRang but unansweredFar end issue
Cause 1Unallocated numberBad number format
Cause 20Subscriber absentNo contact or endpoint
Cause 34No circuit availableProvider congestion
Cause 38Network out of orderProvider or path down
Warning: Common time wasters: editing a generated FreePBX file that gets overwritten, forgetting to reload, and testing from a different network than the PBX.

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.

Related topics:asteriskpjsipsip trunkfreepbxtroubleshooting