How to accept an incomming call in a C# custom client for Azure Comm Services and Teams Interoperability?

Carlos Corona 71 Reputation points
2022-09-07T22:48:21.663+00:00

Hello everybody, I'm making a custom Teams client in C#, I have took: https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/get-started-with-video-calling?pivots=platform-windows as base for my project, making some changes to integrate MSAL and getting a Communication Identity access token to call somebody in my organization.

At this moment I can perform a call and see the remote and local video, but I cannot answer a call, I someone tries to call me, nothing happens.

I've added the method and set up it as call back:

private async void Agent_OnIncomingCall(object sender, IncomingCall incomingcall)  
{  
    Debug.Assert(deviceManager.Microphones.Count > 0);  
    Debug.Assert(deviceManager.Speakers.Count > 0);  
    Debug.Assert(deviceManager.Cameras.Count > 0);  
  
    if (deviceManager.Cameras.Count > 0)  
    {  
        VideoDeviceInfo videoDeviceInfo = deviceManager.Cameras[0];  
        localVideoStream = new LocalVideoStream[1];  
        localVideoStream[0] = new LocalVideoStream(videoDeviceInfo);  
  
        Uri localUri = await localVideoStream[0].MediaUriAsync();  
  
        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>  
        {  
            LocalVideo.Source = localUri;  
            LocalVideo.Play();  
        });  
  
    }  
    AcceptCallOptions acceptCallOptions = new AcceptCallOptions();  
    acceptCallOptions.VideoOptions = new VideoOptions(localVideoStream);  
  
    call = await incomingcall.AcceptAsync(acceptCallOptions);  
}  

But looking deeper into the code from the example I cannot see any UI to handle the incomming calls, so how can I add support for this?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,015 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,725 questions
0 comments No comments
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.