Forum Discussion
Finding if an ongoing call is internal or external
To extract the callId from an ongoing call in Microsoft Teams, you would need to create a bot that interacts with Teams calls and meetings using the Microsoft Graph APIs for calls and online meetings.
When a call is initiated or received by your bot, Teams will send an incoming call notification to your bot. This notification contains the callId in the resourceData object.
Here is a sample incoming call notification:
{
"value": [
{
"changeType": "created",
"resource": "/app/calls/57DAB8B1894C409AB240BD8BEAE78896",
"resourceData": {
"id": "57DAB8B1894C409AB240BD8BEAE78896",
"state": "incoming",
"direction": "incoming",
"subject": "John Doe",
"from": {
"identity": {
"id": "39:contoso.com_8b209ac1-2ec0-4301-9e52-b50536d9e382_a2d1c0d4-5121-4307-ab70-1228e6ae12d5"
}
},
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"resourceUrl": "https://graph.microsoft.com/beta/app/calls/57DAB8B1894C409AB240BD8BEAE78896",
"timeStamp": "2017-09-14T19:56:39.4685525Z"
}
]
}
In this example, the callId is "57DAB8B1894C409AB240BD8BEAE78896".
To receive these notifications, your bot must be registered in the Teams app manifest with the supportsCalling
setting enabled, and you must set up a webhook endpoint for incoming calls to your bot.
Please note that to access the audio and video media streams, your bot must use the Microsoft.Graph.Communications.Calls.Media.NET library and be deployed on a Windows Server machine or Windows Server guest Operating System (OS) in Azure.
For more information, you can refer to the Microsoft Graph APIs for calls and online meetings and requirements and considerations for application-hosted media bots.