summaryrefslogtreecommitdiff
path: root/configs/basic-pbx/extensions.conf
blob: ec4b0bd9471b5f90b43d92e6db50e07c3724d3ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
[globals]
; General internal dialing options used in context Internal at
; extension dial_internal_exten. See the Dial app documentation for options.
INTERNAL_DIAL_OPT=,10

[Hints]
;Allow dynamic hint creation for every extension.
exten = _11XX,hint,PJSIP/${EXTEN}

[Features]
;Extension to check user voicemail.
exten = 8000,1,Verbose(1, "User ${CALLERID(num)} dialed the voicemail feature.")
 same = n,VoiceMailMain(${CALLERID(num)}@example,s)
 same = n,Hangup()

[DialingErrors]
; Handle any extensions dialed that don't otherwise exist.
; Comment out or remove this extension if you would rather have the calls
; ignored.
exten = _X.,1,Verbose(1, "User ${CALLERID(num)} dialed an invalid number.")
 same = n,Playback(pbx-invalid)
 same = n,Hangup()

[Internal]
; Include other contexts providing specific functionality for internal users.
include = Hints
include = Features
include = DialingErrors

; Handle internal calling between user extensions.
exten = _11XX,1,Verbose(1, "User ${CALLERID(num)} dialed internally to ${EXTEN}.")
 same = n,Gosub(Internal,dial_internal_exten,1(${EXTEN}))
 same = n,Hangup()

; Internal Dialing Subroutine
;
; ARG1 will be the extension number dialed.

exten = dial_internal_exten,1,Verbose(1, "Entering internal dialing gosub.")
 same = n,Gotoif($[${DEVICE_STATE(PJSIP/${ARG1})} = BUSY]?dialed-BUSY,1:)
 same = n,Dial(PJSIP/${ARG1}${INTERNAL_DIAL_OPT})
 same = n,Goto(dialed-${DIALSTATUS},1)

exten = dialed-NOANSWER,1,NoOp()
 same = n,Voicemail(${ARG1}@example,u)
 same = n,Return()

exten = dialed-BUSY,1,NoOp()
 same = n,Voicemail(${ARG1}@example,b)
 same = n,Return()

exten = dialed-CHANUNAVAIL,1,NoOp()
 same = n,Playback(pbx-invalid)
 same = n,Return()

exten = _dialed-.,1,Goto(dialed-NOANSWER,1)

exten = h,1,Hangup()