Posts

Showing posts from 2012

Dynamic Menus with VoiceModel

There is a new example in the VoiceModel project that shows how to create dynamic menus. Dynamic menus can be very useful in voice applications where you want to configure how the menus work in some persistence mechanism, allowing you to change the flow of the application without recompiling and redeploying, or if you want to tailor it to a specific user based based on their personal preferences.

Here is the code in this new example:

public override CallFlow BuildCallFlow() { CallFlow flow = new CallFlow(); flow.AddState(ViewStateBuilder.Build("greeting", "myMenu", new Say("greeting", "Welcome to the dynamic menu example.")), true); //This is a fake service that mimics getting meta-data for the menus from a web service or database DynamicMenuService service = new DynamicMenuService(); VoiceMenu myMenu = service.GetMenu("myMenu"); Prompt menuOptions = new Prompt(); //Build the prompts for the menu options for…

New Release of VoiceModel Provides Tropo Support

A new version of VoiceModel has been released that allows your voice applications to run on the Tropo Cloud IVR. Now you can develop your voice applications once and run them on any VoiceXML compatible IVR or on the Tropo Platform.  VoiceModel is an open source project and you can find examples on how to develop with VoiceModel in the source code.

Listening to a Saved Recording Using Tropo and ASP.NET MVC

In my last post I discussed how to save a recording from Tropo using ASP.NET MVC and VoiceModel. I also discussed one of the issues I had to deal with was a difference in how VoiceXML and Tropo handle recordings.  A nice feature in VoiceXML is that you can listen to the recording on the IVR before you save it. With Tropo's Web API there is no mechanism to do this.  The goal of VoiceModel is to develop your voice application once and you can run it on either a VoiceXML or Tropo platform,  therefore I had to make both behave in the same manner.  The solution was to save the recording immediately on completion and to let the user listen to the recording on the application server that VoiceModel is deployed on.

In order to grab the correct recording from the application server I needed a method to map a recording to the current session. Fortunately both VoiceXML and Tropo send a unique session ID with each request so I used the session ID as the file name for the audio file that is st…

How To Save a Recording in Tropo using ASP.NET MVC

I was having trouble getting recordings to save while adding the Tropo integration to VoiceModel and I could not find any good examples on how to do this.  Even the examples for TropoCSharp did not show how to save the recordings.  I was able to figure out a solution so I thought I would share it here since there is a lot of requests on the forums to see an example for C# and .NET.  This example was developed using ASP.NET MVC 4.

I thought I could reuse the same action on the VoiceModel controller to save recordings in VoiceXML applications, but it turned out that was not the case. When saving a recording in VoiceXML the voice browser wants the next VoiceXML document when it is completed, which is not the case for Tropo.  The only response that Tropo is looking for is whether it gets an HTTP 200 success code or not.

The other issue is that the MVC controller action wants to match the name in the multipart form data  request with name given for the HttpPostedFileBase object.  Let me sh…

Progress on Tropo Integration in VoiceModel

We are making progress on the Tropo integration in VoiceModel.   This will allow applications developed in VoiceModel to run as VoiceXML applications or Tropo applications without any changes.  All you have to do is change your application URL in the platform configuration.  So if you deploy your application at http://myServer/myApp  and  have a VoiceModel controller called myController then the starting URL set in Tropo would be http://myServer/myApp/my/StartTropo.  That is all there is to getting your Tropo application running.

We are going through the sample applications and using them as a test bed.  Just finished the WeatherVoice example which asks the caller to enter their zip code, retrieves the weather conditions for the area from a service, and voices the data back.  Give it a try by getting the latest version in source control. You can run WeatherVoice on either Voxeo's Prophecy IVR (in the cloud or on premise), on any VoiceXML compatible IVR, or on Voxeo's Tropo ser…

VoiceModel Supports ASP.NET MVC 4

The latest release of VoiceModel allows developers to easily create VoiceXML applications using ASP.NET MVC 4.  Previously VoiceModel only worked with ASP.NET MVC 3. In addition, all of the projects now open in Visual Studio 2012.

Is there a new feature you would like to see in VoiceModel. You can add feature requests or vote on existing feature requests on the VoiceModel Project Site in the Issue Tracker.

Google Weather API is Dead

It looks like Google has killed its unofficial weather service API.  I caught wind of it when I saw a lot of inquiries about it on StackOverflow.  Now when you make a request to the API it returns "Unsupported API".  One of VoiceModels examples used the Google weather API to demonstrate how to get information from a service and voice it back.  When I found this out I searched for another free weather service and found MSN. The example WeatherVoice now uses the MSN service.  The example was written so that it is easy to insert new services or even use a mock-up service when testing.  If you need a replacement for using the Google weather API you may want to check out the example to see how you can use MSN for the same information.

VoiceModel Mayhem Add-On Wins Honorable Mention

An add-on for the open source project Mayhem that was developed using VoiceModel just won an honorable mention in the Make Mayhem Contest.  There were some pretty cool add-ons developed for Mayhem in this contest and you can view the winners on FaceBook. I recently posted about this add-on and the contest.  You can read about it here.  There was not enough time to submit everything intended for Mayhem in this contest. The way this solution was designed it would be easy to send commands to Mayhem via text messages (SMS) using a service like Tropo or SMSIified.  Work is currently being done to integrate VoiceModel with Tropo which would allow VoiceModel applications to also communicate using SMS.  And it is intended to create an add-on that would control Z-Wave devices in a home for home automation. This would allow you to control lighting and other devices in your home by sending a text message.  Watch this blog for future development.

Tropo My VoiceModel

I recently became interested in Tropo to easily develop applications that support voice and SMS.  Tropo is another service provided by Voxeo.  Voxeo also has the Prophecy platform which allows you to develop voice applications using VoiceXML that can be deployed in the cloud or as an on-premise solution.  The VoiceModel framework lets you easily develop VoiceXML applications using ASP.NET MVC and C# and it has been extensively tested on Prophecy. So why the interest in Tropo? How does it differ from VoiceXML development?

Tropo is interesting to me because of its pricing structure for putting applications into production in the cloud.  With many VoiceXML platforms, like Prophecy, there are some up front costs to deploy your app and the pricing structure depends on the amount of minutes you intend to use.  You often have to agree to some minimum minutes that you will use per month. With Tropo it is a simple pricing model. There are no up front costs for going into production, there is j…

Who Killed ASP.NET MVC?

I recently gave a presentation at a .Net Developer Group meeting about the architecture of VoiceModel and how it promoted reuse by using ASP.NET MVC as the underlying technology. After the presentation I was having a discussion with the attendees and one of them said, "I heard that MVC is a dying technology." I was kind of taken aback by this comment and wondered where he got this information from. Did I miss some news flash from Microsoft?  He could not remember the source and went on to say, "Yeah, I heard that it is being replaced by ASP.NET Web API".  I assured him that it did not seem possible that Microsoft would abandon a technology that is obviously popular with developers and has an upcoming release with MVC 4, and that Web API is just an extension of MVC that serves a very specific purpose.

For those of you not familiar with Web API it is part of the upcoming MVC 4 release and allows developers to easily create RESTful web API's using the familiar MVC…

Making Mayhem with VoiceModel

Image
I recently used VoiceModel to create an add-on module for Mayhem, an open source project developed by Microsoft that allows non-programmers to use their computers to automate anything.  You can find out more about Mayhem here and about the contest that is running until the end of the month for contributing add-on modules.  I have submitted the add-on module called RemoteCommand which makes it easy to integrate Mayhem with an IVR application.  Watch this video to see how Mayhem, RemoteCommand, and VoiceModel can be used together to automate actions through commands given over the telephone.


The voice application used in this demonstration can be found in the VoiceModel examples found in the source code.  This example demonstrates how to dynamically build speech grammars with VoiceModel. I plan on using this for home automation by creating another Mayhem add-on module for Z-Wave devices.  This will allow for controlling Z-Wave devices in your home with voice commands over the telephone.…

How to Build an Open Source Reusable Framework in ASP.NET MVC

I will be giving a presentation on how to create an open source reusable framework using ASP.NET MVC to the local .Net Developer Group in Sarasota, Florida on June 20, 2012.  In this presentation I will be covering the architecture behind VoiceModel, an open source project available on CodePlex that makes it easier to develop VoiceXML applications using ASP.NET MVC, Razor and C#.  If you are in the area be sure to drop by.  The exact time and directions are available here.  I think you will find the presentation very informative. And as always after the meeting there will be continued discussions and networking at the Cock & Bull. They have the greatest beer selection in Sarasota, if not all of Florida.  So come and join in on a fun and informative evening.

How To Create a Menu Using VoiceModel

VoiceModel does not contain a Menu object that will present users with options and branch in the call flow based on the users input.  So how do you add a menu to your voice application when using VoiceModel? Easy. Just add an Ask object and put conditions on the transitions for the state that renders the Ask object to the IVR browser.  Here is some sample code that you can find in the examples for VoiceModel.

public class HomeController : VoiceController { public override CallFlow BuildCallFlow() { CallFlow flow = new CallFlow(); flow.AddState(ViewStateBuilder.Build("mainMenu", new Ask("mainMenu", "Press one for option one. Press two for option two.", new Grammar("digits?maxlength=1"))) .AddTransition("continue", "optionOne", new Condition("result == '1'")) .AddTransition("continue", &q…

Reusable Dialog Components Revisited

A while back we added support in VoiceModel for Reusable Dialog Components (RDC), which I discussed in a previous blog post.  It was an effective implementation but I kept thinking there must be an easier way to create and use RDC's.  After a looking more closely at SCXML and state machines the answer came to me; composite state machines.  Harel State Machines allow for superstates which are composed of nested state machines.  When a superstate becomes active it first runs the nested state machine that is composed of.  This seemed like a natural fit for RDC's; just make them a nested state machine of the main state machine (call flow).  VoiceModel has been updated to provide support for composite state machines. A lot of other changes have been made to VoiceModel's state machine to make it easier to persist to something like SCXML, actions are now implemented with delegates or lambda expression, and conditions on transitions now support expressions written in Javascript by…

Voice Application Call Flows: State Machine, Workflow, or Rules Engine

Image
I have been doing some work with workflow engines lately and it got me thinking; what is the difference between a workflow and a state machine? Further reflection had me wondering whether a voice application call flow is best represented by a state machine or a workflow. Discussions I had while working with the VoiceXML Forums Tools Committee raised a third option of using rules engines for more complex applications.  So what is the best option for implementing a voice application? To determine this lets examine what each method of modeling application logic actually is.  But first lets make sure we are on the same page as to what a voice application call flow is.

Voice/IVR application call flows are usually designed on paper prior to implementation. This design shows the possible paths a user can take through the voice application depending upon their responses and data that is returned by external and internal systems. A common method of depicting call flow is to use a tool like Vis…

Creating Reusable Dialog Components with VoiceXML

UPDATE: How Reusable Dialog Components in VoiceModel are created and used has been greatly simplified. Go to this post for more details.

This post is a continuation of a previous post on using Reusable Dialog Components (RDC).  In this post we will look at creating Reusable Dialog Components for a VoiceXML application using VoiceModel.  VoiceModel is an open source project that makes development of VoiceXML applications easier using ASP.NET MVC, C#, and Razor.  Reusable Dialog Components are reusable libraries that make development of VoiceXML application easier as discussed here.  In this example we will create an RDC for getting a date from a user using a telephone keypad.

To get started create a class library project in Visual Studio.  VoiceModel is developed in Visual Studio 2010 using .NET Framework version 4.0.  Next include in the references System.Web, System.Web.Mvc, VoiceModel, and MvcContrib.  MvcContrib is available via NuGet and is used for the Portable Areas that it supp…

Using VoiceXML Reusable Dialog Components

In a previous post I discussed what Reusable Dialog Components (RDC) are and the basis for adding support for them in the VoiceModel Project.  In this post I will discuss how to use RDC's with  the VoiceModel framework, which allows developers to create advanced voice applications using ASP.NET MVC, C# and Razor.  This will walk you through the example for RDC's in the VoiceModel Project that you can download from here.  Download the complete project for version 0.5 on this page and you will find this example in the project directory ReusableComponentEx.

To get started create a new empty MVC 3 project in Visual Studio.  Next, include a reference to the VoiceModel assembly and the RDC assembly.  The RDC assembly is called GetDateDtmf.  This RDC provides a dialog for collecting a date from the user using the telephone keypad.  VoiceModel uses a technology called Portable Areas to be able to reuse Controllers, Views, and other resources that are available in an assembly.  In orde…

Reusable Dialog Components in VoiceXML

Reusable Dialog Components (RDC) are an important part of making development of VoiceXML more productive.  There are portions of any VoiceXML application that are often repeated and therefore like any application development environment we need a modular way to reuse these components.  And often they are repeated across applications. Take for example a dialog to get a date from the user. There are certain common steps to get the date, validate it, confirm that is the date the user intended, and retry if it is invalid or not the intended date.  Rather than repeat the code in your application to get a data over an over again it is much more productive to call a component library that contains this routine.  RDC's can be as simple as getting a date from a user or more complex and build on each other.  For example, an RDC for getting credit card information could be built on smaller RDC's for getting the date (date of expiration), credit card number, and security code.

Another con…

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

Image
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…