SIP 404 Not Found: what it means and how to fix it
Short answer: SIP 404 Not Found means the server has definitive information that the user or number does not exist in the called domain. The most common cause on trunks is the number format: a missing area code (DDD), a wrong prefix, or E.164 where the carrier expects another format. Compare the number sent in the INVITE with the format the carrier accepts.
| Code | 404 |
|---|---|
| Official name | Not Found |
| Class | 4xx: request failure |
| Defined in | RFC 3261 |
| Q.850 causes that usually come with it | 1 (Unallocated (unassigned) number), 2 (No route to specified transit network (national use)), 3 (No route to destination), 26 (Non-selected user clearing) |
How Monitor treats SIP 404
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 number does not exist or was dialed wrongly, so the provider did not connect the call (SIP 404).
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 404 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 404 mean in practice?
Under RFC 3261, SIP 404 Not Found indicates that the server has definitive information that the user does not exist in the domain given in the Request-URI. The same code is used when the domain in the Request-URI does not match any domain served by whoever received the request.
On a trunk, the SIP 404 error almost always boils down to “that number does not exist here.” Sometimes the number really is not allocated, and the network usually responds with Q.850 cause 1. Often, though, the number exists and was sent in the wrong format, or it reached the destination PBX, which has no route for it. When a call comes into your own PBX and gets a 404, the DID is not configured in the inbound routes. If the number existed and was deactivated, the more precise code would be SIP 410; if digits are missing, SIP 484.
Common causes in Brazil
- A number sent in a format the carrier does not accept: without the area code (DDD), with an extra
0, with a carrier selection code (CSP) where it does not belong, or in E.164 (+55) where the carrier expects digits only. - A mobile number dialed without the ninth digit, or a landline dialed with one digit too many.
- An 0800 number sent incomplete or with an area code in front.
- A destination number that is not allocated or has been deactivated.
- A ported number routed to the old carrier (RFC 3398 maps cause 26 to 404 in this case).
- An inbound DID with no route in Asterisk, Issabel, FreePBX or 3CX: the PBX answers 404 because it cannot find the extension in the context.
How to diagnose it
- Capture with
sngrep port 5060and look at the INVITE’s Request-URI: that is where the number appears exactly as it went out. - On Asterisk or FreePBX, turn on
pjsip set logger on(orsip set debug onwith chan_sip). For inbound calls, the log shows the extension that was not found in the context. Check it withdialplan show <number>@<context>. - Review the outbound rules (dial patterns) in FreePBX or 3CX: a prefix stripped or added by mistake changes the number sent.
- Test the same destination in different formats, for example
11987654321and5511987654321, to find out what the carrier accepts. - Look for the
Reason: Q.850;cause=1header (RFC 6432) or another cause in the response: it tells an unallocated number apart from a missing route (cause 3). - Call the same number from another line. If that does not go through either, the number really does not exist.
What to send the carrier
- Date and time of the attempts, with the time zone.
- Calling number (A) and called number (B), exactly as they appeared in the Request-URI.
- The Call-ID of at least one call.
- The full response line and the Reason header with the Q.850 cause, if present.
- The dialing format you are using and how many attempts failed.
- The pcap of the capture, when available.
Frequently asked questions
What format should I send the number to the carrier in?
It depends on the carrier and the contract. Some accept the area code (DDD) plus the number (10 or 11 digits), others want E.164 with or without the +55, and others accept traditional dialing, with `0`, the carrier selection code and the area code. An 0800 (toll-free) number has 11 digits, as in 0800 123 4567. Ask for the official format in writing and adjust the PBX's outbound rule.
What is the difference between 404, 410 and 484?
A 404 says the number does not exist at that destination. A 410 Gone says it used to exist and is permanently out of service. A 484 Address Incomplete says digits are missing. In practice, many carriers use 404 for all three cases, so it is worth checking the Q.850 cause that comes with it too.