Yes, you can generate menu options for each field dynamically. This is usually accomplished by using some form of middleware (for the plum voice platform, many IVR developers choose php) to gather data and generate the voiceXML for the menus. Below is a simple php script that will print one of two possible vxml fields, depending on what value the $type variable contains...
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<form name="user_form">
<field name="OptionSelected" type="digits?length=1" >
<?php
/**
this variable stores what type of user is accessing the system
this could be passed in as a post or get variable, or retrieved from a
database...
*/
$type = "POWER_USER";
//the user is a "power user" so provide them with more options
if($type == "POWER_USER"){
?>
<grammar type="application/x-jsgf">1|2|3</grammar>
<prompt>
Welcome power user!
Please press 1 or 2 or 3.
<?php
}
//the user is a "normal user", so there are less options provided
else{
?>
<grammar type="application/x-jsgf">1|2</grammar>
<prompt>
Welcome normal user
Please press 1 or 2.
<?php
}
?>
</prompt>
<nomatch>
Sorry, I didn't understand you.
</nomatch>
<filled>
You pressed <value expr="OptionSelected"/>
</filled>
</field>
</form>
</vxml>
NOTE: This is not intended to solve the dynamic menu problem you specifically mentioned. Rather, it provides a simplistic IVR example of how to generate voice XML dynamically using PHP. You may also find it beneficial to use the
<menu> tag.
For a comprehensive reference to all PHP functions, please visit:
http://www.php.net/docs.php
SIDE NOTE: It's import that there are no extra characters inside the
<grammar> tag; it could be interpreted as the wrong IVR grammar and cause user input to fail matching.