/// <summary>
        /// Gets the plugin values.
        /// </summary>
        /// <param name="AppName">Name of the app.</param>
        /// <param name="ConfObject">The conf object.</param>
        /// <returns></returns>
        public OutputValues GetPluginValues(string AppName, ConfService ConfObject)
        {
            ReadApplication read   = new ReadApplication();
            OutputValues    output = OutputValues.GetInstance();

            try
            {
                logger.Debug("ConfigConnectionManager : GetPluginValues Method: Entry");
                StatisticsSetting.GetInstance().confObject = ConfObject;

                read.ReadLoggerDetails(AppName);
                output.MessageCode = "200";
                output.Message     = "Config Server Protocol Opened";
            }
            catch (Exception connectionException)
            {
                logger.Error("ConfigConnectionManager :GetPluginValues Method: " + connectionException.Message.ToString());
            }
            finally
            {
                logger.Debug("ConfigConnectionManager : GetPluginValues Method: Exit");
                GC.Collect();
            }

            return(output);
        }
        /// <summary>
        /// Connects the config server.
        /// </summary>
        /// <param name="ConfigServerHost">The config server host.</param>
        /// <param name="ConfigServerPort">The config server port.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        public OutputValues ConnectConfigServer(string ConfigServerHost, string ConfigServerPort,
                                                string userName, string password, string clientName, string logUserName)
        {
            EventBrokerService comEventBrokerService;
            OutputValues       output = OutputValues.GetInstance();
            ReadApplication    read   = new ReadApplication();

            try
            {
                StatisticsSetting.GetInstance().logUserName = logUserName;
                logger.Debug("ConfigConnectionManager : ConnectConfigServer Method: Entry");
                if (StatisticsSetting.GetInstance().protocolManager == null)
                {
                    StatisticsSetting.GetInstance().configurationProperties = new ConfServerConfiguration("config");
                    StatisticsSetting.GetInstance().protocolManager         = new ProtocolManagementService();

                    //Primary Server settings
                    StatisticsSetting.GetInstance().configurationProperties.Uri = new Uri("tcp://" + ConfigServerHost + ":"
                                                                                          + ConfigServerPort);
                    StatisticsSetting.GetInstance().configurationProperties.ClientApplicationType = CfgAppType.CFGAgentDesktop;
                    StatisticsSetting.GetInstance().configurationProperties.ClientName = clientName;
                    StatisticsSetting.GetInstance().configurationProperties.UserName = userName;
                    StatisticsSetting.GetInstance().configurationProperties.UserPassword = password;

                    //Set ADDP
                    StatisticsSetting.GetInstance().configurationProperties.UseAddp = true;
                    StatisticsSetting.GetInstance().configurationProperties.AddpServerTimeout = 30;
                    StatisticsSetting.GetInstance().configurationProperties.AddpClientTimeout = 60;

                    //Open the connection
                    try
                    {
                        StatisticsSetting.GetInstance().protocolManager.Register(StatisticsSetting.GetInstance().configurationProperties);
                    }
                    catch (Exception generalException)
                    {
                        output.MessageCode = "2001";
                        output.Message     = (generalException.InnerException == null ? generalException.Message : generalException.InnerException.Message);
                        logger.Error("ConfigConnectionManager : ConnectConfigServer Method: " + generalException.Message.ToString());
                        return(output);
                    }

                    StatisticsSetting.GetInstance().protocolManager[StatisticsSetting.ConfServer].Open();

                    comEventBrokerService = new EventBrokerService(StatisticsSetting.GetInstance().protocolManager.Receiver);
                    comEventBrokerService.Activate();

                    //comEventBrokerService.Register(OnConfEventError);
                    //comEventBrokerService.Register(OnConfEventObjectsRead);
                    //comEventBrokerService.Register(OnConfEventObjectsSent);

                    //KeyValueCollection filterKey = new KeyValueCollection();
                    //filterKey.Add("switch_dbid", 102);
                    //filterKey.Add("dn_type", (int)CfgDNType.CFGExtension);
                    //RequestReadObjects requestReadObjects = RequestReadObjects.Create((int)CfgObjectType.CFGDN, filterKey);
                    //StatisticsSetting.GetInstance().protocolManager[StatisticsSetting.ConfServer].Send(requestReadObjects);

                    if (StatisticsSetting.GetInstance().confObject == null)
                    {
                        StatisticsSetting.GetInstance().confObject = (ConfService)ConfServiceFactory.CreateConfService(
                            StatisticsSetting.GetInstance().protocolManager[StatisticsSetting.ConfServer] as ConfServerProtocol,
                            comEventBrokerService, true);
                    }

                    //NotificationQuery NQuery=new NotificationQuery();
                    //NQuery.ObjectType=CfgObjectType.CFGPerson;

                    //StatisticsSetting.GetInstance().confObject.Subscribe(NQuery);

                    if (StatisticsSetting.GetInstance().protocolManager[StatisticsSetting.ConfServer].State == ChannelState.Opened)
                    {
                        StatisticsSetting.GetInstance().confProtocol = (ConfServerProtocol)StatisticsSetting.GetInstance().protocolManager[StatisticsSetting.ConfServer];

                        read.ReadLoggerDetails(StatisticsSetting.GetInstance().AppName);
                        output.MessageCode = "2000";
                        output.Message     = "Config Server Protocol Opened";
                        logger.Trace("ConfigConnectionManager : ConnectConfigServer Method: Config Server Protocol Opened");
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Config Server Protocol Closed";
                        logger.Warn("ConfigConnectionManager : ConnectConfigServer Method: Config Server Protocol Closed");
                    }
                }
            }
            catch (Exception connectionException)
            {
                logger.Error("ConfigConnectionManager : ConnectConfigServer Method: " + connectionException.Message.ToString());
                output.MessageCode = "2001";
                output.Message     = (connectionException.InnerException == null ? connectionException.Message : connectionException.InnerException.Message);
            }
            finally
            {
                logger.Debug("ConfigConnectionManager : ConnectConfigServer Method: Exit");
                //StatisticsSetting.GetInstance().protocolManager = null;
                GC.Collect();
            }
            return(output);
        }
        public void InitializeIntegration(ConfService confProtocol, string applicationName, System.Collections.Generic.Dictionary <string, bool> integrationMediaList = null)
        {
            Thread newThread = new Thread(() =>
            {
                _logger.Info("**********************************************************************************************************************");
                _logger.Info("Pointel.Integration.Core :" + Assembly.GetExecutingAssembly().GetName().Version);
                _logger.Info("***********************************************************************************************************************");
                _logger.Info("Retrieving Values from Application third party integration start.");
                ReadApplication readApplication = new ReadApplication();
                Settings settings = Settings.GetInstance();

                try
                {
                    readApplication.ReadIntegrationDecisionKeyCollections();
                    callData = readApplication.ReadFileIntegrationKeyCollections(confProtocol, applicationName);
                    readApplication.ReadApplicationValue(confProtocol, applicationName);
                    newCallDataProvider = new CallDataProviders();

                    if (settings.EnableFileCommunication)
                    {
                        InitFileIntegration();
                    }
                    else
                    {
                        _logger.Warn("File Communication Disabled");
                    }

                    if (settings.EnablePortCommunication)
                    {
                        try
                        {
                            portSubscriber = new PortSubscriber();
                            portSubscriber.Subscribe(newCallDataProvider);
                            callData.PortData.Decision = IntegrationAction.Open;
                            newCallDataProvider.NewCallData(callData);
                        }
                        catch (Exception ex)
                        {
                            _logger.Error("Error occurred while subcribe Port as " + ex.Message);
                        }
                    }
                    else
                    {
                        _logger.Info("Port integration disabled.");
                    }

                    if (settings.EnablePipeCommunication)
                    {
                        InitPipeIntegration();
                    }
                    else
                    {
                        _logger.Info("Pipe integration disabled.");
                    }

                    if (settings.EnableURLCommunication)
                    {
                        InitWebUrlIntegration(integrationMediaList);
                    }
                    else
                    {
                        _logger.Info("URL integration disabled.");
                    }

                    if (settings.EnableCrmDbCommunication)
                    {
                        try
                        {
                            crmDbSubscriber = new CrmDbSubscriber();
                            crmDbSubscriber.Subscribe(newCallDataProvider);
                        }
                        catch (Exception ex)
                        {
                            _logger.Error("Error occurred while subcribe DB Communication as " + ex.Message);
                        }
                    }
                    else
                    {
                        _logger.Info("Database integration disabled");
                    }

                    if (ConfigContainer.Instance().AllKeys.Contains("voice.enable.agent-activity-db-integration") && ConfigContainer.Instance().GetAsBoolean("voice.enable.agent-activity-db-integration"))
                    {
                        try
                        {
                            var agentActivitySubscriber = new AgentActivitySubscriber();
                            agentActivitySubscriber.Subscribe(newCallDataProvider);
                        }
                        catch (Exception ex)
                        {
                            _logger.Error("Error occurred while subcribe DB Communication as " + ex.Message);
                        }
                    }
                    else
                    {
                        _logger.Info("Agent interaction activity disabled");
                    }


                    ISoftphoneListener softSubscriber = new DesktopMessenger();
                    SoftPhone softPhone = new SoftPhone();
                    softPhone.Subscribe(softSubscriber, Softphone.Voice.SoftPhoneSubscriber.Integration);

                    StartHIMMSIntegration();
                }
                catch (Exception generalException)
                {
                    _logger.Error("Error occurred while reading integration part from the application " + generalException.ToString());
                }
            }); newThread.Start();
        }