Asterisk variable PRI_CAUSE
Created by: oej,Last modification on Fri 08 of Aug, 2008 [10:36 UTC] by JustRumours
The PRI_CAUSE variable - notifying PRI lines of hangup cause before hangup
Available since Asterisk release 1.0Starting with Asterisk 1.2 HangUp accepts cause codes as argument; this is the preferred method compared to setting the variable PRI_CAUSE.
On Zap PRI channels, chan_capi and chan_misdn BRI channels, it is possible to set the PRI_CAUSE variable prior to Hangup(). This will send a PRI DISCONNECT message with the set CAUSE element to the switch. Some commonly used cause codes:
1 = Unallocated number
16 = Normal call clearing
17 = User busy
18 = No user responding (telephone device not connected)
21 = Call rejected
22 = Number changed
27 = Destignation out of order
38 = Network out of order
41 = Temporary failure
For a fairly complete list of cause codes in downloadable pdf see here and a simple flashtool to save you looking then up is HERE
In Canada, through Group Telecom (May work through others) The hangup with PRI_CAUSE delivers these messages.
PRI_CAUSE - Pre-recorded message delivered from telco switch.
1 - The number you have reached is not in service, this is a recording.
2 - Fast Busy Signal
17 - Slow Busy Signal (Normal busy signal)
28 - We're sorry your call cannot be completed as dialed
In the UK, using a BT ISDN 2e/30e line, setting the PRI_CAUSE code delivers the following messages. Note that there is approximately an 8 second delay before these messages/tones are played to the caller after the Asterisk hangup. If the caller is using a BT analogue line there is a line reversal at the caller's side of the connection between the 8 second delay and the start of the tone/message. (NB This is not an exhaustive list.). If you are using ZapHFC with a Business/Home Highway box, you will need to use the 'Progress()' application before the 'Hangup' application to make this work. I'll do some more testing to see whether this is the case with ZapHFC and ISDN2 as well.
1 - "The number you have dialled has not been recognised. Please check and try again."
2 - Number unobtainable tone
17 - Engaged tone
18 - Number unobtainable tone
21 - Number unobtainable tone
22 - "The number you have dialled has not been recognised. Please check and try again."
27 - "This number is temporarily out of order. We are sorry for any inconvenience."
28 - Number unobtainable tone
38 - "This number is temporarily out of order. We are sorry for any inconvenience."
41 - "This number is temporarily out of order. We are sorry for any inconvenience."
^
Example
exten => i,1,SetVar(PRI_CAUSE=1)
; invalid extension dialed - PRI_CAUSE=unallocated number
exten => i,2,Hangup
; send the DISCONNECT message
; This will in most cases result in a network generated recording like
"The number you have dialed has been disconnected ..."
See also
- Reading the dialplan variable HANGUPCAUSE
- Dialplan variable DIALSTATUS
- Asterisk variables: Variables overview
- Asterisk cmd Hangup
- Asterisk cmd Progress: Progress indication (prepare to play early audio without answering)
- Asterisk variables
- Asterisk zap channels: Zaptel is the ISDN PRI connection in Asterisk
- ISDN, PRI
Go back to Asterisk

Comments
333PRI_CAUSE also on BRI ISDN
Without it - strange effects when perform hangup on asterisk side.
It is required for ISDN2 in Latvia.