How do I set up extensions for agent-to-agent calling in my Amazon Connect contact center?

Last updated: 2021-03-24

I want agents in my Amazon Connect contact center to be able to call one another directly. How can I set up extensions so they can do that?

Short description

To allow agents in your Amazon Connect contact center to call one another using direct extensions, do the following:

Important: Make sure that you follow these steps in the same AWS Region that your Amazon Connect instance is in.

Resolution

Create a DynamoDB table that holds agent login names and their extensions

1.    Open the DynamoDB console.

2.    In the Create DynamoDB table screen, do the following:
For Table name, enter AgenttoAgent.
For Primary key, in the Partition key panel, enter Extension.
For Data type, choose String.

3.    Choose Create.

4.    Assign a unique extension to each agent login name. Then, add the extensions and agent login names to the table.
Note: For more information on how to edit DynamoDB tables, see Write data to a table using the console or AWS CLI.

Create an IAM role that a Lambda function can assume to look up an agent login name in DynamoDB

Use the following JSON policy to create an IAM role:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "dynamodb:BatchGetItem",
                "dynamodb:GetItem",
                "dynamodb:Query",
                "dynamodb:Scan",
                "dynamodb:BatchWriteItem",
                "dynamodb:PutItem",
                "dynamodb:UpdateItem"
            ],
            "Resource": "Replace with ARN of DynamoDB table you created"
        },
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": "*"
        }
    ]
}

Create a Lambda function that queries the DynamoDB table with an extension input and returns the corresponding agent login name from the table

Use the following Python code to create a Lambda function and attach the role created previously:

import json
import boto3
from boto3.dynamodb.conditions import Key


def get_agent_id(Extension, dynamodb=None):
    if not dynamodb:
        dynamodb = boto3.resource('dynamodb')

    table = dynamodb.Table('AgenttoAgent')
    response = table.query(
        KeyConditionExpression=Key('Extension').eq(str(Extension))
    )
    return response['Items']


def lambda_handler(event, context):
    Extension = event['Details']['Parameters']['Extension']
    AgentLoginName = get_agent_id(Extension)
    for agent in AgentLoginName:
        print(agent['Extension'], ":", agent['AgentLoginName'])
        
    print(AgentLoginName)
            
    return agent

Add the Lambda function to your Amazon Connect instance

1.    Open the Amazon Connect console.

2.    In the Instance Alias column, choose the name of your Amazon Connect instance.

3.    In the left navigation pane, choose Contact flows.

4.    In the AWS Lambda section, choose the Function dropdown list. Then, choose the Lambda function that you created in the previous section.
Note: The Function dropdown list names only the functions that are in the same Region as your Amazon Connect instance. If no functions are listed, choose Create a new Lambda function to create a new function in the correct Region.

5.    Choose Add Lambda Function. Then, confirm that the ARN of the function is added under Lambda Functions.

Now, you can refer to the Lambda function you created in your Amazon Connect contact flows. For more information about integrating Lambda with Amazon Connect, see Invoke AWS Lambda functions.

Create a customer queue flow (AgentQueueFlow) that will check an agent's availability to receive a call

Create a new customer queue flow. After you choose Create customer queue flow, the contact flow designer opens.

In the contact flow designer, do the following:

Add a Check staffing block

To check if an agent is available to receive a call, use a Check staffing block.

1.    Choose Branch.

2.    Drag and drop a Check staffing block onto the canvas to the right of the Entry point block.

3.    For Status to check, choose Available.

4.    Choose Save.

Note: You will see three outputs from the Check staffing block: True, False, and Error.

Add a Loop prompts block to the True output of the Check staffing block

To play prompts while a caller is in the queue, use a Loops prompts block.

1.    Choose Interact.

2.    Drag and drop a Loop prompts block onto the canvas to the right of the Check staffing block. Then, connect the Loop prompts block to the True output of the Check staffing block.

3.    Choose the block title (Loop prompts). The block's settings menu opens.

4.    For Prompts, choose Text-to-speech. Then, enter the following prompt: "Now we will be transferring the call to $.External.AgentLoginName"
Note: You can change the prompt to match your specific use case.

5.    Choose Add another prompt to the loop.

6.    Choose Audio recording. Then, choose the music you'd like callers to hear while they wait for the dialed agent to accept the call.

7.    For Interrupt, choose Interrupt every 1 minutes, or whatever timeframe you'd like the call to timeout in.

8.    Choose Save.

Add a Loop prompts block to the False and Error outputs of the Check staffing block

1.    Choose Interact.

2.    Drag and drop a Loop prompts block onto the canvas to the right of the Check staffing block. Then, connect the Loop prompts block to both the False and Error outputs of the Check staffing block.

