获取 Microsoft Teams 会议通话更新的更改通知

借助 Microsoft Graph 中的更改通知,能够订阅 Microsoft Teams 联机会议的通话开始/结束以及通话名单更新。 更改通知允许你维护订阅,从而提供低延迟模式。 你还可以在通知中获取资源数据,因此避免调用 API 来获取有效负载。

订阅的最大到期期限为 3 天。 若要将订阅保留超过此期限,必须发出订阅续订请求。 有关详细信息,请参阅 更新订阅。 或者,用户可以等待订阅过期,并使用相同的会议资源创建新订阅。

若要获取会议的呼叫事件的更改通知,请 /communications/onlineMeetings/?$filter=JoinWebUrl eq '{JoinWebUrl}'订阅 。

此资源支持包含资源数据的通知。 有关使用资源数据设置通知的详细信息,请参阅 设置包含资源数据的更改通知

权限

权限类型 权限(从最低特权到最高特权) 支持的版本
委派(工作或学校帐户) 不支持。 不支持。
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 OnlineMeetings.Read.All、OnlineMeetings.ReadWrite.All beta 版

示例

POST https://graph.microsoft.com/beta/subscriptions
Content-Type: application/json

{
  "changeType": "updated",
  "notificationUrl": "https://webhook.azurewebsites.net/api/resourceNotifications",
  "resource": "/communications/onlineMeetings/?$filter=JoinWebUrl eq '{JoinWebUrl}'",
  "includeResourceData": true,
  "encryptionCertificate": "{base64encodedCertificate}",
  "encryptionCertificateId": "{customId}",
  "expirationDateTime": "2021-02-01T11:00:00.0000000Z",
  "clientState": "{secretClientState}"
}

注意

将 替换为 {JoinWebUrl} 指定资源时的实际值。 会议的 JoinWebURL 包含在 onlineMeeting 资源的 joinWebUrl 属性中,或包含在会议的 Teams 客户端中。

具有加密资源数据的通知

{
  "value": [{
    "subscriptionId": "{Subscription id}",
    "clientState": "{secret client state}",
    "changeType": "updated",
    "tenantId": "{Organization/Tenant id}",
    "resource": "communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
    "subscriptionExpirationDateTime": "2022-02-28T00:00:00.0000000Z",
    "resourceData": {
      "@odata.id": "communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
      "@odata.type": "#microsoft.graph.onlineMeeting",
      "id": "communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'"
    },
    "organizationId": "{Organization/Tenant id}",
    "encryptedContent": {
      "data": "{Encrypted content}",
      "dataSignature": "{Encrypted data signature}",
      "dataKey": "{Encrypted data key for encrypting content}",
      "encryptionCertificateId": "{User specified id of encryption certificate}",
      "encryptionCertificateThumbprint": "{Encrpytion certification thumbprint}"
    }
  }],
  "validationTokens": ["{Validation Tokens}"]
}

有关如何验证令牌和解密负载的详细信息,请参阅设置包含资源数据的更改通知

事件通知类型

以下是受支持的会议事件:

  • CallStarted - 在会议呼叫开始时发生。
  • CallEnded - 在会议呼叫结束时发生。
  • CallRosterUpdate - 当参与者加入或退出会议呼叫时发生。

解密的有效负载示例

CallStarted

{
  "@odata.type":"#Microsoft.Graph.onlineMeeting",
  "@odata.id":"communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
  "id":"communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
  "eventType":"{Microsoft.Communication.CallStarted}",
  "eventDateTime":"2022-02-28T00:00:00.0000000Z",
  "state":"active"
}

CallEnded

{
  "@odata.type":"#Microsoft.Graph.onlineMeeting",
  "@odata.id":"communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
  "id":"communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
  "eventType":"{Microsoft.Communication.CallEnded}",
  "eventDateTime":"2022-02-28T00:00:00.0000000Z",
  "state":"inactive"
}

CallRosterUpdate

{
  "@odata.type":"#Microsoft.Graph.onlineMeeting",
  "@odata.id":"communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
  "id":"communications/onlineMeetings?$filter=joinWebUrl+eq+'{joinWebUrl}'",
  "eventType":"Microsoft.Communication.CallRosterUpdate",
  "eventDateTime":"2022-02-28T00:00:00.0000000Z",
  "activeParticipants@joined": [
    {
      "Id": "a4d67b60-56a5-4202-9f1c-f123ff40621e",
      "Identity": 
      {
        "User": 
        {
          "Id": "f92ca67f-0564-414b-8caa-8c95b8099928",
          "DisplayName": "user display name",
          "TenantId": "85045508-f5bd-405e-a553-52700f86e29c"
        }
      }
    }
  ],
  "activeParticipants@exited": [
    {
      "Id": "11141402-1b62-4795-b540-4ffee8544231",
      "Identity": 
      {
        "AzureCommunicationServicesUser": 
        {
          "AzureCommunicationServicesResourceId": "534c244d-49f8-47a1-9e8e-70d115a2ef4d",
          "Id": "8:acs:534c244d-49f8-47a1-9e8e-70d115a2ef4d_28f01a7b-42cd-4e37-ae1a-bd653377f4b7",
          "DisplayName": "acs user display name"
        }
      }
    }
  ]
}

CallRosterUpdate 事件包括两个属性, activeParticipants@joined 描述添加到会议呼叫的参与者和离开会议呼叫的参与者 activeParticipants@exited

活动参与者的表示方式如下:

{
  "Id": "string",
  "Identity": "microsoft.graph.communicationsIdentitySet"
}
  • Id 属性对应于参与者 ID,该 ID 是分配给会议通话中每个参与者的唯一标识符。
  • Identity 属性对应于 communicationsIdentitySet。 有关详细信息,请参阅 communicationsIdentitySet 资源类型