- Joined
- Jun 18, 2020
- Messages
- 12
- Reaction score
- 6
Hi,
I would like to play audio file from external server. In that case I need to be able to download it first. I already found edossantos's post but it doesn't work for me.
Full C# code I use:
CFD component:

There is no error in CFD but in 3CX Management Console in Call Flow Apps section.

I will be grateful for any help.
I would like to play audio file from external server. In that case I need to be able to download it first. I already found edossantos's post but it doesn't work for me.
Full C# code I use:
Code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace FileDownloader
{
public class FileDownloader
{
private async Task downloadFile(string uri, string fileName)
{
using (HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Get, uri))
{
using (HttpClient httpClient = new HttpClient())
{
using (HttpResponseMessage httpResponse = await httpClient.SendAsync(httpRequest))
{
byte[] byteArray = await httpResponse.Content.ReadAsByteArrayAsync();
using (FileStream stream = File.Open(fileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
{
stream.Write(byteArray, 0, byteArray.Length);
}
}
}
}
}
public void DownloadFile(string uri, string fileName)
{
downloadFile(uri, fileName).Wait();
}
}
}
CFD component:

There is no error in CFD but in 3CX Management Console in Call Flow Apps section.

I will be grateful for any help.