Search code examples
botframeworkmicrosoft-teams

Get current call status of Microsoft Teams


On my Windows PC, I've installed the Microsoft Teams app. I'd like to find out with an appropriate API whether I'm actually in a call and whether my microphone within a call is muted or not.

So my questions are:

  1. How can I find out whether I'm currently in a call?
  2. What is the current microphone state within a call (muted / unmuted)?

A little bit of background: I want to implement a little .NET Core service that polls for these information in the background.


Solution

    1. You can get user status using Graph API presence request, in response body you will get status.

      GET https://graph.microsoft.com/v1.0/me/presence

    Response:

    HTTP/1.1 200 OK
    Content-Type: application/json
    Content-Length: 1574
    
    {  
        "id": "fa8bf3dc-eca7-46b7-bad1-db199b62afc3",
        "availability": "Available",
        "activity": "Available"
    }
    
    1. To know current microphone state within a call (muted / unmuted) is not possible.

    There is a get participant API to get microphone state but for this you need to create a calling bot in teams, create a call in that bot and then from created call using call ID you can get participant microphone state using GET https://graph.microsoft.com/v1.0/communications/calls/{id}/participants/{id}