//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; } }); }
internal void Process() { _matchMaker = _huntForAgentAsyncResult.AgentHunter.Matchmaker; AcdPortal portal = _huntForAgentAsyncResult.AgentHunter.Portal; _agent.AllocationStatus = AgentAllocationStatus.CommittingTheAgent; Dictionary <string, object> inputParameters = new Dictionary <string, object>(); string agentSkillPrompt = _huntForAgentAsyncResult.GetAgentSkillPrompt(); inputParameters.Add("AgentUri", _agent.SignInAddress); inputParameters.Add("QaAgentOfferMainPrompt", String.Format(_matchMaker.Configuration.OfferToAgentMainPrompt, _agent.PublicName, agentSkillPrompt)); inputParameters.Add("QaAgentOfferNoRecognitionPrompt", _matchMaker.Configuration.OfferToAgentNoRecoPrompt); inputParameters.Add("QaAgentOfferSilencePrompt", _matchMaker.Configuration.OfferToAgentNoRecoPrompt); inputParameters.Add("Owner", this); inputParameters.Add("ApplicationEndPoint", portal.Endpoint); try { //Start commit agent dialog CommitAgentDialog commitAgent = new CommitAgentDialog(); Guid instanceId = commitAgent.InstanceId; commitAgent.InitializeParameters(inputParameters); commitAgent.Completed += _huntForAgentAsyncResult.AgentHunter.AgentHuntCompleteHandler; commitAgent.Run(); _huntForAgentAsyncResult.AgentHunter.AddDialogInstance(instanceId, this); } catch (Exception ex) { this.SetAsCompleted(ex, false); } }
internal AcdAgentHunter(AcdPortal portal, AcdAgentMatchMaker matchMaker, AcdLogger logger) { _portal = portal; _matchMaker = matchMaker; _logger = logger; _averageQueueTime = new AcdAverageQueueTime(portal); }
private void OnPortalStartUpComplete(IAsyncResult ar) { AcdPortal portal = ar.AsyncState as AcdPortal; try { portal.EndStartUp(ar); } catch (OperationFailureException ofex) { _logger.Log(String.Format("AcdPlatform could not start the portal {0}, exception: {1}", portal.Uri, ofex)); } }
internal AcdAverageQueueTime(AcdPortal portal) { _portal = portal; _averageQueueTime = InitialAverageQueueTime; }
internal StartupAsyncResult(AsyncCallback asyncCallback, Object state, AcdPortal portal) : base(asyncCallback, state) { _acdPortal = portal; }
internal ShutdownAsyncResult(AsyncCallback userCallback, object state, AcdPortal portal) : base(userCallback, state) { _acdPortal = portal; }