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 ; User context is where entries from users.conf are registered. The
92 ; default value is 'default'
96 ; You can include other config files, use the #include command
97 ; (without the ';'). Note that this is different from the "include" command
98 ; that includes contexts within other contexts. The #include command works
99 ; in all asterisk configuration files.
100 ;#include "filename.conf"
101 ;#include <filename.conf>
102 ;#include filename.conf
104 ; You can execute a program or script that produces config files, and they
105 ; will be inserted where you insert the #exec command. The #exec command
106 ; works on all asterisk configuration files. However, you will need to
107 ; activate them within asterisk.conf with the "execincludes" option. They
108 ; are otherwise considered a security risk.
109 ;#exec /opt/bin/build-extra-contexts.sh
110 ;#exec /opt/bin/build-extra-contexts.sh --foo="bar"
111 ;#exec </opt/bin/build-extra-contexts.sh --foo="bar">
112 ;#exec "/opt/bin/build-extra-contexts.sh --foo=\"bar\""
115 ; The "Globals" category contains global variables that can be referenced
116 ; in the dialplan with the GLOBAL dialplan function:
117 ; ${GLOBAL(VARIABLE)}
118 ; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
119 ; Unix/Linux environmental variables can be reached with the ENV dialplan
120 ; function: ${ENV(VARIABLE)}
126 ;CONSOLE=Console/dsp ; Console interface for demo
128 ;CONSOLE=Phone/phone0
129 ;IAXINFO=guest ; IAXtel username/password
130 ;IAXINFO=myuser:mypass
132 ;TRUNK=DAHDI/G2 ; Trunk interface
134 ; Note the 'G2' in the TRUNK variable above. It specifies which group (defined
135 ; in chan_dahdi.conf) to dial, i.e. group 2, and how to choose a channel to use
136 ; in the specified group. The four possible options are:
138 ; g: select the lowest-numbered non-busy DAHDI channel
139 ; (aka. ascending sequential hunt group).
140 ; G: select the highest-numbered non-busy DAHDI channel
141 ; (aka. descending sequential hunt group).
142 ; r: use a round-robin search, starting at the next highest channel than last
143 ; time (aka. ascending rotary hunt group).
144 ; R: use a round-robin search, starting at the next lowest channel than last
145 ; time (aka. descending rotary hunt group).
148 ; TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
149 ;TRUNK=IAX2/user:pass@provider
151 ;FREENUMDOMAIN=mydomain.com ; domain to send on outbound
152 ; freenum calls (uses outbound-freenum
155 ; AUF : inclusion des variables globales
157 #include "auf/extensions-globals.local"
160 ; WARNING WARNING WARNING WARNING
161 ; If you load any other extension configuration engine, such as pbx_ael.so,
162 ; your global variables may be overridden by that file. Please take care to
163 ; use only one location to set global variables, and you will likely save
164 ; yourself a ton of grief.
165 ; WARNING WARNING WARNING WARNING
167 ; Any category other than "General" and "Globals" represent
168 ; extension contexts, which are collections of extensions.
170 ; Extension names may be numbers, letters, or combinations
171 ; thereof. If an extension name is prefixed by a '_'
172 ; character, it is interpreted as a pattern rather than a
173 ; literal. In patterns, some characters have special meanings:
175 ; X - any digit from 0-9
176 ; Z - any digit from 1-9
177 ; N - any digit from 2-9
178 ; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
179 ; . - wildcard, matches anything remaining (e.g. _9011. matches
180 ; anything starting with 9011 excluding 9011 itself)
181 ; ! - wildcard, causes the matching process to complete as soon as
182 ; it can unambiguously determine that no other matches are possible
184 ; For example, the extension _NXXXXXX would match normal 7 digit dialings,
185 ; while _1NXXNXXXXXX would represent an area code plus phone number
188 ; Each step of an extension is ordered by priority, which must always start
189 ; with 1 to be considered a valid extension. The priority "next" or "n" means
190 ; the previous priority plus one, regardless of whether the previous priority
191 ; was associated with the current extension or not. The priority "same" or "s"
192 ; means the same as the previously specified priority, again regardless of
193 ; whether the previous entry was for the same extension. Priorities may be
194 ; immediately followed by a plus sign and another integer to add that amount
195 ; (most useful with 's' or 'n'). Priorities may then also have an alias, or
196 ; label, in parentheses after their name which can be used in goto situations.
198 ; Contexts contain several lines, one for each step of each extension. One may
199 ; include another context in the current one as well, optionally with a date
200 ; and time. Included contexts are included in the order they are listed.
201 ; Switches may also be included within a context. The order of matching within
202 ; a context is always exact extensions, pattern match extensions, includes, and
203 ; switches. Includes are always processed depth-first. So for example, if you
204 ; would like a switch "A" to match before context "B", simply put switch "A" in
205 ; an included context "C", where "C" is included in your original context
209 ;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
211 ; Timing list for includes is
213 ; <time range>,<days of week>,<days of month>,<months>[,<timezone>]
215 ; Note that ranges may be specified to wrap around the ends. Also, minutes are
216 ; fine-grained only down to the closest even minute.
218 ;include => daytime,9:00-17:00,mon-fri,*,*
219 ;include => weekend,*,sat-sun,*,*
220 ;include => weeknights,17:02-8:58,mon-fri,*,*
222 ; ignorepat can be used to instruct drivers to not cancel dialtone upon receipt
223 ; of a particular pattern. The most commonly used example is of course '9'
228 ; so that dialtone remains even after dialing a 9. Please note that ignorepat
229 ; only works with channels which receive dialtone from the PBX, such as DAHDI,
230 ; Phone, and VPB. Other channels, such as SIP and MGCP, which generate their
231 ; own dialtone and converse with the PBX only after a number is complete, are
232 ; generally unaffected by ignorepat (unless DISA or another method is used to
233 ; generate a dialtone after answering the channel).
238 ; pour l'AUF, rien dans le contexte par defaut
241 ; Macro pour appel AUF
242 ; appelle simultannément les canaux SIP et IAX, pendant 20s
243 ; si pas de réponse, occupé ou indisponible : boite vocale
244 ; ${ARG1} : prenom.com
245 ; exemple : exten => 221,1,Macro(AUFDial,thomas.noel)
246 exten => s,1,Set(CHANNEL(language)=fr)
247 ; exten => s,n,Dumpchan(10) ; décommenter cette ligne pour passer en mode "debug"
248 exten => s,n,Dial(IAX2/${ARG1}&SIP/${ARG1},20,tThHkKwW) ; on appelle sur SIP et IAX pendant 25 secondes,
249 exten => s,n,Goto(s-${DIALSTATUS},1) ; saut en fonction du status de fin de sonnerie
250 ; (parmis : NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
251 exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN}@AUF,u) ; Si pas de reponse : vers boite vocale avec message "indisponible"
252 exten => s-BUSY,1,Voicemail(${MACRO_EXTEN}@AUF,b) ; Si occupé : vers boite vocale avec message "occupé"
253 exten => _s-.,1,Goto(s-NOANSWER,1) ; Tout le reste : traité comme non-réponse
256 exten => a,1,VoicemailMain(${MACRO_EXTEN}@AUF) ; Si "*" appuyé pendant Voicemail : VoicemailMain
260 ; Macro utilisé pour l'annuaire téléphonie
261 ; cette macro est appelé soit via le menu du standard s'il existe
262 ; ou simplement en ajoutant une entrée spéciale dans le dialpla (auf/extensions.local
263 exten => s,1,Directory(AUF,AUF,b)
264 exten => s,n,MacroExit
267 [macro-AUF-sip-caller-id]
268 ; Indique un Caller ID "correct" en cas d'un appel SIP
269 ; ( inspiration : http://www.loligo.com/asterisk/sipedu/current/configs/extensions.conf )
270 ; Si le Caller ID contient un deja @ : c'est sans doute l'adresse SIP, on arrete la
271 exten => s,1,Set(rightampersand=${CUT(CALLERID(name),@,2)})
272 exten => s,n,GotoIf(${ISNULL(${rightampersand})}?setpri:endmacro)
273 ; Sinon, le Caller ID sera IIINNN@sip.auf.org (III = indicatif de l'implantation
274 ; NNN = numero dans l'implantation)
275 exten => s,n(setpri),Set(CALLERID(num)=${CALLERID(num):2}@sip.auf.org)
276 ; S'il n'y a pas de nom d'utilisateur, on met "AUF"
277 exten => s,n,GotoIf(${ISNULL(${CALLERID(name)})}?setid:endmacro)
278 exten => s,n(setid),Set(CALLERID(name)=AUF)
279 exten => s,n(endmacro),NoOp
282 ; Cherche le correspondant au numero de telephone, en mode ENUM, puis l'appelle
283 ; argument 1 : le numero a chercher
284 ; argument 2 : la technologie (iax2 ou sip)
285 ; argument 3 : la zone DNS (freenum.org, e164.arpa, e164.info, e164.org, ...)
286 exten => s,1,NoOp(ENUM search number ${ARG1} for tech ${ARG2} in zone ${ARG3})
287 exten => s,n,Set(number=${ARG1})
288 exten => s,n,Set(tech=${ARG2})
289 exten => s,n,Set(zone=${ARG3})
290 exten => s,n,Set(counter=0)
291 exten => s,n,Set(count=${ENUMLOOKUP(${number},${tech},c,,${zone})})
292 exten => s,n,While($["${counter}"<"${count}"])
293 exten => s,n,Set(counter=$[${counter}+1])
294 exten => s,n,Dial(${tech}/${ENUMLOOKUP(${number},${tech},,${counter},${zone})},30,tThHkK)
295 exten => s,n,EndWhile
298 ; pour ceux qui doivent ajouter des macros locales
299 #include "auf/extensions-macros.local"
303 ; pickup : **nnn permet de prendre un appel qui sonne sur le poste nnn
304 exten => _**.,1,Set(CHANNEL(language)=fr)
305 exten => _**.,n,Pickup(${EXTEN:2}@AUF)
309 ; *66 : on lance la boite vocale générale
310 exten => *66,1,Answer()
311 exten => *66,n,Wait(1)
312 exten => *66,n,Set(CHANNEL(language)=fr)
313 exten => *66,n,VoicemailMain(@AUF,p)
314 exten => *66,n,Hangup
315 ; *67nnn : accès direct à la boite nnn
316 exten => _*67.,1,Answer()
317 exten => _*67.,n,Wait(1)
318 exten => _*67.,n,Set(CHANNEL(language)=fr)
319 exten => _*67.,n,VoicemailMain(${EXTEN:3}@AUF)
320 exten => _*67.,n,Hangup
325 exten => *11,1,Answer()
326 exten => *11,n,Wait(1)
327 exten => *11,n,Set(CHANNEL(language)=fr)
328 exten => *11,n,Playback(demo-echotest)
330 exten => *11,n,Playback(demo-echodone)
331 exten => *11,n,Hangup
334 [AUF-enregistrement-voix]
336 ; TOIP: Enregistrement de menus vocaux.
337 ; Le fichier genere est place dans /tmp/asterisk-recording.gsm
338 ; transferer ce fichier vers /usr/share/asterisk/sound/nouveau_nom.gsm
339 exten => *20,1,Wait(2)
340 exten => *20,n,Record(/tmp/asterisk-recording:gsm) ; appuyer sur # pour arrêter l'enregistrement
341 exten => *20,n,Wait(2)
342 exten => *20,n,Playback(/tmp/asterisk-recording) ; l'enregistrement rejouer automatiquement
343 exten => *20,n,wait(2)
344 exten => *20,n,Hangup
348 ; Appels vers autres systemes externes : ENUM (ISN ou e164), sipbroker, ...
349 ; Appels avec 00** : sipbroker
350 exten => _${AUFPREFIX}**.,1,Goto(AUF-sipbroker,${EXTEN:$[${AUFPREFIXLEN} + 2]},1)
351 ; Appels vers prefixes 00* : systeme ENUM
352 exten => _${AUFPREFIX}*.,1,Set(numero=${EXTEN:$[${AUFPREFIXLEN} + 1]})
353 ; Si le numéro comporte un "*" alors on va vers ISN, sinon e164
354 exten => _${AUFPREFIX}*.,n,Set(isndomain=${CUT(numero,*,2)})
355 exten => _${AUFPREFIX}*.,n,GotoIf(${ISNULL(${isndomain})}?e164:isn)
356 exten => _${AUFPREFIX}*.,n(e164),Goto(AUF-enum-e164,${numero},1)
357 exten => _${AUFPREFIX}*.,n(isn),Goto(AUF-enum-isn,${numero},1)
360 ; Appel ISN - voir http://www.freenum.org
361 exten => _X.,1,NoOp(Call ENUM/ISN ${EXTEN})
362 ; On coupe les appels de plus de 5 heures
363 exten => _X.,n,Set(TIMEOUT(absolute)=18000)
364 ; On configure le Caller ID pour un appel SIP
365 exten => _X.,n,Macro(AUF-sip-caller-id)
366 ; On appelle le numero SIP correspondant
367 exten => _X.,n,Macro(AUF-enumdial,${EXTEN},sip,freenum.org)
368 exten => _X.,n(failed),Answer
369 exten => _X.,n,Playback(invalid)
370 exten => _X.,n,Wait(3)
371 exten => _X.,n,Playback(invalid)
372 exten => _X.,n,Hangup
378 exten => _X.,1,NoOp(Call ENUM/e164 ${EXTEN})
379 ; On coupe les appels de plus de 5 heures
380 exten => _X.,n,Set(TIMEOUT(absolute)=18000)
381 ; On cherche+appelle sur les differents services public ENUM, en IAX2
382 ; exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},iax2,e164.arpa)
383 ; exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},iax2,e164.org)
384 ; exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},iax2,e164.info)
385 ; exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},iax2,enum.org)
386 ; exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},iax2,e164.voxgratia.net)
387 ; exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},iax2,e164.televolution.net)
388 ; On configure le Caller ID pour un appel SIP
389 exten => _X.,n,Macro(AUF-sip-caller-id)
390 ; On cherche+appelle sur les differents services publics ENUM, en SIP
391 exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.arpa)
392 exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.org)
393 exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.info)
394 exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,enum.org)
395 exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.voxgratia.net)
396 exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.televolution.net)
397 exten => _X.,n(failed),Answer
398 exten => _X.,n,Playback(invalid)
399 exten => _X.,n,Wait(3)
400 exten => _X.,n,Playback(invalid)
401 exten => _X.,n,Hangup
408 exten => _X.,1,NoOp(Call *${EXTEN}@sipbroker.com)
409 exten => _X.,n,Set(TIMEOUT(absolute)=18000)
410 ; exten => _X.,n,Macro(AUF-sip-caller-id)
411 ; exten => _X.,n,Dial(SIP/*${EXTEN}@sipbroker.com)
412 exten => _X.,n,Dial(SIP/sipbroker-out/*${EXTEN},30,tThHkK)
413 exten => _X.,n,Goto(s-${DIALSTATUS},1) ; saut en fonction du status de fin de sonnerie
414 exten => s-CONGESTION,1,Playback(cannot-complete-otherend-error)
415 exten => s-CONGESTION,n,Wait(3)
416 exten => s-CONGESTION,n,Playback(cannot-complete-otherend-error)
417 exten => s-CONGESTION,n,Hangup
418 exten => s-BUSY,1,Playback(on-busy)
419 exten => s-BUSY,n,Hangup
420 exten => s-.,1,Answer
421 exten => s-.,n,Playback(invalid)
422 exten => s-.,n,Wait(3)
423 exten => s-.,n,Playback(invalid)
424 exten => s-.,n,Hangup
431 #include "auf/extensions-debut.local"
432 ; ce fichier contient les extensions a ajouter au debut du contexte [AUF],
433 ; eventuellement pour surpasser d'autres contextes... exemple classique :
434 ; appels internationaux vers vendeur VoIP avec le même prefixe que les
435 ; appels internationaux AUF
438 #include "auf/extensions.local"
439 ; Ce fichier contient les postes locaux, chaque responsable technique
440 ; doit le tenir à jour
443 #include "auf/extensions-pstn.local"
444 ; TOIP: Ce fichier contient le menu principal et les SDA d'entrées du PSTN
445 ; un exemple complet (celui de Montréal) est fourni ici /usr/share/doc/asterisk-config-auf/examples/extensions-pstn.local.montreal.example
448 #include "auf/extensions.global"
449 ; Note : ce fichier est fourni par le paquet asterisk-config-auf-connexions
457 include => AUF-enregistrement-voix
458 include => parkedcalls
459 include => AUF-boitesvocales
460 include => AUF-pickup
461 ;include => AUF-conferences
463 ; Appels vers les postes locaux
466 ; Appels vers le PSTN local
467 ; include => AUF-trunklocal
468 ; AUF-trunklocal est fourni par extensions-pstn.local.montreal.exemple
470 ; Appels vers les postes internationaux AUF
471 include => AUF-global
473 ; Appels vers autres systemes externes : ENUM (ISN ou e164), sipbroker, ...
474 include => AUF-00etoile
476 ; Pour surcharges finales, si besoin (autres contextes, surcharges de contextes, etc)
477 #include "auf/extensions-final.local"