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