使用亚马逊 EventBridge 通知 - Amazon Chime SDK

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用亚马逊 EventBridge 通知

Amazon Chime Cal SDK l Analytics 支持在媒体见解渠道的状态发生变化或满足呼叫分析实时警报条件时将事件发送到默认 EventBridge 总线。对于媒体见解管道错误状态更新,我们建议您配置一个 EventBridge 目标,以便在资源异步失败时通知您。来电分析通知有 aws.chime 来源和各种详细信息类型,将在以下各节中共享。有关更多信息,请参阅 Amazon EventBridge 用户指南

状态更新

媒体洞察管道会在呼叫分析会话进行时发送 EventBridge 通知,要么成功结束,要么遇到错误。在以下情况下,您会收到一条包含 “媒体见解状态变更” 详细信息的 EventBridge 通知:

  • 媒体见解管道的状态发生了变化。

  • 媒体见解管道元素的状态发生了变化。

  • 所有管道元素都已停止。

  • 任何管道元素都出现故障。

详细信息部分始终包含以下字段:

  • version

  • mediaInsightsPipelineArn

  • eventType

如果媒体见解管道包含多个元素,例如分析处理器和数据接收器,则详细信息部分还包括一个 mediaInsightsPipelineElementStatuses 字段。此字段表示管道中每个元素的状态。每个管道元素可能的状态可能为:

  • NotStarted

  • InProgress

  • Stopped

  • Failed

详细信息部分还包括在此期间指定的任何键值对 MediaInsightsRuntimeMetadata CreateMediaInsightsPipelineAPI打电话。如果呼叫分析会话是由 Voice Connector 发起的,则元数据部分将自动填充以下参数:

  • transactionId

  • fromNumber

  • toNumber

  • callId

  • voiceConnectorId

  • direction

每当媒体见解管道包含单个元素时,就会出现以下事件类型。展开每个部分以了解更多信息。

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [] "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsInProgress", "version": "0", "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [] "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsPaused", "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [] "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsStopped", "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

表示服务遇到了临时故障,将尝试重试。您无需进行操作。

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [] "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsTemporaryFailure", "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

表示需要您采取措施的故障。使用 failureReason 对问题进行故障排除。典型故障可能包括:

  • 资源访问角色权限不足

  • 资源丢失或已删除

  • 通过代表你调用分析调用的 AWS 服务(例如 Amazon Transcribe 或 Amazon Kinesis)进行限制。

  • KVS直播中的媒体格式不兼容

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [] "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsPermanentFailure", "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string", "failureReason": "string" } }
注意

failureReason 字段为可选项。例如,典型的原因可能是 Access denied when assuming resource access role

每当为由 Amazon Chime SDK Voice Connector 启动的呼叫分析会话创建媒体见解管道或创建尝试失败时,都可能出现以下事件类型。展开每个部分以了解更多信息。

此示例显示了一个典型的成功事件。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [] "detail": { "version": "0", "mediaInsightsPipelineConfigurationArn": "string", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsCreated", "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string", } }

此示例显示了一个典型的故障事件。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [] "detail": { "version": "0", "mediaInsightsPipelineConfigurationArn": "string", "eventType": "chime:MediaInsightsCreateFailed", "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string", "failureOrigin": "Voice Connector", "httpStatusCode": "string", "failureReason": "string" } }

当媒体见解管道包含多个元素时,可能会出现以下事件类型。示例通知针对与 S3RecordingSink 组合使用的 AmazonTranscribeProcessor。展开每个部分以了解更多信息。

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsInProgress", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "InProgress", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "NotStarted", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsInProgress", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "Stopped", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "InProgress", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsInProgress", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "Failed", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "InProgress", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsPermanentFailure", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "Failed", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "Stopped", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string", "failureReason": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsPermanentFailure", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "Stopped", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "Failed", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string", "failureReason": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsPaused", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "Paused", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "NotStarted", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsTemporaryFailure", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "TemporarilyFailed", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "NotStarted", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "region": "string", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsStopped", "mediaInsightsPipelineElementStatuses": [ { "type": "AmazonTranscribeProcessor", "status": "Stopped", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "Stopped", "updatedOn": 1686184070655 } ] "callId": "string", "transactionId": "string", "fromNumber": "string", "toNumber": "string", "voiceConnectorId": "string", "direction": "string" } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "time": "yyyy-mm-ddThh:mm:ssZ", "region": "string", "detail": { "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsInProgress", "version": "0", "mediaInsightsPipelineElementStatuses": [ { "type": "VoiceEnhancementSink", "status": "InProgress", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "Stopped", "updatedOn": 1686184070655 } ] } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "time": "yyyy-mm-ddThh:mm:ssZ", "region": "string", "detail": { "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsStopped", "version": "0", "mediaInsightsPipelineElementStatuses": [ { "type": "VoiceEnhancement", "status": "NotSupported", "updatedOn": 1686184070655, "statusDetail": "Unsupported recording length" }, { "type": "S3RecordingSink", "status": "Stopped", "updatedOn": 1686184070655 } ] } }

