Like this article? We recommend
HOV-Lane Multiplication
We have all the necessary pieces now, so let’s assemble them into a complete Voice XML application that does some mobile multiplication while you’re doing 70 in the HOV-lane (see Listing 1).
Listing 1 Voice XML mobile multiplier
<?xml version="1.0" encoding="UTF-8"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/Voice XML20/vxml.xsd"> <script> <![CDATA[ function multiply(v1, v2) { return v1 * v2; } ]]> </script> <form id="multiply"> <field name="v1" type="digits"> <prompt>what’s number one</prompt> </field> <field name="v2" type="digits"> <prompt>what’s number two?</prompt> </field> <filled> <prompt> The product of <value expr="v1"/> and <value expr="v2"/> is <value expr="multiply(v1,v2)"/>. </prompt> </filled> </form> </vxml>