|
| 1 | +--- |
| 2 | +author: rsarkar |
| 3 | +ms.service: azure-communication-services |
| 4 | +ms.date: 03/15/2023 |
| 5 | +ms.topic: include |
| 6 | +ms.custom: private_preview |
| 7 | +ms.author: rsarkar |
| 8 | +--- |
| 9 | + |
| 10 | +[!INCLUDE [Private Preview](../../../../includes/private-preview-include-section.md)] |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +Before you start testing Unmixed Audio recording, make sure you complete the following steps: |
| 15 | + |
| 16 | +- You need a Call in place whether is using Calling Client SDK or Call Automation before you start recording. Review their quickstarts and make sure you follow all their pre-requisites. |
| 17 | +- Create an Azure account with an active subscription. For details, see [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 18 | +- Create an Azure Communication Services resource. For details, see [Create an Azure Communication Services resource](../../../create-communication-resource.md). You'll need to record your resource **connection string** for this quickstart. |
| 19 | +- Subscribe to events via [Azure Event Grid](https://learn.microsoft.com/azure/event-grid/event-schema-communication-services). |
| 20 | +- Download the [Java SDK](https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-java/maven/com.azure%2Fazure-communication-callautomation/overview/1.0.0-alpha.20230314.1 ) |
| 21 | +- This quickstart assumes you have some experience using the [Calling Client SDK](../../get-started-with-video-calling.md). **Important**: To fetch `serverCallId` from Calling SDK, refer to the [JavaScript](../../get-server-call-id.md) example. |
| 22 | +- Make sure to provide the Azure Communication Services Call Recording team with your [immutable Azure resource ID](../../get-resource-id.md) to be allowlisted during the **private preview** tests. |
| 23 | + |
| 24 | + |
| 25 | +## 1. Create a Call Automation client |
| 26 | + |
| 27 | +To create a call automation client, you'll use your Communication Services connection string and pass it to `CallAutomationClient` object. |
| 28 | + |
| 29 | +```java |
| 30 | +CallAutomationClient callAutomationClient = new CallAutomationClientBuilder() |
| 31 | + .connectionString("<acsConnectionString>") |
| 32 | + .buildClient(); |
| 33 | +``` |
| 34 | + |
| 35 | +## 2. Start recording session with StartRecordingOptions using 'startRecordingWithResponse' server API |
| 36 | + |
| 37 | +Use the server call ID received during initiation of the call. |
| 38 | + |
| 39 | +### 2.1 Using Azure Blob Storage for External Storage |
| 40 | + |
| 41 | + |
| 42 | +```java |
| 43 | +StartRecordingOptions recordingOptions = new StartRecordingOptions(new ServerCallLocator("<serverCallId>")) |
| 44 | + .setExternalStorage(new BlobStorage("<Insert Container / Blob Uri>")); |
| 45 | + |
| 46 | +Response<StartCallRecordingResult> response = callAutomationClient.getCallRecording() |
| 47 | +.startRecordingWithResponse(recordingOptions, null); |
| 48 | +``` |
| 49 | + |
| 50 | +The `startRecordingWithResponse` API response contains the recording ID of the recording session. |
| 51 | + |
| 52 | +## 3. Stop recording session using 'stopRecordingWithResponse' server API |
| 53 | + |
| 54 | +Use the recording ID received in response of `startRecordingWithResponse`. |
| 55 | + |
| 56 | +```java |
| 57 | +Response<Void> response = callAutomationClient.getCallRecording() |
| 58 | + .stopRecordingWithResponse(response.getValue().getRecordingId(), null); |
| 59 | +``` |
| 60 | + |
| 61 | +## 4. Pause recording session using 'pauseRecordingWithResponse' server API |
| 62 | + |
| 63 | +Use the recording ID received in response of `startRecordingWithResponse`. |
| 64 | + |
| 65 | +```java |
| 66 | +Response<Void> response = callAutomationClient.getCallRecording() |
| 67 | + .pauseRecordingWithResponse(response.getValue().getRecordingId(), null); |
| 68 | +``` |
| 69 | + |
| 70 | +## 5. Resume recording session using 'resumeRecordingWithResponse' server API |
| 71 | + |
| 72 | +Use the recording ID received in response of `startRecordingWithResponse`. |
| 73 | + |
| 74 | +```csharp |
| 75 | +Response<Void> response = callAutomationClient.getCallRecording() |
| 76 | + .resumeRecordingWithResponse(response.getValue().getRecordingId(), null); |
| 77 | +``` |
| 78 | + |
| 79 | +## 6. Notification on successful export |
| 80 | + |
| 81 | +Use an [Azure Event Grid](../../../../../event-grid/overview.md) web hook or other triggered action should be used to notify your services when the recorded media is ready and have been exported to the external storage location. |
| 82 | + |
| 83 | +Below is an example of the event schema. |
| 84 | + |
| 85 | +``` json |
| 86 | +{ |
| 87 | + "id": "string", // Unique guid for event |
| 88 | + "topic": "string", // /subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name} |
| 89 | + "subject": "string", // /recording/call/{call-id}/serverCallId/{serverCallId} |
| 90 | + "data": { |
| 91 | + "storageType": "string", // acsstorage, blobstorage etc. |
| 92 | + "recordingId": "string", // unique id for recording |
| 93 | + "recordingStorageInfo": { |
| 94 | + "recordingChunks": [ |
| 95 | + { |
| 96 | + "documentId": "string", // Document id for for the recording chunk |
| 97 | + "contentLocation": "string", //Azure Communication Services URL where the content is located |
| 98 | + "metadataLocation": "string", // Azure Communication Services URL where the metadata for this chunk is located |
| 99 | + "deleteLocation": "string", // Azure Communication Services URL to use to delete all content, including recording and metadata. |
| 100 | + "index": "int", // Index providing ordering for this chunk in the entire recording |
| 101 | + "endReason": "string", // Reason for chunk ending: "SessionEnded", "ChunkMaximumSizeExceeded”, etc. |
| 102 | + } |
| 103 | + ] |
| 104 | + }, |
| 105 | + "recordingStartTime": "string", // ISO 8601 date time for the start of the recording |
| 106 | + "recordingDurationMs": "int", // Duration of recording in milliseconds |
| 107 | + "sessionEndReason": "string" // Reason for call ending: "CallEnded", "InitiatorLeft”, etc. |
| 108 | + }, |
| 109 | + "eventType": "string", // "Microsoft.Communication.RecordingFileStatusUpdated" |
| 110 | + "dataVersion": "string", // "1.0" |
| 111 | + "metadataVersion": "string", // "1" |
| 112 | + "eventTime": "string" // ISO 8601 date time for when the event was created |
| 113 | +} |
| 114 | +``` |
0 commit comments