Let's also include aclocal.m4
[asterisk-bristuff.git] / configs / extensions.ael.sample
blobab8cdd854ce437ff00b01941bdcf5e496fe0acaf
1 //
2 // Example AEL config file
3 //
4 //
5 // Static extension configuration file, used by
6 // the pbx_ael 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 "ael 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 chan_dahdi.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;
179         return;
183 // Here are the entries you need to participate in the IAXTEL
184 // call routing system.  Most IAXTEL numbers begin with 1-700, but
185 // there are exceptions.  For more information, and to sign
186 // up, please go to www.gnophone.com or www.iaxtel.com
188 context ael-iaxtel700 {
189         _91700XXXXXXX => Dial(IAX2/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel);
193 // The SWITCH statement permits a server to share the dialplan with
194 // another server. Use with care: Reciprocal switch statements are not
195 // allowed (e.g. both A -> B and B -> A), and the switched server needs
196 // to be on-line or else dialing can be severly delayed.
198 context ael-iaxprovider {
199         switches {
200         // IAX2/user:[key]@myserver/mycontext;
201         };
204 context ael-trunkint {
205         //
206         // International long distance through trunk
207         //
208         includes {
209                 ael-dundi-e164-lookup;
210         };
211         _9011. => {
212                 &ael-dundi-e164(${EXTEN:4});
213                 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
214         };
217 context ael-trunkld {
218         //
219         // Long distance context accessed through trunk
220         //
221         includes {
222                 ael-dundi-e164-lookup;
223         };
224         _91NXXNXXXXXX => {
225                 &ael-dundi-e164(${EXTEN:1});
226                 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
227         };
230 context ael-trunklocal {
231         //
232         // Local seven-digit dialing accessed through trunk interface
233         //
234         _9NXXXXXX => {
235                 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
236         };
239 context ael-trunktollfree {
240         //
241         // Long distance context accessed through trunk interface
242         //
243         
244         _91800NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
245         _91888NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
246         _91877NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
247         _91866NXXXXXX => Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
250 context ael-international {
251         //
252         // Master context for international long distance
253         //
254         ignorepat => 9;
255         includes {
256                 ael-longdistance;
257                 ael-trunkint;
258         };
261 context ael-longdistance {
262         //
263         // Master context for long distance
264         //
265         ignorepat => 9;
266         includes {
267                 ael-local;
268                 ael-trunkld;
269         };
272 context ael-local {
273         //
274         // Master context for local, toll-free, and iaxtel calls only
275         //
276         ignorepat => 9;
277         includes {
278                 ael-default;
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(${ext},b);
313                 break;
314         default:
315                 Voicemail(${ext},u);
316         };
317         catch a {
318                 VoiceMailMain(${ext});
319                 return;
320         };
321         return;
324 context ael-demo {
325         s => {
326                 Wait(1);
327                 Answer();
328                 Set(TIMEOUT(digit)=5);
329                 Set(TIMEOUT(response)=10);
330 restart:
331                 Background(demo-congrats);
332 instructions:
333                 for (x=0; ${x} < 3; x=${x} + 1) {
334                         Background(demo-instruct);
335                         WaitExten();
336                 };
337         };
338         2 => {
339                 Background(demo-moreinfo);
340                 goto s|instructions;
341         };
342         3 => {
343                 Set(LANGUAGE()=fr);
344                 goto s|restart;
345         };
346         1000 => {
347                 goto ael-default|s|1;
348         };
349         500 => {
350                 Playback(demo-abouttotry);
351                 Dial(IAX2/guest@misery.digium.com/s@default);
352                 Playback(demo-nogo);
353                 goto s|instructions;
354         };
355         600 => {
356                 Playback(demo-echotest);
357                 Echo();
358                 Playback(demo-echodone);
359                 goto s|instructions;
360         };
361         _1234 => &ael-std-exten-ael(${EXTEN}, "IAX2");
362         8500 => {
363                 VoicemailMain();
364                 goto s|instructions;
365         };
366         # => {
367                 Playback(demo-thanks);
368                 Hangup();
369         };
370         t => goto #|1;
371         i => Playback(invalid);
376 // If you wish to use AEL for your default context, remove it
377 // from extensions.conf (or change its name or comment it out)
378 // and then uncomment the one here.
381 context ael-default {
383 // By default we include the demo.  In a production system, you 
384 // probably don't want to have the demo there.
386         includes {
387                 ael-demo;
388         };
390 // Extensions like the two below can be used for FWD, Nikotel, sipgate etc.
391 // Note that you must have a [sipprovider] section in sip.conf whereas
392 // the otherprovider.net example does not require such a peer definition
394 //_41X. => Dial(SIP/${EXTEN:2}@sipprovider,,r);
395 //_42X. => Dial(SIP/user:passwd@${EXTEN:2}@otherprovider.net,30,rT);
397 // Real extensions would go here. Generally you want real extensions to be
398 // 4 or 5 digits long (although there is no such requirement) and start with a
399 // single digit that is fairly large (like 6 or 7) so that you have plenty of
400 // room to overlap extensions and menu options without conflict.  You can alias
401 // them with names, too, and use global variables
403 // 6245  => {
404 //              hint(SIP/Grandstream1&SIP/Xlite1,Joe Schmoe); // Channel hints for presence
405 //              Dial(SIP/Grandstream1,20,rt);                 // permit transfer
406 //        Dial(${HINT}/5245},20,rtT);                    // Use hint as listed
407 //        switch(${DIALSTATUS}) {
408 //        case BUSY:
409 //                Voicemail(6245,b);
410 //                              return;
411 //        default:
412 //                Voicemail(6245,u);
413 //                              return;
414 //        };
415 //       };
417 // 6361 => Dial(IAX2/JaneDoe,,rm);                // ring without time limit
418 // 6389 => Dial(MGCP/aaln/1@192.168.0.14);
419 // 6394 => Dial(Local/6275/n);                    // this will dial ${MARK}
421 // 6275 => &ael-stdexten(6275,${MARK});           // assuming ${MARK} is something like Zap/2
422 // mark => goto 6275|1;                          // alias mark to 6275
423 // 6536 => &ael-stdexten(6236,${WIL});            // Ditto for wil
424 // wil  => goto 6236|1;
426 // Some other handy things are an extension for checking voicemail via
427 // voicemailmain
429 // 8500 => {
430 //                      VoicemailMain();
431 //                      Hangup();
432 //             };
434 // Or a conference room (you'll need to edit meetme.conf to enable this room)
436 // 8600 => Meetme(1234);
438 // Or playing an announcement to the called party, as soon it answers
440 // 8700 => Dial(${MARK},30,A(/path/to/my/announcemsg))
442 // For more information on applications, just type "show applications" at your
443 // friendly Asterisk CLI prompt.
445 // 'show application <command>' will show details of how you
446 // use that particular application in this file, the dial plan.