为 Microsoft 团队注册呼叫机器人Registering a calling bot for Microsoft Teams

参与音频/视频呼叫和联机会议的 bot 是一个普通的 Microsoft 团队 bot,其中包含几个额外的功能:A bot that participates in audio/video calls and online meetings is an ordinary Microsoft Teams bot with a few extra features:

  • 有一个新版本的团队应用程序清单,其中有两个附加设置, supportsCallingsupportsVideoThere's a new version of the Teams app manifest with two additional settings, supportsCalling and supportsVideo. 这些设置包括在 Microsoft 团队应用程序清单的开发人员预览版本中。These settings are included in the Developer Preview version of the Microsoft Teams app manifest.
  • 必须为你的 bot 的 Microsoft 应用 ID 配置Microsoft Graph 权限Microsoft Graph permissions must be configured for your bot's Microsoft App ID.
  • Microsoft Graph 呼叫和联机会议 Api 权限需要租户管理员同意。The Microsoft Graph calls and online meetings APIs permissions require tenant admin consent.

让我们更详细地讨论上面的内容。Let's discuss the above in more detail.

新清单设置New manifest settings

呼叫和联机会议 bot 的 manifest.js中有两个其他设置,可在团队中为你的 bot 启用音频/视频。Calling and online meetings bots have two additional settings in the manifest.json that enable audio/video for your bot in Teams.

  • bots[0].supportsCalling.bots[0].supportsCalling. 如果存在并设置为 true ,则团队将允许你的 bot 参与呼叫和联机会议。If present and set to true, Teams will allow your bot to participate in calls and online meetings.
  • bots[0].supportsVideo.bots[0].supportsVideo. 如果存在并设置为 true ,则团队会意识到你的 bot 支持视频。If present and set to true, Teams knows that your bot supports video.

如果您希望 IDE 正确验证这些值的通话和会议机器人架构上的 manifest.js,可以更改 $schema 属性,如下所示:If you want your IDE to properly validate the manifest.json schema for your calling and meeting bot for these values, you can change the $schema attribute as follows:

"$schema": "https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/preview/DevPreview/MicrosoftTeams.schema.json",

创建新的 bot 或向现有 bot 添加呼叫功能Creating a new bot or adding calling capabilities to an existing bot