3.    Choose the block title (Loop prompts). The block's settings menu opens.

4.    For prompts, choose Text-to-speech. Then, enter the following prompt: "The agent you are trying to reach is either not available or is busy on another call. Please try again later."
Note: You can change the prompt to match your specific use case.

5.    For Interrupt, choose Interrupt every 4 seconds, or the time it takes to complete whatever prompt you entered in step 4. After this time period, a timeout branch starts.

6.    Choose Save.

Add a Disconnect block

1.    Choose Terminate/Transfer.

2.    Drag and drop the Disconnect block onto the canvas to the right of the Loop prompts blocks.

3.    Connect all of the Timeout and Error branches to the Disconnect block.

4.    Choose Save to save a draft of the flow. Then, choose Publish to activate the contact flow.

Create an inbound contact flow (AgentToAgentCall) that triggers the Lambda function when an agent calls another agent's extension.

Create a new inbound contact flow. After you choose Create contact flow, the contact flow designer opens.

In the contact flow designer, do the following:

Note: The following is an example of a basic inbound contact flow. You can need to add or edit blocks for your specific use case. For example, error branches can be connected to the Play prompt blocks to play a custom message.

Add a Store customer input block

To store extension inputs from agents making agent-to-agent calls use a Store customer input block.

1.    Choose Interact.

2.    Drag and drop a Store customer input block onto the canvas to the right of the Entry point block.

3.    Choose the block title (Store customer input). The block's settings menu opens.

4.    Choose Text-to-speech. Then, enter a message that asks callers to enter an agent's extension. For example: "Please enter the agent's extension number to continue."

5.    In the Customer input section, choose Custom. Then, enter the maximum number of digits that you'd like to use for each agent's extension.

6.    Choose Save.

Add an Invoke AWS Lambda function block

To invoke the Lambda function and have it return the agent login name that corresponds to the extension input, use the Invoke AWS Lambda function block.

1.    Choose Integrate.

2.    Drag and drop an Invoke AWS Lambda function block onto the canvas to the right of the Store customer input block.

3.    Choose the block title (Invoke AWS Lambda function). The block's settings menu opens.

4.    Choose the Lambda function that you created earlier.

5.    In the Function input parameters section, click Add a parameter and choose Use attribute. Then, do the following:
For Destination key, enter the attribute name Extension.
For Type, choose System.
For Attribute, choose Stored customer input.

6.    Choose Save.

Add a Set working queue block

To set the working queue as an agent's queue, use a Set working queue block.

1.    Choose Set.

2.    Drag and drop a Set working queue block onto the canvas to the right of the Invoke AWS Lambda function block.

3.    Choose the block title (Set working queue). The block's settings menu opens.

4.    For Outputs, choose By agent. Then, choose Use attribute and do the following:
For Type, choose External.
For Attribute, enter AgentLoginName (the attribute returned by the Lambda function.)

5.    Choose Save.

Add a Set customer queue flow block

To specify the flow that you want to invoke when an agent enters another agent's extension (AgentToAgentCall), use a Set customer queue flow block.

1.    Choose Set.

2.    Drag and drop a Set customer queue flow block onto the canvas to the right of the Set working queue block.

3.    Choose Select a flow.

4.    Choose AgentQueueFlow.
Note: You will create the AgentQueueFlow customer queue flow in the next section.

5.    Choose Save.

Add a Transfer to queue block

To end the contact flow (AgentToAgentCall) and place callers in the customer queue flow (AgentQueueFlow), use a Transfer to queue block.

1.    Choose Terminate/Transfer.

2.    Drag and drop a Transfer to queue block onto the canvas to the right of the Set customer queue flow block.

Note: No settings need to be configured for the Transfer to queue block for this use case.

Add a Disconnect block

To disconnect a caller from the contact flow (AgentToAgentCall) after they've been transferred to the customer queue flow (AgentQueueFlow), add a Disconnect block.

1.    Choose Terminate/Transfer.

2.    Drag and drop the Disconnect block onto the canvas to the right of the Transfer to queue block.

3.    Choose Save to save a draft of the contact flow. Then, choose Publish to activate the contact flow.

Important: Make sure that you assign a phone number for agents to use to make internal calls to the AgentToAgentCall contact flow.

Create a quick connect that allows agents to use the internal calling feature

1.    Create a quick connect using the following configurations:
Name the quick connect InternalCalling.
For Type, choose External.
For Destination, enter the number you assigned to the AgentToAgentCall contact flow.

2.    Add the InternalCalling quick connect to the queues assigned to the agents that you want to have access to the internal calling feature.

Note: The cost of each call depends on the duration of the call. For more information on pricing, see Amazon Connect pricing.


Did this article help?


Do you need billing or technical support?