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