Tutorial: Build your own email reader by phone using VoiceXML
ImplementationThe Email Reader application uses JSPs to perform server-side functionality such as writing to files and generating VoiceXML documents with the latest emails. The implementation of the Email Reader involves three steps: registration, authentication and retrieval of emails. Registration
In order to listen to emails, users must register for the Email Reader service through a web page. register.jsp contains the code for the registration page. Users are asked to enter a POP server name, username, password and a pin. When a user clicks on the "Register" button, the form is posted to register_confirm.jsp.
register_confirm.jsp retrieves post parameter values for the POP server, username, password, and pin. It ensures that the pin is not duplicated, and registers the user by writing all of the information to a flat file (called users).
User AuthenticationWhen a user calls the email reader application, the first step is to authenticate the user. emailreader.vxml prompts a user to enter his/her pin and submits the form to access that user's email. Once the pin field is filled, the form is posted to fetchemails.jsp.
Retrieving Emailsfetchemails.jsp retrieves the POP account info associated with the provided pin, and using JavaMail API fetches all emails from the user's POP account. The sender name, subject and email body are extracted and reformatted into VoiceXML content. fetchemails.jsp iterates through all the emails and includes VoiceXML logic to traverse through emails by saying 'next', 'previous', 'last' or first' as well as hear the body of any email by saying 'more'.
Application TestingThe Email Reader application can be tested using some of the tools available on the BeVocal Cafi.
- Application logic testing: Application logic can be tested in the BeVocal Cafi without using a telephone using the Vocal Scripter. The Vocal Scripter is a web-based applet tool that runs with any standard web-browser. A developer can also access the application by calling 1-877-33-VOCAL.
- Recognition testing: Recognition testing is necessary to make sure that a voice application is usable. The Log Browser is an interface that lists all calls for any chosen timeframe. For each call it provides different pieces of info such as caller id, dialed number, duration and the number of times there was misrecognition during the call. A developer can use this info to look at the complete trace log for the call and identify any particular dialogs or grammars that might be the cause for poor recognition. Improving recognition is often accomplished by tuning the associated grammar, and is a larger topic that should be addressed separately. In our example, given the small grammar sizes, we are unlikely to see poor recognition.
- Usability testing: Usability testing, a critical part of testing VoiceXML applications, is an area many new VoiceXML developers are unfamiliar with. The purpose of usability testing is to detect potential problems that were not anticipated during the design review and is a process that continues well after the application is developed. The metrics that provide a measure for usability are the time it takes a user to complete a task, the ease of completing a goal, and frequency of occurrences for out-of grammar utterances.
- Performance testing: Voice applications need to set service level requirements and be tested to ensure that they meet these minimum requirements. The following metrics provide key indications on the performance of an application: fetch time for VoiceXML resources including documents and prompts, time to parse and execute a VoiceXML document, recognition accuracy and response time and text-to-speech quality and response time.
DeploymentThe BeVocal Cafi provides a demo feature through which developers can build an application and then promote that to their company, customers and partners by providing just a demo id. The demo feature can be enabled through the deployment tab of the developer's account. Once a developer has chosen deployed an application using a demo id, the application can be accessed by calling 1-800-4-BVOCAL, saying "BeVocal Cafi" at the first prompt, and then saying or entering the demo id at the next prompt.
ConclusionThis article illustrates how to use VoiceXML and JSP to create a useful email reader by phone application , which reads emails from any POP server. The important facet of this application is that it gives the voice user interface in conjunction with generating content using existing web infrastructure.
Page 2 of 2