Udostępnij za pośrednictwem


RejectIncomingCalls (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 RejectIncomingCalls sample illustrates how to reject incoming calls based on Automatic Number Information (ANI) service data. The sample uses a list of forbidden phone numbers. If the forbidden list contains the call's ANI, the application does not answer the call. The application also does not answer calls when no ANI is available. If the ANI is valid and not in the rejection list, the call is answered and the caller's ANI is played.

  • Rejecting incoming calls based on ANI
  • Using an IfElseActivity to determine whether a call should be rejected
  • Using a CallInfo to obtain the ANI
  • Playing telephone numbers using text-to-speech
  • Using AppendTextWithHint in a prompt to play the telephone number appropriately
  • Retrieving data from an XML data file
  • Logging an informational message using LoggingManager

Running the Sample

To run the sample

  1. In the Samples\Workflow\RejectIncomingCalls\ 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, and then enter any number in the Called Party box.

  4. In the Calling Party box, enter a phone number from the ForbiddenNumbers.xml file, and then click Call.

    The application does not answer the call and a displays a Warning dialog box.

  5. Repeat the previous steps using a phone number that is not in the ForbiddenNumbers.xml file.

    The application says the called phone number and says that the call has been accepted.

  6. Add phone numbers to the ForbiddenNumbers.xml file, and then verify that the calls are not accepted for these numbers.

  7. Use logging tools to view the message logged when a call is rejected.

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.