extensions.conf.sample 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. ;
  2. ; Static extension configuration file, used by
  3. ; the pbx_config module. This is where you configure all your
  4. ; inbound and outbound calls in Asterisk.
  5. ;
  6. ; This configuration file is reloaded
  7. ; - With the "extensions reload" command in the CLI
  8. ; - With the "reload" command (that reloads everything) in the CLI
  9. ;
  10. ; The "General" category is for certain variables.
  11. ;
  12. [general]
  13. ;
  14. ; If static is set to no, or omitted, then the pbx_config will rewrite
  15. ; this file when extensions are modified. Remember that all comments
  16. ; made in the file will be lost when that happens.
  17. ;
  18. ; XXX Not yet implemented XXX
  19. ;
  20. static=yes
  21. ;
  22. ; if static=yes and writeprotect=no, you can save dialplan by
  23. ; CLI command 'save dialplan' too
  24. ;
  25. writeprotect=no
  26. ; You can include other config files, use the #include command (without the ';')
  27. ; Note that this is different from the "include" command that includes contexts within
  28. ; other contexts. The #include command works in all asterisk configuration files.
  29. ;#include "filename.conf"
  30. ; The "Globals" category contains global variables that can be referenced
  31. ; in the dialplan with ${VARIABLE} or ${ENV(VARIABLE)} for Environmental variable
  32. ; ${${VARIABLE}} or ${text${VARIABLE}} or any hybrid
  33. ;
  34. [globals]
  35. CONSOLE=Console/dsp ; Console interface for demo
  36. ;CONSOLE=Zap/1
  37. ;CONSOLE=Phone/phone0
  38. IAXINFO=guest ; IAXtel username/password
  39. ;IAXINFO=myuser:mypass
  40. TRUNK=Zap/g2 ; Trunk interface
  41. ;
  42. ; Note the 'g2' in the TRUNK variable above. It specifies which group (defined
  43. ; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
  44. ; the specified group. The four possible options are:
  45. ;
  46. ; g: select the lowest-numbered non-busy Zap channel (aka. ascending sequential hunt group).
  47. ; G: select the highest-numbered non-busy Zap channel (aka. descending sequential hunt group).
  48. ; r: use a round-robin search, starting at the next highest channel than last time (aka. ascending rotary hunt group).
  49. ; R: use a round-robin search, starting at the next lowest channel than last time (aka. descending rotary hunt group).
  50. ;
  51. TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
  52. ;TRUNK=IAX2/user:pass@provider
  53. ;
  54. ; Any category other than "General" and "Globals" represent
  55. ; extension contexts, which are collections of extensions.
  56. ;
  57. ; Extension names may be numbers, letters, or combinations
  58. ; thereof. If an extension name is prefixed by a '_'
  59. ; character, it is interpreted as a pattern rather than a
  60. ; literal. In patterns, some characters have special meanings:
  61. ;
  62. ; X - any digit from 0-9
  63. ; Z - any digit from 1-9
  64. ; N - any digit from 2-9
  65. ; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
  66. ; . - wildcard, matches anything remaining (e.g. _9011. matches
  67. ; anything starting with 9011 excluding 9011 itself)
  68. ;
  69. ; For example the extension _NXXXXXX would match normal 7 digit dialings,
  70. ; while _1NXXNXXXXXX would represent an area code plus phone number
  71. ; preceeded by a one.
  72. ;
  73. ; Each step of an extension is ordered by priority, which must
  74. ; always start with 1 to be considered a valid extension.
  75. ;
  76. ; Contexts contain several lines, one for each step of each
  77. ; extension, which can take one of two forms as listed below,
  78. ; with the first form being preferred. One may include another
  79. ; context in the current one as well, optionally with a
  80. ; date and time. Included contexts are included in the order
  81. ; they are listed.
  82. ;
  83. ;[context]
  84. ;exten => someexten,priority,application(arg1,arg2,...)
  85. ;exten => someexten,priority,application,arg1|arg2...
  86. ;
  87. ; Timing list for includes is
  88. ;
  89. ; <time range>|<days of week>|<days of month>|<months>
  90. ;
  91. ;include => daytime|9:00-17:00|mon-fri|*|*
  92. ;
  93. ; ignorepat can be used to instruct drivers to not cancel dialtone upon
  94. ; receipt of a particular pattern. The most commonly used example is
  95. ; of course '9' like this:
  96. ;
  97. ;ignorepat => 9
  98. ;
  99. ; so that dialtone remains even after dialing a 9.
  100. ;
  101. ;
  102. ; Here are the entries you need to participate in the IAXTEL
  103. ; call routing system. Most IAXTEL numbers begin with 1-700, but
  104. ; there are exceptions. For more information, and to sign
  105. ; up, please go to www.gnophone.com or www.iaxtel.com
  106. ;
  107. [iaxtel700]
  108. exten => _91700XXXXXXX,1,Dial(IAX2/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel)
  109. ;
  110. ; The SWITCH statement permits a server to share the dialplain with
  111. ; another server. Use with care: Reciprocal switch statements are not
  112. ; allowed (e.g. both A -> B and B -> A), and the switched server needs
  113. ; to be on-line or else dialing can be severly delayed.
  114. ;
  115. [iaxprovider]
  116. ;switch => IAX2/user:[key]@myserver/mycontext
  117. [trunkint]
  118. ;
  119. ; International long distance through trunk
  120. ;
  121. exten => _9011.,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
  122. exten => _9011.,2,Congestion
  123. [trunkld]
  124. ;
  125. ; Long distance context accessed through trunk
  126. ;
  127. exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
  128. exten => _91NXXNXXXXXX,2,Congestion
  129. [trunklocal]
  130. ;
  131. ; Local seven-digit dialing accessed through trunk interface
  132. ;
  133. exten => _9NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
  134. exten => _9NXXXXXX,2,Congestion
  135. [trunktollfree]
  136. ;
  137. ; Long distance context accessed through trunk interface
  138. ;
  139. exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
  140. exten => _91800NXXXXXX,2,Congestion
  141. exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
  142. exten => _91888NXXXXXX,2,Congestion
  143. exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
  144. exten => _91877NXXXXXX,2,Congestion
  145. exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
  146. exten => _91866NXXXXXX,2,Congestion
  147. [international]
  148. ;
  149. ; Master context for international long distance
  150. ;
  151. ignorepat => 9
  152. include => longdistance
  153. include => trunkint
  154. [longdistance]
  155. ;
  156. ; Master context for long distance
  157. ;
  158. ignorepat => 9
  159. include => local
  160. include => trunkld
  161. [local]
  162. ;
  163. ; Master context for local, toll-free, and iaxtel calls only
  164. ;
  165. ignorepat => 9
  166. include => default
  167. include => parkedcalls
  168. include => trunklocal
  169. include => iaxtel700
  170. include => trunktollfree
  171. include => iaxprovider
  172. ;
  173. ; You can use an alternative switch type as well, to resolve
  174. ; extensions that are not known here, for example with remote
  175. ; IAX switching you transparently get access to the remote
  176. ; Asterisk PBX
  177. ;
  178. ; switch => IAX2/user:password@bigserver/local
  179. [macro-stdexten];
  180. ;
  181. ; Standard extension macro:
  182. ; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
  183. ; ${ARG2} - Device(s) to ring
  184. ;
  185. exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
  186. exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
  187. exten => s-NOANSWER,1,Voicemail(u${ARG1}) ; If unavailable, send to voicemail w/ unavail announce
  188. exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start
  189. exten => s-BUSY,1,Voicemail(b${ARG1}) ; If busy, send to voicemail w/ busy announce
  190. exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
  191. exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
  192. exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain
  193. [demo]
  194. ;
  195. ; We start with what to do when a call first comes in.
  196. ;
  197. exten => s,1,Wait,1 ; Wait a second, just for fun
  198. exten => s,2,Answer ; Answer the line
  199. exten => s,3,DigitTimeout,5 ; Set Digit Timeout to 5 seconds
  200. exten => s,4,ResponseTimeout,10 ; Set Response Timeout to 10 seconds
  201. exten => s,5,BackGround(demo-congrats) ; Play a congratulatory message
  202. exten => s,6,BackGround(demo-instruct) ; Play some instructions
  203. exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
  204. exten => 2,2,Goto(s,6)
  205. exten => 3,1,SetLanguage(fr) ; Set language to french
  206. exten => 3,2,Goto(s,5) ; Start with the congratulations
  207. exten => 1000,1,Goto(default,s,1)
  208. ;
  209. ; We also create an example user, 1234, who is on the console and has
  210. ; voicemail, etc.
  211. ;
  212. exten => 1234,1,Playback(transfer,skip) ; "Please hold while..."
  213. ; (but skip if channel is not up)
  214. exten => 1234,2,Macro(stdexten,1234,${CONSOLE})
  215. exten => 1235,1,Voicemail(u1234) ; Right to voicemail
  216. exten => 1236,1,Dial(Console/dsp) ; Ring forever
  217. exten => 1236,2,Voicemail(u1234) ; Unless busy
  218. ;
  219. ; # for when they're done with the demo
  220. ;
  221. exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
  222. exten => #,2,Hangup ; Hang them up.
  223. ;
  224. ; A timeout and "invalid extension rule"
  225. ;
  226. exten => t,1,Goto(#,1) ; If they take too long, give up
  227. exten => i,1,Playback(invalid) ; "That's not valid, try again"
  228. ;
  229. ; Create an extension, 500, for dialing the
  230. ; Asterisk demo.
  231. ;
  232. exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
  233. exten => 500,2,Dial(IAX2/guest@misery.digium.com/s@default) ; Call the Asterisk demo
  234. exten => 500,3,Playback(demo-nogo) ; Couldn't connect to the demo site
  235. exten => 500,4,Goto(s,6) ; Return to the start over message.
  236. ;
  237. ; Create an extension, 600, for evaulating echo latency.
  238. ;
  239. exten => 600,1,Playback(demo-echotest) ; Let them know what's going on
  240. exten => 600,2,Echo ; Do the echo test
  241. exten => 600,3,Playback(demo-echodone) ; Let them know it's over
  242. exten => 600,4,Goto(s,6) ; Start over
  243. ;
  244. ; Give voicemail at extension 8500
  245. ;
  246. exten => 8500,1,VoicemailMain
  247. exten => 8500,2,Goto(s,6)
  248. ;
  249. ; Here's what a phone entry would look like (IXJ for example)
  250. ;
  251. ;exten => 1265,1,Dial(Phone/phone0,15)
  252. ;exten => 1265,2,Goto(s,5)
  253. ;[mainmenu]
  254. ;
  255. ; Example "main menu" context with submenu
  256. ;
  257. ;exten => s,1,Answer
  258. ;exten => s,2,Background(thanks) ; "Thanks for calling press 1 for sales, 2 for support, ..."
  259. ;exten => 1,1,Goto(submenu,s,1)
  260. ;exten => 2,1,Hangup
  261. ;include => default
  262. ;
  263. ;[submenu]
  264. ;exten => s,1,Ringing ; Make them comfortable with 2 seconds of ringback
  265. ;exten => s,2,Wait,2
  266. ;exten => s,3,Background(submenuopts) ; "Thanks for calling the sales department. Press 1 for steve, 2 for..."
  267. ;exten => 1,1,Goto(default,steve,1)
  268. ;exten => 2,1,Goto(default,mark,2)
  269. [default]
  270. ;
  271. ; By default we include the demo. In a production system, you
  272. ; probably don't want to have the demo there.
  273. ;
  274. include => demo
  275. ;
  276. ; Extensions like the two below can be used for FWD, Nikotel, sipgate etc.
  277. ; Note that you must have a [sipprovider] section in sip.conf whereas
  278. ; the otherprovider.net example does not require such a peer definition
  279. ;
  280. ;exten => _41X.,1,Dial(SIP/${EXTEN:2}@sipprovider,,r)
  281. ;exten => _42X.,1,Dial(SIP/user:passwd@${EXTEN:2}@otherprovider.net,30,rT)
  282. ; Real extensions would go here. Generally you want real extensions to be 4 or 5
  283. ; digits long (although there is no such requirement) and start with a single
  284. ; digit that is fairly large (like 6 or 7) so that you have plenty of room to
  285. ; overlap extensions and menu options without conflict. You can alias them with
  286. ; names, too and use global variables
  287. ;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1 ; Channel hints for presence
  288. ;exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer
  289. ;exten => 6245,1,Dial(${HINT},20,rtT) ; Use hint as listed
  290. ;exten => 6361,1,Dial(IAX2/JaneDoe,,rm) ; ring without time limit
  291. ;exten => 6389,1,Dial(MGCP/aaln/1@192.168.0.14)
  292. ;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK}
  293. ;exten => 6275,1,Macro(stdexten,6275,${MARK}) ; assuming ${MARK} is something like Zap/2
  294. ;exten => mark,1,Goto(6275|1) ; alias mark to 6275
  295. ;exten => 6536,1,Macro(stdexten,6236,${WIL}) ; Ditto for wil
  296. ;exten => wil,1,Goto(6236|1)
  297. ;
  298. ; Some other handy things are an extension for checking voicemail via
  299. ; voicemailmain
  300. ;
  301. ;exten => 8500,1,VoicemailMain
  302. ;exten => 8500,2,Hangup
  303. ;
  304. ; Or a conference room (you'll need to edit meetme.conf to enable this room)
  305. ;
  306. ;exten => 8600,1,Meetme(1234)
  307. ;
  308. ; Or playing an announcement to the called party, as soon it answers
  309. ;
  310. ;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
  311. ;
  312. ; For more information on applications, just type "show applications" at your
  313. ; friendly Asterisk CLI prompt.
  314. ;
  315. ; 'show application <command>' will show details of how you
  316. ; use that particular application in this file, the dial plan.
  317. ;