Step 1: Designing Main Menu Choices

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 Unified Communications Managed API call distributor application using Microsoft Visual Studio development system. The procedures for creating the walkthrough application build sequentially. Completing the procedures in sequence is important.

To recognize main menu choices

  1. In Visual Studio, create an Inbound Sequential Workflow Console Application (with Code Separation) project.

  2. In the Visual Studio Toolbox, expand Unified Communications Workflow to display workflow activities.

  3. Drag and drop a SpeechQuestionAnswer activity from the Toolbox onto the design surface in communicationsSequenceActivity1 above disconnectCallActivity1.

  4. Rename the question answer activity to qaMainMenu.

  5. Set the MainPrompt property for qaMainMenu to Would you like support, hours, or status?

  6. 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

  1. In the Toolbox, expand Windows Workflow to display the core workflow activities.

  2. Drag and drop an IfElse activity onto the design surface between qaMainMenu and disconnectCallActivity1.

  3. Rename the IfElse activity to ifElseMain. Rename the branch on the left as ifElseHours, and the branch on the right as ifElseSupport.

  4. On the red exclamation mark at the top of ifElseHours, click the arrow, and then click Property 'Condition' is not set.

  5. In the Properties window for ifElseHours, set the Condition property to Code Condition, and then expand the Condition property.

  6. Type conditionHours as a name for the condition.

  7. To set the property, move the mouse pointer onto the design surface adjacent to the Properties window and then click the design surface.

  8. 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");
  9. Right-click the design surface inside ifElseMain and then click Add Branch. Rename the new branch ifElseOrderStatus.

  10. 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");