Exemplo n.º 1
0
      public async Task Run()
      {
          ConsoleLogger logger = new ConsoleLogger();

          logger.HttpRequestResponseNeedsToBeLogged = true;  //Set to true if you want to log all http request and responses

          //Prepare platform

          //For all public developers
          ClientPlatformSettings platformSettings = new ClientPlatformSettings(
              QuickSamplesConfig.AAD_ClientSecret,
              Guid.Parse(QuickSamplesConfig.AAD_ClientId),
              false
              );

          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 adhocMeeting = await applicationEndpoint.Application.GetAdhocMeetingResourceAsync(loggingContext,
                                                                                                new AdhocMeetingInput
            {
                AccessLevel = AccessLevel.Everyone,
                Subject     = Guid.NewGuid().ToString("N") + "testMeeting"
            });

          logger.Information("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri);
          logger.Information("ad hoc meeting join url : " + adhocMeeting.JoinUrl);

          //Get anon join token
          AnonymousApplicationTokenResource anonToken = await applicationEndpoint.Application.GetAnonApplicationTokenAsync(loggingContext, new AnonymousApplicationTokenInput
            {
                ApplicationSessionId = Guid.NewGuid().ToString(),                                                                      //Should be unique everytime
                AllowedOrigins       = "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
                MeetingUrl           = adhocMeeting.JoinUrl
            }
                                                                                                                           );


          logger.Information("Get anon token : " + anonToken.AuthToken);
          logger.Information("Get discover url for web SDK : " + anonToken.AnonymousApplicationsDiscover.Href);
      }
Exemplo n.º 2
0
      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();
      }