[Home]

Summary:ASTERISK-05300: [patch] GotoIf() evaluates wrong
Reporter:tgj (tgj)Labels:
Date Opened:2005-10-16 12:23:35Date Closed:2011-06-07 14:10:18
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20051017__better_truth.diff.txt
Description:exten => 1,1,gotoif($[abc]?true:false); Will goto false
exten => 1,1,gotoif($[878]?true:false); Will goto true

I think that is wrong. This is what the file README.variables says:

"condition" is just a string. If the string is empty or "0", the condition
is considered to be false, if it's anything else, the condition is true.

Comments:By: Tilghman Lesher (tilghman) 2005-10-16 21:37:17

$[] is arithmetic (or logical) evaluation.  Try $["abc" = "abc"] or just:

GotoIf(abc?true:false)

By: tgj (tgj) 2005-10-17 09:14:37

I tried this:

exten => 999,1,GotoIf(abc?a:b)
exten => 999,n(a),Noop(a)
exten => 999,n(b),Noop(b)

result: false and jumps to (b) - is that correct behaviour?

By: Tilghman Lesher (tilghman) 2005-10-17 11:55:52

Patch uploaded.  Disclaimer on file.

By: tgj (tgj) 2005-10-18 03:00:35

The patch works - thank you very much

By: Serge Vecher (serge-v) 2005-10-18 13:55:20

looks like markster has committed this one already.