Skip to content

Commit f75dbe3

Browse files
Astratusgtjoseph
authored andcommitted
Update Hangup-Cause.md
Improved/Fixed whitespace and formatting.
1 parent fa01f33 commit f75dbe3

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

docs/Configuration/Miscellaneous/Hangup-Cause.md

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ Used to obtain a comma separated list of all channels for which hangup causes ar
2121
The following example shows one way of accessing the channels that have hangup cause related information after a Dial has completed. In this particular example, a parallel dial occurs to both *SIP/foo* and *SIP/bar*. A hangup handler has been attached to the calling channel, which executes the subroutine at **handler,s,1** when the channel is hung up. This queries the HANGUPCAUSE\_KEYS function for the channels with hangup cause information and prints the information as a Verbose message. On the CLI, this would look something like:
2222

2323
Channels with hangup cause information: SIP/bar-00000002,SIP/foo-00000001
24+
```
2425
[default]
25-
2626
exten => s,1,NoOp()
27-
same => n,Set(CHANNEL(hangup\_handler\_push)=handler,s,1)
27+
same => n,Set(CHANNEL(hangup_handler_push)=handler,s,1)
2828
same => n,Dial(SIP/foo&SIP/bar,10)
2929
same => n,Hangup()
3030
3131
[handler]
32-
3332
exten => s,1,NoOp()
34-
same => n,Set(HANGUPCAUSE\_STRING=${HANGUPCAUSE\_KEYS()})
35-
same => n,Verbose(0, Channels with hangup cause information: ${HANGUPCAUSE\_STRING})
33+
same => n,Set(HANGUPCAUSE_STRING=${HANGUPCAUSE_KEYS()})
34+
same => n,Verbose(0, Channels with hangup cause information: ${HANGUPCAUSE_STRING})
3635
same => n,Return()
36+
```
3737
### HANGUPCAUSE
3838

3939
Used to obtain hangup cause information for a specific channel. For a given channel, there are two sources of hangup cause information:
@@ -46,63 +46,59 @@ Note that in some cases, the hangup causes returned may not be reflected in . Fo
4646
#### Example
4747

4848
This example illustrates obtaining hangup cause information for a parallel dial to *SIP/foo* and *SIP/bar*. A hangup handler has been attached to the calling channel, which executes the subroutine at **handler,s,1** when the channel is hung up. This queries the hangup cause information using the HANGUPCAUSE\_KEYS function and the HANGUPCAUSE function. The channels returned from HANGUPCAUSE\_KEYS are parsed out, and each is queried for their hangup cause information. The technology specific cause code as well as the Asterisk cause code are printed to the CLI.
49-
49+
```
5050
[default]
51-
5251
exten => s,1,NoOp()
53-
same => n,Set(CHANNEL(hangup\_handler\_push)=handler,s,1)
52+
same => n,Set(CHANNEL(hangup_handler_push)=handler,s,1)
5453
same => n,Dial(SIP/foo&SIP/bar,10)
5554
same => n,Hangup()
5655
5756
[handler]
58-
5957
exten => s,1,NoOp()
60-
61-
same => n,Set(HANGUPCAUSE\_STRING=${HANGUPCAUSE\_KEYS()})
58+
same => n,Set(HANGUPCAUSE_STRING=${HANGUPCAUSE_KEYS()})
6259
6360
; start loop
64-
same => n(hu\_begin),NoOp()
61+
same => n(hu_begin),NoOp()
6562
6663
; check exit condition (no more array to check)
67-
same => n,GotoIf($[${LEN(${HANGUPCAUSE\_STRING})}=0]?hu\_exit)
64+
same => n,GotoIf($[${LEN(${HANGUPCAUSE_STRING})}=0]?hu_exit)
6865
6966
; pull the next item
70-
same => n,Set(ARRAY(item)=${HANGUPCAUSE\_STRING})
71-
same => n,Set(HANGUPCAUSE\_STRING=${HANGUPCAUSE\_STRING:${LEN(${item})}})
67+
same => n,Set(ARRAY(item)=${HANGUPCAUSE_STRING})
68+
same => n,Set(HANGUPCAUSE_STRING=${HANGUPCAUSE_STRING:${LEN(${item})}})
7269
7370
; display the channel name and cause codes
74-
same => n,Verbose(0, Got Channel ID ${item} with Technology Cause Code ${HANGUPCAUSE(${item},tech)}, Asterisk Cause Code ${HANGUPCAUSE(${item},ast)})
71+
same => n,Verbose(0, Got Channel ID ${item} with Technology Cause Code ${HANGUPCAUSE(${item},tech)}, Asterisk Cause Code ${HANGUPCAUSE(${item},ast)})
7572
7673
; check exit condition (no more array to check)
77-
same => n,GotoIf($[${LEN(${HANGUPCAUSE\_STRING})}=0]?hu\_exit)
74+
same => n,GotoIf($[${LEN(${HANGUPCAUSE_STRING})}=0]?hu_exit)
7875
7976
; we still have entries to process, so strip the leading comma
80-
same => n,Set(HANGUPCAUSE\_STRING=${HANGUPCAUSE\_STRING:1})
77+
same => n,Set(HANGUPCAUSE_STRING=${HANGUPCAUSE_STRING:1})
8178
8279
; go back to the beginning of the loop
83-
same => n,Goto(hu\_begin)
84-
85-
same => n(hu\_exit),NoOp()
86-
same => n,Return()
87-
80+
same => n,Goto(hu_begin)
81+
same => n(hu_exit),NoOp()
82+
same => n,Return()
83+
```
8884
### HangupCauseClear
8985

9086
Used to remove all hangup cause information currently stored.
9187

9288
#### Example
9389

9490
The following example clears the hangup cause information from the channel if *SIP/foo* fails to answer and execution continues in the dialplan. The hangup handler attached to the channel will thus only report the the name of the last channel dialled.
95-
91+
```
9692
exten => s,1,NoOp()
97-
same => n,Set(CHANNEL(hangup\_handler\_push)=handler,s,1)
93+
same => n,Set(CHANNEL(hangup_handler_push)=handler,s,1)
9894
same => n,Dial(SIP/foo,10)
9995
same => n,HangupCauseClear()
10096
same => n,Dial(SIP/bar,10)
10197
same => n,Hangup()
10298
10399
[handler]
104-
105100
exten => s,1,NoOp()
106-
same => n,Set(HANGUPCAUSE\_STRING=${HANGUPCAUSE\_KEYS()})
107-
same => n,Verbose(0, Channels with hangup cause information: ${HANGUPCAUSE\_STRING})
101+
same => n,Set(HANGUPCAUSE_STRING=${HANGUPCAUSE_KEYS()})
102+
same => n,Verbose(0, Channels with hangup cause information: ${HANGUPCAUSE_STRING})
108103
same => n,Return()
104+
```

0 commit comments

Comments
 (0)