如何使用 AWS transcribe API 转录通话?
当我尝试转录通话时出现此错误:
帐户无权调用此操作。检查您的帐户权限
我认为错误的属性是 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);
你知道如何解决角色问题吗?
I got this error when I'm trying to transcribe a call:
Account isn't authorized to call this operation. Check your account perm
I think the bad property is DataAccessRoleArn, I tried to create new role on IAM console, but it does not work.
Here's the full PHP code:
<?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);
Do you know how to fix role issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要解决此问题,您必须:
选择兼容的区域(在我的例子中为 eu-central-1)
使用 AmazonS3FullAccess 策略(仅用于测试,调整安全性)和此信任实体创建新角色:
{
"版本": "2012-10-17",
“陈述”: [
{
"效果": "允许",
“主要的”: {
“服务”:“transcribe.amazonaws.com”
},
“行动”:“sts:假设角色”
}
]
}
For fixing this issue, you have to:
Select a region compatible (in my case eu-central-1)
Create a new role with AmazonS3FullAccess policy (just for testing, adjust for security) and this trust entity:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "transcribe.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Attach AmazonTranscribeFullAccess and AmazonS3FullAccess policiy to your IAM user (just for testing, adjust for security)