VoiceXML 2.1 Development Guide Home  |  Frameset Home

  VoiceXML 2.1 Tutorials  |  TOC  |  tutorial Voice Recognition  

Tutorial: VoiceXML Hello World Phone Application

This simple tutorial will step you through the creation and deployment of a "hello world" application. When we're done, you'll have a basic understanding of creating phone applications using web technologies, and you can call the resulting Hello world application.


Step 1: Write the Main VoiceXML File


Open up your favorite text editor to write a few lines of VoiceXML.

First you'll need to put in the file a standard XML header. Every XML document you write, including VoiceXML documents, will need a header like this.


<?xml version="1.0" encoding="UTF-8"?>


Next, you will need to specify the proper version number for your VXML document. If you plan on using any of the newer 2.1 application features, such as the <data> element, then you will want to make certain that you specify version "2.1".


<?xml version="1.0" encoding="UTF-8">
<vxml version="2.1">

</vxml>



Since we are starting small, we will partake in the time-honored tradition of true 'Hello World' applications.

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >

  <form>
    <block>
    <prompt>
      Hello World. This is my first telephone application.
    </prompt>

    </block>
  </form>
</vxml>


That is all there is to it. Notice that even at this most basic level of scripting, we still see evidence of some required code structure. The <form> tag is not unlike the HTML <form> tag, as it groups sections of input and output together on your page (remember, this is just a "web page" for the telephone). But the similarity between the two tags ends there -- in more complicated scripts the <form> can also serve as a named section that can be jumped to (not unlike a HTML anchor tag). In a similar way, the <block> tag in our example seems somewhat unimportant because we are performing but a single function; however, VoiceXML requires structure inside the <form> tag, which is what the <block> provides for us. So how does VoiceXML know to convert "Hello World. This is my first telephone application"? No extra tags are required to read text-to-speech -- VoiceXML assumes any non-tagged value is text to be read over the phone. How simple is that?

Your VoiceXML file is now done. Go ahead and save it as "helloworld.xml".


Step 2: upload your VoiceXML file to the web

Next you need to post or upload your VoiceXML file to a web server. In this example, we might put the file into http://www.myserver.com/helloworld, so that your VoiceXML file would be at http://www.myserver.com/helloworld/helloworld.xml in the VAM. If you don't have access to a web server, you can use the new Voxeo File Manager to upload  your code to our servers. As a member of the Voxeo Community, you get 10MB of free hosting space on our servers in which to test your applications. See our How-To Guide on the Voxeo File Manager for more details.

Step 3: sign up for a voxeo account

If you have already signed up for a voxeo account, you can skip forward to the next step.

Signing up for a Voxeo account is absolutely free. The link below will pop-up a new window where you provide basic contact information to sign up for an account. When you're done signing up for an account, just close the pop-up window and return here to move on to step 5.

Click here to sign up for a voxeo account



Step 4: link a phone number to your VoiceXML URL

Not sure how to map an application to a phone number? Check out the Quick Start Mapping Guide for info!


Step 5: upload, and call your application

You are now ready to try out your application. Call the number you received in step 4. You should hear "hello world" read to you over the phone!

Welcome to the world of phone application development!


Download the Code!

  Source Code






  ANNOTATIONS: EXISTING POSTS
dbernardes
6/18/2009 12:15 PM (EDT)
in english
How to test an application developed in OpenVxml of the eclipse, I have a .War to test and not know where the server host and test Voxeo. could someone help me?

in portuguese
Como faço para testar uma aplicação desenvolvida no OpenVxml do eclipse, eu tenho um arquivo .war para testar e não sei onde hospedar no servidor Voxeo e testar. alguém poderia me ajudar?

grato
Diogo Bernardes
voxeoblehn
6/18/2009 12:55 PM (EDT)
Hello Diogo,

I see you have already created an Evolution account, therefore, all that is necessary is to point your .war file to your external server which will support and execute this file.

This can either be as a StartURL in Evolution or a route in a local installation of Prophecy. As we do not allow any server-side components in our staging environment, you will need to point the URL of you .war file to external web server which can execute this.

In the instance of a local installation of Prophecy, built in support exists for php/jsp exists, and you will need to place your scripts in the \webapps directory. So the route you specify for your .war file must be direct there as well.

Hope that clears things up a bit, but if you have any additional questions or concerns please feel free to let us know.

Best Regards,

