This lesson will guide you through the creation of a "hello world" VoiceXML application, but just to be different we're going to call it "Welcome to Genie University!". You're going to understand the fundamental structure of a VoiceXML application, and we'll get you running your first VoiceXML program.
Open your favorite text editor.
First we need to acknowledge our roots. VoiceXML is a variant of "XML":
<?xml version="1.0"?>
Now we will specify what version of VoiceXML we're running:
<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> . . . (soon we're going to put our code in here) </vxml>
Every VoiceXML document will start and end as above. Notice the final </vxml> with a slash before the vxml. The slash means "end" as in "end vxml". The majority of VoiceXML tags are written that way, with a beginning and an end - much like braces ( "{ }" ) in the C programming language. This is quite a bit different from html, where the closing tag was allowed but not usually required.
<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form> <block> Welcome to Genie University! </block> </form> </vxml>
The <form> tag is what groups sections of input and output together. It is also known as a "dialog". (In this document, there is only one form, but a document could of course contain any number of forms.)
Why don't you save your document as "welcome.vxml"? You can call it whatever you want, but it must have a ".vxml" extension.
Just to be clear with regard to terminology:
An application can be comprised of one or more documents, or pages. "Document" is synonymous with "page".
A document (page) can be comprised of one or more forms, or dialogs. "Form" is synonymous with "dialog".
Each form (dialog) can contain one or more field items.
Application -> Document (Page) -> Form (Dialog) -> Field item
(For more detail on which tags can be grouped under or over a given tag, check the Parents and Children listed in its entry in the VoiceXML 2.0 tag reference.)
Your application needs to be readable (by the VoiceGenie VoiceXML Browser) on a web site. There are many web sites that offer their services free of charge.
Let's imagine that your file ends up at
http://www.freewebsite.com/yourname/welcome.vxml
You will need to know this information when you set up your VoiceGenie extension (Step 5).
(Many free web hosts don't allow the posting of .vxml files, or add advertising information that causes errors when the pages are loaded.
If you're following this tutorial, then you're already logged in.
Click on the "Tools" tab, and go to the "Extension Manager".
Type the URL for your application (Step 3) in the table.
Click on "Add", and make a note of the extension you're given.
You are now ready to test your application:
Call either number listed in the Extension Manager.
When you are asked for your extension (Step 5), either say it or type it in using the touchtone keypad on your telephone.
Listen while the Text-To-Speech engine reads "Welcome to Genie University"!