You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Configuration/Miscellaneous/Hangup-Cause.md
+24-28Lines changed: 24 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,19 +21,19 @@ Used to obtain a comma separated list of all channels for which hangup causes ar
21
21
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:
22
22
23
23
Channels with hangup cause information: SIP/bar-00000002,SIP/foo-00000001
24
+
```
24
25
[default]
25
-
26
26
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)
28
28
same => n,Dial(SIP/foo&SIP/bar,10)
29
29
same => n,Hangup()
30
30
31
31
[handler]
32
-
33
32
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})
36
35
same => n,Return()
36
+
```
37
37
### HANGUPCAUSE
38
38
39
39
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
46
46
#### Example
47
47
48
48
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
+
```
50
50
[default]
51
-
52
51
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)
54
53
same => n,Dial(SIP/foo&SIP/bar,10)
55
54
same => n,Hangup()
56
55
57
56
[handler]
58
-
59
57
exten => s,1,NoOp()
60
-
61
-
same => n,Set(HANGUPCAUSE\_STRING=${HANGUPCAUSE\_KEYS()})
58
+
same => n,Set(HANGUPCAUSE_STRING=${HANGUPCAUSE_KEYS()})
62
59
63
60
; start loop
64
-
same => n(hu\_begin),NoOp()
61
+
same => n(hu_begin),NoOp()
65
62
66
63
; 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)
68
65
69
66
; 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})}})
72
69
73
70
; 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)})
75
72
76
73
; 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)
78
75
79
76
; 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})
81
78
82
79
; 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
+
```
88
84
### HangupCauseClear
89
85
90
86
Used to remove all hangup cause information currently stored.
91
87
92
88
#### Example
93
89
94
90
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
+
```
96
92
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)
98
94
same => n,Dial(SIP/foo,10)
99
95
same => n,HangupCauseClear()
100
96
same => n,Dial(SIP/bar,10)
101
97
same => n,Hangup()
102
98
103
99
[handler]
104
-
105
100
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})
0 commit comments