此示例介绍了典型的事件结构。

{ "version": "0", "id": "string", "detail-type": "Media Insights State Change", "source": "aws.chime", "account": number, "time": "yyyy-mm-ddThh:mm:ssZ", "region": "string", "detail": { "mediaInsightsPipelineArn": "string", "eventType": "chime:MediaInsightsPermanentFailure", "version": "0", "mediaInsightsPipelineElementStatuses": [ { "type": "VoiceEnhancement", "status": "Failed", "updatedOn": 1686184070655 }, { "type": "S3RecordingSink", "status": "Stopped", "updatedOn": 1686184070655 } ] } }

实时提醒

注意

只有 Amazon Transcribe 和 Amazon Transcribe 通话分析功能处理器支持实时提醒。

Amazon Chime SDK 呼叫分析允许开发人员设置规则,以便在分析会话期间通过处理器发送实时警报。提醒将以详细类型发送到亚马逊 EventBridge Media Insights Rules Matched。 EventBridge 支持与 Lambda、Amazon 和 Amazon 等下游服务集成SQS,SNS以触发终端用户的通知或启动其他自定义业务逻辑。

针对 MediaInsightsPipelineConfiguration 将实时警报设置为 RealTimeAlertConfiguration 字段的一部分。您可以使用 Amazon Chime SDK 控制台来配置该字段,也可以调用 CreateMediaInsightsPipelineConfigurationUpdateMediaInsightsPipelineConfiguration APIs.

此示例说明如何通过创建或更新实时警报配置API。

{ "MediaInsightsPipelineConfigurationName": "config_name", "ResourceAccessRoleArn": "arn:aws:iam::account_id:role/role_name", "RealTimeAlertConfiguration": { "Disabled": false, "Rules": [{ "Type": "KeywordMatch", "KeywordMatchConfiguration": { "RuleName": "rule_name_1", "Keywords": [ "hello", "thank you" ], "Negate": false } }, { "Type": "Sentiment", "RuleName": "rule_name_2", "SentimentType": "NEGATIVE", "TimePeriod": 60 }, { "Type": "IssueDetection", "RuleName": "rule_name_3" } ] }, "Elements": [{ "Type": "AmazonTranscribeCallAnalyticsProcessor", "AmazonTranscribeCallAnalyticsProcessorConfiguration": { "LanguageCode": "en-US" } }, { "Type": "KinesisDataStreamSink", "KinesisDataStreamSinkConfiguration": { "InsightsTarget": "arn:aws:kinesis:us-east-1:account_id:stream/stream_name" } } ] }

实时警报配置中的每条规则都是独立触发的。如果同时满足多个规则条件,您可能会收到多条 EventBridge 通知。要为警报创建规则列表,可以在以下规则类型中进行选择:

关键字匹配

在言语或转录事件中匹配一组指定的关键字或短语时发出警报。在以下情况下,您可以将警报配置为发出事件:

  • 朗读任何指定的关键字,并且将 Negate 设置为 false

  • 如果将 Negate 设置为 true,则在整个通话过程中,不朗读所有指定的关键字。

Amazon Transcribe 和 Amazon Transcribe 分析支持这种规则类型。

情绪分析

当特定情绪类型持续一段滚动窗口期时发出警报。只有 Transcribe 呼叫分析支持此规则。

问题检测

在语音事件中检测到问题时发出警报。只有 Transcribe 呼叫分析支持此规则类型。

以下示例介绍了一个 KeywordMatch 规则的实时警报事件。

{ "version": "0", "id": "string", "detail-type": "Media Insights Rules Matched", "source": "aws.chime", "account": number, "region": "us-east-1", "time": "yyyy-mm-ddThh:mm:ssZ", "resources": [], "detail": { "version": "0", "sourceMetadata": {} "ruleName": "string" "utteranceId": "string", "beginTimestamp": "yyyy-mm-ddThh:mm:ssZ", } }

有些 EventBridge 字段特定于匹配的规则类型:

关键字匹配字段

utteranceId:如果您使用 Amazon Transcribe 通话分析功能,则为包含匹配关键字的转录 ID。仅适用于口语关键词匹配。

resultId:如果您使用 Amazon Transcribe,则为包含匹配关键字的转录 ID。仅适用于口语关键词匹配。

beginTimestamp:包含匹配关键字的转录开始时间。仅适用于口语关键词匹配。

情感分析字段

beginTimestamp:匹配情绪的滚动窗口的开始时间。

endTimestamp:匹配情绪的滚动窗口的结束时间。