The <Switch>
element permits to execute conditional code based on the value of a var.
It is equivalent to the switch statement in programming languages.
Element Attributes
Attribute Name | Description | Allowed Values | Default Value |
---|---|---|---|
var | name of the variable or parameter (From, To etc) | non-empty string | none |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?xml version="1.0" encoding="UTF-8" ?> <Response> <GetDigits retries="3" validDigits="012"> <Speak voice="rms">Press 1 to talk with Sales. Press 2 to talk with Support</Speak> </GetDigits> <Switch var="Digits"> <Case val="1"> <Transfer>Sales</Transfer> </Case> <Case val="2"> <Transfer>Support</Transfer> </Case> <Default> <Speak voice="rms">Bye.</Speak> </Default> </Switch> </Response> |