extensions.ael.sample 12 KB

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