Capture the exact request that received 604
Use a narrowly timed, authorized PJSIP trace and retain the request method, Request-URI, Call-ID, CSeq, tags, top Via branch, response source and PJSIP channel. Correlate both legs when Asterisk receives one request and creates another; a back-to-back user agent can change the URI, Call-ID and final response between legs.
RFC 3261 defines 604 as an authoritative assertion that the user in the Request-URI does not exist anywhere. Record which system claimed authority for which user and domain. A phone display or final calling-channel cause does not answer either question.
Separate entered digits from the evaluated URI
Follow the destination through the loaded context, extension and priority, including prefixes, substitutions, directory lookups and trunk URI construction. Preserve user, domain and URI parameters from the actual outbound request. Keep them separate from From, To, P-Asserted-Identity, display name and the digits shown in a CDR.
For an external response, compare the exact URI with the provider's documented namespace and obtain its trace for the same transaction. Do not interpret 604 as proof about a public telephone number until the responder, normalization and authority boundary are established.
Keep 404, 485 and 604 distinct
Asterisk maps SIP 404, 485 and 604 to AST_CAUSE_UNALLOCATED, Q.850 cause 1. That common translation discards whether the responder reported a domain-local not-found result, an ambiguous URI or a global authoritative absence. Retain the original wire code before using cause-based dialplan logic, CDRs or announcements.
After Dial(), inspect HANGUPCAUSE_KEYS() and the technology-specific and Asterisk values for each called channel. Parallel or sequential channels can produce different responses; a single final variable can hide the leg whose outcome won application handling.
Preserve branch and failover decisions
A stateful proxy that receives a 6xx response stops adding branches and should cancel pending transactions. Preserve the 604 with the resulting CANCEL and 487 outcomes rather than treating those branches as fresh evidence of absence. Asterisk dialplan fan-out and provider failover can instead create separate calls, so use channel and route evidence to reconstruct their actual policy.
Do not automatically send an authoritative absence result to every configured carrier or probe related identities. An alternate route may have a legitimate namespace role, but it requires documented ownership, privacy limits and a bounded negative-path test.
Treat a local 604 as deliberate dialplan behavior
Current Asterisk documentation provides PJSIPHangup() to return a selected 400–699 response on an incoming PJSIP channel, before another final response has been sent. Confirm the installed release, loaded application and exact executed priority before assigning a local 604 to it.
In FreePBX, inspect generated dialplan and matched supported objects, but change routes through supported controls or documented extension points. Do not add a catch-all or edit generated files merely to replace 604 with a less specific code. First correct the record or rewrite that made the authoritative result false.
Verify positive, negative and unauthorized targets
Change only the demonstrated normalization, directory record, domain, trunk URI or route owner. Retest the intended destination, a nearby valid destination, a deliberately nonexistent destination and an unauthorized destination. Confirm the exact Request-URI, responder and final response for each, then test answer, two-way media and release separately on the successful path.
Remove temporary PJSIP logging and redact credentials, identities and directory data from shared traces. No PBX, endpoint, proxy, provider, directory, number, route, dialplan, failover path or live request was tested for this guide.
Sources & applicability
Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.
- IETF RFC 3261: 604 Does Not Exist Anywhere and 6xx handling ↗
- Asterisk hangup-cause mappings ↗
- Asterisk hangup-cause inspection ↗
- Asterisk PJSIPHangup application ↗
- Asterisk dialing PJSIP channels ↗
- Asterisk dialplan contexts, extensions and priorities ↗
- Asterisk PJSIP troubleshooting guide ↗
Examples require adaptation to your topology. No live PBX or hardware testing is claimed.