Udostępnij za pośrednictwem


RecognizeSpeech (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 RecognizeSpeech sample shows how to use both inline and URI-based grammars to recognize speech. When the sample runs, it plays a welcome message and prompts the caller to say a number between one and ten. The sample uses an inline grammar to recognize the answer and plays the recognized number. The sample then prompts the caller to say a number between 11 and 20. The sample uses a URI-based grammar for this prompt and plays the recognized number. The final prompt requests the caller to say a number between 1 and 20. For the final recognition, the sample activates both the inline and URI-based grammars to recognize the number and plays the recognized number.

The sample has been configured with Silence and No Recognition prompts as well as a Help grammar and corresponding Help messages for each prompt.

  • Recognizing speech using an inline grammar, a URI-based grammar, and a combination of inline and URI-based grammars
  • Setting up and enforcing a maximum number of recognition attempts for the application
  • Using context-specific help prompts

Running the Sample

To run the sample

  1. In the Samples\Workflow\RecognizeSpeech\ 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 input, click Start Recording, and then say a number in the appropriate range.

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

    The application plays the number it recognized.

  6. Say "help" after any prompt.

  7. Before you speak, click Start Recording, and then click Submit when your utterance is recognized.

    The application plays a context-specific help message.

  8. To emulate error input, click Error Emulation in the User Input pane, click Silence or No Recognition to indicate the type of error to emulate, and then click Submit.

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.