Exemple #1
0
        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;
        }
Exemple #2
0
        public async Task <bool> Init(string token)
        {
            var credentials = new CommunicationTokenCredential(token);

            _callClient = new CallClient();
            var callOptions = new CallAgentOptions();

            _callAgent     = Com.Laerdal.Azurecommunicationhelper.CallClientHelper.GetCallAgent(_callClient, Application.Context, credentials);
            _deviceManager = Com.Laerdal.Azurecommunicationhelper.CallClientHelper.GetDeviceManager(_callClient, Application.Context);
            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);
        }