无法使用Microsoft Graph和团队创建VoIP通话

时间:2020-03-06 15:30:29

标签: microsoft-graph-api microsoft-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();

此代码最终返回错误

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

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

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

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

enter image description here 有人通过Microsoft Graph / Team在C#中成功拨打了电话吗?

1 个答案:

答案 0 :(得分:0)

Create call使您的Bot可以创建对等呼叫或组呼叫,您需要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.

注册Bot时,您需要为Bot启用calling feature,并使您的Bot参与音频和视频通话。您需要将supportsCallingsupportsVideo设置为{{1 }}在您的应用清单中。