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.
7 ; This configuration file is reloaded
8 ; - With the "dialplan reload" command in the CLI
9 ; - With the "reload" command (that reloads everything) in the CLI
12 ; The "General" category is for certain variables.
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
24 ; if static=yes and writeprotect=no, you can save dialplan by
25 ; CLI command "dialplan save" too
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).
41 ; If extenpatternmatchnew is set (true, yes, etc), then a new algorithm that uses
42 ; a Trie to find the best matching pattern is used. In dialplans
43 ; with more than about 20-40 extensions in a single context, this
44 ; new algorithm can provide a noticeable speedup.
45 ; With 50 extensions, the speedup is 1.32x
46 ; with 88 extensions, the speedup is 2.23x
47 ; with 138 extensions, the speedup is 3.44x
48 ; with 238 extensions, the speedup is 5.8x
49 ; with 438 extensions, the speedup is 10.4x
50 ; With 1000 extensions, the speedup is ~25x
51 ; with 10,000 extensions, the speedup is 374x
52 ; Basically, the new algorithm provides a flat response
53 ; time, no matter the number of extensions.
55 ; By default, the old pattern matcher is used.
57 ; ****This is a new feature! *********************
58 ; The new pattern matcher is for the brave, the bold, and
59 ; the desperate. If you have large dialplans (more than about 50 extensions
60 ; in a context), and/or high call volume, you might consider setting
61 ; this value to "yes" !!
62 ; Please, if you try this out, and are forced to return to the
63 ; old pattern matcher, please report your reasons in a bug report
64 ; on https://issues.asterisk.org. We have made good progress in providing
65 ; something compatible with the old matcher; help us finish the job!
67 ; This value can be switched at runtime using the cli command "dialplan set extenpatternmatchnew true"
68 ; or "dialplan set extenpatternmatchnew false", so you can experiment to your hearts content.
70 ;extenpatternmatchnew=no
72 ; If clearglobalvars is set, global variables will be cleared
73 ; and reparsed on a dialplan reload, or Asterisk reload.
75 ; If clearglobalvars is not set, then global variables will persist
76 ; through reloads, and even if deleted from the extensions.conf or
77 ; one of its included files, will remain set to the previous value.
79 ; NOTE: A complication sets in, if you put your global variables into
80 ; the AEL file, instead of the extensions.conf file. With clearglobalvars
81 ; set, a "reload" will often leave the globals vars cleared, because it
82 ; is not unusual to have extensions.conf (which will have no globals)
83 ; load after the extensions.ael file (where the global vars are stored).
84 ; So, with "reload" in this particular situation, first the AEL file will
85 ; clear and then set all the global vars, then, later, when the extensions.conf
86 ; file is loaded, the global vars are all cleared, and then not set, because
87 ; they are not stored in the extensions.conf file.
91 ; If priorityjumping is set to 'yes', then applications that support
92 ; 'jumping' to a different priority based on the result of their operations
93 ; will do so (this is backwards compatible behavior with pre-1.2 releases
94 ; of Asterisk). Individual applications can also be requested to do this
95 ; by passing a 'j' option in their arguments.
99 ; User context is where entries from users.conf are registered. The
100 ; default value is 'default'
102 ;userscontext=default
104 ; You can include other config files, use the #include command
105 ; (without the ';'). Note that this is different from the "include" command
106 ; that includes contexts within other contexts. The #include command works
107 ; in all asterisk configuration files.
108 ;#include "filename.conf"
109 ;#include <filename.conf>
110 ;#include filename.conf
112 ; You can execute a program or script that produces config files, and they
113 ; will be inserted where you insert the #exec command. The #exec command
114 ; works on all asterisk configuration files. However, you will need to
115 ; activate them within asterisk.conf with the "execincludes" option. They
116 ; are otherwise considered a security risk.
117 ;#exec /opt/bin/build-extra-contexts.sh
118 ;#exec /opt/bin/build-extra-contexts.sh --foo="bar"
119 ;#exec </opt/bin/build-extra-contexts.sh --foo="bar">
120 ;#exec "/opt/bin/build-extra-contexts.sh --foo=\"bar\""
123 ; The "Globals" category contains global variables that can be referenced
124 ; in the dialplan with the GLOBAL dialplan function:
125 ; ${GLOBAL(VARIABLE)}
126 ; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
127 ; Unix/Linux environmental variables can be reached with the ENV dialplan
128 ; function: ${ENV(VARIABLE)}
131 CONSOLE=Console/dsp ; Console interface for demo
133 ;CONSOLE=Phone/phone0
134 IAXINFO=guest ; IAXtel username/password
135 ;IAXINFO=myuser:mypass
136 TRUNK=DAHDI/G2 ; Trunk interface
138 ; Note the 'G2' in the TRUNK variable above. It specifies which group (defined
139 ; in chan_dahdi.conf) to dial, i.e. group 2, and how to choose a channel to use
140 ; in the specified group. The four possible options are:
142 ; g: select the lowest-numbered non-busy DAHDI channel
143 ; (aka. ascending sequential hunt group).
144 ; G: select the highest-numbered non-busy DAHDI channel
145 ; (aka. descending sequential hunt group).
146 ; r: use a round-robin search, starting at the next highest channel than last
147 ; time (aka. ascending rotary hunt group).
148 ; R: use a round-robin search, starting at the next lowest channel than last
149 ; time (aka. descending rotary hunt group).
151 TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
152 ;TRUNK=IAX2/user:pass@provider
154 ;FREENUMDOMAIN=mydomain.com ; domain to send on outbound
155 ; freenum calls (uses outbound-freenum
159 ; WARNING WARNING WARNING WARNING
160 ; If you load any other extension configuration engine, such as pbx_ael.so,
161 ; your global variables may be overridden by that file. Please take care to
162 ; use only one location to set global variables, and you will likely save
163 ; yourself a ton of grief.
164 ; WARNING WARNING WARNING WARNING
166 ; Any category other than "General" and "Globals" represent
167 ; extension contexts, which are collections of extensions.
169 ; Extension names may be numbers, letters, or combinations
170 ; thereof. If an extension name is prefixed by a '_'
171 ; character, it is interpreted as a pattern rather than a
172 ; literal. In patterns, some characters have special meanings:
174 ; X - any digit from 0-9
175 ; Z - any digit from 1-9
176 ; N - any digit from 2-9
177 ; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
178 ; . - wildcard, matches anything remaining (e.g. _9011. matches
179 ; anything starting with 9011 excluding 9011 itself)
180 ; ! - wildcard, causes the matching process to complete as soon as
181 ; it can unambiguously determine that no other matches are possible
183 ; For example, the extension _NXXXXXX would match normal 7 digit dialings,
184 ; while _1NXXNXXXXXX would represent an area code plus phone number
187 ; Each step of an extension is ordered by priority, which must always start
188 ; with 1 to be considered a valid extension. The priority "next" or "n" means
189 ; the previous priority plus one, regardless of whether the previous priority
190 ; was associated with the current extension or not. The priority "same" or "s"
191 ; means the same as the previously specified priority, again regardless of
192 ; whether the previous entry was for the same extension. Priorities may be
193 ; immediately followed by a plus sign and another integer to add that amount
194 ; (most useful with 's' or 'n'). Priorities may then also have an alias, or
195 ; label, in parentheses after their name which can be used in goto situations.
197 ; Contexts contain several lines, one for each step of each extension. One may
198 ; include another context in the current one as well, optionally with a date
199 ; and time. Included contexts are included in the order they are listed.
200 ; Switches may also be included within a context. The order of matching within
201 ; a context is always exact extensions, pattern match extensions, includes, and
202 ; switches. Includes are always processed depth-first. So for example, if you
203 ; would like a switch "A" to match before context "B", simply put switch "A" in
204 ; an included context "C", where "C" is included in your original context
208 ;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
210 ; Timing list for includes is
212 ; <time range>,<days of week>,<days of month>,<months>[,<timezone>]
214 ; Note that ranges may be specified to wrap around the ends. Also, minutes are
215 ; fine-grained only down to the closest even minute.
217 ;include => daytime,9:00-17:00,mon-fri,*,*
218 ;include => weekend,*,sat-sun,*,*
219 ;include => weeknights,17:02-8:58,mon-fri,*,*
221 ; ignorepat can be used to instruct drivers to not cancel dialtone upon receipt
222 ; of a particular pattern. The most commonly used example is of course '9'
227 ; so that dialtone remains even after dialing a 9. Please note that ignorepat
228 ; only works with channels which receive dialtone from the PBX, such as DAHDI,
229 ; Phone, and VPB. Other channels, such as SIP and MGCP, which generate their
230 ; own dialtone and converse with the PBX only after a number is complete, are
231 ; generally unaffected by ignorepat (unless DISA or another method is used to
232 ; generate a dialtone after answering the channel).
236 ; Sample entries for extensions.conf
239 [dundi-e164-canonical]
242 ; List canonical entries here
244 ;exten => 12564286000,1,Gosub(6000,stdexten(IAX2/foo))
245 ;exten => 12564286000,n,Goto(default,s,1) ; exited Voicemail
246 ;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7})
248 [dundi-e164-customers]
250 ; If you are an ITSP or Reseller, list your customers here.
252 ;exten => _12564286000,1,Dial(SIP/customer1)
253 ;exten => _12564286001,1,Dial(IAX2/customer2)
255 [dundi-e164-via-pstn]
257 ; If you are freely delivering calls to the PSTN, list them here
259 ;exten => _1256428XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Expose all of 256-428
260 ;exten => _1256325XXXX,1,Dial(DAHDI/G2/${EXTEN:7}) ; Ditto for 256-325
264 ; Context to put your dundi IAX2 or SIP user in for
267 include => dundi-e164-canonical
268 include => dundi-e164-customers
269 include => dundi-e164-via-pstn
273 ; Just a wrapper for the switch
279 ; Locally to lookup, try looking for a local E.164 solution
280 ; then try DUNDi if we don't have one.
282 include => dundi-e164-local
283 include => dundi-e164-switch
285 ; DUNDi can also be implemented as a Macro instead of using
286 ; the Local channel driver.
290 ; ARG1 is the extension to Dial
292 ; Extension "s" is not a wildcard extension that matches "anything".
293 ; In macros, it is the start extension. In most other cases,
294 ; you have to goto "s" to execute that extension.
296 ; For wildcard matches, see above - all pattern matches start with
298 exten => s,1,Goto(${ARG1},1)
299 include => dundi-e164-lookup
302 ; Here are the entries you need to participate in the IAXTEL
303 ; call routing system. Most IAXTEL numbers begin with 1-700, but
304 ; there are exceptions. For more information, and to sign
305 ; up, please go to www.gnophone.com or www.iaxtel.com
308 exten => _91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}@iaxtel.com/${EXTEN:1}@iaxtel)
311 ; The SWITCH statement permits a server to share the dialplan with
312 ; another server. Use with care: Reciprocal switch statements are not
313 ; allowed (e.g. both A -> B and B -> A), and the switched server needs
314 ; to be on-line or else dialing can be severly delayed.
317 ;switch => IAX2/user:[key]@myserver/mycontext
321 ; International long distance through trunk
323 exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
324 exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
328 ; Long distance context accessed through trunk
330 exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})
331 exten => _91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
335 ; Local seven-digit dialing accessed through trunk interface
337 exten => _9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
341 ; Long distance context accessed through trunk interface
343 exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
344 exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
345 exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
346 exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
350 ; Master context for international long distance
353 include => longdistance
358 ; Master context for long distance
366 ; Master context for local, toll-free, and iaxtel calls only
370 include => trunklocal
372 include => trunktollfree
373 include => iaxprovider
375 ;Include parkedcalls (or the context you define in features conf)
376 ;to enable call parking.
377 include => parkedcalls
379 ; You can use an alternative switch type as well, to resolve
380 ; extensions that are not known here, for example with remote
381 ; IAX switching you transparently get access to the remote
384 ; switch => IAX2/user:password@bigserver/local
386 ; An "lswitch" is like a switch but is literal, in that
387 ; variable substitution is not performed at load time
388 ; but is passed to the switch directly (presumably to
389 ; be substituted in the switch routine itself)
391 ; lswitch => Loopback/12${EXTEN}@othercontext
393 ; An "eswitch" is like a switch but the evaluation of
394 ; variable substitution is performed at runtime before
395 ; being passed to the switch routine.
397 ; eswitch => IAX2/context@${CURSERVER}
399 ; The following two contexts are a template to enable the ability to dial
400 ; ISN numbers. For more information about what an ISN number is, please see
401 ; http://www.freenum.org.
403 ; This is the dialing hook. use:
404 ; include => outbound-freenum
407 ; We'll add more digits as needed. The purpose is to dial things
408 ; like extension numbers at domains (ITAD number) so we're matching
409 ; on lengths of 1 through 6 prior to the separator (the asterisk [*])
411 exten => _X*X!,1,Goto(outbound-freenum2,${EXTEN},1)
412 exten => _XX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
413 exten => _XXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
414 exten => _XXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
415 exten => _XXXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
416 exten => _XXXXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
419 ; This is the handler which performs the dialing logic. It is called
420 ; from the [outbound-freenum] context
422 exten => _X!,1,Verbose(2,Performing ISN lookup for ${EXTEN})
423 same => n,Set(SUFFIX=${CUT(EXTEN,*,2-)}) ; make sure the suffix is all digits as well
424 same => n,GotoIf($["${FILTER(0-9,${SUFFIX})}" != "${SUFFIX}"]?fn-CONGESTION,1)
425 ; filter out bad characters per the README-SERIOUSLY.best-practices.txt document
426 same => n,Set(TIMEOUT(absolute)=10800)
427 same => n,Set(isnresult=${ENUMLOOKUP(${EXTEN},sip,,1,freenum.org)}) ; perform our lookup with freenum.org
428 same => n,GotoIf($["${isnresult}" != ""]?from)
429 same => n,Set(DIALSTATUS=CONGESTION)
430 same => n,Goto(fn-CONGESTION,1)
431 same => n(from),Set(SIPFROMUSER=${CALLERID(num)})
432 same => n,GotoIf($["${GLOBAL(FREENUMDOMAIN)}" = ""]?dial) ; check if we set the FREENUMDOMAIN global variable in [global]
433 same => n,Set(SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)}) ; if we did set it, then we'll use it for our outbound dialing domain
434 same => n(dial),Dial(SIP/${isnresult},40)
435 same => n,Goto(fn-${DIALSTATUS},1)
437 exten => fn-BUSY,1,Busy()
439 exten => _f[n]-.,1,NoOp(ISN: ${DIALSTATUS})
440 same => n,Congestion()
444 ; Standard trunk dial macro (hangs up on a dialstatus that should
446 ; ${ARG1} - What to dial
448 exten => s,1,Dial(${ARG1})
449 exten => s,n,Goto(s-${DIALSTATUS},1)
450 exten => s-NOANSWER,1,Hangup
451 exten => s-BUSY,1,Hangup
456 ; Standard extension subroutine:
457 ; ${EXTEN} - Extension
458 ; ${ARG1} - Device(s) to ring
459 ; ${ARG2} - Optional context in Voicemail (if empty, then "default")
461 ; Note that the current version will drop through to the next priority in the
462 ; case of their pressing '#'. This gives more flexibility in what do to next:
463 ; you can prompt for a new extension, or drop the call, or send them to a
464 ; general delivery mailbox, or...
466 ; The use of the LOCAL() function is purely for convenience. Any variable
467 ; initially declared as LOCAL() will disappear when the innermost Gosub context
468 ; in which it was declared returns. Note also that you can declare a LOCAL()
469 ; variable on top of an existing variable, and its value will revert to its
470 ; previous value (before being declared as LOCAL()) upon Return.
472 exten => _X.,50000(stdexten),NoOp(Start stdexten)
473 exten => _X.,n,Set(LOCAL(ext)=${EXTEN})
474 exten => _X.,n,Set(LOCAL(dev)=${ARG1})
475 exten => _X.,n,Set(LOCAL(cntx)=${ARG2})
477 exten => _X.,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
478 exten => _X.,n,Dial(${dev},20) ; Ring the interface, 20 seconds maximum
479 exten => _X.,n,Goto(stdexten-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
481 exten => stdexten-NOANSWER,1,Voicemail(${mbx},u) ; If unavailable, send to voicemail w/ unavail announce
482 exten => stdexten-NOANSWER,n,NoOp(Finish stdexten NOANSWER)
483 exten => stdexten-NOANSWER,n,Return() ; If they press #, return to start
485 exten => stdexten-BUSY,1,Voicemail(${mbx},b)
486 ; If busy, send to voicemail w/ busy announce
487 exten => stdexten-BUSY,n,NoOp(Finish stdexten BUSY)
488 exten => stdexten-BUSY,n,Return() ; If they press #, return to start
490 exten => _stde[x]te[n]-.,1,Goto(stdexten-NOANSWER,1) ; Treat anything else as no answer
492 exten => a,1,VoicemailMain(${mbx}) ; If they press *, send the user into VoicemailMain
493 exten => a,n,Return()
497 ; Standard extension subroutine:
498 ; ${ARG1} - Extension
499 ; ${ARG2} - Device(s) to ring
500 ; ${ARG3} - Optional DONTCALL context name to jump to (assumes the s,1 extension-priority)
501 ; ${ARG4} - Optional TORTURE context name to jump to (assumes the s,1 extension-priority)`
502 ; ${ARG5} - Context in voicemail (if empty, then "default")
504 ; See above note in stdexten about priority handling on exit.
506 exten => _X.,60000(stdPrivacyexten),NoOp(Start stdPrivacyexten)
507 exten => _X.,n,Set(LOCAL(ext)=${ARG1})
508 exten => _X.,n,Set(LOCAL(dev)=${ARG2})
509 exten => _X.,n,Set(LOCAL(dontcntx)=${ARG3})
510 exten => _X.,n,Set(LOCAL(tortcntx)=${ARG4})
511 exten => _X.,n,Set(LOCAL(cntx)=${ARG5})
513 exten => _X.,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
514 exten => _X.,n,Dial(${dev},20,p) ; Ring the interface, 20 seconds maximum, call screening
515 ; option (or use P for databased call _X.creening)
516 exten => _X.,n,Goto(stdexten-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
518 exten => stdexten-NOANSWER,1,Voicemail(${mbx},u) ; If unavailable, send to voicemail w/ unavail announce
519 exten => stdexten-NOANSWER,n,NoOp(Finish stdPrivacyexten NOANSWER)
520 exten => stdexten-NOANSWER,n,Return() ; If they press #, return to start
522 exten => stdexten-BUSY,1,Voicemail(${mbx},b) ; If busy, send to voicemail w/ busy announce
523 exten => stdexten-BUSY,n,NoOp(Finish stdPrivacyexten BUSY)
524 exten => stdexten-BUSY,n,Return() ; If they press #, return to start
526 exten => stdexten-DONTCALL,1,Goto(${dontcntx},s,1) ; Callee chose to send this call to a polite "Don't call again" script.
528 exten => stdexten-TORTURE,1,Goto(${tortcntx},s,1) ; Callee chose to send this call to a telemarketer torture script.
530 exten => _stde[x]te[n]-.,1,Goto(stdexten-NOANSWER,1) ; Treat anything else as no answer
532 exten => a,1,VoicemailMain(${mbx}) ; If they press *, send the user into VoicemailMain
539 ; Check to see if SIP device is in use and DO NOT PAGE if they are
541 ; ${ARG1} - Device to page
543 exten => s,1,ChanIsAvail(${ARG1},s) ; s is for ANY call
544 exten => s,n,GoToIf([${AVAILSTATUS} = "1"]?autoanswer:fail)
545 exten => s,n(autoanswer),Set(_ALERT_INFO="RA") ; This is for the PolyComs
546 exten => s,n,SIPAddHeader(Call-Info: Answer-After=0) ; This is for the Grandstream, Snoms, and Others
547 exten => s,n,NoOp() ; Add others here and Post on the Wiki!!!!
548 exten => s,n,Dial(${ARG1})
549 exten => s,n(fail),Hangup
555 ; We start with what to do when a call first comes in.
557 exten => s,1,Wait(1) ; Wait a second, just for fun
558 exten => s,n,Answer ; Answer the line
559 exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
560 exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
561 exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message
562 exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions
563 exten => s,n,WaitExten ; Wait for an extension to be dialed.
565 exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
566 exten => 2,n,Goto(s,instruct)
568 exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
569 exten => 3,n,Goto(s,restart) ; Start with the congratulations
571 exten => 1000,1,Goto(default,s,1)
573 ; We also create an example user, 1234, who is on the console and has
576 exten => 1234,1,Playback(transfer,skip) ; "Please hold while..."
577 ; (but skip if channel is not up)
578 exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
579 exten => 1234,n,Goto(default,s,1) ; exited Voicemail
581 exten => 1235,1,Voicemail(1234,u) ; Right to voicemail
583 exten => 1236,1,Dial(Console/dsp) ; Ring forever
584 exten => 1236,n,Voicemail(1234,b) ; Unless busy
587 ; # for when they're done with the demo
589 exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
590 exten => #,n,Hangup ; Hang them up.
593 ; A timeout and "invalid extension rule"
595 exten => t,1,Goto(#,1) ; If they take too long, give up
596 exten => i,1,Playback(invalid) ; "That's not valid, try again"
599 ; Create an extension, 500, for dialing the
602 exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
603 exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo
604 exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site
605 exten => 500,n,Goto(s,6) ; Return to the start over message.
608 ; Create an extension, 600, for evaluating echo latency.
610 exten => 600,1,Playback(demo-echotest) ; Let them know what's going on
611 exten => 600,n,Echo ; Do the echo test
612 exten => 600,n,Playback(demo-echodone) ; Let them know it's over
613 exten => 600,n,Goto(s,6) ; Start over
616 ; You can use the Macro Page to intercom a individual user
617 exten => 76245,1,Macro(page,SIP/Grandstream1)
618 ; or if your peernames are the same as extensions
619 exten => _7XXX,1,Macro(page,SIP/${EXTEN})
622 ; System Wide Page at extension 7999
624 exten => 7999,1,Set(TIMEOUT(absolute)=60)
625 exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n,d)
627 ; Give voicemail at extension 8500
629 exten => 8500,1,VoicemailMain
630 exten => 8500,n,Goto(s,6)
632 ; Here's what a phone entry would look like (IXJ for example)
634 ;exten => 1265,1,Dial(Phone/phone0,15)
635 ;exten => 1265,n,Goto(s,5)
638 ; The page context calls up the page macro that sets variables needed for auto-answer
639 ; It is in is own context to make calling it from the Page() application as simple as
640 ; Local/{peername}@page
643 exten => _X.,1,Macro(page,SIP/${EXTEN})
647 ; Example "main menu" context with submenu
650 ;exten => s,n,Background(thanks) ; "Thanks for calling press 1 for sales, 2 for support, ..."
651 ;exten => s,n,WaitExten
652 ;exten => 1,1,Goto(submenu,s,1)
657 ;exten => s,1,Ringing ; Make them comfortable with 2 seconds of ringback
659 ;exten => s,n,Background(submenuopts) ; "Thanks for calling the sales department. Press 1 for steve, 2 for..."
660 ;exten => s,n,WaitExten
661 ;exten => 1,1,Goto(default,steve,1)
662 ;exten => 2,1,Goto(default,mark,2)
666 ; By default we include the demo. In a production system, you
667 ; probably don't want to have the demo there.
672 ; An extension like the one below can be used for FWD, Nikotel, sipgate etc.
673 ; Note that you must have a [sipprovider] section in sip.conf
675 ;exten => _41X.,1,Dial(SIP/${FILTER(0-9,${EXTEN:2})}@sipprovider,,r)
677 ; Real extensions would go here. Generally you want real extensions to be
678 ; 4 or 5 digits long (although there is no such requirement) and start with a
679 ; single digit that is fairly large (like 6 or 7) so that you have plenty of
680 ; room to overlap extensions and menu options without conflict. You can alias
681 ; them with names, too, and use global variables
683 ;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1(Joe Schmoe) ; Channel hints for presence
684 ;exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer
685 ;exten => 6245,n(dial),Dial(${HINT},20,rtT) ; Use hint as listed
686 ;exten => 6245,n,Voicemail(6245,u) ; Voicemail (unavailable)
687 ;exten => 6245,s+1,Hangup ; s+1, same as n
688 ;exten => 6245,dial+101,Voicemail(6245,b) ; Voicemail (busy)
689 ;exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit
690 ;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
691 ;exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
692 ;exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org) ;Dial via jingle using asterisk as the transport and calling mogorman.
693 ;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK}
695 ;exten => 6275,1,Gosub(${EXTEN},stdexten(${MARK}))
696 ; assuming ${MARK} is something like DAHDI/2
697 ;exten => 6275,n,Goto(default,s,1) ; exited Voicemail
698 ;exten => mark,1,Goto(6275,1) ; alias mark to 6275
699 ;exten => 6536,1,Gosub(${EXTEN},stdexten(${WIL}))
701 ;exten => 6536,n,Goto(default,s,1) ; exited Voicemail
702 ;exten => wil,1,Goto(6236,1)
704 ;If you want to subscribe to the status of a parking space, this is
705 ;how you do it. Subscribe to extension 6600 in sip, and you will see
706 ;the status of the first parking lot with this extensions' help
707 ;exten => 6600,hint,park:701@parkedcalls
708 ;exten => 6600,1,noop
710 ; Some other handy things are an extension for checking voicemail via
713 ;exten => 8500,1,VoicemailMain
714 ;exten => 8500,n,Hangup
716 ; Or a conference room (you'll need to edit meetme.conf to enable this room)
718 ;exten => 8600,1,Meetme(1234)
720 ; Or playing an announcement to the called party, as soon it answers
722 ;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
725 ; example of a compartmentalized company called "acme"
727 ; this is the context that your incoming IAX/SIP trunk dumps you in...
729 ;exten => s,1,Wait(1)
730 ;exten => s,n,Answer()
731 ;exten => s,n(menu),Playback(acme/vm-brief-menu)
732 ;exten => s,n(exten),Background(vm-enter-num-to-call)
733 ;exten => s,n,WaitExten(5)
734 ;exten => s,n(goodbye),Playback(vm-goodbye)
735 ;exten => s,n(end),Hangup()
737 ;include => acme-extens
739 ;exten => i,1,Playback(vm-invalid)
740 ;exten => i,n,Goto(s,exten) ; optionally, transfer to operator
742 ;exten => t,1,Goto(s,goodbye)
744 ; this is the context our internal SIP hardphones use (see sip.conf)
747 ;exten => s,1,Answer()
748 ;exten => s,n(exten),Background(vm-enter-num-to-call)
749 ;exten => s,n,WaitExten(5)
750 ;exten => s,n(goodbye),Playback(vm-goodbye)
751 ;exten => s,n(end),Hangup()
755 ;include => trunklocal
757 ;include => acme-extens
759 ; you can test what your system sounds like to outside callers by dialing this
760 ;exten => 777,1,DISA(no-password,acme-incoming)
762 ; grouping of acme's extensions... never used directly, always included.
766 ;exten => 111,1,Gosub(111,stdexten(SIP/pete_1,acme))
767 ;exten => 111,n,Goto(s,exten)
769 ;exten => 112,1,Gosub(112,stdexten(SIP/nancy_1,acme))
770 ;exten => 112,n,Goto(s,end)
772 ; end of acme example
775 ; Time context: you can patch this in via the following.
779 ; exten => 777,1,Gosub(time)
780 ; exten => 777,n,Hangup()
785 ; Note: if you're geographically spread out, you can have SIP extensions
786 ; specify their own local timezone in sip.conf as:
790 ; context=acme-internal
791 ; callerid="Boise Ofc. <2083451111>"
793 ; ; use system-wide default timezone of MST7MDT
797 ; context=acme-internal
798 ; callerid="Lewiston Ofc. <2087431111>"
800 ; setvar=timezone=PST8PDT
802 ; "timezone" isn't a 'reserved' name in any way, and other places where
803 ; the timezone is significant (e.g. calls to "SayUnixTime()", etc) will
804 ; require modification as well. Note that voicemail.conf already has
805 ; a mechanism for timezones.
809 exten => _X.,30000(time),NoOp(Time: ${EXTEN} ${timezone})
810 exten => _X.,n,Wait(0.25)
811 exten => _X.,n,Answer()
812 ; the amount of delay is set for English; you may need to adjust this time
813 ; for other languages if there's no pause before the synchronizing beep.
814 exten => _X.,n,Set(FUTURETIME=$[${EPOCH} + 12])
815 exten => _X.,n,SayUnixTime(${FUTURETIME},Zulu,HNS)
816 exten => _X.,n,SayPhonetic(z)
817 ; use the timezone associated with the extension (sip only), or system-wide
818 ; default if one hasn't been set.
819 exten => _X.,n,SayUnixTime(${FUTURETIME},${timezone},HNS)
820 exten => _X.,n,Playback(spy-local)
821 exten => _X.,n,WaitUntil(${FUTURETIME})
822 exten => _X.,n,Playback(beep)
823 exten => _X.,n,Return()
826 ; ANI context: use in the same way as "time" above
830 exten => _X.,40000(ani),NoOp(ANI: ${EXTEN})
831 exten => _X.,n,Wait(0.25)
832 exten => _X.,n,Answer()
833 exten => _X.,n,Playback(vm-from)
834 exten => _X.,n,SayDigits(${CALLERID(ani)})
835 exten => _X.,n,Wait(1.25)
836 exten => _X.,n,SayDigits(${CALLERID(ani)}) ; playback again in case of missed digit
837 exten => _X.,n,Return()
839 ; For more information on applications, just type "core show applications" at your
840 ; friendly Asterisk CLI prompt.
842 ; "core show application <command>" will show details of how you
843 ; use that particular application in this file, the dial plan.
844 ; "core show functions" will list all dialplan functions
845 ; "core show function <COMMAND>" will show you more information about
846 ; one function. Remember that function names are UPPER CASE.