共用方式為


通話錄音:自備 Azure 儲存體快速入門

本快速入門可讓您開始使用自備 Azure 儲存體進行通話錄音。 若要開始使用自備 Azure 儲存體功能,請確定您已熟悉通話錄音 API

必要條件:設定受控識別和角色型 存取控制(RBAC) 角色指派

1.為 Azure 通訊服務啟用系統指派的受控識別

此圖顯示已停用受控識別的通訊服務資源

  1. 開啟 Azure 通訊服務資源。 瀏覽至左側的 [身分識別]
  2. 已啟用系統指派的受控識別,然後按兩下 [ 儲存]。
  3. 完成後,您就能夠看到新建身分識別的物件主體識別碼。

此圖顯示已啟用受控識別的通訊服務資源

  1. 成功建立身分識別之後,按兩下 [ Azure 角色指派 ] 以開始新增角色指派。

2.新增角色指派

  1. 按一下 [新增角色指派]

顯示通訊服務資源受控識別新增角色指派的圖表

  1. 在 [新增角色指派] 面板中,選取下列值
    1. 範圍:Storage
    2. 訂用帳戶:選擇您的訂用帳戶
    3. 資源:選擇您的儲存體帳戶
    4. 角色:Azure 通訊服務需要 [儲存體 Blob 資料參與者],才能寫入您的儲存體帳戶。

顯示通訊服務資源受控識別新增角色指派詳細數據的圖表

  1. 按一下 [儲存]
  2. 完成後,您會在 [Azure 角色指派] 視窗中看到新增的角色指派。

顯示通訊服務資源受控識別角色指派成功的圖表

使用指定的外部儲存體開始錄製工作階段

使用在通話起始期間收到的伺服器通話識別碼。

使用 Azure Blob 儲存體作為外部儲存體

StartRecordingOptions recordingOptions = new StartRecordingOptions(new ServerCallLocator("<serverCallId>"))
{
    //...
    ExternalStorage = new BlobStorage(new Uri("<Insert Container / Blob Uri>"))
};
               
Response<RecordingStateResult> startRecordingWithResponse = await callAutomationClient.GetCallRecording()
        .StartRecordingAsync(options: recordingOptions);

使用 Azure Blob 儲存體作為外部儲存體

StartRecordingOptions recordingOptions = new StartRecordingOptions(new ServerCallLocator("<serverCallId>"))
                .setExternalStorage(new BlobStorage("<Insert Container / Blob Uri>"));

Response<StartCallRecordingResult> response = callAutomationClient.getCallRecording()
.startRecordingWithResponse(recordingOptions, null);

成功匯出的通知

使用 Azure 事件方格 Web 攔截或其他觸發動作,在錄製的媒體就緒並匯出至外部儲存位置時通知您的服務。

請參閱事件結構描述的這個範例。

{
    "id": "string", // Unique guid for event
    "topic": "string", // /subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}
    "subject": "string", // /recording/call/{call-id}/serverCallId/{serverCallId}
    "data": {
        "storageType": "string", // AzureBlob etc.
        "recordingId": "string", // unique id for recording
        "recordingStorageInfo": {
            "recordingChunks": [
                {
                    "documentId": "string", // Document id for the recording chunk
                    "contentLocation": "string", //Azure Communication Services URL where the content is located
                    "metadataLocation": "string", // Azure Communication Services URL where the metadata for this chunk is located
                    "deleteLocation": "string", // Azure Communication Services URL to use to delete all content, including recording and metadata.
                    "index": "int", // Index providing ordering for this chunk in the entire recording
                    "endReason": "string", // Reason for chunk ending: "SessionEnded", "ChunkMaximumSizeExceeded”, etc.
                }
            ]
        },
        "recordingStartTime": "string", // ISO 8601 date time for the start of the recording
        "recordingDurationMs": "int", // Duration of recording in milliseconds
        "sessionEndReason": "string" // Reason for call ending: "CallEnded", "InitiatorLeft”, etc.
    },
    "eventType": "string", // "Microsoft.Communication.RecordingFileStatusUpdated"
    "dataVersion": "string", // "1.0"
    "metadataVersion": "string", // "1"
    "eventTime": "string" // ISO 8601 date time for when the event was created
}

通話錄製的資料夾結構

錄製會以下列格式儲存,如下圖所示。

  • /YYYYYMMDD/callId/first_8_of_recordingId + '-' + 唯一 guid/[chunk-id]-acsmetadata.documentId.json
  • /YYYYYMMDD/callId/first_8_of_recordingId + '-' + 唯一 guid/[chunk-id]-audiomp3.documentId.mp3

顯示通話錄製資料夾結構的圖表

下一步

如需詳細資訊,請參閱下列文章: