Bot call automatically terminated after trying to establish
Describe the issue I am testing PsiBot example. I am running it with .NET 6.0. I got joinCall working, then first /api/calling to establish, but seconds later I got another /api/calling to terminate the call. So the bot never joins the meeting. The message from second /api/calling is "Server Internal Error. DiagCode: 500#1203002.@"
Code Snippet
Expected behavior The bot should join the meeting.
Graph SDK (please complete the following information):
<PackageReference Include="Microsoft.Graph" Version="5.38.0" />
<PackageReference Include="Microsoft.Graph.Communications.Calls" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.Graph.Communications.Client" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.Graph.Communications.Common" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.Graph.Communications.Core" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.Psi.Imaging.Windows" Version="0.19.100.1-beta" />
<PackageReference Include="Microsoft.Skype.Bots.Media" Version="1.30.0.19-preview" />
<PackageReference Include="Microsoft.Graph.Communications.Calls.Media" Version="1.2.0.10563" />
Call ID 2025-06-10T13:50:49.1743446Z call-id: 03005e80-cef6-457d-ade2-7341b0ce39d5 2025-06-10T11:46:49.2201324Z call-id: 34005980-c729-4591-bd8f-07d89d282c55 2025-06-10T01:41:08.8033901Z call-id: 07005c80-537c-4ac6-8c9b-b3b43b1f99a5
Logs
Second /api/calling response:
{ "@odata.type": "#microsoft.graph.commsNotifications", "value": [ { "@odata.type": "#microsoft.graph.commsNotification", "changeType": "deleted", "resource": "/app/calls/07005c80-537c-4ac6-8c9b-b3b43b1f99a5", "resourceUrl": "/communications/calls/07005c80-537c-4ac6-8c9b-b3b43b1f99a5", "resourceData": { "@odata.type": "#microsoft.graph.call", "state": "terminated", "resultInfo": { "@odata.type": "#microsoft.graph.resultInfo", "code": 500, "subcode": 1203002, "message": "Server Internal Error. DiagCode: 500#1203002.@" }, "chatInfo": { "@odata.type": "#microsoft.graph.chatInfo", "threadId": "19:meeting_YWI3MGVlM2EtNGVlNS00NzIxLTg0MzgtZDE0OWVmNmI1ZTg0@thread.v2", "messageId": "0" }, "meetingInfo": { "@odata.type": "#microsoft.graph.organizerMeetingInfo", "organizer": { "@odata.type": "#microsoft.graph.identitySet", "user": { "@odata.type": "#microsoft.graph.identity", "id": "ec183066-03f4-4c44-b620-8696f70e75d8", "tenantId": "15e71edc-5c3f-4c0f-b430-20a12d1fe785" } } }, "callChainId": "2217848d-6b0f-429a-bc6f-74d473f80fd8" } } ] }
Additional context I got PsiBot working in .NET Framework 4.8, so there should be no issue with certificate, domain, and app registration. I got the error after upgrading to .NET 6.0.
@yfengcs Strange. When you run the bot on .NET 6.0, are you sure the version on .NET Framework has been terminated?
If you redeploy the .NET 6.0 version, see if you can do a test connection to it, using the Test-NetConnection powershell command:
Test-NetConnection -ComputerName ServiceFqdn -Port InstancePublicPort
where ServiceFqdn and InstancePublicPort are the values given for those properties in MediaPlatformSettings.MediaPlatformInstanceSettings.
Also try that Test-NetConnection when the bot is running on .NET Framework, and see if there is a difference.
Hi @ssulzer Thanks for the reply! Sorry for late response.
Yes, just checked and ran again. I have two branches, one .NET Framework, one .NET 6.0. When running in .NET 6.0 branch, PsiBot.Service and PsiBot.Module project target are .NET only, TeamsBot target is net472 and net6.0. So only the version of .NET 6.0 should be running right?
When running the Test-NetConnection commands, I got the same TcpTestSucceeded: True. They were using the same ServiceFqdn and InstancePublicPort.
@ssulzer Something to share, I feel it's close, but hard to make progress without your insights. I am testing curl -k -v https://<ip>:<port>/MediaProcessor/v1 when I was running .NET Framework and .NET 6.0. In .NET Framework version, the server closed my request since it's TCP. But in .NET 6.0 version server returns 401 Forbidden. So somehow the same Media SDK (same version) is treating that TCP port as HTTP when running in .NET 6.0?
@yfengcs The bot media SDK runs a different HTTP stack depending on the .NET version, so that difference you observe with curl is Ok. I am still not sure what the issue is. One possible problem we have seen is with the Microsoft.IO.RecyclableMemoryStream library. Can you please check if your project references that, and if so, ensure it is on the latest 3.0.1 version. https://www.nuget.org/packages/microsoft.io.recyclablememorystream/
Another thing to try is to deploy to a clean VM on which you have not deployed the .NET Framework version.
@ssulzer Thanks! ok, I wouldn't worry about curl behavior difference then.
Both .NET Framework and .NET 6.0 one have indirect reference to Microsoft.IO.RecyclableMemoryStream 2.2.3 version. In .NET 6.0, now I use explicit reference to 3.0.1. It didn't help. The call still terminates.
I will update here once I have progress. Thanks!
@ssulzer same issue with same error code happening when I run PSI bot and Echo bot locally using ngrok. It was working before but not now. @yfengcs did you find any solution?
Can you share a callChainId please.
@ssulzer "callChainId": "db1095ba-7cca-4fee-b3c9-425bb3e4857b"
Hi @ssulzer, were you able to find any issues in the logs?
First things first, when making posts like this, redact the sensitive information you display. With what you've posted, you've created an attack vector on your account, specially sharing the thread ID of a call along your tenant Id.
Then, this might sound crazy, but upgrade yourself to netcore 8 (I got to update my app to this version when they announced the compat with net6).
then, update your libraries to this version stack if they apply:
<TargetFramework>net8</TargetFramework>
...
<PackageReference Include="Azure.Identity" Version="1.13.2" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.22.7" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.22.7" />
<PackageReference Include="Microsoft.Bot.Schema" Version="4.22.7" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.3" />
<PackageReference Include="Microsoft.Graph.Communications.Calls" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.Graph.Communications.Client" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.Graph.Communications.Common" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.Graph.Communications.Core" Version="1.2.0.10563" />
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.4" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.3.0" />
<PackageReference Include="Microsoft.Skype.Bots.Media" Version="1.28.0.321-preview" />
<PackageReference Include="Microsoft.Graph.Communications.Calls.Media" Version="1.2.0.10563" />
If this does not work for you, then it means that your media session for some reason is not being stablished and the handshake fails. Graph will terminate the call for a participant, if the media session did not come up when the status changes to "stablishing" -> "stablished".
Good luck.
Note, the latest version of the bot media library is 1.31.0.225-preview: https://www.nuget.org/packages/Microsoft.Skype.Bots.Media/1.31.0.225-preview
However, there is a known issue that the current Microsoft.Skype.Bots.Media library does not work on .NET 9. We hope to have a fix for that released in our next SDK, expected in September.
@yfengcs @Krishnanunni333 If updating Microsoft.IO.RecyclableMemoryStream to version 3.0.1 did not help, then there is another oddball thing to check. The bot machine must have the necessary intermediate Azure Certificate Authority (CA) certificates installed. In particular, all of the "Microsoft Azure RSA TLS Issuing CA 03/04/07/08" certificates must be installed in the "Intermediate Certificate Authorities\Certificates" folder in the Local computer certificate store. https://learn.microsoft.com/en-us/azure/security/fundamentals/azure-ca-details?tabs=root-and-subordinate-cas-list#subordinate-certificate-authorities
@ssulzer The bot machine does need to hold a certificate signing the domain the bot exposes. But it does not NEED to be inside the store. This is a functional working code where the certificate is not installed in the store.
public virtual MediaPlatformSettings CreateMediaPlatformSettings() {
X509Certificate2 cert = new(@"C:\GRL\cert.dev.csp.pfx", "randompwdredacted", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
return new MediaPlatformSettings() {
MediaPlatformInstanceSettings = new MediaPlatformInstanceSettings() {
Certificate = cert,
InstanceInternalPort = InstanceInternalPort,
InstancePublicIPAddress = IPAddress.Any,
InstancePublicPort = InstancePublicPort,
ServiceFqdn = MediaServiceFQDN
},
ApplicationId = AadAppId,
};
}