The <Cond/> Element

This element permits flow control based on evalution of clauses

Element Attributes

This element has no attributes. But it will contain child elements <Clause/> and <Else/> elements.

Attributes of the <Clause/> element:

Attribute Name Description Allowed Values Default Value
expr expression to be evaluated. If it evaluates to True then the elements in the body of the <Clause/> will be executed. If no <Clause/> element matches but there is a child element <Else/> present, it will be executed. See expressions non-empty string none

Example 1:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<IVR>
  <GetJSON var="data" url="https://somewhere.com/get_account?phone_number={{CallingNumber}}"/>
  <Cond>
    <Clause expr="data.balance > 10000">
      <Transfer>sales1</Transfer>
    </Clause>
    <Clause expr="data.balance > 5000">
      <Transfer>sales2</Transfer>
    </Clause>
    <Else>
      <Transfer>sales3</Transfer>
    </Else>
  </Cond>
</IVR>