if

Definition

The contents within this tag will execute if the variable value is equal to the result of the expression.

Value

The contents within this tag are more nodes to execute. This tag can also contain an "else" tag.

Attributes

Attribute Required Values Description
name N any text A unique name for the tag
expr Y any text A JavaScript expression to evaluate. Examples = " '${call.lastinput}' + ' 2 3'" or "1+2" or "${call.lastinput} + 10"

Examples

In the example below, the system will play

"Sorry we couldn't find you" and then will jump to the tag named "enter-id" only if the expression (1+45 / 50) > ${call.lastinput} equals false.

and play

"Hello ${call.callerid}. You have 12 credits left. Oh wait ${call.callerid}. You have 11 credits left. I'm sorry I was mistaken ${call.callerid}. You have 10 credits left. "

if the expression evaluates to true.


    
        Hello ${call.callerid}. You have 12 credits left.
    
    
        Oh wait ${call.callerid}. You have 11 credits left.
    
    
        I'm sorry I was mistaken ${call.callerid}.
        You have 10 credits left.
    


    Sorry, we couldn't find you.

enter_id

The following example compares two strings in the if statement. All strings should be inside a single quote.


    Hello ${call.callerid}. 
        You have 12 credits left.
    
    
        Oh wait ${call.callerid}. You have 11 credits left.
    
    
         Sorry we couldn't find you!
        
        enter_id