exten => _XX.,1,GotoIf($["${calledid}" != ""]?3) or exten => _XX.,1,GotoIf($[foo${calledid} != foo]?3)
The second example above is the way suggested by the WIKI. It will work as long as there are no spaces in the evaluated value.
The first way should work in all cases, and indeed, might now be the safest way to handle this situation.