在 "创建 Microsoft 团队的 bot " 主题中将更详细地介绍了如何创建新的 bot,但我们将在此处重复执行以下操作:Creating a new bot is covered in more detail in the Create a bot for Microsoft Teams topic, but we'll repeat some of it here:

  1. 使用此链接可创建新的 bot: https://dev.botframework.com/bots/newUse this link to create a new bot: https://dev.botframework.com/bots/new. 如果改为在 Bot 框架门户中选择 "创建机器人" 按钮,则会在 Microsoft Azure 中创建你需要 Azure 帐户的你的 bot。If, instead, you select the Create a bot button in the Bot Framework portal, you will create your bot in Microsoft Azure, for which you'll need an Azure account.
  2. 添加 Microsoft 团队频道。Add the Microsoft Teams channel. 单击 "Microsoft 团队频道" 页面上的 "通话" 选项卡,然后选择 "启用呼叫",然后使用你将接收传入通知的 HTTPS URL 更新**Webhook () ** (例如, https://contoso.com/teamsapp/api/calling )。Click on the "Calling" tab on the Microsoft Teams channel page and select Enable calling, and then update Webhook (for calling) with your HTTPS URL where you will receive incoming notifications, e.g.https://contoso.com/teamsapp/api/calling. 有关如何配置频道的详细信息,请参阅配置频道Refer to Configuring Channels for more information on how to configure channels. 配置 Microsoft 团队频道信息Configure Microsoft Teams channel information

添加 Microsoft Graph 权限Add Microsoft Graph permissions

Microsoft Graph 公开了控制应用程序对资源的访问权限的精细权限。Microsoft Graph exposes granular permissions controlling the access that apps have to resources. 作为开发人员,你可以决定应用请求哪些 Microsoft Graph 权限。As a developer, you decide which permissions for Microsoft Graph your app requests. Microsoft Graph 调用 Api 支持_应用程序权限_,这些权限由在没有登录用户的情况下运行的应用程序使用。The Microsoft Graph Calling APIs support Application permissions, which are used by apps that run without a signed-in user present. 租户管理员必须授予应用程序权限许可。A tenant administrator must grant consent to application permissions. 以下是这些权限的列表:Below is a list of those permissions:

应用程序权限:调用Application permissions: calls

权限Permission 显示字符串Display String 说明Description 需经过管理员同意Admin Consent Required
Calls.Initiate.AllCalls.Initiate.All 从应用发起一对一拨出通话(预览版)Initiate outgoing 1:1 calls from the app (preview) 允许应用在没有登录用户的情况下,向单个用户发起播出通话并将通话转接到组织目录中的用户。Allows the app to place outbound calls to a single user and transfer calls to users in your organization’s directory, without a signed-in user. Yes
Calls.InitiateGroupCall.AllCalls.InitiateGroupCall.All 从应用发起组拨出通话(预览版)Initiate outgoing group calls from the app (preview) 允许应用在没有登录用户的情况下,向多个用户发起播出通话并向组织中的会议添加参与者。Allows the app to place outbound calls to multiple users and add participants to meetings in your organization, without a signed-in user. Yes
Calls.JoinGroupCall.AllCalls.JoinGroupCall.All 作为应用加入组通话和会议(预览版)Join Group Calls and Meetings as an app (preview) 允许应用在没有登录用户的情况下,加入组织中的组通话和计划会议。Allows the app to join group calls and scheduled meetings in your organization, without a signed-in user. 应用将加入到租户的会议中并获得目录用户特权。The app will be joined with the privileges of a directory user to meetings in your tenant. Yes
Calls.JoinGroupCallasGuest.AllCalls.JoinGroupCallasGuest.All 作为来宾加入组通话和会议(预览版)Join Group Calls and Meetings as a guest (preview) 允许应用在没有登录用户的情况下,以匿名方式加入组织中的组通话和计划会议。Allows the app to anonymously join group calls and scheduled meetings in your organization, without a signed-in user. 应用将作为来宾加入租户的会议。The app will be joined as a guest to meetings in your tenant. Yes
AccessMedia。 _请参阅下面_的Calls.AccessMedia.All see below 作为应用访问通话中的媒体数据流(预览版)Access media streams in a call as an app (preview) 允许应用在没有登录用户的情况下,直接访问通话中的媒体数据流。Allows the app to get direct access to media streams in a call, without a signed-in user. Yes

重要

不能使用 Microsoft. Media API 来记录或以其他方式保留你的 bot 访问的呼叫或会议中的媒体内容。You cannot use the Microsoft.Graph.Calls.Media API to record or otherwise persist media content from calls or meetings that your bot accesses.

应用程序权限:联机会议Application permissions: online meetings

权限Permission 显示字符串Display String 说明Description 需经过管理员同意Admin Consent Required
OnlineMeetings.Read.AllOnlineMeetings.Read.All 从应用阅读联机会议详细信息(预览版)Read Online Meeting details from the app (preview) 允许应用在没有登录用户的情况下读取组织中的联机会议详细信息。Allows the app to read Online Meeting details in your organization, without a signed-in user. Yes
OnlineMeetings.ReadWrite.AllOnlineMeetings.ReadWrite.All 代表用户从应用读取和创建联机会议(预览版)Read and Create Online Meetings from the app (preview) on behalf of a user 允许应用在没有登录用户的情况下代表用户创建组织中的联机会议。Allows the app to create Online Meetings in your organization on behalf of a user, without a signed-in user. Yes

分配权限Assigning permissions

你必须提前为你的 bot 配置应用程序权限。You must configure the application permissions for your bot in advance. 我们建议使用Microsoft 应用注册门户 ,如下所述,因为它是配置机器人的地方;但是,如果您更喜欢使用AZURE AD V1 终结点,仍可以使用azure 门户We recommend using the Microsoft App Registration Portal as described here because that's where your bot was configured; however, you can still use the Azure portal if you prefer to use the Azure AD V1 endpoint.

对于使用 Azure AD V1 终结点的应用程序,租户管理员可以在其组织中安装应用程序时同意使用Azure 门户的应用程序权限,也可以在您的应用程序中提供注册权限,管理员可通过该体验来同意您配置的权限。For apps using the Azure AD V1 endpoint, a tenant administrator can consent to the application permissions using the Azure portal when your app is installed in their organization, or you can provide a sign-up experience in your app through which administrators can consent to the permissions you configured. 在 Azure AD 中记录管理员同意后,您的应用程序可以请求令牌,而无需再次请求许可。Once administrator consent is recorded by Azure AD, your app can request tokens without having to request consent again.

你可以依靠管理员授予你的应用程序在Azure 门户上所需的权限;不过,通常情况下,更好的选择是使用 Azure AD V2 终结点为管理员提供注册体验 /adminconsentYou can rely on an administrator to grant the permissions your app needs at the Azure portal; though, often a better option is to provide a sign-up experience for administrators by using the Azure AD V2 /adminconsent endpoint. 有关详细信息,请参阅构建管理员同意 URL 的说明Please refer to the instructions on constructing an Admin Consent URL for more information.

备注

构造租户管理员同意 URL 需要在应用注册门户中配置的重定向 URI/回复 url。Constructing the Tenant Admin Consent URL requires a configured Redirect URI/Reply URL in the App Registration Portal. 若要为你的 bot 添加回复 Url,请访问你的 bot 注册,选择 "高级选项-> 编辑应用程序清单"。To add reply URLs for your bot, access your bot registration, choose Advanced Options -> Edit Application Manifest. 将重定向 URL 添加到 replyUrls 集合中。Add your Redirect URL to the replyUrls collection.

重要

无论何时对应用程序的权限进行更改,还必须重复管理员同意过程。Anytime you make a change to your application's permissions, you must also repeat the Admin Consent process. 租户管理员重新应用同意之后,才会反映应用注册门户中所做的更改。Changes made in the app registration portal will not be reflected until consent has been reapplied by the tenant's administrator.