Human filter using simple math

I am trying to implement a simple math question to see if that stops the robot from calling …
this is what I was thinking …
announcement asking to input the answer to a simple math question …
this is all modeled on the great advice on a post from lgaetz

exten => s,1,Noop
exten => s,n,Answer
exten => s,n,Set(Count=0)
exten => s,n,Set(i=${RAND(0,7))

“Audio recording that says +”

exten => s,n,Set(j=${RAND(0,7))

exten => s,n,set(goal=${MATH(i+j)})

exten => s,n,Read(dtmf-in,{LEN({goal})},10)

exten => s,n,execif(["{dtmf-in}"="${goal}"]?Return)

exten => s,n,Set(Count=[{Count}+1])
exten => s,n,gotoif(["{Count}"=“3”]?finish)
exten => s,n,Playback(no_worries_try_again)
exten => s,n,goto(restart)
exten => s,n(finish),hangup

I can’t seem to make the Math func work … any help would be much appreciated !!

“j” is not a number. You need to de-reference.

I’m not sure what ${MATH()} gives you over $[...].

I don’t understand what you mean …could you be a little more specific ?

j is a letter ${j} might be a number.

… can be a compound expression, not just a single operator one.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.