VoiceXML Example : Hello World!

Simple with TextToSpeech

<?xml version="1.0"?>
<vxml version = "2.0" xmlns="http://www.w3.org/2001/vxml">
 <form>
  <block>Hello world!</block>
 </form>
</vxml>

The VoiceXML browser will use the TextToSpeech to convert the text “Hello world!” to a synthesis audio prompt.

Download : helloworld1.vxml

With an audio file

<?xml version="1.0"?>
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
 <form>
  <block>
   <prompt>
    <audio src="helloworld.wav"/>
   </prompt>
  </block>
 </form>
</vxml>

The VoiceXML browser will play the audio file helloworld.wav (in the same folder). In this example, the audio content “Hello World!” message. You can use any format supported by the asterisk.

Download : helloworld2.vxml helloworld.wav

With Asterisk audio reference

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="en">
 <form>
  <block>
   <prompt>
    <audio src="uri:asterisk_audio"/>
   </prompt>
  </block>
 </form>
</vxml>

The VoiceXML browser will use the default Asterisk audio folder to play the message. The default folder is “/var/lib/asterisk/sound”. The language set in xml:lang select the Asterisk language. Asterisk sound files

Download : helloworld3.vxml

Log In