Showing posts from January, 2012

Recording User Voice Message in ASP.NET MVC

Recording user input in a VoiceXML application using ASP.NET MVC is very easy if you use VoiceModel.  VoiceModel is an open source project that abstracts the VoiceXML to an easy to use object hierarchy that is meant to work with ASP.NET MVC 3 and Razor.  In this post I will walk you through a simple demonstration on using VoiceModel to record user input.  The source code for this demo is available on CodePlex.

 In this demonstration the application will prompt the user to make a recording after a beep and to press the pound (#) key when they are done. When the user is finished recording the recorded message will be played back to them and they will be asked if they want to save it. If they respond yes, by either saying "yes" or pressing the 1 key on the phone, the audio recording will be saved in a directory on the application server.  If they respond no, by saying "no" or pressing the 2 key on the phone, they will be prompted to re-record the message.  Messages ar…

Debugging VoiceXML Applications with Fiddler

I was working on adding the ability to record user input in VoiceModel when I ran into an issue with the syntax of the VoiceXML that was returned to the IVR.  I was testing the changes using Voxeo's Prophecy IVR and the logs told me what line the issue was on but I could not understand why my application was generating the VoiceXML in question and I could not see VoiceXML document to verify what was going on.  My usual step for troubleshooting issues like this is to take the URL from the Prophecy log associated with the issue and put it in a web browser to see what the IVR is working with.  But in this case the IVR was doing a POST and a web browser can only perform GET operations.

After you create a user recording in VoiceXML using the record element you need to send the audio file from the IVR to you application using the submit element in order to save it, as shown below.  The recording does not do you much good if you leave it on the IVR.

<submit expr="Record/SaveRecor…

Using Google Weather API in a VoiceXML Application

In this post I will show you how to use the Google Weather API to retrieve current weather conditions that can be voiced back to callers.  In a previous post I showed how to use VoiceModel to create a simple VoiceXML application that asks the caller for their zip code, looks up the the weather conditions for that zip, and then voices the information back to the caller; but I used a mock-up for the service that retrieves the weather information for easier testing.  This time I will demonstrate how to swap out the mock-up for a functioning service to get the current weather.  Since the underlying architecture for VoiceModel is ASP.NET MVC this method would work just as well in a web application.

The way I implemented the Weather Application the service to retrieve the weather information implements the interface IWeatherService. This allows me to easily insert a mock-up for testing or any version of a service that I wish to.  I chose the Google Weather API because it is free, easy to us…