SIP 504 Server Time-out: what it means and how to fix it
Short answer: SIP 504 Server Time-out means a server on the route did not get a timely response from another server it contacted to process the call. On trunks, it usually points to a slow or downed next hop, such as the carrier's interconnection or a routing lookup. Check who generated the 504 and how long it took.
| Code | 504 |
|---|---|
| Official name | Server Time-out |
| Class | 5xx: server failure |
| Defined in | RFC 3261 |
| Q.850 causes that usually come with it | 102 (Recovery on timer expiry) |
How Monitor treats SIP 504
The reading depends on what should answer the number, which is the question 2N5 answers when it adds each circuit. These are the rules the product applies today, generated from the same function that judges every test call.
| What should answer the number | Reading |
|---|---|
| A greeting or recorded message (the IVR) | Down |
| A test tone or echo service | Down |
| Other: it may ring or be answered | Down |
What Monitor records for an IVR: The provider could not complete the call because of a fault on its side: a server on the route got no reply from the next one in time (SIP 504).
A call read as Down alerts nobody on its own: it is repeated 3 times, every 2 minutes, and only 4 failures in a row open an incident, with each call's SIP code and Q.850 cause as evidence for the carrier. At the default pace, every circuit is tested every 15 minutes.
If the carrier returns SIP 504 when 2N5's calling account registers, before any call, the test is monitoring blind: it is a problem on 2N5's side, it does not count against the circuit and it does not alert the customer.
What does SIP 504 mean in practice?
SIP 504 Server Time-out is a 5xx response. Under RFC 3261, the responding server did not receive a timely response from an external server it contacted to process the request. That external server can be the next proxy on the route, a gateway to the phone network or a lookup service, such as a DNS server or a routing database.
Where SIP meets the phone network, RFC 3398 ties the 504 to Q.850 cause 102 (Recovery on timer expiry) in both directions. A SIP 504 error shows the first hop is up, but something after it took too long. If your PBX gets no response at all, the code you see is usually a SIP 408, generated locally.
Common causes in Brazil
- A slow or downed interconnection between your trunk’s carrier (Vivo, Claro, Algar, Embratel or another) and the destination network.
- A slow external lookup in call routing, such as DNS or a routing database queried by the SBC.
- A SIP-to-E1 gateway that got no response from the exchange before its timer ran out, signaled with Q.850 cause 102.
- An SBC on your network, in front of Asterisk, Issabel, FreePBX or 3CX, waiting on an overloaded or hung PBX.
- Packet loss or a firewall block between two servers on the route, so responses never arrive.
How to troubleshoot
- Capture the call with
sngrepand see who generated the 504 from the Via, Server and User-Agent headers, and how much time passed between the INVITE and the response. - In Asterisk, Issabel or FreePBX, turn on
pjsip set logger on(orsip set debug onin chan_sip) and look forReason: Q.850;cause=102. - If the 504 comes from your own SBC, capture on the PBX side as well and check whether the PBX responded and how late.
- Run
core show channelsand check the server load at the time of the failure. - Call the same number through another trunk and call other numbers on the same destination network, to tell the route apart from the destination.
- In 3CX, turn on verbose logging and check the Activity Log for how long the trunk took to respond.
What to send your carrier
- The exact date and time with the time zone, for example 2026-10-07 14:32:10 -03:00.
- The calling number (A), the called number (B) and the Call-ID.
- The full
SIP/2.0 504 Server Time-outline, the Server and Reason headers and the time between the INVITE and the response. - Whether other destinations also fail and how many attempts were made.
- The pcap file of the capture, if you have one.
Frequently asked questions
What is the difference between SIP 504 and SIP 408?
408 Request Timeout says the request got no response within the expected time, and it is often generated by the PBX itself when nobody answered. A 504 comes from a server in the middle of the route that received your request but did not get a timely response from the server it needed to contact. With a 504, you know at least the first hop is up.
Which Q.850 cause goes with a SIP 504?
Under RFC 3398, a SIP 504 becomes Q.850 cause 102 (Recovery on timer expiry), and cause 102 becomes a 504 in the other direction. A `Reason: Q.850;cause=102` header means a protocol timer expired in the phone network before the call could be completed.
Does a real test call catch this error?
Yes. A real test call receives the final SIP response the network returns, including a 504. When the result counts as a failure, the call is retried before any alert goes out, and the alert is sent by email and SMS.