We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Dynamic Menu
-
- Posts: 84
- Joined: Wed Apr 04, 2007 4:58 pm
Dynamic Menu
Hello,
I need to get the menu dynamically from the web server as a
script array. Any help is appreciated.
Thanks
I need to get the menu dynamically from the web server as a
script array. Any help is appreciated.
Thanks
dynamically generating IVR script
Hello,
You should be generating the VoiceXML dynamically using server side scripting. By dynamically generating the IVR script you will be able to easily create the menu on the fly. Starting from a static script and attempting to assemble the menu using ECMAScript is extremely complex and not the recommended means of working with VoiceXML. An IVR example of a dynamically generated menu using php would be:
Regards,
Plum Support
You should be generating the VoiceXML dynamically using server side scripting. By dynamically generating the IVR script you will be able to easily create the menu on the fly. Starting from a static script and attempting to assemble the menu using ECMAScript is extremely complex and not the recommended means of working with VoiceXML. An IVR example of a dynamically generated menu using php would be:
Code: Select all
<?php
$choices[] = Array("name"=>"sales", "url"=>"sales.php");
$choices[] = Array("name"=>"support", "url"=>"support.php");
$choices[] = Array("name"=>"company directory", "url"=>"company.php");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<menu>
<prompt>
<enumerate>
For <value expr="_prompt"/>, press <value expr="_dtmf"/>.
</enumerate>
</prompt>
<?php
foreach ($choices as $choice) {
echo("<choice next=\"".$choice['url']."\">".$choice['name']."</choice>\n");
}
?>
</menu>
</vxml>
Plum Support
Last edited by support on Sat Feb 20, 2010 3:03 pm, edited 3 times in total.
-
- Posts: 84
- Joined: Wed Apr 04, 2007 4:58 pm
Dynamic Menu
Thank you. I will try that.
One more question about that.
Actually I am using subdialog tag to connect to the web server.
In this case, Don't i need to return something from the server instead of looping through the script array there itself?.
One more question about that.
Actually I am using subdialog tag to connect to the web server.
In this case, Don't i need to return something from the server instead of looping through the script array there itself?.
-
- Posts: 84
- Joined: Wed Apr 04, 2007 4:58 pm
Dynamic Menu
And one more thing I am using JSP in the server side.
to collect input, use a field with IVR grammar
Hello,
Can you please provide a more detailed explanation of what you are trying to do? Normally you would not use a menu within a subdialog. Menus are provided to allow for shortcuts to jump between different pages, not for collecting input from the user. If you want to collect input it is recommended that you instead use a field with an IVR grammar. We do not have any internal expertise in JSP so we will not be able to provide you with JSP based examples.
Regards,
Plum Support
Can you please provide a more detailed explanation of what you are trying to do? Normally you would not use a menu within a subdialog. Menus are provided to allow for shortcuts to jump between different pages, not for collecting input from the user. If you want to collect input it is recommended that you instead use a field with an IVR grammar. We do not have any internal expertise in JSP so we will not be able to provide you with JSP based examples.
Regards,
Plum Support
Last edited by support on Wed Dec 30, 2009 3:59 pm, edited 1 time in total.
-
- Posts: 84
- Joined: Wed Apr 04, 2007 4:58 pm
Dynamic Menu
I am sorry for not providing enough information.
Here is what I am trying to do.
I am gettting input from user and sending that to the webserver
for authentication using subdialog tag and from web server
I am sending some data as a response to the interpreter context using return tags. menu array is one of those response data from the server. And in the interpreter context I have to loop through the array for the dynamic menu. Is there any way to do it like using
data tag or something? somehow I have to get the control back to interpreter context with the response data.
Thank you.
Here is what I am trying to do.
I am gettting input from user and sending that to the webserver
for authentication using subdialog tag and from web server
I am sending some data as a response to the interpreter context using return tags. menu array is one of those response data from the server. And in the interpreter context I have to loop through the array for the dynamic menu. Is there any way to do it like using
data tag or something? somehow I have to get the control back to interpreter context with the response data.
Thank you.
-
- Posts: 84
- Joined: Wed Apr 04, 2007 4:58 pm
IVR Programmer's Reference Manual shows how to loop through
Hello,
The IVR problem you will have in trying to use a menu in a dynamic way is that there is no way to generate the <choice> elements without using server side scripting. You should instead mimic the behavior of a menu using the <field> tag and dynamically generating the prompts using a <foreach> tag. The <foreach> tag can be used to traverse an array and then play back each element of the array. The IVR example in the Plum IVR Programmer's Reference Manual shows how to loop through array data, you would just have to return the array data from your subdialog.
There is no way to specify a dynamically generated IVR grammar, you'd be better off specifying the IVR grammar as type="digits?length=1" and then checking the return value in the <filled>block:
Regards,
Plum Support
The IVR problem you will have in trying to use a menu in a dynamic way is that there is no way to generate the <choice> elements without using server side scripting. You should instead mimic the behavior of a menu using the <field> tag and dynamically generating the prompts using a <foreach> tag. The <foreach> tag can be used to traverse an array and then play back each element of the array. The IVR example in the Plum IVR Programmer's Reference Manual shows how to loop through array data, you would just have to return the array data from your subdialog.
There is no way to specify a dynamically generated IVR grammar, you'd be better off specifying the IVR grammar as type="digits?length=1" and then checking the return value in the <filled>block:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<form>
<!-- ASSUMES THE SUBDIALOG RETURNS AN ARRAY OF OPTIONS -->
<subdialog name="options" src="somescript.php"/>
<var name="count" expr="1"/>
<field name="fakemenu" type="digits?length=1">
<prompt>
<foreach array="options" item="option">
For <value expr="options.prompt"/>, press <value expr="count++"/>.
</foreach>
</prompt>
<filled>
<if cond="fakemenu > options.length">
<clear/>
<reprompt/>
<else/>
<!-- STORE THE RESPONSE AND GO TO THE NEXT SECTION -->
</if>
</filled>
</field>
</form>
</vxml>
Plum Support
Last edited by support on Wed Feb 24, 2010 5:44 pm, edited 4 times in total.
-
- Posts: 84
- Joined: Wed Apr 04, 2007 4:58 pm
-
- Posts: 84
- Joined: Wed Apr 04, 2007 4:58 pm
IVR developer explains why dynamice menu won't work
It will not work for voice because you need a voice specific IVR grammar like one that the IVR platform utilzes to listen for the different utterances. Such an IVR grammar is static and needs to be explicitly specified within a <grammar> tag.