500 5xx Server error RFC 3261
SIP 500 Server Internal Error
The server hit an unexpected condition and could not complete the request.
500 Server Internal Error means the server that answered hit a problem of its own while handling a request that looked valid. It is a catch-all: a crashed module, a failed database query, a broken script or dialplan, or a downstream failure the server chose to report as its own. The reason phrase is often the only clue in the SIP message, and the server's logs hold the real answer.
500 also has a legitimate use worth recognising. RFC 3261 requires a user agent that receives a second re-INVITE while an earlier one on the same call is still pending to reject the newer one with 500 and a Retry-After of up to 10 seconds. Proxies also send 500 when the only response they received was 503, because forwarding a 503 would tell upstream servers that the proxy itself is out of service.
For a caller, a 500 on a new call means immediate failure. Repeated 500s from one server on every call point to a fault on that server; occasional ones on re-INVITEs are usually timing collisions that resolve on retry.
What it looks like in a SIP trace
PBX -> Phone : INVITE sip:2001@192.168.1.41:5060 SIP/2.0 (re-INVITE, CSeq 21: hold) PBX -> Phone : INVITE sip:2001@192.168.1.41:5060 SIP/2.0 (re-INVITE, CSeq 22: codec change) Phone -> PBX : SIP/2.0 500 Server Internal Error Via: SIP/2.0/UDP 192.168.1.10:5060;branch=z9hG4bK66d01e Call-ID: 8a2f61c3@192.168.1.10 CSeq: 22 INVITE Retry-After: 4 Content-Length: 0 PBX -> Phone : ACK sip:2001@192.168.1.41:5060 SIP/2.0 (CSeq 22) Phone -> PBX : SIP/2.0 200 OK (CSeq 21) PBX -> Phone : ACK sip:2001@192.168.1.41:5060 SIP/2.0 (CSeq 21) # The PBX may retry the codec change, with a new CSeq, after the Retry-After delay.
Example values only. Your headers, addresses and numbers will differ.
Common causes
- A software fault or exception on the PBX or proxy.
- Database or backend lookup failure.
- Script or dialplan error.
How to diagnose it
- Note which server sent the 500 (Via, Server or User-Agent header) and the exact time, then go to that server's logs. The SIP response rarely explains the fault.
- Check whether the 500 answers a re-INVITE or UPDATE and carries
Retry-After. That is the overlapping re-INVITE case, often caused by hold, transfer and session-timer updates colliding. - If a proxy returned 500, check what it got from downstream. A 503 from every gateway, or a failure to relay at all (unresolvable destination, missing transport), is often reported upstream as 500.
- Check backend dependencies such as databases, DNS, AGI or REST scripts, LDAP and billing lookups. An error or timeout in any of them can surface as 500 on every call.
- Check recent changes. A dialplan or script edit, module update or certificate change shortly before the 500s began is the most likely cause.
- If 500s rise and fall with load, check CPU, memory and file descriptor limits, and whether the process restarted or logged out-of-memory errors.
How to fix it
- Check the server's error logs at the time of the call.
- Retry. Repeated 500s point to a bug or broken config that needs fixing on that server.
Platform notes
Asterisk / FreePBX
Search /var/log/asterisk/full for ERROR and WARNING lines around the call, and reproduce it with pjsip set logger on to capture the exact request. In FreePBX, run fwconsole reload after changes and read any errors it reports, because configuration problems after module updates are a common source of odd failures.
OpenSIPS / Kamailio
The OpenSIPS stock script replies 500 Internal Error when t_relay() fails, for example because the destination cannot be resolved or no listening socket matches its transport; Kamailio's default script calls sl_reply_error(), which reports the internal error with its own code. Add xlog lines around the relay and check the log for shared memory errors.
SIP 500 FAQ
Is SIP 500 my fault or the server's?
The server reports it, but the trigger can be on either side: your request may have hit a bug or unhandled case. Capture the request and give the server's owner the time and Call-ID.
Why do I get 500 with Retry-After during a call?
The device received a new re-INVITE while an earlier one was still pending, and RFC 3261 tells it to answer 500 with a short Retry-After. Frequent cases point to features sending updates at the same moment.
What is the difference between 500 and 503?
500 means the server failed while handling this request. 503 means it is overloaded, in maintenance or has no route or capacity, and may recover shortly.
Related codes
Related guides
Capture SIP Traces With sngrep and Wireshark
Capture SIP and RTP with sngrep and tcpdump, then analyse calls in Wireshark: call flows, RTP stream analysis, jitter, loss, audio playback and safe sharing.
SIP Registration Failed? Troubleshooting Checklist
Fix failed SIP registrations step by step: read 401, 403, 404, 408, 423 and 503 replies, then check DNS, ports, NAT, fail2ban bans and Asterisk PJSIP.