Source SyntaxThe only thing that changes from the Asterisk syntax is the way you mark extensions, contexts, and the references to lines in the same extension, a different extension in the same context, or a different extension in another context. Currently, the DPC only supports references to lines in the same file. Basic SyntaxTo indicate an extension, use the format After that, just type your dialplan code, without the Whenever you have a Now, if you have a reference to another line, in that line you need to indicate the label,
by prefixing it with the label indicator ExampleHere's an example of a simple file in the format for the Dial Plan Compiler. Labels and references are marked in red, while extension headers are marked in blue. X:example:501 ; some comment for the extension SetVariable(value=10) Answer L:enter-pin:Read(pin,enter-pin,4) GotoIf($["${pin}" = "1234"]?(L:ok)) ; goto label "ok" playback(incorrect-pin) Goto((L:enter-pin)) L:ok:playback(ok) Goto((L:number:599)) Hangup X:example:599 NoOp(The password was correct) L:number:Read(number,enter-number,7) Dial(SIP/${number},20,t) The compiler will transform the above code into this Asterisk dial plan code: [example] ; some comment for the extension exten => 501,1,SetVariable(value=10) exten => 501,2,Answer exten => 501,3,Read(pin,enter-pin,4) exten => 501,4,GotoIf($["${pin}" = "1234"]?7) ; goto label "ok" exten => 501,5,playback(incorrect-pin) exten => 501,6,Goto(3) exten => 501,7,playback(ok) exten => 501,8,Goto(599,2) exten => 501,9,Hangup exten => 599,1,NoOp(The password was correct) exten => 599,2,Read(number,enter-number,7) exten => 599,3,Dial(SIP/${number},20,t) |
|