Set/Gotoif in Asterisk 1.8

Can anyone help get the following example working in Asterisk 1.8?

exten => i,1,Set(NUMINVALID=$[${NUMINVALID}+1]})
exten => i,2,Gotoif($["${NUMINVALID}" < "4"]?:10)
exten => i,3,Background(invalid)
exten => i,4,Goto(s,3)
exten => i,10,Playback(vm-goodbye)
exten => i,11,Hangup()

My problem appears that the Set command. I’ve also tried debugging by using NoOp but they never display onto the console either. The error on the console is:

}ast_yyerror(): syntax error: syntax error, unexpected '+', expecting $end; Input: }+1 ^

I use this on a system…

exten => i,n,Set(KTR=${MATH(${KTR}+1)})
exten => s,n,Set(KTR=2)
exten => s,n,SayDigits(${KTR})

Plays back “2” as expected

exten => s,n,Set(KTR=2)
exten => s,n,Set(KTR=${KTR}+1})
exten => s,n,SayDigits(${KTR})

Plays back “2,1”… it has concatenated the strings.

exten => s,n,Set(KTR=2)
exten => s,n,Set(KTR=${MATH(${KTR}+1)})
exten => s,n,SayDigits(${KTR})

Plays back “3,0,0,0,0,0,0,0” ?!?

Any further ideas? Is this Asterisk 1.8 or something within my system that is broken?

default of the MATH function is float…so you would get bunch of zeros…

add ,int to the line to only get an integer value returned.

Hi, a { is missing.

exten => i,1,Set(NUMINVALID=${[${NUMINVALID}+1]})