2 // Example AEL config file
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.
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)}
22 CONSOLE="Console/dsp"; // Console interface for demo
24 //CONSOLE=Phone/phone0
25 IAXINFO=guest; // IAXtel username/password
26 //IAXINFO="myuser:mypass";
27 TRUNK="Zap/g2"; // Trunk interface
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:
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).
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
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
88 // application(arg1,arg2,...);
90 // Timing list for includes is
92 // <time range>|<days of week>|<days of month>|<months>
95 // daytime|9:00-17:00|mon-fri|*|*;
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:
104 // so that dialtone remains even after dialing a 9.
109 // Sample entries for extensions.conf
112 context ael-dundi-e164-canonical {
114 // List canonical entries here
116 // 12564286000 => &ael-std-exten(6000,IAX2/foo);
117 // _125642860XX => Dial(IAX2/otherbox/${EXTEN:7});
120 context ael-dundi-e164-customers {
122 // If you are an ITSP or Reseller, list your customers here.
124 //_12564286000 => Dial(SIP/customer1);
125 //_12564286001 => Dial(IAX2/customer2);
128 context ael-dundi-e164-via-pstn {
130 // If you are freely delivering calls to the PSTN, list them here
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 {
138 // Context to put your dundi IAX2 or SIP user in for
142 ael-dundi-e164-canonical;
143 ael-dundi-e164-customers;
144 ael-dundi-e164-via-pstn;
148 context ael-dundi-e164-switch {
150 // Just a wrapper for the switch
158 context ael-dundi-e164-lookup {
160 // Locally to lookup, try looking for a local E.164 solution
161 // then try DUNDi if we don't have one.
164 ael-dundi-e164-local;
165 ael-dundi-e164-switch;
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
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 {
199 // IAX2/user:[key]@myserver/mycontext;
203 context ael-trunkint {
205 // International long distance through trunk
208 ael-dundi-e164-lookup;
211 &ael-dundi-e164(${EXTEN:4});
212 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
216 context ael-trunkld {
218 // Long distance context accessed through trunk
221 ael-dundi-e164-lookup;
224 &ael-dundi-e164(${EXTEN:1});
225 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
229 context ael-trunklocal {
231 // Local seven-digit dialing accessed through trunk interface
234 Dial(${TRUNK}/${EXTEN:${TRUNKMSD}});
238 context ael-trunktollfree {
240 // Long distance context accessed through trunk interface
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 {
251 // Master context for international long distance
260 context ael-longdistance {
262 // Master context for long distance
273 // Master context for local, toll-free, and iaxtel calls only
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
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}) {
318 VoiceMailMain(${ext});
327 Set(TIMEOUT(digit)=5);
328 Set(TIMEOUT(response)=10);
330 Background(demo-congrats);
332 for (x=0; ${x} < 3; x=${x} + 1) {
333 Background(demo-instruct);
338 Background(demo-moreinfo);
346 goto ael-default|s|1;
349 Playback(demo-abouttotry);
350 Dial(IAX2/guest@misery.digium.com/s@default);
355 Playback(demo-echotest);
357 Playback(demo-echodone);
360 _1234 => &ael-std-exten-ael(${EXTEN}, "IAX2");
366 Playback(demo-thanks);
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.
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
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}) {
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
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.