.NET SDK doesn't work for the async methods

The client is using GitHub - MyPureCloud/platform-client-sdk-dotnet: .NET platform client SDK to call Genesys API.

The client was able to log API requests/responses for the sync methods, but for the async methods nothing is logging.

What could cause this issue?

Buenos días, no soy experto pero uso con frecuencia métodos asíncronos del SDK de .net, compartí el código que esta fallando y capas que te pueda ayudar.
Saludos

To be more specific, our client stores interaction recordings on their backend using the SDK above.

Here is the log example for the sync methods:

{"date":"2024-03-07T13:22:33.9955867Z","level":"trace","method":"Get","url":" https://api.cac1.pure.cloud/api/v2/conversations/7bf9afe3-7037-48be-9d09-0f43fcb0bc51/recordingmetadata","requestHeaders":{"Accept":"application/json","Authorization":"[REDACTED]"},"responseHeaders":{"Transfer-Encoding":"chunked","Connection":"keep-alive","Date":"Thu, 07 Mar 2024 13:22:33 GMT","ININ-Correlation-Id":"15f47d4c-3137-4828-b952-c37adeec718a","Strict-Transport-Security":"max-age=31536000; includeSubDomains","Cache-Control":"no-store, must-revalidate, no-cache","X-Cache":"Miss from cloudfront","Via":"1.1 269b0fad85dfd450220cf6573a2d384e.cloudfront.net (CloudFront)","X-Amz-Cf-Pop":"ARN56-P2","X-Amz-Cf-Id":"MVSg-u-XQwvWd1KPUC-mDu7WyPpHayZmqbFdluy7_iICPMVVxBoVGg=="},"correlationId":"15f47d4c-3137-4828-b952-c37adeec718a","statusCode":200}

a continuación una app de consola que cumple la función de descargar todos los tipos de grabaciones que puede tener una interacción, podes filtrar por el tipo que necesites o almacenar por carpetas según el tipo. Desconozco si se puede realizar de otra forma mas optima pero es la que puede realizar con le SDK de .NET

using PureCloudPlatform.Client.V2.Api;
using PureCloudPlatform.Client.V2.Client;
using PureCloudPlatform.Client.V2.Extensions;
using PureCloudPlatform.Client.V2.Model;
using System;
using System.Net;


namespace DownloadCall
{
    internal class Program
    {
        static void Main(string[] args)
        {            
            DownloadCall();
            Console.ReadLine();
        }
        private async static void DownloadCall()
        {
            WebClient myWebClient = new WebClient();
            Configuration.Default.ConfigFilePath = "congif.ini";
            var accessTokenInfo = Configuration.Default.ApiClient.PostToken("YOU_CLIENT_ID",
                "YOU_CLIENT_SECRET");
            var ClienteApi = new RecordingApi();
            var Recordings = await ClienteApi.GetConversationRecordingmetadataAsync("50bb186f-8be7-46fe-bb69-cc5fb19832be");
            if (Recordings != null) 
            {
                foreach (var Recording in Recordings)
                {
                    if (Recording.FileState == RecordingMetadata.FileStateEnum.Available)
                    {                        
                        var records = await ClienteApi.GetConversationRecordingAsync(Recording.ConversationId, Recording.Id, "mp3", "eml", "zip", "zip", true);
                        while (records == null)
                        {
                          records = await ClienteApi.GetConversationRecordingAsync(Recording.ConversationId, Recording.Id, "mp3", "eml", "zip", "zip", true);
                        }                        
                        foreach (var URLs in records.MediaUris)
                        {
                            var filename = Recording.ConversationId + "_" + Recording.Id + "_" + Recording.Media;
                            switch (Recording.Media)
                            {
                                case "voice":
                                    filename = filename + ".mp3";
                                    break;
                                case "email":
                                    filename = filename + ".eml";
                                    break;
                                case "screen":
                                    filename = filename + "webm";
                                    break;

                                default:
                                    filename = filename + ".zip";
                                    break;
                            }
                            myWebClient.DownloadFile(URLs.Value.MediaUri, filename);
                        }
                        

                    }
                }
            } 
        }
    }
}

En el siguiente link esta también un ejemplo para realizar descargas de forma masiva. Talvez se pueda adaptar a la necesitada de tu cliente ejecutando una vez al día la descarga de todas las llamadas del día anterior.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.