[asterisk-users] Gotoif Question

Barry Miller asterisk-users at notanet.net
Thu Feb 4 10:45:47 CST 2010


I think the quotes cause the values to be compared as strings, not
numbers.  The old shell programmer's trick (which allows for empty
strings):

exten => s,n,GotoIf($[0${SPEECH_SCORE(0)} <= 0${THRESHOLD}]?:tag)

ought to cause a numeric comparison.

-- 
Barry

On Thu, Feb 04, 2010 at 09:42:18AM -0600, Danny Nicholas wrote:
> Hi Gang,
> 
>              I'm working on a lumenvox app and am having "fun" with the
> Gotoif's on speech/DTMF recognition.  If you're using DTMF to enter a number
> instead of speech to enter a numeric value, the engine will often return a
> "confidence score" of 1000 instead of 1-999.  Therefore this Gotoif fails:
> 
> exten => s,n,GotoIf($["${SPEECH_SCORE(0)}" <= "${THRESHOLD}"]?:tag)
> 
>  
> 
> ${THRESHOLD} was set to 850.
> 
> If SPEECH_SCORE(0) <= 850 (1-850) fails
> 
> 851-999 succeeds
> 
> 1000 fails
> 
>  
> 
> My workaround was this:
> 
> exten => s,n,GotoIf($["${SPEECH_SCORE(0)}" = "1000"]?tag)
> 
> exten => s,n,GotoIf($["${SPEECH_SCORE(0)}" <= "${THRESHOLD}"]?:tag)
> 
>  
> 
> Is there a better way than using to Gotoif's per evaluation?
> 
>  
> 
> Regards,
> 
>  
> 
> Danny Nicholas
> 
>  
> 

> -- 
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list