openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

index.html (4591B)


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