MixedInitiative (Managed Code Sample)

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.

The MixedInitiative sample illustrates how to allow users to control the flow of a dialog using the concept of mixed initiative. The caller can provide multiple pieces of information in a single utterance or simply respond to individual requests for information from the application.

After the welcome message, the sample application asks "Would you like a mocha, latte, or cappuccino?" The caller can respond either with all the information that the application requires (size, drink, and milk choices) or simply answer the question in the prompt.

Depending on the caller's response, the application asks for any missing pieces of information and confirms the caller's responses before disconnecting the call.

  • Creating a multi-token grammar that reuses common rules for drink, size, and milk
  • Retrieving multiple values from a grammar by using the Semantics object
  • Using an IfElseActivity to conditionally skip execution of a QuestionAnswerActivity if the application has already received the data that the QuestionAnswerActivity is designed to collect
  • Using context-specific error prompts

Running the Sample

To run the sample

  1. In the Samples\Workflow\MixedInitiative\ directory of the Speech Server installation directory, open the sample solution file.

  2. To start debugging, press F5.

  3. In the Voice Response Debugging Window dialog box, click the SIP Phone tab, enter any numbers in the Called Party and Calling Party boxes, and then click Call.

  4. When prompted for a drink, click Start Recording, and then say "mocha," "latte," or "cappuccino."

  5. When the recognized value appears in the Text Input box, click Submit.

  6. When prompted for a size, click Start Recording, and then say "tall," "grande," or "venti."

  7. When the recognized value appears in the Text Input box, click Submit.

  8. When prompted for milk, click Start Recording, and then say "whole," "non-fat," or "soy."

  9. When the recognized value appears in the Text Input box, click Submit.

  10. When the call completes, initiate another call, and then respond to the first prompt with a size, milk, and drink (for example, "a tall grande mocha").

  11. When the recognized result appears in the Text Input box, click Submit.

    The application confirms your entire response.

  12. When the call completes, initiate another call, and then respond to the first prompt with a size and drink (for example, "a venti latte").

  13. When the recognized result appears in the Text Input box, click Submit.

    The application confirms your response and then asks for the missing information (milk).

Remarks

This code sample is intended to demonstrate specific Speech Server features. It does not necessarily reflect best practices with respect to security and privacy. You should carefully review any code that you deploy in production for potential security risks and privacy issues.