/// <summary> /// Event handler to receive auto-provisioned ApplicationEndpointSettings for /// a given application Id. Auto-provisioned ApplicationEndpointSettings contains /// the correct proxy server and proxy port, as well as other configurational /// information required to establish a connection between the endpoint and the /// server. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void ApplicationEndpointSettingsDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Console.WriteLine("ApplicationEndpointOwnerDiscovered event was raised."); Console.WriteLine("provisioned application ID = \'{0}\' ", _appID); Console.WriteLine("Owner display name is: " + e.ApplicationEndpointSettings.OwnerDisplayName); Console.WriteLine("Owner URI is: " + e.ApplicationEndpointSettings.OwnerUri); Console.WriteLine("ProxyHost: " + e.ApplicationEndpointSettings.ProxyHost); Console.WriteLine("ProxyPort: " + e.ApplicationEndpointSettings.ProxyPort); try { ApplicationEndpointSettings settings = e.ApplicationEndpointSettings; _superEndpoint = new ApplicationEndpoint(_collabPlatform, settings); // Establish the endpoint. _superEndpoint.EndEstablish(_superEndpoint.BeginEstablish(null, null)); Console.WriteLine("ApplicationEndpoint state={0}", _superEndpoint.State.ToString()); _superP2PEndpoint = (SipPeerToPeerEndpoint)_superEndpoint.InnerEndpoint; } 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): Error handling code. Console.WriteLine("Invalid Operation Exception: " + iOpEx.ToString()); } }
// Registered event handler for the ApplicationEndpointOwnerDiscovered event on the // CollaborationPlatform for the provisioned application. private void Platform_ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Helper.Logger.Info("ApplicationEndpointOwnerDiscovered event was raised during startup of the " + "CollaborationPlatform."); ApplicationEndpointSettings settings = e.ApplicationEndpointSettings; settings.UseRegistration = false; m_applicationEndpoint = new ApplicationEndpoint(m_collabPlatform, settings); bool epBeginEstablishFailed = true; try { this.RegisterEndpointEventHandlers(m_applicationEndpoint); m_applicationEndpoint.BeginEstablish(this.EndpointEstablishCompleted, m_applicationEndpoint); epBeginEstablishFailed = false; } catch (InvalidOperationException ioe) { Helper.Logger.Error("Endpoint establishment operation threw an exception {0}", EventLogger.ToString(ioe)); } finally { if (epBeginEstablishFailed) { this.Cleanup(); } } }
// Registered event handler for the ApplicationEndpointOwnerDiscovered // event on the CollaborationPlatform for the provisioned application. private void Platform_ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Console.WriteLine("ApplicationEndpointOwnerDiscovered event was raised during startup of the " + "CollaborationPlatform for the provisioned application with ID \'{0}\'."); ApplicationEndpointSettings settings = e.ApplicationEndpointSettings; settings.SupportedMimePartContentTypes = new ContentType[] { new ContentType("text/plain") }; //Set the endpoint presence to appear as always online InitializePublishAlwaysOnlineSettings(settings); Console.WriteLine("Initializing the ApplicationEndpoint that corresponds to the provisioned " + "application with ID \'{0}\'.", _appID); // Initialize the endpoint using the settings retrieved above. _appEndpoint = new ApplicationEndpoint(_collabPlatform, settings); // Wire up the StateChanged event. _appEndpoint.StateChanged += this.Endpoint_StateChanged; try { // Establish the endpoint. _appEndpoint.BeginEstablish(EndEndpointEstablish, _appEndpoint); } 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()); } }
//Auto Provisioning private void OnNewPortalFound(object sender, ApplicationEndpointSettingsDiscoveredEventArgs args) { string entityUri = args.ApplicationEndpointSettings.OwnerUri; // The endpoint created is not a matchmaker, verify the endpoint created has been provisioned as an Acdportal _configuration.PortalConfigurations.ForEach(delegate(AcdPortalConfiguration pConfig) { if (SipUriCompare.Equals(entityUri, pConfig.Uri)) { lock (_syncRoot) { if (_acdPlatformState < AcdPlatformState.Terminating) { AcdPortal portal = new AcdPortal(this, pConfig, args.ApplicationEndpointSettings); _portals.Add(portal); _logger.Log(String.Format("AcdPlatform Added AcdPortal {0} to the cache ", entityUri)); portal.BeginStartUp(this.OnPortalStartUpComplete, portal); _logger.Log(String.Format("AcdPlatform Starting AcdPortal {0}", entityUri)); } } return; } }); }
private async void OnNewApplicationEndpointDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { log.Info(string.Format("New Endpoint {0} discovered", e.ApplicationEndpointSettings.OwnerUri)); _endpoint = new ApplicationEndpoint(_collabPlatform, e.ApplicationEndpointSettings); _endpoint.RegisterForIncomingCall<InstantMessagingCall>(OnIncomingIM); await _endpoint.EstablishAsync(); log.Info("Endpoint established"); LyncServerReady(this, new EventArgs()); }
private async void OnNewApplicationEndpointDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Console.WriteLine(string.Format("New Endpoint {0} discovered", e.ApplicationEndpointSettings.OwnerUri)); _endpoint = new ApplicationEndpoint(_collabPlatform, e.ApplicationEndpointSettings); _endpoint.RegisterForIncomingCall<AudioVideoCall>(OnIncomingCall); await _endpoint.EstablishAsync(); Console.WriteLine("Endpoint established"); await CreateConference(); LyncServerReady(this, new EventArgs()); }
private async void OnNewApplicationEndpointDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Console.WriteLine(string.Format("New Endpoint {0} discovered", e.ApplicationEndpointSettings.OwnerUri)); _endpoint = new ApplicationEndpoint(_collabPlatform, e.ApplicationEndpointSettings); _endpoint.RegisterForIncomingCall <InstantMessagingCall>(OnIncomingCall); await _endpoint.EstablishAsync(); Console.WriteLine("Endpoint established"); LyncServerReady(this, new EventArgs()); }
private void Platform_ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Console.WriteLine("Contact discovered: {0}", e.ApplicationEndpointSettings.OwnerUri); var settings = e.ApplicationEndpointSettings; settings.AutomaticPresencePublicationEnabled = true; settings.Presence.PresentityType = "automaton"; settings.Presence.Description = "Toujours disponible !"; _applicationEndpoint = new ApplicationEndpoint(_CollabPlatform, settings); Console.WriteLine("Establishing the endopint"); _applicationEndpoint.BeginEstablish(EndpointEstablishCompleted, null); }
private void OnMatchMakerFound(object sender, ApplicationEndpointSettingsDiscoveredEventArgs args) { string entityUri = args.ApplicationEndpointSettings.OwnerUri; if (SipUriCompare.Equals(entityUri, _acdPlatform._matchMakerConfiguration.Uri)) { _acdPlatform._logger.Log(String.Format("AcdPlatform new AcdAgentMatchMaker found for contact uri {0}, display name {1}", entityUri, args.ApplicationEndpointSettings.OwnerDisplayName)); if (_acdPlatform._acdPlatformState != AcdPlatformState.Terminating && _acdPlatform._acdPlatformState != AcdPlatformState.Terminated) { _acdPlatform._matchMaker = new AcdAgentMatchMaker(_acdPlatform, _acdPlatform._matchMakerConfiguration, args.ApplicationEndpointSettings, _acdPlatform._logger); _acdPlatform._matchMaker.BeginStartup(this.OnMatchMakerStartUpComplete, _acdPlatform._matchMaker); } } }
private void OnApplicationEndpointSettingsDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs args) { // Keep track of how many endpoints we've found // so that we only take one. Interlocked.Increment(ref _endpointsDiscovered); if (_endpointsDiscovered > 1) { // We've already found an endpoint // and we don't need another one. Sorry! return; } _appEndpoint = new ApplicationEndpoint(_collaborationPlatform, args.ApplicationEndpointSettings); _appEndpoint.BeginEstablish(OnApplicationEndpointEstablishCompleted, null); }
//#region Presence //// Registered event handler for the ApplicationEndpointOwnerDiscovered //// event on the CollaborationPlatform for the provisioned application. private void Platform_ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { collabPlatform.UnregisterForApplicationEndpointSettings(Platform_ApplicationEndpointOwnerDiscovered); ApplicationEndpointSettings settings = e.ApplicationEndpointSettings; this.logger.Log("Publishing Presence"); //Set the endpoint presence to appear as always online InitializePublishAlwaysOnlineSettings(settings); this.applicationEndpoint = new ApplicationEndpoint(this.collabPlatform, settings); this.applicationEndpoint.InnerEndpoint.AddFeatureParameter("isAcd"); this.applicationEndpoint.RegisterForIncomingCall <AudioVideoCall>(this.AV_Received); this.applicationEndpoint.RegisterForIncomingCall <InstantMessagingCall>(this.IM_Received); this.logger.Log("Establishing the endpoint."); this.applicationEndpoint.EndEstablish(this.applicationEndpoint.BeginEstablish(null, null)); }
// Registered event handler for the ApplicationEndpointOwnerDiscovered event on the // CollaborationPlatform for the provisioned application. static void Platform_ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Console.WriteLine("ApplicationEndpointOwnerDiscovered event was raised during startup of the CollaborationPlatform."); Console.WriteLine("The ApplicationEndpointOwnerConfiguration that corresponds to the provisioned application are: "); Console.WriteLine("Owner display name is: " + e.ApplicationEndpointSettings.OwnerDisplayName); Console.WriteLine("Owner URI is: " + e.ApplicationEndpointSettings.OwnerUri); Console.WriteLine("Now retrieving the ApplicationEndpointSettings from the ApplicationEndpointSettingsDiscoveredEventArgs."); ApplicationEndpointSettings settings = e.ApplicationEndpointSettings; settings.AutomaticPresencePublicationEnabled = true; settings.SupportedMimePartContentTypes = new ContentType[] { new ContentType("text/plain") }; settings.Presence.Description = "AlwaysOnlineBot"; PreferredServiceCapabilities capabilities = settings.Presence.PreferredServiceCapabilities; capabilities.ApplicationSharingSupport = CapabilitySupport.Supported; capabilities.AudioSupport = CapabilitySupport.Supported; capabilities.InstantMessagingSupport = CapabilitySupport.Supported; capabilities.VideoSupport = CapabilitySupport.Supported; Console.WriteLine("Initializing the ApplicationEndpoint that corresponds to the provisioned application."); // Initalize the endpoint using the settings retrieved above. _appEndpoint = new ApplicationEndpoint(_collabPlatform, settings); // Wire up the StateChanged event. _appEndpoint.StateChanged += Endpoint_StateChanged; // Wire up the ApplicationEndpointOwnerPropertiesChanged event. _appEndpoint.OwnerPropertiesChanged += Endpoint_ApplicationEndpointOwnerPropertiesChanged; try { // Establish the endpoint. _appEndpoint.BeginEstablish(EndEndpointEstablish, _appEndpoint); } catch (InvalidOperationException iOpEx) { Console.WriteLine("Invalid Operation Exception: " + iOpEx.ToString()); } }
private void ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { AppFrontEnd frontEnd = null; if (this.IsTerminatingTerminated) { return; } lock (this.SyncRoot) { this.Logger.Log(Logger.LogLevel.Info, "A new endpoint was detected : " + e.ApplicationEndpointSettings.OwnerUri); frontEnd = new AppFrontEnd(this, e.ApplicationEndpointSettings); this.AddFrontEnd(frontEnd); } Debug.Assert(frontEnd != null, "frontEnd should not be null"); try { frontEnd.BeginStartup( ar => { try { frontEnd.EndStartup(ar); } catch (RealTimeException ex) { this.Logger.Log(Logger.LogLevel.Error, "Failed to start front end : ", ex); this.RemoveFrontEnd(frontEnd); } }, null); } catch (InvalidOperationException ex) { this.Logger.Log(Logger.LogLevel.Error, "Failed to start front end : ", ex); this.RemoveFrontEnd(frontEnd); } }
// Registered event handler for the ApplicationEndpointOwnerDiscovered event on the // CollaborationPlatform for the provisioned application. void Platform_ApplicationEndpointOwnerDiscovered(object sender, ApplicationEndpointSettingsDiscoveredEventArgs e) { Console.WriteLine("ApplicationEndpointOwnerDiscovered event was raised during startup of the " + "CollaborationPlatform."); Console.WriteLine("The ApplicationEndpointOwnerConfiguration that corresponds to the provisioned " + "application with ID \'{0}\' are: ", _appID); Console.WriteLine("Owner display name is: " + e.ApplicationEndpointSettings.OwnerDisplayName); Console.WriteLine("Owner URI is: " + e.ApplicationEndpointSettings.OwnerUri); Console.WriteLine("Now retrieving the ApplicationEndpointSettings from the " + "ApplicationEndpointSettingsDiscoveredEventArgs."); ApplicationEndpointSettings settings = e.ApplicationEndpointSettings; settings.SupportedMimePartContentTypes = new ContentType[] { new ContentType("text/plain") }; Console.WriteLine("Initializing the ApplicationEndpoint that corresponds to the provisioned " + "application with ID \'{0}\'.", _appID); // Initalize the endpoint using the settings retrieved above. _appEndpoint = new ApplicationEndpoint(_collabPlatform, settings); // Wire up the StateChanged event. _appEndpoint.StateChanged += this.Endpoint_StateChanged; // Wire up the ApplicationEndpointOwnerPropertiesChanged event. _appEndpoint.OwnerPropertiesChanged += this.Endpoint_ApplicationEndpointOwnerPropertiesChanged; try { // Establish the endpoint. _appEndpoint.BeginEstablish(EndEndpointEstablish, _appEndpoint); } 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): Error handling code. Console.WriteLine("Invalid Operation Exception: " + iOpEx.ToString()); } }