Business Productivity

Using call metadata to enhance insights provided by Amazon Chime SDK call analytics

Introduction

On 27 Mar 2023, Amazon Chime SDK launched the call analytics feature to help organizations extract real-time insights from voice conversations. This blog explains the steps required to enhance the data lake created for use with Amazon Chime SDK call analytics by parsing the metadata provided by a voice infrastructure. Metadata parsing is done by deploying a AWS CloudFormation Template (CFT).

Real-time insights provided by Amazon Chime SDK call analytics include speaker search, voice tone analysis, turn-by-turn transcripts, and customer and agent sentiment. These insights are provided by analyzing the call audio streamed into AWS through Amazon Chime SDK Voice Connector. Audio streaming is enabled through Session Initial Protocol recording (SIPREC) from a voice infrastructure such as Session Border Controller (SBC) that supports the SIPREC protocol. Developers can turn on streaming by using the AWS Management Console for Amazon Chime SDK. Insights provided by Amazon Chime SDK call analytics are stored in a data lake, and they can be visualized using tools such as Amazon QuickSight.

In addition to real-time audio, the SIPREC protocol provides call metadata that contains valuable information such as an identifier to uniquely identify the call, call timestamps, stream identifiers to identify each media stream, and participant identification. This information can be used to do post-call analytics by correlating with the insights provided by Amazon Chime SDK call analytics. For example, a contact center supervisor can improve agent productivity by listening to call recordings and analyzing insights such as sentiment of the agent. But, the call metadata provided by SIPREC protocol is in Extensible Markup Language (XML) format and needs to parsed to make it consumable in the data lake created for use with Amazon Chime SDK call analytics. Without parsing the metadata, customers cannot query the metadata to correlate it with the insights provided by Amazon Chime SDK call analytics.

In this post we describe the steps required to deploy an AWS CFT that will parse a subset of the metadata fields and deliver them to the data lake. This will enable customers to query the metadata using Amazon Athena to correlate it with the insights provided by Amazon Chime SDK call analytics.

Solution overview

This solution will help you parse the SIPREC metadata coming from the voice infrastructure and deliver the formatted data to the data lake created for use with Amazon Chime SDK call analytics. AWS CFT provided by this solution will enable customers to trigger an AWS Lambda function by attaching to the Amazon EventBridge target that receives events from Amazon Chime SDK Voice Connector. An event is created whenever an audio streaming is started, updated, or ended. The AWS Lambda function will parse the SIPREC metadata and then deliver the Parquet formatted data with explicit columns based on the XML tags to the data lake. The AWS Lambda function will perform the following steps on the metadata:

1. Extract the session id from the metadata as defined by RFC 7865, which defines the metadata standards for SIPREC protocol.

2. Extract participant and stream IDs. Although the specification allows for multiple streams per participant, Amazon Chime SDK Voice Connector uses only a single stream per participant, so there is a 1:1 mapping of participant to stream in the output.

3. Extract other features of the Amazon Chime SDK Voice Connector Streaming session, including: transaction id, call id, voiceConnector id, start time and end time (if it exists).

4. Convert extracted data to Apache Parquet, a column-oriented data file format.

5. Write the data to the specified Amazon S3 bucket, where it can be queried using Amazon Athena.

Architecture diagram for sending formatted metadata to the data lake created by Amazon Chime SDK call analytics

Prerequisites

For this solution walkthrough, you should have the following prerequisites:

·        An AWS account

·        An Amazon Chime SDK Voice Connector configured with Kinesis streaming enabled  and Amazon Chime SDK call analytics in the AWS account

·        An data lake deployed in the AWS account using Amazon Chime SDK call analytics

Solution walkthrough

Step 1: Go to https://github.com/aws-samples/amazon-chime-sdk/tree/main/lambda/call-insights-parsing and follow the instructions to build and deploy the AWS Lambda image to Amazon ECR.

Step 2: Log into your AWS console and paste the below URL in your browser’s address bar. Make sure to enter your region in the URL.

