void modifyTextApplication(Visio.Characters chars, CfgApplication application) { appendEndOfLine(chars); chars.Begin = chars.End; new Parser.Parser().parseText(Settings.ApplicationText, new Parser.ApplicationTextVisitor(application, chars)); }
private void OnProtocolOpened(object sender, ProtocolEventArgs eaEventArgs) { connected = true; Console.WriteLine("Connection open, reading " + applicationConnectedTo + " application object."); cfgApplication = new CfgApplicationQuery(confServiceContract) { Name = applicationConnectedTo }.ExecuteSingleResult(); }
public void StartHIMMSIntegration() { Thread objThread = new Thread(() => { try { CfgApplication application = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgApplication")) { application = ConfigContainer.Instance().GetValue("CfgApplication"); } if (application != null) { if (!application.Options.ContainsKey("himms-integration")) { _logger.Warn("The HIMMS integration's configuration not found."); return; } KeyValueCollection kvHIMMS = application.Options.GetAsKeyValueCollection("himms-integration"); HimmsIntegrationData objHimmsConfiguration = new HimmsIntegrationData(); _logger.Trace("Try to parse the HIMMS configuration."); objHimmsConfiguration.ParseConfiguration(kvHIMMS); _logger.Trace("The HIMMS configuration parsed successfully."); //mannual login. //objHimmsConfiguration.UserName = username; //objHimmsConfiguration.Password = password; if (objHimmsConfiguration.IsEnabled) { HimmsSubscriber objHimmsSubscriber = new HimmsSubscriber(objHimmsConfiguration); _logger.Trace("Try to subcribe the HIMMS integration."); objHimmsSubscriber.Subscribe(newCallDataProvider); _logger.Trace("The HIMMS integration subscribed successfully."); } } else { _logger.Warn("The application object is null while start HIMMS integration."); } } catch (Exception generalException) { _logger.Error("Error occurred as " + generalException.Message); _logger.Trace("Error Trace : " + generalException.StackTrace); } }); objThread.Start(); }
/// <summary> /// Converts a PSDK Application object to its CTI equivalent. /// </summary> /// <param name="app">The Application object to convert.</param> /// <returns>An <see cref="Application"/> object equivalent to the provided PSDK object.</returns> public static Application ToApplication(this CfgApplication app) => new Application { CfgAppType = app.Type.Value, AppServers = app.AppServers? .Select(conn => conn.ToConnectionInfo(app.DBID, app.GetTenantDBIDs()?.FirstOrDefault())) .ToList(), Dbid = app.DBID, Enabled = app.State.IsEnabled(), Name = app.Name, TenantDbid = app.GetTenantDBIDs()?.FirstOrDefault() };
/// <summary> /// Reads the application level server details. /// </summary> /// <param name="applicationName">Name of the application.</param> /// <returns>CfgApplication.</returns> private static CfgApplication ReadApplicationLevelServerDetails(string applicationName) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); CfgApplication application = null; try { application = new CfgApplication(EmailDataContext.GetInstance().ConfigurationServer); CfgApplicationQuery queryApp = new CfgApplicationQuery(); queryApp.Name = applicationName; application = EmailDataContext.GetInstance().ConfigurationServer.RetrieveObject <CfgApplication>(queryApp); } catch (Exception generalException) { logger.Error("Error Occurred while reading : ReadApplicationLevelServerDetails() " + applicationName + "=" + generalException.ToString()); } return(application); }
public CfgApplication ReadApplicationLevelServerDetails(string applicationName) { CfgApplication application = null; try { application = new CfgApplication(_configContainer.ConfServiceObject); CfgApplicationQuery queryApp = new CfgApplicationQuery(); queryApp.TenantDbid = WellKnownDbids.EnterpriseModeTenantDbid; queryApp.Name = applicationName; application = _configContainer.ConfServiceObject.RetrieveObject <CfgApplication>(queryApp); } catch (Exception commonException) { logger.Error("Error occurred while reading:ReadApplicationAndConnectionTab" + applicationName + "=" + commonException.ToString()); } return(application); }
internal static CfgApplication ReadApplicationObjects(string applicationName) { CfgApplication application = null; try { application = new CfgApplication(_configContainer.ConfServiceObject); CfgApplicationQuery queryApp = new CfgApplicationQuery(); //queryApp.TenantDbid = _configContainer.TenantDbId; queryApp.Name = applicationName; application = _configContainer.ConfServiceObject.RetrieveObject <CfgApplication>(queryApp); } catch (Exception commonException) { _logger.Error("Error occurred while reading " + applicationName + " = " + commonException.ToString()); } return(application); }
/// <summary> /// Reads the application level server details. /// </summary> /// <param name="applicationName">Name of the application.</param> /// <returns></returns> public CfgApplication ReadApplicationLevelServerDetails(string applicationName) { CfgApplication application = null; try { application = new CfgApplication(ChatConnectionSettings.GetInstance().ComObject); CfgApplicationQuery queryApp = new CfgApplicationQuery(); //queryApp.TenantDbid = ChatConnectionSettings.GetInstance().TenantDBID; queryApp.Name = applicationName; application = ChatConnectionSettings.GetInstance().ComObject.RetrieveObject <CfgApplication>(queryApp); } catch (Exception generalException) { logger.Error("Error Occurred while reading:ReadApplicationLevelServerDetails()" + applicationName + "=" + generalException.ToString()); } return(application); }
public void StartWebIntegration(List <ApplicationDataDetails> lstApplication) { try { if (lstApplication != null) { CfgApplication application = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgApplication")) { application = ConfigContainer.Instance().GetValue("CfgApplication"); } if (application != null) { List <WebIntegrationData> lstWebIntegration = GetConfiguredIntegration <WebIntegrationData>("web-integration."); if (lstWebIntegration != null) { for (byte index = 0; index < lstWebIntegration.Count; index++) { if (lstWebIntegration[index].IsConditional && lstApplication.Any(x => x.ApplicationName == lstWebIntegration[index].ApplicationName)) { DesktopMessenger.totalWebIntegration++; lstWebIntegration[index].ApplicationData = lstApplication.SingleOrDefault(x => x.ApplicationName == lstWebIntegration[index].ApplicationName); UrlSubscriber objUrlIntegration = new UrlSubscriber(lstWebIntegration[index]); objUrlIntegration.Subscribe(newCallDataProvider); // If it is need , Need to call OnNext method. //objUrlIntegration.OnNext(null); } } } } } else { _logger.Warn("The web integration is null."); } } catch (Exception generalException) { _logger.Error("Error occurred as " + generalException.Message); _logger.Trace("Error trace: " + generalException.Message); } }
void modifyShapeText(Visio.Shape shape, CfgHost host) { shape.Name = host.Name; Visio.Characters chars = shape.Characters; chars.set_ParaProps(6, 0); // Left alignment if (Settings.WriteHost) { modifyTextHost(chars, host); } if (Settings.WriteApplicationList) { foreach (CfgServer server in host.Servers) { CfgApplication app = server.Application; chars.Begin = chars.End; modifyTextApplication(chars, app); } } }
/// <summary> /// Gets the email server from aid connection tab. /// </summary> /// <param name="applicationName">Name of the application.</param> /// <returns>System.String.</returns> private static void getEmailIDsFromConnectionTab(string applicationName) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); EmailDataContext.GetInstance().MailBox = new List <FromAddresses>(); FromAddresses comboBoxItem; try { CfgApplication application = ReadApplicationLevelServerDetails(applicationName); if (application != null && application.AppServers != null && application.AppServers.Count != 0) { //Get Interaction Server Name from AID connections Tab. foreach (CfgConnInfo appDetails in application.AppServers) { if (appDetails.AppServer.Type == CfgAppType.CFGInteractionServer) { CfgApplication ixnApp = ReadApplicationLevelServerDetails(appDetails.AppServer.Name.ToString()); if (ixnApp != null && ixnApp.AppServers != null && ixnApp.AppServers.Count != 0) { //Get Email Server Name from Interaction connections Tab. foreach (CfgConnInfo ixnappDetail in ixnApp.AppServers) { if (ixnappDetail.AppServer.Type == CfgAppType.CFGEmailServer) { //Read application keys and values CfgApplication applicationObject = ReadApplicationLevelServerDetails(ixnappDetail.AppServer.Name.ToString().Trim()); if (applicationObject != null && applicationObject.Options.Keys.Count > 0) { // Get sections from Email Server foreach (string section in applicationObject.Options.AllKeys) { if (section.Contains("pop-client")) { comboBoxItem = new FromAddresses(); KeyValueCollection kvpPopClient = (KeyValueCollection)applicationObject.Options[section]; if (kvpPopClient != null && kvpPopClient.Keys.Count > 0 && kvpPopClient.AllKeys.Contains("address") && !string.IsNullOrEmpty(kvpPopClient["address"].ToString())) { comboBoxItem.Tag = kvpPopClient["address"].ToString(); comboBoxItem.Content = kvpPopClient["address"].ToString(); comboBoxItem.ToolTip = kvpPopClient["address"].ToString(); comboBoxItem.IsSelected = false; var getCount = EmailDataContext.GetInstance().MailBox.Where(x => x.Tag.ToString() == kvpPopClient["address"].ToString()); if (getCount.Count() <= 0) { EmailDataContext.GetInstance().MailBox.Add(comboBoxItem); } } } } } EmailDataContext.GetInstance().isFromAddressPopulated = true; } } } } } } } catch (Exception generalException) { logger.Error("Error Occurred while reading : getEmailServerFromAIDConnectionTab() " + applicationName + "=" + generalException.ToString()); } }
public KeyValueCollection ReadGeneralConfigurations(CfgApplication myApplication, List <CfgAgentGroup> agentGroups, CfgPerson personObject) { try { logger.Info("ReadGeneralConfigurations : Reading salesforce-integration Configuration"); KeyValueCollection SFDCConfig = null; #region Reading General Configurations try { if (myApplication != null) { //Reading Agent Level Configurations if (myApplication.Options.ContainsKey("salesforce-integration")) { SFDCConfig = myApplication.Options.GetAsKeyValueCollection("salesforce-integration"); this.logger.Info("ReadGeneralConfigurations : " + (SFDCConfig != null ? "Read Configuration at Application Level" : " No configuration found at Application Level")); } else { this.logger.Info("ReadGeneralConfigurations : SFDC General Configuration is not found at Application Level."); } } } catch (Exception generalException) { this.logger.Error("ReadGeneralConfigurations : Error occurred while reading configuration at application level :" + generalException.ToString()); } //Reading AgentGroupLevel Configurartions try { if (agentGroups != null) { foreach (CfgAgentGroup agentgroup in agentGroups) { if (agentgroup.GroupInfo.UserProperties.ContainsKey("salesforce-integration")) { KeyValueCollection agentGroupConfig = agentgroup.GroupInfo.UserProperties.GetAsKeyValueCollection("salesforce-integration"); if (agentGroupConfig != null) { if (SFDCConfig != null) { foreach (string key in agentGroupConfig.AllKeys) { if (SFDCConfig.ContainsKey(key)) { SFDCConfig.Set(key, agentGroupConfig.GetAsString(key)); } else { SFDCConfig.Add(key, agentGroupConfig.GetAsString(key)); } } } else { SFDCConfig = agentGroupConfig; } logger.Info("ReadGeneralConfigurations : SFDC configuration taken from Agent Group : " + agentgroup.GroupInfo.Name); break; } } else { logger.Info("ReadGeneralConfigurations : No SFDC configuration found at Agent Group : " + agentgroup.GroupInfo.Name); } } } } catch (Exception generalException) { this.logger.Error("ReadGeneralConfigurations : Error occurred while reading configuration at AgentGroup level :" + generalException.ToString()); } //Reading Agent Level Configurations try { if (personObject.UserProperties.ContainsKey("salesforce-integration")) { KeyValueCollection agentConfig = personObject.UserProperties.GetAsKeyValueCollection("salesforce-integration"); if (agentConfig != null) { if (SFDCConfig != null) { foreach (string key in agentConfig.AllKeys) { if (SFDCConfig.ContainsKey(key)) { SFDCConfig.Set(key, agentConfig.GetAsString(key)); } else { SFDCConfig.Add(key, agentConfig.GetAsString(key)); } } } else { SFDCConfig = agentConfig; } } } else { logger.Info("ReadGeneralConfigurations : No SFDC configuration found at Agent Level"); } } catch (Exception generalException) { this.logger.Error("ReadGeneralConfigurations : Error occurred while reading configuration at Agent level :" + generalException.ToString()); } #endregion Reading General Configurations if (SFDCConfig != null) { logger.Info("ReadGeneralConfigurations : General salesforce-integration Configuration Read : " + SFDCConfig.ToString()); } return(SFDCConfig); } catch (Exception generalException) { logger.Error("ReadGeneralConfigurations : Error Occurred while reading SFDC General Configuration : " + generalException.ToString()); } return(null); }
public OutputValues ConnectInteractionServer(CfgApplication primaryServer, CfgApplication secondayServer, string clientName) { OutputValues output = OutputValues.GetInstance(); var ixnserverconfProperties = new IxnServerConfProperties(); try { if (Settings.InteractionProtocol == null) { _logger.Debug("ConnectInteractionServer : Connecting to the Ixn server with the details of " + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port + " backup server " + secondayServer.ServerInfo.Port + ":" + secondayServer.ServerInfo.Port); ProtocolManagers.Instance().DisConnectServer(ServerType.Ixnserver); Settings.InteractionProtocol = null; ixnserverconfProperties.Create(new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port), clientName, InteractionClient.Proxy, new Uri("tcp://" + secondayServer.ServerInfo.Host.IPaddress + ":" + secondayServer.ServerInfo.Port), Convert.ToInt32(primaryServer.ServerInfo.Timeout), Convert.ToInt16(primaryServer.ServerInfo.Attempts), Convert.ToInt32(Settings.AddpServerTimeout), Convert.ToInt32(Settings.AddpClientTimeout), Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both); var ixnProtocolConfiguration = ixnserverconfProperties.Protocolconfiguration; string error = ""; if (!ProtocolManagers.Instance().ConnectServer(ixnProtocolConfiguration, out error)) { _logger.Error("Interaction protocol is not opened due to, " + error); output.MessageCode = "2001"; output.Message = error; return(output); } Settings.InteractionProtocol = ProtocolManagers.Instance().ProtocolManager[ixnProtocolConfiguration.Name] as InteractionServerProtocol; InteractionManager.EventCreated = false; Settings.InteractionProtocol.Received += InteractionManager.InteractionEvents; if (Settings.InteractionProtocol.State == ChannelState.Opened) { InteractionManager.isAfterConnect = true; _logger.Debug("ConnectInteractionServer : Interaction protocol is opened "); _logger.Info("ConnectInteractionServer : Interaction Protocol object id is " + Settings.InteractionProtocol.GetHashCode().ToString()); output.MessageCode = "200"; output.Message = "InteractionServer Connected"; } else { _logger.Warn("CreateInteractionConnection : Interaction protocol is closed "); } } else { _logger.Warn("Interaction Protocol status is " + Settings.InteractionProtocol.State.ToString()); } } catch (Exception commonException) { Settings.InteractionProtocol = null; _logger.Error("ConnectInteractionServer :" + commonException.ToString()); output.MessageCode = "2001"; output.Message = commonException.Message; } return(output); }
public OutputValues ConnectTServer(CfgApplication primaryServer, CfgApplication secondaryServer, bool switchoverServer = true) { OutputValues output = OutputValues.GetInstance(); var tServerConfProperties = new TServerConfProperties(); try { if (primaryServer != null) { ProtocolManagers.Instance().DisConnectServer(ServerType.Tserver); Settings.GetInstance().VoiceProtocol = null; logger.Debug("ConnectTServer : Applied primary server properties to Voice protocol"); logger.Debug("ConnectTServer : Primary server uri " + "tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port); if (secondaryServer != null) { logger.Debug("ConnectTServer : Applied secondary server properties to Voice protocol"); logger.Debug("ConnectTServer : Secondary server uri " + "tcp://" + secondaryServer.ServerInfo.Host.IPaddress + ":" + secondaryServer.ServerInfo.Port); } else { logger.Warn("ConnectTServer : Secondary server is not mentioned"); logger.Info("ConnectTServer : Application has no backup servers"); } tServerConfProperties.Create(new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port), Settings.GetInstance().UserName, new Uri("tcp://" + secondaryServer.ServerInfo.Host.IPaddress + ":" + secondaryServer.ServerInfo.Port), Convert.ToInt32(primaryServer.ServerInfo.Timeout), Convert.ToInt16(primaryServer.ServerInfo.Attempts), Convert.ToInt32(Settings.GetInstance().AddpServerTimeout), Convert.ToInt32(Settings.GetInstance().AddpClientTimeout), Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both); var TserverProtocolConfiguration = tServerConfProperties.Protocolconfiguration; string error = ""; if (!ProtocolManagers.Instance().ConnectServer(TserverProtocolConfiguration, out error)) { logger.Error("Tserver protocol is not opened due to, " + error); output.MessageCode = "2001"; output.Message = error; return(output); } Settings.GetInstance().VoiceProtocol = ProtocolManagers.Instance().ProtocolManager[TserverProtocolConfiguration.Name] as TServerProtocol; VoiceManager.EventCreated = false; Settings.GetInstance().VoiceProtocol.Received += VoiceManager.GetInstance().ReportingVoiceMessage; if (Settings.GetInstance().VoiceProtocol.State == ChannelState.Opened) { logger.Debug("ConnectTServer : Voice protocol is opened "); logger.Info("ConnectTServer : Voice Protocol object id is " + Settings.GetInstance().VoiceProtocol.GetHashCode().ToString()); output.MessageCode = "200"; output.Message = "TServer Connected"; } else { logger.Debug("CreateVoiceConnection : Voice protocol is closed "); } } else { Settings.GetInstance().VoiceProtocol = null; if (switchoverServer) { output = ConnectTServer(secondaryServer, primaryServer, false); } else { logger.Error("ConnectTServer : No primary server configured."); output.MessageCode = "2002"; output.Message = "No primary server configured. Could not able to connect T-server"; } } } catch (Exception CommonException) { Settings.GetInstance().VoiceProtocol = null; if (switchoverServer) { output = ConnectTServer(secondaryServer, primaryServer, false); } else { logger.Error("ConnectTServer :" + CommonException.ToString()); output.MessageCode = "2001"; output.Message = CommonException.Message; } } return(output); }
/// <summary> /// Reads the application object. /// </summary> /// <param name="applicationName">Name of the application.</param> /// <returns></returns> public CfgApplication ReadApplicationObject(string applicationName) { CfgApplication application = null; try { ChatConnectionSettings.GetInstance().TenantDBID = ConfigContainer.Instance().TenantDbId; application = new CfgApplication(ChatConnectionSettings.GetInstance().ComObject); CfgApplicationQuery queryApp = new CfgApplicationQuery(); // queryApp.TenantDbid = ChatConnectionSettings.GetInstance().TenantDBID; queryApp.Name = applicationName; application = ChatConnectionSettings.GetInstance().ComObject.RetrieveObject <CfgApplication>(queryApp); if (application != null) { if (application.Type == CfgAppType.CFGChatServer) { Settings.PrimaryApplication = application; if (Settings.PrimaryApplication != null) { Settings.PrimaryChatServerName = Settings.PrimaryApplication.Name; } Settings.SecondaryApplication = application.ServerInfo.BackupServer; if (Settings.SecondaryApplication == null) { Settings.SecondaryChatServerName = Settings.PrimaryChatServerName; Settings.SecondaryApplication = Settings.PrimaryApplication; } else { Settings.SecondaryChatServerName = Settings.SecondaryApplication.Name; } } else { Settings.PrimaryApplication = null; Settings.PrimaryChatServerName = string.Empty; Settings.SecondaryApplication = null; Settings.SecondaryChatServerName = string.Empty; } } if (ConfigContainer.Instance().AllKeys.Contains("CfgPerson")) { Settings.Person = ConfigContainer.Instance().GetValue("CfgPerson"); } if (ConfigContainer.Instance().AllKeys.Contains("chat.nickname")) { Settings.NickNameFormat = (string)ConfigContainer.Instance().GetValue("chat.nickname"); } if (ConfigContainer.Instance().AllKeys.Contains("client-timeout")) { Settings.AddpClientTimeout = (string)ConfigContainer.Instance().GetValue("client-timeout"); } if (ConfigContainer.Instance().AllKeys.Contains("server-timeout")) { Settings.AddpServerTimeout = (string)ConfigContainer.Instance().GetValue("server-timeout"); } if (ConfigContainer.Instance().AllKeys.Contains("chat.reconnect-attempts")) { Settings.WarmStandbyAttempts = (string)ConfigContainer.Instance().GetValue("chat.reconnect-attempts"); } if (ConfigContainer.Instance().AllKeys.Contains("chat.reconnect-timeout")) { Settings.WarmStandbyTimeout = (string)ConfigContainer.Instance().GetValue("chat.reconnect-timeout"); } } catch (Exception generalException) { logger.Error("Error occurred while reading application object" + applicationName + " = " + generalException.ToString()); } return(application); }
public CfgApplication ReadApplicationObject(string tserverApplicationName, string agentLogin) { CfgApplication application = null; try { string[] tServers = tserverApplicationName.Split(','); string primaryTserver = string.Empty; string secondaryTServer = string.Empty; int switchDBID = 0; if (tServers != null && tServers.Length > 0) { if (!string.IsNullOrEmpty(tServers[0])) { Settings.GetInstance().PrimaryTServerName = tServers[0].Trim().ToString(); } if (tServers.Length > 1 && !string.IsNullOrEmpty(tServers[1])) { Settings.GetInstance().SecondaryTServerName = tServers[1].Trim().ToString(); } } if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName) && string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName)) { Settings.GetInstance().SecondaryTServerName = Settings.GetInstance().PrimaryTServerName; } else if (!string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName) && string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName)) { Settings.GetInstance().PrimaryTServerName = Settings.GetInstance().SecondaryTServerName; } #region To get Correct switch application = new CfgApplication(_configContainer.ConfServiceObject); CfgApplicationQuery queryApp = new CfgApplicationQuery(); if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName)) { queryApp.Name = Settings.GetInstance().PrimaryTServerName; } application = _configContainer.ConfServiceObject.RetrieveObject <CfgApplication>(queryApp); //if (application != null) //{ // var _flexibleProperties = application.FlexibleProperties; // if (_flexibleProperties != null && _flexibleProperties.Count > 0) // { // if (_flexibleProperties.ContainsKey("CONN_INFO")) // { // var _connInfoCollection = _flexibleProperties["CONN_INFO"]; // if (_connInfoCollection != null) // { // var _switchCollection = (KeyValueCollection)_connInfoCollection; // if (_switchCollection != null && _switchCollection.ContainsKey("CFGSwitch")) // { // var _switchCollection1 = _switchCollection["CFGSwitch"]; // if (_switchCollection1 != null) // { // KeyValueCollection _switchDBIds = (KeyValueCollection)_switchCollection1; // if (_switchDBIds != null && _switchDBIds.Count > 0) // foreach (string id in _switchDBIds.AllKeys) // switchDBID = Convert.ToInt32(id); // } // } // } // } // } //} //CfgAgentLoginQuery _queryAGLogin = new CfgAgentLoginQuery(); //_queryAGLogin.LoginCode = agentLogin; //_queryAGLogin.TenantDbid = _configContainer.TenantDbId; //var agentInfo = (ICollection<CfgAgentLoginInfo>)((CfgPerson)_configContainer.GetValue("CfgPerson")).AgentInfo.AgentLogins; //foreach (var loginDetails in agentInfo) //{ // if (_queryAGLogin.LoginCode == loginDetails.AgentLogin.LoginCode && switchDBID == loginDetails.AgentLogin.Switch.DBID) // { // _queryAGLogin.Dbid = loginDetails.AgentLogin.DBID; // break; // } //} //CfgAgentLogin _cfgAGLogin = _configContainer.ConfServiceObject.RetrieveObject<CfgAgentLogin>(_queryAGLogin); //CfgApplication _cfgApplication = (_cfgAGLogin.Switch).TServer; //if (_cfgApplication == null) // logger.Warn("The switch name " + _cfgAGLogin.Switch.Name + " does not contains T-server configurations"); if (application != null) { //if (application.DBID == _cfgApplication.DBID) //{ Settings.GetInstance().PrimaryApplication = application; if (Settings.GetInstance().PrimaryApplication != null) { Settings.GetInstance().PrimaryTServerName = Settings.GetInstance().PrimaryApplication.Name; } Settings.GetInstance().SecondaryApplication = application.ServerInfo.BackupServer; if (Settings.GetInstance().SecondaryApplication == null) { Settings.GetInstance().SecondaryTServerName = Settings.GetInstance().PrimaryTServerName; Settings.GetInstance().SecondaryApplication = Settings.GetInstance().PrimaryApplication; } else { Settings.GetInstance().SecondaryTServerName = Settings.GetInstance().SecondaryApplication.Name; } //} //else //{ // Settings.GetInstance().PrimaryTServerName = string.Empty; // Settings.GetInstance().SecondaryTServerName = string.Empty; // Settings.GetInstance().PrimaryApplication = null; // Settings.GetInstance().SecondaryApplication = null; //} if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName)) { if (Settings.GetInstance().PrimaryApplication == null) { Settings.GetInstance().PrimaryApplication = ReadApplicationLevelServerDetails(Settings.GetInstance().PrimaryTServerName); } } if (!string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName)) { if (Settings.GetInstance().SecondaryApplication == null) { logger.Debug("Secondary server is retrieving from configured key"); Settings.GetInstance().SecondaryApplication = ReadApplicationLevelServerDetails(Settings.GetInstance().SecondaryTServerName); } if (Settings.GetInstance().PrimaryApplication == null && Settings.GetInstance().SecondaryApplication != null) { logger.Debug("Primary server is not configured, Secondary server is assigned to Primary server"); Settings.GetInstance().PrimaryApplication = Settings.GetInstance().SecondaryApplication; } } else { logger.Debug("secondary application name is not configured"); if (Settings.GetInstance().SecondaryApplication == null) { logger.Debug("Secondary server is not configured, primary server is assigned to secondary server"); Settings.GetInstance().SecondaryApplication = Settings.GetInstance().PrimaryApplication; } } if (_configContainer.AllKeys.Contains("interaction.disposition-collection.key-name") && ((string)_configContainer.GetValue("interaction.disposition-collection.key-name")) != string.Empty) { Settings.GetInstance().DispositionCollectionKey = ((string)_configContainer.GetValue("interaction.disposition-collection.key-name")); } if (_configContainer.AllKeys.Contains("interaction.disposition.key-name") && ((string)_configContainer.GetValue("interaction.disposition.key-name")) != string.Empty) { Settings.GetInstance().DispositionCodeKey = ((string)_configContainer.GetValue("interaction.disposition.key-name")); } if (_configContainer.AllKeys.Contains("login.voice.workmode") && ((string)_configContainer.GetValue("login.voice.workmode")) != string.Empty) { Settings.GetInstance().WorkMode = FindWorkMode((string)_configContainer.GetValue("login.voice.workmode")); } if (_configContainer.AllKeys.Contains("not-ready.request.attribute-name") && ((string)_configContainer.GetValue("not-ready.request.attribute-name")) != string.Empty) { Settings.GetInstance().NotReadyRequest = ((string)_configContainer.GetValue("not-ready.request.attribute-name")); } if (_configContainer.AllKeys.Contains("not-ready.code-name") && ((string)_configContainer.GetValue("not-ready.code-name")) != string.Empty) { Settings.GetInstance().NotReadyCodeKey = ((string)_configContainer.GetValue("not-ready.code-name")); } if (_configContainer.AllKeys.Contains("not-ready.key-name") && ((string)_configContainer.GetValue("not-ready.key-name")) != string.Empty) { Settings.GetInstance().NotReadyKey = ((string)_configContainer.GetValue("not-ready.key-name")); } if (_configContainer.AllKeys.Contains("attempts") && ((string)_configContainer.GetValue("attempts")) != string.Empty) { Settings.GetInstance().WarmStandbyAttempts = ((string)_configContainer.GetValue("attempts")); } if (_configContainer.AllKeys.Contains("client-timeout") && ((string)_configContainer.GetValue("client-timeout")) != string.Empty) { Settings.GetInstance().AddpClientTimeout = ((string)_configContainer.GetValue("client-timeout")); } if (_configContainer.AllKeys.Contains("log-off-enable") && ((string)_configContainer.GetValue("log-off-enable")) != string.Empty) { Settings.GetInstance().LogOffEnable = ((string)_configContainer.GetValue("log-off-enable")).ToLower().Equals("true") ? true : false; } if (_configContainer.AllKeys.Contains("server-timeout") && ((string)_configContainer.GetValue("server-timeout")) != string.Empty) { Settings.GetInstance().AddpServerTimeout = ((string)_configContainer.GetValue("server-timeout")); } if (_configContainer.AllKeys.Contains("call-control") && ((string)_configContainer.GetValue("call-control")) != string.Empty) { Settings.GetInstance().CallControl = ((string)_configContainer.GetValue("call-control")); } if (_configContainer.AllKeys.Contains("voice.enable.auto-answer") && ((string)_configContainer.GetValue("voice.enable.auto-answer")) != string.Empty) { Settings.GetInstance().IsAutoAnswerEnabled = ((string)_configContainer.GetValue("voice.enable.auto-answer")).ToLower().Equals("true") ? true : false; } if (_configContainer.AllKeys.Contains("voice.enable.delete-conf.call") && ((string)_configContainer.GetValue("voice.enable.delete-conf.call")) != string.Empty) { Settings.GetInstance().IsDeleteConfEnabled = ((string)_configContainer.GetValue("voice.enable.delete-conf.call")).ToLower().Equals("true") ? true : false; } } #endregion } catch (Exception commonException) { logger.Error("Error occurred while reading " + tserverApplicationName + " = " + commonException.ToString()); } return(application); }
/// <summary> /// Converts a PSDK Server Application to its CTI equivalent. /// </summary> /// <remarks> /// Duplicates similar code in <see cref="ApplicationAdapter"/> to avoid clutter. /// </remarks> /// <param name="server">The Server Application object to convert.</param> /// <returns>A <see cref="Server"/> object equivalent to the provided PSDK object.</returns> /// <exception cref="ArgumentException"> /// Throws if the provided <paramref name="server"/> Application is not really a server. /// </exception> public static Server ToServer(this CfgApplication server) => !(server.IsServer.IsTrue() ?? false)
/// <summary> /// Reads the file integration key collections. /// </summary> /// <param name="configProtocol">The configuration protocol.</param> /// <param name="applicationName">Name of the application.</param> /// <returns></returns> #region ReadFileIntegrationKeyCollections public iCallData ReadFileIntegrationKeyCollections(ConfService configProtocol, string applicationName) { iCallData result = null; string value = string.Empty; int paramKey = 0; try { result = new CallData(); result.FileData = new FileIntegration(); result.PortData = new PortIntegration(); result.PipeData = new PipeIntegration(); result.CrmDbData = new CrmDbIntegration(); CfgApplication application = new CfgApplication(configProtocol); CfgApplicationQuery queryApp = new CfgApplicationQuery(); //queryApp.TenantDbid = WellKnownDbids.EnterpriseModeTenantDbid; queryApp.Name = applicationName; application = configProtocol.RetrieveObject <CfgApplication>(queryApp); if (application != null) { string[] applicationKeys = application.Options.AllKeys; string[] applicationUserPropertieskeys = application.UserProperties.AllKeys; foreach (string section in applicationUserPropertieskeys) { if (string.Compare(section, "facet.user.data", true) == 0) { KeyValueCollection kvColl = new KeyValueCollection(); kvColl = (KeyValueCollection)application.UserProperties["facet.user.data"]; logger.Debug("Retrieving values from facet.user.data section"); setting.attachDataList.Clear(); if (kvColl != null) { for (int i = 1; i <= (kvColl.Count / 2); i++) { if (kvColl.ContainsKey("facet.userdata.key" + i.ToString())) { if (kvColl["facet.userdata.key" + i.ToString()].ToString() != null && kvColl["facet.userdata.key" + i.ToString()].ToString() != string.Empty) { if (kvColl.ContainsKey("facet.tag.name" + i.ToString())) { if (kvColl["facet.tag.name" + i.ToString()].ToString() != null && kvColl["facet.tag.name" + i.ToString()].ToString() != string.Empty) { if (!setting.attachDataList.ContainsKey(kvColl["facet.tag.name" + i.ToString()].ToString())) { setting.attachDataList.Add(kvColl["facet.tag.name" + i.ToString()].ToString(), kvColl["facet.userdata.key" + i.ToString()].ToString()); logger.Debug("Key : facet.tag.name" + i.ToString() + " Value : " + kvColl["facet.tag.name" + i.ToString()].ToString()); logger.Debug("Key : facet.userdata.key" + i.ToString() + " Value : " + kvColl["facet.userdata.key" + i.ToString()].ToString()); } } } } } } } } } ConfigContainer.Instance().ReadSection("file-integration"); if (ConfigContainer.Instance().AllKeys.Contains("file-integration")) { KeyValueCollection _tempcoll = ConfigContainer.Instance().GetValue("file-integration"); } foreach (string section in applicationKeys) { if (string.Compare(section, "file-integration", true) == 0 && Settings.GetInstance().EnableFileCommunication) { KeyValueCollection getFileIntegrationCollection = (KeyValueCollection)application.Options[section]; //code added by vinoth for bcbs version to show calldata pop up result.FileData.EnableView = true; //End foreach (string fileKey in getFileIntegrationCollection.AllKeys) { Regex re = new Regex(@"\d+"); Match m = re.Match(fileKey); if (m.Success) { paramKey = Convert.ToInt16(m.Value); } if (string.Compare(fileKey, "directory", true) == 0) { logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString()); result.FileData.DirectoryPath = getFileIntegrationCollection[fileKey].ToString(); } else if (string.Compare(fileKey, "file-name", true) == 0) { logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString()); result.FileData.FileName = getFileIntegrationCollection[fileKey].ToString(); } else if (string.Compare(fileKey, "file-format", true) == 0) { logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString()); result.FileData.FileFormat = getFileIntegrationCollection[fileKey].ToString(); } else if (string.Compare(fileKey, "file.string-delimiter", true) == 0) { logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString()); result.FileData.Delimiter = getFileIntegrationCollection[fileKey].ToString(); } else if (string.Compare(fileKey, "file.event.data-type", true) == 0) { logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString()); result.FileData.CallDataEventFileType = getFileIntegrationCollection[fileKey].ToString().Split(new char[] { ',' }); } else if (string.Compare(fileKey, "enable.view", true) == 0) { logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString()); result.FileData.EnableView = Convert.ToBoolean(getFileIntegrationCollection[fileKey].ToString()); } else if (string.Compare(fileKey, "content-type", true) == 0) { logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString()); result.FileData.ContentType = getFileIntegrationCollection[fileKey].ToString(); } //else if (string.Compare(fileKey, "file" + paramKey + ".attribute", true) == 0) //{ // value += getFileIntegrationCollection[fileKey].ToString() + ","; //} else if (string.Compare(fileKey, "file" + paramKey + ".param", true) == 0) { try { if (getFileIntegrationCollection.ContainsKey("file" + paramKey + ".user-data.key")) { result.FileData.ParameterName.Add(getFileIntegrationCollection[fileKey].ToString() , Convert.ToString(getFileIntegrationCollection["file" + paramKey + ".user-data.key"])); } } catch (Exception paramValue) { logger.Error("No value configured for given Parameter " + getFileIntegrationCollection[fileKey].ToString() + " " + paramValue.ToString()); } // paramKey++; } else if (string.Compare(fileKey, "file" + paramKey + ".attribute", true) == 0) { try { if (getFileIntegrationCollection.ContainsKey("file" + paramKey + ".attribute.param")) { result.FileData.ParameterValue.Add(getFileIntegrationCollection[fileKey].ToString() , Convert.ToString(getFileIntegrationCollection["file" + paramKey + ".attribute.param"])); } } catch (Exception paramValue) { logger.Error("No value configured for given Parameter " + getFileIntegrationCollection[fileKey].ToString() + " " + paramValue.ToString()); } // paramKey++; } } //result.FileData.AttributeFilter= value.ToString().Split(new char[] { ',' }); ; getFileIntegrationCollection.Clear(); value = string.Empty; } else if (string.Compare(section, "port-integration", true) == 0 && Settings.GetInstance().EnablePortCommunication) { KeyValueCollection getPortIntegrationCollection = (KeyValueCollection)application.Options[section]; // paramKey = 0; foreach (string portKey in getPortIntegrationCollection.AllKeys) { switch (portKey) { case "ip-address": setting.PortSetting.HostName = getPortIntegrationCollection[portKey].ToString(); break; case "receiving.data.port": setting.PortSetting.IncomingPortNumber = int.Parse(getPortIntegrationCollection[portKey].ToString()); break; case "sending.data.port": setting.PortSetting.OutGoingPortNumber = int.Parse(getPortIntegrationCollection[portKey].ToString()); break; case "port.send.delimiter": setting.PortSetting.SendDataDelimiter = getPortIntegrationCollection[portKey].ToString(); break; case "port.receive.delimiter": setting.PortSetting.ReceiveDataDelimiter = getPortIntegrationCollection[portKey].ToString(); break; case "port.call-media": setting.PortSetting.CallMedia = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(',')); break; case "port.listen.event": //if (!string.IsNullOrEmpty(getPortIntegrationCollection[portKey].ToString()) && !string.IsNullOrWhiteSpace(getPortIntegrationCollection[portKey].ToString())) setting.PortSetting.CallDataEventType = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(',')); break; case "port.receive.key-name": setting.PortSetting.ReceiveDatakey = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(',')); break; case "port.receive.connid-key-name": setting.PortSetting.ReceiveConnectionIdName = getPortIntegrationCollection[portKey].ToString(); break; case "port.webservicereference-url": setting.PortSetting.WebServiceURL = getPortIntegrationCollection[portKey].ToString(); break; } } //Code to get list of key names and param name for (int i = 0; true; i++) { string keyName = "port.attribute" + i + ".key-name"; string paramName = "port.attribute" + i + ".param-name"; if (getPortIntegrationCollection.ContainsKey(keyName) && getPortIntegrationCollection.ContainsKey(paramName)) { setting.PortSetting.SendAttributeKeyName.Add(getPortIntegrationCollection[keyName].ToString()); setting.PortSetting.SendAttributeValue.Add(getPortIntegrationCollection[paramName].ToString()); } else { break; } } //Code to get list of user data's key names and param name for (int j = 0; true; j++) { string keyName = "port.user-data" + j + ".key-name"; string paramName = "port.user-data" + j + ".param-name"; if (getPortIntegrationCollection.ContainsKey(keyName) && getPortIntegrationCollection.ContainsKey(paramName)) { setting.PortSetting.SendUserDataName.Add(getPortIntegrationCollection[keyName].ToString()); setting.PortSetting.SendUserDataValue.Add(getPortIntegrationCollection[paramName].ToString()); } else { break; } } getPortIntegrationCollection.Clear(); } else if (string.Compare(section, "pipe-integration", true) == 0 && Settings.GetInstance().EnablePipeCommunication) { //KeyValueCollection getPipeIntegrationCollection = (KeyValueCollection)application.Options[section]; ////paramKey = 0; //foreach (string pipeKey in getPipeIntegrationCollection.AllKeys) //{ // Regex re = new Regex(@"\d+"); // Match m = re.Match(pipeKey); // if (m.Success) // { // paramKey = Convert.ToInt16(m.Value); // } // if (string.Compare(pipeKey, "pipe.server-first", true) == 0) // { // logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString()); // result.PipeData.PipeFist = Convert.ToBoolean(getPipeIntegrationCollection[pipeKey].ToString().ToLower()); // } // else if (string.Compare(pipeKey, "pipe.name", true) == 0) // { // logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString()); // result.PipeData.PipeName = getPipeIntegrationCollection[pipeKey].ToString(); // } // else if (string.Compare(pipeKey, "pipe.string-delimiter", true) == 0) // { // logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString()); // result.PipeData.Delimiter = getPipeIntegrationCollection[pipeKey].ToString(); // } // else if (string.Compare(pipeKey, "pipe.format", true) == 0) // { // logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString()); // result.PipeData.FileFormat = getPipeIntegrationCollection[pipeKey].ToString(); // } // else if (string.Compare(pipeKey, "pipe.event.data-type", true) == 0) // { // logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString()); // result.PipeData.CallDataEventPipeType = getPipeIntegrationCollection[pipeKey].ToString().Split(new char[] { ',' }); // } // //else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0) // //{ // // value += getPipeIntegrationCollection[pipeKey].ToString() + ","; // //} // //else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0) // //{ // // value += getPipeIntegrationCollection[pipeKey].ToString() + ","; // //} // else if (string.Compare(pipeKey, "pipe" + paramKey + ".param", true) == 0) // { // try // { // if (getPipeIntegrationCollection.ContainsKey("pipe" + paramKey + ".user-data.key")) // result.PipeData.ParameterName.Add(getPipeIntegrationCollection[pipeKey].ToString() // , Convert.ToString(getPipeIntegrationCollection["pipe" + paramKey + ".user-data.key"])); // } // catch (Exception paramValue) // { // logger.Error("No value configured for given Parameter " + getPipeIntegrationCollection[pipeKey].ToString() + " " + paramValue.ToString()); // } // result.PipeData.ParameterName.Add(pipeKey, getPipeIntegrationCollection[pipeKey].ToString()); // // paramKey++; // } // else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0) // { // try // { // if (getPipeIntegrationCollection.ContainsKey("pipe" + paramKey + ".attribute.param")) // result.PipeData.ParameterValue.Add(getPipeIntegrationCollection[pipeKey].ToString() // , Convert.ToString(getPipeIntegrationCollection["pipe" + paramKey + ".attribute.param"])); // } // catch (Exception paramValue) // { // logger.Error("No value configured for given Parameter " + getPipeIntegrationCollection[pipeKey].ToString() + " " + paramValue.ToString()); // } // // paramKey++; // } //} //// result.PipeData.AttributeFilter = value.ToString().Split(new char[] { ',' }); ; //getPipeIntegrationCollection.Clear(); //value = string.Empty; } else if (string.Compare(section, "url-integration", true) == 0 && Settings.GetInstance().EnableURLCommunication) { //KeyValueCollection getUrlIntegrationCollection = (KeyValueCollection)application.Options[section]; //// paramKey = 0; //foreach (string urlKey in getUrlIntegrationCollection.AllKeys) //{ // Regex re = new Regex(@"\d+"); // Match m = re.Match(urlKey); // if (m.Success) // { // paramKey = Convert.ToInt16(m.Value); // } // if (string.Compare(urlKey, "enable.validate.queue-login", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.IsValidateQueueLogin = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString()); // } // else if (string.Compare(urlKey, "browser-type", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.BrowserType = getUrlIntegrationCollection[urlKey].ToString(); // } // else if (string.Compare(urlKey, "popup.url", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // string[] popurl = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' }); // result.URLData.PopUpUrl = popurl[0]; // } // else if (string.Compare(urlKey, "login.url", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // string[] popurl = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' }); // result.URLData.LoginUrl = popurl[0]; // } // else if (string.Compare(urlKey, "enable.login-popup-url", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.IsLoginUrlEnable = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString()); // } // else if (string.Compare(urlKey, "enable.web-page-address-bar", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.IsBrowserAddress = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString()); // } // else if (string.Compare(urlKey, "enable.web-page-status-bar", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.IsBrowserStatusBar = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString()); // } // else if (string.Compare(urlKey, "url.qs.delimiter", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.Delimiter = getUrlIntegrationCollection[urlKey].ToString(); // } // else if (string.Compare(urlKey, "url.event.data-type", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.CallDataEventUrlType = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' }); // } // else if (string.Compare(urlKey, "enable.web-page-inside-aid", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.IsWebPageEnabled = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString()); // } // else if (string.Compare(urlKey, "web-page.name-aid", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.WebPageName = getUrlIntegrationCollection[urlKey].ToString(); // } // else if (string.Compare(urlKey, "control.popup-single-browser", true) == 0) // { // logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString()); // result.URLData.IsSingleBrowser = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString()); // } // else if (string.Compare(urlKey, "url" + paramKey + ".param", true) == 0) // { // try // { // if (getUrlIntegrationCollection.ContainsKey("url" + paramKey + ".user-data.key")) // result.URLData.ParameterName.Add(getUrlIntegrationCollection[urlKey].ToString() // , Convert.ToString(getUrlIntegrationCollection["url" + paramKey + ".user-data.key"])); // } // catch (Exception paramValue) // { // logger.Error("No value configured for given Paramater " + getUrlIntegrationCollection[urlKey].ToString() + " " + paramValue.ToString()); // } // // paramKey++; // } // else if (string.Compare(urlKey, "url" + paramKey + ".attribute", true) == 0) // { // try // { // if (getUrlIntegrationCollection.ContainsKey("url" + paramKey + ".attribute.param")) // result.URLData.ParameterValue.Add(getUrlIntegrationCollection[urlKey].ToString() // , Convert.ToString(getUrlIntegrationCollection["url" + paramKey + ".attribute.param"])); // } // catch (Exception paramValue) // { // logger.Error("No value configured for given Paramater " + getUrlIntegrationCollection[urlKey].ToString() + " " + paramValue.ToString()); // } // // paramKey++; // } //} ////result.URLData .AttributeFilter = value.ToString().Split(new char[] { ',' }); ; //getUrlIntegrationCollection.Clear(); //value = string.Empty; } else if (string.Compare(section, "db-integration", true) == 0 && Settings.GetInstance().EnableCrmDbCommunication) { KeyValueCollection getCrmIntegrationCollection = (KeyValueCollection)application.Options[section]; //paramKey = 0; foreach (string portKey in getCrmIntegrationCollection.AllKeys) { Regex re = new Regex(@"\d+"); Match m = re.Match(portKey); if (m.Success) { paramKey = Convert.ToInt16(m.Value); } if (string.Compare(portKey, "db.sqlliteconnectionstring", true) == 0) { logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString()); result.CrmDbData.DirectoryPath = getCrmIntegrationCollection[portKey].ToString(); } else if (string.Compare(portKey, "db-type", true) == 0) { logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString()); result.CrmDbData.CrmDbFormat = getCrmIntegrationCollection[portKey].ToString(); } else if (string.Compare(portKey, "db.string-delimiter", true) == 0) { logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString()); result.CrmDbData.Delimiter = getCrmIntegrationCollection[portKey].ToString(); } else if (string.Compare(portKey, "db.sqlconnectionstring", true) == 0) { logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString()); result.CrmDbData.ConnectionSqlPath = getCrmIntegrationCollection[portKey].ToString(); } else if (string.Compare(portKey, "db.oracleconnectionstring", true) == 0) { logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString()); result.CrmDbData.ConnectionOraclePath = getCrmIntegrationCollection[portKey].ToString(); } else if (string.Compare(portKey, "db.event.data-type", true) == 0) { logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString()); result.CrmDbData.CallDataEventDBType = getCrmIntegrationCollection[portKey].ToString().Split(new char[] { ',' }); } //else if (string.Compare(portKey, "db" + paramKey + ".attribute", true) == 0) //{ // value += getCrmIntegrationCollection[portKey].ToString() + ","; //} else if (string.Compare(portKey, "db" + paramKey + ".param", true) == 0) { try { if (getCrmIntegrationCollection.ContainsKey("db" + paramKey + ".user-data.key")) { result.CrmDbData.ParameterName.Add(getCrmIntegrationCollection[portKey].ToString() , Convert.ToString(getCrmIntegrationCollection["db" + paramKey + ".user-data.key"])); } } catch (Exception paramValue) { logger.Error("No value configured for given Parameter " + getCrmIntegrationCollection[portKey].ToString() + " " + paramValue.ToString()); } // paramKey++; } else if (string.Compare(portKey, "db" + paramKey + ".attribute", true) == 0) { try { if (getCrmIntegrationCollection.ContainsKey("db" + paramKey + ".attribute.param")) { result.CrmDbData.ParameterValue.Add(getCrmIntegrationCollection[portKey].ToString() , Convert.ToString(getCrmIntegrationCollection["db" + paramKey + ".attribute.param"])); } } catch (Exception paramValue) { logger.Error("No value configured for given Parameter " + getCrmIntegrationCollection[portKey].ToString() + " " + paramValue.ToString()); } // paramKey++; } } //result.CrmDbData.AttributeFilter = value.ToString().Split(new char[] { ',' }); ; getCrmIntegrationCollection.Clear(); value = string.Empty; } } } } catch (Exception generalException) { logger.Error("Error occurred while reading KVP's for File Popup " + generalException.ToString()); } return(result); }
private ICollection GenesysCollection(dynamic dynamicObject) { Dictionary <string, Dictionary <string, List <Tuple <string, string, bool> > > > genesysProperties = new Dictionary <string, Dictionary <string, List <Tuple <string, string, bool> > > >(); //dynamic dynamicObject = retrievedObject; Type typeOfDynamic = dynamicObject.GetType(); if (typeOfDynamic.GetProperties().Any(p => p.Name.Equals("UserProperties"))) { Dictionary <string, List <Tuple <string, string, bool> > > genesysSection = new Dictionary <string, List <Tuple <string, string, bool> > >(); foreach (var option in dynamicObject.UserProperties) { List <Tuple <string, string, bool> > items = new List <Tuple <string, string, bool> >(); foreach (DictionaryEntry eachValue in (KeyValueCollection)option.Value) { items.Add(new Tuple <string, string, bool>(eachValue.Key.ToString(), eachValue.Value.ToString(), (eachValue.Value.ToString().StartsWith(PointerValue) && eachValue.Value.ToString().Length > 1 ? true : false))); } genesysSection.Add(option.Key.ToString(), items); } if (genesysSection.Count > 0) { genesysProperties.Add("UserProperties", genesysSection); } } if (typeOfDynamic.GetProperties().Any(p => p.Name.Equals("Options"))) { var gen = (KeyValueCollection)dynamicObject.Options["General"]; PointerValue = (gen != null) ? gen["Repoint Characters"].ToString() : ">"; Dictionary <string, List <Tuple <string, string, bool> > > genesysSection = new Dictionary <string, List <Tuple <string, string, bool> > >(); foreach (var option in dynamicObject.Options) { List <Tuple <string, string, bool> > items = new List <Tuple <string, string, bool> >(); foreach (DictionaryEntry eachValue in (KeyValueCollection)option.Value) { items.Add(new Tuple <string, string, bool>(eachValue.Key.ToString(), eachValue.Value.ToString(), (eachValue.Value.ToString().StartsWith(PointerValue) && eachValue.Value.ToString().Length > 1 ? true : false))); } genesysSection.Add(option.Key.ToString(), items); } if (genesysSection.Count > 0) { genesysProperties.Add("Options", genesysSection); } } if (typeOfDynamic.GetProperties().Any(p => p.Name.Equals("AppServers"))) { Dictionary <string, List <Tuple <string, string, bool> > > genesysSection = new Dictionary <string, List <Tuple <string, string, bool> > >(); foreach (CfgConnInfo nextServer in dynamicObject.AppServers) { List <Tuple <string, string, bool> > items = new List <Tuple <string, string, bool> >(); if ((nextServer.AppServer.State == CfgObjectState.CFGEnabled) && (nextServer.AppServer.IsPrimary == CfgFlag.CFGTrue) && (nextServer.AppServer.IsServer == CfgFlag.CFGTrue)) { CfgApplication server = nextServer.AppServer; items.Add(new Tuple <string, string, bool>(server.ServerInfo.Host.Name, server.ServerInfo.Port, false)); if (server.ServerInfo.BackupServer != null) { items.Add(new Tuple <string, string, bool>(server.ServerInfo.BackupServer.ServerInfo.Host.Name, server.ServerInfo.BackupServer.ServerInfo.Port, false)); } genesysSection.Add(server.Name, items); } } if (genesysSection.Count > 0) { genesysProperties.Add("AppServers", genesysSection); } } if (typeOfDynamic.GetProperties().Any(p => p.Name.Equals("Agents"))) { List <string> items = new List <string>(); foreach (var agent in dynamicObject.Agents) { items.Add(agent.UserName); } if (items.Count > 0) { //If we are requesting agents for a VAG then we should just return the section and not the whole genesys properties return(items); } } return(genesysProperties); }
private ConfigServer(string confServUriPri, string confServUriBack, string appName) { configServerPrimaryUri = confServUriPri; configServerBackupUri = confServUriBack; applicationConnectedTo = appName; int configServerAddpClientTimeout = 0, configServerAddpServerTimeout = 0; string configServerAddpTrace = ""; /*To get configuration server specific config (addp settings)*/ try { string path = Assembly.GetExecutingAssembly().Location; Configuration cfg = ConfigurationManager.OpenExeConfiguration(path); ApplicationSettings = new Dictionary <string, string>(); foreach (var setting in cfg.AppSettings.Settings.AllKeys) { ApplicationSettings.Add(setting, cfg.AppSettings.Settings[setting].Value); } configServerAddpClientTimeout = (ApplicationSettings.ContainsKey("ConfigServerAPPDClientTimeout")) ? Convert.ToInt32(ApplicationSettings["ConfigServerAPPDClientTimeout"]) : 30; configServerAddpServerTimeout = (ApplicationSettings.ContainsKey("ConfigServerADDPServerTimeout")) ? Convert.ToInt32(ApplicationSettings["ConfigServerADDPServerTimeout"]) : 30; configServerAddpTrace = (ApplicationSettings.ContainsKey("ConfigServerADDPTrace")) ? ApplicationSettings["ConfigServerADDPTrace"] : "both"; } catch (Exception ex) { TpsLogManager <MessageServer> .Error("Cannot read config values from configuration file: " + ex.Message); } Connect(applicationConnectedTo, configServerAddpClientTimeout, configServerAddpServerTimeout, configServerAddpTrace); while (!connected) { Thread.Sleep(1000); } SetPointerValue(); if (cfgApplication != null) { int port = 0; string host = ""; foreach (CfgConnInfo server in cfgApplication.AppServers) { if ((server.AppServer.Type != CfgAppType.CFGMessageServer) || (server.AppServer.State != CfgObjectState.CFGEnabled) || (server.AppServer.IsPrimary != CfgFlag.CFGTrue)) { continue; } CfgApplication messageServerApp = server.AppServer; port = Convert.ToInt32(messageServerApp.ServerInfo.Port); host = messageServerApp.ServerInfo.Host.Name; break; } int lcaPort = 4999; if (cfgApplication.ServerInfo != null) { if (cfgApplication.ServerInfo.Host != null) { if (cfgApplication.ServerInfo.Host.LCAPort != null) { lcaPort = Convert.ToInt32(cfgApplication.ServerInfo.Host.LCAPort); } } } if ((port != 0) && (!string.IsNullOrEmpty(host))) { SetUpMessageServer(appName, cfgApplication.DBID, lcaPort, host, port); } } }
private List <T> GetConfiguredIntegration <T>(string stringToMatch) { List <T> lstConfigurations = new List <T>(); CfgPerson person = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgPerson")) { person = ConfigContainer.Instance().GetValue("CfgPerson"); } List <CfgAgentGroup> agentGroup = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgAgentGroup")) { agentGroup = ConfigContainer.Instance().GetValue("CfgAgentGroup"); } CfgApplication application = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgApplication")) { application = ConfigContainer.Instance().GetValue("CfgApplication"); } if (application != null) { List <string> lstSections = new List <string>(); if (person != null && person.UserProperties != null) { foreach (string sectionName in person.UserProperties.AllKeys.Where(x => x.StartsWith(stringToMatch)).ToArray()) { lstSections.Add(sectionName); } } if (agentGroup != null) { for (int index = 0; index < agentGroup.Count; index++) { if (agentGroup[index].GroupInfo != null && agentGroup[index].GroupInfo.UserProperties != null) { foreach (string sectionName in agentGroup[index].GroupInfo.UserProperties.AllKeys.Where(x => x.StartsWith(stringToMatch)).ToArray()) { if (!lstSections.Contains(sectionName)) { lstSections.Add(sectionName); } } } } } foreach (string sectionName in application.Options.AllKeys.Where(x => x.StartsWith(stringToMatch)).ToArray()) { if (!lstSections.Contains(sectionName)) { lstSections.Add(sectionName); } } _logger.Trace("Number of web integration configured: " + lstSections.Count); for (int index = 0; index < lstSections.Count; index++) { KeyValueCollection section = null; if (application.Options.ContainsKey(lstSections[index])) { section = application.Options.GetAsKeyValueCollection(lstSections[index]); } if (person != null && person.UserProperties != null && person.UserProperties.ContainsKey(lstSections[index])) { section = person.UserProperties.GetAsKeyValueCollection(lstSections[index]); } else if (agentGroup != null) { for (int agentGroupIndex = 0; agentGroupIndex < agentGroup.Count; agentGroupIndex++) { if (agentGroup[agentGroupIndex].GroupInfo != null && agentGroup[agentGroupIndex].GroupInfo.UserProperties != null && agentGroup[agentGroupIndex].GroupInfo.UserProperties.ContainsKey(lstSections[index])) { section = agentGroup[agentGroupIndex].GroupInfo.UserProperties.GetAsKeyValueCollection(lstSections[index]); break; } } } if (section != null) { lstConfigurations.Add((T)Activator.CreateInstance(typeof(T), section)); } } } else { _logger.Warn("Application object is null"); } return(lstConfigurations); }
/// <summary> /// Its going to init the set of Web URL Integration. /// </summary> /// <param name="integrationMediaList">The integration media list.</param> private void InitWebUrlIntegration(System.Collections.Generic.Dictionary <string, bool> integrationMediaList = null) { System.Threading.Thread objThread = new System.Threading.Thread(() => { try { CfgApplication application = null; if (ConfigContainer.Instance().AllKeys.Contains("CfgApplication")) { application = ConfigContainer.Instance().GetValue("CfgApplication"); } if (application != null) { var file = Path.Combine(Path.Combine(System.Windows.Forms.Application.StartupPath, "Plugins"), "Pointel.Salesforce.Adapter.dll"); if (ConfigContainer.Instance().AllKeys.Contains("salesforce.enable.plugin") && ConfigContainer.Instance().GetAsBoolean("salesforce.enable.plugin") && File.Exists(file)) { if (application.Options.ContainsKey("salesforce-integration")) { KeyValueCollection salesforceSection = application.Options.GetAsKeyValueCollection("salesforce-integration"); if (salesforceSection.ContainsKey("sfdc.screen.popup") && salesforceSection.GetAsString("sfdc.screen.popup").ToLower() == "aid") { DesktopMessenger.totalWebIntegration += 1; } } } } List <WebIntegrationData> lstWebIntegration = GetConfiguredIntegration <WebIntegrationData>("web-integration."); //null; if (lstWebIntegration != null) { _logger.Trace("Number of web integration configured: " + lstWebIntegration.Count); for (byte index = 0; index < lstWebIntegration.Count; index++) { if (lstWebIntegration[index].IsEnableIntegration) { if (lstWebIntegration[index].ApplicationName.ToLower().Equals("lawson")) { if (integrationMediaList != null && integrationMediaList.ContainsKey("Lawson") && integrationMediaList["Lawson"]) { Settings.GetInstance().IsLawsonEnabled = integrationMediaList["Lawson"]; } else { continue; } } UrlSubscriber objUrlIntegration = new UrlSubscriber(lstWebIntegration[index]); if (lstWebIntegration[index].BrowserType == BrowserType.AID) { totalWebIntegration++; } objUrlIntegration.Subscribe(newCallDataProvider); } else { _logger.Warn("Integration disabled for the application '" + lstWebIntegration[index].ApplicationName + "'"); } } } } catch (Exception ex) { _logger.Error("Error occurred while subcribe URL Popup as " + ex.Message); } }); objThread.Start(); }
/// <summary> /// Reads the application object. /// </summary> /// <param name="applicationName">Name of the application.</param> /// <returns></returns> public CfgApplication ReadApplicationObject(string ixnAppName) { CfgApplication application = null; try { string[] tServers = ixnAppName.Split(','); string primaryTserver = string.Empty; string secondaryTServer = string.Empty; if (tServers != null && tServers.Length > 0) { if (!string.IsNullOrEmpty(tServers[0])) { Settings.PrimaryInteractionServerName = tServers[0].Trim().ToString(); } if (tServers.Length > 1 && !string.IsNullOrEmpty(tServers[1])) { Settings.SecondaryInteractionServerName = tServers[1].Trim().ToString(); } } if (!string.IsNullOrEmpty(Settings.PrimaryInteractionServerName) && string.IsNullOrEmpty(Settings.SecondaryInteractionServerName)) { Settings.SecondaryInteractionServerName = Settings.PrimaryInteractionServerName; } else if (!string.IsNullOrEmpty(Settings.SecondaryInteractionServerName) && string.IsNullOrEmpty(Settings.PrimaryInteractionServerName)) { Settings.PrimaryInteractionServerName = Settings.SecondaryInteractionServerName; } application = new CfgApplication(ConfigContainer.Instance().ConfServiceObject); CfgApplicationQuery queryApp = new CfgApplicationQuery(); queryApp.TenantDbid = WellKnownDbids.EnterpriseModeTenantDbid; if (!string.IsNullOrEmpty(Settings.PrimaryInteractionServerName)) { queryApp.Name = Settings.PrimaryInteractionServerName; } application = ConfigContainer.Instance().ConfServiceObject.RetrieveObject <CfgApplication>(queryApp); if (application != null) { if (application.Type == CfgAppType.CFGInteractionServer) { Settings.PrimaryApplication = application; Settings.PrimaryInteractionServerName = Settings.PrimaryApplication.Name; if (application.ServerInfo.BackupServer != null) { Settings.SecondaryApplication = application.ServerInfo.BackupServer; Settings.SecondaryInteractionServerName = Settings.SecondaryApplication.Name; } else { Settings.SecondaryApplication = Settings.PrimaryApplication; Settings.SecondaryInteractionServerName = Settings.PrimaryInteractionServerName; } } else { Settings.PrimaryInteractionServerName = string.Empty; Settings.SecondaryInteractionServerName = string.Empty; Settings.PrimaryApplication = null; Settings.SecondaryApplication = null; } if (_configContainer.AllKeys.Contains("interaction.reconnect-attempts") && ((string)_configContainer.GetValue("interaction.reconnect-attempts")) != string.Empty) { Settings.WarmStandbyAttempts = ((string)_configContainer.GetValue("interaction.reconnect-attempts")); } if (_configContainer.AllKeys.Contains("interaction.reconnect-timeout") && ((string)_configContainer.GetValue("interaction.reconnect-timeout")) != string.Empty) { Settings.WarmStandbyTimeout = ((string)_configContainer.GetValue("interaction.reconnect-timeout")); } if (_configContainer.AllKeys.Contains("interaction.server-timeout") && ((string)_configContainer.GetValue("interaction.server-timeout")) != string.Empty) { Settings.AddpServerTimeout = ((string)_configContainer.GetValue("interaction.server-timeout")); } if (_configContainer.AllKeys.Contains("interaction.client-timeout") && ((string)_configContainer.GetValue("interaction.client-timeout")) != string.Empty) { Settings.AddpClientTimeout = ((string)_configContainer.GetValue("interaction.client-timeout")); } } } catch (Exception commonException) { logger.Error("Error occurred while reading application object" + ixnAppName + " = " + commonException.ToString()); } return(application); }
/// <summary> /// Connects the contact server. /// </summary> /// <param name="primaryServer">The primary server.</param> /// <param name="secondaryServer">The secondary server.</param> /// <returns></returns> public OutputValues ConnectContactServer(CfgApplication primaryServer, CfgApplication secondaryServer, bool switchoverServer = true) { OutputValues output = OutputValues.GetInstance(); var ucsServerConfProperties = new UcsServerConfProperties(); try { if (Settings.UCSProtocol == null) { logger.Debug("ConnectContactServer : Applied primary server properties to UCS protocol"); logger.Debug("ConnectContactServer : Primary server uri " + "tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port); if (secondaryServer != null) { logger.Debug("ConnectContactServer : Applied secondary server properties to UCS protocol"); logger.Debug("ConnectContactServer : Secondary server uri " + "tcp://" + secondaryServer.ServerInfo.Host.IPaddress + ":" + secondaryServer.ServerInfo.Port); } else { logger.Warn("ConnectContactServer : Secondary server is not mentioned"); logger.Info("ConnectContactServer : Application has no backup servers"); } ProtocolManagers.Instance().DisConnectServer(ServerType.Ucserver); ucsServerConfProperties.Create(new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port), "", new Uri("tcp://" + secondaryServer.ServerInfo.Host.IPaddress + ":" + secondaryServer.ServerInfo.Port), Convert.ToInt32(primaryServer.ServerInfo.Timeout), Convert.ToInt16(primaryServer.ServerInfo.Attempts), Convert.ToInt32(Settings.AddpServerTimeout), Convert.ToInt32(Settings.AddpClientTimeout), Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both); var USCserverProtocolConfiguration = ucsServerConfProperties.Protocolconfiguration; string error = ""; if (!ProtocolManagers.Instance().ConnectServer(USCserverProtocolConfiguration, out error)) { logger.Error("Ucs protocol is not opened due to, " + error); output.MessageCode = "2001"; output.Message = error; return(output); } Settings.UCSProtocol = ProtocolManagers.Instance().ProtocolManager[USCserverProtocolConfiguration.Name] as UniversalContactServerProtocol; Settings.UCSProtocol.Opened += ContactConnectionManager_Opened; Settings.UCSProtocol.Closed += ContactConnectionManager_Closed; if (Settings.UCSProtocol.State == ChannelState.Opened) { ContactConnectionManager_Opened(null, null); logger.Warn("ConnectContactServer : Contact protocol is opened "); logger.Info("ConnectContactServer : Contact Protocol object id is " + Settings.UCSProtocol.GetHashCode().ToString()); output.MessageCode = "200"; output.Message = "ConnectContactServer Connected"; } else { logger.Warn("ConnectContactServer : Contact protocol is closed "); } } else { logger.Info("Contact Protocol status is " + Settings.UCSProtocol.State.ToString()); } } catch (Exception commonException) { Settings.UCSProtocol = null; if (switchoverServer) { output = ConnectContactServer(secondaryServer, primaryServer, false); } else { logger.Error("ConnectContactServer :" + commonException.ToString()); output.MessageCode = "2001"; output.Message = commonException.Message; } } return(output); }
private static ArgumentException InvalidServer(CfgApplication application, string paramName) => new ArgumentException($"The provided Application object ({application.Name}:{application.DBID}) is not a Server, and is invalid for this operation.", paramName);
public ApplicationTextVisitor(CfgApplication application, Visio.Characters chars) : base(chars) { this.application = application; }