Esempio n. 1
0
        public void AdicionarDadosLigacao(Dictionary<String, String> dadosUsuario)
        {
            try
            {
                EnviaMensagemSignalR("ServidorCTI", this.PA + ", " + this.AgentID + ", " + this.PasswordAgentID + ", " + this.Queue);
                Genesyslab.Platform.Commons.Collections.KeyValueCollection kvColl = new Genesyslab.Platform.Commons.Collections.KeyValueCollection();
                kvColl.Add(dadosUsuario);

                Genesyslab.Platform.Voice.Protocols.ConnectionId currentConnId = connIdAnswered;
                if (connIdTransfer != null)
                    currentConnId = connIdTransfer;

                RequestAttachUserData raud = RequestAttachUserData.Create(this.PA, currentConnId, kvColl);
                pmsTServer[TSERVER_IDENTIFIER].Send(raud);
            }
            catch (Exception ex)
            {
                EnviaMensagemSignalR("ServidorCTI-Erro", "AdicionarDadosLigacao(...) - EncaminharPara: " + ex.Message);
            }
        }
        /// <summary>
        /// Transfers the chat session.
        /// </summary>
        /// <param name="interactionId">The interaction identifier.</param>
        /// <param name="agentId">The agent identifier.</param>
        /// <param name="placeId">The place identifier.</param>
        /// <param name="proxyId">The proxy identifier.</param>
        /// <param name="queueName">Name of the queue.</param>
        /// <returns></returns>
        public static Pointel.Interactions.Chat.Core.General.OutputValues TransferChatSession(string interactionId, string agentId, string placeId, int proxyId, string queueName, Genesyslab.Platform.Commons.Collections.KeyValueCollection userData)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            Pointel.Interactions.Chat.Core.General.OutputValues output = Pointel.Interactions.Chat.Core.General.OutputValues.GetInstance();
            try
            {
                if (!string.IsNullOrEmpty(placeId) && !string.IsNullOrEmpty(agentId))
                {
                    Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestTransfer requestTransfer = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestTransfer.Create();
                    requestTransfer.Extension     = userData;
                    requestTransfer.InteractionId = interactionId;
                    requestTransfer.ProxyClientId = proxyId;
                    requestTransfer.PlaceId       = placeId;
                    requestTransfer.AgentId       = agentId;
                    if (Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol != null && Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol.State == Genesyslab.Platform.Commons.Protocols.ChannelState.Opened)
                    {
                        Genesyslab.Platform.Commons.Protocols.IMessage message = Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol.Request(requestTransfer);
                        if (message != null)
                        {
                            switch (message.Id)
                            {
                            case Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck.MessageId:
                                Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck eventack = (Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck)message;
                                logger.Info("------------TransferChatSession-------------");
                                logger.Info("InteractionId  :" + interactionId);
                                logger.Info("ProxyClientId    :" + proxyId);
                                logger.Info("AgentId    :" + agentId);
                                logger.Info("PlaceId    :" + placeId);
                                logger.Info("--------------------------------------------");
                                logger.Trace(eventack.ToString());
                                output.MessageCode = "200";
                                output.Message     = "Transfer Chat Session Successful";
                                break;

                            case Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventError.MessageId:
                                Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventError eventError = (Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventError)message;
                                string LoginErrorCode        = Convert.ToString(eventError.ErrorCode);
                                string LoginErrorDescription = Convert.ToString(eventError.ErrorDescription);
                                logger.Info("------------TransferChatSession-------------");
                                logger.Error(LoginErrorCode + ":" + LoginErrorDescription);
                                logger.Info("--------------------------------------------");
                                logger.Trace(eventError.ToString());
                                output.MessageCode = "2001";
                                output.Message     = LoginErrorDescription;
                                break;
                            }
                        }
                    }
                    else
                    {
                        logger.Warn("TransferChatSession() : Interaction Server protocol is Null..");
                    }
                }
                else if (!string.IsNullOrEmpty(queueName))
                {
                    Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestChangeProperties requestChangeProperties = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestChangeProperties.Create();
                    Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestPlaceInQueue     requestPlaceInQueue     = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestPlaceInQueue.Create();
                    Genesyslab.Platform.Commons.Collections.KeyValueCollection attachData = new Genesyslab.Platform.Commons.Collections.KeyValueCollection();
                    attachData.Add("ChatSkills", queueName);
                    requestChangeProperties.ChangedProperties = attachData;
                    requestChangeProperties.InteractionId     = interactionId;
                    requestChangeProperties.ProxyClientId     = proxyId;
                    requestPlaceInQueue.InteractionId         = interactionId;
                    requestPlaceInQueue.Queue           = queueName;
                    requestPlaceInQueue.ProxyClientId   = proxyId;
                    requestPlaceInQueue.AddedProperties = attachData;

                    if (Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol != null && Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol.State == Genesyslab.Platform.Commons.Protocols.ChannelState.Opened)
                    {
                        Genesyslab.Platform.Commons.Protocols.IMessage message = Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol.Request(requestPlaceInQueue);
                        if (message != null)
                        {
                            switch (message.Id)
                            {
                            case Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck.MessageId:
                                Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck eventAck = (Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck)message;
                                logger.Info("------------Chat Transfer Interaction By Queue-------------");
                                logger.Info("InteractionId  :" + interactionId);
                                logger.Info("ProxyClientId    :" + proxyId);
                                logger.Info("QueueName    :" + queueName);
                                logger.Info("----------------------------------------------------------");
                                logger.Trace(eventAck.ToString());
                                output.MessageCode = "200";
                                output.Message     = "Chat Transfer interaction Successful";
                                break;

                            case Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventError.MessageId:
                                Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventError eventError = (Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventError)message;
                                logger.Info("------------Error on Chat Transfer Interaction By Queue-------------");
                                logger.Info("InteractionId  :" + interactionId);
                                logger.Info("ProxyClientId    :" + proxyId);
                                logger.Info("QueueName    :" + queueName);
                                logger.Info("-------------------------------------------------------------------");
                                logger.Trace(eventError.ToString());
                                output.MessageCode = "2001";
                                output.Message     = Convert.ToString(eventError.ErrorDescription);
                                logger.Error("Error occurred while chat transferring  interaction : " + Convert.ToString(eventError.ErrorDescription));
                                break;
                            }
                        }
                        else
                        {
                            output.MessageCode = "2001";
                            output.Message     = "Chat Transfer Interaction UnSuccessful";
                        }
                        logger.Info("------------TransferChatSession-------------");
                        logger.Info("InteractionId  :" + interactionId);
                        logger.Info("ProxyClientId    :" + proxyId);
                        logger.Info("QueueName    :" + queueName);
                        logger.Info("--------------------------------------------");
                        logger.Info(requestChangeProperties.ToString());
                        logger.Info(requestPlaceInQueue.ToString());
                    }
                    else
                    {
                        logger.Warn("TransferChatSession() : Interaction Server protocol is Null..");
                    }
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Transfer Chat Session request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
Esempio n. 3
0
        public static Pointel.Softphone.Voice.Common.OutputValues AgentNotReady(string reason, string code, bool isSolicited)
        {
            var logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            var output = Pointel.Softphone.Voice.Common.OutputValues.GetInstance();

            try
            {
                var requestAgentNotReady = Genesyslab.Platform.Voice.Protocols.TServer.Requests.Agent.RequestAgentNotReady.Create(Settings.GetInstance().ACDPosition, Settings.GetInstance().WorkMode);

                var ReasonCode = new Genesyslab.Platform.Commons.Collections.KeyValueCollection();

                //Code Added to check whether send configurable reason key and code/default key and code to tserver
                //27.09.2013 V.Palaniappan
                if (!string.IsNullOrEmpty(Settings.GetInstance().NotReadyKey))
                {
                    ReasonCode.Add(Settings.GetInstance().NotReadyKey, reason);
                }
                if (!string.IsNullOrEmpty(Settings.GetInstance().NotReadyCodeKey))
                {
                    ReasonCode.Add(Settings.GetInstance().NotReadyCodeKey, code);
                }
                if (string.IsNullOrEmpty(Settings.GetInstance().NotReadyKey) && string.IsNullOrEmpty(Settings.GetInstance().NotReadyCodeKey))
                {
                    ReasonCode.Add("Name", reason);
                    ReasonCode.Add("Code", code);
                }
                if (string.IsNullOrEmpty(reason) && string.IsNullOrEmpty(code))
                {
                    ReasonCode = null;
                }
                //End
                if (string.Compare(Settings.GetInstance().NotReadyRequest.ToLower(), "extensions", true) == 0)
                {
                    requestAgentNotReady.Extensions = ReasonCode;
                }
                else
                {
                    requestAgentNotReady.Reasons = ReasonCode;
                }
                //Code Added - To resolve agent not ready issue in client box
                //11.10.2013 V.Palaniappan
                if (Settings.GetInstance().QueueName.ToLower() != "optional" && Settings.GetInstance().QueueName.ToLower() != "none")
                {
                    requestAgentNotReady.ThisQueue = Settings.GetInstance().QueueName;
                }

                logger.Info("---------------AgentNotReady------------------");
                logger.Info("ThisDN:" + Settings.GetInstance().ACDPosition);
                logger.Info("Reason:" + reason);
                logger.Info("Reasoncode:" + code);
                logger.Info("--------------------------------------------");
                output.MessageCode = "200";
                output.Message     = "Not Ready Successful";

                //End
                if (isSolicited)
                {
                    output.IMessage = Settings.GetInstance().VoiceProtocol.Request(requestAgentNotReady);
                }
                else
                {
                    Settings.GetInstance().VoiceProtocol.Send(requestAgentNotReady);
                }
            }
            catch (System.Exception commonException)
            {
                logger.Error("Error occurred while Agent Not Ready " + commonException.ToString());
                output.MessageCode = "2001";
                output.Message     = commonException.Message;
            }
            return(output);
        }
Esempio n. 4
0
        public void ColocarPausa(TiposDePausa tipoPausa)
        {
            try
            {
                EnviaMensagemSignalR("ServidorCTI", this.PA + ", " + this.AgentID + ", " + this.PasswordAgentID + ", " + this.Queue);
                Genesyslab.Platform.Commons.Collections.KeyValueCollection reasons = new Genesyslab.Platform.Commons.Collections.KeyValueCollection();
                reasons.Add(tipoPausa.ToString(), ((int)tipoPausa).ToString());

                RequestAgentNotReady rar = RequestAgentNotReady.Create(this.PA, AgentWorkMode.WalkAway, this.Queue, reasons, null);
                pmsTServer[TSERVER_IDENTIFIER].Send(rar);
            }
            catch (Exception ex)
            {
                EnviaMensagemSignalR("ServidorCTI-Erro", "ColocarPausa(...) - exception: " + ex.Message);
            }
        }