If tag
Definition
- The contents within this tag will execute if the variable value is equal to the result of the expression.
This tag supports CallFire XML Javascript
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 | N | 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.
<if expr="1+45 / 50 + ${call.lastinput} == 10">
<play type="tts"
voice="male1">
Hello ${call.callerid}. You have 12 credits left.
</play>
<play type="tts"
voice="male1">
Oh wait ${call.callerid}. You have 11 credits left.
</play>
<play type="tts"
voice="male1">
I'm sorry I was mistaken ${call.callerid}.
You have 10 credits left.
</play>
</if>
The following example compares two strings in the if statement. All strings should be inside a single quote.
<if expr="'${myVariableName}' == 'success'">
<play type="tts"
voice="male1">Hello ${call.callerid}.
You have 12 credits left.
</play>
<play type="tts"
voice="male1">
Oh wait ${call.callerid}. You have 11 credits left.
</play>
<else>
<play type="tts"> Sorry we couldn't find you!
</play>
<goto>enter-id</goto>
</else>
</if>
Also See
-
This tag supports CallFire XML Javascript