如何使用 AWS 转录 API 转录通话?
How to transcribe a call with AWS transcribe API?
我在尝试转录电话时遇到此错误:
Account isn't authorized to call this operation. Check your account perm
我认为坏的 属性 是 DataAccessRoleArn,我尝试在 IAM 控制台上创建新角色,但它不起作用。
这是完整的 PHP 代码:
<?php
require 'vendor/autoload.php';
use Aws\TranscribeService\TranscribeServiceClient;
$awsKey = "{awsKey}";
$awsSecretKey = "{awsSecretKey}";
$clientAWS = new TranscribeServiceClient([
'region' => 'eu-west-3',
'version' => 'latest',
'credentials' => [
'key' => $awsKey,
'secret' => $awsSecretKey
],
]);
$result = $clientAWS->startCallAnalyticsJob([
'CallAnalyticsJobName' => 'Transcript1', // REQUIRED
'ChannelDefinitions' => [
[
'ChannelId' => 0,
'ParticipantRole' => 'AGENT',
],
[
'ChannelId' => 1,
'ParticipantRole' => 'CUSTOMER',
]
],
'DataAccessRoleArn' => 'arn:aws:iam::{id}:role/AWSRole', // REQUIRED
'Media' => [ // REQUIRED
'MediaFileUri' => 's3://{bucketName}/2022/02/23/file.wav',
'RedactedMediaFileUri' => 's3://{bucketName}/2022/02/23/',
],
'Settings' => [
'ContentRedaction' => [
'RedactionOutput' => 'redacted', // REQUIRED
'RedactionType' => 'PII', // REQUIRED
],
],
]);
print_r($result);
你知道如何解决角色问题吗?
要解决此问题,您必须:
Select 兼容区域(在我的例子中 eu-central-1)
使用 AmazonS3FullAccess 策略(仅用于测试,针对安全进行调整)和此信任实体创建一个新角色:
{
"版本": "2012-10-17",
“陈述”: [
{
"效果": "允许",
“主要的”: {
“服务”:“transcribe.amazonaws.com”
},
“行动”:“sts:AssumeRole”
}
]
}
将 AmazonTranscribeFullAccess 和 AmazonS3FullAccess 策略附加到您的 IAM 用户(仅用于测试,针对安全性进行调整)
我在尝试转录电话时遇到此错误:
Account isn't authorized to call this operation. Check your account perm
我认为坏的 属性 是 DataAccessRoleArn,我尝试在 IAM 控制台上创建新角色,但它不起作用。
这是完整的 PHP 代码:
<?php
require 'vendor/autoload.php';
use Aws\TranscribeService\TranscribeServiceClient;
$awsKey = "{awsKey}";
$awsSecretKey = "{awsSecretKey}";
$clientAWS = new TranscribeServiceClient([
'region' => 'eu-west-3',
'version' => 'latest',
'credentials' => [
'key' => $awsKey,
'secret' => $awsSecretKey
],
]);
$result = $clientAWS->startCallAnalyticsJob([
'CallAnalyticsJobName' => 'Transcript1', // REQUIRED
'ChannelDefinitions' => [
[
'ChannelId' => 0,
'ParticipantRole' => 'AGENT',
],
[
'ChannelId' => 1,
'ParticipantRole' => 'CUSTOMER',
]
],
'DataAccessRoleArn' => 'arn:aws:iam::{id}:role/AWSRole', // REQUIRED
'Media' => [ // REQUIRED
'MediaFileUri' => 's3://{bucketName}/2022/02/23/file.wav',
'RedactedMediaFileUri' => 's3://{bucketName}/2022/02/23/',
],
'Settings' => [
'ContentRedaction' => [
'RedactionOutput' => 'redacted', // REQUIRED
'RedactionType' => 'PII', // REQUIRED
],
],
]);
print_r($result);
你知道如何解决角色问题吗?
要解决此问题,您必须:
Select 兼容区域(在我的例子中 eu-central-1)
使用 AmazonS3FullAccess 策略(仅用于测试,针对安全进行调整)和此信任实体创建一个新角色:
{ "版本": "2012-10-17", “陈述”: [ { "效果": "允许", “主要的”: { “服务”:“transcribe.amazonaws.com” }, “行动”:“sts:AssumeRole” } ] }
将 AmazonTranscribeFullAccess 和 AmazonS3FullAccess 策略附加到您的 IAM 用户(仅用于测试,针对安全性进行调整)