Question

I am having issues with the following scenario: my vxml has the following snippet:

<block> 
<script src="myscript.es"/> 
<audio> <value expr="temp()"/> </audio> 
<exit/> 
</block> 

myscript.es:

function temp(){ 
var delay = new String("abc <break time='2000ms'/> pqr"); 
return delay; 
} 

The evaluated expression is not being treated as a tag rather as follows: addd <break time='2000ms'/> bbb

Is there a way to generate a tag dynamically from ecmascript expression?

Was it helpful?

Solution

There are at least a couple of issues wrong with your example. First, the results of the expression used in the value tag should not return a break element, only the items you want the text-to-speech engine to voice back. You would need to do something like this to insert a break in between two values.

<form id="F1"> 
  <var name="Color1" expr="'red'"/> 
  <var name="Color2" expr="'blue'"/> 
  <block> 
    <prompt> 
       My favorite colors are  
       <value expr="Color1"/>
       <break time="2000ms"/>
       <value expr="Color2"/>
    </prompt> 
  </block> 
</form>

And you cannot generate tags with ECMA script in VoiceXML. To dynamically generate tags you have to use your favorite web technology, such as ASP.NET, JSP, or PHP as examples.

If you are new to VoiceXML and are familiar with ASP.NET MVC then there is an open source project you can use called VoiceModel that generates dynamic VoiceXML without having to understand the VoiceXML syntax.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top