Forum Discussion
pablomoreno700
Dec 20, 2022Copper Contributor
Error in Teams Bot when getting audio - MS Graph
Hi guys, I'm having issues using PsiBot project (https://github.com/microsoftgraph/microsoft-graph-comms-samples/tree/master/Samples/PublicSamples/PsiBot) as base. JUST happening on some MS accounts. When I'm trying to get audio from a Teams meeting using the bot I'm not getting any data, just silence.
public void Received(AudioMediaBuffer audioFrame)
{
//Console.WriteLine("Receiving audio");
if (audioFrame.Timestamp == 0)
{
this.logger.Warn($"Audio buffer timestamp is zero.");
return;
}
var audioFormat = audioFrame.AudioFormat == Microsoft.Skype.Bots.Media.AudioFormat.Pcm44KStereo ?
Microsoft.Psi.Audio.WaveFormat.Create16BitPcm(44000, 2) :
Microsoft.Psi.Audio.WaveFormat.Create16kHz1Channel16BitPcm();
var buffers = new Dictionary<string, (AudioBuffer, DateTime)>();
try
{
unsafe
{
FileStream file = new FileStream(MediaFrameSourceComponent.BASE_PATH + "audio_" + callHandler.Call.Id + ".raw", FileMode.Append, FileAccess.Write);
UnmanagedMemoryStream ustream = new UnmanagedMemoryStream((byte*)audioFrame.Data, audioFrame.Length);
ustream.CopyTo(file);
ustream.Close();
file.Close();
}
}
catch (Exception e)
{
Console.WriteLine("Error receiving audio" + e.StackTrace);
}
}
This is the error log:
This is the list of permissions the MS app has:
- Calls.JoinGroupCall.All
- OnlineMeetings.ReadWrite.All
- Calls.JoinGroupCallAsGuest.All
- Calls.AccessMedia.All
At this moment I don't have any clue because as I said before this is not happening in all MS accounts, just in a few ones.
Can anyone bring any idea?
Thanks
8 Replies
- Meghana-MSFTFormer EmployeeWe are looking into this, we will get back to you.
- pablomoreno700Copper ContributorWe found that this error throwing is just happening when someone is talking, in that moment audioFrame.Length is 0, when people are muted then we receive Silence sound correctly.
- Meghana-MSFTFormer EmployeeThank you for the additional details, we will check internally and get back to you. Thank you.