Mise à jour après premières vagues de gros tests
[asterisk-config-auf.git] / etc-asterisk / extensions.conf
CommitLineData
a52025b1
MN
1; extensions.conf - the Asterisk dial plan
2;
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 "dialplan reload" command in the CLI
9; - With the "reload" command (that reloads everything) in the CLI
10
11;
12; The "General" category is for certain variables.
13;
14[general]
15;
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.
19;
20; XXX Not yet implemented XXX
21;
22static=yes
23;
24; if static=yes and writeprotect=no, you can save dialplan by
25; CLI command "dialplan save" too
26;
27writeprotect=no
28;
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.
32;
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).
36;
37autofallthrough=yes
38;
39;
40;
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.
54;
55; By default, the old pattern matcher is used.
56;
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!
66;
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.
69;
70;extenpatternmatchnew=no
71;
72; If clearglobalvars is set, global variables will be cleared
73; and reparsed on a dialplan reload, or Asterisk reload.
74;
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.
78;
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.
88;
89clearglobalvars=no
90;
91; User context is where entries from users.conf are registered. The
92; default value is 'default'
93;
94;userscontext=default
95;
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
103;
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\""
113;
114
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)}
121;
122[globals]
123
124;
125
126;CONSOLE=Console/dsp ; Console interface for demo
127;CONSOLE=DAHDI/1
128;CONSOLE=Phone/phone0
129;IAXINFO=guest ; IAXtel username/password
130;IAXINFO=myuser:mypass
131
132;TRUNK=DAHDI/G2 ; Trunk interface
133;
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:
137;
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).
146;
147
148; TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
149;TRUNK=IAX2/user:pass@provider
150
151;FREENUMDOMAIN=mydomain.com ; domain to send on outbound
152 ; freenum calls (uses outbound-freenum
153 ; context)
154
155; AUF : inclusion des variables globales
156;
157#include "auf/extensions-globals.local"
158
159;
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
166;
167; Any category other than "General" and "Globals" represent
168; extension contexts, which are collections of extensions.
169;
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:
174;
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
183;
184; For example, the extension _NXXXXXX would match normal 7 digit dialings,
185; while _1NXXNXXXXXX would represent an area code plus phone number
186; preceded by a one.
187;
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.
197;
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
206; before "B".
207;
208;[context]
209;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
210;
211; Timing list for includes is
212;
213; <time range>,<days of week>,<days of month>,<months>[,<timezone>]
214;
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.
217;
218;include => daytime,9:00-17:00,mon-fri,*,*
219;include => weekend,*,sat-sun,*,*
220;include => weeknights,17:02-8:58,mon-fri,*,*
221;
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'
224; like this:
225;
226;ignorepat => 9
227;
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).
234;
235
236[default]
237;
238; pour l'AUF, rien dans le contexte par defaut
239
240[macro-AUFDial]
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)
246exten => s,1,Set(CHANNEL(language)=fr)
247; exten => s,n,Dumpchan(10) ; décommenter cette ligne pour passer en mode "debug"
248exten => s,n,Dial(IAX2/${ARG1}&SIP/${ARG1},20,tThHkKwW) ; on appelle sur SIP et IAX pendant 25 secondes,
249exten => s,n,Goto(s-${DIALSTATUS},1) ; saut en fonction du status de fin de sonnerie
250 ; (parmis : NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
251exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN}@AUF,u) ; Si pas de reponse : vers boite vocale avec message "indisponible"
252exten => s-BUSY,1,Voicemail(${MACRO_EXTEN}@AUF,b) ; Si occupé : vers boite vocale avec message "occupé"
253exten => _s-.,1,Goto(s-NOANSWER,1) ; Tout le reste : traité comme non-réponse
254
255
256exten => a,1,VoicemailMain(${MACRO_EXTEN}@AUF) ; Si "*" appuyé pendant Voicemail : VoicemailMain
257
258
259[macro-AUFDirectory]
260; Macro utilisé pour l'annuaire téléphonie
261; cette macro est appelé soit via le menu du standard s'il existe
5bc84f52 262; ou simplement en ajoutant une entrée spéciale dans le dialplan (auf/extensions.local)
a52025b1
MN
263exten => s,1,Directory(AUF,AUF,b)
264exten => s,n,MacroExit
265
266
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
271exten => s,1,Set(rightampersand=${CUT(CALLERID(name),@,2)})
272exten => 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)
275exten => 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"
277exten => s,n,GotoIf(${ISNULL(${CALLERID(name)})}?setid:endmacro)
278exten => s,n(setid),Set(CALLERID(name)=AUF)
279exten => s,n(endmacro),NoOp
280
281[macro-AUF-enumdial]
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, ...)
286exten => s,1,NoOp(ENUM search number ${ARG1} for tech ${ARG2} in zone ${ARG3})
287exten => s,n,Set(number=${ARG1})
288exten => s,n,Set(tech=${ARG2})
289exten => s,n,Set(zone=${ARG3})
290exten => s,n,Set(counter=0)
291exten => s,n,Set(count=${ENUMLOOKUP(${number},${tech},c,,${zone})})
292exten => s,n,While($["${counter}"<"${count}"])
293exten => s,n,Set(counter=$[${counter}+1])
294exten => s,n,Dial(${tech}/${ENUMLOOKUP(${number},${tech},,${counter},${zone})},30,tThHkK)
295exten => s,n,EndWhile
296
297
298; pour ceux qui doivent ajouter des macros locales
299#include "auf/extensions-macros.local"
300
301
302[AUF-pickup]
303; pickup : **nnn permet de prendre un appel qui sonne sur le poste nnn
304exten => _**.,1,Set(CHANNEL(language)=fr)
305exten => _**.,n,Pickup(${EXTEN:2}@AUF)
306
307
308[AUF-boitesvocales]
309; *66 : on lance la boite vocale générale
310exten => *66,1,Answer()
311exten => *66,n,Wait(1)
312exten => *66,n,Set(CHANNEL(language)=fr)
313exten => *66,n,VoicemailMain(@AUF,p)
314exten => *66,n,Hangup
315; *67nnn : accès direct à la boite nnn
316exten => _*67.,1,Answer()
317exten => _*67.,n,Wait(1)
318exten => _*67.,n,Set(CHANNEL(language)=fr)
319exten => _*67.,n,VoicemailMain(${EXTEN:3}@AUF)
320exten => _*67.,n,Hangup
321
322[AUF-echo]
323
324; *11 : test d'echo
325exten => *11,1,Answer()
326exten => *11,n,Wait(1)
327exten => *11,n,Set(CHANNEL(language)=fr)
328exten => *11,n,Playback(demo-echotest)
329exten => *11,n,Echo
330exten => *11,n,Playback(demo-echodone)
331exten => *11,n,Hangup
332
333
334[AUF-enregistrement-voix]
335
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
339exten => *20,1,Wait(2)
340exten => *20,n,Record(/tmp/asterisk-recording:gsm) ; appuyer sur # pour arrêter l'enregistrement
341exten => *20,n,Wait(2)
342exten => *20,n,Playback(/tmp/asterisk-recording) ; l'enregistrement rejouer automatiquement
343exten => *20,n,wait(2)
344exten => *20,n,Hangup
345
346
347[AUF-00etoile]
348; Appels vers autres systemes externes : ENUM (ISN ou e164), sipbroker, ...
349; Appels avec 00** : sipbroker
350exten => _${AUFPREFIX}**.,1,Goto(AUF-sipbroker,${EXTEN:$[${AUFPREFIXLEN} + 2]},1)
351; Appels vers prefixes 00* : systeme ENUM
352exten => _${AUFPREFIX}*.,1,Set(numero=${EXTEN:$[${AUFPREFIXLEN} + 1]})
353; Si le numéro comporte un "*" alors on va vers ISN, sinon e164
354exten => _${AUFPREFIX}*.,n,Set(isndomain=${CUT(numero,*,2)})
355exten => _${AUFPREFIX}*.,n,GotoIf(${ISNULL(${isndomain})}?e164:isn)
356exten => _${AUFPREFIX}*.,n(e164),Goto(AUF-enum-e164,${numero},1)
357exten => _${AUFPREFIX}*.,n(isn),Goto(AUF-enum-isn,${numero},1)
358
359[AUF-enum-isn]
360; Appel ISN - voir http://www.freenum.org
361exten => _X.,1,NoOp(Call ENUM/ISN ${EXTEN})
362; On coupe les appels de plus de 5 heures
363exten => _X.,n,Set(TIMEOUT(absolute)=18000)
364; On configure le Caller ID pour un appel SIP
365exten => _X.,n,Macro(AUF-sip-caller-id)
366; On appelle le numero SIP correspondant
367exten => _X.,n,Macro(AUF-enumdial,${EXTEN},sip,freenum.org)
368exten => _X.,n(failed),Answer
369exten => _X.,n,Playback(invalid)
370exten => _X.,n,Wait(3)
371exten => _X.,n,Playback(invalid)
372exten => _X.,n,Hangup
373exten => h,1,Hangup
374exten => i,1,Hangup
375exten => T,1,Hangup
376
377[AUF-enum-e164]
378exten => _X.,1,NoOp(Call ENUM/e164 ${EXTEN})
379; On coupe les appels de plus de 5 heures
380exten => _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
389exten => _X.,n,Macro(AUF-sip-caller-id)
390; On cherche+appelle sur les differents services publics ENUM, en SIP
391exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.arpa)
392exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.org)
393exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.info)
394exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,enum.org)
395exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.voxgratia.net)
396exten => _X.,n,Macro(AUF-enumdial,+${EXTEN},sip,e164.televolution.net)
397exten => _X.,n(failed),Answer
398exten => _X.,n,Playback(invalid)
399exten => _X.,n,Wait(3)
400exten => _X.,n,Playback(invalid)
401exten => _X.,n,Hangup
402exten => h,1,Hangup
403exten => i,1,Hangup
404exten => T,1,Hangup
405
406
407[AUF-sipbroker]
408exten => _X.,1,NoOp(Call *${EXTEN}@sipbroker.com)
409exten => _X.,n,Set(TIMEOUT(absolute)=18000)
410; exten => _X.,n,Macro(AUF-sip-caller-id)
411; exten => _X.,n,Dial(SIP/*${EXTEN}@sipbroker.com)
412exten => _X.,n,Dial(SIP/sipbroker-out/*${EXTEN},30,tThHkK)
413exten => _X.,n,Goto(s-${DIALSTATUS},1) ; saut en fonction du status de fin de sonnerie
414exten => s-CONGESTION,1,Playback(cannot-complete-otherend-error)
415exten => s-CONGESTION,n,Wait(3)
416exten => s-CONGESTION,n,Playback(cannot-complete-otherend-error)
417exten => s-CONGESTION,n,Hangup
418exten => s-BUSY,1,Playback(on-busy)
419exten => s-BUSY,n,Hangup
420exten => s-.,1,Answer
421exten => s-.,n,Playback(invalid)
422exten => s-.,n,Wait(3)
423exten => s-.,n,Playback(invalid)
424exten => s-.,n,Hangup
425exten => h,1,Hangup
426exten => i,1,Hangup
427exten => T,1,Hangup
428
429
430[AUF-debut]
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
436
437[AUF-local]
438#include "auf/extensions.local"
439; Ce fichier contient les postes locaux, chaque responsable technique
440; doit le tenir à jour
441
442[AUF-pstn]
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
446
447[AUF-global]
448#include "auf/extensions.global"
449; Note : ce fichier est fourni par le paquet asterisk-config-auf-connexions
450
451[AUF]
452; Surcharges locales
453include => AUF-debut
454
455; Services standard
456include => AUF-echo
457include => AUF-enregistrement-voix
458include => parkedcalls
459include => AUF-boitesvocales
460include => AUF-pickup
461;include => AUF-conferences
462
463; Appels vers les postes locaux
464include => AUF-local
465
466; Appels vers le PSTN local
467; include => AUF-trunklocal
468; AUF-trunklocal est fourni par extensions-pstn.local.montreal.exemple
469
470; Appels vers les postes internationaux AUF
471include => AUF-global
472
473; Appels vers autres systemes externes : ENUM (ISN ou e164), sipbroker, ...
474include => AUF-00etoile
475
476; Pour surcharges finales, si besoin (autres contextes, surcharges de contextes, etc)
477#include "auf/extensions-final.local"