我設定了 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 語音訊息設定日誌?