Forum Discussion

Anne_Rowe's avatar
Anne_Rowe
Copper Contributor
Nov 28, 2023

Finding if an ongoing call is internal or external

Hi,

I am developing a solution (in visual Studio) that detects phone calls on a computers (the calls are made using Teams) and start recording to provide a transcript and summary (with user consent).

 

However only calls to external callers (external from the company) should be recorded.

 

My plan was to extract the callId from the ongoing call, and then check the participant of the call against the Active Directory.

However I haven't found a way to get the callId from an ongoing call.

 

Could you please let me know if it is possible to do it, and how.

If the solution I am providing cannot work, is there another way to find out if the call is internal or external?

 

Thank you for your help

 

Anne

  • Anne_Rowe   - 

    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.

Resources