Speech Application SampleĀ 

Download sample

The speech application sample demonstrates the use of state machines to create flexible processes. It also demonstrates the use of recursive states and state-initialization activities.

The speech application is a typical interactive voice response (IVR) application. The state machine workflow that is used in the application represents a typical telephone application menu that consists of different states that represent the different levels of the menu. In each state, only certain events are valid and represent the options that are available in that menu.

Two menu options are available in every state:

  • The '*' menu option ends the conversation.

  • The '9' option returns to the main menu.

The event handlers that handle these events are attached to the root state machine. Therefore, they are inherited by every state, and are available in every state.

The user interface consists of a series of buttons for communicating with the system. In each state, only a subset of the buttons is enabled. This is done by using the query facility that is available with the state machine model. You can explore the code to see how the StateMachineWorkflowInstance is used to query the state machine and retrieve the current state, and the events that are valid in the current state.

To build the sample

  1. Download the sample by clicking Download Sample in this topic.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the SpeechUI\bin\debug folder, which is located below the main folder for the sample.

  2. Click Start Phone Session.

  3. Notice the following:

    1. The text that appears simulates a broadcast from a telephone.

    2. Only the buttons that correspond to the available menu choices are enabled. You can select any menu item and see how the state machine reacts.

    3. The * and 9 buttons are always active. This is because the event handlers that correspond to those buttons are handled at the root state-machine level

See Also

Other Resources

Tutorial: Create a State Machine Workflow
State Machine Workflows
Ordering State Machine Sample
Windows Workflow Foundation Samples

Footer image

Send comments about this topic to Microsoft.