fab4047f07c1dbe8eaf0e185cd3f0211219f3dca
[asterisk/asterisk.git] / configs / extensions.conf.sample
1 ;
2 ; Static extension configuration file, used by
3 ; the pbx_config module. This is where you configure all your 
4 ; inbound and outbound calls in Asterisk. 
5
6
7 ;
8 ; The "General" category is for certain variables.  
9 ;
10 [general]
11 ;
12 ; If static is set to no, or omitted, then the pbx_config will rewrite
13 ; this file when extensions are modified.  Remember that all comments
14 ; made in the file will be lost when that happens. 
15 ;
16 ; XXX Not yet implemented XXX
17 ;
18 static=yes
19 ;
20 ; if static=yes and writeprotect=no, you can save dialplan by
21 ; CLI command 'save dialplan' too
22 ;
23 writeprotect=no
24
25 ; You can include other config files, use the #include command (without the ';')
26 ; Note that this is different from the "include" command that includes contexts within 
27 ; other contexts. The #include command works in all asterisk configuration files.
28 ;#include "filename.conf"
29
30 ; The "Globals" category contains global variables that can be referenced
31 ; in the dialplan with ${VARIABLE} or ${ENV(VARIABLE)} for Environmental variable
32 ; ${${VARIABLE}} or ${text${VARIABLE}} or any hybrid
33 ;
34 [globals]
35 CONSOLE=Console/dsp                             ; Console interface for demo
36 ;CONSOLE=Zap/1
37 ;CONSOLE=Phone/phone0
38 IAXINFO=guest                                   ; IAXtel username/password
39 ;IAXINFO=myuser:mypass
40 TRUNK=Zap/g2                                    ; Trunk interface
41 TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)
42 ;TRUNK=IAX2/user:pass@provider
43
44 ;
45 ; Any category other than "General" and "Globals" represent 
46 ; extension contexts, which are collections of extensions.  
47 ;
48 ; Extension names may be numbers, letters, or combinations
49 ; thereof. If an extension name is prefixed by a '_'
50 ; character, it is interpreted as a pattern rather than a
51 ; literal.  In patterns, some characters have special meanings:
52 ;
53 ;   X - any digit from 0-9
54 ;   Z - any digit from 1-9
55 ;   N - any digit from 2-9
56 ;   [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
57 ;   . - wildcard, matches anything remaining (e.g. _9011. matches 
58 ;       anything starting with 9011 excluding 9011 itself)
59 ;
60 ; For example the extension _NXXXXXX would match normal 7 digit dialings, 
61 ; while _1NXXNXXXXXX would represent an area code plus phone number
62 ; preceeded by a one.
63 ;
64 ; Each step of an extension is ordered by priority, which must
65 ; always start with 1 to be considered a valid extension.
66 ;
67 ; Contexts contain several lines, one for each step of each
68 ; extension, which can take one of two forms as listed below,
69 ; with the first form being preferred.  One may include another
70 ; context in the current one as well, optionally with a
71 ; date and time.  Included contexts are included in the order
72 ; they are listed.
73 ;
74 ;[context]
75 ;exten => someexten,priority,application(arg1,arg2,...)
76 ;exten => someexten,priority,application,arg1|arg2...
77 ;
78 ; Timing list for includes is 
79 ;
80 ;   <time range>|<days of week>|<days of month>|<months>
81 ;
82 ;include => daytime|9:00-17:00|mon-fri|*|*
83 ;
84 ; ignorepat can be used to instruct drivers to not cancel dialtone upon
85 ; receipt of a particular pattern.  The most commonly used example is
86 ; of course '9' like this:
87 ;
88 ;ignorepat => 9
89 ;
90 ; so that dialtone remains even after dialing a 9.
91 ;
92
93 ;
94 ; Here are the entries you need to participate in the IAXTEL
95 ; call routing system.  Most IAXTEL numbers begin with 1-700, but
96 ; there are exceptions.  For more information, and to sign
97 ; up, please go to www.gnophone.com or www.iaxtel.com
98 ;
99 [iaxtel700]
100 exten => _91700XXXXXXX,1,Dial(IAX2/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel)
101
102 ;
103 ; The SWITCH statement permits a server to share the dialplain with
104 ; another server. Use with care: Reciprocal switch statements are not
105 ; allowed (e.g. both A -> B and B -> A), and the switched server needs
106 ; to be on-line or else dialing can be severly delayed.
107 ;
108 [iaxprovider]
109 ;switch => IAX2/user:[key]@myserver/mycontext
110
111 [trunkint]
112 ;
113 ; International long distance through trunk
114 ;
115 exten => _9011.,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
116 exten => _9011.,2,Congestion
117
118 [trunkld]
119 ;
120 ; Long distance context accessed through trunk
121 ;
122 exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
123 exten => _91NXXNXXXXXX,2,Congestion
124
125 [trunklocal]
126 ;
127 ; Local seven-digit dialing accessed through trunk interface
128 ;
129 exten => _9NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
130 exten => _9NXXXXXX,2,Congestion
131
132 [trunktollfree]
133 ;
134 ; Long distance context accessed through trunk interface
135 ;
136 exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
137 exten => _91800NXXXXXX,2,Congestion
138 exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
139 exten => _91888NXXXXXX,2,Congestion
140 exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
141 exten => _91877NXXXXXX,2,Congestion
142 exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
143 exten => _91866NXXXXXX,2,Congestion
144
145 [international]
146 ;
147 ; Master context for international long distance
148 ;
149 ignorepat => 9
150 include => longdistance
151 include => trunkint
152
153 [longdistance]
154 ;
155 ; Master context for long distance
156 ;
157 ignorepat => 9
158 include => local
159 include => trunkld
160
161 [local]
162 ;
163 ; Master context for local, toll-free, and iaxtel calls only
164 ;
165 ignorepat => 9
166 include => default
167 include => parkedcalls
168 include => trunklocal
169 include => iaxtel700
170 include => trunktollfree
171 include => iaxprovider
172 ;
173 ; You can use an alternative switch type as well, to resolve
174 ; extensions that are not known here, for example with remote 
175 ; IAX switching you transparently get access to the remote
176 ; Asterisk PBX
177
178 ; switch => IAX2/user:password@bigserver/local
179
180 [macro-stdexten];
181 ;
182 ; Standard extension macro:
183 ;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well
184 ;   ${ARG2} - Device(s) to ring
185 ;
186 exten => s,1,Dial(${ARG2},20)                                   ; Ring the interface, 20 seconds maximum
187 exten => s,2,Goto(s-${DIALSTATUS},1)                            ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
188
189 exten => s-NOANSWER,1,Voicemail(u${ARG1})               ; If unavailable, send to voicemail w/ unavail announce
190 exten => s-NOANSWER,2,Goto(default,s,1)                 ; If they press #, return to start
191
192 exten => s-BUSY,1,Voicemail(b${ARG1})                   ; If busy, send to voicemail w/ busy announce
193 exten => s-BUSY,2,Goto(default,s,1)                             ; If they press #, return to start
194
195 exten => s-.,1,Goto(s-NOANSWER,1)                               ; Treat anything else as no answer
196
197 exten => a,1,VoicemailMain(${ARG1})                             ; If they press *, send the user into VoicemailMain
198
199 [demo]
200 ;
201 ; We start with what to do when a call first comes in.
202 ;
203 exten => s,1,Wait,1                     ; Wait a second, just for fun
204 exten => s,2,Answer                     ; Answer the line
205 exten => s,3,DigitTimeout,5             ; Set Digit Timeout to 5 seconds
206 exten => s,4,ResponseTimeout,10         ; Set Response Timeout to 10 seconds
207 exten => s,5,BackGround(demo-congrats)  ; Play a congratulatory message
208 exten => s,6,BackGround(demo-instruct)  ; Play some instructions
209
210 exten => 2,1,BackGround(demo-moreinfo)  ; Give some more information.
211 exten => 2,2,Goto(s,6)
212
213 exten => 3,1,SetLanguage(fr)            ; Set language to french
214 exten => 3,2,Goto(s,5)                  ; Start with the congratulations
215
216 exten => 1000,1,Goto(default,s,1)
217 ;
218 ; We also create an example user, 1234, who is on the console and has
219 ; voicemail, etc.
220 ;
221 exten => 1234,1,Playback(transfer,skip)         ; "Please hold while..." 
222                                         ; (but skip if channel is not up)
223 exten => 1234,2,Macro(stdexten,1234,${CONSOLE})
224
225 exten => 1235,1,Voicemail(u1234)                ; Right to voicemail
226
227 exten => 1236,1,Dial(Console/dsp)               ; Ring forever
228 exten => 1236,2,Voicemail(u1234)                ; Unless busy
229
230 ;
231 ; # for when they're done with the demo
232 ;
233 exten => #,1,Playback(demo-thanks)              ; "Thanks for trying the demo"
234 exten => #,2,Hangup                     ; Hang them up.
235
236 ;
237 ; A timeout and "invalid extension rule"
238 ;
239 exten => t,1,Goto(#,1)                  ; If they take too long, give up
240 exten => i,1,Playback(invalid)          ; "That's not valid, try again"
241
242 ;
243 ; Create an extension, 500, for dialing the
244 ; Asterisk demo.
245 ;
246 exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
247 exten => 500,2,Dial(IAX2/guest@misery.digium.com/s@default)     ; Call the Asterisk demo
248 exten => 500,3,Playback(demo-nogo)      ; Couldn't connect to the demo site
249 exten => 500,4,Goto(s,6)                ; Return to the start over message.
250
251 ;
252 ; Create an extension, 600, for evaulating echo latency.
253 ;
254 exten => 600,1,Playback(demo-echotest)  ; Let them know what's going on
255 exten => 600,2,Echo                     ; Do the echo test
256 exten => 600,3,Playback(demo-echodone)  ; Let them know it's over
257 exten => 600,4,Goto(s,6)                ; Start over
258
259 ;
260 ; Give voicemail at extension 8500
261 ;
262 exten => 8500,1,VoicemailMain
263 exten => 8500,2,Goto(s,6)
264 ;
265 ; Here's what a phone entry would look like (IXJ for example)
266 ;
267 ;exten => 1265,1,Dial(Phone/phone0,15)
268 ;exten => 1265,2,Goto(s,5)
269
270 ;[mainmenu]
271 ;
272 ; Example "main menu" context with submenu
273 ;
274 ;exten => s,1,Answer
275 ;exten => s,2,Background(thanks)                ; "Thanks for calling press 1 for sales, 2 for support, ..."
276 ;exten => 1,1,Goto(submenu,s,1)
277 ;exten => 2,1,Hangup
278 ;include => default
279 ;
280 ;[submenu]
281 ;exten => s,1,Ringing                                   ; Make them comfortable with 2 seconds of ringback
282 ;exten => s,2,Wait,2
283 ;exten => s,3,Background(submenuopts)   ; "Thanks for calling the sales department.  Press 1 for steve, 2 for..."
284 ;exten => 1,1,Goto(default,steve,1)
285 ;exten => 2,1,Goto(default,mark,2)
286
287 [default]
288 ;
289 ; By default we include the demo.  In a production system, you 
290 ; probably don't want to have the demo there.
291 ;
292 include => demo
293
294 ;
295 ; Extensions like the two below can be used for FWD, Nikotel, sipgate etc.
296 ; Note that you must have a [sipprovider] section in sip.conf whereas
297 ; the otherprovider.net example does not require such a peer definition
298 ;
299 ;exten => _41X.,1,Dial(SIP/${EXTEN:2}@sipprovider,,r)
300 ;exten => _42X.,1,Dial(SIP/user:passwd@${EXTEN:2}@otherprovider.net,30,rT)
301
302 ; Real extensions would go here. Generally you want real extensions to be 4 or 5
303 ; digits long (although there is no such requirement) and start with a single
304 ; digit that is fairly large (like 6 or 7) so that you have plenty of room to
305 ; overlap extensions and menu options without conflict.  You can alias them with
306 ; names, too and use global variables
307
308 ;exten => 6245,1,Dial(SIP/Grandstream1,20,rt)   ; permit transfer
309 ;exten => 6245,1,Dial(SIP/Grandstream1&SIP/Xlite1,20,rtT)
310 ;exten => 6361,1,Dial(IAX2/JaneDoe,,rm)         ; ring without time limit
311 ;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
312 ;exten => 6394,1,Dial(Local/6275/n)             ; this will dial ${MARK}
313
314 ;exten => 6275,1,Macro(stdexten,6275,${MARK})   ; assuming ${MARK} is something like Zap/2
315 ;exten => mark,1,Goto(6275|1)                   ; alias mark to 6275
316 ;exten => 6536,1,Macro(stdexten,6236,${WIL})    ; Ditto for wil
317 ;exten => wil,1,Goto(6236|1)
318 ;
319 ; Some other handy things are an extension for checking voicemail via
320 ; voicemailmain
321 ;
322 ;exten => 8500,1,VoicemailMain
323 ;exten => 8500,2,Hangup
324 ;
325 ; Or a conference room (you'll need to edit meetme.conf to enable this room)
326 ;
327 ;exten => 8600,1,Meetme(1234)
328 ;
329 ; Or playing an announcement to the called party, as soon it answers
330 ;
331 ;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
332 ;
333 ; For more information on applications, just type "show applications" at your
334 ; friendly Asterisk CLI prompt.
335 ;
336 ; 'show application <command>' will show details of how you
337 ; use that particular application in this file, the dial plan. 
338 ;