block addition of silence files... not needed here
[asterisk-bristuff.git] / configs / extensions.conf.sample
blobdd6ba132927a06d09b75a228f6417792440ef88a
1 ; extensions.conf - the Asterisk dial plan
3 ; Static extension configuration file, used by
4 ; the pbx_config module. This is where you configure all your 
5 ; inbound and outbound calls in Asterisk. 
6
7 ; This configuration file is reloaded 
8 ; - With the "extensions reload" command in the CLI
9 ; - With the "reload" command (that reloads everything) in the CLI
12 ; The "General" category is for certain variables.  
14 [general]
16 ; If static is set to no, or omitted, then the pbx_config will rewrite
17 ; this file when extensions are modified.  Remember that all comments
18 ; made in the file will be lost when that happens. 
20 ; XXX Not yet implemented XXX
22 static=yes
24 ; if static=yes and writeprotect=no, you can save dialplan by
25 ; CLI command 'save dialplan' too
27 writeprotect=no
29 ; If autofallthrough is set, then if an extension runs out of
30 ; things to do, it will terminate the call with BUSY, CONGESTION
31 ; or HANGUP depending on Asterisk's best guess. This is the default.
33 ; If autofallthrough is not set, then if an extension runs out of 
34 ; things to do, Asterisk will wait for a new extension to be dialed 
35 ; (this is the original behavior of Asterisk 1.0 and earlier).
37 ;autofallthrough=no
39 ; If clearglobalvars is set, global variables will be cleared 
40 ; and reparsed on an extensions reload, or Asterisk reload.
42 ; If clearglobalvars is not set, then global variables will persist
43 ; through reloads, and even if deleted from the extensions.conf or
44 ; one of its included files, will remain set to the previous value.
46 clearglobalvars=no
48 ; If priorityjumping is set to 'yes', then applications that support
49 ; 'jumping' to a different priority based on the result of their operations
50 ; will do so (this is backwards compatible behavior with pre-1.2 releases
51 ; of Asterisk). Individual applications can also be requested to do this
52 ; by passing a 'j' option in their arguments.
54 ;priorityjumping=yes
56 ; User context is where entries from users.conf are registered.  The
57 ; default value is 'default'
59 ;userscontext=default
61 ; You can include other config files, use the #include command
62 ; (without the ';'). Note that this is different from the "include" command
63 ; that includes contexts within other contexts. The #include command works
64 ; in all asterisk configuration files.
65 ;#include "filename.conf"
67 ; The "Globals" category contains global variables that can be referenced
68 ; in the dialplan with the GLOBAL dialplan function:
69 ; ${GLOBAL(VARIABLE)}
70 ; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
71 ; Unix/Linux environmental variables can be reached with the ENV dialplan
72 ; function: ${ENV(VARIABLE)}
74 [globals]
75 CONSOLE=Console/dsp                             ; Console interface for demo
76 ;CONSOLE=Zap/1
77 ;CONSOLE=Phone/phone0
78 IAXINFO=guest                                   ; IAXtel username/password
79 ;IAXINFO=myuser:mypass
80 TRUNK=Zap/g2                                    ; Trunk interface
82 ; Note the 'g2' in the TRUNK variable above. It specifies which group (defined
83 ; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
84 ; the specified group. The four possible options are:
86 ; g: select the lowest-numbered non-busy Zap channel
87 ;    (aka. ascending sequential hunt group).
88 ; G: select the highest-numbered non-busy Zap channel
89 ;    (aka. descending sequential hunt group).
90 ; r: use a round-robin search, starting at the next highest channel than last
91 ;    time (aka. ascending rotary hunt group).
92 ; R: use a round-robin search, starting at the next lowest channel than last
93 ;    time (aka. descending rotary hunt group).
95 TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)
96 ;TRUNK=IAX2/user:pass@provider
99 ; Any category other than "General" and "Globals" represent 
100 ; extension contexts, which are collections of extensions.  
102 ; Extension names may be numbers, letters, or combinations
103 ; thereof. If an extension name is prefixed by a '_'
104 ; character, it is interpreted as a pattern rather than a
105 ; literal.  In patterns, some characters have special meanings:
107 ;   X - any digit from 0-9
108 ;   Z - any digit from 1-9
109 ;   N - any digit from 2-9
110 ;   [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
111 ;   . - wildcard, matches anything remaining (e.g. _9011. matches 
112 ;       anything starting with 9011 excluding 9011 itself)
113 ;   ! - wildcard, causes the matching process to complete as soon as
114 ;       it can unambiguously determine that no other matches are possible
116 ; For example the extension _NXXXXXX would match normal 7 digit dialings, 
117 ; while _1NXXNXXXXXX would represent an area code plus phone number
118 ; preceded by a one.
120 ; Each step of an extension is ordered by priority, which must
121 ; always start with 1 to be considered a valid extension.  The priority
122 ; "next" or "n" means the previous priority plus one, regardless of whether
123 ; the previous priority was associated with the current extension or not.
124 ; The priority "same" or "s" means the same as the previously specified
125 ; priority, again regardless of whether the previous entry was for the
126 ; same extension.  Priorities may be immediately followed by a plus sign
127 ; and another integer to add that amount (most useful with 's' or 'n').  
128 ; Priorities may then also have an alias, or label, in 
129 ; parenthesis after their name which can be used in goto situations
131 ; Contexts contain several lines, one for each step of each
132 ; extension, which can take one of two forms as listed below,
133 ; with the first form being preferred.  One may include another
134 ; context in the current one as well, optionally with a
135 ; date and time.  Included contexts are included in the order
136 ; they are listed.
138 ;[context]
139 ;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
140 ;exten => someexten,{priority|label{+|-}offset}[(alias)],application,arg1|arg2...
142 ; Timing list for includes is 
144 ;   <time range>|<days of week>|<days of month>|<months>
146 ; Note that ranges may be specified to wrap around the ends.  Also, minutes are
147 ; fine-grained only down to the closest even minute.
149 ;include => daytime|9:00-17:00|mon-fri|*|*
150 ;include => weekend|*|sat-sun|*|*
151 ;include => weeknights|17:02-8:58|mon-fri|*|*
153 ; ignorepat can be used to instruct drivers to not cancel dialtone upon
154 ; receipt of a particular pattern.  The most commonly used example is
155 ; of course '9' like this:
157 ;ignorepat => 9
159 ; so that dialtone remains even after dialing a 9.
163 ; Sample entries for extensions.conf
166 [dundi-e164-canonical]
168 ; List canonical entries here
170 ;exten => 12564286000,1,Macro(stdexten,6000,IAX2/foo)
171 ;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7})
173 [dundi-e164-customers]
175 ; If you are an ITSP or Reseller, list your customers here.
177 ;exten => _12564286000,1,Dial(SIP/customer1)
178 ;exten => _12564286001,1,Dial(IAX2/customer2)
180 [dundi-e164-via-pstn]
182 ; If you are freely delivering calls to the PSTN, list them here
184 ;exten => _1256428XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Expose all of 256-428 
185 ;exten => _1256325XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Ditto for 256-325
187 [dundi-e164-local]
189 ; Context to put your dundi IAX2 or SIP user in for
190 ; full access
192 include => dundi-e164-canonical
193 include => dundi-e164-customers
194 include => dundi-e164-via-pstn
196 [dundi-e164-switch]
198 ; Just a wrapper for the switch
200 switch => DUNDi/e164
202 [dundi-e164-lookup]
204 ; Locally to lookup, try looking for a local E.164 solution
205 ; then try DUNDi if we don't have one.
207 include => dundi-e164-local
208 include => dundi-e164-switch
210 ; DUNDi can also be implemented as a Macro instead of using 
211 ; the Local channel driver. 
213 [macro-dundi-e164]
215 ; ARG1 is the extension to Dial
217 ; Extension "s" is not a wildcard extension that matches "anything".
218 ; In macros, it is the start extension. In most other cases, 
219 ; you have to goto "s" to execute that extension.
221 ; For wildcard matches, see above - all pattern matches start with
222 ; an underscore.
223 exten => s,1,Goto(${ARG1},1)
224 include => dundi-e164-lookup
227 ; Here are the entries you need to participate in the IAXTEL
228 ; call routing system.  Most IAXTEL numbers begin with 1-700, but
229 ; there are exceptions.  For more information, and to sign
230 ; up, please go to www.gnophone.com or www.iaxtel.com
232 [iaxtel700]
233 exten => _91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}@iaxtel.com/${EXTEN:1}@iaxtel)
236 ; The SWITCH statement permits a server to share the dialplan with
237 ; another server. Use with care: Reciprocal switch statements are not
238 ; allowed (e.g. both A -> B and B -> A), and the switched server needs
239 ; to be on-line or else dialing can be severly delayed.
241 [iaxprovider]
242 ;switch => IAX2/user:[key]@myserver/mycontext
244 [trunkint]
246 ; International long distance through trunk
248 exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
249 exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
251 [trunkld]
253 ; Long distance context accessed through trunk
255 exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})
256 exten => _91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
258 [trunklocal]
260 ; Local seven-digit dialing accessed through trunk interface
262 exten => _9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
264 [trunktollfree]
266 ; Long distance context accessed through trunk interface
268 exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
269 exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
270 exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
271 exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
273 [international]
275 ; Master context for international long distance
277 ignorepat => 9
278 include => longdistance
279 include => trunkint
281 [longdistance]
283 ; Master context for long distance
285 ignorepat => 9
286 include => local
287 include => trunkld
289 [local]
291 ; Master context for local, toll-free, and iaxtel calls only
293 ignorepat => 9
294 include => default
295 include => trunklocal
296 include => iaxtel700
297 include => trunktollfree
298 include => iaxprovider
300 ;Include parkedcalls (or the context you define in features conf)
301 ;to enable call parking.
302 include => parkedcalls
304 ; You can use an alternative switch type as well, to resolve
305 ; extensions that are not known here, for example with remote 
306 ; IAX switching you transparently get access to the remote
307 ; Asterisk PBX
309 ; switch => IAX2/user:password@bigserver/local
311 ; An "lswitch" is like a switch but is literal, in that
312 ; variable substitution is not performed at load time
313 ; but is passed to the switch directly (presumably to
314 ; be substituted in the switch routine itself)
316 ; lswitch => Loopback/12${EXTEN}@othercontext
318 ; An "eswitch" is like a switch but the evaluation of
319 ; variable substitution is performed at runtime before
320 ; being passed to the switch routine.
322 ; eswitch => IAX2/context@${CURSERVER}
324 [macro-trunkdial]
326 ; Standard trunk dial macro (hangs up on a dialstatus that should 
327 ; terminate call)
328 ;   ${ARG1} - What to dial
330 exten => s,1,Dial(${ARG1})
331 exten => s,n,Goto(s-${DIALSTATUS},1)
332 exten => s-NOANSWER,1,Hangup
333 exten => s-BUSY,1,Hangup
334 exten => _s-.,1,NoOp
336 [macro-stdexten];
338 ; Standard extension macro:
339 ;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well
340 ;   ${ARG2} - Device(s) to ring
342 exten => s,1,Dial(${ARG2},20)                   ; Ring the interface, 20 seconds maximum
343 exten => s,2,Goto(s-${DIALSTATUS},1)            ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
345 exten => s-NOANSWER,1,Voicemail(${ARG1},u)      ; If unavailable, send to voicemail w/ unavail announce
346 exten => s-NOANSWER,2,Goto(default,s,1)         ; If they press #, return to start
348 exten => s-BUSY,1,Voicemail(${ARG1},b)          ; If busy, send to voicemail w/ busy announce
349 exten => s-BUSY,2,Goto(default,s,1)             ; If they press #, return to start
351 exten => _s-.,1,Goto(s-NOANSWER,1)              ; Treat anything else as no answer
353 exten => a,1,VoicemailMain(${ARG1})             ; If they press *, send the user into VoicemailMain
355 [macro-stdPrivacyexten];
357 ; Standard extension macro:
358 ;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well
359 ;   ${ARG2} - Device(s) to ring
360 ;   ${ARG3} - Optional DONTCALL context name to jump to (assumes the s,1 extension-priority)
361 ;   ${ARG4} - Optional TORTURE context name to jump to (assumes the s,1 extension-priority)`
363 exten => s,1,Dial(${ARG2},20|p)                 ; Ring the interface, 20 seconds maximum, call screening 
364                                                 ; option (or use P for databased call screening)
365 exten => s,2,Goto(s-${DIALSTATUS},1)            ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
367 exten => s-NOANSWER,1,Voicemail(${ARG1},u)      ; If unavailable, send to voicemail w/ unavail announce
368 exten => s-NOANSWER,2,Goto(default,s,1)         ; If they press #, return to start
370 exten => s-BUSY,1,Voicemail(${ARG1},b)          ; If busy, send to voicemail w/ busy announce
371 exten => s-BUSY,2,Goto(default,s,1)             ; If they press #, return to start
373 exten => s-DONTCALL,1,Goto(${ARG3},s,1)         ; Callee chose to send this call to a polite "Don't call again" script.
375 exten => s-TORTURE,1,Goto(${ARG4},s,1)          ; Callee chose to send this call to a telemarketer torture script.
377 exten => _s-.,1,Goto(s-NOANSWER,1)              ; Treat anything else as no answer
379 exten => a,1,VoicemailMain(${ARG1})             ; If they press *, send the user into VoicemailMain
381 [macro-page];
383 ; Paging macro:
385 ;       Check to see if SIP device is in use and DO NOT PAGE if they are
387 ;   ${ARG1} - Device to page
389 exten => s,1,ChanIsAvail(${ARG1}|js)                    ; j is for Jump and s is for ANY call
390 exten => s,n,GoToIf([${AVAILSTATUS} = "1"]?autoanswer:fail)
391 exten => s,n(autoanswer),Set(_ALERT_INFO="RA")                  ; This is for the PolyComs
392 exten => s,n,SIPAddHeader(Call-Info: Answer-After=0)    ; This is for the Grandstream, Snoms, and Others
393 exten => s,n,NoOp()                                     ; Add others here and Post on the Wiki!!!!
394 exten => s,n,Dial(${ARG1}||)
395 exten => s,n(fail),Hangup
398 [demo]
400 ; We start with what to do when a call first comes in.
402 exten => s,1,Wait(1)                    ; Wait a second, just for fun
403 exten => s,n,Answer                     ; Answer the line
404 exten => s,n,Set(TIMEOUT(digit)=5)      ; Set Digit Timeout to 5 seconds
405 exten => s,n,Set(TIMEOUT(response)=10)  ; Set Response Timeout to 10 seconds
406 exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message
407 exten => s,n(instruct),BackGround(demo-instruct)        ; Play some instructions
408 exten => s,n,WaitExten                  ; Wait for an extension to be dialed.
410 exten => 2,1,BackGround(demo-moreinfo)  ; Give some more information.
411 exten => 2,n,Goto(s,instruct)
413 exten => 3,1,Set(LANGUAGE()=fr)         ; Set language to french
414 exten => 3,n,Goto(s,restart)            ; Start with the congratulations
416 exten => 1000,1,Goto(default,s,1)
418 ; We also create an example user, 1234, who is on the console and has
419 ; voicemail, etc.
421 exten => 1234,1,Playback(transfer,skip)         ; "Please hold while..." 
422                                         ; (but skip if channel is not up)
423 exten => 1234,n,Macro(stdexten,1234,${GLOBAL(CONSOLE)})
425 exten => 1235,1,Voicemail(1234,u)               ; Right to voicemail
427 exten => 1236,1,Dial(Console/dsp)               ; Ring forever
428 exten => 1236,n,Voicemail(1234,b)               ; Unless busy
431 ; # for when they're done with the demo
433 exten => #,1,Playback(demo-thanks)      ; "Thanks for trying the demo"
434 exten => #,n,Hangup                     ; Hang them up.
437 ; A timeout and "invalid extension rule"
439 exten => t,1,Goto(#,1)                  ; If they take too long, give up
440 exten => i,1,Playback(invalid)          ; "That's not valid, try again"
443 ; Create an extension, 500, for dialing the
444 ; Asterisk demo.
446 exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
447 exten => 500,n,Dial(IAX2/guest@misery.digium.com/s@default)     ; Call the Asterisk demo
448 exten => 500,n,Playback(demo-nogo)      ; Couldn't connect to the demo site
449 exten => 500,n,Goto(s,6)                ; Return to the start over message.
452 ; Create an extension, 600, for evaluating echo latency.
454 exten => 600,1,Playback(demo-echotest)  ; Let them know what's going on
455 exten => 600,n,Echo                     ; Do the echo test
456 exten => 600,n,Playback(demo-echodone)  ; Let them know it's over
457 exten => 600,n,Goto(s,6)                ; Start over
460 ;       You can use the Macro Page to intercom a individual user
461 exten => 76245,1,Macro(page,SIP/Grandstream1)
462 ; or if your peernames are the same as extensions
463 exten => _7XXX,1,Macro(page,SIP/${EXTEN})
466 ; System Wide Page at extension 7999
468 exten => 7999,1,Set(TIMEOUT(absolute)=60)
469 exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n|d)
471 ; Give voicemail at extension 8500
473 exten => 8500,1,VoicemailMain
474 exten => 8500,n,Goto(s,6)
476 ; Here's what a phone entry would look like (IXJ for example)
478 ;exten => 1265,1,Dial(Phone/phone0,15)
479 ;exten => 1265,n,Goto(s,5)
482 ;       The page context calls up the page macro that sets variables needed for auto-answer
483 ;       It is in is own context to make calling it from the Page() application as simple as 
484 ;       Local/{peername}@page
486 [page]
487 exten => _X.,1,Macro(page,SIP/${EXTEN})
489 ;[mainmenu]
491 ; Example "main menu" context with submenu
493 ;exten => s,1,Answer
494 ;exten => s,n,Background(thanks)                ; "Thanks for calling press 1 for sales, 2 for support, ..."
495 ;exten => s,n,WaitExten
496 ;exten => 1,1,Goto(submenu,s,1)
497 ;exten => 2,1,Hangup
498 ;include => default
500 ;[submenu]
501 ;exten => s,1,Ringing                                   ; Make them comfortable with 2 seconds of ringback
502 ;exten => s,n,Wait,2
503 ;exten => s,n,Background(submenuopts)   ; "Thanks for calling the sales department.  Press 1 for steve, 2 for..."
504 ;exten => s,n,WaitExten
505 ;exten => 1,1,Goto(default,steve,1)
506 ;exten => 2,1,Goto(default,mark,2)
508 [default]
510 ; By default we include the demo.  In a production system, you 
511 ; probably don't want to have the demo there.
513 include => demo
516 ; An extension like the one below can be used for FWD, Nikotel, sipgate etc.
517 ; Note that you must have a [sipprovider] section in sip.conf
519 ;exten => _41X.,1,Dial(SIP/${EXTEN:2}@sipprovider,,r)
521 ; Real extensions would go here. Generally you want real extensions to be
522 ; 4 or 5 digits long (although there is no such requirement) and start with a
523 ; single digit that is fairly large (like 6 or 7) so that you have plenty of
524 ; room to overlap extensions and menu options without conflict.  You can alias
525 ; them with names, too, and use global variables
527 ;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1,Joe Schmoe ; Channel hints for presence
528 ;exten => 6245,1,Dial(SIP/Grandstream1,20,rt)   ; permit transfer
529 ;exten => 6245,n(dial),Dial(${HINT},20,rtT)     ; Use hint as listed
530 ;exten => 6245,n,Voicemail(6245,u)              ; Voicemail (unavailable)
531 ;exten => 6245,s+1,Hangup                       ; s+1, same as n
532 ;exten => 6245,dial+101,Voicemail(6245,b)       ; Voicemail (busy)
533 ;exten => 6361,1,Dial(IAX2/JaneDoe,,rm)         ; ring without time limit
534 ;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
535 ;exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
536 ;exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org) ;Dial via jingle using asterisk as the transport and calling mogorman.
537 ;exten => 6394,1,Dial(Local/6275/n)             ; this will dial ${MARK}
539 ;exten => 6275,1,Macro(stdexten,6275,${MARK})   ; assuming ${MARK} is something like Zap/2
540 ;exten => mark,1,Goto(6275|1)                   ; alias mark to 6275
541 ;exten => 6536,1,Macro(stdexten,6236,${WIL})    ; Ditto for wil
542 ;exten => wil,1,Goto(6236|1)
544 ;If you want to subscribe to the status of a parking space, this is
545 ;how you do it. Subscribe to extension 6600 in sip, and you will see
546 ;the status of the first parking lot with this extensions' help
547 ;exten => 6600,hint,park:701@parkedcalls
548 ;exten => 6600,1,noop
550 ; Some other handy things are an extension for checking voicemail via
551 ; voicemailmain
553 ;exten => 8500,1,VoicemailMain
554 ;exten => 8500,n,Hangup
556 ; Or a conference room (you'll need to edit meetme.conf to enable this room)
558 ;exten => 8600,1,Meetme(1234)
560 ; Or playing an announcement to the called party, as soon it answers
562 ;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
564 ; For more information on applications, just type "show applications" at your
565 ; friendly Asterisk CLI prompt.
567 ; 'show application <command>' will show details of how you
568 ; use that particular application in this file, the dial plan. 
569 ; 'show functions" will list all dialplan functions
570 ; 'show function <COMMAND>' will show you more information about
571 ; one function. Remember that function names are UPPER CASE.