public OutputValues Login(string place, string userName, string workMode, string queue, string agentLoginId, string agentPassword) { logger.Debug("SoftPhone Login:"******"*********************************************"); logger.Debug("Place: " + place + Environment.NewLine + "UserName: "******"WorkMode: " + workMode + Environment.NewLine + "Queue: " + queue + Environment.NewLine + "AgentLoginId: " + agentLoginId); logger.Debug("*********************************************"); var output = new OutputValues(); //Input Validation CheckException.CheckLoginValues(place, userName); //Authenticate User Settings.GetInstance().QueueName = queue; CheckException.CheckDN(Settings.GetInstance().ACDPosition, Settings.GetInstance().ExtensionDN, Settings.GetInstance().PlaceName); EventRegistered evenReg = null; string fullName = ""; if (Settings.GetInstance().ACDPosition == Settings.GetInstance().ExtensionDN) { var message = RegisterDNRequest(Settings.GetInstance().ExtensionDN); if (message != null) { switch (message.Id) { case EventRegistered.MessageId: evenReg = message as EventRegistered; string AID = string.IsNullOrEmpty(evenReg.AgentID) ? "" : evenReg.AgentID; if (CheckPlcaeTaken(AID, out fullName)) { if (Settings.GetInstance().ACDPosition == Settings.GetInstance().ExtensionDN) { Pointel.Softphone.Voice.Core.Request.RequestUnRegisterPlace.UnRegisterDN(Settings.GetInstance().ExtensionDN); } else { Pointel.Softphone.Voice.Core.Request.RequestUnRegisterPlace.UnRegisterDN(Settings.GetInstance().ACDPosition); Pointel.Softphone.Voice.Core.Request.RequestUnRegisterPlace.UnRegisterDN(Settings.GetInstance().ExtensionDN); } output.MessageCode = "2004"; output.Message = "Place is already taken by " + fullName + "."; return(output); } AssignPreAgentStatus(evenReg); AssignPreCallStatus(evenReg); Settings.GetInstance().IsDNRegistered = true; break; case EventError.MessageId: Settings.GetInstance().IsDNRegistered = false; break; } } Register(Settings.GetInstance().ExtensionDN); } else { var message = RegisterDNRequest(Settings.GetInstance().ACDPosition); if (message != null) { switch (message.Id) { case EventRegistered.MessageId: evenReg = message as EventRegistered; string AID = string.IsNullOrEmpty(evenReg.AgentID) ? "" : evenReg.AgentID; if (CheckPlcaeTaken(AID, out fullName)) { if (Settings.GetInstance().ACDPosition == Settings.GetInstance().ExtensionDN) { Pointel.Softphone.Voice.Core.Request.RequestUnRegisterPlace.UnRegisterDN(Settings.GetInstance().ExtensionDN); } else { Pointel.Softphone.Voice.Core.Request.RequestUnRegisterPlace.UnRegisterDN(Settings.GetInstance().ACDPosition); //Pointel.Softphone.Voice.Core.Request.RequestUnRegisterPlace.UnRegisterDN(Settings.GetInstance().ExtensionDN); } output.MessageCode = "2004"; output.Message = "Place is already taken by " + fullName + "."; return(output); } AssignPreAgentStatus(evenReg); Settings.GetInstance().IsDNRegistered = true; break; case EventError.MessageId: Settings.GetInstance().IsDNRegistered = false; break; } } IMessage message1 = RegisterDNRequest(Settings.GetInstance().ExtensionDN); if (message1 != null) { switch (message1.Id) { case EventRegistered.MessageId: evenReg = message as EventRegistered; AssignPreCallStatus(evenReg); Settings.GetInstance().IsDNRegistered = true; break; case EventError.MessageId: Settings.GetInstance().IsDNRegistered = false; break; } } Register(Settings.GetInstance().ACDPosition); Register(Settings.GetInstance().ExtensionDN); } if (!Settings.GetInstance().ISAlreadyLogin&& Settings.GetInstance().IsDNRegistered) { output = RequestLogin.LoginAgent(workMode, queue, agentLoginId, agentPassword); } else if (Settings.GetInstance().ISAlreadyLogin) { output.MessageCode = "201"; output.Message = "Agent Login Success"; } if (output.MessageCode == "200") { output.Message = "Agent Login Success"; } return(output); }