internal FindAgentAsyncResult(AsyncCallback asyncCallback, Object state, AcdCustomerSession requestor, AcdAgentMatchMaker matchMaker, List <Agent> exclusionList, List <AgentSkill> requestedSkills) : base(asyncCallback, state) { _matchMaker = matchMaker; _configuration = matchMaker._configuration; _exclusionList = exclusionList; _requestedSkills = requestedSkills; _requestor = requestor; }
/// <summary> /// AcdAgentMatchMaker constructs the Automatic Call Distributor match maker /// </summary> internal AcdAgentMatchMaker(AcdPlatform platform, AcdAgentMatchMakerConfiguration configuration, ApplicationEndpointSettings endpointSettings, AcdLogger logger) { _platform = platform; _configuration = configuration; _logger = logger; _matchMakerState = MatchMakerState.Created; _pendingAgentRequestQueueItems = new List <PendingAgentMatchRequestQueueItem>(); endpointSettings.AutomaticPresencePublicationEnabled = true; endpointSettings.Presence.RemotePresenceSubscriptionCategories.Clear(); endpointSettings.Presence.RemotePresenceSubscriptionCategories.Add("state"); //Create the endpoint that will be used by the Agent match maker. _endpoint = new ApplicationEndpoint(platform.CollaborationPlatform, endpointSettings); }
/// <summary> /// Parses the configuration file /// </summary> /// <param name="configXMLDoc"></param> /// <returns>true if the configuration file could be parsed successfully, false otherwise</returns> internal bool ProcessConfigurationFile(string configXMLDoc) { try { //Parse the config xml doc into an Xdocument XDocument configDoc = XDocument.Parse(configXMLDoc); //Use Linq to XML to get the platform _configuration = (from platform in configDoc.Descendants("platform") select new AcdPlatformConfiguration { ApplicationUserAgent = platform.Element("applicationUserAgent").Value, ApplicationUrn = platform.Element("applicationUrn").Value, PortalConfigurations = (from portal in platform.Element("portals").Descendants("portal") select new AcdPortalConfiguration { Uri = portal.Element("uri").Value, Token = portal.Element("token").Value, VoiceXmlEnabled = (portal.Element("voiceXmlEnabled") != null && portal.Element("voiceXmlEnabled").Value.Equals("true")) ? true : false, VoiceXmlPath = portal.Element("voiceXmlPath") != null ? portal.Element("voiceXmlPath").Value : null, WelcomeMessage = portal.Element("welcomeMessage").Value, ContextualWelcomeMessage = portal.Element("contextualWelcomeMessage").Value, ImBridgingMessage = portal.Element("imBridgingMessage").Value, ImPleaseHoldMessage = portal.Element("imPleaseHoldMessage").Value, FinalMessage = portal.Element("finalMessage").Value, TimeOutNoAgentAvailableMessage = portal.Element("timeOutNoAgentAvailableMessage").Value, Skills = (from skill in portal.Element("portalSkills").Descendants("portalSkill").Attributes() select(string) skill.Value).ToList <string>() }).ToList() }).First(); //Retrieve the matchmaker configuration _matchMakerConfiguration = (from matchMaker in configDoc.Element("platform").Descendants("matchMaker") select new AcdAgentMatchMakerConfiguration { MaxWaitTimeOut = int.Parse(matchMaker.Element("maxWaitTimeOut").Value), Uri = matchMaker.Element("uri").Value, AgentDashboardGuid = new Guid(matchMaker.Element("agentDashboardGuid").Value), SupervisorDashboardGuid = new Guid(matchMaker.Element("supervisorDashboardGuid").Value), FinalMessageToAgent = matchMaker.Element("agentPrompts").Element("finalMessageToAgent").Value, OfferToAgentMainPrompt = matchMaker.Element("agentPrompts").Element("mainPrompt").Value, OfferToAgentNoRecoPrompt = matchMaker.Element("agentPrompts").Element("noRecoPrompt").Value, OfferToAgentSilencePrompt = matchMaker.Element("agentPrompts").Element("silencePrompt").Value, MusicOnHoldFilePath = matchMaker.Element("musicOnHoldFilePath").Value, AgentMatchMakingPrompt = matchMaker.Element("agentMatchMakingPrompt").Value, FinalMessageToSupervisor = matchMaker.Element("supervisorPrompts").Element("finalMessageToSupervisor").Value, SupervisorWelcomePrompt = matchMaker.Element("supervisorPrompts").Element("welcomePrompt").Value, Skills = (from skill in matchMaker.Element("skills").Descendants("skill") select new Skill() { Name = skill.Attribute("name").Value, MainPrompt = skill.Element("mainPrompt").Value, NoRecoPrompt = skill.Element("noRecoPrompt").Value, SilencePrompt = skill.Element("silencePrompt").Value, RecognizedSkillPrompt = skill.Element("skillRecognizedMainPrompt").Value, Values = (from skillValue in skill.Descendants("skillValues").Elements() select skillValue.Value).ToList() }).ToList(), }).First(); //add the supervisors. _matchMakerConfiguration.Supervisors = (from supervisor in configDoc.Descendants("supervisors").Elements("supervisor") select new Supervisor() { SignInAddress = supervisor.Element("signInAddress").Value, PublicName = supervisor.Element("publicName").Value, InstantMessageColor = supervisor.Element("instantMessageColor").Value, }).ToList(); //Add the agents. This must be done separately from the previous line since we need the skills //from the matchMakerConfiguration object. _matchMakerConfiguration.Agents = (from agent in configDoc.Descendants("agents").Elements("agent") select new Agent(_logger) { PublicName = agent.Element("publicName").Value, SignInAddress = agent.Element("signInAddress").Value, SupervisorUri = agent.Element("supervisorUri").Value, InstantMessageColor = agent.Element("instantMessageColor").Value, Skills = (from agentSkill in agent.Descendants("agentSkills").Elements() select new AgentSkill(Skill.FindSkill(agentSkill.Attribute("name").Value, _matchMakerConfiguration.Skills), agentSkill.Value)).ToList(), }).ToList(); //Assign agent to supervisor and vice versa _matchMakerConfiguration.Agents.ForEach(agent => { _matchMakerConfiguration.Supervisors.ForEach(sup => { if (SipUriCompare.Equals(sup.SignInAddress, agent.SupervisorUri)) { agent.Supervisor = sup; sup.Agents.Add(agent); } }); }); return(true); } catch (Exception ex) { _logger.Log("AcdPlatform failed parsing the configuration file", ex); return(false); } }