Asterisk SIP 503 Service Unavailable: Find the Cause Fast
An asterisk sip 503 service unavailable means the server that answered cannot handle the request right now. First check whether the 503 actually left your PBX on the wire, then classify it: channel limit, rate limit, outage, dial format or IP auth.
- Capture first: if no 503 appears in tcpdump or pjsip logger, Asterisk generated it locally (unavailable contact, channel limit or congestion) and the carrier is not at fault.
- An instant 503 on every call points to policy, such as IP auth, account or dial format, while a slow 503 points to an upstream timeout.
- A 503 that appears only above N concurrent calls is a channel cap, and one that appears in bursts is a CPS limit.
- Honour any Retry-After header and never retry in a tight loop, because retry storms get source IPs blocked.
- A useful carrier ticket contains the UTC time, Call-ID, IPs and ports, the full 503 message, the number as dialed and a capture file.
What does an Asterisk SIP 503 Service Unavailable mean, and who sent it?
RFC 3261 defines 503 Service Unavailable as: the server is temporarily unable to process the request because of overload or maintenance. It may carry a Retry-After header telling the client how long to wait. The key point is that 503 says nothing is wrong with your request syntax, only that the responder cannot serve it now.
Three different devices can produce it: the carrier edge (session border controller), an upstream carrier behind it that the edge relayed, or Asterisk itself. Asterisk returns 503 on an inbound leg when the dialplan ends in Congestion(), and it maps hangup cause 34 (circuit congestion) to 503. On outbound calls, a local 503 or CONGESTION result with no packet sent is common. This is why the first job is to find out which hop spoke.
Compare it with neighbouring codes, because carriers use them loosely:
| Code | Meaning | Typical cause | Retry the same call? |
|---|---|---|---|
| 503 | Temporarily unable to serve | Capacity, CPS, overload, outage, some policy rejects | Yes, after Retry-After or backoff |
| 500 | Server internal error | Carrier software fault | Rarely helps |
| 403 | Forbidden (policy or auth) | IP not whitelisted, bad credentials, caller ID not allowed | No, fix the cause |
| 404 / 484 | Not found / address incomplete | Bad number or format | No, fix the number |
| 480 | Temporarily unavailable | Callee not reachable or not registered | Maybe later |
| 488 | Not acceptable here | Codec or SDP mismatch | No, fix media settings |
Did the 503 come off the wire or from Asterisk itself?
Answer this before touching anything else. If the 503 never left the PBX, the carrier ticket would waste time. Turn on PJSIP logging and place one failing call:
If the INVITE goes out and a 503 comes back, the carrier side sent it. If you see no outbound INVITE and the CLI shows Dial status CHANUNAVAIL or CONGESTION, Asterisk decided locally. Common local triggers are a trunk contact marked Unavailable after failed qualify (OPTIONS) checks, the FreePBX Maximum Channels cap being reached, a DNS failure resolving the carrier host, or a transport mismatch such as a TLS trunk without a working certificate.
asterisk -rvvvvv
core set verbose 5
core set debug 3
pjsip set logger on
# chan_sip only:
sip set debug on
# independent capture on the wire (add port 5061 for TLS)
tcpdump -i any -s 0 -w /tmp/503.pcap port 5060 or port 5061
# local state checks
pjsip show endpoints
pjsip show contacts
pjsip show registrations
core show channels count
pjsip show channels
curl ifconfig.meHow do I read a 503 trace?
Open the pcap in Wireshark and use Telephony > VoIP Calls, then Flow Sequence, or Telephony > SIP Flows. A quick filter is sip.Status-Code == 503. In a terminal, sngrep -I 503.pcap gives the same ladder diagram.
Read the INVITE first: the Request-URI and To (is the number in the format the carrier wants?), From and P-Asserted-Identity (is the caller ID allowed?), Contact and Via (is the source IP and port the one the carrier whitelisted, or a private address?) and SDP (c= line must hold a reachable public IP). Then read the response headers below.
Then measure the time between INVITE and 503. Under about 100 ms means a policy or capacity check at the first hop, such as auth, account, CPS or channel cap. Several seconds means the edge waited on an upstream and gave up. A delay near 32 seconds is the INVITE transaction timeout (64 x T1), meaning packets were lost, not rejected.
INVITE sip:0015551234567@sip.carrier.example SIP/2.0 <- number as sent
Via: SIP/2.0/UDP 203.0.113.10:5060;branch=z9hG4bK... <- your public IP
From: <sip:2125550100@203.0.113.10>;tag=abc
P-Asserted-Identity: <sip:2125550100@203.0.113.10> <- CLI the carrier may check
SIP/2.0 100 Trying <- t+0.02s, edge accepted it
SIP/2.0 503 Service Unavailable <- t+0.09s, fast: policy/capacity
Server: CarrierSBC/4.2 <- which device answered
Retry-After: 30 <- wait 30s before retrying
Reason: Q.850;cause=34;text="No circuit available" <- upstream congestion
Warning: 399 edge1 "Channel limit exceeded" <- often the clearest hint
X-Hop: edge1.region2 <- vendor header, quote to carrier Which cause is it? Symptom to test to fix
Treat 503 as five failure classes, not one. This table maps what you observe to the likeliest class and the quickest confirming test.
| Symptom | Likely cause | Test | Fix |
|---|---|---|---|
| Instant 503 on every call, even from a new source | IP auth, account suspended or balance exhausted | curl ifconfig.me against the carrier whitelist; check balance | Whitelist the right IP, restore the account |
| 503 only when more than N calls are active | Carrier per-trunk channel cap | core show channels count at failure; place calls up to N | Raise the cap with the carrier or add a trunk |
| 503 in bursts, fine at low volume | CPS limit from dialers or campaigns | Count INVITEs per second in the pcap | Throttle, pace queues, back off |
| 503 on one country or prefix only | Route congestion upstream | Call a different prefix and a different carrier | Ask for another route tier or fail over |
| No INVITE on the wire | Asterisk local: contact Unavailable, Maximum Channels, DNS | pjsip show contacts, dialplan logs | Fix qualify, limits or DNS |
| 503 only for some caller IDs or number formats | Dial format or CLI rejection | Dial the same number in E.164 and national form | Adjust dial patterns and caller ID |
| 503 from softphone too, status page red | Carrier outage or overload | Second source IP, status page | Fail over, ticket the carrier |
How do I fix each class of 503?
Channel limits: the carrier cap and the FreePBX Maximum Channels setting must agree. If Maximum Channels is higher than the carrier cap, the extra calls are rejected remotely. If it is lower, FreePBX blocks them locally. Also look for hung calls that still hold channels; core show channels count rising overnight with no real traffic means stuck channels, and the cause (often a broken NAT or missing BYE) needs fixing, not a restart.
Rate limits: carriers commonly cap calls per second and also throttle REGISTER and OPTIONS floods. Pace dialer campaigns, lower the qualify frequency (qualify_frequency=60 is plenty), and never loop retries. On a 503, wait the Retry-After value, or use exponential backoff such as 5, 10, 20, 40 seconds with jitter.
Dial format: carriers differ on E.164 with or without +, 00 or 011 international prefixes, 10 or 11 digit US numbers, and required technical prefixes. Fix it in the FreePBX outbound route dial patterns using prepend, prefix and match fields, and test with the exact string seen in the INVITE. Check caller ID too: an unverified or non-owned CLI in From or P-Asserted-Identity is rejected with 503 or 403 by some carriers.
IP authentication and DNS: the carrier whitelist must match your current public IP. Dynamic IPs, a rebuilt server or an IPv6 source break it silently. Confirm the trunk's server_uri and outbound proxy are the right host, check that an SRV or A lookup returns the carrier's current address (dig SRV _sip._udp.carrier.example), and for registering trunks confirm pjsip show registrations says Registered, not Rejected or Unregistered.
NAT and transport: set external_signaling_address, external_media_address and local_net in the transport, set direct_media=no on the trunk, and disable SIP ALG on the router. Allow UDP 5060 (or TCP/TLS 5060/5061) and the RTP range 10000 to 20000 from the carrier addresses only.
; pjsip.transports (example values)
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_signaling_address=203.0.113.10
external_media_address=203.0.113.10
local_net=192.168.1.0/24
; trunk endpoint
[carrier]
type=endpoint
direct_media=no
allow=!all,ulaw,alawWhat should I send the carrier?
A ticket that includes evidence gets routed to engineers; "calls fail with 503" gets a scripted reply. Include everything below and ask directly which hop generated the 503. Attach the pcap and keep it small by capturing only affected calls.
If the carrier edge is overloaded or a route is down, route around it while the ticket is open. Add a second trunk and a failover route so a 503 moves the call to a backup carrier.
Subject: Intermittent 503 on outbound calls, trunk ACME-1234
Start time: 2026-11-20 09:14 UTC, ongoing. Failure rate: about 40% of calls.
Source: 203.0.113.10:5060 UDP Destination: 198.51.100.5:5060
Account / trunk ID: ACME-1234
Example Call-IDs (UTC):
09:14:22 a84b4c76e66710@203.0.113.10
09:15:03 f19c2d88aa0145@203.0.113.10
Number as sent: 0015551234567 (also failed as +15551234567)
Response: 503 Service Unavailable, Retry-After: 30, full message attached
Response delay: 90 ms after 100 Trying
Ruled out: concurrent calls were 4 (cap 30), CPS under 1, IP whitelist
unchanged, same result from a second source IP, other prefixes work.
Attached: 503.pcap
Question: which hop generated the 503, and is it route or account specific? Which mistakes make a 503 worse?
Restarting Asterisk repeatedly does nothing for a carrier-side fault, drops live calls and wipes the logs you need. Ignoring Retry-After and retrying instantly creates a retry storm, which can trip the carrier's flood protection and get your IP blocked, turning a temporary fault into a permanent one.
Finally, do not assume 503 means the carrier is down. It is just as likely to be your own channel cap, a dial pattern, a changed public IP or a local contact marked unavailable. The capture settles that in five minutes.
Common questions
Is SIP 503 the carrier's fault or mine?
Neither by default. Capture the call: if the 503 arrived from the carrier's IP, they generated it, but the trigger may still be yours, such as an unlisted IP or exceeded cap. If no 503 is on the wire, Asterisk produced it locally.
Should my PBX retry a call after a 503?
Only once the Retry-After period has passed, or after a backoff delay. For a call to a different destination, failing over to a second trunk immediately is fine. Tight retry loops can get your IP blocked.
Why do I get 503 on outbound calls but inbound calls work?
Inbound calls need only your IP to be reachable, while outbound calls hit the carrier's authentication, channel, CPS and dial-format checks. Test whether the trunk shows as registered and whether the number format matches the carrier's requirements.
Can a SIP ALG cause a 503?
Indirectly. An ALG that rewrites headers can make the carrier see a private IP, so the whitelist check fails, or it can drop replies so Asterisk marks the trunk unavailable. Disable it on the router and recapture.
How is 503 different from 480 and 403?
503 says the server cannot handle the request right now, 480 says the called party is temporarily unreachable and 403 says the request is refused by policy or authentication. Some carriers misuse 503 for policy rejections, so read the Reason and Warning headers rather than the code alone.