question

AlexKwan-4307 avatar image
0 Votes"
AlexKwan-4307 asked ajkuma-MSFT commented

PlayAudioAsync not playing any audio in the call

I tried called playAudioAsync through the ServerCall and the CallConnection and its not working.

I have encoded a wav file and made it available as a static file through my asp.net core project and ngrok'd so my static assets are publicly available.

I can play the file if I use the link directly in the browser however it doesn't work with playAudioAsync using the calling automation APIs. What else do I need to do?
Is there any sample wav urls that I can test with?

azure-communication-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ajkuma-MSFT avatar image
1 Vote"
ajkuma-MSFT answered

@AlexKwan-4307,

Apologies for the late response!

Just to highlight, only Wave file (.wav) format audio prompts are supported at this time. More specifically, the audio content in the wave file must be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate. Could you please share the audio file format (sample rate and bits per sample)?

To isolate the issue, you may log the response and review- for the steps, please see the sample which shows how to, using the LogMessage method (sample)

Call Connections - Play Audio


Kindly let us know, I’ll follow-up with you further on this.

Thanks for your patience!


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I am using the audio files in the outbound reminder quickstart that someone had pointed to me.
https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/OutboundCallReminder

I get a 202 accepted when I call playAudioAsync but no sound is being played.
I can hit the static file through ngrok so the file URI is publicly accessible.

What else can I use to debug why no audio is being played?

0 Votes 0 ·

Determined it was my ngrok set up that was preventing the audio from being found by the calling apis.

When I deployed to an azure static web app since everything was public it could be found.

Narrowing down the situation it seemed that

app.UseHttpsRedirection was causing my issue (this is code that is bundled in a c# create-react-app) with ngrok

commenting it out fixes everything.

0 Votes 0 ·
AlexKwan-4307 avatar image
0 Votes"
AlexKwan-4307 answered ajkuma-MSFT commented

Determined it was my ngrok set up that was preventing the audio from being found by the calling apis.

When I deployed to an azure static web app since everything was public it could be found.

Narrowing down the situation it seemed that

app.UseHttpsRedirection was causing my issue (this is code that is bundled in a c# create-react-app) with ngrok

commenting it out fixes everything.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AlexKwan-4307, Glad to know that you have sorted out the issue. Thanks for sharing the solution that worked for you with the community, it will benefit the users experiencing a similar issue.

To benefit the community find the right answers, please do mark the post which was helpful by clicking on ‘Accept Answer’ & ‘Up-Vote’

Much appreciate the follow-up and collaboration on this.

0 Votes 0 ·