应用程序托管媒体 bot 的要求和注意事项Requirements and considerations for application-hosted media bots

并非所有开发邮件和交互语音响应(IVR) bot 的指南都同样适用于生成应用程序托管的媒体 bot。Not all guidance for developing messaging and Interactive Voice Response (IVR) bots applies equally to building application-hosted media bots. 本文介绍了开发和运行应用程序托管媒体 bot 的一些重要要求和注意事项。This article describes some of the important requirements and considerations for developing and running an application-hosted media bot.

备注

由于用于 Bot 的 Microsoft 实时媒体平台是在开发人员预览版中,因此本文中的指导可能会发生变化。Because the Microsoft Real-time Media Platform for Bots is in developer preview, the guidance in this article is subject to change.

应用程序托管的媒体 bot 开发需要 c #/.NET 和 Windows ServerApplication-hosted media bot development requires C#/.NET and Windows Server

  • 应用程序托管的媒体 bot 需要 Microsoft.Graph.Communications.Calls.Media .net 库(可在此处访问音频和视频媒体流,并且必须在 windows server 计算机(或 Azure 中的 WINDOWS server 来宾 OS)上部署 bot。An application-hosted media bot requires the Microsoft.Graph.Communications.Calls.Media .NET library (available here to access the audio and video media streams, and the bot must be deployed on a Windows Server machine (or Windows Server guest OS in Azure). 因此,必须在 c # 和 standard .NET Framework 中开发机器人并在 Microsoft Azure 中部署机器人。Therefore, the bot must be developed in C# and the standard .NET Framework and deployed in Microsoft Azure. 不能使用 c + + 或 Node.js Api 访问实时媒体和 .NET Core 不支持应用程序托管的媒体 bot。You can't use C++ or Node.js APIs to access real-time media and .NET Core is not supported for an application-hosted media bot.

  • 可以在以下 Azure 服务环境之一中托管应用程序托管的媒体 bot:An application-hosted media bot can be hosted within one of the following Azure service environments:

    • 云服务。Cloud Service.
    • 具有虚拟机规模集的 Service Fabric (VMSS)。Service Fabric with Virtual Machine Scale Sets (VMSS).
    • 基础结构即服务(IaaS)虚拟机(VM)。Infrastructure as a Service (IaaS) Virtual Machine (VM).
  • 无法将应用程序托管的媒体 bot 部署为 Azure Web 应用。An application-hosted media bot can't be deployed as an Azure Web App.

  • 应用程序托管的媒体 bot 必须在 .Net 库的最新版本上运行 Microsoft.Graph.Communications.Calls.MediaAn application-hosted media bot must be running on a recent version of the Microsoft.Graph.Communications.Calls.Media .NET library. Bot 应使用最新可用版本的NuGet 包,或使用的版本不超过三个月。The bot should use either the newest available version of the NuGet package, or a version that is not more than three months old. 库的较旧版本将被弃用,并且在几个月后可能无法工作。Older versions of the library will be deprecated and may not work after a few months. Microsoft.Graph.Communications.Calls.Media将库保持最新可确保机器人和 Microsoft 团队之间的最佳互操作性。Keeping the Microsoft.Graph.Communications.Calls.Media library up-to-date will ensure the best interoperability between the bot and Microsoft Teams.

实时媒体呼叫停留在创建它们的计算机上Real-time media calls stay on the machine where they were created

  • 实时媒体呼叫将固定到已接受或已启动呼叫的虚拟机(VM)实例。A real-time media call is pinned to the virtual machine (VM) instance that accepted or started the call. 来自 Microsoft 团队呼叫或会议的媒体将流向该 VM 实例,并且机器人发送回 Microsoft 团队的媒体也必须源自该 VM。Media from a Microsoft Teams call or meeting will flow to that VM instance, and media the bot sends back to Microsoft Teams must also originate from that VM.
  • 如果在停止 VM 时正在进行任何实时媒体呼叫,这些呼叫将突然终止。If there are any real-time media calls in progress when the VM is stopped, those calls will be abruptly terminated. 如果 bot 事先了解挂起的 VM 关闭,它可能会尝试 "正常" 结束呼叫。If the bot has prior knowledge of the pending VM shutdown, it can try to "gracefully" end the calls.

应用程序托管的媒体 bot 必须可以直接在 internet 上进行访问Application-hosted media bots must be directly accessible on the internet

  • 在 Azure 中托管应用程序托管媒体 bot 的每个 VM 实例都必须使用实例级公共 IP 地址(ILPIP)直接从 internet 进行访问。Each VM instance hosting an application-hosted media bot in Azure must be directly accessible from the internet using an instance-level public IP address (ILPIP).
  • 承载应用程序托管媒体 bot 的服务还必须使用映射到特定实例的面向公众的端口配置每个 VM 实例。The service hosting an application-hosted media bot must also configure each VM instance with a public-facing port which maps to the specific instance.
  • Bot 框架仿真器不支持应用程序托管的媒体 bot。Application-hosted media bots aren't supported by the Bot Framework Emulator.

可伸缩性和性能注意事项Scalability and performance considerations

  • 应用程序托管的媒体 bot 需要比邮件机器人更多的计算和网络(带宽)容量,并且可能会产生显著更高的运营成本。Application-hosted media bots require more compute and network (bandwidth) capacity than messaging bots and may incur significantly higher operational costs. 实时媒体机器人开发人员必须仔细衡量 bot 的可伸缩性,并确保 bot 不会接受比它更多的同时呼叫数。A real-time media bot developer must carefully measure the bot's scalability, and ensure the bot doesn't accept more simultaneous calls than it can manage. 启用视频的 bot 可能只能承受每个 CPU 核心的一个或两个并发媒体会话(如果使用 "raw" RGB24 或 NV12 视频格式)。A video-enabled bot may be able to sustain only one or two concurrent media sessions per CPU core (if using the "raw" RGB24 or NV12 video formats).
  • 实时媒体平台目前不会利用 VM 上提供的任何图形处理单元(GPU)来脱离加载 H-p 视频编码/解码。The Real-time Media Platform doesn't currently take advantage of any Graphics Processing Units (GPU) available on the VM to off-load H.264 video encoding/decoding. 相反,视频编码和解码是在 CPU 上的软件中完成的。Instead, video encode and decode are done in software on the CPU. 如果有 GPU 可用,则 bot 可以利用它进行自己的图形呈现(例如,如果 bot 使用的是3D 图形引擎)。If a GPU is available, the bot may take advantage of it for its own graphics rendering (e.g. if the bot is using a 3D graphics engine).
  • 托管实时媒体 bot 的 VM 实例必须至少具有2个 CPU 内核。The VM instance hosting the real-time media bot must have at least 2 CPU cores. 对于 Azure,建议使用 Dv2 系列虚拟机。For Azure, a Dv2-series virtual machine is recommended. 对于其他 Azure VM 类型,具有4个虚拟 Cpu (vCPU)的系统是所需的最小大小。For other Azure VM types, a system with 4 virtual CPUs (vCPU) is the minimum size required. Azure文档中提供了有关 azure VM 类型的详细信息。Detailed information about Azure VM types is available in the Azure documentation.

示例和其他资源Samples and Additional Resources