pierrick | 2017-10-10 17:05:53 UTC | #1
When RecordingApi.GetConversationRecordings() mutiple times to get the recording URL and download recordings, I often get null as a response.
It happens randomly. Is this due to the API rate limits? No exception occurs.
Here is a sample code:
var recordingApi = new RecordingApi();
var recordings = recordingApi.GetConversationRecordings(conversationId);
if (recordings == null)
{
Trace.Main.Error("Null received.");
}
And here is a screenshot of the error occurring: <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/02ad56651874ceb748ced0df7ea41c0c8c30a71a.jpg" width="690" height="114">
Looking for guidance. I can provide the entire source code if needed.
Thanks.
tim.smith | 2017-10-10 19:36:47 UTC | #2
Can you grab a correlation ID from the request that returned null?
pierrick | 2017-10-11 08:17:16 UTC | #3
var recordings = recordingApi.GetConversationRecordings(conversationId); just returns null, no exception thrown. How can I get the correlation id header using the C# SDK?
tim.smith | 2017-10-12 14:58:53 UTC | #4
Use the WithHttpInfo variety of the method and access the headers from the response object.
pierrick | 2017-10-12 15:33:03 UTC | #5
Thanks. Here you go:
ININ-Correlation-Id: 58162ef1-0bfb-46b0-af70-9d888bb2a70b
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/a4d37f2de51ee0258009f14eaa3077e4bca4af66.jpg" width="690" height="186">
tim.smith | 2017-10-12 15:39:18 UTC | #6
Yea, that's what I thought. You're getting a 202 response because the recording hasn't finished transcoding yet. Wait a little bit and try again when you get a 202.
pierrick | 2017-10-12 15:41:17 UTC | #7
ok, will try that. Thanks for the info.
pierrick | 2017-10-12 16:51:02 UTC | #8
Hey Tim, I added more traces about the recordings that were failing (returning null) and the recordings are from 3/1/2017... Are you sure it's because they have not finished transcoding yet?
When this happens (kind of randomly btw), all further attempts suddenly fail (and I end up reaching the API rate limits). Here are some examples:
- Recordings downloading fine:
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/200652e48533b1197d2fa7751a9146d5336bacca.jpg" width="690" height="482">
- Recordings failing (all further attempts fail):
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/b9e9710c31d14ffe964f5ba930027940a87e8567.jpg" width="690" height="421">
It really happens randomly because the recording that failed in my previous post (69bae57c-e64c-484a-9682-15fe3ff609fd) actually worked this time:
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/63c56a5aff148368c58a18c8169ef607daad8fee.jpg" width="690" height="34">
Thanks, Pierrick
tim.smith | 2017-10-12 16:58:31 UTC | #9
It's important to be clear that nothing is failing in your examples. Everything you're seeing is working exactly as intended. If the recording service determines that it needs to transcode a recording, it's going to kick off that process and return a 202 for any requests for that recording until transcoding is complete. Only then will it return a 200 with the download URI for the recording.
Regarding rate limiting, a well-behaved app will monitor the rate limiting headers and behave accordingly when it gets rate limited (429 responses). For more information about API rate limiting, see https://developer.mypurecloud.com/api/rest/tips/index.html#3. Do take note that you may be rate limited before reaching the limits shown in the headers; some back end services implement their own rate limiting in addition to the API layer rate limiting.
pierrick | 2017-10-12 18:13:05 UTC | #10
Ah... Makes sense. I was still thinking like in PureConnect where recordings were transcoded and compressed as soon as the calls were finished. I understand now that, In PureCloud, recordings are transcoded when we need to download them.
Got it. I will change the code accordingly.
Regarding API rate limits, it was only happening when getting null responses rapidly. The app handles this error by waiting the appropriate time.
Thanks
pierrick | 2017-10-16 11:23:51 UTC | #11
Here is a related issue:
If I use the C# SDK to retrieve a recording from a conversation (59d4e873-01d1-40ea-88e9-4d68a1119704), I get a 202.
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/c5f8313825af97bed54d1fbf6572d780acff43cc.jpg" width="690" height="248">
Since this is pretty much all I get, I checked using the Developer tools to retrieve the same recording, I get a 200
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/93a7bfb7926d49e3cddf4c1c7a4d68e5f31f5811.jpg" width="690" height="401">
I tested this with multiple recordings. I also ran this app from 2 different sources:
- From my own PC, I get a lot of recordings being downloaded
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/0973b9199c0ccafaced2c6e337da8d9b0a196614.jpg" width="690" height="240">
- From an Azure VM (to get faster internet access), I get lots of 202
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/873ac29ab81965a59298ac69bd14871f95c12703.jpg" width="690" height="326">
Note that the conversations are in the same order and how the IDs match but the response is different in the two different locations? For example, the first conversation id: 43cbbe20-27f5-4f32-9d34-792942b31d0e downloads OK on my machine but I get a 202 from the Azure VM.
tim.smith | 2017-10-16 14:21:39 UTC | #12
The SDK just sends the request; it's not responsible for determining if the recording is available or not. If you believe there's an issue with the recording services, please open a ticket with PureCloud Support or contact the dev team directly.
flyte | 2017-10-26 19:25:19 UTC | #13
Was there anything new discovered here with respect to the inconsistent 202's when triggered from the Azure VM?
I want to do something similar; instead of actually downloading the media, I just want to create a download link that I can put in my report/csv/xls/whatever summary of the calls.
Now I understand that the mediaUri's provided back once I do a request via GetConversationRecordingsAsyncWithHttpInfo would essentially be the download link, but how long would that be valid?
pierrick | 2017-10-27 07:22:41 UTC | #14
I did get an explanation: 202s occur when PureCloud gets a request to download a recording but instead of blocking the request, it returns 202. It's up to you to try again later.
Recordings are kept for 1 hour so make sure that when you try again, you do it within the hour (that was my mistake).
So, your scenario won't work.
flyte | 2017-10-27 22:56:26 UTC | #15
Ok, I will only request to get the media when I am ready to download it so that it doesn't expire. However, I seem to be running into another issue; I have separate media files for a conversation.. one seems to be the customer, and the other seems to be the agent..
Isn't there a way to get a combined recording?
flyte | 2017-10-30 16:46:34 UTC | #16
@tim.smith @pierrick
Do you know if there is there any way to obtain a combined recording?
pierrick | 2017-10-30 16:59:19 UTC | #17
Not that I know of. @tim.smith?
flyte | 2017-10-30 17:55:04 UTC | #18
I wonder if this is controlled by the download parameter of another method, GetConversationRecording (I'm currently using GetConversationRecordingsAsyncWithHttpInfo which does not have the download parameter)
// download: // requesting a download format of the recording (optional, default to false)
So no where in the documentation can I find more details on what a "download format" is. This is a boolean flag and not a media type..
I'll see what this does..
tim.smith | 2017-10-31 15:02:44 UTC | #19
flyte, post:15, topic:1930
Isn't there a way to get a combined recording?
This setting is configured per trunk and does not apply retroactively. It's found under Edit External Trunk > External Trunk Configuration > Media > Recording > Dual Channel.
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/76701fb4ca6f730f1bdf9fbd9de23a7b4455a5c5.png" width="561" height="293">
flyte | 2017-11-01 16:46:12 UTC | #20
So, we would want to disable this Dual Channel setting to get a combined stream? Tooltip suggests that we would enable it if we wanted separate streams?
Also, it seemed that the call to GetConversationRecording providing the download parameter of true did combine the streams together - that is I can hear both the customer and the agent... BUT I still sometimes get 2 separate recordings.. which I think is ok.. for example one maybe the initial call, and the other may be the call back..
I'm still investigating..
tim.smith | 2017-11-01 17:49:30 UTC | #21
If you enable dual channel recording, you get recordings for each channel. If you disable it, you get a single recording for all channels.
system | 2017-12-02 17:49:48 UTC | #22
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 1930