GlobalCommands (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 GlobalCommands sample illustrates how to use commands by adding Start Over and Cancel commands to the RecognizeSpeech sample application. When run, the application plays a greeting, followed by a message informing the caller that he or she can say "start over" or "cancel" at any time. If the caller says "cancel," the application acknowledges that the caller canceled the application and says goodbye. If the caller says "start over," the sample starts over with the welcome message. Otherwise, this sample is identical to the RecognizeSpeech sample application.
Featured Highlights
- Use of the Command Handler within a speech application workflow
- Use of CommandActivity activities to implement multiple commands
Running the Sample
To run the sample
In the Samples\Workflow\GlobalCommands\ directory of the Speech Server installation directory, open the sample solution file.
To start debugging, press F5.
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.
When prompted for a number between one and ten, click Start Recording, and then say "Cancel."
When cancelCommandActivity appears in the Commands box, click Submit.
The application says "Okay, canceled. Goodbye."
Initiate another call.
When prompted, click Start Recording, and then say a number between one and ten.
When the recognized value appears in the Text Input box, click Submit.
When prompted for a number between 11 and 20, click Start Recording, and then say "Start over."
When startOverCommandActivity appears in the Commands box, click Submit.
The application responds with the welcome message.
Continue through the application prompts and observe that the application recognizes the commands at any prompt.
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.