private async Task JoinCallAndSetChatThreadId() { try { token_credential = new Azure.WinRT.Communication.CommunicationTokenCredential(user_token_); CallAgentOptions call_agent_options = new CallAgentOptions(); call_agent = await call_client.CreateCallAgent(token_credential, call_agent_options); } catch { _ = await new MessageDialog("It was not possible to create call agent. Please check if token is valid.").ShowAsync(); return; } // Join a Teams meeting try { JoinCallOptions joinCallOptions = new(); TeamsMeetingLinkLocator teamsMeetingLinkLocator = new(TxtTeamsLinkTextBox.Text); call_ = await call_agent.JoinAsync(teamsMeetingLinkLocator, joinCallOptions); } catch { _ = await new MessageDialog("It was not possible to join the Teams meeting. Please check if Teams Link is valid.").ShowAsync(); return; } // set thread Id thread_Id_ = ExtractThreadIdFromTeamsLink(); // Set up call callbacks call_.OnStateChanged += Call_OnStateChangedAsync; }
public async Task <bool> Init(string token) { var credentials = new CommunicationTokenCredential(token); _callClient = new CallClient(); _callAgent = (CallAgent)await _callClient.CreateCallAgent(Application.Context, credentials).GetAsync(); _deviceManager = (DeviceManager)await _callClient.DeviceManager.GetAsync(); return(true); }
private async void CallButton_ClickAsync(object sender, RoutedEventArgs e) { CommunicationTokenCredential token_credential = new CommunicationTokenCredential("<USER_ACCESS_TOKEN>"); call_client_ = new CallClient(); CallAgentOptions callAgentOptions = new CallAgentOptions() { DisplayName = "<YOUR_DISPLAY_NAME>" }; call_agent_ = await call_client_.CreateCallAgent(token_credential, callAgentOptions); StartCallOptions startCallOptions = new StartCallOptions(); ICommunicationIdentifier[] callees = new ICommunicationIdentifier[1] { new CommunicationUserIdentifier(CalleeTextBox.Text) }; call_ = await call_agent_.StartCallAsync(callees, startCallOptions); }