Deter spam callers using Amazon Connect
Contact centers often receive illegitimate phone calls where the caller is pretending to be someone else by using an existing customer’s phone number. While you might simply fail a check on a web site because you don’t have the right credentials, contact center agents are trained to be polite even when something seems amiss, so they can become a target for social engineering, especially when the contact center uses the automatic number identification (ANI) to identify the customer and look up customer data. Beyond the obvious pain this causes the real customer, it can also tie up agents, which can lead to increased wait times and potential loss of revenue.
This post describes a workflow to detect and deter such calls using Amazon Connect and other AWS services. The solution requires the caller to match a randomly generated three digit code to avoid automated spam calls.
The sequence consists of the following steps:
- Caller calls for customer service
- Call is sent to an Amazon Connect IVR by the carrier Public Switch Telecom Network (PSTN)
- Amazon Connect IVR invokes a Lambda function (Function #1), and passes the customers phone number (ANI) as input.
- The Lambda function queries a DynamoDB table with that ANI and retrieves the customer’s name, if it exists.
- The Lambda function also returns a 3 digit random number.
- Amazon Connect plays back the random number to the caller and requests them to enter this number on their phone keypad.
- If number entry is successful, Amazon Connect greets the caller by their name (if it was returned) and workflow can continue / transfer to an agent, if number entry is not successful, the call is politely disconnected.
The flow is shown in the diagram below.
Deploying the Solution
Most of this sample configuration can be deployed into your account using AWS CloudFormation using a template. The CloudFormation template will create a new stack consisting of an AWS Identity and Access Management (IAM) role, IAM Policy, DybamoDB table and a Lambda Function. The remaining configuration is done in Amazon Connect and the Amazon Connect Console.
The high-level steps to configure are:
- Download the resource pack for this solution
- Deploy the CloudFormation template
- Provide Amazon Connect access to the newly created Lambda functions
- Import & modify Amazon Connect contact flows
- Configure a phone number
For this walk-through, you should have the following prerequisites:
- An AWS account
- An Amazon Connect instance
- Basic understanding of AWS CloudFormation, Amazon Connect, Amazon Dynamo DB, and AWS Lambda
These instructions assume a general working knowledge of Amazon Connect and AWS CloudFormation. For details on how to perform basic administration tasks with either, please refer to:
Deploy the CloudFormation Template
- Download the resource pack
- Unzip the file to your local machine, this will create a Resources folder which contains
- CloudFormation template
- Amazon Connect contact flow
- Login to the AWS Console and open the AWS CloudFormation Console
- Make sure that you have the console open to the same region as your Amazon Connect instance. See Choosing a Region in the Getting Started Guide
- In the CloudFormation console, choose Create stack ->With New Resources
- On the Create stack screen, leave the Prerequisite set to Template is ready
- In the Specify template section, select Upload a template file, then select the Choose file button
- Enter a name for the template, click ‘Next’, select the defaults in the ‘Configure Stack Options’, click ‘Next’, review all the options and check the acknowledgement and click ‘Create Stack’
- Navigate to the Resources folder that you created in step 2, open the CloudFormation folder inside, and select Cloud Formation Template – Deter Spam Callers.json
- Once the template loads, choose Next
- Provide a name for the stack, choose Next
- Apply any Tags as desired. Leave the rest of the options to their defaults and choose Next.
- Review the configuration. At the bottom of the page, select the checkbox to acknowledge that IAM resources may be created.
- Choose Create stack. This will launch the CloudFormation template and create the resources needed. Creation should only take a couple minutes.
- Once the stack is created, the status will change to CREATE_COMPLETE
Give Amazon Connect Access to the New Lambda Functions
- Login to the AWS Console
- Open the Amazon Connect console
- Choose the name of the instance from the Instance Alias column.
- In the navigation pane, choose Contact flows.
- For AWS Lambda, select RetrieveFirstNameFromANI from Function and choose Add Lambda Function. Confirm that the ARN of the function is added under Lambda Functions.
Import the Amazon Connect Contact Flow
- Log in to your contact center using your access URL.
- In the navigation pane, choose Routing, Contact flows.
- Choose Create contact flow. This opens the contact flow designer and creates an inbound contact flow (Type = Contact flow).
- Select the down arrow next to the grayed out Save button and choose Import flow (beta)
- Choose Select
- Navigate to the resources folder and select the “Amazon Connect Contact Flow – Deter Spam Calls” file in the ContactFlows folder, then choose Open
- Choose Import
- Once the flow imports, edit the third object in the flow, ‘Invoke AWS Lambda function’ by double-clicking the title
- Drop down the combo box for ‘Select a function’ and select the Lambda function that was added by the CloudFormation Template
- Click on the ‘Set working queue’ and in the properties, update the queue to an existing queue.
- Hit ‘Save’ and exit the object.
- Publish the contact flow
- In the navigation pane, choose Routing, Phone Numbers.
- Chose an existing phone number or claim a new one. Refer to the Claim a Phone Number section of the Administrator Guide for more information
- For the Contact flow / IVR value, choose the newly imported contact flow.
- Note the phone number and select Save.
Validate the Solution
- Wait roughly two minutes for the contact flow to publish and the phone number to reassign to the new flow.
- Update the Dynamo DB table with your phone number in the E.164 format and your first name – for example, phone-number = +14085550100, FirstName = John
- Dial the phone number that you configured in Amazon Connect from the phone number +14085551212
- IVR Playback: Hello, John. Please enter 565
- Customer enters ‘565’
- IVR Playback: Please hold for the next available agent.
- Change the phone number in Dynamo DB to be phone-number = +14085551213 and place a call again.
- IVR Playback: Please enter 785
- Customer enters ‘785’
- IVR Playback: Please hold for the next available agent.
- Call from an unknown ANI (for example, +14085551213)
- IVR Playback: Please enter 757
- Customer enters ‘400’
- Call is disconnected
Adapt to Your Use Case
This configuration can easily be adapted to your use cases. The contact flow can be used as the authentication flow in a larger business specific workflow. The Dynamo DB table or any database table with customer phone numbers can be used as a source of truth for authentication.
To avoid incurring future charges, disconnect the contact flow from the phone number that you used. If you claimed a new phone number, you should also release it. The remaining resources can be deleted by deleting the CloudFormation stack, which will remove the Lambda functions, DyanmoDB table, and the IAM resources used in this sample.
The blog post demonstrates a way to thwart spam callers. Additional reporting can be added to demonstrate the number of calls identified as spam and disconnected – which could be built in future blog posts.