Fri, 22 Oct 2010 13:22:33 +0200
Import package vendor original specs for necessary manipulations.
michael@202 | 1 | ; extensions.conf - the Asterisk dial plan |
michael@202 | 2 | ; |
michael@202 | 3 | ; Static extension configuration file, used by |
michael@202 | 4 | ; the pbx_config module. This is where you configure all your |
michael@202 | 5 | ; inbound and outbound calls in Asterisk. |
michael@202 | 6 | ; |
michael@202 | 7 | ; This configuration file is reloaded |
michael@202 | 8 | ; - With the "dialplan reload" command in the CLI |
michael@202 | 9 | ; - With the "reload" command (that reloads everything) in the CLI |
michael@202 | 10 | |
michael@202 | 11 | ; |
michael@202 | 12 | ; The "General" category is for certain variables. |
michael@202 | 13 | ; |
michael@202 | 14 | ;[general] |
michael@202 | 15 | ; |
michael@202 | 16 | ; If static is set to no, or omitted, then the pbx_config will rewrite |
michael@202 | 17 | ; this file when extensions are modified. Remember that all comments |
michael@202 | 18 | ; made in the file will be lost when that happens. |
michael@202 | 19 | ; |
michael@202 | 20 | ; XXX Not yet implemented XXX |
michael@202 | 21 | ; |
michael@202 | 22 | ;static=yes |
michael@202 | 23 | ; |
michael@202 | 24 | ; if static=yes and writeprotect=no, you can save dialplan by |
michael@202 | 25 | ; CLI command "dialplan save" too |
michael@202 | 26 | ; |
michael@202 | 27 | ;writeprotect=no |
michael@202 | 28 | ; |
michael@202 | 29 | ; If autofallthrough is set, then if an extension runs out of |
michael@202 | 30 | ; things to do, it will terminate the call with BUSY, CONGESTION |
michael@202 | 31 | ; or HANGUP depending on Asterisk's best guess. This is the default. |
michael@202 | 32 | ; |
michael@202 | 33 | ; If autofallthrough is not set, then if an extension runs out of |
michael@202 | 34 | ; things to do, Asterisk will wait for a new extension to be dialed |
michael@202 | 35 | ; (this is the original behavior of Asterisk 1.0 and earlier). |
michael@202 | 36 | ; |
michael@202 | 37 | ;autofallthrough=no |
michael@202 | 38 | ; |
michael@202 | 39 | ; If clearglobalvars is set, global variables will be cleared |
michael@202 | 40 | ; and reparsed on an extensions reload, or Asterisk reload. |
michael@202 | 41 | ; |
michael@202 | 42 | ; If clearglobalvars is not set, then global variables will persist |
michael@202 | 43 | ; through reloads, and even if deleted from the extensions.conf or |
michael@202 | 44 | ; one of its included files, will remain set to the previous value. |
michael@202 | 45 | ; |
michael@202 | 46 | ; NOTE: A complication sets in, if you put your global variables into |
michael@202 | 47 | ; the AEL file, instead of the extensions.conf file. With clearglobalvars |
michael@202 | 48 | ; set, a "reload" will often leave the globals vars cleared, because it |
michael@202 | 49 | ; is not unusual to have extensions.conf (which will have no globals) |
michael@202 | 50 | ; load after the extensions.ael file (where the global vars are stored). |
michael@202 | 51 | ; So, with "reload" in this particular situation, first the AEL file will |
michael@202 | 52 | ; clear and then set all the global vars, then, later, when the extensions.conf |
michael@202 | 53 | ; file is loaded, the global vars are all cleared, and then not set, because |
michael@202 | 54 | ; they are not stored in the extensions.conf file. |
michael@202 | 55 | ; |
michael@202 | 56 | ;clearglobalvars=no |
michael@202 | 57 | ; |
michael@202 | 58 | ; If priorityjumping is set to 'yes', then applications that support |
michael@202 | 59 | ; 'jumping' to a different priority based on the result of their operations |
michael@202 | 60 | ; will do so (this is backwards compatible behavior with pre-1.2 releases |
michael@202 | 61 | ; of Asterisk). Individual applications can also be requested to do this |
michael@202 | 62 | ; by passing a 'j' option in their arguments. |
michael@202 | 63 | ; |
michael@202 | 64 | ;priorityjumping=yes |
michael@202 | 65 | ; |
michael@202 | 66 | ; User context is where entries from users.conf are registered. The |
michael@202 | 67 | ; default value is 'default' |
michael@202 | 68 | ; |
michael@202 | 69 | ;userscontext=default |
michael@202 | 70 | ; |
michael@202 | 71 | ; You can include other config files, use the #include command |
michael@202 | 72 | ; (without the ';'). Note that this is different from the "include" command |
michael@202 | 73 | ; that includes contexts within other contexts. The #include command works |
michael@202 | 74 | ; in all asterisk configuration files. |
michael@202 | 75 | ;#include "filename.conf" |
michael@202 | 76 | |
michael@202 | 77 | ; The "Globals" category contains global variables that can be referenced |
michael@202 | 78 | ; in the dialplan with the GLOBAL dialplan function: |
michael@202 | 79 | ; ${GLOBAL(VARIABLE)} |
michael@202 | 80 | ; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid |
michael@202 | 81 | ; Unix/Linux environmental variables can be reached with the ENV dialplan |
michael@202 | 82 | ; function: ${ENV(VARIABLE)} |
michael@202 | 83 | ; |
michael@202 | 84 | ;[globals] |
michael@202 | 85 | ;CONSOLE=Console/dsp ; Console interface for demo |
michael@202 | 86 | ;CONSOLE=Zap/1 |
michael@202 | 87 | ;CONSOLE=Phone/phone0 |
michael@202 | 88 | ;IAXINFO=guest ; IAXtel username/password |
michael@202 | 89 | ;IAXINFO=myuser:mypass |
michael@202 | 90 | ;TRUNK=Zap/G2 ; Trunk interface |
michael@202 | 91 | ; |
michael@202 | 92 | ; Note the 'G2' in the TRUNK variable above. It specifies which group (defined |
michael@202 | 93 | ; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in |
michael@202 | 94 | ; the specified group. The four possible options are: |
michael@202 | 95 | ; |
michael@202 | 96 | ; g: select the lowest-numbered non-busy Zap channel |
michael@202 | 97 | ; (aka. ascending sequential hunt group). |
michael@202 | 98 | ; G: select the highest-numbered non-busy Zap channel |
michael@202 | 99 | ; (aka. descending sequential hunt group). |
michael@202 | 100 | ; r: use a round-robin search, starting at the next highest channel than last |
michael@202 | 101 | ; time (aka. ascending rotary hunt group). |
michael@202 | 102 | ; R: use a round-robin search, starting at the next lowest channel than last |
michael@202 | 103 | ; time (aka. descending rotary hunt group). |
michael@202 | 104 | ; |
michael@202 | 105 | ;TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0) |
michael@202 | 106 | ;TRUNK=IAX2/user:pass@provider |
michael@202 | 107 | |
michael@202 | 108 | ; |
michael@202 | 109 | ; Any category other than "General" and "Globals" represent |
michael@202 | 110 | ; extension contexts, which are collections of extensions. |
michael@202 | 111 | ; |
michael@202 | 112 | ; Extension names may be numbers, letters, or combinations |
michael@202 | 113 | ; thereof. If an extension name is prefixed by a '_' |
michael@202 | 114 | ; character, it is interpreted as a pattern rather than a |
michael@202 | 115 | ; literal. In patterns, some characters have special meanings: |
michael@202 | 116 | ; |
michael@202 | 117 | ; X - any digit from 0-9 |
michael@202 | 118 | ; Z - any digit from 1-9 |
michael@202 | 119 | ; N - any digit from 2-9 |
michael@202 | 120 | ; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) |
michael@202 | 121 | ; . - wildcard, matches anything remaining (e.g. _9011. matches |
michael@202 | 122 | ; anything starting with 9011 excluding 9011 itself) |
michael@202 | 123 | ; ! - wildcard, causes the matching process to complete as soon as |
michael@202 | 124 | ; it can unambiguously determine that no other matches are possible |
michael@202 | 125 | ; |
michael@202 | 126 | ; For example the extension _NXXXXXX would match normal 7 digit dialings, |
michael@202 | 127 | ; while _1NXXNXXXXXX would represent an area code plus phone number |
michael@202 | 128 | ; preceded by a one. |
michael@202 | 129 | ; |
michael@202 | 130 | ; Each step of an extension is ordered by priority, which must |
michael@202 | 131 | ; always start with 1 to be considered a valid extension. The priority |
michael@202 | 132 | ; "next" or "n" means the previous priority plus one, regardless of whether |
michael@202 | 133 | ; the previous priority was associated with the current extension or not. |
michael@202 | 134 | ; The priority "same" or "s" means the same as the previously specified |
michael@202 | 135 | ; priority, again regardless of whether the previous entry was for the |
michael@202 | 136 | ; same extension. Priorities may be immediately followed by a plus sign |
michael@202 | 137 | ; and another integer to add that amount (most useful with 's' or 'n'). |
michael@202 | 138 | ; Priorities may then also have an alias, or label, in |
michael@202 | 139 | ; parenthesis after their name which can be used in goto situations |
michael@202 | 140 | ; |
michael@202 | 141 | ; Contexts contain several lines, one for each step of each |
michael@202 | 142 | ; extension, which can take one of two forms as listed below, |
michael@202 | 143 | ; with the first form being preferred. |
michael@202 | 144 | ; |
michael@202 | 145 | ;[context] |
michael@202 | 146 | ;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...) |
michael@202 | 147 | ;exten => someexten,{priority|label{+|-}offset}[(alias)],application,arg1|arg2... |
michael@202 | 148 | ; |
michael@202 | 149 | ; Included Contexts |
michael@202 | 150 | ; |
michael@202 | 151 | ; One may include another context in the current one as well, optionally with a |
michael@202 | 152 | ; date and time. Included contexts are included in the order |
michael@202 | 153 | ; they are listed. |
michael@202 | 154 | ; The reason a context would include other contexts is for their |
michael@202 | 155 | ; extensions. |
michael@202 | 156 | ; The algorithm to find an extension is recursive, and works in this |
michael@202 | 157 | ; fashion: |
michael@202 | 158 | ; first, given a stack on which to store context references, |
michael@202 | 159 | ; push the context to find the extension onto the stack... |
michael@202 | 160 | ; a) Try to find a matching extension in the context at the top of |
michael@202 | 161 | ; the stack, and, if found, begin executing the priorities |
michael@202 | 162 | ; there in sequence. |
michael@202 | 163 | ; b) If not found, Search the switches, if any declared, in |
michael@202 | 164 | ; sequence. |
michael@202 | 165 | ; c) If still not found, for each include, push that context onto |
michael@202 | 166 | ; the top of the context stack, and recurse to a). |
michael@202 | 167 | ; d) If still not found, pop the entry from the top of the stack; |
michael@202 | 168 | ; if the stack is empty, the search has failed. If it's not, |
michael@202 | 169 | ; continue with the next context in c). |
michael@202 | 170 | ; This is a depth-first traversal, and stops with the first context |
michael@202 | 171 | ; that provides a matching extension. As usual, if more than one |
michael@202 | 172 | ; pattern in a context will match, the 'best' match will win. |
michael@202 | 173 | ; Please note that that extensions found in an included context are |
michael@202 | 174 | ; treated as if they were in the context from which the search began. |
michael@202 | 175 | ; The PBX's notion of the "current context" is not changed. |
michael@202 | 176 | ; Please note that in a context, it does not matter where an include |
michael@202 | 177 | ; directive occurs. Whether at the top, or near the bottom, the effect |
michael@202 | 178 | ; will be the same. The only thing that matters is that if there is |
michael@202 | 179 | ; more than one include directive, they will be searched for extensions |
michael@202 | 180 | ; in order, first to last. |
michael@202 | 181 | ; Also please note that pattern matches (like _9XX) are not treated |
michael@202 | 182 | ; any differently than exact matches (like 987). Also note that the |
michael@202 | 183 | ; order of extensions in a context have no affect on the outcome. |
michael@202 | 184 | ; |
michael@202 | 185 | ; Timing list for includes is |
michael@202 | 186 | ; |
michael@202 | 187 | ; <time range>|<days of week>|<days of month>|<months> |
michael@202 | 188 | ; |
michael@202 | 189 | ; Note that ranges may be specified to wrap around the ends. Also, minutes are |
michael@202 | 190 | ; fine-grained only down to the closest even minute. |
michael@202 | 191 | ; |
michael@202 | 192 | ;include => daytime|9:00-17:00|mon-fri|*|* |
michael@202 | 193 | ;include => weekend|*|sat-sun|*|* |
michael@202 | 194 | ;include => weeknights|17:02-8:58|mon-fri|*|* |
michael@202 | 195 | ; |
michael@202 | 196 | ; ignorepat can be used to instruct drivers to not cancel dialtone upon |
michael@202 | 197 | ; receipt of a particular pattern. The most commonly used example is |
michael@202 | 198 | ; of course '9' like this: |
michael@202 | 199 | ; |
michael@202 | 200 | ;ignorepat => 9 |
michael@202 | 201 | ; |
michael@202 | 202 | ; so that dialtone remains even after dialing a 9. |
michael@202 | 203 | ; |
michael@202 | 204 | |
michael@202 | 205 | ; |
michael@202 | 206 | ; Sample entries for extensions.conf |
michael@202 | 207 | ; |
michael@202 | 208 | ; |
michael@202 | 209 | ;[dundi-e164-canonical] |
michael@202 | 210 | ; |
michael@202 | 211 | ; List canonical entries here |
michael@202 | 212 | ; |
michael@202 | 213 | ;exten => 12564286000,1,Macro(stdexten,6000,IAX2/foo) |
michael@202 | 214 | ;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7}) |
michael@202 | 215 | |
michael@202 | 216 | ;[dundi-e164-customers] |
michael@202 | 217 | ; |
michael@202 | 218 | ; If you are an ITSP or Reseller, list your customers here. |
michael@202 | 219 | ; |
michael@202 | 220 | ;exten => _12564286000,1,Dial(SIP/customer1) |
michael@202 | 221 | ;exten => _12564286001,1,Dial(IAX2/customer2) |
michael@202 | 222 | |
michael@202 | 223 | ;[dundi-e164-via-pstn] |
michael@202 | 224 | ; |
michael@202 | 225 | ; If you are freely delivering calls to the PSTN, list them here |
michael@202 | 226 | ; |
michael@202 | 227 | ;exten => _1256428XXXX,1,Dial(Zap/G2/${EXTEN:7}) ; Expose all of 256-428 |
michael@202 | 228 | ;exten => _1256325XXXX,1,Dial(Zap/G2/${EXTEN:7}) ; Ditto for 256-325 |
michael@202 | 229 | |
michael@202 | 230 | ;[dundi-e164-local] |
michael@202 | 231 | ; |
michael@202 | 232 | ; Context to put your dundi IAX2 or SIP user in for |
michael@202 | 233 | ; full access |
michael@202 | 234 | ; |
michael@202 | 235 | ;include => dundi-e164-canonical |
michael@202 | 236 | ;include => dundi-e164-customers |
michael@202 | 237 | ;include => dundi-e164-via-pstn |
michael@202 | 238 | |
michael@202 | 239 | ;[dundi-e164-switch] |
michael@202 | 240 | ; |
michael@202 | 241 | ; Just a wrapper for the switch |
michael@202 | 242 | ; |
michael@202 | 243 | ;switch => DUNDi/e164 |
michael@202 | 244 | |
michael@202 | 245 | ;[dundi-e164-lookup] |
michael@202 | 246 | ; |
michael@202 | 247 | ; Locally to lookup, try looking for a local E.164 solution |
michael@202 | 248 | ; then try DUNDi if we don't have one. |
michael@202 | 249 | ; |
michael@202 | 250 | ;include => dundi-e164-local |
michael@202 | 251 | ;include => dundi-e164-switch |
michael@202 | 252 | ; |
michael@202 | 253 | ; DUNDi can also be implemented as a Macro instead of using |
michael@202 | 254 | ; the Local channel driver. |
michael@202 | 255 | ; |
michael@202 | 256 | ;[macro-dundi-e164] |
michael@202 | 257 | ; |
michael@202 | 258 | ; ARG1 is the extension to Dial |
michael@202 | 259 | ; |
michael@202 | 260 | ; Extension "s" is not a wildcard extension that matches "anything". |
michael@202 | 261 | ; In macros, it is the start extension. In most other cases, |
michael@202 | 262 | ; you have to goto "s" to execute that extension. |
michael@202 | 263 | ; |
michael@202 | 264 | ; For wildcard matches, see above - all pattern matches start with |
michael@202 | 265 | ; an underscore. |
michael@202 | 266 | ;exten => s,1,Goto(${ARG1},1) |
michael@202 | 267 | ;include => dundi-e164-lookup |
michael@202 | 268 | |
michael@202 | 269 | ; |
michael@202 | 270 | ; Here are the entries you need to participate in the IAXTEL |
michael@202 | 271 | ; call routing system. Most IAXTEL numbers begin with 1-700, but |
michael@202 | 272 | ; there are exceptions. For more information, and to sign |
michael@202 | 273 | ; up, please go to www.gnophone.com or www.iaxtel.com |
michael@202 | 274 | ; |
michael@202 | 275 | ;[iaxtel700] |
michael@202 | 276 | ;exten => _91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}@iaxtel.com/${EXTEN:1}@iaxtel) |
michael@202 | 277 | |
michael@202 | 278 | ; |
michael@202 | 279 | ; The SWITCH statement permits a server to share the dialplan with |
michael@202 | 280 | ; another server. Use with care: Reciprocal switch statements are not |
michael@202 | 281 | ; allowed (e.g. both A -> B and B -> A), and the switched server needs |
michael@202 | 282 | ; to be on-line or else dialing can be severly delayed. |
michael@202 | 283 | ; |
michael@202 | 284 | ;[iaxprovider] |
michael@202 | 285 | ;switch => IAX2/user:[key]@myserver/mycontext |
michael@202 | 286 | |
michael@202 | 287 | ;[trunkint] |
michael@202 | 288 | ; |
michael@202 | 289 | ; International long distance through trunk |
michael@202 | 290 | ; |
michael@202 | 291 | ;exten => _9011.,1,Macro(dundi-e164,${EXTEN:4}) |
michael@202 | 292 | ;exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}}) |
michael@202 | 293 | |
michael@202 | 294 | ;[trunkld] |
michael@202 | 295 | ; |
michael@202 | 296 | ; Long distance context accessed through trunk |
michael@202 | 297 | ; |
michael@202 | 298 | ;exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1}) |
michael@202 | 299 | ;exten => _91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}}) |
michael@202 | 300 | |
michael@202 | 301 | ;[trunklocal] |
michael@202 | 302 | ; |
michael@202 | 303 | ; Local seven-digit dialing accessed through trunk interface |
michael@202 | 304 | ; |
michael@202 | 305 | ;exten => _9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}}) |
michael@202 | 306 | |
michael@202 | 307 | ;[trunktollfree] |
michael@202 | 308 | ; |
michael@202 | 309 | ; Long distance context accessed through trunk interface |
michael@202 | 310 | ; |
michael@202 | 311 | ;exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}}) |
michael@202 | 312 | ;exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}}) |
michael@202 | 313 | ;exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}}) |
michael@202 | 314 | ;exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}}) |
michael@202 | 315 | |
michael@202 | 316 | ;[international] |
michael@202 | 317 | ; |
michael@202 | 318 | ; Master context for international long distance |
michael@202 | 319 | ; |
michael@202 | 320 | ;ignorepat => 9 |
michael@202 | 321 | ;include => longdistance |
michael@202 | 322 | ;include => trunkint |
michael@202 | 323 | |
michael@202 | 324 | ;[longdistance] |
michael@202 | 325 | ; |
michael@202 | 326 | ; Master context for long distance |
michael@202 | 327 | ; |
michael@202 | 328 | ;ignorepat => 9 |
michael@202 | 329 | ;include => local |
michael@202 | 330 | ;include => trunkld |
michael@202 | 331 | |
michael@202 | 332 | ;[local] |
michael@202 | 333 | ; |
michael@202 | 334 | ; Master context for local, toll-free, and iaxtel calls only |
michael@202 | 335 | ; |
michael@202 | 336 | ;ignorepat => 9 |
michael@202 | 337 | ;include => default |
michael@202 | 338 | ;include => trunklocal |
michael@202 | 339 | ;include => iaxtel700 |
michael@202 | 340 | ;include => trunktollfree |
michael@202 | 341 | ;include => iaxprovider |
michael@202 | 342 | |
michael@202 | 343 | ;Include parkedcalls (or the context you define in features conf) |
michael@202 | 344 | ;to enable call parking. |
michael@202 | 345 | ;include => parkedcalls |
michael@202 | 346 | ; |
michael@202 | 347 | ; You can use an alternative switch type as well, to resolve |
michael@202 | 348 | ; extensions that are not known here, for example with remote |
michael@202 | 349 | ; IAX switching you transparently get access to the remote |
michael@202 | 350 | ; Asterisk PBX |
michael@202 | 351 | ; |
michael@202 | 352 | ; switch => IAX2/user:password@bigserver/local |
michael@202 | 353 | ; |
michael@202 | 354 | ; An "lswitch" is like a switch but is literal, in that |
michael@202 | 355 | ; variable substitution is not performed at load time |
michael@202 | 356 | ; but is passed to the switch directly (presumably to |
michael@202 | 357 | ; be substituted in the switch routine itself) |
michael@202 | 358 | ; |
michael@202 | 359 | ; lswitch => Loopback/12${EXTEN}@othercontext |
michael@202 | 360 | ; |
michael@202 | 361 | ; An "eswitch" is like a switch but the evaluation of |
michael@202 | 362 | ; variable substitution is performed at runtime before |
michael@202 | 363 | ; being passed to the switch routine. |
michael@202 | 364 | ; |
michael@202 | 365 | ; eswitch => IAX2/context@${CURSERVER} |
michael@202 | 366 | |
michael@202 | 367 | ;[macro-trunkdial] |
michael@202 | 368 | ; |
michael@202 | 369 | ; Standard trunk dial macro (hangs up on a dialstatus that should |
michael@202 | 370 | ; terminate call) |
michael@202 | 371 | ; ${ARG1} - What to dial |
michael@202 | 372 | ; |
michael@202 | 373 | ;exten => s,1,Dial(${ARG1}) |
michael@202 | 374 | ;exten => s,n,Goto(s-${DIALSTATUS},1) |
michael@202 | 375 | ;exten => s-NOANSWER,1,Hangup |
michael@202 | 376 | ;exten => s-BUSY,1,Hangup |
michael@202 | 377 | ;exten => _s-.,1,NoOp |
michael@202 | 378 | |
michael@202 | 379 | ;[macro-stdexten]; |
michael@202 | 380 | ; |
michael@202 | 381 | ; Standard extension macro: |
michael@202 | 382 | ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well |
michael@202 | 383 | ; ${ARG2} - Device(s) to ring |
michael@202 | 384 | ; |
michael@202 | 385 | ;exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum |
michael@202 | 386 | ;exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) |
michael@202 | 387 | |
michael@202 | 388 | ;exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce |
michael@202 | 389 | ;exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start |
michael@202 | 390 | |
michael@202 | 391 | ;exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce |
michael@202 | 392 | ;exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start |
michael@202 | 393 | |
michael@202 | 394 | ;exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer |
michael@202 | 395 | |
michael@202 | 396 | ;exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain |
michael@202 | 397 | |
michael@202 | 398 | ;[macro-stdPrivacyexten]; |
michael@202 | 399 | ; |
michael@202 | 400 | ; Standard extension macro: |
michael@202 | 401 | ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well |
michael@202 | 402 | ; ${ARG2} - Device(s) to ring |
michael@202 | 403 | ; ${ARG3} - Optional DONTCALL context name to jump to (assumes the s,1 extension-priority) |
michael@202 | 404 | ; ${ARG4} - Optional TORTURE context name to jump to (assumes the s,1 extension-priority)` |
michael@202 | 405 | ; |
michael@202 | 406 | ;exten => s,1,Dial(${ARG2},20|p) ; Ring the interface, 20 seconds maximum, call screening |
michael@202 | 407 | ; option (or use P for databased call screening) |
michael@202 | 408 | ;exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER) |
michael@202 | 409 | |
michael@202 | 410 | ;exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce |
michael@202 | 411 | ;exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start |
michael@202 | 412 | |
michael@202 | 413 | ;exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce |
michael@202 | 414 | ;exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start |
michael@202 | 415 | |
michael@202 | 416 | ;exten => s-DONTCALL,1,Goto(${ARG3},s,1) ; Callee chose to send this call to a polite "Don't call again" script. |
michael@202 | 417 | |
michael@202 | 418 | ;exten => s-TORTURE,1,Goto(${ARG4},s,1) ; Callee chose to send this call to a telemarketer torture script. |
michael@202 | 419 | |
michael@202 | 420 | ;exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer |
michael@202 | 421 | |
michael@202 | 422 | ;exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain |
michael@202 | 423 | |
michael@202 | 424 | ;[macro-page]; |
michael@202 | 425 | ; |
michael@202 | 426 | ; Paging macro: |
michael@202 | 427 | ; |
michael@202 | 428 | ; Check to see if SIP device is in use and DO NOT PAGE if they are |
michael@202 | 429 | ; |
michael@202 | 430 | ; ${ARG1} - Device to page |
michael@202 | 431 | |
michael@202 | 432 | ;exten => s,1,ChanIsAvail(${ARG1}|js) ; j is for Jump and s is for ANY call |
michael@202 | 433 | ;exten => s,n,GoToIf([${AVAILSTATUS} = "1"]?autoanswer:fail) |
michael@202 | 434 | ;exten => s,n(autoanswer),Set(_ALERT_INFO="RA") ; This is for the PolyComs |
michael@202 | 435 | ;exten => s,n,SIPAddHeader(Call-Info: Answer-After=0) ; This is for the Grandstream, Snoms, and Others |
michael@202 | 436 | ;exten => s,n,NoOp() ; Add others here and Post on the Wiki!!!! |
michael@202 | 437 | ;exten => s,n,Dial(${ARG1}||) |
michael@202 | 438 | ;exten => s,n(fail),Hangup |
michael@202 | 439 | |
michael@202 | 440 | |
michael@202 | 441 | ;[demo] |
michael@202 | 442 | ; |
michael@202 | 443 | ; We start with what to do when a call first comes in. |
michael@202 | 444 | ; |
michael@202 | 445 | ;exten => s,1,Wait(1) ; Wait a second, just for fun |
michael@202 | 446 | ;exten => s,n,Answer ; Answer the line |
michael@202 | 447 | ;exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds |
michael@202 | 448 | ;exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds |
michael@202 | 449 | ;exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message |
michael@202 | 450 | ;exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions |
michael@202 | 451 | ;exten => s,n,WaitExten ; Wait for an extension to be dialed. |
michael@202 | 452 | |
michael@202 | 453 | ;exten => 2,1,BackGround(demo-moreinfo) ; Give some more information. |
michael@202 | 454 | ;exten => 2,n,Goto(s,instruct) |
michael@202 | 455 | |
michael@202 | 456 | ;exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french |
michael@202 | 457 | ;exten => 3,n,Goto(s,restart) ; Start with the congratulations |
michael@202 | 458 | |
michael@202 | 459 | ;exten => 1000,1,Goto(default,s,1) |
michael@202 | 460 | ; |
michael@202 | 461 | ; We also create an example user, 1234, who is on the console and has |
michael@202 | 462 | ; voicemail, etc. |
michael@202 | 463 | ; |
michael@202 | 464 | ;exten => 1234,1,Playback(transfer,skip) ; "Please hold while..." |
michael@202 | 465 | ; (but skip if channel is not up) |
michael@202 | 466 | ;exten => 1234,n,Macro(stdexten,1234,${GLOBAL(CONSOLE)}) |
michael@202 | 467 | |
michael@202 | 468 | ;exten => 1235,1,Voicemail(1234,u) ; Right to voicemail |
michael@202 | 469 | |
michael@202 | 470 | ;exten => 1236,1,Dial(Console/dsp) ; Ring forever |
michael@202 | 471 | ;exten => 1236,n,Voicemail(1234,b) ; Unless busy |
michael@202 | 472 | |
michael@202 | 473 | ; |
michael@202 | 474 | ; # for when they're done with the demo |
michael@202 | 475 | ; |
michael@202 | 476 | ;exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo" |
michael@202 | 477 | ;exten => #,n,Hangup ; Hang them up. |
michael@202 | 478 | |
michael@202 | 479 | ; |
michael@202 | 480 | ; A timeout and "invalid extension rule" |
michael@202 | 481 | ; |
michael@202 | 482 | ;exten => t,1,Goto(#,1) ; If they take too long, give up |
michael@202 | 483 | ;exten => i,1,Playback(invalid) ; "That's not valid, try again" |
michael@202 | 484 | |
michael@202 | 485 | ; |
michael@202 | 486 | ; Create an extension, 500, for dialing the |
michael@202 | 487 | ; Asterisk demo. |
michael@202 | 488 | ; |
michael@202 | 489 | ;exten => 500,1,Playback(demo-abouttotry); Let them know what's going on |
michael@202 | 490 | ;exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo |
michael@202 | 491 | ;exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site |
michael@202 | 492 | ;exten => 500,n,Goto(s,6) ; Return to the start over message. |
michael@202 | 493 | |
michael@202 | 494 | ; |
michael@202 | 495 | ; Create an extension, 600, for evaluating echo latency. |
michael@202 | 496 | ; |
michael@202 | 497 | ;exten => 600,1,Playback(demo-echotest) ; Let them know what's going on |
michael@202 | 498 | ;exten => 600,n,Echo ; Do the echo test |
michael@202 | 499 | ;exten => 600,n,Playback(demo-echodone) ; Let them know it's over |
michael@202 | 500 | ;exten => 600,n,Goto(s,6) ; Start over |
michael@202 | 501 | |
michael@202 | 502 | ; |
michael@202 | 503 | ; You can use the Macro Page to intercom a individual user |
michael@202 | 504 | ;exten => 76245,1,Macro(page,SIP/Grandstream1) |
michael@202 | 505 | ; or if your peernames are the same as extensions |
michael@202 | 506 | ;exten => _7XXX,1,Macro(page,SIP/${EXTEN}) |
michael@202 | 507 | ; |
michael@202 | 508 | ; |
michael@202 | 509 | ; System Wide Page at extension 7999 |
michael@202 | 510 | ; |
michael@202 | 511 | ;exten => 7999,1,Set(TIMEOUT(absolute)=60) |
michael@202 | 512 | ;exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n|d) |
michael@202 | 513 | |
michael@202 | 514 | ; Give voicemail at extension 8500 |
michael@202 | 515 | ; |
michael@202 | 516 | ;exten => 8500,1,VoicemailMain |
michael@202 | 517 | ;exten => 8500,n,Goto(s,6) |
michael@202 | 518 | ; |
michael@202 | 519 | ; Here's what a phone entry would look like (IXJ for example) |
michael@202 | 520 | ; |
michael@202 | 521 | ;exten => 1265,1,Dial(Phone/phone0,15) |
michael@202 | 522 | ;exten => 1265,n,Goto(s,5) |
michael@202 | 523 | |
michael@202 | 524 | ; |
michael@202 | 525 | ; The page context calls up the page macro that sets variables needed for auto-answer |
michael@202 | 526 | ; It is in is own context to make calling it from the Page() application as simple as |
michael@202 | 527 | ; Local/{peername}@page |
michael@202 | 528 | ; |
michael@202 | 529 | ;[page] |
michael@202 | 530 | ;exten => _X.,1,Macro(page,SIP/${EXTEN}) |
michael@202 | 531 | |
michael@202 | 532 | ;[mainmenu] |
michael@202 | 533 | ; |
michael@202 | 534 | ; Example "main menu" context with submenu |
michael@202 | 535 | ; |
michael@202 | 536 | ;exten => s,1,Answer |
michael@202 | 537 | ;exten => s,n,Background(thanks) ; "Thanks for calling press 1 for sales, 2 for support, ..." |
michael@202 | 538 | ;exten => s,n,WaitExten |
michael@202 | 539 | ;exten => 1,1,Goto(submenu,s,1) |
michael@202 | 540 | ;exten => 2,1,Hangup |
michael@202 | 541 | ;include => default |
michael@202 | 542 | ; |
michael@202 | 543 | ;[submenu] |
michael@202 | 544 | ;exten => s,1,Ringing ; Make them comfortable with 2 seconds of ringback |
michael@202 | 545 | ;exten => s,n,Wait,2 |
michael@202 | 546 | ;exten => s,n,Background(submenuopts) ; "Thanks for calling the sales department. Press 1 for steve, 2 for..." |
michael@202 | 547 | ;exten => s,n,WaitExten |
michael@202 | 548 | ;exten => 1,1,Goto(default,steve,1) |
michael@202 | 549 | ;exten => 2,1,Goto(default,mark,2) |
michael@202 | 550 | |
michael@202 | 551 | ;[default] |
michael@202 | 552 | ; |
michael@202 | 553 | ; By default we include the demo. In a production system, you |
michael@202 | 554 | ; probably don't want to have the demo there. |
michael@202 | 555 | ; |
michael@202 | 556 | ;include => demo |
michael@202 | 557 | |
michael@202 | 558 | ; |
michael@202 | 559 | ; An extension like the one below can be used for FWD, Nikotel, sipgate etc. |
michael@202 | 560 | ; Note that you must have a [sipprovider] section in sip.conf |
michael@202 | 561 | ; |
michael@202 | 562 | ;exten => _41X.,1,Dial(SIP/${EXTEN:2}@sipprovider,,r) |
michael@202 | 563 | |
michael@202 | 564 | ; Real extensions would go here. Generally you want real extensions to be |
michael@202 | 565 | ; 4 or 5 digits long (although there is no such requirement) and start with a |
michael@202 | 566 | ; single digit that is fairly large (like 6 or 7) so that you have plenty of |
michael@202 | 567 | ; room to overlap extensions and menu options without conflict. You can alias |
michael@202 | 568 | ; them with names, too, and use global variables |
michael@202 | 569 | |
michael@202 | 570 | ;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1,Joe Schmoe ; Channel hints for presence |
michael@202 | 571 | ;exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer |
michael@202 | 572 | ;exten => 6245,n(dial),Dial(${HINT},20,rtT) ; Use hint as listed |
michael@202 | 573 | ;exten => 6245,n,Voicemail(6245,u) ; Voicemail (unavailable) |
michael@202 | 574 | ;exten => 6245,s+1,Hangup ; s+1, same as n |
michael@202 | 575 | ;exten => 6245,dial+101,Voicemail(6245,b) ; Voicemail (busy) |
michael@202 | 576 | ;exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit |
michael@202 | 577 | ;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14) |
michael@202 | 578 | ;exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels |
michael@202 | 579 | ;exten => 6391,1,Dial(JINGLE/asterisk@digium.com/mogorman@astjab.org) ;Dial via jingle using asterisk as the transport and calling mogorman. |
michael@202 | 580 | ;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK} |
michael@202 | 581 | |
michael@202 | 582 | ;exten => 6275,1,Macro(stdexten,6275,${MARK}) ; assuming ${MARK} is something like Zap/2 |
michael@202 | 583 | ;exten => mark,1,Goto(6275|1) ; alias mark to 6275 |
michael@202 | 584 | ;exten => 6536,1,Macro(stdexten,6236,${WIL}) ; Ditto for wil |
michael@202 | 585 | ;exten => wil,1,Goto(6236|1) |
michael@202 | 586 | |
michael@202 | 587 | ;If you want to subscribe to the status of a parking space, this is |
michael@202 | 588 | ;how you do it. Subscribe to extension 6600 in sip, and you will see |
michael@202 | 589 | ;the status of the first parking lot with this extensions' help |
michael@202 | 590 | ;exten => 6600,hint,park:701@parkedcalls |
michael@202 | 591 | ;exten => 6600,1,noop |
michael@202 | 592 | ; |
michael@202 | 593 | ; Some other handy things are an extension for checking voicemail via |
michael@202 | 594 | ; voicemailmain |
michael@202 | 595 | ; |
michael@202 | 596 | ;exten => 8500,1,VoicemailMain |
michael@202 | 597 | ;exten => 8500,n,Hangup |
michael@202 | 598 | ; |
michael@202 | 599 | ; Or a conference room (you'll need to edit meetme.conf to enable this room) |
michael@202 | 600 | ; |
michael@202 | 601 | ;exten => 8600,1,Meetme(1234) |
michael@202 | 602 | ; |
michael@202 | 603 | ; Or playing an announcement to the called party, as soon it answers |
michael@202 | 604 | ; |
michael@202 | 605 | ;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg)) |
michael@202 | 606 | ; |
michael@202 | 607 | ; For more information on applications, just type "core show applications" at your |
michael@202 | 608 | ; friendly Asterisk CLI prompt. |
michael@202 | 609 | ; |
michael@202 | 610 | ; "core show application <command>" will show details of how you |
michael@202 | 611 | ; use that particular application in this file, the dial plan. |
michael@202 | 612 | ; "core show functions" will list all dialplan functions |
michael@202 | 613 | ; "core show function <COMMAND>" will show you more information about |
michael@202 | 614 | ; one function. Remember that function names are UPPER CASE. |