Keypress
Definition
One branch of a <menu> tag defining user input.
Value
Determines the result for a user key input. A <menu> tag requires at least one <keypress> tag. The contents of a <keypress> tag are more nodes to execute.
Attributes
Attribute | Required | Values | Description |
---|---|---|---|
name | N | any text | A unique name for the tag |
loggingEnabled | Y | any valid number or default or timeout | A numerical value or default or timeout |
Examples
This poll asks recipients to indicate their response by pressing buttons on their phone. Note that there is also a dangerous continual loop: users who enter nothing, or an undefined number, will loop back to the top. The call will not end until the recipient hangs up. This is for informational purposes only!
<dialplan name="Root">
<menu name="main" maxdigits="1" timeout="5000">
<play type="tts" voice="female2">Is your opinion of Prime Minister Churchill favorable or unfavorable? Press 1 for Very Favorable. Press 2 for Somewhat Favorable. Press 3 for Somewhat Unfavorable. Press 4 for Very Unfavorable.
</play>
<keypress pressed="1">
<stash varname="Opinion">Very Favorable</stash>
</keypress>
<keypress pressed="2">
<stash varname="Opinion">Somewhat favorable</stash>
</keypress>
<keypress pressed="3">
<stash varname="Opinion">Somewhat unfavorable</stash>
</keypress>
<keypress pressed="4">
<stash varname="Opinion">Very unfavorable</stash>
</keypress>
<keypress pressed="default">
<goto>main</goto>
</keypress>
<keypress pressed="timeout">
<goto>main</goto>
</keypress>
</menu>
<play type="tts" voice="female2">Thank you for your time and participation. Have a great day.</play>
</dialplan>