Exemplo n.º 1
0
        /// <summary>
        /// Refines the place.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="placeName">Name of the place.</param>
        /// <param name="agentLoginID">The agent login identifier.</param>
        /// <param name="queueName">Name of the queue.</param>
        /// <param name="agentPassword">The agent password.</param>
        /// <param name="workMode">The work mode.</param>
        /// <returns></returns>
        public OutputValues RefinePlace(string userName, string placeName, string agentLoginID, string queueName, string agentPassword, string workMode)
        {
            var output = OutputValues.GetInstance();
            var read   = new ReadConfigObjects();

            try
            {
                Settings.GetInstance().PlaceName = placeName;
                output = read.ReadPlaceObject();
                if (output.MessageCode == "200")
                {
                    if (Settings.GetInstance().VoiceProtocol != null && Settings.GetInstance().VoiceProtocol.State == ChannelState.Opened)
                    {
                        output = Login(placeName, userName, workMode, queueName, agentLoginID, agentPassword);
                    }
                }
                return(output);
            }
            catch (Exception generalException)
            {
                output.MessageCode = "2001";
                output.Message     = "Error occurred in Softphone RefinePlace() : " + generalException.ToString();
                logger.Error("Softphone_RefinePlace:" + generalException.ToString());
                return(output);
            }
        }
Exemplo n.º 2
0
        public OutputValues Initialize(string place, string userName, ConfService configObject, string tServerApplicationName, string agentLoginId, string agentPassword,
                                       CfgSwitch switchType)
        {
            Settings.GetInstance().AgentLoginID   = agentLoginId;
            Settings.GetInstance().Switch         = switchType;
            Settings.GetInstance().SwitchTypeName = switchType.Type == CfgSwitchType.CFGLucentDefinityG3 ?
                                                    "avaya" :
                                                    ((switchType.Type == CfgSwitchType.CFGNortelDMS100 || switchType.Type == CfgSwitchType.CFGNortelMeridianCallCenter) ? "nortel" : "avaya");
            var output  = OutputValues.GetInstance();
            var connect = new VoiceConnectionManager();
            var read    = new ReadConfigObjects();

            //Print DLL Info
            try
            {
                Assembly assemblyVersion = Assembly.LoadFrom(Environment.CurrentDirectory + @"\Pointel.Softphone.Voice.dll");
                if (assemblyVersion != null)
                {
                    logger.Debug("*********************************************");
                    logger.Debug(assemblyVersion.GetName().Name + " : " + assemblyVersion.GetName().Version);
                    logger.Debug("*********************************************");
                }
            }
            catch (Exception versionException)
            {
                logger.Error("Error occurred while getting the version of the SoftPhone library " + versionException.ToString());
            }

            try
            {
                //ConnectionSettings.comObject = configObject;
                //Get Place details
                Settings.GetInstance().PlaceName = place;
                Settings.GetInstance().UserName  = userName;
                output = read.ReadPlaceObject();
                //Read Person Details
                //output = read.ReadPersonObject(userName);
                read.ReadApplicationObject(tServerApplicationName, agentLoginId);
            }
            catch (Exception inputException)
            {
                logger.Error("Error occurred while login into SoftPhone " + inputException);
            }

            //Input Validation
            CheckException.CheckLoginValues(place, userName);
            if (output.MessageCode == "200")
            {
                //Register with TServer
                output = connect.ConnectTServer(Settings.GetInstance().PrimaryApplication, Settings.GetInstance().SecondaryApplication);

                if (output.MessageCode != "200")
                {
                    logger.Debug("Protocol is not opened, try to connect with server config keys");
                    if (Settings.GetInstance().VoiceProtocol != null && Settings.GetInstance().VoiceProtocol.State != ChannelState.Opened)
                    {
                        if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName))
                        {
                            logger.Debug("Primary TServer name : " + Settings.GetInstance().PrimaryTServerName);
                            Settings.GetInstance().PrimaryApplication = read.ReadApplicationLevelServerDetails(Settings.GetInstance().PrimaryTServerName);
                        }
                        if (!string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName))
                        {
                            logger.Debug("Secondary TServer name : " + Settings.GetInstance().SecondaryTServerName);
                            Settings.GetInstance().SecondaryApplication = read.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;
                            }
                        }

                        //connect with server names from options tab
                        output = connect.ConnectTServer(Settings.GetInstance().PrimaryApplication, Settings.GetInstance().SecondaryApplication);
                    }
                    else
                    {
                        return(output);
                    }
                }
            }

            return(output);
        }