1. Voice and Video Call Analytics with AWS Chime SDK


    AWS Chime SDK is a set of real-time communication tools that enable developers to build solutions for audio calling, video calling, and screen sharing. To enable analytics for your voice and video calls using AWS Chime SDK, you can utilize various AWS services such as Kinesis Video Streams for media streaming and AWS Chime SDK media pipelines for running analytics on your media streams.

    Below is a Pulumi Python program that sets up an infrastructure for voice and video call analytics using AWS Chime SDK. The program includes the creation of components like an AWS Chime Voice Connector for call management and streaming, a Kinesis Video Stream to capture the media, and AWS Chime SDK Media Pipelines to configure the analytics and insights extraction from the media streams.

    Before we start with the program, let’s understand the resources being used:

    1. VoiceConnector: This resource enables you to connect your telephony infrastructure to the PSTN (Public Switched Telephone Network). You can use it to manage SIP-based media including calls and streaming.

    2. VideoStream: This resource creates an Amazon Kinesis Video Stream, where you can send your media (audio and video) and then process, analyze, and optionally store it.

    3. MediaInsightsPipelineConfiguration: This configuration applies to the media pipelines and allows you to analyze and gain insights from the media streams. For instance, you can extract transcripts, sentiment analysis, and other useful information.

    Now, let's look at the Pulumi program to set this up:

    import pulumi import pulumi_aws as aws # Create an AWS Chime Voice Connector for managing voice calls and streaming. voice_connector = aws.chime.VoiceConnector("voiceConnector", name="MyVoiceConnector", aws_region="us-east-1", require_encryption=False) # Create an Amazon Kinesis Video Stream to capture and manage the media flow. video_stream = aws.kinesis.VideoStream("videoStream", name="MyVideoStream") # Create a Media Insights Pipeline Configuration to enable analytics on the media streams. # This requires setting up elements such as Amazon Transcribe for transcription and # possibly other processing features like sentiment analysis. media_insights_pipeline_configuration = aws.chimesdkmediapipelines.MediaInsightsPipelineConfiguration( "mediaInsightsPipelineConfiguration", name="MyInsightsPipelineConfiguration", elements=[{ "type": "string", # Specify the type of analytics elements you want to include "voiceAnalyticsProcessorConfiguration": { "speakerSearchStatus": "ENABLED", "voiceToneAnalysisStatus": "ENABLED" } }], resource_access_role_arn="arn:aws:iam::123456789012:role/MediaInsightsPipelineRole" # Role ARN with required permissions ) # Apply Media Insights Pipeline Configuration to the Voice Connector for streaming analytics. voice_connector_streaming = aws.chime.VoiceConnectorStreaming("voiceConnectorStreaming", voice_connector_id=voice_connector.id, streaming_notification_targets=["SNS"], # Notification target for streaming events. media_insights_configuration={ "configurationArn": media_insights_pipeline_configuration.arn, "disabled": False } ) # Export resource names and IDs as stack outputs. pulumi.export("voice_connector_id", voice_connector.id) pulumi.export("video_stream_name", video_stream.name) pulumi.export("media_insights_pipeline_configuration_name", media_insights_pipeline_configuration.name)

    In this program, we start by creating an AWS Chime Voice Connector using aws.chime.VoiceConnector. It's used to route the audio and video through AWS services and is configured to the "us-east-1" region. Encryption is not required for this example.

    We then set up an Amazon Kinesis Video Stream through aws.kinesis.VideoStream. This is where the video and audio streams will flow and can be further processed or stored according to your needs.

    Lastly, we configure a Media Insights Pipeline Configuration with aws.chimesdkmediapipelines.MediaInsightsPipelineConfiguration. This is where you define what analytics you want to extract from your media streams, such as transcriptions, sentiment analysis, or other insights.

    After configuring each service, we take the ARN from the Media Insights Pipeline and apply it to the Voice Connector Streaming configuration to enable real-time analytics of your voice and video streams.

    Please replace the dummy role ARN in resource_access_role_arn with the ARN of a role that has the necessary permissions. You may also need to set up additional AWS resources, IAM roles, and policies depending on your specific analytics needs and security requirements.

    Finally, we export the IDs and names of our resources as stack outputs which can be handy if you need to reference these resources from other stacks or for auditing purposes.