无法使用 Microsoft Graph 和 Teams 创建 VoIP 呼叫

Cannot create a VoIP call using Microsoft Graph and Teams

我正在尝试替换当前使用 "Skype For Business/Lync" 的 .NET 应用程序中的现有点击拨号功能,并将其切换为 "Microsoft Teams"。网上好像没有很多这样的例子。我发现的示例似乎对我不起作用。在多个来源中显示的示例如下:

IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
                                                                                .Create(clientId)
                                                                                .WithTenantId(tenantID)
                                                                                .WithClientSecret(clientSecret)
                                                                                .Build();

            ClientCredentialProvider authProvider = new ClientCredentialProvider(confidentialClientApplication);

            GraphServiceClient graphClient = new GraphServiceClient(authProvider);

            var call = new Call
            {
                CallbackUri = redirectUri,
                Targets = new List<InvitationParticipantInfo>()
            {
                new InvitationParticipantInfo
                {
                    Identity = new IdentitySet
                    {
                        User = new Identity
                        {
                            DisplayName = "John",
                            Id = userId
                        }
                    }
                }
            },
                RequestedModalities = new List<Modality>()
            {
                Modality.Audio
            },
                MediaConfig = new ServiceHostedMediaConfig
                {
                }
            };

            var response = graphClient.Communications.Calls
                .Request()
                .AddAsync(call).GetAwaiter().GetResult();

这段代码最终returns一个错误

Message: {"errorCode":"7503","message":"Application is not registered in our store.","instanceAnnotations":[]}

关于此错误的文档不多。我已经在 Azure Active Directory 中注册了一个机器人,并将所有必要的值插入到上面代码片段中的变量中。

我还尝试使用此 link 中的示例在 Postman 中 运行 此代码,其中还包含 C# 示例。邮递员 returns 完全相同的错误。

我还可以确认我拥有经管理员同意授予的 Calls.Initialte API 权限。

有没有人通过 Microsoft Graph/Teams 在 C# 中成功拨出电话?

Create call enables your Bot to create peer to peer or group call, You need to register your calling Bot 并分配以下应用程序权限:

Calls.JoinGroupCallsasGuest.All, Calls.JoinGroupCalls.All, 
Calls.Initiate.All, Calls.InitiateGroupCalls.All 

1.使用服务托管媒体创建点对点 VoIP 呼叫

Note: This call needs the Calls.Initiate.All Application permission.

在注册您的机器人时,您需要为您的机器人启用 calling feature 并让您的机器人参与音频和视频通话 您需要将 supportsCallingsupportsVideo 设置为 true 在您的应用程序清单中。