Step 1: Designing Main Menu Choices
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
This is the first of four topics describing the steps to create the Create an Automated Call Distributor walkthrough application. This sequence of topics demonstrates how the various capabilities of communications workflow activities can be combined to implement a basic Microsoft Unified Communications Managed API call distributor application using Microsoft Visual Studio 2008 development system. The procedures for creating the walkthrough application build sequentially. Completing the procedures in sequence is important.
To recognize main menu choices
In Visual Studio 2008, create an Inbound Sequential Workflow Console Application (with Code Separation) project.
In the Visual Studio 2008Toolbox, expand Unified Communications Workflow to display workflow activities.
Drag and drop a SpeechQuestionAnswer activity from the Toolbox onto the design surface in communicationsSequenceActivity1 above disconnectCallActivity1.
Rename the question answer activity to qaMainMenu.
Set the MainPrompt property for qaMainMenu to Would you like support, hours, or status?
Specify user inputs for the qaMenu.ExpectedSpeechInputs property so that the activity recognizes the three words support, hours, or status. For information about specifying user inputs, see Authoring Grammars.
The decision-making logic for the IfElseActivity class evaluates each branch from left to right. The first branch evaluated as true is followed. The path through the final branch, the last one on the right, is chosen if the true/false logic on the branches to the left fail. As a result, the last IfElseActivity branch does not need code to complete a true/false check. The last branch is chosen only if the true/false check on all other branches fails.
In the following procedure you add three IfElse branches. The first two branches require simple event handler code to evaluate the recognized text from the SpeechQuestionAnswerActivity activity. The third branch is used when the first two branches evaluate as false and it does not need code to evaluate the recognition.
To add an IfElse activity to handle main menu choices
In the Visual Studio 2008Toolbox, expand Windows Workflow 3.0 to display the core workflow activities.
Drag and drop an IfElse activity onto the design surface between qaMainMenu and disconnectCallActivity1.
Rename the IfElse activity to ifElseMain. Rename the branch on the left as ifElseHours, and the branch on the right as ifElseSupport.
On the red exclamation mark at the top of ifElseHours, click the arrow, and then click Property 'Condition' is not set.
In the Properties window for ifElseHours, set the Condition property to Code Condition, and then expand the Condition property.
Type conditionHours as a name for the condition.
To set the property, move the mouse pointer onto the design surface adjacent to the Properties window and then click the design surface.
In the event handler, add a statement to set the Result property to true or false based on the answer to qaMainMenu. For example:
e.Result = (this.qaMainMenu.RecognitionResult.Text == "hours");
Right-click the design surface inside ifElseMain and then click Add Branch. Rename the new branch ifElseOrderStatus.
Because a third branch is added, the second IfElse branch now requires code to complete a true/false check. On ifElseSupport, add a code condition called conditionSupport. For example:
e.Result = (this.qaMainMenu.RecognitionResult.Text == "support");