Speech Application 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
Download the sample by clicking Download Sample in this topic.
This extracts the sample project to your local hard disk.
Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.
Go to the source directory of the sample.
At the command prompt, type MSBUILD <Solution file name>.
To run the sample
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.
Click Start Phone Session.
Notice the following:
The text that appears simulates a broadcast from a telephone.
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.
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.
© 2007 Microsoft Corporation. All rights reserved.