cond
Execute a sequence of instructions depending on the value of a JavaScript condition.
Parameters
Name | Type | Description |
---|---|---|
when | string | The JavaScript condition to act on. Required. |
then | array | Sequence of instructions to execute when the condition evaluates to true . Required. |
else | array | Sequence of instructions to execute when the condition evaluates to false . Required. |
Variables
None
Examples
- YAML
- JSON
version: 1.0.0
sections:
main:
- cond:
- when: "vars.foo < 2"
then:
- hangup
- when: "'%{call.to}' == '+15551231234'"
then:
- execute: help
- when: "/hello/.test('vars.foo')"
then:
- execute: match
- else:
- goto: retry
{
"version": "1.0.0",
"sections": {
"main": [
{
"cond": [
{
"when": "vars.foo < 2",
"then": ["hangup"]
},
{
"when": "'%{call.to}' == '+15551231234'",
"then": [{ "execute": "help" }]
},
{
"when": "/hello/.test(vars.foo)",
"then": [{ "execute": "match" }]
},
{
"else": [{ "goto": "retry" }]
}
]
}
]
}
}