

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Amazon Chime SDK の通話分析プロセッサと出力先
<a name="call-analytics-processor-and-output-destinations"></a>

 各メディアインサイトパイプライン設定では、一意の要素を 1 回のみ指定できます。すべてのプロセッサとシンクは同じ AWS アカウントに存在し、呼び出すエンドポイントと同じ AWS リージョンに作成する必要があります。例えば、Amazon Chime SDK メディアパイプライン向けに `us-east-1` のエンドポイントを使用する場合、`us-west-2` リージョンから Kinesis Data Stream を渡すことはできません。

各送信先に関する情報については、各セクションを展開してください。

## Amazon Transcribe Call Analytics プロセッサの送信先
<a name="amazon-transcribe-call-analytics-processor"></a>

対応シンク: `KinesisDataStreamSink`

このプロセッサを Amazon Transcribe プロセッサと組み合わせることはできません。Amazon Transcribe Call Analytics の詳細については、「* Amazon Transcribe Developer Guide*」の「[Real-time call analytics](https://docs.aws.amazon.com/transcribe/latest/dg/call-analytics-streaming.html)」を参照してください。`AmazonTranscribeCallAnalyticsProcessorConfiguration` API コールで `PostCallAnalyticsSettings` を指定して[通話後分析](https://docs.aws.amazon.com/transcribe/latest/dg/tca-post-call.html)を有効にすると、メディアインサイトパイプラインが停止し、処理が終了したタイミングで、送信先に指定した Amazon S3 にアーティファクトが保存されます。

**注記**  
パイプラインを 35 秒以上一時停止した後に再開すると、通話後分析のアーティファクトは、異なるセッション ID を持つ個別のファイルとして Amazon S3 バケット内に保存されます。

通話後分析のアーティファクトは、分析 JSON ファイルと音声録音 (WAV または Opus ファイル) で構成されています。編集済み (コンテンツの編集を有効にした場合) および編集済みでない録音ファイルの Amazon S3 バケット URL は、メタデータセクションの `onetimeMetadata` の一部として、Amazon Transcribe Call Analytics の通話後分析セッションごとに 1 回 Kinesis Data Stream に送信されます。

Amazon Transcribe Call Analytics による通話分析では、Kinesis Video Streams から音声データの入力を取得します。
+ 対応メディアエンコーディング: PCM 符号付き 16 ビットリトルエンディアン音声。
+ 対応メディアサンプリングレート: 8,000 Hz～48,000 Hz

Amazon Transcribe Analytics プロセスの `StreamConfiguration` 入力:
+ ストリームごとに `KinesisVideoStreamArn` を指定する必要があります。
+ (オプション) KVS `FragmentNumber` により、指定したフラグメントの後のチャンクを使用して通話分析ジョブが開始されます。指定していない場合は、Kinesis Video Streams の最新のチャンクが使用されます。
+ `StreamChannelDefinition` により、スピーカーを定義します。Amazon Transcribe Call Analytics には 2 チャネルの音声が必要です。そのため、[https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipeline.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipeline.html) API を呼び出すときに、どのスピーカーがどのチャネルにいるかを指定する必要があります。例えば、エージェントが最初に話す場合、`ChannelId` を `0` に設定して最初のチャネルを示し、`ParticipantRole` を `AGENT` に設定してエージェントがスピーカーであることを示します。

**注記**  
Voice Connector を使用して、Amazon Transcribe Call Analytics プロセッサで `MediaInsightsPipeline` を作成する場合、Voice Connector アカウントレッグの音声には `AGENT` を、PSTN レッグの音声には `ParticipantRole` の `CUSTOMER` を設定します。  
Voice Connector で SIPREC を使用する場合は、SIPREC メタデータによってそれらが決定されます。ほとんどの場合、辞書順に基づく値が最も小さいストリームラベルのスピーカーが `AGENT` と見なされます。

次の例は、1 つのデュアルチャネルオーディオストリームを使用する Kinesis Video Streams の入力を示しています。

```
"StreamChannelDefinition" : {
    "NumberOfChannels" : 2
    "ChannelDefinitions": [
        {
            "ChannelId": 0,
            "ParticipantRole": "AGENT"
        },
        {
            "ChannelId": 1,
            "ParticipantRole": "CUSTOMER"
        }
    ]
}
```

 対照的に、次の例は、2 つの異なる Kinesis Video Streams から取得した 2 つのモノラル入力を示しています。

```
KVS-1:
    "StreamChannelDefinition" : {
        "NumberOfChannels"  : 1
        "ChannelDefinitions": [
            {
                "ChannelId": 0,
               "ParticipantRole": "AGENT"
            }
        ]
    }
KVS-2:
    "StreamChannelDefinition" : {
        "NumberOfChannels"  : 1
        "ChannelDefinitions": [
            {
                "ChannelId": 1,
               "ParticipantRole": "CUSTOMER"
            }
        ]
    }
```

## Amazon Transcribe Call Analytics の出力
<a name="amazon-transcribe-call-analytics-output"></a>

 各 Amazon Transcribe レコードには、`UtteranceEvent` または `CategoryEvent` が含まれますが、両方は含まれません。`CategoryEvents` には、`detail-type` の `TranscribeCallAnalyticsCategoryEvent` があります。

次の例は、Amazon Transcribe に使用する 1 回限りのメタデータ出力形式を示しています。

```
{
    "time": "{{string}}", // ISO8601 format
    "service-type": "CallAnalytics",
    "detail-type": "CallAnalyticsMetadata",
    "mediaInsightsPipelineId": "{{string}}",
    "metadata": "{{string}}" // JSON encoded string of the metadata object
}

// metadata object
{
    "voiceConnectorId": "{{string}}",
    "callId": "{{string}}",
    "transactionId": "{{string}}",
    "fromNumber": "{{string}}",
    "toNumber": "{{string}}",
    "direction": "{{string}}",
    "oneTimeMetadata": "{{string}}" // JSON encoded string of oneTimeMetadata object
}
 
// onetimeMetadata object
{
    "inviteHeaders": "{{string}}", // JSON encoded string of SIP Invite headers key-value pair
    "siprecMetadata": "{{string}}", // siprec metadata in XML 
    "siprecMetadataJson": "{{string}}", // siprec metadata in JSON (converted from above XML) 
    
    // If PostcallSettings are enabled for Amazon Transcribe Call Analytics
    "s3RecordingUrl": "{{string}}", 
    "s3RecordingUrlRedacted": "{{string}}"
}
 
// inviteHeaders object
{
    "{{string}}": "{{string}}"
}
```

 次の例は、Amazon Transcribe Call Analytics の出力形式を示しています。

```
{
    "time": "{{string}}", // ISO8601 format
    "service-type": "CallAnalytics",
    "detail-type": "TranscribeCallAnalytics",
    "mediaInsightsPipelineId": "{{string}}",
    "metadata": {
        "voiceConnectorId": "{{string}}",
        "callId": "{{string}}",
        "transactionId": "{{string}}",
        "fromNumber": "{{string}}",
        "toNumber": "{{string}}",
        "direction": "{{string}}"
    },
    "UtteranceEvent": {
        "UtteranceId": "{{string}}",
        "ParticipantRole": "{{string}}",
        "IsPartial": {{boolean}},
        "BeginOffsetMillis": {{number}},
        "EndOffsetMillis": {{number}},
        "Transcript": "{{string}}",
        "Sentiment": "{{string}}",
        "Items": [{
            "Content": "{{string}}",
            "Confidence": {{number}},
            "VocabularyFilterMatch": {{boolean}},
            "Stable": {{boolean}},
            "ItemType": "{{string}}",
            "BeginOffsetMillis": {{number}},
            "EndOffsetMillis": {{number}},
        }, ]
        "Entities": [{
            "Content": "{{string}}",
            "Confidence": {{number}},
            "Category": "{{string}}", // Only PII is supported currently
            "Type": "{{string}}",
            "BeginOffset": {{number}},
            "EndOffset": {{number}},
        }, ],
        "IssuesDetected": [{
            "CharacterOffsets": {
                "Begin": {{number}},
                "End": {{number}}
            }
        }]
    },
    "CategoryEvent": {
        "MatchedCategories": ["{{string}}"],
        "MatchedDetails": {
            "{{string}}": {
                "TimestampRanges": [{
                    "BeginOffsetMillis": {{number}},
                    "EndOffsetMillis": {{number}}
                }]
            }
        }
    }
}
```

## Amazon Chime SDK Voice Connector ストリーミング更新メタデータ
<a name="cvc-stream-update-metadata"></a>

コール分析設定が Amazon Chime SDK Voice Connector に関連付けられている場合、[Voice Connector のストリーミング更新](https://docs.aws.amazon.com/chime-sdk/latest/ag/automating-chime-with-cloudwatch-events.html)があると、次の Voice Connector Update ペイロードが送信されます。

次の例は、Amazon Transcribe プロセッサと Transcribe Call Analytics プロセッサの更新メタデータ形式を示しています。

```
{
    "time": "{{string}}", // ISO8601 format
    "service-type": "CallAnalytics",
    "detail-type": "CallAnalyticsMetadata",
    "callevent-type": "Update",
    "metadata": "{{string}}" // JSON encoded string of the metadata object
}

// metadata object
{
    "voiceConnectorId": "{{string}}",
    "callId": "{{string}}",
    "transactionId": "{{string}}",
    "fromNumber": "{{string}}",
    "toNumber": "{{string}}",
    "direction": "{{string}}",
    "oneTimeMetadata": "{{string}}" // JSON encoded string of oneTimeMetadata object
}
 
// onetimeMetadata object
{
    "sipHeaders": "{{string}}", // JSON encoded string of SIP Invite headers key-value pair
    "siprecMetadata": "{{string}}", // siprec metadata in XML 
    "siprecMetadataJson": "{{string}}" // siprec metadata in JSON (converted from above XML) 
}
 
// sipHeaders object
{
    "string": "{{string}}"
}
```

次の例は、Call Analytics Amazon S3 Recording のメタデータ更新形式を示しています。

```
{
    "time": "{{string}}", // ISO8601 format
    "service-type": "CallAnalytics",
    "detail-type": "Recording",
    "callevent-type": "Update",
    "metadata": "string" // JSON encoded string of the metadata object
}

// metadata object
{
    "voiceConnectorId": "{{string}}",
    "callId": "{{string}}",
    "transactionId": "{{string}}",
    "fromNumber": "{{string}}",
    "toNumber": "{{string}}",
    "direction": "{{string}}",
    "oneTimeMetadata": "{{string}}" // JSON encoded in string of oneTimeMetadata object
}

// onetimeMetadata object
{
    "sipHeaders": "{{string}}", // JSON encoded string of SIP Invite headers key-value pair
    "siprecMetadata": "{{string}}", // siprec metadata in XML 
    "siprecMetadataJson": "{{string}}" // siprec metadata in JSON (converted from above XML) 
}

// sipHeaders object
{
    "{{string}}": "{{string}}"
}
```

## SIP コール記録メタデータ
<a name="sip-update-metadata"></a>

次の例は、Alice と Bob の 2 人の間の SIP 通話を記録するためのメタデータを示しています。両方の参加者が音声と動画を送受信します。わかりやすくするために、この例では SIP と SDP のスニペットのみを使用しており、SRC は各参加者のストリームをミックスせずに SRS に記録しています。

```
INVITE sip:recorder@example.com SIP/2.0
   Via: SIP/2.0/TCP src.example.com;branch=z9hG4bKdf6b622b648d9
   From: <sip:2000@example.com>;tag=35e195d2-947d-4585-946f-09839247
   To: <sip:recorder@example.com>
   Call-ID: d253c800-b0d1ea39-4a7dd-3f0e20a
   Session-ID: ab30317f1a784dc48ff824d0d3715d86
    ;remote=00000000000000000000000000000000
   CSeq: 101 INVITE
   Max-Forwards: 70
   Require: siprec
   Accept: application/sdp, application/rs-metadata,
   application/rs-metadata-request
   Contact: <sip:2000@src.example.com>;+sip.src
   Content-Type: multipart/mixed;boundary={{boundary}}
   Content-Length: [length]

   Content-Type: application/SDP
   ...
   m=audio 49170 RTP/AVP 0
   a=rtpmap:0 PCMU/8000
   a=label:96
   a=sendonly
   ...
   m=video 49174 RTP/AVPF 96
   a=rtpmap:96 H.264/90000
   a=label:97
   a=sendonly
   ...
   m=audio 51372 RTP/AVP 0
   a=rtpmap:0 PCMU/8000
   a=label:98
   a=sendonly
   ...
   m=video 49176 RTP/AVPF 96
   a=rtpmap:96 H.264/90000
   a=label:99
   a=sendonly
   ....

Content-Type: application/rs-metadata
Content-Disposition: recording-session

<?xml version="1.0" encoding="UTF-8"?>
<recording xmlns='urn:ietf:params:xml:ns:recording:1'>
  <datamode>complete</datamode>
        <group group_id="7+OTCyoxTmqmqyA/1weDAg==">
                <associate-time>2010-12-16T23:41:07Z</associate-time>
                <!-- Standardized extension -->
                <call-center xmlns='urn:ietf:params:xml:ns:callcenter'>
                        <supervisor>sip:alice@atlanta.com</supervisor>
                </call-center>
                <mydata xmlns='http://example.com/my'>
                        <structure>structure!</structure>
                        <whatever>structure</whatever>
                </mydata>
        </group>
        <session session_id="hVpd7YQgRW2nD22h7q60JQ==">
                <sipSessionID>ab30317f1a784dc48ff824d0d3715d86;
                                      remote=47755a9de7794ba387653f2099600ef2</sipSessionID>
                <group-ref>7+OTCyoxTmqmqyA/1weDAg==
                </group-ref>
                <!-- Standardized extension -->
                <mydata xmlns='http://example.com/my'>
                        <structure>FOO!</structure>
                        <whatever>bar</whatever>
                </mydata>
        </session>
        <participant
              participant_id="srfBElmCRp2QB23b7Mpk0w==">
                <nameID aor="sip:alice@atlanta.com">
                        <naSRCme xml:lang="it">Alice</name>
                </nameID>
                <!-- Standardized extension -->
                <mydata xmlns='http://example.com/my'>
                        <structure>FOO!</structure>
                        <whatever>bar</whatever>
                </mydata>
        </participant>
        <participant
               participant_id="zSfPoSvdSDCmU3A3TRDxAw==">
                <nameID aor="sip:bob@biloxy.com">
                        <name xml:lang="it">Bob</name>
                </nameID>
                <!-- Standardized extension -->
                <mydata xmlns='http://example.com/my'>
                        <structure>FOO!</structure>
                        <whatever>bar</whatever>
                </mydata>
        </participant>
        <stream stream_id="UAAMm5GRQKSCMVvLyl4rFw=="
               session_id="hVpd7YQgRW2nD22h7q60JQ==">
                <label>96</label>
        </stream>
        <stream stream_id="i1Pz3to5hGk8fuXl+PbwCw=="
               session_id="hVpd7YQgRW2nD22h7q60JQ==">
                <label>97</label>
        </stream>
        <stream stream_id="8zc6e0lYTlWIINA6GR+3ag=="
               session_id="hVpd7YQgRW2nD22h7q60JQ==">
                <label>98</label>
        </stream>
        <stream stream_id="EiXGlc+4TruqqoDaNE76ag=="
               session_id="hVpd7YQgRW2nD22h7q60JQ==">
                <label>99</label>
        </stream>
        <sessionrecordingassoc session_id="hVpd7YQgRW2nD22h7q60JQ==">
            <associate-time>2010-12-16T23:41:07Z</associate-time>
        </sessionrecordingassoc>
        <participantsessionassoc
              participant_id="srfBElmCRp2QB23b7Mpk0w=="
              session_id="hVpd7YQgRW2nD22h7q60JQ==">
                <associate-time>2010-12-16T23:41:07Z</associate-time>
        </participantsessionassoc>
        <participantsessionassoc
               participant_id="zSfPoSvdSDCmU3A3TRDxAw=="
               session_id="hVpd7YQgRW2nD22h7q60JQ==">
                <associate-time>2010-12-16T23:41:07Z</associate-time>
        </participantsessionassoc>
        <participantstreamassoc
              participant_id="srfBElmCRp2QB23b7Mpk0w==">
                <send>i1Pz3to5hGk8fuXl+PbwCw==</send>
                <send>UAAMm5GRQKSCMVvLyl4rFw==</send>
                <recv>8zc6e0lYTlWIINA6GR+3ag==</recv>
                <recv>EiXGlc+4TruqqoDaNE76ag==</recv>
        </participantstreamassoc>
        <participantstreamassoc
               participant_id="zSfPoSvdSDCmU3A3TRDxAw==">
                <send>8zc6e0lYTlWIINA6GR+3ag==</send>
                <send>EiXGlc+4TruqqoDaNE76ag==</send>
                <recv>UAAMm5GRQKSCMVvLyl4rFw==</recv>
                <recv>i1Pz3to5hGk8fuXl+PbwCw==</recv>
        </participantstreamassoc>
</recording>
```

次の例は、ある通話参加者がもう片方を保留にしたときの更新されたメタデータを示しています。この場合、`participant_id srfBElmCRp2QB23b7Mpk0w==` は、メディアストリームのみを受信し、メディアは送信しないため、`send` XML 要素は省略されます。これとは対照的に、`participant_id zSfPoSvdSDCmU3A3TRDxAw==` は、他の参加者にはメディアを送信しますが、相手からはメディアを受信しないため、`recv` XML 要素は省略されます。

```
INVITE sip:recorder@example.com SIP/2.0
            Via: SIP/2.0/TCP src.example.com;branch=z9hG4bKdf6b622b648d9
      From: <sip:2000@example.com>;tag=35e195d2-947d-4585-946f-09839247
      To: <sip:recorder@example.com>
      Call-ID: d253c800-b0d1ea39-4a7dd-3f0e20a
      Session-ID: ab30317f1a784dc48ff824d0d3715d86
       ;remote=f81d4fae7dec11d0a76500a0c91e6bf6
      CSeq: 101 INVITE
      Max-Forwards: 70
      Require: siprec
      Accept: application/sdp, application/rs-metadata,
      application/rs-metadata-request
      Contact: <sip:2000@src.example.com>;+sip.src
      Content-Type: multipart/mixed;boundary=foobar
      Content-Length: [length]

      Content-Type: application/SDP
      ...
      m=audio 49170 RTP/AVP 0
      a=rtpmap:0 PCMU/8000
      a=label:96
      a=sendonly
      ...
      m=video 49174 RTP/AVPF 96
      a=rtpmap:96 H.264/90000
      a=label:97
      a=sendonly
      ...
      m=audio 51372 RTP/AVP 0
      a=rtpmap:0 PCMU/8000
      a=label:98
      a=sendonly
      ...
      m=video 49176 RTP/AVPF 96
      a=rtpmap:96 H.264/90000
      a=label:99
      a=sendonly
      ....

   Content-Type: application/rs-metadata
   Content-Disposition: recording-session

      <?xml version="1.0" encoding="UTF-8"?>
        <recording xmlns='urn:ietf:params:xml:ns:recording:1'>
          <datamode>partial</datamode>
            <participantstreamassoc
             participant_id="srfBElmCRp2QB23b7Mpk0w==">
             <recv>8zc6e0lYTlWIINA6GR+3ag==</recv>
             <recv>EiXGlc+4TruqqoDaNE76ag==</recv>
            </participantstreamassoc>
            <participantstreamassoc
             participant_id="zSfPoSvdSDCmU3A3TRDxAw==">
              <send>8zc6e0lYTlWIINA6GR+3ag==</send>
              <send>EiXGlc+4TruqqoDaNE76ag==</send>
             </participantstreamassoc>
           </recording>
```

次の例は、通話が再開されたときのメタデータの更新を示しています。これで、ペイロードには `send` と `recv` XML 要素が含まれるようになりました。

```
INVITE sip:recorder@example.com SIP/2.0
      Via: SIP/2.0/TCP src.example.com;branch=z9hG4bKdf6b622b648d9
      From: <sip:2000@example.com>;tag=35e195d2-947d-4585-946f-09839247
      To: <sip:recorder@example.com>
      Call-ID: d253c800-b0d1ea39-4a7dd-3f0e20a
      Session-ID: ab30317f1a784dc48ff824d0d3715d86
       ;remote=f81d4fae7dec11d0a76500a0c91e6bf6
      CSeq: 101 INVITE
      Max-Forwards: 70
      Require: siprec
      Accept: application/sdp, application/rs-metadata,
      application/rs-metadata-request
      Contact: <sip:2000@src.example.com>;+sip.src
      Content-Type: multipart/mixed;boundary=foobar
      Content-Length: [length]

      Content-Type: application/SDP
      ...
      m=audio 49170 RTP/AVP 0
      a=rtpmap:0 PCMU/8000
      a=label:96
      a=sendonly
      ...
      m=video 49174 RTP/AVPF 96
      a=rtpmap:96 H.264/90000
      a=label:97
      a=sendonly
      ...
      m=audio 51372 RTP/AVP 0
      a=rtpmap:0 PCMU/8000
      a=label:98
      a=sendonly
      ...
      m=video 49176 RTP/AVPF 96
      a=rtpmap:96 H.264/90000
      a=label:99
      a=sendonly
      ....
    
   Content-Type: application/rs-metadata
   Content-Disposition: recording-session

      <?xml version="1.0" encoding="UTF-8"?>
        <recording xmlns='urn:ietf:params:xml:ns:recording:1'>
          <datamode>partial</datamode>
            <participantstreamassoc
             participant_id="srfBElmCRp2QB23b7Mpk0w==">
             <send>i1Pz3to5hGk8fuXl+PbwCw==</send>
             <send>UAAMm5GRQKSCMVvLyl4rFw==</send>
             <recv>8zc6e0lYTlWIINA6GR+3ag==</recv>
             <recv>EiXGlc+4TruqqoDaNE76ag==</recv>
            </participantstreamassoc>
            <participantstreamassoc
             participant_id="zSfPoSvdSDCmU3A3TRDxAw==">
              <send>8zc6e0lYTlWIINA6GR+3ag==</send>
              <send>EiXGlc+4TruqqoDaNE76ag==</send>
              <recv>i1Pz3to5hGk8fuXl+PbwCw==</recv>
             <recv>UAAMm5GRQKSCMVvLyl4rFw==</recv>
             </participantstreamassoc>
           </recording>
```

## Amazon Transcribe プロセッサの送信先
<a name="amazon-transcribe-processors"></a>

対応シンク: `KinesisDataStreamSink`

このプロセッサを Amazon Transcribe Call Analytics と組み合わせることはできません。Amazon Transcribe への入力と出力の詳細については、「*Amazon Transcribe Developer Guide*」の「[Transcribe streaming audio](https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html)」を参照してください。

Amazon Transcribe による通話分析セッションでは、Kinesis Video Streams から音声データの入力を取得します。
+ 対応メディアエンコーディング: PCM 符号付き 16 ビットリトルエンディアン音声。
+ 対応 MediaSampleRate サンプリングレート: 8,000 Hz～48,000 Hz

 Amazon Transcribe プロセッサの `StreamConfiguration` 入力: 
+ ストリームごとに `KinesisVideoStreamArn` を指定する必要があります。
+ (オプション) KVS `FragmentNumber` により、指定したフラグメントの後のチャンクを使用して通話分析ジョブが開始されます。指定していない場合は、Kinesis Video Streams の利用可能な最新のチャンクが使用されます。
+ `StreamChannelDefinition` Amazon Transcribe は現在、2 つのチャネルの音声に対応しています。`NumberOfChannels` は、ランタイム `StreamChannelDefinition` で指定する必要があります。さらに、モノラル音声を 2 つの個別チャネルで送信する場合は、`ChannelId` を渡さなければなりません。トランスクリプトでは、チャネルに `ch_0` および `ch_1` というラベルが割り当てられます。次の例は、1 つのモノラル音声チャネルストリームに使用する KVS 入力を示しています。

```
"StreamChannelDefinition" : {"
    NumberOfChannels" : 1
}
```

 次の例は、2 つの異なるストリームの 2 つのモノラル音声入力に使用する KVS 入力を示しています。

```
KVS-1:
    "StreamChannelDefinition" : {
        "NumberOfChannels"  : 1
        "ChannelDefinitions": [
            {
                "ChannelId": 0
            }
        ]
    }
KVS-2:
    "StreamChannelDefinition" : {
        "NumberOfChannels"  : 1
        "ChannelDefinitions": [
            {
                "ChannelId": 1
            }
        ]
    }
```

**注記**  
Amazon Transcribe プロセッサを使用して `MediaInsightsPipeline` を作成する Voice Connector の場合、Voice Connector アカウントレッグの音声は `channel-0` に、PSTN レッグの音声は `channel-1` に割り当てられます。  
Voice Connector で SIPREC を使用する場合は、SIPREC メタデータによってそれらが決定されます。ほとんどの場合、辞書順に基づく値が最も小さいストリームラベルの音声が `channel-0` に割り当てられます。  
Amazon Transcribe および Amazon Transcribe Call Analytics プロセッサでは、2 つの Kinesis Video Streams を渡し、各ストリームにモノラル音声チャネルが含まれている場合、両方のチャネルが 1 つの音声ストリームにインターリーブされた後に、Transcribe または Transcribe Call Analytics のデータが処理されます。

## Amazon Transcribe の出力
<a name="amazon-transcribe-output"></a>

次の例は、Amazon Transcribe に使用する 1 回限りのメタデータ出力形式を示しています。

```
{
    "time": "{{string}}", // ISO8601 format
    "service-type": "CallAnalytics",
    "detail-type": "CallAnalyticsMetadata",
    "mediaInsightsPipelineId": "{{string}}",
    "metadata": "{{string}}" // JSON encoded string of the metadata object
}

// metadata object
{
    "voiceConnectorId": "{{string}}",
    "callId": "{{string}}",
    "transactionId": "{{string}}",
    "fromNumber": "{{string}}",
    "toNumber": "{{string}}",
    "direction": "{{string}}",
    "oneTimeMetadata": "{{string}}" // JSON encoded string of oneTimeMetadata object
}
 
// onetimeMetadata object
{
    "inviteHeaders": "{{string}}", // JSON encoded string of SIP Invite headers key-value pair
    "siprecMetadata": "{{string}}", // siprec metadata in XML 
    "siprecMetadataJson": "{{string}}" // siprec metadata in JSON (converted from above XML) 
}
 
// inviteHeaders object
{
    "{{string}}": "{{string}}"
}
```

次の例は、Amazon Transcribe の出力形式を示しています。

```
{
    "time": "{{string}}", // ISO8601 format
    "service-type": "CallAnalytics",
    "detail-type": "Transcribe",
    "mediaInsightsPipelineId": "{{string}}",
    "metadata": {
        "voiceconnectorId": "{{string}}",
        "callId": "{{string}}",
        "transactionId": "{{string}}",
        "fromNumber": "{{string}}",
        "toNumber": "{{string}}",
        "direction": "{{string}}"
    }
    "TranscriptEvent": {
        "Transcript": {
            "Results": [{
                "Alternatives": [{
                    "Entities": [{
                        "Category": "{{string}}",
                        "Confidence": {{number}},
                        "Content": "{{string}}",
                        "EndTime": {{number}},
                        "StartTime": {{number}},
                        "Type": "{{string}}"
                    }],
                    "Items": [{
                        "Confidence": {{number}},
                        "Content": "{{string}}",
                        "EndTime": {{number}},
                        "Speaker": "{{string}}",
                        "Stable": {{boolean}},
                        "StartTime": {{number}},
                        "Type": "{{string}}",
                        "VocabularyFilterMatch": {{boolean}}
                    }],
                    "Transcript": "{{string}}"
                }],
                "ChannelId": "{{string}}",
                "EndTime": {{number}},
                "IsPartial": {{boolean}},
                "LanguageCode": "{{string}}",
                "LanguageIdentification": [{
                    "LanguageCode": "{{string}}",
                    "Score": {{number}}
                }],
                "ResultId": "{{string}}",
                "StartTime": {{number}}
            }]
        }
    }
}
```

## 音声分析プロセッサの送信先
<a name="voice-analytics-processor"></a>

 対応シンク:`KinesisDataStreamSink`、`SqsQueueSink`、`SnsTopicSink`、`LambdaFunctionSink`。

 このプロセッサは、Amazon Transcribe Call Analytics プロセッサ、Amazon Transcribe プロセッサ、または通話録音と組み合わせることができます。音声分析プロセッサを呼び出すには、[https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_StartSpeakerSearchTask.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_StartSpeakerSearchTask.html) または [https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_StartVoiceToneAnalysisTask.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_StartVoiceToneAnalysisTask.html) API を使用する必要があります。音声分析の使用方法の詳細については、「[Using Amazon Chime SDK voice analytics](https://docs.aws.amazon.com/chime-sdk/latest/dg/voice-analytics.html)」を参照してください。

## Kinesis Data Stream をシンクとして使用する
<a name="kinesis-data-stream-destination"></a>

通話分析によって生成される Kinesis Data Stream (KDS) レコードには、メディアパイプライン ID、詳細タイプ、メタデータ、プロセッサ固有のセクションが含まれます。Kinesis Data Stream からのデータを利用する方法については、「*Amazon Kinesis Streams Developer guide*」の「[Reading Data from Amazon Kinesis Data Streams](https://docs.aws.amazon.com/streams/latest/dev/building-consumers.html)」を参照してください。このシンクを使用して設定を行うには、指定されたストリームの `kinesis:DescribeStream` 権限が必要です。

 **メタデータ**

 生成した KDS レコードの `metadata` セクションには、[https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipeline.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipeline.html) API の呼び出し中に `CallAnalyticsRuntimeMetadata` で指定したキーと値のペアが含まれています。通話分析セッションを Voice Connector によって開始した場合、メタデータセクションには次のパラメータが自動的に入力されます。
+ `transactionId`
+ `fromNumber`
+ `toNumber`
+ `callId`
+ `voiceConnectorId`
+ `direction`

 上記のパラメータに加え、Voice Connector で開始した通話分析セッションのメタデータセクションには、次の内容を含む `oneTimeMetadata` フィールドが設定されます。
+ `inviteHeaders`
+ `siprecMetadata`

これは、セッションの開始時に 1 回だけ Kinesis Data Streams に発行され、`CallAnalyticsMetadata` の `detail-type` を持ちます。

[https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipeline.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipeline.html) API の呼び出しごとに `MediaInsightsRuntimeMetadata` で一意の識別子を渡すことで、Kinesis Data Stream に配信する各レコードソースを一意に識別できます。

## Amazon S3 での通話録音
<a name="amazon-s3-call-recording"></a>

 通話分析の録音では、KVS ストリームから音声を読み取り、録音を音声ファイルにし、そのファイルを指定した Amazon S3 バケットにアップロードします。録音後、ファイルの場所と共に通話メタデータも KDS に送信します。データウェアハウスを有効にすると、通話メタデータ (SIPREC を使用している場合は、SIPREC メタデータも含まれる) は、クエリ可能な Parquet テーブルのセットとしてデータウェアハウスに配信されます。

他の通話分析プロセッサと同様に、最初にパイプラインの設定を行う必要があります。この設定を行うには、Amazon Chime SDK コンソールまたは CLI を使用します。次に、CLI を使用してパイプラインを作成します。コンソールを使用して録音設定を行う方法については、このセクションで前述した「[Amazon Chime SDK の通話分析を設定する](creating-ca-configuration.md)」で詳しく確認できます。録音ワークフローの使用方法については、このセクションで前述した「[Amazon Chime SDK の通話を記録するためのワークフローについて](recording-workflows.md)」で詳しく確認できます。

 **CLI を使用して設定を行うには**

 次のコマンドを実行します。

```
aws chime-sdk-media-pipeline create-media-insights-pipeline-configuration --cli-input-json file://configuration.json 
```

 次の例は、記録のみ有効にする設定用 JSON ファイルを示しています。

```
{
    "MediaInsightsPipelineConfigurationName": configuration_name,
    "ResourceAccessRoleArn": {{role_arn}},
    "Elements": [
        {
            "KinesisDataStreamSinkConfiguration": {
                "InsightsTarget": {{KDS_arn}} //Where recording live metadata will be delivered.
            },
            "Type": "KinesisDataStreamSink"
        },
        {
            "S3RecordingSinkConfiguration": {
                "Destination": "arn:aws:s3:::kvs-recording-testing",
                "RecordingFileFormat": {{file_format}} // Specify "Opus" or "WAV" as the recording file format.
            },
            "Type": "S3RecordingSink"
        }         
    ]
}
```

次の点に注意してください。
+ Kinesis Video Streams による通話録音を有効にするには、PCM 符号付き 16 ビットリトルエンディアン音声を使用する必要があります。サンプルレートは 8 kHz でなければなりません。
+ Kinesis Video Streams のデータ保持期間を十分に長く設定してフラグメントを保持し、通話分析でそれらを利用できるようにする必要があります。
+ 通話録音を有効にする場合は、単独で使用する場合も、他のプロセッサと組み合わせて使用する場合も、録音用の Kinesis Video Streams ARN を 2 つ指定する必要があります。通話録音は 1 つのステレオ音声入力には対応していません。

## Amazon S3 に通話録音する場合のメタデータ出力
<a name="s3-recording-metadata-output"></a>

次の例は、Amazon S3 に録音する通話分析でのメタデータ出力形式を示しています。

```
{
    "time": "{{string}}", // ISO8601 format
    "service-type": "CallAnalytics",
    "detail-type": "Recording",   
    "mediaInsightsPipelineId": "{{string}}",
    "s3MediaObjectConsoleUrl": "{{string}}",
    "recordingDurationSeconds": "{{number}}",
    "metadata": "{{string}}" // JSON encoded string of the metadata object
}

// metadata object
{
    "voiceConnectorId": "{{string}}",
    "callId": "{{string}}",
    "transactionId": "{{string}}",
    "fromNumber": "{{string}}",
    "toNumber": "{{string}}",
    "direction": "{{string}}",
    "startTime": "{{string}}", // ISO8601 format
    "endTime": "{{string}}", // ISO8601 format
    "oneTimeMetadata": "{{string}}" // JSON encoded in string of oneTimeMetadata object
}

// onetimeMetadata object
{
    "sipHeaders": "{{string}}", // JSON encoded string of SIP Invite headers key-value pair
    "siprecMetadata": "{{string}}", // siprec metadata in XML 
    "siprecMetadataJson": "{{string}}" // siprec metadata in JSON (converted from above XML) 
}

// sipHeaders object
{
    "{{string}}": "{{string}}"
}
```

## 音声エンハンスメントを有効にする
<a name="voice-enhancement-sink"></a>

音声強化を有効にするには、[https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipelineConfiguration.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_CreateMediaInsightsPipelineConfiguration.html) API コールに `VoiceEnhancementSinkConfiguration` 要素を含めます。

一般的な要素の例を次に示します。

```
{
  "Type":"VoiceEnhancementSink",
  "VoiceEnhancementSinkConfiguration": {
       "Disabled": {{Boolean}} (string) // FALSE ==> Voice Enhancement will be performed
}
```

設定を更新するには、`VoiceEnhancementSinkConfiguration` 要素を [https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_UpdateMediaInsightsPipelineConfiguration.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_UpdateMediaInsightsPipelineConfiguration.html) API コールに追加します。これを行うと、[https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_GetMediaInsightsPipelineConfiguration.html](https://docs.aws.amazon.com/chime-sdk/latest/APIReference/API_media-pipelines-chime_GetMediaInsightsPipelineConfiguration.html) API には `VoiceEnhancementSinkConfiguration` 要素が結果に含まれます。

このリクエスト例は、音声エンハンスメントと Amazon S3 への録音を有効にする方法を示しています。

```
POST /media-insights-pipeline-configurations HTTP/1.1
Content-type: application/json

{
   "MediaInsightsPipelineConfigurationName":"{{media_insights_configuration_name}}",
   "ResourceAccessRoleArn":"arn:aws:iam::{{account_id}}:role/{{resource_access_role}}",
   "Elements":[
      {
         "Type":"S3RecordingSink",
         "S3RecordingSinkConfiguration":{
            "Destination":"arn:aws:s3:::{{input_bucket_path}}",
            "RecordingFileFormat":"{{Wav}}"
         }
      },
      {
         "Type":"VoiceEnhancementSink",
         "VoiceEnhancementSinkConfiguration": {
            "disabled":"{{false}}"
         }
      }
   ],
   "ClientRequestToken":"{{client_request_token}}"
}
```

**注記**  
`VoiceEnhancementSink` 要素を使用するには、通話分析の設定で `S3RecordingSink` 要素を常に設定する必要があります。