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.
6 ; This configuration file is reloaded
7 ; - With the "extensions reload" command in the CLI
8 ; - With the "reload" command (that reloads everything) in the CLI
11 ; The "General" category is for certain variables.
15 ; If static is set to no, or omitted, then the pbx_config will rewrite
16 ; this file when extensions are modified. Remember that all comments
17 ; made in the file will be lost when that happens.
19 ; XXX Not yet implemented XXX
23 ; if static=yes and writeprotect=no, you can save dialplan by
24 ; CLI command 'save dialplan' too
28 ; If autofallthrough is set, then if an extension runs out of
29 ; things to do, it will terminate the call with BUSY, CONGESTION
30 ; or HANGUP depending on Asterisk's best guess (strongly recommended).
32 ; If autofallthrough is not set, then if an extension runs out of
33 ; things to do, asterisk will wait for a new extension to be dialed
34 ; (this is the original behavior of Asterisk 1.0 and earlier).
38 ; If clearglobalvars is set, global variables will be cleared
39 ; and reparsed on an extensions reload, or Asterisk reload.
41 ; If clearglobalvars is not set, then global variables will persist
42 ; through reloads, and even if deleted from the extensions.conf or
43 ; one of its included files, will remain set to the previous value.
47 ; If priorityjumping is set to 'yes', then applications that support
48 ; 'jumping' to a different priority based on the result of their operations
49 ; will do so (this is backwards compatible behavior with pre-1.2 releases
50 ; of Asterisk). Individual applications can also be requested to do this
51 ; by passing a 'j' option in their arguments.
55 ; You can include other config files, use the #include command
56 ; (without the ';'). Note that this is different from the "include" command
57 ; that includes contexts within other contexts. The #include command works
58 ; in all asterisk configuration files.
59 ;#include "filename.conf"
61 ; The "Globals" category contains global variables that can be referenced
62 ; in the dialplan with ${VARIABLE} or ${ENV(VARIABLE)} for Environmental
64 ; ${${VARIABLE}} or ${text${VARIABLE}} or any hybrid
67 CONSOLE=Console/dsp ; Console interface for demo
70 IAXINFO=guest ; IAXtel username/password
71 ;IAXINFO=myuser:mypass
72 TRUNK=Zap/g2 ; Trunk interface
74 ; Note the 'g2' in the TRUNK variable above. It specifies which group (defined
75 ; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
76 ; the specified group. The four possible options are:
78 ; g: select the lowest-numbered non-busy Zap channel
79 ; (aka. ascending sequential hunt group).
80 ; G: select the highest-numbered non-busy Zap channel
81 ; (aka. descending sequential hunt group).
82 ; r: use a round-robin search, starting at the next highest channel than last
83 ; time (aka. ascending rotary hunt group).
84 ; R: use a round-robin search, starting at the next lowest channel than last
85 ; time (aka. descending rotary hunt group).
87 TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
88 ;TRUNK=IAX2/user:pass@provider
91 ; Any category other than "General" and "Globals" represent
92 ; extension contexts, which are collections of extensions.
94 ; Extension names may be numbers, letters, or combinations
95 ; thereof. If an extension name is prefixed by a '_'
96 ; character, it is interpreted as a pattern rather than a
97 ; literal. In patterns, some characters have special meanings:
99 ; X - any digit from 0-9
100 ; Z - any digit from 1-9
101 ; N - any digit from 2-9
102 ; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
103 ; . - wildcard, matches anything remaining (e.g. _9011. matches
104 ; anything starting with 9011 excluding 9011 itself)
105 ; ! - wildcard, causes the matching process to complete as soon as
106 ; it can unambiguously determine that no other matches are possible
108 ; For example the extension _NXXXXXX would match normal 7 digit dialings,
109 ; while _1NXXNXXXXXX would represent an area code plus phone number
110 ; preceeded by a one.
112 ; Each step of an extension is ordered by priority, which must
113 ; always start with 1 to be considered a valid extension. The priority
114 ; "next" or "n" means the previous priority plus one, regardless of whether
115 ; the previous priority was associated with the current extension or not.
116 ; The priority "same" or "s" means the same as the previously specified
117 ; priority, again regardless of whether the previous entry was for the
118 ; same extension. Priorities may be immediately followed by a plus sign
119 ; and another integer to add that amount (most useful with 's' or 'n').
120 ; Priorities may then also have an alias, or label, in
121 ; parenthesis after their name which can be used in goto situations
123 ; Contexts contain several lines, one for each step of each
124 ; extension, which can take one of two forms as listed below,
125 ; with the first form being preferred. One may include another
126 ; context in the current one as well, optionally with a
127 ; date and time. Included contexts are included in the order
131 ;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
132 ;exten => someexten,{priority|label{+|-}offset}[(alias)],application,arg1|arg2...
134 ; Timing list for includes is
136 ; <time range>|<days of week>|<days of month>|<months>
138 ; Note that ranges may be specified to wrap around the ends. Also, minutes are
139 ; fine-grained only down to the closest even minute.
141 ;include => daytime|9:00-17:00|mon-fri|*|*
142 ;include => weekend|*|sat-sun|*|*
143 ;include => weeknights|17:02-8:58|mon-fri|*|*
145 ; ignorepat can be used to instruct drivers to not cancel dialtone upon
146 ; receipt of a particular pattern. The most commonly used example is
147 ; of course '9' like this:
151 ; so that dialtone remains even after dialing a 9.
155 ; Sample entries for extensions.conf
158 [dundi-e164-canonical]
160 ; List canonical entries here
162 ;exten => 12564286000,1,Macro(std-exten,6000,IAX2/foo)
163 ;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7})
165 [dundi-e164-customers]
167 ; If you are an ITSP or Reseller, list your customers here.
169 ;exten => _12564286000,1,Dial(SIP/customer1)
170 ;exten => _12564286001,1,Dial(IAX2/customer2)
172 [dundi-e164-via-pstn]
174 ; If you are freely delivering calls to the PSTN, list them here
176 ;exten => _1256428XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Expose all of 256-428
177 ;exten => _1256325XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Ditto for 256-325
181 ; Context to put your dundi IAX2 or SIP user in for
184 include => dundi-e164-canonical
185 include => dundi-e164-customers
186 include => dundi-e164-via-pstn
190 ; Just a wrapper for the switch
196 ; Locally to lookup, try looking for a local E.164 solution
197 ; then try DUNDi if we don't have one.
199 include => dundi-e164-local
200 include => dundi-e164-switch
202 ; DUNDi can also be implemented as a Macro instead of using
203 ; the Local channel driver.
207 ; ARG1 is the extension to Dial
209 ; Extension "s" is not a wildcard extension that matches "anything".
210 ; In macros, it is the start extension. In most other cases,
211 ; you have to goto "s" to execute that extension.
213 ; For wildcard matches, see above - all pattern matches start with
215 exten => s,1,Goto(${ARG1},1)
216 include => dundi-e164-lookup
219 ; Here are the entries you need to participate in the IAXTEL
220 ; call routing system. Most IAXTEL numbers begin with 1-700, but
221 ; there are exceptions. For more information, and to sign
222 ; up, please go to www.gnophone.com or www.iaxtel.com
225 exten => _91700XXXXXXX,1,Dial(IAX2/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel)
228 ; The SWITCH statement permits a server to share the dialplain with
229 ; another server. Use with care: Reciprocal switch statements are not
230 ; allowed (e.g. both A -> B and B -> A), and the switched server needs
231 ; to be on-line or else dialing can be severly delayed.
234 ;switch => IAX2/user:[key]@myserver/mycontext
238 ; International long distance through trunk
240 exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
241 exten => _9011.,n,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
245 ; Long distance context accessed through trunk
247 exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})
248 exten => _91NXXNXXXXXX,n,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
252 ; Local seven-digit dialing accessed through trunk interface
254 exten => _9NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
258 ; Long distance context accessed through trunk interface
260 exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
261 exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
262 exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
263 exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
267 ; Master context for international long distance
270 include => longdistance
275 ; Master context for long distance
283 ; Master context for local, toll-free, and iaxtel calls only
287 include => trunklocal
289 include => trunktollfree
290 include => iaxprovider
292 ;Include parkedcalls (or the context you define in features conf)
293 ;to enable call parking.
294 include => parkedcalls
296 ; You can use an alternative switch type as well, to resolve
297 ; extensions that are not known here, for example with remote
298 ; IAX switching you transparently get access to the remote
301 ; switch => IAX2/user:password@bigserver/local
303 ; An "lswitch" is like a switch but is literal, in that
304 ; variable substitution is not performed at load time
305 ; but is passed to the switch directly (presumably to
306 ; be substituted in the switch routine itself)
308 ; lswitch => Loopback/12${EXTEN}@othercontext
310 ; An "eswitch" is like a switch but the evaluation of
311 ; variable substitution is performed at runtime before
312 ; being passed to the switch routine.
314 ; eswitch => IAX2/context@${CURSERVER}
318 ; Standard extension macro:
319 ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
320 ; ${ARG2} - Device(s) to ring
322 exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
323 exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
325 exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce
326 exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start
328 exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce
329 exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
331 exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
333 exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain
335 [macro-stdPrivacyexten];
337 ; Standard extension macro:
338 ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
339 ; ${ARG2} - Device(s) to ring
340 ; ${ARG3} - Optional DONTCALL context name to jump to (assumes the s,1 extension-priority)
341 ; ${ARG4} - Optional TORTURE context name to jump to (assumes the s,1 extension-priority)`
343 exten => s,1,Dial(${ARG2},20|p) ; Ring the interface, 20 seconds maximum, call screening
344 ; option (or use P for databased call screening)
345 exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
347 exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce
348 exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start
350 exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce
351 exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
353 exten => s-DONTCALL,1,Goto(${ARG3},s,1) ; Callee chose to send this call to a polite "Don't call again" script.
355 exten => s-TORTURE,1,Goto(${ARG4},s,1) ; Callee chose to send this call to a telemarketer torture script.
357 exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
359 exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain
365 ; Check to see if SIP device is in use and DO NOT PAGE if they are
367 ; ${ARG1} - Device to page
369 exten => s,1,ChanIsAvail(${ARG1}|js) ; j is for Jump and s is for ANY call
370 exten => s,n,GoToIf([${AVAILSTATUS} = "1"]?autoanswer:fail)
371 exten => s,n(autoanswer),Set(_ALERT_INFO="RA") ; This is for the PolyComs
372 exten => s,n,SIPAddHeader(Call-Info: Answer-After=0) ; This is for the Grandstream, Snoms, and Others
373 exten => s,n,NoOp() ; Add others here and Post on the Wiki!!!!
374 exten => s,n,Dial(${ARG1}||)
375 exten => s,n(fail),Hangup
380 ; We start with what to do when a call first comes in.
382 exten => s,1,Wait(1) ; Wait a second, just for fun
383 exten => s,n,Answer ; Answer the line
384 exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
385 exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
386 exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message
387 exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions
388 exten => s,n,WaitExten ; Wait for an extension to be dialed.
390 exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
391 exten => 2,n,Goto(s,instruct)
393 exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
394 exten => 3,n,Goto(s,restart) ; Start with the congratulations
396 exten => 1000,1,Goto(default,s,1)
398 ; We also create an example user, 1234, who is on the console and has
401 exten => 1234,1,Playback(transfer,skip) ; "Please hold while..."
402 ; (but skip if channel is not up)
403 exten => 1234,n,Macro(stdexten,1234,${CONSOLE})
405 exten => 1235,1,Voicemail(1234,u) ; Right to voicemail
407 exten => 1236,1,Dial(Console/dsp) ; Ring forever
408 exten => 1236,n,Voicemail(1234,b) ; Unless busy
411 ; # for when they're done with the demo
413 exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
414 exten => #,n,Hangup ; Hang them up.
417 ; A timeout and "invalid extension rule"
419 exten => t,1,Goto(#,1) ; If they take too long, give up
420 exten => i,1,Playback(invalid) ; "That's not valid, try again"
423 ; Create an extension, 500, for dialing the
426 exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
427 exten => 500,n,Dial(IAX2/guest@misery.digium.com/s@default) ; Call the Asterisk demo
428 exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site
429 exten => 500,n,Goto(s,6) ; Return to the start over message.
432 ; Create an extension, 600, for evaulating echo latency.
434 exten => 600,1,Playback(demo-echotest) ; Let them know what's going on
435 exten => 600,n,Echo ; Do the echo test
436 exten => 600,n,Playback(demo-echodone) ; Let them know it's over
437 exten => 600,n,Goto(s,6) ; Start over
440 ; You can use the Macro Page to intercom a individual user
441 exten => 76245,1,Macro(page,SIP/Grandstream1)
442 ; or if your peernames are the same as extensions
443 exten => _7XXX,1,Macro(page,SIP/${EXTEN})
446 ; System Wide Page at extension 7999
448 exten => 7999,1,Set(TIMEOUT(absolute)=60)
449 exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n|d)
451 ; Give voicemail at extension 8500
453 exten => 8500,1,VoicemailMain
454 exten => 8500,n,Goto(s,6)
456 ; Here's what a phone entry would look like (IXJ for example)
458 ;exten => 1265,1,Dial(Phone/phone0,15)
459 ;exten => 1265,n,Goto(s,5)
462 ; The page context calls up the page macro that sets variables needed for auto-answer
463 ; It is in is own context to make calling it from the Page() application as simple as
464 ; Local/{peername}@page
467 exten => _X.,1,Macro(page,SIP/${EXTEN})
471 ; Example "main menu" context with submenu
474 ;exten => s,n,Background(thanks) ; "Thanks for calling press 1 for sales, 2 for support, ..."
475 ;exten => s,n,WaitExten
476 ;exten => 1,1,Goto(submenu,s,1)
481 ;exten => s,1,Ringing ; Make them comfortable with 2 seconds of ringback
483 ;exten => s,n,Background(submenuopts) ; "Thanks for calling the sales department. Press 1 for steve, 2 for..."
484 ;exten => s,n,WaitExten
485 ;exten => 1,1,Goto(default,steve,1)
486 ;exten => 2,1,Goto(default,mark,2)
490 ; By default we include the demo. In a production system, you
491 ; probably don't want to have the demo there.
496 ; An extension like the one below can be used for FWD, Nikotel, sipgate etc.
497 ; Note that you must have a [sipprovider] section in sip.conf
499 ;exten => _41X.,1,Dial(SIP/${EXTEN:2}@sipprovider,,r)
501 ; Real extensions would go here. Generally you want real extensions to be
502 ; 4 or 5 digits long (although there is no such requirement) and start with a
503 ; single digit that is fairly large (like 6 or 7) so that you have plenty of
504 ; room to overlap extensions and menu options without conflict. You can alias
505 ; them with names, too, and use global variables
507 ;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1,Joe Schmoe ; Channel hints for presence
508 ;exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer
509 ;exten => 6245,n(dial),Dial(${HINT},20,rtT) ; Use hint as listed
510 ;exten => 6245,n,Voicemail(6245,u) ; Voicemail (unavailable)
511 ;exten => 6245,s+1,Hangup ; s+1, same as n
512 ;exten => 6245,dial+101,Voicemail(6245,b) ; Voicemail (busy)
513 ;exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit
514 ;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
515 ;exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
516 ;exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org) ;Dial via jingle using asterisk as the transport and calling mogorman.
517 ;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK}
519 ;exten => 6275,1,Macro(stdexten,6275,${MARK}) ; assuming ${MARK} is something like Zap/2
520 ;exten => mark,1,Goto(6275|1) ; alias mark to 6275
521 ;exten => 6536,1,Macro(stdexten,6236,${WIL}) ; Ditto for wil
522 ;exten => wil,1,Goto(6236|1)
524 ;If you want to subscribe to the status of a parking space, this is
525 ;how you do it. Subscribe to extension 6600 in sip, and you will see
526 ;the status of the first parking lot with this extensions' help
527 ;exten => 6600,hint,park:701@parkedcalls
528 ;exten => 6600,1,noop
530 ; Some other handy things are an extension for checking voicemail via
533 ;exten => 8500,1,VoicemailMain
534 ;exten => 8500,n,Hangup
536 ; Or a conference room (you'll need to edit meetme.conf to enable this room)
538 ;exten => 8600,1,Meetme(1234)
540 ; Or playing an announcement to the called party, as soon it answers
542 ;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
544 ; For more information on applications, just type "show applications" at your
545 ; friendly Asterisk CLI prompt.
547 ; 'show application <command>' will show details of how you
548 ; use that particular application in this file, the dial plan.
549 ; 'show functions" will list all dialplan functions
550 ; 'show function <COMMAND>' will show you more information about
551 ; one function. Remember that function names are UPPER CASE.