Udostępnij za pośrednictwem


CallRouter (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 CallRouter sample is an end-to-end reference application that demonstrates features of a typical call router. The application provides business hours, routes callers based on their needs, and looks up tracking numbers to provide the status of orders. The sample:

  • Demonstrates the function of an end-to-end application that answers incoming calls for a company.
  • Provides developers with a flexible application that they can configure and use as a model for developing call-routing applications.
  • Support for the global command Operator
  • Use of XML files for storing transfer extensions
  • Use of a BlindTransferActivity

Running the Sample

To run the sample

  1. In the Samples\Workflow\CallRouter\ 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.

    When prompted to enter data, the User Input pane opens.

  4. While using a microphone, click Start Recording, and then say the input phrase.

  5. When the recognized result appears in one of the text boxes in the pane, click Submit.

  6. If you are using the keyboard, click the button next to the Text Input box, enter the data, and then click Submit.

Note

The speech recognition engine attempts to interpret each string of adjacent alphanumeric characters that you type into the Text Input box as words. To enter a string that should be interpreted as a string containing alphabetic characters (for example, as part of a tracking number or an initialism), type a period after each alphabetic character. For example, to make the speech recognition engine interpret the character sequence "A-1234-Y" as a tracking number, in the Text Input box type "A. one two three four Y.".

The logic of the CallRouter reference application is complex enough that a single, step-by-step explanation of all the decision points and responses is impractical. Instead, the following sections outline three scenarios using the CallRouter application. These scenarios illustrate the majority of the application's features.

User Scenario 1: Retrieving Shipping Status

To retrieve shipping status

  1. Initiate a call as described in the Running the Sample section.

    The application starts the welcomeStatementActivity and says "Thank you for calling Proseware, Incorporated. You can speak your response at any time." It then starts the askRouteQuestionAnswerActivity and asks "Which would you like? Business hours, shipping status, technical support, or customer service?"

  2. Click Start Recording, and then say "Shipping status."

  3. When your response appears in one of the text boxes in the User Input pane, click Submit.

    The application executes the shippingStatusIntroStatementActivity and says "Shipping status. To look up your information, we'll need your tracking number." It then initiates TrackingNumberSequence, a SpeechSequenceActivity. The first activity in the speech sequence is the askTrackingNumberQuestionAnswerActivity, which says "Please say your tracking number now."

  4. Click Start Recording, and then say "A one two three three Y."

  5. When your response appears in one of the text boxes in the User Input pane, click Submit.

    The application executes trackingNumberConfirmSequence, another SpeechSequenceActivity. This speech sequence contains the confirmTrackingNumberQuestionAnswerActivity and says "Okay, I got the tracking number" and then repeats the tracking number that was spoken. Because this QuestionAnswerActivity uses short time-out confirmation, the caller can respond with phrases such as "no," "no that's wrong," and "stop" to indicate that the tracking number is incorrect. For a complete list of the keywords, see TrackingNumberConfirm.gbuilder.

  6. Click Start Recording, and then say "No."

  7. When your response appears in one of the text boxes in the User Input pane, click Submit.

    The application responds with "Sorry. Let's try that again," returns to the askTrackingNumberQuestionAnswerActivity, and says "Please say your tracking number now."

  8. Click Start Recording, and then say "A one two three four Y."

  9. When your response appears in one of the text boxes in the User Input pane, click Submit.

    The application executes trackingNumberConfirmSequence and the confirmTrackingNumberQuestionAnswerActivity, says "Okay, I got the tracking number," and then repeats the tracking number that was spoken. The application then asks you to confirm this tracking number.

  10. Click Start Recording, and then say "Yes."

  11. When your response appears in one of the text boxes in the User Input pane, click Submit.

    Note

    You can also say nothing. The application interprets silence as implicit confirmation of the tracking number that it previously stated.

    The application then carries out the following operations:

    1. The Closed event handler for confirmTrackingNumber looks up the status of the tracking number entered.
    2. The application executes the orderStatusStatementActivity and says "Your order is currently being processed and will be shipped as soon as possible."
    3. The application executes the askNextActionQuestionAnswerActivity and says "If you're finished you may hang up. Otherwise, to hear your order status again, say Repeat. To start over, say Main Menu."
  12. In the Voice Response Debugging Window dialog box, click the SIP Phone pane, and then click Hang Up to end the call.

User Scenario 2: Asking for Business Hours and an Operator

To ask for business hours and an operator

  1. Initiate a call as described in the Running the Sample section.

    The application executes the welcomeStatementActivity and says "Thank you for calling Proseware, Incorporated. You can speak your response at any time." It then starts the askRouteQuestionAnswerActivity and asks "Which would you like? Business hours, shipping status, technical support, or customer service?"

  2. Click Start Recording, and then say "I would like business hours."

  3. When your response has been recognized and the keyword appears, click Submit.

    The application executes the businessHoursStatementActivity and says "Proseware is open Monday through Friday 8:00 AM to 5:00 PM Pacific Standard Time. If you're finished, you may hang up. Otherwise???" It then returns to the askRouteQuestionAnswerActivity and asks "Which would you like? Business hours, shipping status, technical support, or customer service?"

  4. Click Start Recording, and then say "Operator."

  5. When OperatorCommand appears in the Commands text box, click Submit.

    The application executes the customerServiceStatementActivity and says "Customer service." It then initiates the oneMomentStatementActivity and says "One moment while I transfer your call."

  6. In the Call transfer dialog box, click OK.

User Scenario 3: Asking for Technical Support

To ask for technical support

  1. Initiate a call as described in the Running the Sample section.

    The application executes the welcomeStatementActivity and says "Thank you for calling Proseware, Incorporated. You can speak your response at any time." It then starts the askRouteQuestionAnswerActivity and asks "Which would you like? Business hours, shipping status, technical support, or customer service?"

  2. Remain silent.

    Simulate silence in the Visual Studio 2005 debugger by selecting Error Emulation, clicking the Silence button, and then clicking Submit.

    The application executes the askRouteQuestionAnswerActivity and asks "I didn't hear you. Which would you like? Business hours, shipping status, Technical Support, or Customer Service?"

  3. Click Start Recording, and then say "I need technical support."

  4. When TechnicalSupport appears in the Keyword Values text box, click Submit.

    The application executes the technicalSupportStatementActivity and says "Technical support." It then executes the oneMomentStatementActivity and says "One moment while I transfer your call."

  5. In the Call transfer dialog box, click OK.

Modifying Data Used in the CallRouter Sample

The CallRouter sample uses two XML files: one for transfer extensions and one for order information. No changes are required in these files to run the application, but they can be changed to test other scenarios.

Transfer Extensions

The CallRouter application retrieves transfer extensions from the Extensions.xml file. Each extension in the file is a separate extension node, with name and number attributes. The following sample shows extensions as XML data.

<extensions>
  <extension name="customer service" number="5550"/>
  <extension name="technical support" number="5551"/>
</extensions>

By default, there are two extensions defined in the file. These extensions are described in the following table.

Extensions.xml Entry Description

name="customer-service"

The transfer extension for the customer service option of the main menu. The application also uses this extension for the Operator command.

name="technical-support"

The transfer extension for the technical support option of the main menu.

The oneMomentStatementActivity plays before the application performs any transfer. The TurnStarting event handler method for this activity, oneMoment_TurnStarting, contains logic for loading and querying the Extensions.xml file. This code can be extended to support querying additional extension names in the XML file.

Orders

The CallRouter sample retrieves order status information from the Orders.xml file. Each order in the file is a separate order node. The following sample shows data in Orders.xml.

<orders>
  <order number="A-1234-Y" status="processing">
    <ship-date>02/15/2006</ship-date>
  </order number>
  <order number="R-5678-Y" status="shipped">
    <ship-date>02/01/2006</ship-date>
    <delivery-date>02/10/2006</delivery-date>
  </order number>
  <order number="Q-1234-H" status="shipped">
    <ship-date>01/21/2006</ship-date>
    <delivery-date>02/01/2006</delivery-date>
  </order number>
</orders>

The following table describes the valid attributes and child nodes for an order node.

Type (Node or Attribute) Name Description Valid Value Required?

Attribute

number

The order number.

arbitrary

Yes

Attribute

status

The order status.

"processing" or "shipped"

Yes

Node

ship-date

If status = "processing," this is the estimated shipping date. If status == "shipped," this is the actual shipping date.

MM/DD/YYYY

Yes

Node

delivery-date

Specified only if status == "shipped." If the delivery date is later than the current date, the date is estimated. Otherwise, it is the actual delivery date.

MM/DD/YYYY

No

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.