Brian Lehnen
Voxeo Support
prabodhprakashibm
6/30/2009 9:03 AM (EDT)
Can we have nested form ?
voxeojeremyr
6/30/2009 10:16 AM (EDT)
Hello,

No you cannot nest Forms, they are meant to be standalone entities.  The only valid parent of <form>  is <vxml>.  If you give us an idea of what you would want to nest forms for, I am sure we can come up with a solution that would fit your needs.

Standing by,
Jeremy Richmond
Voxeo Support
dpinter
8/5/2009 5:33 PM (EDT)
how is Voxeo's voice browser able to interpret an .xml file when VoiceXML files must have a .vxml extension?
dpinter
8/5/2009 5:36 PM (EDT)
what is the purpose of the pin? does it redirect you to the specified server?
VoxeoDustin
8/5/2009 5:42 PM (EDT)
Hello,

The VoiceXML browser does not look at MIME type or file extension, but rather looks at the XML header in the file and for the <vmxl> element to determine it's the proper type. This allows us to use non-standard file extensions as well as server-side - it will still parse a .php file as a VoiceXML file and as long as the output it valid VoiceXML(like your web browser is with HTML), it does not care.

In regards to the PIN question, I assume you are referring to the PIN you enter in the 800 PIN application. This PIN is the DNIS(the dialed number) attached to the application and is used to route to the appropriate application in our hosted environment.

Regards,
Dustin Hayre
Customer Support Engineer II
Voxeo Support
luis
9/10/2009 5:42 PM (EDT)
Hello,

I have just tried my first application and it worked really well. It was successful at my first attempt and I give you guys a big thank you.

Now, I have a few questions. I am doing this work at my brother's house and I do not want to accumulate any phone bill for him before I leave his place. Is any of these phone numbers we are given to call free? What about this one (800) 289-5570 then PIN: 9991436201? Another question, how can I use my own audio file?

Thanks,
Luis
VoxeoDustin
9/10/2009 6:16 PM (EDT)
Hello Luis,

The (800) 289-5570 then PIN: 9991436201 number is a free number to dial within the United States. If you're outside the US, you may want to dial in via the SIP address provided for your application via a SIP softphone.

Let me know if we can be of further assistance.

Regards,
Dustin Hayre
Customer Support Engineer II
Voxeo Support
NMareboina
3/10/2010 6:27 AM (EST)
Hi i have some doubts. Please give me step by step to test VoiceXml process from my server
voxeoJeffK
3/10/2010 7:23 AM (EST)
Hello,

If you would like to install Prophecy on your own server, first download it from here:

  http://www.voxeo.com/prophecy/

I would recommend selecting Prophecy version 9, and then your specific operating system. Install Prophecy, and then you can reference our Prophecy 9 Guide here:

  http://docs.voxeo.com/prophecy/9.0

For cretaing VoiceXML applications our tutorials begin here:

  http://www.vxml.org/

We are always available for any questions or difficulties you encounter. Feel free to open a Support Ticket from your Voxeo Evolution account, and we'll do our best to help.

Regards,
Jeff Kustermann
Voxeo Support
Geralyn
3/25/2010 10:37 PM (EDT)
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >

  <form>
    <block>
    <prompt>
      Hello World. This is my first telephone application.
    </prompt>
    </block>
  </form>
</vxml>
voxeoJeffK
3/25/2010 11:59 PM (EDT)
Hello,

Do you have a question concerning the "Hello World" code? How can we help?

Regards,
Jeff Kustermann
Voxeo Support
amruth
4/28/2010 12:57 AM (EDT)
hi
  i have created an application but i m confused in making a call . i stay in india and i dont have a sip phone how do i make a call without using any browser support.
voxeoJeffK
4/28/2010 3:07 AM (EDT)
Hello,

You can use the provided U.S. based numbers, but you will probably incur long distance, international rate charges. There are also Skype numbers to use with a Skype client and iNum numbers for use with a Gizmo softphone. If you wish to use a SIP phone you can download X-Lite or SJphone for free.

Regards,
Jeff Kustermann
Voxeo Support
ibicf8288
5/14/2010 6:23 AM (EDT)
Hello,

After finishing the first App, I got a "Skype VoIP" number-+99000936 9991448781. But when I used skepe to call it, it failed, with the voice reply: that call has an internal error...
I use the source-code from your tutorial website.
So what should I do?
3x
voxeoJeffK
5/14/2010 6:40 AM (EDT)
Hello,

