I am trying to set a variable at the top of my script, kind of like a configuration area and in there I want to specify some variables and later use them. However I want to add on to the variable as shown below
<prompt timeout="8s">
<audio src=<value expr="document.tempPhoneNumber"/>."/voice_overs/VO2_.mp3">Please enter your cell phone number after the tone</audio>
</prompt>
<prompt timeout="8s">
<audio src="<value expr="document.tempPhoneNumber"/>/voice_overs/VO2_.mp3">Please enter your cell phone number after the tone</audio>
</prompt>
Obviously these are not going to work. Anyone help me out here?
The easiest way to include javascript in your IVR application is to use the src attribute of the <script> tag. This allows you to reference an external javascript file that will load when the document is first parsed. You can include any valid javascript including functions, arrays and object declarations. Here is a simple IVR example:
Apologies for misinterpreting your question. The correct approach to get dynamic URLs for audio (or any other tag that references remote files) is to use the expr attribute of the <audio> tag. The expr attribute will be parsed as javascript when the audio is played. This allows you to use standard javascript notation to concatenate the two strings. Here is a simple IVR example:
<?xml version="1.0"?>
<vxml version="2.0">
<var name="url" expr="'http://site.com:8080'"/>
<form>
<block>
<prompt>
<audio expr="url+'/voice_overs/VO2_.mp3'">Please enter your cell phone number after the tone</audio>
</prompt>
</block>
</form>
</vxml>
Regards,
Plum Support
Last edited by support on Wed Jan 13, 2010 4:28 pm, edited 2 times in total.
As you can see I used expr in place of next as the documentation says however I need to use my variable for the fetchaudio. Now I am confused on what to do.
You have hit a limitation of VoiceXML. The best option for your IVR application is to use PHP and skip the use of javascript for the base url of these: