获取 Microsoft Teams 会议呼叫事件更新的更改通知

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

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

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

权限

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

订阅联机会议呼叫事件

若要获取会议的呼叫事件的更改通知,请订阅 /communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents,其中 是 joinWebUrl 会议加入 URL 的 URL 编码值。

例如, joinWebUrl 必须为联机会议获取以下 URL 中的 。

https://teams.microsoft.com/l/meetup-join/19%3ameeting_ZmYwZTEyYjctZjA5MS00OTkzLWJhNzEtYzFiZDVjNGE0OGFj%40thread.v2/0?context=%7b%22Tid%22%3a%22909c6581-5130-43e9-88f3-fcb3582cde37%22%2c%22Oid%22%3a%22048c94fb-dda6-48b8-9fc8-6740ee418fb9%22%7d

若要寄存订阅,参数必须经过 URL 编码,并在资源属性中用作 joinWebUrl ,如以下示例所示。

https%3A%2F%2Fteams.microsoft.com%2Fl%2Fmeetup-join%2F19%253ameeting_ZmYwZTEyYjctZjA5MS00OTkzLWJhNzEtYzFiZDVjNGE0OGFj%2540thread.v2%2F0%3Fcontext%3D%257b%2522Tid%2522%253a%2522909c6581-5130-43e9-88f3-fcb3582cde37%2522%252c%2522Oid%2522%253a%2522048c94fb-dda6-48b8-9fc8-6740ee418fb9%2522%257d

注意

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

订阅有效负载示例

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

{
  "changeType": "updated",
  "notificationUrl": "https://webhook.azurewebsites.net/api/resourceNotifications",
  "resource": "communications/onlineMeetings(joinWebUrl='https%3A%2F%2Fteams.microsoft.com%2Fl%2Fmeetup-join%2F19%253ameeting_ZmYwZTEyYjctZjA5MS00OTkzLWJhNzEtYzFiZDVjNGE0OGFj%2540thread.v2%2F0%3Fcontext%3D%257b%2522Tid%2522%253a%2522909c6581-5130-43e9-88f3-fcb3582cde37%2522%252c%2522Oid%2522%253a%2522048c94fb-dda6-48b8-9fc8-6740ee418fb9%2522%257d')/meetingCallEvents",
  "includeResourceData": true,
  "encryptionCertificate": "{base64encodedCertificate}",
  "encryptionCertificateId": "{customId}",
  "expirationDateTime": "2021-02-01T11:00:00.0000000Z",
  "clientState": "{secretClientState}"
}

具有加密资源数据的通知

{
  "value": [{
    "subscriptionId": "{Subscription id}",
    "clientState": "{secret client state}",
    "changeType": "updated",
    "tenantId": "{Organization/Tenant id}",
    "resource": "communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents",
    "subscriptionExpirationDateTime": "2022-02-28T00:00:00.0000000Z",
    "resourceData": {
      "@odata.id": "communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents",
      "@odata.type": "#microsoft.graph.callevent",
      "id": "{notificationId}'"
    },
    "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 - 会议呼叫结束时的事件。
  • rosterUpdated - 参与者加入并退出呼叫或大厅时的事件。
    • 花名册更新事件包含participants@delta中的会议呼叫参与者更改的集合。 此集合描述了会议呼叫名单中的用户参与者更改。 具有 removedState 属性的参与者表示已退出集合的参与者。 有关 参与者 信息的更多详细信息,请参阅参与者。

解密的有效负载示例

CallStarted

{
  "@odata.type":"#microsoft.graph.callevent",
  "@odata.id":"communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents",
  "id":"{notificationId}'",
  "eventType":"callStarted",
  "eventDateTime":"2022-02-28T00:00:00.0000000Z",
}

CallEnded

{
  "@odata.type":"#microsoft.graph.callevent",
  "@odata.id":"communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents",
  "id":"{notificationId}",
  "eventType":"callEnded",
  "eventDateTime":"2022-02-28T00:00:00.0000000Z",
}

RosterUpdated - 参与者加入呼叫或大厅模式

{
  "@odata.type": "#microsoft.graph.callevent",
  "@odata.id": "communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents",
  "id": "{notificationId}",
  "eventType": "rosterUpdated",
  "eventDateTime": "2022-02-28T00:00:00.0000000Z",
  "participants@delta": [
    {
      "info": {
        "identity": {
          "user": {
            "id": "f3ce5e01-0724-43c7-ae4d-80ca18703a96",
            "displayName": "A user roster update in the call",
            "tenantId": "f69f5191-20ae-4093-8dae-3ec09edeb253"
          }
        }
      },
      "isInLobby": false,
      "id": "e1018298-976a-4956-93e8-f58e43b0016c"
    },
    {
      "info": {
        "identity": {
          "user": {
            "id": "e8bbbe0e-6e3d-42db-9082-213abbe8ee5c",
            "displayName": "User roster update in the lobby of the call",
            "tenantId": "f69f5191-20ae-4093-8dae-3ec09edeb253"
          }
        }
      },
      "isInLobby": true,
      "id": "a7cc3ddb-a469-410d-8057-44dba3b0c073"
    }
  ]
}

RosterUpdated - 参与者进入非活动状态 (不在大厅或呼叫)

{
  "@odata.type": "#microsoft.graph.callevent",
  "@odata.id": "communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents",
  "id": "{notificationId}",
  "eventType": "rosterUpdated",
  "eventDateTime": "2022-02-28T00:00:00.0000000Z",
  "participants@delta": [
    {
      "info": {
        "identity": {
          "user": {
            "id": "f3ce5e01-0724-43c7-ae4d-80ca18703a96",
            "displayName": "A user change within the meeting call",
            "tenantId": "f69f5191-20ae-4093-8dae-3ec09edeb253"
          }
        }
      },
      "isInLobby": false,
      "removedState": {
        "reason": "Participant has entered an inactive state in the roster."
      },
      "id": "e1018298-976a-4956-93e8-f58e43b0016c"
    }
  ]
}

RosterUpdated - 参与者退出呼叫

{
  "@odata.type": "#microsoft.graph.callevent",
  "@odata.id": "communications/onlineMeetings(joinWebUrl='{joinWebUrl}')/meetingCallEvents",
  "id": "{notificationId}",
  "eventType": "rosterUpdated",
  "eventDateTime": "2022-02-28T00:00:00.0000000Z",
  "participants@delta": [
    {
      "info": {
        "identity": {
          "user": {
            "id": "e98eb11c-8385-445e-8b19-4a2f169ac5bc",
            "displayName": "User that is leaving the call",
            "tenantId": "f69f5191-20ae-4093-8dae-3ec09edeb253"
          }
        }
      },
      "isInLobby": false,
      "removedState": {
        "reason": "Participant has left the meeting call."
      },
      "id": "347040dd-aa51-4ada-8a44-510c65a3a2d3"
    }
  ]
}