For your application I see you have the Start URL set as "helloworld.wav". You'll need this to be set to an XML file. You'll need to place any application files under the "www" directory. I see there is a Voice folder you created. Just create that folder under the "www" directory, and put your hello.xml file there.

Then in your application settings:

  * Voice URL:    file manager | edit file | view

Click "file manager" and select the hello.xml, click the Map button, and Update the application.

Regards,
Jeff Kustermann
Voxeo Support
ibicf8288
5/14/2010 7:37 AM (EDT)
Hello,

Thank you. It does work now. But I still have a question about
the debugger. According to "Quick Start Guide", when I open the
application debugger, it will show me the app's activity when I
call the app. num. But for me, nothing happen to this App. Debugger.

Thank you.
voxeoJeffK
5/14/2010 8:16 AM (EDT)
Hello,

I just tested your "HelloTts" application with the debugger running, and it output the logging for me. Is it the debugger is not opening in the browser at all, or is it just blank?

Regards,
Jeff Kustermann
Voxeo Support
ibicf8288
5/14/2010 9:05 AM (EDT)
Hello,

The App. Debugger pops up in a new Win.
In the middle it reads: Click on a call session in the top left frame to activate this command bar. But it's blank in the left frame-"Interactive Sessions - calledID - callerID".

voxeoblehn
5/14/2010 4:23 PM (EDT)
Hello,

Currently, the buttons in the application debugger are only active for the Prophecy 8 VoiceXML platform. When using this platform you will see your individual sessions in this box, which you can then click on and apply the applicable filters.

If you are indeed using this platform and still do not see the active sessions, please let us know.

Best Regards,

Brian Lehnen
Voxeo Support
smarth
6/28/2010 9:58 PM (EDT)
Hi
First of all I really liked the idea of application
I have used the xml file hosted on my server
Link to this file is http://www.smarth.5gigs.net/voicexml/sample.xml
I am using X-Lite to make a call to SIP number
It was working yesterday morning for me but is not working since yesterday evening.Can you help me please?
voxeoJeffK
6/29/2010 12:33 AM (EDT)
Hello,

What is happening when you call the application? Try testing while having the Application Debugger open. If the messages there are unclear, then save the logging to a file, and attach t here for us to review.

Regards,
Jeff Kustermann
Voxeo Support
lmarrero
8/4/2010 3:17 PM (EDT)
Hello,

Im trying to deploy this application on an Avaya Voice Portal, but when I try calling the application i get a technical difficulties error.  Do you know if i need to add anything to it so that it can successfully run? 

Thanks,

Luis
VoxeoDustin
8/4/2010 4:53 PM (EDT)
Luis,

We don't really have any experience with Avaya Voice Portal, so I don't know how helpful we could be. However, I could certainly take a look. Do you have a log of a call attempt from the server?

Regards,
Dustin Hayre
Solutions Engineer
Voxeo Corporation
voxeojeremyr
8/9/2010 12:12 AM (EDT)
Hello Ashish,

I made a test call into your application and it answered and played the message correctly.

Can you try again and let us know your results?

Standing by,
Jeremy Richmond
Voxeo Support
aashishpandeyk
8/9/2010 1:04 AM (EDT)
Hi,

