Hello Lucas Lehembre,
Greetings! Welcome to Microsoft Q&A Forum.
I understand that you would like to know how to authenticate a file to get back and get the call recordings to the storage account directly once the recordings are ready,
1.I get a contentLocation back: "contentLocation": "``https://fr-storage.asm.skype.com/v1/objects/0-frc-d4-e20...fccb154/content/audiomp3``"
=> How to authenticate to get the file back?
When you receive a contentLocation
like the one you mentioned (https://fr-storage.asm.skype.com/v1/objects/0-frc-d4-e20...fccb154/content/audiomp3
), you’ll need to authenticate to access the file.
Since you’re using the REST API, you can follow these steps:
- Digest Authentication: Unfortunately,
file_get_contents
don’t directly support digest authentication. However, you can use Curl to achieve this. Here’s an example of how to do it with Curl:
$ch = curl_init('https://fr-storage.asm.skype.com/v1/objects/0-frc-d4-e20...fccb154/content/audiomp3');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, 'your_username:your_password');
$fileContent = curl_exec($ch);
curl_close($ch);
// Now $fileContent contains the audio file data
- Replace
'your_username'
and'your_password'
with your actual credentials. - Remember that digest authentication requires additional handling compared to basic authentication.
2.How do I apply this to the REST API please ? What attributes do I put in the start_recording request body to use my Azure storage ?
If you’d like to store the audio files directly in an Azure storage account, you can follow these steps:
- Set up an Azure Storage Account (if you had done already, please ignore).
- Modify your recording process to save the audio files directly to the Azure storage account.
- In your
start_recording
request body, include the necessary attributes to specify the Azure storage account details. These attributes will depend on the specifics of your implementation and the Azure SDK you’re using. - Configure your storage account and integrate it with your application.
- Unfortunately, the REST API documentation doesn’t explicitly mention how to use Azure storage for recording. However, you’ll need to include the relevant information in your request body. Here’s a high-level example (you’ll need to adapt it to your specific case): {
}"recordingType": "audio", "storageType": "azure", "azureStorageSettings": { "accountName": "your_storage_account_name", "containerName": "your_container_name", "sasToken": "your_sas_token" }
- Replace
"your_storage_account_name"
,"your_container_name"
, and"your_sas_token"
with your actual Azure storage account details. - Ensure that your app has the necessary permissions to write to the specified container.
refer - https://stackoverflow.com/questions/21409914/how-to-access-rest-web-service-using-file-get-contents-with-digest-authenticatio, https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/get-started-call-recording?pivots=programming-language-csharp.
Hope this answer helps! Please let us know if you have any further queries. I’m happy to assist you further.
Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.