Cause Codes

From aa-asterisk.org.uk wiki

Revision as of 13:16, 23 November 2010 by Nrs (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ISDN (Q.850) cause codes are returned when a channel disconnects, which shows you the reason for the disconnection or why the call failed. To help you diagnose problems with calls, they appear in the verbose debug on the Asterisk CLI as well as being stored in the ${HANGUPCAUSE} variable.

The following table shows common cause codes and their SIP code equivalent if defined by RFC 3398. Asterisk always stores cause codes internally and translates to SIP codes where required if talking to chan_sip. However please note that the SIP code to cause code translation often does not work well as there are far fewer SIP codes than there are cause codes and many SIP codes have multiple cause code equivalents.

Modern SIP implementations can send Q.850 cause codes by way of a Reason: header in the SIP INVITE or BYE message. The format is as follows:

Reason: Q.850;cause=1;text="UNALLOCATED_NUMBER"

where the cause parameter is the cause code, and the text parameter is an optional parameter for a description. Asterisk versions earlier than 1.6.0 are believed not to support this but rather use a proprietary X-Asterisk-HangupCauseCode: header, but FreeSWITCH does support this header and interoperates correctly with Revtel, which seems to pass back the right information to the PSTN.

To enable the use of the Reason: header on Asterisk 1.6, set the use_q850_reason parameter in sip.conf to yes

Q.850 cause code table

Cause code (ISUP) SIP Equivalent Definition
1 404 Not Found Unallocated (unassigned) number
2 404 Not found no route to network
3 404 Not found no route to destination
16 BYE or CANCEL (*)normal call clearing
17486 Busy here user busy
18408 Request Timeout no user responding
19480 Temporarily unavailable no answer from the user
20480 Temporarily unavailable subscriber absent
21403 Forbidden (+) call rejected
22410 Gone number changed (w/o diagnostic)
22301 Moved Permanently number changed (w/ diagnostic)
23410 Gone redirection to new destination
26404 Not Found (=) non-selected user clearing
27502 Bad Gateway destination out of order
28484 Address incomplete address incomplete
29501 Not implemented facility rejected
31480 Temporarily unavailable normal unspecified
34503 Service unavailable no circuit available
38503 Service unavailable network out of order
41503 Service unavailable temporary failure
42503 Service unavailable switching equipment congestion
47503 Service unavailable resource unavailable
55403 Forbiddenincoming calls barred within CUG
57403 Forbiddenbearer capability not authorized
58503 Service unavailable bearer capability not presently
65488 Not Acceptable Here bearer capability not implemented
70488 Not Acceptable Here only restricted digital avail
79501 Not implemented service or option not implemented
87403 Forbidden user not member of CUG
88503 Service unavailable incompatible destination
102504 Gateway timeout recovery of timer expiry
111500 Server internal error protocol error
127500 Server internal error interworking unspecified

(*) ISDN Cause 16 will usually result in a BYE or CANCEL.

(+) If the cause location is 'user' than the 6xx code could be given rather than the 4xx code (i.e., 403 becomes 603).

(=) ANSI procedure - in ANSI networks, 26 is overloaded to signify 'misrouted ported number'. Presumably, a number portability dip should have been performed by a prior network. Otherwise cause 26 is usually not used in ISUP procedures.

See also

External Links

  • RFC3398 – Integrated Services Digital Network (ISDN) User Part (ISUP) to Session Initiation Protocol (SIP) Mapping
Personal tools