I looked great in the beginning but stopped working at all later. :(

In my first try, I built a new application for "Hello World" and then tried calling through SJPhone.  It worked fine.  However, on trying it later, it stopped giving any response. When I call from SJPhone now, it just keep on ringing & the vxml is not read at all.

Could you please help me understand the reason for such a behaviour?
Also, the debugger does not show any progress while the call is in process.

Thanks.
Ashish
gargv
12/1/2010 2:23 PM (EST)
Hi

Is there way if I can access my VXML application through a number of my choice?
Problem is that I do not want to dial a USA number from India to access my application and Voxeo doesn't have a number in India.

I need to know how the VXML browser interacts with Telephony hardware?

Regards
Vineet
VoxeoDustin
12/1/2010 6:18 PM (EST)
Hello Vineet,

The easiest way to accomplish this is by simply dialing the Prophecy server using a SIP phone. For a local installation of Prophecy, you would just dial sip:address@prophecyIP, where 'address' is the address you created for your application and 'prophecyIP' is the IP address of the Prophecy server. If you're using our hosted platform, we provide a SIP address you can use to dial into your app under the Contact Methods section of your application settings.

If you wish to call your applications using a landline or cellphone, you can use an analog-to-SIP gateway to connect standard phone lines to the server. We recommend the Audiocodes MP-114 (four lines), MP-118 (eight lines) or Mediant 1000 (up to 24 lines).

Let me know if we can be of further assistance.

Cheers,
Dustin
mozak
7/22/2011 8:07 AM (EDT)
hello
I have prophecy 9 installed on my local machine. Now I want to test the application helloword.I want to know how to process.In which folder do I put the VoiceXML file? Which url I have to call via the sip phone to test the application.
Thanks for the help.
voxeoJeffK
7/22/2011 8:35 AM (EDT)
Hello,

First, we would recommend using Prophecy 10 rather than 9 since it includes additional functionality, and is a newer version. For setting up the application itself, and then calling it you can use our QuickStart Guide here:

  http://docs.voxeo.com/prophecy/10.0/quickstart.htm

Let us know if you have any trouble.

Regards,
Jeff Kustermann
Voxeo Corporation

[url=http://www.voxeo.com/summit2011/]
[img=http://evolution.voxeo.com/images/summit2011footer.jpg/]
[/url]
[b][color=blue]Join us October 10-12 in Orlando for Customer Summit 2011[/color][/b]

[b][url=http://www.voxeo.com/summit2011/]REGISTER NOW![/url][/b]
mozak
7/25/2011 10:47 AM (EDT)
Thank you Jeff !!!
the test is working properly. Now can I make an application in French because I use a trial version of prophecy.
VoxeoDante
7/25/2011 4:02 PM (EDT)
Hello Mozak,

If I am understanding your most recent post correctly, it sounds like you are asking if you can create an application in french using the trial version of Prophecy.  This is possible, but the trial version of Prophecy does not ship with French language packs.  You would need to get these packages and install them separately.

You also have the option of using the Voxeo hosted network which does have French available in the staging environment.

If you would like to continue working with your local installation of Prophecy for this, please let us know your applications requirements, and we can work with you to get the proper packages.

Regards,
Dante Vitulano
Hosted Solutions Engineer

[url=http://www.voxeo.com/summit2011/]
[img=http://evolution.voxeo.com/images/summit2011footer.jpg/]
[/url]
[b][color=blue]Join us October 10-12 in Orlando for Customer Summit 2011[/color][/b]

[b][url=http://www.voxeo.com/summit2011/]REGISTER NOW![/url][/b]
mozak
7/25/2011 5:45 PM (EDT)
Hello,
I just want to create an application that can make text-to-speech and speech recognition.
Regards.
voxeoJeffK
7/26/2011 12:44 PM (EDT)
Hello,

I noticed in your account that your "hello" application is correctly prompting French. For your local installation you would need to install French language packs. Since our Hosted environment is already configured successfully for French it may be more convenient for you to continue using your hosted account to develop further if desired.

Let us know though if you require trial French TTS/ASR for you local install.

Regards,
Jeff Kustermann
Voxeo Corporation
mozak
7/27/2011 5:20 AM (EDT)
Hello,
yes I require trial French TTS/ASR for my local install.
About your hosted enrironement do I need Skype credit to call? because if I call the number you gave me, the call fails.
VOIP: 9996137719
INUM: +883510001836086
mozak
7/28/2011 5:29 AM (EDT)
Hello,
I'm waitting to your help !!! I require the french language packages for the trial prophecy version. I'm student and I want to test the prophecy TTS/ASR in french.
Thanks for the help.
voxeoshanesmith
7/29/2011 10:21 AM (EDT)
Hi,

You do not need Skype credit to access the Skype numbers associated with applications in your account. If you are having any difficulties, please open an account ticket and I would be glad to assist further.

Regards,
Shane Smith
Voxeo Corporation

Status of Voxeo's Hosted Services: [link=http://status.voxeo.com/]http://status.voxeo.com/[/link]
mozak
8/1/2011 6:52 AM (EDT)
Hello,
I can't access to my application helloworld using skype. Please can you describe me how to process.
Tkanks.
voxeoJeffK
8/1/2011 8:53 AM (EDT)
Hello,

What happens when you call the application's Skype number from your Skype client exactly? Does it report an error? Do you get a connection, but then an immediate hangup? Let us know any additional details.

Regards,
Jeff Kustermann
Voxeo Corporation
mozak
8/1/2011 1:57 PM (EDT)
Hello Jeff,
no I don't get connection, the call  immediate hangup, and skype says that the call failed.
See the numbers I receive when I create the application.
VOIP: 9996137719
INUM: +883510001836086
voxeoJeffK
8/1/2011 3:48 PM (EDT)
Hello,

For Skype the number attached to that application is:

  +990009369996137719

and tests successfully for me. You can go to the application's settings page, and click the "Contact Methods" tab for all the connection numbers.

Regards,
Jeff Kustermann
Voxeo Corporation
mozak
8/2/2011 6:57 AM (EDT)
Ok It's work, but the call quality is so bad.
I can't hear. I will check if it's not my internet connection.
Thanks.
mozak
8/2/2011 7:35 AM (EDT)
Ok It's work, but the call quality is so bad.
I can't hear. I will check if it's not my internet connection.
Thanks.
lanas
10/31/2011 1:36 PM (EDT)
Can any one please teach me how to execute this vxml program in prophecy.... or in any software's I am pasionated to learn Vxml Please send those details step by step to my mail Id: meetlanas@gmail.com
VoxeoDante
11/1/2011 4:30 PM (EDT)
Hello Lanas,

I would suggest taking a look at the quickstart guide;

https://evolution.voxeo.com/docs/quickStart.jsp

That is a great place to get started with VoiceXML on the Evolution hosted Prophecy platform.

I hope that helps.

Regards,
Danté Vitulano
Hosted Solutions Engineer

[url=http://www.voxeo.com/university/home.jsp]
[img=http://www.voxeo.com/images/logos/VoxeoUnivLogo.png/]
[/url]
[b][color=blue]Interested in Training? Visit the Voxeo University Page to Learn More![/color][/b]
infogain2011
1/2/2012 4:24 AM (EST)
How to configure this application for India as i cant find India in the country list provided in the "Add application" section or is there any other way i can develop and test this application??

Regards,
Infogain2011
VoxeoDante
1/3/2012 9:54 AM (EST)
Hello Infogain2011,

Sadly we are not able to provide numbers in India due to local regulations in that country which do not allow us to acquire numbers there.  We are also not able to dial out to India from the US in the staging network.

You best option for testing would be to using either Skype or SIP to test as we provide both Skype and SIP inbound numbers for every application.

I hope this helps.

Regards,
Danté Vitulano
Hosted Solutions Engineer

[url=http://www.voxeo.com/university/home.jsp]
[img=http://www.voxeo.com/images/logos/VoxeoUnivLogo.png/]
[/url]
[b][color=blue]Interested in Training? Visit the Voxeo University Page to Learn More![/color][/b]
wriki
1/6/2012 8:23 AM (EST)
hiii
.. i m new to this language . please guid me how i can use this vxml code in .net and to make call ..please define in detail
please rply me as soon as possible ..
thnx in advance
VoxeoDante
1/6/2012 11:05 AM (EST)
Hello,

There is a lot to learn here.  If you are interested in using VXML with .net, I would honestly recommend reading through the tutorials here.  There are a number of things about VoiceXML that you will need to learn, and I do not think that I can pass along all that information in one posting.

Specifically for use with server-side like ASP, you would want to take a look here;

http://www.vxml.org/qs_vars.htm

For outbound dialing, you should start here;

http://www.vxml.org/mot_appendixg.htm

Please take a look there and let us know if you have other questions.

Regards,
Danté Vitulano
Hosted Solutions Engineer

wriki
1/7/2012 1:36 AM (EST)
thnx for rply ..

there one more problem. To do outbond calls first i need token id . Can you please help me that how i can get token id and used in vxml.
wriki
1/7/2012 1:49 AM (EST)
how to do request for token id from my account .please help
xshao
1/9/2012 3:07 AM (EST)

Hi, There,

I see you've already had your start token in another ticket so to avoid further confusions, we'll deal with token related issues via that private thread. Thanks.

Best Regards.
Xudong Shao
Voxeo Support

[img=http://www.voxeo.com/images/top/logo.gif]
smidowski
1/22/2012 3:39 PM (EST)
Yay!  First voicexml app working.  Onward!
Expers
4/1/2012 1:33 PM (EDT)
Is there a way to pause in between prompt tags?

I have some VXML right now reading 3 descriptions, the structure is as follows:

<vxml>
...
  <prompt>
    something
  </prompt>
  <prompt>
    something else
  </prompt>
  <prompt>
    a third thing
  </prompt>
...
</vxml>

It is formatted properly and reads correctly, but it reads each prompt tag one after the other with no pauses. When you call you hear "something something else a third thing." Is there any thing I can use to force a pause between each prompt?
voxeoJeffK
4/9/2012 12:59 PM (EDT)
Hello,

The <break> element is used:

  http://www.vxml.org/break.htm

  <prompt>
    something
    <break strength="weak"/>
  </prompt>
  <prompt>
    something else
    <break strength="weak"/>
  </prompt>
  <prompt>
    a third thing
  </prompt>

regards,
Jeff Kustermann
Voxeo Corporation
HennaSingh
4/18/2012 1:54 AM (EDT)
Hi team,

i uploaded the code on voxeo file manager, i received
VOIP- 9996193436

but when i call on this number, it says the number is invalid.
please help
voxeoJeffK
4/18/2012 1:49 PM (EDT)
Hello,

The full SIP address you would use is:

  sip:9996193436@sip.voxeo.net

You can also view the other numbers for that application by checking its Contact Methods tab.

Regards,
Jeff Kustermann
Voxeo Corporation
naughtystyle2
5/4/2012 10:15 PM (EDT)
I just wanted to know if there is support to Bolivia for both services Voice and SMS. Thanks in advance
VoxeoDante
5/15/2012 12:48 PM (EDT)
Hello,

At this time, you will not be able to use the free development environment WTO send calls or SMS messages to Bolivia.  If you are planning on using this service for a business, the Voxeo production environment is able to send calls and SMS to Bolivia. If you are interested in testing this functionality, I can get you in contact with my sales team, and we can work on a test account for you with this functionality.

Regards,
Dante Vitulano
Voxeo Support
RashmiS01
6/19/2012 12:09 AM (EDT)
Hello ,

I have created an application and i have got the following numbers
  Number Type                Number
------------------------------------------
  USA Domestic              (213) 674-9989 
  iNum Number              +883510001284499
  USA Toll Free PIN Access  (800) 289-5570 then PIN: 9990041977
  USA Domestic PIN Access  (407) 386-2174 then PIN: 9990041977
  Skype VoIP                +990009369990041977
  SIP VoIP                  sip:9990041977@sip.voxeo.net
  SMS Botkey                379193

Im From India.Im not able to make a call.It tells me invallid number.
RashmiS01
6/19/2012 12:17 AM (EDT)
Hello,

Please let me know what is Prophecy server? Why do we need this?

Thanks
Rashmi
MattHenry
6/29/2012 2:19 PM (EDT)


Rashmi,

In regards to the problems you are having with dialing your application, I'd advise you to capture some relevant information and submit it to us via a private account ticket rather than appending the inquiry to our documentation. Use the below link for guidance:

* https://evolution.voxeo.com/wiki/docs:CollectingInformation

In regards to your questions on Prophecy, I think it is best to direct you here for additional information:

* http://docs.voxeo.com/prophecy/11.0/

Regards,

~Matthew Henry
sidasari
2/21/2013 7:37 AM (EST)
Hi,

Below is the scenario in which i am facing issue.
I have a vxml hosted in my prophecy in which i am calling my servlet hosted in tomcat server(where i am retrieving data from database).I want to return the fetched data to my vxml that is hosted in prophecy server.I tried with options like return from servlet.Below is my code sample for vxml snd servlet.


LeaveApp.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.0">
    <nomatch>
        No Match! I'm sorry, There is no menu option for this.  Could you please try again?
        <reprompt />
    </nomatch>
    <noinput>
     
        <reprompt />
    </noinput>
<script>
  <![CDATA[
  var d = new Date(); 
  var hours = d.getHours(); 
  var greeting = "Welcome to SCI";
  if(hours > 2 && hours < 12)
  greeting = "Good morning."+greeting;
  else if(hours >= 12 && hours < 18)
  greeting = "Good afternoon."+greeting;
  else
  greeting = "Good evening."+greeting;
  ]]>
</script>
  <menu id="menu">
  <property name="inputmodes" value="dtmf"/>
    <prompt bargein="false"> <value expr="greeting"/>! This is Voice Leave Application</prompt>
    <prompt>
      <enumerate>
    <value expr="_prompt"/> press <value expr="_dtmf"/>,
      </enumerate>
    </prompt>
 
    <choice next="#leaveform" dtmf="1">
      To Apply for Leave
    </choice>
    <choice next="#leavebal"  dtmf="2">
      To know your leave balance
    </choice>
   
  </menu>
 
    <form id="leaveform">
      <property name="inputmodes" value="dtmf"/>
    <field name="empno" type="digits?minlength=6;maxlength=6">
        <prompt>
        This is Leave Application Page.
          Enter your Employee Id 
        </prompt>
   
 
<filled>
<break time="500ms"/>
          <prompt bargein="false">
            Looks like you pressed  <value expr="empno" />
          </prompt>
           
          <submit next="http://localhost:8084/WebApplication1/servlet/HelloWorld" namelist="empno"  method = "get"/>
 
  <!-- here i want to make use of data returned from servlet  -->
        <goto next="#leaveapp"/>
        </filled>
      </field>     
    </form>
 
    <form id="leaveapp">
      <property name="inputmodes" value="dtmf"/>
      <field name="bal" type="digits?minlength=6;maxlength=6">
          <prompt>
            Enter leave duration
          </prompt>

        <filled>

          <prompt bargein="false">
          Your Leave duration is <value expr="bal" /> days.
          </prompt>
  <break time="500ms"/>

            <prompt bargein="false">
                Your leave request has been raised and waiting for approval.Thank you for using voice leave application.
</prompt>
          </filled>
      </field>

    </form>
<form id="leavebal">
      <property name="inputmodes" value="voice"/>
      <field name="currbal">
          <prompt>
            your leave balance is <value expr="currbal" /> days
          </prompt>
</field>

    </form>
 
</vxml>


HelloWorld.java


protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        String name = null;
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            String serverName = "192.168.8.29";
            String portNumber = "1521";
            String serviceName = "XE";
            String url = "jdbc:oracle:thin:@//" + serverName + ":" + portNumber + "/" + serviceName;
            System.out.println(url);
            String username = "sci";
            String password = "sci";
            Connection con = DriverManager.getConnection(url, username, password);
            Statement st = con.createStatement();
            String dbQuery = "Select ename from emp where empno =" + request.getParameter("empno");
            ResultSet rs = st.executeQuery(dbQuery);
            while (rs.next()) {
                name = rs.getString("ename");
            }
           
            con.close();
        } catch (Exception e) {
            out.println(e.getMessage());
        }
        out.println("<?xml version=\"1.0\"?> ");
        out.println("<vxml version=\"2.0\">");
        out.println("<form>");
        out.println("  <block>");
        out.println(" <prompt>\n"
                + "name is  \n");
        out.println(name);
          out.println("  <break time=\"500ms\"/>");
        out.println("  </prompt>");
        out.println("  </block>");
        out.println("</form>");
        out.println("</vxml>");
        out.close();

    }


Please help me on this.
VoxeoRobert
2/27/2013 5:32 PM (EST)
Hello,

      Looking at your code everything seems to be good. In regards to your HelloWorld.java we would recommend that you declare the variables outside of the scope of your try catch as global variables as this will allow you to call them in more than one method. Additionally, you will not be able to reference these variables within the try catch if you don't declare them as global variables, outside the scope of the try catch.


Please feel free to contact us if you have additional questions or if you need further assistance.

Best regards,
Bobby McDonald
Customer Support Engineer II

[image=http://www.voxeo.com/images/top/logo.gif /]
dr_acula53
3/26/2013 2:06 AM (EDT)
Hello,

I am from Bangladesh and trying to implement a simple IVR application. But I'm failing to call my application as I don't reside in US or any other country provided in the list.

Is there any other way that I can emulate my app?
VoxeoIanHannah
4/6/2013 6:50 AM (EDT)
Hello,

While dialing your application from a standard phone is best to simulate standard calling conditions, being that you have a US based application you get a specific Skype number that you can call your application through. This number can be found under the "Contact Methods" tab and typically can be easily used by clicking on the number. As a warning, there are known issues with the integrity of using Skype in calling our hosted IVR applications, so if you have issues with Skype there is also a SIP VoIP number you can also call with your own web-enabled SIP phone.

Using one of these calling method in conjunction with the hosted debugger you can verify the validity of your application.

Regards,

Ian Hannah
Voxeo Customer Obsession Team

login
  VoiceXML 2.1 Tutorials  |  TOC  |  tutorial Voice Recognition  

© 2013 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site