public async Task CreateAdhocMeetingShouldThrowIfAdhocMeetingResourceNotAvailable() { // Given m_restfulClient.OverrideResponse(new Uri(DataUrls.Application), HttpMethod.Get, HttpStatusCode.OK, "Application_NoAdhocMeetings.json"); await m_application.RefreshAsync(m_loggingContext).ConfigureAwait(false); var input = new AdhocMeetingCreationInput("subject"); // When await m_application.CreateAdhocMeetingAsync(input, m_loggingContext).ConfigureAwait(false); // Then // Exception is thrown }
static void Main(string[] args) { Dictionary <string, string> skypeAuthSettings = new Dictionary <string, string>() { { "AAD_ClientId", "" }, { "AAD_ClientSecret", "" }, { "ApplicationEndpointId", "" }, { "DiscoverUri", "https://api.skypeforbusiness.com/platformservice/discover?Region=northamerica" } }; var logger = new StringLogger(); try { ClientPlatformSettings platformSettings = new ClientPlatformSettings(new Uri(skypeAuthSettings["DiscoverUri"]), new Guid(skypeAuthSettings["AAD_ClientId"]), null, skypeAuthSettings["AAD_ClientSecret"], false); var platform = new ClientPlatform(platformSettings, logger); //Prepare endpoint var endpointSettings = new ApplicationEndpointSettings(new SipUri(skypeAuthSettings["ApplicationEndpointId"])); ApplicationEndpoint applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, null); var loggingContext = new LoggingContext(Guid.NewGuid()); applicationEndpoint.InitializeAsync().GetAwaiter().GetResult(); applicationEndpoint.InitializeApplicationAsync().GetAwaiter().GetResult(); //Schedule meeting var input = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + "testMeeting"); var adhocMeeting = applicationEndpoint.Application.CreateAdhocMeetingAsync(input, loggingContext).Result; Console.WriteLine("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri); Console.WriteLine("ad hoc meeting join url : " + adhocMeeting.JoinUrl); //Get anon join token IAnonymousApplicationToken anonToken = applicationEndpoint.Application.GetAnonApplicationTokenForMeetingAsync(adhocMeeting.JoinUrl, "https://contoso.com;https://litware.com;http://www.microsoftstore.com/store/msusa/en_US/home<https://urldefense.proofpoint.com/v2/url?u=https-3A__contoso.com-3Bhttps-3A_litware.com-3Bhttp-3A_www.microsoftstore.com_store_msusa_en-5FUS_home&d=DwMGaQ&c=Bi8ZWNNcZUBhi-AHLorvrkVH0ArnzxTAZ7C8kNcJoZo&r=uycUjr279qo0kuj5jNiyFqi9adZMUkMtmsdo99NlvRQ&m=7jet88f1Tbswi73IIaQYzhITPDlxR_mzF2flXNxdbwQ&s=ozm8LVnKFoAyQtSX8KWnm56u950cmjrR5fvfEpP1SfM&e=>", Guid.NewGuid().ToString(), loggingContext).Result; Console.WriteLine("Get anon token : " + anonToken.AuthToken); Console.WriteLine("Get discover url for web SDK : " + anonToken.AnonymousApplicationsDiscoverUri); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.Read(); }
public async Task Run() { var logger = new SampleAppLogger(); logger.HttpRequestResponseNeedsToBeLogged = true; //Set to true if you want to log all http request and responses //Prepare platform ClientPlatformSettings platformSettings = new ClientPlatformSettings(QuickSamplesConfig.AAD_ClientSecret, Guid.Parse(QuickSamplesConfig.AAD_ClientId)); var platform = new ClientPlatform(platformSettings, logger); //Prepare endpoint var eventChannel = new FakeEventChannel(); var endpointSettings = new ApplicationEndpointSettings(new SipUri(QuickSamplesConfig.ApplicationEndpointId)); ApplicationEndpoint applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, eventChannel); var loggingContext = new LoggingContext(Guid.NewGuid()); await applicationEndpoint.InitializeAsync(loggingContext).ConfigureAwait(false); await applicationEndpoint.InitializeApplicationAsync(loggingContext).ConfigureAwait(false); //Schedule meeting var input = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + "testMeeting"); var adhocMeeting = await applicationEndpoint.Application.CreateAdhocMeetingAsync(loggingContext, input).ConfigureAwait(false); logger.Information("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri); logger.Information("ad hoc meeting join url : " + adhocMeeting.JoinUrl); //Get anon join token IAnonymousApplicationToken anonToken = await applicationEndpoint.Application.GetAnonApplicationTokenForMeetingAsync( loggingContext, adhocMeeting.JoinUrl, "https://contoso.com;https://litware.com;http://www.microsoftstore.com/store/msusa/en_US/home", //Fill your own web site, For allow cross domain using Guid.NewGuid().ToString() //Should be unique everytime ).ConfigureAwait(false); logger.Information("Get anon token : " + anonToken.AuthToken); logger.Information("Get discover url for web SDK : " + anonToken.AnonymousApplicationsDiscoverUri.ToString()); Console.ForegroundColor = ConsoleColor.Green; logger.Information("RemoteAdvisor sample completed successfully!"); Console.ResetColor(); }
public async Task <MeetingInfo> CreateSkypeAdhocMeetingAsync(MeetingInput input) { if (!_isInitialized) { await InitializeEndpointAsync(); } //setup meeting request AdhocMeetingCreationInput inputInfo = new AdhocMeetingCreationInput(input.Subject, AccessLevel.Everyone); var newMeeting = await _applicationEndpoint.Application.CreateAdhocMeetingAsync(_loggingContext, inputInfo); MeetingInfo meetingInfo = new MeetingInfo(); //convert to common class meetingInfo.Subject = newMeeting.Subject; meetingInfo.OnlineMeetingUri = newMeeting.OnlineMeetingUri; meetingInfo.JoinUrl = newMeeting.JoinUrl; return(meetingInfo); }
public async Task RunAsync() { var skypeId = ConfigurationManager.AppSettings["Trouter_SkypeId"]; var password = ConfigurationManager.AppSettings["Trouter_Password"]; var applicationName = ConfigurationManager.AppSettings["Trouter_ApplicationName"]; var userAgent = ConfigurationManager.AppSettings["Trouter_UserAgent"]; var token = SkypeTokenClient.ConstructSkypeToken( skypeId: skypeId, password: password, useTestEnvironment: false, scope: string.Empty, applicationName: applicationName).Result; m_logger = new SampleAppLogger(); // Uncomment for debugging // m_logger.HttpRequestResponseNeedsToBeLogged = true; EventChannel = new TrouterBasedEventChannel(m_logger, token, userAgent); // Prepare platform var platformSettings = new ClientPlatformSettings(QuickSamplesConfig.AAD_ClientSecret, new Guid(QuickSamplesConfig.AAD_ClientId)); var platform = new ClientPlatform(platformSettings, m_logger); // Prepare endpoint var endpointSettings = new ApplicationEndpointSettings(new SipUri(QuickSamplesConfig.ApplicationEndpointId)); var applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, EventChannel); var loggingContext = new LoggingContext(Guid.NewGuid()); await applicationEndpoint.InitializeAsync(loggingContext).ConfigureAwait(false); await applicationEndpoint.InitializeApplicationAsync(loggingContext).ConfigureAwait(false); // Meeting configuration var meetingConfiguration = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + " test meeting"); // Schedule meeting var adhocMeeting = await applicationEndpoint.Application.CreateAdhocMeetingAsync(loggingContext, meetingConfiguration).ConfigureAwait(false); WriteToConsoleInColor("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri); WriteToConsoleInColor("ad hoc meeting join url : " + adhocMeeting.JoinUrl); // Get all the events related to join meeting through Trouter's uri platformSettings.SetCustomizedCallbackurl(new Uri(EventChannel.CallbackUri)); // Start joining the meeting var invitation = await adhocMeeting.JoinAdhocMeeting(loggingContext, null).ConfigureAwait(false); // Wait for the join to complete await invitation.WaitForInviteCompleteAsync().ConfigureAwait(false); WriteToConsoleInColor("Please use this url to join the meeting : " + adhocMeeting.JoinUrl); WriteToConsoleInColor("Giving 30 seconds for the user to join the meeting..."); await Task.Delay(TimeSpan.FromSeconds(30)).ConfigureAwait(false); var conversation = invitation.RelatedConversation; var imCall = invitation.RelatedConversation.MessagingCall; if (imCall == null) { WriteToConsoleInColor("No messaging call link found in conversation of the conference."); return; } var messagingInvitation = await imCall.EstablishAsync(loggingContext).ConfigureAwait(false); messagingInvitation.HandleResourceCompleted += OnMessagingResourceCompletedReceived; await messagingInvitation.WaitForInviteCompleteAsync().ConfigureAwait(false); if (imCall.State != CallState.Connected) { WriteToConsoleInColor("Messaging call is not connected."); return; } var modalities = invitation.RelatedConversation.ActiveModalities; WriteToConsoleInColor("Active modalities : "); bool hasMessagingModality = false; foreach (var modality in modalities) { WriteToConsoleInColor(" " + modality.ToString()); if (modality == ConversationModalityType.Messaging) { hasMessagingModality = true; } } await imCall.SendMessageAsync("Hello World.", loggingContext).ConfigureAwait(false); if (!hasMessagingModality) { WriteToConsoleInColor("Failed to connect messaging call.", ConsoleColor.Red); return; } WriteToConsoleInColor("Adding messaging to meeting completed successfully."); }
public async Task RunAsync(Uri callbackUri) { m_logger = new SampleAppLogger(); // Uncomment for debugging // m_logger.HttpRequestResponseNeedsToBeLogged = true; // You can hook up your own implementation of IEventChannel here IEventChannel eventChannel = WebEventChannel.WebEventChannel.Instance; // Prepare platform var platformSettings = new ClientPlatformSettings(QuickSamplesConfig.AAD_ClientSecret, new Guid(QuickSamplesConfig.AAD_ClientId)); var platform = new ClientPlatform(platformSettings, m_logger); // Prepare endpoint var endpointSettings = new ApplicationEndpointSettings(new SipUri(QuickSamplesConfig.ApplicationEndpointId)); var applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, eventChannel); var loggingContext = new LoggingContext(Guid.NewGuid()); await applicationEndpoint.InitializeAsync(loggingContext).ConfigureAwait(false); await applicationEndpoint.InitializeApplicationAsync(loggingContext).ConfigureAwait(false); // Meeting configuration var meetingConfiguration = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + " test meeting"); // Schedule meeting var adhocMeeting = await applicationEndpoint.Application.CreateAdhocMeetingAsync(meetingConfiguration, loggingContext).ConfigureAwait(false); WriteToConsoleInColor("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri); WriteToConsoleInColor("ad hoc meeting join url : " + adhocMeeting.JoinUrl); // Get all the events related to join meeting through our custom callback uri platformSettings.SetCustomizedCallbackurl(callbackUri); // Start joining the meeting ICommunication communication = applicationEndpoint.Application.Communication; if (!communication.CanJoinAdhocMeeting(adhocMeeting)) { throw new Exception("Cannot join adhoc meeting"); } var invitation = await communication.JoinAdhocMeetingAsync(adhocMeeting, null, loggingContext).ConfigureAwait(false); // Wait for the join to complete await invitation.WaitForInviteCompleteAsync().ConfigureAwait(false); WriteToConsoleInColor("Please use this url to join the meeting : " + adhocMeeting.JoinUrl); WriteToConsoleInColor("Giving 30 seconds for the user to join the meeting..."); await Task.Delay(TimeSpan.FromSeconds(30)).ConfigureAwait(false); var conversation = invitation.RelatedConversation; var imCall = invitation.RelatedConversation.MessagingCall; if (imCall == null) { WriteToConsoleInColor("No messaging call link found in conversation of the conference."); return; } var messagingInvitation = await imCall.EstablishAsync(loggingContext).ConfigureAwait(false); messagingInvitation.HandleResourceCompleted += OnMessagingInvitationCompleted; await messagingInvitation.WaitForInviteCompleteAsync().ConfigureAwait(false); if (imCall.State != CallState.Connected) { WriteToConsoleInColor("Messaging call is not connected."); return; } var modalities = invitation.RelatedConversation.ActiveModalities; WriteToConsoleInColor("Active modalities : "); bool hasMessagingModality = false; foreach (var modality in modalities) { WriteToConsoleInColor(" " + modality.ToString()); if (modality == ConversationModalityType.Messaging) { hasMessagingModality = true; } } if (!hasMessagingModality) { WriteToConsoleInColor("Failed to connect messaging call.", ConsoleColor.Red); return; } WriteToConsoleInColor("Adding messaging to meeting completed successfully."); WriteToConsoleInColor("Sending Hellow World!"); await imCall.SendMessageAsync("Hello World!", loggingContext).ConfigureAwait(false); WriteToConsoleInColor("Sent Hello World!"); await WebEventChannel.WebEventChannel.Instance.TryStopAsync().ConfigureAwait(false); }
public async Task RunAsync(Uri callbackUri) { var participantUri = ConfigurationManager.AppSettings["ParticipantUri"]; m_logger = new SampleAppLogger(); // Uncomment for debugging // m_logger.HttpRequestResponseNeedsToBeLogged = true; // You can hook up your own implementation of IEventChannel here IEventChannel eventChannel = WebEventChannel.WebEventChannel.Instance; // Prepare platform var platformSettings = new ClientPlatformSettings(QuickSamplesConfig.AAD_ClientSecret, new Guid(QuickSamplesConfig.AAD_ClientId)); var platform = new ClientPlatform(platformSettings, m_logger); // Prepare endpoint var endpointSettings = new ApplicationEndpointSettings(new SipUri(QuickSamplesConfig.ApplicationEndpointId)); var applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, eventChannel); var loggingContext = new LoggingContext(Guid.NewGuid()); await applicationEndpoint.InitializeAsync(loggingContext).ConfigureAwait(false); await applicationEndpoint.InitializeApplicationAsync(loggingContext).ConfigureAwait(false); // Meeting configuration var meetingConfiguration = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + " test meeting"); // Schedule meeting var adhocMeeting = await applicationEndpoint.Application.CreateAdhocMeetingAsync(meetingConfiguration, loggingContext).ConfigureAwait(false); WriteToConsoleInColor("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri); WriteToConsoleInColor("ad hoc meeting join url : " + adhocMeeting.JoinUrl); // Get all the events related to join meeting through our custom callback uri platformSettings.SetCustomizedCallbackurl(callbackUri); // Start joining the meeting ICommunication communication = applicationEndpoint.Application.Communication; if (!communication.CanJoinAdhocMeeting(adhocMeeting)) { throw new Exception("Cannot join the adhoc meeting!"); } var invitation = await communication.JoinAdhocMeetingAsync(adhocMeeting, null, loggingContext).ConfigureAwait(false); // Wait for the join to complete await invitation.WaitForInviteCompleteAsync().ConfigureAwait(false); m_participantAddedTcs = new TaskCompletionSource <IParticipant>(); invitation.RelatedConversation.HandleParticipantChange += Conversation_HandleParticipantChange; // invite the participant to join the meeting WriteToConsoleInColor("Invite " + participantUri + " to join the meeting"); var participantInvitation = await invitation.RelatedConversation.AddParticipantAsync(new SipUri(participantUri), loggingContext).ConfigureAwait(false); // Wait for the join to complete await participantInvitation.WaitForInviteCompleteAsync().ConfigureAwait(false); // Get the corresponding IParticipant; other way of getting this is by traversing invitation.RelatedConversation.Participants IParticipant participant = await m_participantAddedTcs.Task.ConfigureAwait(false); WriteToConsoleInColor("Waiting 10 seconds before ejecting " + participant.Name); await Task.Delay(TimeSpan.FromSeconds(10)).ConfigureAwait(false); WriteToConsoleInColor("Ejecting " + participant.Name + " from the meeting"); await participant.EjectAsync(loggingContext).ConfigureAwait(false); WriteToConsoleInColor("Showing roaster udpates for 5 minutes for meeting : " + adhocMeeting.JoinUrl); // Wait 5 minutes before exiting. // Since we have registered Conversation_HandleParticipantChange, we will continue to show participant changes in the // meeting for this duration. await Task.Delay(TimeSpan.FromMinutes(5)).ConfigureAwait(false); await WebEventChannel.WebEventChannel.Instance.TryStopAsync().ConfigureAwait(false); }
public async Task RunAsync() { var skypeId = ConfigurationManager.AppSettings["Trouter_SkypeId"]; var password = ConfigurationManager.AppSettings["Trouter_Password"]; var applicationName = ConfigurationManager.AppSettings["Trouter_ApplicationName"]; var userAgent = ConfigurationManager.AppSettings["Trouter_UserAgent"]; var token = SkypeTokenClient.ConstructSkypeToken( skypeId: skypeId, password: password, useTestEnvironment: false, scope: string.Empty, applicationName: applicationName).Result; m_logger = new SampleAppLogger(); // Uncomment for debugging m_logger.HttpRequestResponseNeedsToBeLogged = true; EventChannel = new TrouterBasedEventChannel(m_logger, token, userAgent); // Prepare platform var platformSettings = new ClientPlatformSettings(QuickSamplesConfig.AAD_ClientSecret, new Guid(QuickSamplesConfig.AAD_ClientId)); var platform = new ClientPlatform(platformSettings, m_logger); // Prepare endpoint var endpointSettings = new ApplicationEndpointSettings(new SipUri(QuickSamplesConfig.ApplicationEndpointId)); var applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, EventChannel); var loggingContext = new LoggingContext(Guid.NewGuid()); await applicationEndpoint.InitializeAsync(loggingContext).ConfigureAwait(false); await applicationEndpoint.InitializeApplicationAsync(loggingContext).ConfigureAwait(false); // Meeting configuration var meetingConfiguration = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + " test meeting"); // Schedule meeting var adhocMeeting = await applicationEndpoint.Application.CreateAdhocMeetingAsync(loggingContext, meetingConfiguration).ConfigureAwait(false); WriteToConsoleInColor("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri); WriteToConsoleInColor("ad hoc meeting join url : " + adhocMeeting.JoinUrl); // Get all the events related to join meeting through Trouter's uri platformSettings.SetCustomizedCallbackurl(new Uri(EventChannel.CallbackUri)); // Start joining the meeting var invitation = await adhocMeeting.JoinAdhocMeeting(loggingContext, null).ConfigureAwait(false); var conversation = invitation.RelatedConversation; // Wait for the join to complete await invitation.WaitForInviteCompleteAsync().ConfigureAwait(false); conversation.HandleParticipantChange += Conversation_HandleParticipantChange; IAudioVideoCall audioVideoCall = conversation.AudioVideoCall; await audioVideoCall.EstablishAsync(loggingContext).ConfigureAwait(false); // Wait for the audiovideo call to complete await audioVideoCall.WaitForAVFlowConnected().ConfigureAwait(false); WriteToConsoleInColor("Showing roaster udpates for 1 minute for meeting : " + adhocMeeting.JoinUrl); // Wait for 1 minutes before playing prompt. During this time, we can connect from other skype client and listen prompt. // Since we have registered Conversation_HandleParticipantChange, we will also continue to show participant changes in the // meeting for this duration. await Task.Delay(TimeSpan.FromMinutes(1)).ConfigureAwait(false); Uri promptUri = new Uri(mediaUrl); // Wait for prompt play to complete await audioVideoCall.AudioVideoFlow.PlayPromptAsync(promptUri, loggingContext).ConfigureAwait(false); // exit after play prompt. wait for 5 seconds to see all responses. await Task.Delay(TimeSpan.FromSeconds(5)).ConfigureAwait(false); }
public async Task RunAsync() { var skypeId = ConfigurationManager.AppSettings["Trouter_SkypeId"]; var password = ConfigurationManager.AppSettings["Trouter_Password"]; var applicationName = ConfigurationManager.AppSettings["Trouter_ApplicationName"]; var userAgent = ConfigurationManager.AppSettings["Trouter_UserAgent"]; var participantUri = ConfigurationManager.AppSettings["ParticipantUri"]; var token = SkypeTokenClient.ConstructSkypeToken( skypeId: skypeId, password: password, useTestEnvironment: false, scope: string.Empty, applicationName: applicationName).Result; m_logger = new SampleAppLogger(); // Uncomment for debugging // m_logger.HttpRequestResponseNeedsToBeLogged = true; EventChannel = new TrouterBasedEventChannel(m_logger, token, userAgent); // Prepare platform var platformSettings = new ClientPlatformSettings(QuickSamplesConfig.AAD_ClientSecret, new Guid(QuickSamplesConfig.AAD_ClientId)); var platform = new ClientPlatform(platformSettings, m_logger); // Prepare endpoint var endpointSettings = new ApplicationEndpointSettings(new SipUri(QuickSamplesConfig.ApplicationEndpointId)); var applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, EventChannel); var loggingContext = new LoggingContext(Guid.NewGuid()); await applicationEndpoint.InitializeAsync(loggingContext).ConfigureAwait(false); await applicationEndpoint.InitializeApplicationAsync(loggingContext).ConfigureAwait(false); // Meeting configuration var meetingConfiguration = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + " test meeting"); // Schedule meeting var adhocMeeting = await applicationEndpoint.Application.CreateAdhocMeetingAsync(loggingContext, meetingConfiguration).ConfigureAwait(false); WriteToConsoleInColor("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri); WriteToConsoleInColor("ad hoc meeting join url : " + adhocMeeting.JoinUrl); // Get all the events related to join meeting through Trouter's uri platformSettings.SetCustomizedCallbackurl(new Uri(EventChannel.CallbackUri)); // Start joining the meeting var invitation = await adhocMeeting.JoinAdhocMeeting(loggingContext, null).ConfigureAwait(false); // Wait for the join to complete await invitation.WaitForInviteCompleteAsync().ConfigureAwait(false); invitation.RelatedConversation.HandleParticipantChange += Conversation_HandleParticipantChange; // invite the participant to join the meeting WriteToConsoleInColor("Invite " + participantUri + " to join the meeting"); var participantInvitation = await invitation.RelatedConversation.AddParticipantAsync(participantUri, loggingContext).ConfigureAwait(false); // Wait for the join to complete await participantInvitation.WaitForInviteCompleteAsync().ConfigureAwait(false); //remove the participant from the meeting foreach (var participant in invitation.RelatedConversation.Participants) { if (participantUri.Equals(participant.Uri)) { await participant.EjectAsync(loggingContext).ConfigureAwait(false); } } WriteToConsoleInColor("Showing roaster udpates for 5 minutes for meeting : " + adhocMeeting.JoinUrl); // Wait 5 minutes before exiting. // Since we have registered Conversation_HandleParticipantChange, we will continue to show participant changes in the // meeting for this duration. await Task.Delay(TimeSpan.FromMinutes(5)).ConfigureAwait(false); }