我设置了 Amazon Pinpoint 语音事件目标以记录 Amazon Pinpoint 语音消息,但我没有看到任何日志。为什么我的 Amazon Pinpoint 语音消息日志未填充,如何排查此问题?
解决方法
**请注意:**如果您在运行 AWS Command Line Interface (AWS CLI) 命令时遇到错误,请确保您使用的是最新版本的 AWS CLI。
验证您对 SendVoiceMessage API 操作的请求是否包含配置集的名称
检查对 SendVoiceMessage API 操作的请求中 ConfigurationSetName 参数的值。请求必须包含配置集的确切名称。
对包含 ConfigurationSetName 参数的 SendVoiceMessage API 操作的 Python 请求示例
response = client.send_voice_message(
DestinationPhoneNumber=destinationNumber,
OriginationPhoneNumber=originationNumber,
ConfigurationSetName="ConfigurationSetName", # Pass the ConfigurationSetName here
Content={
"SSMLMessage": {
"LanguageCode": languageCode,
"VoiceId": voiceId,
"Text": ssmlMessage,
}
},
)
验证 Amazon Pinpoint 语音事件目标是否已激活
1. 运行以下 get-configuration-set-event-destinations AWS CLI 命令:
**重要提示:**将 <Pass_the_configuration_set_name> 替换为配置集的名称。
aws pinpoint-sms-voice get-configuration-set-event-destinations --configuration-set-name <Pass_the_configuration_set_name>
2. 在命令输出中,查看**“Enabled”**(已启用)参数。如果此参数的值为 false,则事件目标不会激活。
**注意:**如果目标未激活,日志不会写入事件目标。
3. 如果事件目标未激活,则通过运行以下 update-configuration-set-event-destination 命令来激活事件目标:
重要提示:将 <Pass_the_configuration_set_name> 替换为配置集的名称。将 <EventDestinationName> 替换为事件目标的名称。将 <InputFileName> 替换为输入请求文件的名称。确保输入请求文件的“Enabled”(已启用)参数配置为 true。
aws pinpoint-sms-voice update-configuration-set-event-destination --configuration-set-name <Pass_the_configuration_set_name> --event-destination-name <EventDestinationName> --event-destination file://<InputFileName>.json
Amazon Kinesis Data Firehose 流式传输事件目标的输入请求文件示例
{
"Enabled": true,
"MatchingEventTypes": ["INITIATED_CALL","RINGING","ANSWERED","COMPLETED_CALL","BUSY","FAILED","NO_ANSWER"],
"KinesisFirehoseDestination": {
"DeliveryStreamArn": "arn:aws:firehose:<region>:<AccountID>:deliverystream/<Name_of_Kinesis_Firehose>",
"IamRoleArn": "arn:aws:iam::<AccountID>:role/service-role/<IAM_role_name>"
}
}
有关输入请求文件的更多信息,请参阅如何设置 Amazon Pinpoint 语音消息的日志记录?