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>
10 .CodeMirror {border: 1px solid #999;}
11 .cm-s-default span.cm-arrow { color: red; }
13 <link rel="stylesheet" href="../../doc/docs.css">
16 <h1>CodeMirror: Asterisk dialplan mode</h1>
17 <form><textarea id="code" name="code">
18 ; extensions.conf - the Asterisk dial plan
23 ; If static is set to no, or omitted, then the pbx_config will rewrite
24 ; this file when extensions are modified. Remember that all comments
25 ; made in the file will be lost when that happens.
28 #include "/etc/asterisk/additional_general.conf
31 switch => IAX2/user:[key]@myserver/mycontext
34 #exec /usr/bin/dynamic-peers.pl
38 ; International long distance through trunk
40 exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
41 exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
45 ; Master context for local, toll-free, and iaxtel calls only
53 ; We start with what to do when a call first comes in.
55 exten => s,1,Wait(1) ; Wait a second, just for fun
56 same => n,Answer ; Answer the line
57 same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
58 same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
59 same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message
60 same => n(instruct),BackGround(demo-instruct) ; Play some instructions
61 same => n,WaitExten ; Wait for an extension to be dialed.
63 exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
64 exten => 2,n,Goto(s,instruct)
66 exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
67 exten => 3,n,Goto(s,restart) ; Start with the congratulations
69 exten => 1000,1,Goto(default,s,1)
71 ; We also create an example user, 1234, who is on the console and has
74 exten => 1234,1,Playback(transfer,skip) ; "Please hold while..."
75 ; (but skip if channel is not up)
76 exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
77 exten => 1234,n,Goto(default,s,1) ; exited Voicemail
79 exten => 1235,1,Voicemail(1234,u) ; Right to voicemail
81 exten => 1236,1,Dial(Console/dsp) ; Ring forever
82 exten => 1236,n,Voicemail(1234,b) ; Unless busy
85 ; # for when they're done with the demo
87 exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
88 exten => #,n,Hangup ; Hang them up.
91 ; A timeout and "invalid extension rule"
93 exten => t,1,Goto(#,1) ; If they take too long, give up
94 exten => i,1,Playback(invalid) ; "That's not valid, try again"
97 ; Create an extension, 500, for dialing the
100 exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
101 exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default) ; Call the Asterisk demo
102 exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site
103 exten => 500,n,Goto(s,6) ; Return to the start over message.
106 ; Create an extension, 600, for evaluating echo latency.
108 exten => 600,1,Playback(demo-echotest) ; Let them know what's going on
109 exten => 600,n,Echo ; Do the echo test
110 exten => 600,n,Playback(demo-echodone) ; Let them know it's over
111 exten => 600,n,Goto(s,6) ; Start over
114 ; You can use the Macro Page to intercom a individual user
115 exten => 76245,1,Macro(page,SIP/Grandstream1)
116 ; or if your peernames are the same as extensions
117 exten => _7XXX,1,Macro(page,SIP/${EXTEN})
120 ; System Wide Page at extension 7999
122 exten => 7999,1,Set(TIMEOUT(absolute)=60)
123 exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n,d)
125 ; Give voicemail at extension 8500
127 exten => 8500,1,VoicemailMain
128 exten => 8500,n,Goto(s,6)
132 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
133 mode: "text/x-asterisk",
139 <p><strong>MIME types defined:</strong> <code>text/x-asterisk</code>.</p>