preparation adaptations SIP (NAT et domaines)
[asterisk-config-auf.git] / etc-asterisk / extensions.conf
CommitLineData
b2e905a6
TN
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=yes
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; If clearglobalvars is set, global variables will be cleared
40; and reparsed on an extensions reload, or Asterisk reload.
41;
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.
45;
46; NOTE: A complication sets in, if you put your global variables into
47; the AEL file, instead of the extensions.conf file. With clearglobalvars
48; set, a "reload" will often leave the globals vars cleared, because it
49; is not unusual to have extensions.conf (which will have no globals)
50; load after the extensions.ael file (where the global vars are stored).
51; So, with "reload" in this particular situation, first the AEL file will
52; clear and then set all the global vars, then, later, when the extensions.conf
53; file is loaded, the global vars are all cleared, and then not set, because
54; they are not stored in the extensions.conf file.
55;
56clearglobalvars=no
57;
58; If priorityjumping is set to 'yes', then applications that support
59; 'jumping' to a different priority based on the result of their operations
60; will do so (this is backwards compatible behavior with pre-1.2 releases
61; of Asterisk). Individual applications can also be requested to do this
62; by passing a 'j' option in their arguments.
63;
64priorityjumping=no
65;
66; User context is where entries from users.conf are registered. The
67; default value is 'default'
68;
69;userscontext=default
70;
71; You can include other config files, use the #include command
72; (without the ';'). Note that this is different from the "include" command
73; that includes contexts within other contexts. The #include command works
74; in all asterisk configuration files.
75;#include "filename.conf"
76
77; The "Globals" category contains global variables that can be referenced
78; in the dialplan with the GLOBAL dialplan function:
79; ${GLOBAL(VARIABLE)}
80; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
81; Unix/Linux environmental variables can be reached with the ENV dialplan
82; function: ${ENV(VARIABLE)}
83;
84[globals]
85
86;
87; AUF : inclusion des variables globales
88;
89
90#include "auf/extensions-globals.local"
91
92;CONSOLE=Console/dsp ; Console interface for demo
93;CONSOLE=Zap/1
94;CONSOLE=Phone/phone0
95;IAXINFO=guest ; IAXtel username/password
96;IAXINFO=myuser:mypass
1fb8dda4 97;TRUNK=Zap/G2 ; Trunk interface
b2e905a6 98;
1fb8dda4 99; Note the 'G2' in the TRUNK variable above. It specifies which group (defined
b2e905a6
TN
100; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
101; the specified group. The four possible options are:
102;
103; g: select the lowest-numbered non-busy Zap channel
104; (aka. ascending sequential hunt group).
105; G: select the highest-numbered non-busy Zap channel
106; (aka. descending sequential hunt group).
107; r: use a round-robin search, starting at the next highest channel than last
108; time (aka. ascending rotary hunt group).
109; R: use a round-robin search, starting at the next lowest channel than last
110; time (aka. descending rotary hunt group).
111;
112;TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
113;TRUNK=IAX2/user:pass@provider
114
115;
116; Any category other than "General" and "Globals" represent
117; extension contexts, which are collections of extensions.
118;
119; Extension names may be numbers, letters, or combinations
120; thereof. If an extension name is prefixed by a '_'
121; character, it is interpreted as a pattern rather than a
122; literal. In patterns, some characters have special meanings:
123;
124; X - any digit from 0-9
125; Z - any digit from 1-9
126; N - any digit from 2-9
127; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
128; . - wildcard, matches anything remaining (e.g. _9011. matches
129; anything starting with 9011 excluding 9011 itself)
130; ! - wildcard, causes the matching process to complete as soon as
131; it can unambiguously determine that no other matches are possible
132;
133; For example the extension _NXXXXXX would match normal 7 digit dialings,
134; while _1NXXNXXXXXX would represent an area code plus phone number
135; preceded by a one.
136;
137; Each step of an extension is ordered by priority, which must
138; always start with 1 to be considered a valid extension. The priority
139; "next" or "n" means the previous priority plus one, regardless of whether
140; the previous priority was associated with the current extension or not.
141; The priority "same" or "s" means the same as the previously specified
142; priority, again regardless of whether the previous entry was for the
143; same extension. Priorities may be immediately followed by a plus sign
144; and another integer to add that amount (most useful with 's' or 'n').
145; Priorities may then also have an alias, or label, in
146; parenthesis after their name which can be used in goto situations
147;
148; Contexts contain several lines, one for each step of each
149; extension, which can take one of two forms as listed below,
150; with the first form being preferred.
151;
152;[context]
153;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
154;exten => someexten,{priority|label{+|-}offset}[(alias)],application,arg1|arg2...
155;
156; Included Contexts
157;
158; One may include another context in the current one as well, optionally with a
159; date and time. Included contexts are included in the order
160; they are listed.
161; The reason a context would include other contexts is for their
162; extensions.
163; The algorithm to find an extension is recursive, and works in this
164; fashion:
165; first, given a stack on which to store context references,
166; push the context to find the extension onto the stack...
167; a) Try to find a matching extension in the context at the top of
168; the stack, and, if found, begin executing the priorities
169; there in sequence.
170; b) If not found, Search the switches, if any declared, in
171; sequence.
172; c) If still not found, for each include, push that context onto
173; the top of the context stack, and recurse to a).
174; d) If still not found, pop the entry from the top of the stack;
175; if the stack is empty, the search has failed. If it's not,
176; continue with the next context in c).
177; This is a depth-first traversal, and stops with the first context
178; that provides a matching extension. As usual, if more than one
179; pattern in a context will match, the 'best' match will win.
180; Please note that that extensions found in an included context are
181; treated as if they were in the context from which the search began.
182; The PBX's notion of the "current context" is not changed.
183; Please note that in a context, it does not matter where an include
184; directive occurs. Whether at the top, or near the bottom, the effect
185; will be the same. The only thing that matters is that if there is
186; more than one include directive, they will be searched for extensions
187; in order, first to last.
188; Also please note that pattern matches (like _9XX) are not treated
189; any differently than exact matches (like 987). Also note that the
190; order of extensions in a context have no affect on the outcome.
191;
192; Timing list for includes is
193;
194; <time range>|<days of week>|<days of month>|<months>
195;
196; Note that ranges may be specified to wrap around the ends. Also, minutes are
197; fine-grained only down to the closest even minute.
198;
199;include => daytime|9:00-17:00|mon-fri|*|*
200;include => weekend|*|sat-sun|*|*
201;include => weeknights|17:02-8:58|mon-fri|*|*
202;
203; ignorepat can be used to instruct drivers to not cancel dialtone upon
204; receipt of a particular pattern. The most commonly used example is
205; of course '9' like this:
206;
207;ignorepat => 9
208;
209; so that dialtone remains even after dialing a 9.
210;
211
212[default]
213
214; pour l'AUF, rien dans le contexte par defaut
215
216
217[macro-AUFDial]
218; Macro pour appel AUF
219; appelle simultannément les canaux SIP et IAX, pendant 30s
220; si pas de réponse, occupé ou indisponible : boite vocale
221; ${ARG1} : prenom.com
222; exemple : exten => 221,1,Macro(AUFDial,thomas.noel)
223exten => s,1,Set(CHANNEL(language)=fr)
224; exten => s,n,Dumpchan(10) ; décommenter cette ligne pour passer en mode "debug"
225exten => s,n,Dial(IAX2/${ARG1}&SIP/${ARG1},30,tThH) ; on appelle sur SIP et IAX pendant 30 secondes,
226; FIXME : activer les options w,W et d au niveau du Dial ci-dessus dès que tout sera ok (cf "show application Dial")
227exten => s,n,Goto(s-${DIALSTATUS},1) ; saut en fonction du status de fin de sonnerie
228 ; (parmis : NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
229exten => s-NOANSWER,1,Voicemail(u${MACRO_EXTEN}@AUF) ; Si pas de reponse : vers boite vocale avec message "indisponible"
230exten => s-BUSY,1,Voicemail(b${MACRO_EXTEN}@AUF) ; Si occupé : vers boite vocale avec message "occupé"
231exten => _s-.,1,Goto(s-NOANSWER,1) ; Tout le reste : traité comme non-réponse
232exten => a,1,VoicemailMain(${MACRO_EXTEN}@AUF) ; Si "*" appuyé : VoicemailMain
233
234[macro-AUFConference]
235; Macro pour appel conference (prononce d'abord le numéro de la conférence)
236; ${ARG1} : numero de la conf
237exten => s,1,Set(CHANNEL(language)=fr)
238; exten => s,n,Dumpchan(10) ; décommenter cette ligne pour passer en mode "debug"
239exten => s,n,Playback(conf-youareinconfnum)
240exten => s,n,SayNumber(${ARG1})
241exten => s,n,Conference(${ARG1})
242
243[macro-AUFAutoConference]
244; Si appelée directement : balance dans la conférence "cccc" où cccc est
245; calculé depuis nom du channel (CHANNEL==IAX2/thomas.noel-3 donnera IAX2_thomas.noel)
246; Si appelée suite à un transfert aveugle : balance dans la conférence
247; de l'initiateur du transfer (même calcul depuis BLINDTRANSFER)
248; FIXME : verifier la robustesse du bazar, par exemple suite à un transfert
249; assisté ou depuis un poste non local, etc...
250exten => s,1,Set(NAME=${IF($["${BLINDTRANSFER}" != ""]?${BLINDTRANSFER}:${CHANNEL})}) ; NAME = ; nom du channel relatif à la conference
251; exten => s,n,Dumpchan(10) ; décommenter cette ligne pour passer en mode "debug"
252exten => s,n,Set(TECHNO=${CUT(NAME,/,1)}) ; technologie du channel (partie gauche de IAX2/thomas.noel-2 par rapport au /)
253exten => s,n,Set(NAME=${CUT(NAME,/,2)}) ; nom du channel (partie droite de IAX2/thomas.noel-2 par rapport au /)
254exten => s,n,Set(cutnum=$[${FIELDQTY(NAME,-)} - 1]) ; on compte combien de champ on doit prendre pour retirer le dernier -nn
255exten => s,n,Set(NAME=${CUT(NAME,-,1-${cutnum})}) ; on retire le dernier "-n" : jean-pierre.to-2 devient jean-pierre.to
256exten => s,n,Set(CHANNEL(language)=fr)
257exten => s,n,Playback(conference)
258exten => s,n,Conference(${TECHNO}_${NAME}) ; nom de la conférence = IAX2_thomas.noel (ne doit pas comporter de /)
259
260[macro-AUFChoixSonnerie]
261; Selecteur de sonnerie
262; joue les fichiers 1.gsm, 2.gsm, ... de asterisk/sounds/ipphone5-rings/
263; On passe d'un fichier à l'autre avec 4 et 6. Quand on appuie sur 5, le
264; fichier .dat correspondant dans ; /usr/share/ipphone-tools/rings/ est
265; uploadé sur le poste IP appelant
266; TODO : Tentative de detection que c'est un IP Phone... Pour l'instant
267; je teste uniquement si c'est IAX. Mais pour faire un truc propre
268; il faudrait utiliser ipphone5-report ou qlq chose comme ça
269; TODO2: une petite intro qui dit qu'il faut taper 4/6/5 ça serait bien
270exten => s,1,Set(uploadip=${IAXPEER(CURRENTCHANNEL)})
271exten => s,2,GotoIf($["${uploadip}" = ""]?200:)
272exten => s,3,Set(n=1)
273exten => s,4,System(ls /usr/share/asterisk/sounds/ipphone5-rings/${n}.gsm)
274; Si le fichier n.gsm n'existe pas, on sort de la boucle
275exten => s,5,GotoIf($["${SYSTEMSTATUS}" != "SUCCESS"]?100:)
276; on diffuse la musique "n", en boucle, en attendant l'appui sur une touche
277exten => s,6,Background(/usr/share/asterisk/sounds/ipphone5-rings/${n}|m||macro-AUFChoixSonnerie)
278exten => s,7,Goto(6)
279; 4 et 6 : n-- et n++ et on retourne jouer le fichier
280exten => 4,1,GotoIf($["${n}" = "1"]?3:)
281exten => 4,2,Set(n=$[${n}-1])
282exten => 4,3,Goto(s|4)
283exten => 6,1,Set(n=$[${n}+1])
284exten => 6,2,Goto(s|4)
285; S'il le fichier n.gsm n'existe pas et que n n'était pas la première
286; alors on repasse au début ; sinon on plante (= aucune sonnerie dispo)
287exten => s,100,GotoIf($["${n}" = "1"]?200:3)
288; 5 => on lance un upload avec un délai d'exec de 2 secondes
289; le temps que le hangup soit fait. L'ipphone ne peut pas être uploadé
290; pendant la communication
291exten => 5,1,Playback(goodbye)
292exten => 5,n,System(sleep 2 && /usr/bin/ipphone5-upload /usr/share/ipphone-tools/rings/${n}.dat ${uploadip} > /dev/null 2>&1 &)
293exten => 5,n,Hangup()
294; Les erreurs fatales : pas de musique, ou bien c'est pas un ipphone...
295exten => s,200,Playback(system-crashed)
296exten => s,300,Playback(feature-not-avail-line)
297
298
299; pour ceux qui veulent ajouter des macros locales
300#include "auf/extensions-macros.local"
301
302
303[AUF-conferences]
304; *33 : envoie vers la conference "dynamique" (cf macro ci-dessus)
305exten => *33,1,Macro(AUFAutoConference)
306; *36nnn : accede à la conférence "nnn"
307exten => _*36.,1,Macro(AUFConference,${EXTEN:3})
308; *341 : acces au pont CERN/CNRS/IN2P3/Inserm/INRA
309; reservation : http://vacs.in2p3.fr
310; streaming : http://ccmcu40.in2p3.fr
311; ACCESSIBLE UNIQUEMENT EN SIP : necessite que votre serveur puisse "sortir" en SIP
312exten => *341,1,Dial(SIP/ccmcu40-in2p3-fr,10)
313
314[AUF-choixsonnerie]
315; * 15 : petit robot pour choisir sa sonnerie
316exten => *15,1,Macro(AUFChoixSonnerie)
317
318[AUF-boitesvocales]
319; *66 : on lance la boite vocale générale
320exten => *66,1,Set(CHANNEL(language)=fr)
321exten => *66,n,VoicemailMain(@AUF|p)
322exten => *66,n,Hangup
323; *67nnn : accès direct à la boite nnn
324exten => _*67.,1,Set(CHANNEL(language)=fr)
325exten => _*67.,n,VoicemailMain(${EXTEN:3}@AUF)
326exten => _*67.,n,Hangup
327
328[AUF-pickup]
329; pickup : **nnn permet de prendre un appel qui sonne sur le poste nnn
330; note : utilise DPickup provenant du patch bristuff
331exten => _**.,1,Set(CHANNEL(language)=fr)
332exten => _**.,n,DPickup(${EXTEN:2}@AUF)
333
334[AUF-echo]
335; *11 : test d'echo
336exten => *11,1,Set(CHANNEL(language)=fr)
337exten => *11,n,Playback(demo-echotest)
338exten => *11,n,Echo
339exten => *11,n,Playback(demo-echodone)
340exten => *11,n,Hangup
341
342[AUF-global]
343#include "auf/extensions.global"
344; Note : ce fichier est fourni par le paquet asterisk-config-auf-connexions
345
346[AUF-local]
347#include "auf/extensions.local"
348; Ce fichier contient les postes locaux, chaque responsable technique
349; doit le tenir à jour
350
351[AUF]
352
353; Services
354include => AUF-echo
355include => parkedcalls
356include => AUF-conferences
357include => AUF-choixsonnerie
358include => AUF-boitesvocales
359include => AUF-pickup
360
361; Appels locaux
362include => AUF-local
363
364; Appels internationaux
365include => AUF-global
366
367; Pour surcharges finales, si besoin (autres contextes, surcharges de contextes, etc)
368#include "auf/extensions-final.local"
369