AWS Contact Center

Monitor the health of phone numbers in Amazon Connect

When managing your contact center, knowing if your claimed phone number is customer reachable in Amazon Connect instead of a busy signal or a “not in service” message is crucial to your business.  Your phone number(s) might become unreachable due to various unforeseen circumstances like carrier issue, release of phone number, and others.

This blog post shows how to leverage AWS services to check the reachability of your phone number and send a status message via SMS to your mobile phone on a schedule basis.


The following architecture diagrams shows how the use of an AWS Lambda function to execute an outbound contact flow dialing into an Amazon Connect phone number that play a series of DTMF tones back to confirm if your phone number is working.  Once confirmed, a text message is sent to your mobile number of the result.


  1. A scheduled AWS EventBridge rule execute the AWS Lambda function to make the outbound call using Amazon Connect.
  2. Amazon Connect makes an outbound call to the inbound phone number that you want to check if it is working with a specific caller id.
  3. The Amazon Connect inbound phone number executes a contact flow to look for specific caller id and playback specific DTMF tones sequence.
  4. The Outbound Contact Flow receive the DTMF digits and update a contact attributes on the call.
  5. The AWS Lambda function wait 10 seconds for the contact attributes to be set and retrieve the value using GetContactAttributes.
  6. Check if the collected digits are valid or not to determine what status message to send via AWS SNS.
  7. The designated mobile phone number would get the status message.

By using the Amazon Connect StartOutboundVoiceContact API with an Amazon Connect Contact Flow to make an outbound call to get a status update on the reachability of your Amazon Connect’s phone numbers.


For this walkthrough, you should have the following prerequisites:

  • An AWS account
  • An existing Amazon Connect instance with inbound and outbound telephony capability
  • Access to the following AWS services:
    • AWS Simple Notification Services
    • AWS Lambda with access to create functions
  • Access to software that can generate a wav file with DTMF tone. Audacity is used as an example in this blog post


Create a DTMF wav file using Audacity

    1. Install and launch Audactiy
    2. In the menu, choose Generate -> DTMF Tones…
    3. Put in the sequence of digits with a hashtag to use for verification like this “31642#”
    4. Amplitude: 0.8
    5. Duration: 5 seconds
    6. Take the default for the rest, and it should look like this:                                                                                                                                       
    7. Click OK to generate the wav
    8. From the menu, choose File -> Export -> Export Audio…
    9. Name your file and for “Save as type”, choose “WAV (Microsoft) signed 16 bit PCM”

Upload the wav file to Amazon Connect as a prompt

  1. Login to your Amazon Connect instance and follow the instructions “To create a prompt”
  2. Upload the wav file that you generated when creating the prompt

Claim a new phone number for outbound dialing purposes

  1. Login to your Amazon Connect instance and follow the instructions “Claim a phone number in your country”

Add logic in your current Contact Flow that is associated to the phone number that you want to check for reachability

    1. Find and edit your Contact Flow that handles the inbound phone number that you would like to check for reachability
    2. Add “Check contact attributes”, “Play prompt”, “Disconnect” block at the beginning of your flow and connect them like below 
    3. In “Check contact attributes” put in the phone number you just claim from step 3 for outbound purposes so the Contact Flow play the DTMF prompt when it has a match. For example, you claimed +13334445555, and it would look like the following:                                                                                                                                              
    4. In “Play prompts”, choose the prompt you create and uploaded that contains the DTMF tones you generated using Audacity like the following:

Create a new Contact Flow for outbound dialing to retrieve the DTMF digits

    1. Login to your Amazon Connect instance and create a Contact Flow by importing this flow
    2. After publishing the contact flow, get the contact flow ID by click on “Show additional flow information” and copy the contact flow id to be used later as shown below:

Deploy the AWS Cloudformation stack:

Launch the AWS CloudFormation stack here:

  1. Enter the name you want to give under Stack Name, this has to be unique.
  2. Enter the name of your Amazon Connect Instance ID, follow this link to learn how
  3. Enter the Contact Flow ID you copied down from step 5
  4. Enter the phone that you want to check with the modified Contact Flow from step 4 above as the Destination Number
  5. Take the default AWS EventBridge rule name PhoneHealthCheck-Rule or change it.
  6. Enter the mobile phone number to get the status message in PageNumber
  7. Enter the cron expression to schedule the health check time, the default value schedule is to execute this check everyday at 3:00 PM UTC
  8. Enter the claimed number for outbound use from step 3
  9. Enter the sequence of numbers entered from step 1 without the hashtag symbol as the SuccessCode

Testing the solution

    1. To manually test your phone number using AWS Lambda, open AWS Lambda function call PhoneHealthCheck which got created when running your AWS Cloudformation Stack:
    2. In AWS Lambda function, choose Select a test event configure test events as follow

“CF_ID”: “5ca32fbd-8f92-46af-5678-6b0f970f0efe”,
“DEST_NUMBER”: “+11234567890”,
“INSTANCE_ID”: “9308c2a1-1234-1234-8290-6c0b4a6d38fa”,
“PAGE_NUMBER”: “+11234567890”,
“SOURCE_NUMBER”: “+11234567890”,
“SUCCESS_CODE”: “31642”

  1. Edit the different values as follow:
    CF_ID: Replace this with the contact flow id you saved earlier
    DEST_NUMBER: The phone number you want to check for reachability
    INSTANCE_ID: The Amazon Connect instance ID that makes the outbound call
    PAGE_NUMBER: The mobile phone number where the AWS Lambda function sends the text message to.
    SOURCE_NUMBER: The newly claimed phone number for outbound calling purposes that you input into the “Check contact attributes” earlier
    SUCCESS_CODE: the 5 digits code you created as a prompt earlier
  2. And invoke your AWS Lambda function to perform the test.


To avoid incurring charges, you can either disable the AWS EventBridge Rule or delete the AWS Cloudformation stack that was created. In Amazon Connect, remove the two Contact Flow blocks you added into your main flow and release the phone number you claimed for outbound dialing purposes.


You have now created a solution to get a status of your Amazon Connect’s phone number reachability so you can react and take action on a schedule. You can create more AWS EventBridge rules using the PhoneHealthCheck AWS Lambda function to test if you have more than one phone number.