1
0

index.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Asterisk dialplan mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="asterisk.js"></script>
  9. <style>
  10. .CodeMirror {border: 1px solid #999;}
  11. .cm-s-default span.cm-arrow { color: red; }
  12. </style>
  13. <link rel="stylesheet" href="../../doc/docs.css">
  14. </head>
  15. <body>
  16. <h1>CodeMirror: Asterisk dialplan mode</h1>
  17. <form><textarea id="code" name="code">
  18. ; extensions.conf - the Asterisk dial plan
  19. ;
  20. [general]
  21. ;
  22. ; If static is set to no, or omitted, then the pbx_config will rewrite
  23. ; this file when extensions are modified. Remember that all comments
  24. ; made in the file will be lost when that happens.
  25. static=yes
  26. #include "/etc/asterisk/additional_general.conf
  27. [iaxprovider]
  28. switch => IAX2/user:[key]@myserver/mycontext
  29. [dynamic]
  30. #exec /usr/bin/dynamic-peers.pl
  31. [trunkint]
  32. ;
  33. ; International long distance through trunk
  34. ;
  35. exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
  36. exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
  37. [local]
  38. ;
  39. ; Master context for local, toll-free, and iaxtel calls only
  40. ;
  41. ignorepat => 9
  42. include => default
  43. [demo]
  44. include => stdexten
  45. ;
  46. ; We start with what to do when a call first comes in.
  47. ;
  48. exten => s,1,Wait(1) ; Wait a second, just for fun
  49. same => n,Answer ; Answer the line
  50. same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
  51. same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
  52. same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message
  53. same => n(instruct),BackGround(demo-instruct) ; Play some instructions
  54. same => n,WaitExten ; Wait for an extension to be dialed.
  55. exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
  56. exten => 2,n,Goto(s,instruct)
  57. exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
  58. exten => 3,n,Goto(s,restart) ; Start with the congratulations
  59. exten => 1000,1,Goto(default,s,1)
  60. ;
  61. ; We also create an example user, 1234, who is on the console and has
  62. ; voicemail, etc.
  63. ;
  64. exten => 1234,1,Playback(transfer,skip) ; "Please hold while..."
  65. ; (but skip if channel is not up)
  66. exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
  67. exten => 1234,n,Goto(default,s,1) ; exited Voicemail
  68. exten => 1235,1,Voicemail(1234,u) ; Right to voicemail
  69. exten => 1236,1,Dial(Console/dsp) ; Ring forever
  70. exten => 1236,n,Voicemail(1234,b) ; Unless busy
  71. ;
  72. ; # for when they're done with the demo
  73. ;
  74. exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
  75. exten => #,n,Hangup ; Hang them up.
  76. ;
  77. ; A timeout and "invalid extension rule"
  78. ;
  79. exten => t,1,Goto(#,1) ; If they take too long, give up
  80. exten => i,1,Playback(invalid) ; "That's not valid, try again"
  81. ;
  82. ; Create an extension, 500, for dialing the
  83. ; Asterisk demo.
  84. ;
  85. exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
  86. exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo
  87. exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site
  88. exten => 500,n,Goto(s,6) ; Return to the start over message.
  89. ;
  90. ; Create an extension, 600, for evaluating echo latency.
  91. ;
  92. exten => 600,1,Playback(demo-echotest) ; Let them know what's going on
  93. exten => 600,n,Echo ; Do the echo test
  94. exten => 600,n,Playback(demo-echodone) ; Let them know it's over
  95. exten => 600,n,Goto(s,6) ; Start over
  96. ;
  97. ; You can use the Macro Page to intercom a individual user
  98. exten => 76245,1,Macro(page,SIP/Grandstream1)
  99. ; or if your peernames are the same as extensions
  100. exten => _7XXX,1,Macro(page,SIP/${EXTEN})
  101. ;
  102. ;
  103. ; System Wide Page at extension 7999
  104. ;
  105. exten => 7999,1,Set(TIMEOUT(absolute)=60)
  106. exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n,d)
  107. ; Give voicemail at extension 8500
  108. ;
  109. exten => 8500,1,VoicemailMain
  110. exten => 8500,n,Goto(s,6)
  111. </textarea></form>
  112. <script>
  113. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  114. mode: "text/x-asterisk",
  115. matchBrackets: true,
  116. lineNumber: true
  117. });
  118. </script>
  119. <p><strong>MIME types defined:</strong> <code>text/x-asterisk</code>.</p>
  120. </body>
  121. </html>