1 ; Sample Asterisk configuration
2 ; To use, include this dialplan in your extensions.conf file and dialplan reload.
3 ; Note the explicitly numbered line sequences. This makes it hard to edit or
4 ; and new lines. Remember to preserve sequentiality and Goto integrity.
8 ; First the ${ ... } variables and functions are evaluated and substituted.
9 ; Then the $[ ... ] expressions are evaluated and substituted.
12 exten => s,1,Verbose(titlestring: ${titlestring})
14 ; exten => s,n,Set(LOOP=${IF($[foo${x} = "foo"]?1:0${LOOP})}) ; [${foo${LOOP} = "foo"}?1:0${LOOP}]) ; Buggy trinary ops
15 exten => s,n,Set(LOOP=0${LOOP}) ; Default will be zero if undefined
16 exten => s,n,Verbose(LOOP top: ${LOOP})
18 exten => s,10,Wait(1) ; The beginning of loop.
19 exten => s,11,Playback(sample-greeting)
20 exten => s,12,SayDigits(${items})
21 exten => s,13,GotoIf($[0${items} > 1]?20:30) ; spaces are important here
22 exten => s,20,Playback(sample-overdue-plural)
23 exten => s,21,Festival(Your items titles are)
24 exten => s,22,Goto(40)
25 exten => s,30,Playback(sample-overdue-singular)
26 exten => s,31,Festival(The title is)
27 exten => s,32,Goto(40)
29 exten => s,41,Festival(${titlestring})
31 ;exten => s,43,Festival(Return these items or else.)
32 exten => s,43,Playback(sample-thanks)
33 exten => s,44,Set(LOOP=$[${LOOP}-1]) ; LOOP decrements
34 exten => s,45,Verbose(LOOP bottom: ${LOOP})
35 exten => s,46,GotoIf($[0${LOOP} >= 0]?10:48) ; spaces are important here, we loop on zero because we already did decrement
36 ; exten => s,47,Verbose(REASON: ${REASON})
37 exten => s,48,Hangup()
39 exten => failed,1,Verbose(FAILED REASON: ${REASON})
40 exten => failed,n,Verbose(CALLFILENAME: ${CALLFILENAME})