Merged revisions 44955 via svnmerge from
[asterisk-bristuff.git] / configs / extensions.ael.sample
blob0c09bbc62b23954da4de0aab40e836b93cdee81c
1 //
2 // Example AEL config file
3 //
4 //
5 // Static extension configuration file, used by
6 // the pbx_config module. This is where you configure all your 
7 // inbound and outbound calls in Asterisk. 
8 // 
9 // This configuration file is reloaded 
10 // - With the "extensions reload" command in the CLI
11 // - With the "reload" command (that reloads everything) in the CLI
13 // The "Globals" category contains global variables that can be referenced
14 // in the dialplan by using the GLOBAL dialplan function:
15 //  ${GLOBAL(VARIABLE)} 
16 // ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
17 // Unix/Linux environmental variables are reached with the ENV dialplan
18 // function: ${ENV(VARIABLE)}
21 globals {
22         CONSOLE="Console/dsp";          // Console interface for demo
23         //CONSOLE=Zap/1
24         //CONSOLE=Phone/phone0
25         IAXINFO=guest;                          // IAXtel username/password
26         //IAXINFO="myuser:mypass";
27         TRUNK="Zap/g2";                                 // Trunk interface
28         //
29         // Note the 'g2' in the TRUNK variable above. It specifies which group (defined
30         // in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
31         // the specified group. The four possible options are:
32         //
33         // g: select the lowest-numbered non-busy Zap channel
34         //    (aka. ascending sequential hunt group).
35         // G: select the highest-numbered non-busy Zap channel
36         //    (aka. descending sequential hunt group).
37         // r: use a round-robin search, starting at the next highest channel than last
38         //    time (aka. ascending rotary hunt group).
39         // R: use a round-robin search, starting at the next lowest channel than last
40         //    time (aka. descending rotary hunt group).
41         //
42         TRUNKMSD=1;                                     // MSD digits to strip (usually 1 or 0)
43         //TRUNK=IAX2/user:pass@provider
47 // Any category other than "General" and "Globals" represent 
48 // extension contexts, which are collections of extensions.  
50 // Extension names may be numbers, letters, or combinations
51 // thereof. If an extension name is prefixed by a '_'
52 // character, it is interpreted as a pattern rather than a
53 // literal.  In patterns, some characters have special meanings:
55 //   X - any digit from 0-9
56 //   Z - any digit from 1-9
57 //   N - any digit from 2-9
58 //   [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
59 //   . - wildcard, matches anything remaining (e.g. _9011. matches 
60 //      anything starting with 9011 excluding 9011 itself)
61 //   ! - wildcard, causes the matching process to complete as soon as
62 //       it can unambiguously determine that no other matches are possible
64 // For example the extension _NXXXXXX would match normal 7 digit dialings, 
65 // while _1NXXNXXXXXX would represent an area code plus phone number
66 // preceded by a one.
68 // Each step of an extension is ordered by priority, which must
69 // always start with 1 to be considered a valid extension.  The priority
70 // "next" or "n" means the previous priority plus one, regardless of whether
71 // the previous priority was associated with the current extension or not.
72 // The priority "same" or "s" means the same as the previously specified
73 // priority, again regardless of whether the previous entry was for the
74 // same extension.  Priorities may be immediately followed by a plus sign
75 // and another integer to add that amount (most useful with 's' or 'n').  
76 // Priorities may then also have an alias, or label, in 
77 // parenthesis after their name which can be used in goto situations
79 // Contexts contain several lines, one for each step of each
80 // extension, which can take one of two forms as listed below,
81 // with the first form being preferred.  One may include another
82 // context in the current one as well, optionally with a
83 // date and time.  Included contexts are included in the order
84 // they are listed.
86 //context name {
87 //      exten-name => {
88 //              application(arg1,arg2,...);
90 //      Timing list for includes is 
92 //   <time range>|<days of week>|<days of month>|<months>
94 //      includes { 
95 //              daytime|9:00-17:00|mon-fri|*|*;
96 //      };
98 //      ignorepat can be used to instruct drivers to not cancel dialtone upon
99 //      receipt of a particular pattern.  The most commonly used example is
100 //      of course '9' like this:
102 //      ignorepat => 9;
104 //      so that dialtone remains even after dialing a 9.
105 //};
109 // Sample entries for extensions.conf
112 context ael-dundi-e164-canonical {
113         //
114         // List canonical entries here
115         //
116         // 12564286000 => &ael-std-exten(6000,IAX2/foo);
117         // _125642860XX => Dial(IAX2/otherbox/${EXTEN:7});
120 context ael-dundi-e164-customers {
121         //
122         // If you are an ITSP or Reseller, list your customers here.
123         //
124         //_12564286000 => Dial(SIP/customer1);
125         //_12564286001 => Dial(IAX2/customer2);
128 context ael-dundi-e164-via-pstn {
129         //
130         // If you are freely delivering calls to the PSTN, list them here
131         //
132         //_1256428XXXX => Dial(Zap/g2/${EXTEN:7}); // Expose all of 256-428 
133         //_1256325XXXX => Dial(Zap/g2/${EXTEN:7}); // Ditto for 256-325
136 context ael-dundi-e164-local {
137         //
138         // Context to put your dundi IAX2 or SIP user in for
139         // full access
140         //
141         includes {
142          ael-dundi-e164-canonical;
143          ael-dundi-e164-customers;
144          ael-dundi-e164-via-pstn;
145         };
148 context ael-dundi-e164-switch {
149         //
150         // Just a wrapper for the switch
151         //
152         
153         switches { 
154                 DUNDi/e164;
155         };
158 context ael-dundi-e164-lookup {
159         //
160         // Locally to lookup, try looking for a local E.164 solution
161         // then try DUNDi if we don't have one.
162         //
163         includes {
164                 ael-dundi-e164-local;
165                 ael-dundi-e164-switch;
166         };
167         //
171 // DUNDi can also be implemented as a Macro instead of using 
172 // the Local channel driver. 
174 macro ael-dundi-e164(exten) {
176 // ARG1 is the extension to Dial
178         goto ${exten}|1;
182 // Here are the entries you need to participate in the IAXTEL
183 // call routing system.  Most IAXTEL numbers begin with 1-700, but
184 // there are exceptions.  For more information, and to sign
185 // up, please go to www.gnophone.com or www.iaxtel.com
187 context ael-iaxtel700 {
188         _91700XXXXXXX => Dial(IAX2/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel);
192 // The SWITCH statement permits a server to share the dialplan with
193 // another server. Use with care: Reciprocal switch statements are not
194 // allowed (e.g. both A -> B and B -> A), and the switched server needs
195 // to be on-line or else dialing can be severly delayed.
197 context ael-iaxprovider {
198         switches {
199         // IAX2/user:[key]@myserver/mycontext;
200         };
203 context ael-trunkint {
204         //
205         // International long distance through trunk
206         //
207         includes {
208                 ael-dundi-e164-lookup;
209         };
210         _9011. => {
211                 &ael-dundi-e164(${EXTEN:4});
212                 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
213         };
216 context ael-trunkld {
217         //
218         // Long distance context accessed through trunk
219         //
220         includes {
221                 ael-dundi-e164-lookup;
222         };
223         _91NXXNXXXXXX => {
224                 &ael-dundi-e164(${EXTEN:1});
225                 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
226         };
229 context ael-trunklocal {
230         //
231         // Local seven-digit dialing accessed through trunk interface
232         //
233         _9NXXXXXX => {
234                 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
235         };
238 context ael-trunktollfree {
239         //
240         // Long distance context accessed through trunk interface
241         //
242         
243         _91800NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
244         _91888NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
245         _91877NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
246         _91866NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
249 context ael-international {
250         //
251         // Master context for international long distance
252         //
253         ignorepat => 9;
254         includes {
255                 ael-longdistance;
256                 ael-trunkint;
257         };
260 context ael-longdistance {
261         //
262         // Master context for long distance
263         //
264         ignorepat => 9;
265         includes {
266                 ael-local;
267                 ael-trunkld;
268         };
271 context ael-local {
272         //
273         // Master context for local, toll-free, and iaxtel calls only
274         //
275         ignorepat => 9;
276         includes {
277                 ael-default;
278                 ael-parkedcalls;
279                 ael-trunklocal;
280                 ael-iaxtel700;
281                 ael-trunktollfree;
282                 ael-iaxprovider;
283         };
287 // You can use an alternative switch type as well, to resolve
288 // extensions that are not known here, for example with remote 
289 // IAX switching you transparently get access to the remote
290 // Asterisk PBX
291 // 
292 // switch => IAX2/user:password@bigserver/local
294 // An "lswitch" is like a switch but is literal, in that
295 // variable substitution is not performed at load time
296 // but is passed to the switch directly (presumably to
297 // be substituted in the switch routine itself)
299 // lswitch => Loopback/12${EXTEN}@othercontext
301 // An "eswitch" is like a switch but the evaluation of
302 // variable substitution is performed at runtime before
303 // being passed to the switch routine.
305 // eswitch => IAX2/context@${CURSERVER}
308 macro ael-std-exten-ael( ext , dev ) {
309         Dial(${dev}/${ext},20);
310         switch(${DIALSTATUS}) {
311         case BUSY:
312                 Voicemail(b${ext});
313                 break;
314         default:
315                 Voicemail(u${ext});
316         };
317         catch a {
318                 VoiceMailMain(${ext});
319                 return;
320         };
323 context ael-demo {
324         s => {
325                 Wait(1);
326                 Answer();
327                 Set(TIMEOUT(digit)=5);
328                 Set(TIMEOUT(response)=10);
329 restart:
330                 Background(demo-congrats);
331 instructions:
332                 for (x=0; ${x} < 3; x=${x} + 1) {
333                         Background(demo-instruct);
334                         WaitExten();
335                 };
336         };
337         2 => {
338                 Background(demo-moreinfo);
339                 goto s|instructions;
340         };
341         3 => {
342                 Set(LANGUAGE()=fr);
343                 goto s|restart;
344         };
345         1000 => {
346                 goto ael-default|s|1;
347         };
348         500 => {
349                 Playback(demo-abouttotry);
350                 Dial(IAX2/guest@misery.digium.com/s@default);
351                 Playback(demo-nogo);
352                 goto s|instructions;
353         };
354         600 => {
355                 Playback(demo-echotest);
356                 Echo();
357                 Playback(demo-echodone);
358                 goto s|instructions;
359         };
360         _1234 => &ael-std-exten-ael(${EXTEN}, "IAX2");
361         8500 => {
362                 VoicemailMain();
363                 goto s|instructions;
364         };
365         # => {
366                 Playback(demo-thanks);
367                 Hangup();
368         };
369         t => goto #|1;
370         i => Playback(invalid);
375 // If you wish to use AEL for your default context, remove it
376 // from extensions.conf (or change its name or comment it out)
377 // and then uncomment the one here.
380 context ael-default {
382 // By default we include the demo.  In a production system, you 
383 // probably don't want to have the demo there.
385         includes {
386                 ael-demo;
387         };
389 // Extensions like the two below can be used for FWD, Nikotel, sipgate etc.
390 // Note that you must have a [sipprovider] section in sip.conf whereas
391 // the otherprovider.net example does not require such a peer definition
393 //_41X. => Dial(SIP/${EXTEN:2}@sipprovider,,r);
394 //_42X. => Dial(SIP/user:passwd@${EXTEN:2}@otherprovider.net,30,rT);
396 // Real extensions would go here. Generally you want real extensions to be
397 // 4 or 5 digits long (although there is no such requirement) and start with a
398 // single digit that is fairly large (like 6 or 7) so that you have plenty of
399 // room to overlap extensions and menu options without conflict.  You can alias
400 // them with names, too, and use global variables
402 // 6245  => {
403 //              hint(SIP/Grandstream1&SIP/Xlite1,Joe Schmoe); // Channel hints for presence
404 //              Dial(SIP/Grandstream1,20,rt);                 // permit transfer
405 //        Dial(${HINT}/5245},20,rtT);                    // Use hint as listed
406 //        switch(${DIALSTATUS}) {
407 //        case BUSY:
408 //                Voicemail(b6245);
409 //                              return;
410 //        default:
411 //                Voicemail(u6245);
412 //                              return;
413 //        };
414 //       };
416 // 6361 => Dial(IAX2/JaneDoe,,rm);                // ring without time limit
417 // 6389 => Dial(MGCP/aaln/1@192.168.0.14);
418 // 6394 => Dial(Local/6275/n);                    // this will dial ${MARK}
420 // 6275 => &ael-stdexten(6275,${MARK});           // assuming ${MARK} is something like Zap/2
421 // mark => goto 6275|1;                          // alias mark to 6275
422 // 6536 => &ael-stdexten(6236,${WIL});            // Ditto for wil
423 // wil  => goto 6236|1;
425 // Some other handy things are an extension for checking voicemail via
426 // voicemailmain
428 // 8500 => {
429 //                      VoicemailMain();
430 //                      Hangup();
431 //             };
433 // Or a conference room (you'll need to edit meetme.conf to enable this room)
435 // 8600 => Meetme(1234);
437 // Or playing an announcement to the called party, as soon it answers
439 // 8700 => Dial(${MARK},30,A(/path/to/my/announcemsg))
441 // For more information on applications, just type "show applications" at your
442 // friendly Asterisk CLI prompt.
444 // 'show application <command>' will show details of how you
445 // use that particular application in this file, the dial plan.