https://{region}.console.aws.amazon.com/cloudformation/home?region={region}#/stacks/quickcreate?templateURL=https://chime-sdk-assets.s3.amazonaws.com/public_templates/AmazonChimeSDKSIPRECTemplate.yaml

For example for us-east-1 the URL will be:

https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?templateURL=https://chime-sdk-assets.s3.amazonaws.com/public_templates/AmazonChimeSDKSIPRECTemplate.yaml

Step 3: Provide the Amazon Chime SDK Voice Connector ID and URI of the data lake (Amazon S3 bucket) that is enabled for Amazon Chime SDK call analytics. The URI of Amazon S3 should be the same as the data lake created by Amazon Chime SDK call analytics. Additionally, provide URI of AWS Lambda image in your ECR repository. Select the checkbox that has the text “I acknowledge that AWS CloudFormation might create IAM resources”.

Step 4: Deploy and verify the AWS CloudFormation template deployment is successful.

Step 5: Visit the AWS Glue Console and the Tables page. Verify the table amazon_chime_sdk_siprec_metadata is present under amazon_chime_sdk_database.

Amazon Athena Console to query metadata from data lake created by Amazon Chime SDK call analytics

Step 6: To query the data in amazon_chime_sdk_siprec_metadata table, navigate to Amazon Athena and then to Query Editor. If you are using Athena for the first time, you will need to set up the query result location. This is an Amazon S3 location where all your query result will be written to. To set up the location, Query editor > Settings > Manage

Settings for Amazon Athena

Then click on Browse S3, and select any bucket [it is recommended to select the same S3 bucket where the data lake is in].

Step 7: Once the query result location is selected, you can query the tables in Query Editor console by writing different SQL queries and hitting Run

Using Amazon Athena Console to query the data lake created using Amazon Chime SDK call analytics

Below is an example query that can be written in Amazon Athena:

The SIPREC metadata written to Amazon S3 bucket can be queried and joined with transcribe call analytics data in Amazon Athena using the following example query:

SELECT
a."callid",a."sessionid",a."detailtype",a. "endtime",a."participant1",a."participant2",a."servicetype", a."starttime",a."stream1", a."stream2",a."transactionid",a."voiceconnectorid"
,json_extract_scalar(a.siprecmetadata,'$.recording.session.extensiondata.agentName_LV') AS "agentName_LV"
,json_extract_scalar(a.siprecmetadata,'$.recording.session.extensiondata.clientID_LV') AS "clientID_LV"
,json_extract_scalar(a.siprecmetadata,'$.recording.session.extensiondata.CallType') AS "CallType"
,json_extract_scalar(a.siprecmetadata,'$.recording.session.extensiondata.nvcPhoneNumber') AS "nvcPhoneNumber"
,b. UtteranceEvent
FROM
"amazon_chime_sdk_database"."amazon_chime_sdk_siprec_metadata" a
JOIN
"amazon_chime_sdk_database"."transcribe_call_analytics" b
ON
a.transactionid = json_extract_scalar(b.metadata,'$.transactionId')

Summary

In this post we covered how you can extract SIPREC metadata to correlate with the insights generated by Amazon Chime SDK call analytics. Deploying the AWS CloudFormation Template (CFT) simplifies the process of extracting metadata. To learn more about generating real-time insights for phone calls using Amazon Chime SDK call analytics, please review the following resources:

Shankar Krishnan

Shankar Krishnan

Shankar is a product manager in the Amazon Chime SDK service where he works with customers across a diverse range of communication workloads. On weekends, he spends time with his family cooking food, hiking, and reading books.

Deepjot Saini

Deepjot Saini

Deepjot is a Data Engineer in Amazon Chime SDK service where he specializes in creating and managing data pipelines for various services. He is skilled in designing, building, and maintaining complex data architectures that support efficient and effective data flow. Additionally, he is proficient in developing data visualization that enable others to better understand and interpret data.

Logan Noel

Logan Noel

Logan is a software development engineer at Amazon Chime SDK working on media pipelines who has a passion for building elegant solutions to complex problems. In his free time, he can usually be found running, bouldering, or appreciating the finer points of a fresh pastry.