Can't you use the inline statement to set a variable so that it can be used directly in a condition? http://wiki.freeswitch.org/wiki/Dialplan_XML#Inline_Actions