asterisk/pbx/ael/ael-test/ref.ael-vtest17
Steve Murphy 3ffa04bbd3 Merged revisions 84511 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r84511 | murf | 2007-10-03 08:23:00 -0600 (Wed, 03 Oct 2007) | 1 line

closes issue #10834 ; where a null input to a switch statement results in a hangup; since switch is implemented with extensions, and the default case is implemented with a '.', and the '.' matches 1 or more remaining characters, the case where 0 characters exist isn't matched, and the extension isn't matched, and the goto fails, and a hangup occurs. Now, when a default case is generated, it also generates a single fixed extension that will match a null input. That extension just does a goto to the default extension for that switch. I played with an alternate solution, where I just tack an extra char onto all the patterns and the goto, but not the default case's pattern. Then even a null input will still have at least one char in it. But it made me nervous, having that extra char in , even if that's a pretty secret and low-level issue.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@84512 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-03 14:39:05 +00:00

70 lines
1.9 KiB
Text

[dialextens]
exten => _10X,1,Dial(Zap/${EXTEN:2}\,30\,tw)
exten => _1ZX,1,Dial(Zap/${EXTEN:1}\,30\,tw)
[dialthrus]
exten => _3XX,1,Dial(Zap/${EXTEN:1}\,30\,tw)
[t1incoming]
include => dialextens
include => parkedcalls
exten => s,1,Answer()
exten => s,2,Background(welcome-to-test-machine)
[incoming]
include => dialextens
include => parkedcalls
exten => s,1,Answer()
exten => s,2,Background(welcome-to-test-machine)
[extension]
include => dialextens
include => dialthrus
exten => 5,1,Record(recording:gsm)
exten => 5,2,Background(recording)
exten => 81,1,Set(iterations=$[1000000])
exten => 81,2,Set(time1=${EPOCH})
exten => 81,3,Set(i=$[1])
exten => 81,4,GotoIf($[${i}<${iterations}]?5:8)
exten => 81,5,NoOp(Hello)
exten => 81,6,Set(i=$[${i}+1])
exten => 81,7,Goto(4)
exten => 81,8,NoOp(Finish for-extension-1)
exten => 81,9,Set(time2=${EPOCH})
exten => 81,10,Verbose(The time diff is $[${time2} - ${time1} ] seconds)
exten => 81,11,Verbose(Which means that the priorities/sec = $[4* ${iterations} / (${time2} - ${time1}) ])
exten => 81,12,SayNumber($[4 * ${iterations} / (${time2} - ${time1}) ])
exten => 82,1,Gosub(ndeep\,s\,1(100000))
exten => 82,2,Verbose(Finished 100000 levels deep call!)
exten => 83,1,Goto(sw-2-${EXTEN}\,10)
exten => 83,2,NoOp(Finish switch-extension-2)
exten => _sw-2-.,10,Goto(83\,2)
exten => sw-2-,10,Goto(sw-2-.|10)
exten => _sw-2-[4-7]X,10,Verbose(and this too!)
exten => _sw-2-[4-7]X,11,Goto(sw-2-.\,10)
exten => _sw-2-9X,10,Verbose(handle both 8x and 9x calls)
exten => _sw-2-9X,11,Goto(sw-2-49\,10)
exten => _sw-2-8X,10,Verbose(do something to prepare it)
exten => _sw-2-8X,11,Goto(sw-2-99\,10)
[ndeep]
exten => s,1,Set(LOCAL(level)=${ARG1})
exten => s,2,GotoIf($[${level} == 0]?3:5)
exten => s,3,Verbose(2|Got to Level 0)
exten => s,4,Return()
exten => s,5,NoOp(Finish if-ndeep-3)
exten => s,6,Gosub(ndeep\,s\,1($[${level}-1]))
exten => s,7,Return()
[t1extension]
include => dialextens
include => dialthrus