/// <summary> /// Creates the P2PEndpoint for sending the Notify. A P2P endpoint enjoys /// auto-provisioning of the necessary application endpoint settings /// if it is obtained from an established ApplicationEndpoint created with /// ProvisionedApplicationPlatformSettings. /// </summary> void CreateP2PEndpoint() { Console.WriteLine("Creating P2P Endpoint...for {0}", _appID); try { if (!string.IsNullOrEmpty(_appID)) { Console.WriteLine("Creating CollaborationPlatform for the provisioned application with " + "ID \'{0}\' using ProvisionedApplicationPlatformSettings.", _appID); ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("UCMASampleApp", _appID); _collabPlatform = new CollaborationPlatform(settings); // Receive applicationEndpoint settings via auto-provisioning _collabPlatform.RegisterForApplicationEndpointSettings(ApplicationEndpointSettingsDiscovered); _collabPlatform.EndStartup(_collabPlatform.BeginStartup(null, null)); Console.WriteLine("platform started."); } else { Console.WriteLine("Error: Application ID not provided."); } } catch (Exception iOpEx) { Console.WriteLine(iOpEx.ToString()); } }
/// <summary> /// Retrieves the application configuration and begins running the /// sample. /// </summary> void Run() { _appID = null; try { // Attempt to retrieve the application ID of the provisioned // application from the config file. _appID = System.Configuration.ConfigurationManager.AppSettings["ApplicationID"]; if (string.IsNullOrEmpty(_appID)) { // The application ID wasn't retrieved from the config file // so prompt for the application ID for the application that // has been provisioned. string prompt = "Please enter the unique ID of the application that is provisioned in " + "the topology => "; _appID = UCMASampleHelper.PromptUser(prompt, null); } if (!string.IsNullOrEmpty(_appID)) { Console.WriteLine("Creating CollaborationPlatform for the provisioned application with " + "ID \'{0}\' using ProvisionedApplicationPlatformSettings.", _appID); ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("UCMASampleApp", _appID); _collabPlatform = new CollaborationPlatform(settings); // Wire up a handler for the // ApplicationEndpointOwnerDiscovered event. _collabPlatform.RegisterForApplicationEndpointSettings( this.Platform_ApplicationEndpointOwnerDiscovered); // Initialize and startup the platform. _collabPlatform.BeginStartup(EndPlatformStartup, _collabPlatform); } else { Console.WriteLine("No application ID was specified by the user."); } UCMASampleHelper.PauseBeforeContinuing("Press ENTER to shutdown and exit."); } catch (InvalidOperationException iOpEx) { // Invalid Operation Exception may be thrown if the data // provided to the BeginXXX methods was // invalid/malformed. // TODO (Left to the reader): Write actual handling code for the // occurrence. Console.WriteLine("Invalid Operation Exception: " + iOpEx.ToString()); } finally { // Terminate the platform which would in turn terminate any // endpoints. Console.WriteLine("Shutting down the platform."); ShutdownPlatform(); } }
void Run() { _AppID = System.Configuration.ConfigurationManager.AppSettings["ApplicationID"]; ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("My UCMA Application", _AppID); _CollabPlatform = new CollaborationPlatform(settings); _CollabPlatform.RegisterForApplicationEndpointSettings(Platform_ApplicationEndpointOwnerDiscovered); Console.WriteLine("Starting collaboration platform"); _CollabPlatform.BeginStartup(PlatformStartupComplete, _CollabPlatform); //PauseBeforeContinuing("Press enter to shutdown and exit"); Console.WriteLine("Shutting down the platform."); //ShutdownPlatform(); }
public async Task Start() { try { Console.WriteLine("Starting Collaboration Platform"); ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings(_appUserAgent, _appID); _collabPlatform = new CollaborationPlatform(settings); _collabPlatform.RegisterForApplicationEndpointSettings(OnNewApplicationEndpointDiscovered); await _collabPlatform.StartupAsync(); Console.WriteLine("Platform Started"); } catch (Exception ex) { Console.WriteLine("Error establishing collaboration platform: {0}", ex.ToString()); } }
public void StartupPlatform() { try { ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings(LumtGlobals.ApplicationUserAgent, LumtGlobals.TrustedApplicationID); collabPlatform = new CollaborationPlatform(settings); Log.WriteLogEntry("INFO", String.Format("Starting {0} platform...", LumtGlobals.ApplicationShortName)); collabPlatform.EndStartup(collabPlatform.BeginStartup(null, null)); Log.WriteLogEntry("INFO", String.Format("{0} platform started.", LumtGlobals.ApplicationShortName)); } catch (Exception ex) { Log.WriteLogEntry("ERROR", String.Format("{0} platform NOT started: {1}. Inner Exception: {2}", LumtGlobals.ApplicationShortName, ex.Message, (ex.InnerException == null ? "N/A" : ex.InnerException.Message)), String.Format("{0} platform NOT started.", LumtGlobals.ApplicationShortName)); Program.CloseApplicationOnError(); } }
public async Task Start() { try { Console.WriteLine("Starting Collaboration Platform"); ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings(_appUserAgent, _appID); _collabPlatform = new CollaborationPlatform(settings); _collabPlatform.RegisterForApplicationEndpointSettings(OnNewApplicationEndpointDiscovered); await _collabPlatform.StartupAsync(); Console.WriteLine("Platform Started"); } catch (Exception ex) { Console.WriteLine("Error establishing collaboration platform: {0}", ex.ToString()); } }
public static void Main(string[] args) { try { string appId = ConfigurationManager.AppSettings["ApplicationID"]; Console.WriteLine("Creating CollaborationPlatform for the provisioned application with " + "ID \'{0}\' using ProvisionedApplicationPlatformSettings.", appId); ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("UCMASampleApp", appId); settings.DefaultAudioVideoProviderEnabled = true; _collabPlatform = new CollaborationPlatform(settings); _collabPlatform.InstantMessagingSettings.SupportedFormats = InstantMessagingFormat.All; // Wire up a handler for the // ApplicationEndpointOwnerDiscovered event. _collabPlatform.RegisterForApplicationEndpointSettings( Platform_ApplicationEndpointOwnerDiscovered); // Initalize and startup the platform. _collabPlatform.BeginStartup(EndPlatformStartup, _collabPlatform); Console.WriteLine("Please hit Esc key to end the sample."); ConsoleKeyInfo info = Console.ReadKey(); while (info.Key != ConsoleKey.Escape) { info = Console.ReadKey(); } } catch (InvalidOperationException iOpEx) { Console.WriteLine("Invalid Operation Exception: " + iOpEx.ToString()); } finally { Console.WriteLine("Shutting down the platform."); ShutdownPlatform(); } }
public static void Main(string[] args) { try { string appId = ConfigurationManager.AppSettings["ApplicationID"]; Console.WriteLine("Creating CollaborationPlatform for the provisioned application with " + "ID \'{0}\' using ProvisionedApplicationPlatformSettings.", appId); ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("UCMASampleApp", appId); settings.DefaultAudioVideoProviderEnabled = true; _collabPlatform = new CollaborationPlatform(settings); _collabPlatform.InstantMessagingSettings.SupportedFormats = InstantMessagingFormat.All; // Wire up a handler for the // ApplicationEndpointOwnerDiscovered event. _collabPlatform.RegisterForApplicationEndpointSettings( Platform_ApplicationEndpointOwnerDiscovered); // Initalize and startup the platform. _collabPlatform.BeginStartup(EndPlatformStartup, _collabPlatform); Console.WriteLine("Please hit Esc key to end the sample."); ConsoleKeyInfo info = Console.ReadKey(); while (info.Key != ConsoleKey.Escape) { info = Console.ReadKey(); } } catch (InvalidOperationException iOpEx) { Console.WriteLine("Invalid Operation Exception: " + iOpEx.ToString()); } finally { Console.WriteLine("Shutting down the platform."); ShutdownPlatform(); } }
public void Start() { // Get the application ID from App.config. string applicationUserAgent = "maximillian"; string applicationId = ConfigurationManager.AppSettings["applicationId"]; // Create a settings object. ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings(applicationUserAgent, applicationId); // Create a new collaboration platform with the settings. _collaborationPlatform = new CollaborationPlatform(settings); _collaborationPlatform.RegisterForApplicationEndpointSettings(OnApplicationEndpointSettingsDiscovered); _logger.Log("Starting collaboration platform..."); // Start the platform as an asynchronous operation. _collaborationPlatform.BeginStartup(OnPlatformStartupCompleted, null); }
public void Start() { // Get the trusted application settings from App.config string appUserAgent = "MyUCMAApp"; string applicationId = "urn:application:myucmaapp"; string localhost = System.Net.Dns.GetHostEntry("localhost").HostName; int listeningPort = int.Parse("10600"); _recipientSipUri = "sip:[email protected]"; // Create a settings object that will hold all the previous information var settings = new ProvisionedApplicationPlatformSettings(appUserAgent, applicationId); //ServerPlatformSettings settings = new ServerPlatformSettings(applicationName, localhost, listeningPort, gruu, CertificateHelper.GetLocalCertificate()); // Create a new collaboration platform with the settings _collaborationPlatform = new CollaborationPlatform(settings); // Start the platform as an asynchronous operation _collaborationPlatform.BeginStartup(OnPlatformStartupCompleted, null); }
public void Start() { // Get the trusted application settings from App.config string appUserAgent = "MyUCMAApp"; string applicationId = ConfigurationManager.AppSettings["applicationId"]; string applicationName = ConfigurationManager.AppSettings["applicationName"]; string localhost = System.Net.Dns.GetHostEntry("localhost").HostName; int listeningPort = int.Parse(ConfigurationManager.AppSettings["listeningPort"]); string gruu = ConfigurationManager.AppSettings["gruu"]; // Create a settings object that will hold all the previous information var settings = new ProvisionedApplicationPlatformSettings(appUserAgent, applicationId); //ServerPlatformSettings settings = new ServerPlatformSettings(applicationName, localhost, listeningPort, gruu, CertificateHelper.GetLocalCertificate()); // Create a new collaboration platform with the settings _collaborationPlatform = new CollaborationPlatform(settings); // Start the platform as an asynchronous operation _collaborationPlatform.BeginStartup(OnPlatformStartupCompleted, null); }
internal void Process() { _acdPlatform._logger = new AcdLogger(); if (false == _acdPlatform.ProcessConfigurationFile(_configXMLDoc)) { this.SetAsCompleted(new InvalidOperationException("AcdPlatform configuration cannot be parsed"), false); } //Create the platform settings ProvisionedApplicationPlatformSettings platformSettings = new ProvisionedApplicationPlatformSettings(_acdPlatform._configuration.ApplicationUserAgent, _acdPlatform._configuration.ApplicationUrn); //Create the CollaborationPlatform _acdPlatform._platform = new CollaborationPlatform(platformSettings); //Mark that we only support text/plain _acdPlatform._platform.InstantMessagingSettings.SupportedFormats = InstantMessagingFormat.PlainText; //Extend the support of the CollaborationPlatform for ApplicationSharing _acdPlatform._platform.RegisterPlatformExtension(new ApplicationSharingCallFactory()); _acdPlatform._platform.RegisterPlatformExtension(new ApplicationSharingMcuSessionFactory()); _acdPlatform._platform.RegisterPlatformExtension(new ApplicationSharingMcuSessionNotificationProcessorFactory()); //Register a separate event handler for the AcdAgentMatchMaker as this is meant to be processed //by the async result _acdPlatform._platform.RegisterForApplicationEndpointSettings(OnMatchMakerFound); _acdPlatform._platform.ProvisioningFailed += _acdPlatform.OnPlatformProvisioningFailed; //starts the CollaborationPlatform try { _acdPlatform._platform.BeginStartup(this.OnPlatformStartupComplete, null); } catch (InvalidOperationException ivoex) { _acdPlatform._logger.Log("AcdPortal the collaboration platform may already be started", ivoex); } }
//Commented the functions used to start and stop workflow runtime service as workflows are not to be used /* * private void StartWorkflowRuntime(AsyncTask task, object state) * { * m_workflowRuntime = new WorkflowRuntime(); * m_workflowRuntime.AddService(new CommunicationsWorkflowRuntimeService()); * m_workflowRuntime.AddService(new TrackingDataWorkflowRuntimeService()); * * task.DoFinalStep( * delegate() * { * m_workflowRuntime.StartRuntime(); * this.Logger.Log(Logger.LogLevel.Info, "Workflow started."); * }); * } * * private void ShutdownWorkflowRuntime(AsyncTask task, object state) * { * if (m_workflowRuntime == null) * { * task.Complete(null); * return; * } * task.DoFinalStep( * delegate() * { * m_workflowRuntime.StopRuntime(); * this.Logger.Log(Logger.LogLevel.Info, "Workflow shutdown."); * }); * } */ private void StartupPlatform(AsyncTask task, object state) { task.DoOneStep( delegate() { var settings = new ProvisionedApplicationPlatformSettings(m_userAgent, m_applicationId); m_platform = new CollaborationPlatform(settings); m_platform.RegisterForApplicationEndpointSettings(this.ApplicationEndpointOwnerDiscovered); //this.Logger.Log(Logger.LogLevel.Info, "Starting the Collaboration Platform."); m_platform.BeginStartup( delegate(IAsyncResult ar) { task.DoFinalStep( delegate() { m_platform.EndStartup(ar); //this.Logger.Log(Logger.LogLevel.Info, "Collaboration Platform started."); }); }, null); }); }
/// <summary> /// Setup Collaboration Platform /// </summary> private void StartPlatform() { try { if (!useUserEndPoint) { string localhost = Dns.GetHostEntry("localhost").HostName; // Config change: for conditional Auto Provisioning. if (this.useApplicationAutoProvisioning) { ProvisionedApplicationPlatformSettings appSettings = new ProvisionedApplicationPlatformSettings("fasthelp", this.applicationId); this.collabPlatform = new CollaborationPlatform(appSettings); this.collabPlatform.RegisterForApplicationEndpointSettings( this.Platform_ApplicationEndpointOwnerDiscovered); } else { ServerPlatformSettings platform = new ServerPlatformSettings(this.applicationName, localhost, this.port, this.gruu, CertificateHelper.GetLocalCertificate(this.certificateName)); platform.TrustedDomains.Add(new TrustedDomain(".fabrikam.com")); this.collabPlatform = new CollaborationPlatform(platform); } Console.WriteLine("Publishing Presence"); } else { // Initalize and startup the platform. ClientPlatformSettings clientPlatformSettings = new ClientPlatformSettings(this.applicationName, this.transportType); this.collabPlatform = new CollaborationPlatform(clientPlatformSettings); } this.logger.Log("Starting the platform."); Console.WriteLine("Starting the platform."); this.collabPlatform.EndStartup(this.collabPlatform.BeginStartup(null, null)); Console.WriteLine("Starting the platform complete."); // Config change: for conditional Auto Provisioning. if (!this.useApplicationAutoProvisioning) { this.StartEndpoint(); } } catch (InvalidOperationException ioe) { Console.WriteLine(ioe.ToString()); } catch (ConnectionFailureException connFailEx) { // ConnectionFailureException will be thrown when the platform cannot connect Console.WriteLine(connFailEx.ToString()); this.logger.Log("Connection Failure Exception {0}", connFailEx); } catch (ProvisioningFailureException provFailEx) { // ProvisioningFailureException will be thrown when the platform cannot find the trusted application // entry per the application ID passed in ProvisionedApplicationPlatformSettings. Console.WriteLine(provFailEx.ToString()); this.logger.Log("Provisioning Failure Exception {0}", provFailEx); } catch (RealTimeException rte) { Console.WriteLine(rte); this.logger.Log("Platform failed to start {0}", rte); } }
/// <summary> /// Returns an application endpoint that is provisioned on a platform /// as specified by the ApplicationID which could be provided by config /// file or be prompted to the user; if the platform discovers multiple /// application endpoints the first one discovered and established will be /// returned. If no application endpoints are discovered this method /// returns null. /// </summary> /// <returns></returns> public ApplicationEndpoint CreateAutoProvisionedApplicationEndpoint() { _applicationId = null; try { // Attempt to retrieve the application ID of the provisioned // application from the config file. _applicationId = System.Configuration.ConfigurationManager.AppSettings["ApplicationID"]; if (string.IsNullOrEmpty(_applicationId)) { // The application ID wasn't retrieved from the config file // so prompt for the application ID for the application that // has been provisioned. string prompt = "Please enter the unique ID of the application that is provisioned in " + "the topology => "; _applicationId = UCMASampleHelper.PromptUser(prompt, null); } if (!string.IsNullOrEmpty(_applicationId)) { UCMASampleHelper.WriteLine("Creating CollaborationPlatform for the provisioned application" + " with ID \'" + _applicationId + "\' using ProvisionedApplicationPlatformSettings."); ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings("UCMASampleApp", _applicationId); // Reuse platform instance so that all endpoints share the // same platform. if (_collabPlatform == null) { // Initalize and startup the platform. _collabPlatform = new CollaborationPlatform(settings); // Wire up a handler for the // ApplicationEndpointOwnerDiscovered event. _collabPlatform.RegisterForApplicationEndpointSettings( this.Platform_ApplicationEndpointOwnerDiscovered); // Initalize and startup the platform. _collabPlatform.BeginStartup(EndPlatformStartup, _collabPlatform); if (_endpointInitCompletedEvent.WaitOne()) { UCMASampleHelper.WriteLine("Found an application EP the Owner Uri is: " + _applicationEndpoint.OwnerUri); } else { Console.WriteLine("Application endpoint was not established within the given time," + " ending Sample."); UCMASampleHelper.FinishSample(); } } else { Console.WriteLine("Collaboration platform already exists, ending Sample."); UCMASampleHelper.FinishSample(); } } else { Console.WriteLine("No application ID was specified by the user. Unable to create an" + " ApplicationEndpoint to use in the sample."); UCMASampleHelper.FinishSample(); } return(_applicationEndpoint); } catch (InvalidOperationException iOpEx) { // Invalid Operation Exception may be thrown if the data provided // to the BeginStartUp is called when the platform has already been // started or terminated. // TODO (Left to the reader): Error handling code. UCMASampleHelper.WriteException(iOpEx); return(_applicationEndpoint); } }
/// <summary> /// Method to start platform and endpoint initialization. /// </summary> public void Start() { if (m_disposed) { throw new ObjectDisposedException("Please restart"); } string applicationId = Configuration.ApplicationId; if (!String.IsNullOrEmpty(applicationId)) { ProvisionedApplicationPlatformSettings settings = new ProvisionedApplicationPlatformSettings(UcmaHelper.ApplicationName, applicationId); //Create the platform. m_collabPlatform = new CollaborationPlatform(settings); //Populate im flow template. InstantMessagingFlowTemplate imFlowTemplate = new InstantMessagingFlowTemplate(); imFlowTemplate.ComposingTimeoutValue = 10; //seconds imFlowTemplate.SupportedFormats = InstantMessagingFormat.PlainText | InstantMessagingFormat.HtmlText; imFlowTemplate.MessageConsumptionMode = InstantMessageConsumptionMode.ProxiedToRemoteEntity; imFlowTemplate.ToastFormatSupport = CapabilitySupport.UnSupported; m_collabPlatform.InstantMessagingSettings = imFlowTemplate; // Wire up a handler for the ApplicationEndpointOwnerDiscovered event. m_collabPlatform.RegisterForApplicationEndpointSettings(this.Platform_ApplicationEndpointOwnerDiscovered); bool needCleanup = true; try { m_collabPlatform.BeginStartup(this.PlatformStartupCompleted, m_collabPlatform); needCleanup = false; } catch (InvalidOperationException ioe) { Helper.Logger.Error("Exception caught during startup {0}", EventLogger.ToString(ioe)); } finally { if (needCleanup) { this.Cleanup(); } } //Wait for all operations to complete. var allDone = m_allDone; if (allDone != null) { bool succeeded = m_allDone.WaitOne(UcmaHelper.MaxTimeoutInMillis, false /*exitContext*/); if (!succeeded) { Helper.Logger.Error("Initialization did not complete in expected time."); } } } else { Helper.Logger.Error("Invalid application id. Please provide a valid value for application id in the web.config file."); } }