Compartir a través de


How to: Add a Dynamic Prompt

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.

Add dynamic prompts in a Speech Server voice response application to, for example, add the result of a run-time SQL query to prompt text.

Adding Dynamic Prompt Text to a Workflow Activity

The following procedure describes how to add dynamic prompt text to a QuestionAnswerActivity class.****You can also use the StatementActivity class in the procedure. This procedure dynamically adds numbered slots to the prompt string. The slot numbering is zero-based, with no upper limit enforced by Speech Server.

To add dynamic prompt text

  1. Create a new voice response application.

    For more information, see How to: Create a Voice Response Application.

  2. In Solution Explorer, right-click VoiceResponseWorkflow1.cs, and then select View Designer.

  3. On the View menu, click Toolbox.

  4. In the Toolbox, click Speech Dialog Components to display speech activities.

  5. In the Toolbox, drag and drop a QuestionAnswer speech dialog component onto the design surface.

  6. On the design surface, right-click questionAnswerActivity1, and then click Property Builder.

  7. In the QuestionAnswer Property Builder dialog box, click the Prompts tab, and then type your prompt text in the Main box.

  8. Click Add Slot, and then note the new variable slot in the Main box.

  9. Click Show Event Handler.

  10. Enter code similar to the following example.

    // Fill the slots in the prompt, if any are present
    questionAnswerActivity1.Prompts.MainPrompt.SetText(GetPromptResource(questionAnswerActivity1.Prompts.MainPrompt.Id), "slot0Value");
    

See Also

Tasks

Walkthrough: Access Dynamic Data

Other Resources

Speech Server Tutorials
Sample and Reference Applications