コード例 #1
0
        /// <summary>
        /// Agents the logout.
        /// </summary>
        /// <param name="proxyId">The proxy identifier.</param>
        /// <returns></returns>
        public OutputValues AgentLogout(int proxyId)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestAgentLogout requestAgentlogout = RequestAgentLogout.Create();
                requestAgentlogout.ProxyClientId = proxyId;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestAgentlogout);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAgentLogout = (EventAck)message;
                            logger.Info("-------------AgentLogout----------------");
                            logger.Info("ProxyClientId    :" + proxyId);
                            logger.Info("Name    :" + eventAgentLogout.Name.ToString());
                            logger.Info("----------------------------------------");
                            logger.Trace(eventAgentLogout.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Agent Logout Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError            = (EventError)message;
                            string     LoginErrorCode        = Convert.ToString(eventError.ErrorCode);
                            string     LoginErrorDescription = Convert.ToString(eventError.ErrorDescription);
                            logger.Trace(eventError.ToString());
                            output.ErrorCode   = eventError.ErrorCode;
                            output.MessageCode = "2002";
                            output.Message     = "AgentLogout() : " + LoginErrorDescription;
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Agent Logout UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("AgentLogout() : Interaction Server Protocol is Null..");
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while Agent Logout request " + commonException.ToString());
                output.MessageCode = "2001";
                output.Message     = commonException.Message;
            }
            return(output);
        }
コード例 #2
0
        /// <summary>
        /// Agents the register.
        /// </summary>
        /// <param name="clientName">Name of the client.</param>
        /// <returns></returns>
        public OutputValues AgentRegister(string clientName)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestRegisterClient requestRegisterClient = RequestRegisterClient.Create();
                requestRegisterClient.ClientName    = clientName;
                requestRegisterClient.ClientType    = InteractionClient.AgentApplication;
                requestRegisterClient.ProxyClientId = 0;
                requestRegisterClient.Extension     = null;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestRegisterClient);

                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAgentRegister = (EventAck)message;
                            logger.Info("------------AgentRegister-------------");
                            logger.Info("ClientName    :" + clientName);
                            logger.Info("--------------------------------------");
                            logger.Trace(eventAgentRegister.ToString());
                            output.MessageCode = "200";
                            output.ProxyID     = eventAgentRegister.ProxyClientId;
                            output.Message     = "Agent Register Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError            = (EventError)message;
                            string     LoginErrorCode        = Convert.ToString(eventError.ErrorCode);
                            string     LoginErrorDescription = Convert.ToString(eventError.ErrorDescription);
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = "AgentRegister() : " + LoginErrorDescription;
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Agent Register UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("AgentRegister() : Interaction Server Protocol is Null..");
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while Register request " + commonException.ToString());
                output.MessageCode = "2001";
                output.Message     = commonException.Message;
            }
            return(output);
        }
コード例 #3
0
        public OutputValues RequestPlaceWorkbin(string interactionId, string agentId,
                                                //string placeId,
                                                string workbin, int proxyId)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                WorkbinInfo workbinInfo = WorkbinInfo.Create();
                workbinInfo.WorkbinAgentId = agentId;
                //  workbinInfo.WorkbinPlaceId = placeId;
                workbinInfo.WorkbinTypeId = workbin;

                RequestPlaceInWorkbin requestPlaceInWorkbin = RequestPlaceInWorkbin.Create();
                requestPlaceInWorkbin.InteractionId = interactionId;
                requestPlaceInWorkbin.ProxyClientId = proxyId;

                requestPlaceInWorkbin.Workbin = workbinInfo;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestPlaceInWorkbin);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------PlaceInWorkbin-------------");
                            logger.Info("AgentID  :" + agentId);
                            logger.Info("InteractionID  :" + interactionId);
                            // logger.Info("PlaceID  :" + placeId);
                            logger.Info("ProxyID        :" + proxyId);
                            logger.Info("Workbin        :" + workbin);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Place in Workbin Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Email Interaction-------------");
                            logger.Info("AgentID  :" + agentId);
                            logger.Info("InteractionID  :" + interactionId);
                            // logger.Info("PlaceID  :" + placeId);
                            logger.Info("ProxyID        :" + proxyId);
                            logger.Info("Workbin        :" + workbin);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while placeinworkbin : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Place in Workbin UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("PlaceInWorkbin() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Accept the request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #4
0
        /// <summary>
        /// Rejects the interaction.
        /// </summary>
        /// <param name="ticketID">The ticket identifier.</param>
        /// <param name="interactionID">The interaction identifier.</param>
        /// <param name="proxyID">The proxy identifier.</param>
        /// <returns></returns>
        public OutputValues RejectInteraction(int ticketID, string interactionID, int proxyID, KeyValueCollection data)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestReject requestReject = RequestReject.Create();
                requestReject.TicketId      = ticketID;
                requestReject.InteractionId = interactionID;
                requestReject.ProxyClientId = proxyID;
                requestReject.Extension     = data;
                ReasonInfo reasonInfo = ReasonInfo.Create();
                reasonInfo.ReasonDescription = "Agent has reject this interaction";
                requestReject.Reason         = reasonInfo;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestReject);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventInteractionReject = (EventAck)message;
                            logger.Info("------------RejectInteraction-------------");
                            logger.Info("InteractionId  :" + interactionID);
                            logger.Info("ProxyClientId    :" + proxyID);
                            logger.Info("---------------------------------------------");
                            logger.Trace(eventInteractionReject.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Reject Interaction Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError            = (EventError)message;
                            string     LoginErrorCode        = Convert.ToString(eventError.ErrorCode);
                            string     LoginErrorDescription = Convert.ToString(eventError.ErrorDescription);
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = "RejectInteraction() : " + LoginErrorDescription;
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Agent Reject Interaction UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("RejectInteraction() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Reject Interaction request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #5
0
        /// <summary>
        /// Accepts the interaction.
        /// </summary>
        /// <param name="ticketID">The ticket identifier.</param>
        /// <param name="interactionID">The interaction identifier.</param>
        /// <param name="proxyID">The proxy identifier.</param>
        /// <returns></returns>
        public OutputValues AcceptInteraction(int ticketID, string interactionID, int proxyID)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestAccept requestAccept = RequestAccept.Create();
                requestAccept.TicketId      = ticketID;
                requestAccept.InteractionId = interactionID;
                requestAccept.ProxyClientId = Convert.ToInt32(proxyID);
                //added 27-02-2015
                requestAccept.InitialInFocusState = true;
                //end
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestAccept);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------Accepted  Interaction-------------");
                            logger.Info("TicketID  :" + ticketID);
                            logger.Info("InteractionID  :" + interactionID);
                            logger.Info("ProxyID        :" + proxyID);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Accept Interaction Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Email Interaction-------------");
                            logger.Info("TicketID  :" + ticketID);
                            logger.Info("InteractionID  :" + interactionID);
                            logger.Info("ProxyID        :" + proxyID);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while accepting the interaction : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Agent Not Ready UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("AcceptChatInteraction() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Accept the request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #6
0
        public OutputValues NotifyWorbin(int proxyClientId, string workbinType, string worbinEmpId, string workbinGroupId = null, string WorkbinPlaceId = null, string workbinPlaceGroupId = null)
        {
            OutputValues outPutValues = new OutputValues();

            outPutValues.Message     = string.Empty;
            outPutValues.MessageCode = string.Empty;
            outPutValues.ErrorCode   = 0;
            KeyValueCollection keyVC = new KeyValueCollection();

            keyVC.Add("event_processing_stopped", 1);
            try
            {
                RequestWorkbinNotifications reqWorkbinNotifications = RequestWorkbinNotifications.Create();
                reqWorkbinNotifications.Workbin = WorkbinInfo.Create(workbinType);
                reqWorkbinNotifications.Workbin.WorkbinAgentId = worbinEmpId;
                if (!string.IsNullOrEmpty(workbinGroupId))
                {
                    reqWorkbinNotifications.Workbin.WorkbinGroupId = workbinGroupId;
                }
                if (!string.IsNullOrEmpty(workbinPlaceGroupId))
                {
                    reqWorkbinNotifications.Workbin.WorkbinPlaceGroupId = workbinPlaceGroupId;
                }
                if (!string.IsNullOrEmpty(WorkbinPlaceId))
                {
                    reqWorkbinNotifications.Workbin.WorkbinPlaceId = WorkbinPlaceId;
                }
                reqWorkbinNotifications.Reason                = ReasonInfo.Create();
                reqWorkbinNotifications.ProxyClientId         = proxyClientId;
                reqWorkbinNotifications.NotifyPropertyChanges = 1;
                reqWorkbinNotifications.Extension             = keyVC;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(reqWorkbinNotifications);

                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck _requestWorkbinNotifications = (EventAck)message;
                            logger.Info("------------Request Workbin Notifications-------------");
                            logger.Trace(_requestWorkbinNotifications.ToString());
                            outPutValues.MessageCode = "200";
                            logger.Trace(_requestWorkbinNotifications.ProxyClientId);
                            outPutValues.Message = "Request Workbin Notifications Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Trace(eventError.ToString());
                            outPutValues.MessageCode = "2001";
                            outPutValues.Message     = "NotifyWorbin() : " + Convert.ToString(eventError.ErrorDescription);
                            break;
                        }
                    }
                }
            }
            catch (Exception error)
            {
                logger.Error(error.Message.ToString());
                outPutValues.MessageCode = "2001";
                outPutValues.Message     = "NotifyWorbin() : " + error.Message.ToString();
            }

            return(outPutValues);
        }
        /// <summary>
        /// Agents the ready.
        /// </summary>
        /// <param name="proxyClientId">The proxy client identifier.</param>
        /// <param name="mediaType">Type of the media.</param>
        /// <returns></returns>
        public OutputValues AgentNotReadyWithReason(int proxyClientId, string mediaType, string reason, string code)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                KeyValueCollection ReasonCode = new KeyValueCollection();
                if (!string.IsNullOrEmpty(reason))
                {
                    ReasonCode.Add("Name", reason);
                    ReasonCode.Add("Code", code);
                }
                RequestChangeMediaStateReason requestChangeMediaStateReason = RequestChangeMediaStateReason.Create(proxyClientId, ReasonCode, mediaType, ReasonInfo.Create(mediaType, reason, Convert.ToInt32(code)));
                //requestChangeMediaStateReason.ProxyClientId = proxyClientId;
                //requestChangeMediaStateReason.MediaTypeName = mediaType;

                //requestChangeMediaStateReason.Extension = ReasonCode;
                //requestChangeMediaStateReason.Reason = ReasonInfo.Create(mediaType, reason, Convert.ToInt32(code));

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestChangeMediaStateReason);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAgentNotReady = (EventAck)message;
                            logger.Info("----------------AgentNotReadyWithReason-------------");
                            logger.Info("ProxyClientId    :" + proxyClientId);
                            logger.Info("MediaTypeName    :" + mediaType);
                            logger.Info("Name    :" + eventAgentNotReady.Name.ToString());
                            logger.Info("Reason Name    :" + reason);
                            logger.Info("Reason Code    :" + code);
                            logger.Info("----------------------------------------------------");
                            logger.Trace(eventAgentNotReady.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Agent Not Ready with reason Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError            = (EventError)message;
                            string     LoginErrorCode        = Convert.ToString(eventError.ErrorCode);
                            string     LoginErrorDescription = Convert.ToString(eventError.ErrorDescription);
                            logger.Trace(eventError.ToString());
                            output.ErrorCode   = eventError.ErrorCode;
                            output.MessageCode = "2002";
                            output.Message     = "AgentNotReadyWithReason() : " + LoginErrorDescription;
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Agent Not Ready with reason UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("AgentNotReadyWithReason() : Interaction Server Protocol is Null..");
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while Agent Not Ready with reason request " + commonException.ToString());
                output.MessageCode = "2001";
                output.Message     = commonException.Message;
            }
            return(output);
        }
コード例 #8
0
        public OutputValues RequestPlaceQueue(string interactionId, int proxyId, string queueName)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestPlaceInQueue requestPlaceInQueue = RequestPlaceInQueue.Create();
                requestPlaceInQueue.InteractionId = interactionId;
                requestPlaceInQueue.Queue         = queueName;
                requestPlaceInQueue.ProxyClientId = proxyId;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestPlaceInQueue);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------PlaceInQueue-------------");
                            logger.Info("InteractionID  :" + interactionId);
                            logger.Info("ProxyID        :" + proxyId);
                            logger.Info("Queue Name        :" + queueName);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Place in Queue Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Place In Queue-------------");
                            logger.Info("InteractionID  :" + interactionId);
                            logger.Info("ProxyID        :" + proxyId);
                            logger.Info("Queue Name        :" + queueName);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while placeinqueue : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Place in Queue UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("PlaceInQueue() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Accept the request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #9
0
        public string SubmitNewInteraction(int tenantId, int proxyClientId, string queuename, KeyValueCollection userdata)
        {
            string interactionID = string.Empty;

            try
            {
                RequestSubmit requestSumbit = RequestSubmit.Create();
                requestSumbit.TenantId           = tenantId;
                requestSumbit.ProxyClientId      = proxyClientId;
                requestSumbit.Queue              = queuename;
                requestSumbit.InteractionType    = "Outbound";
                requestSumbit.InteractionSubtype = "OutboundNew";
                requestSumbit.MediaType          = "email";
                requestSumbit.UserData           = userdata;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestSumbit);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------Submit New Email Interaction-------------");
                            logger.Info("TenantID  :" + requestSumbit.TenantId);
                            logger.Info("ProxyClientId  :" + requestSumbit.ProxyClientId);
                            logger.Info("Queue  :" + requestSumbit.Queue);
                            logger.Info("InteractionType        :" + requestSumbit.InteractionType);
                            logger.Info("InteractionSubtype        :" + requestSumbit.InteractionSubtype);
                            logger.Info("MediaType        :" + requestSumbit.MediaType);
                            logger.Info("UserData        :" + requestSumbit.UserData.ToString());
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            if (eventAck.Extension.ContainsKey("InteractionId"))
                            {
                                interactionID = eventAck.Extension["InteractionId"].ToString();
                            }
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Submitting new  Interaction-------------");
                            logger.Info("TenantID  :" + requestSumbit.TenantId);
                            logger.Info("ProxyClientId  :" + requestSumbit.ProxyClientId);
                            logger.Info("Queue  :" + requestSumbit.Queue);
                            logger.Info("InteractionType        :" + requestSumbit.InteractionType);
                            logger.Info("InteractionSubtype        :" + requestSumbit.InteractionSubtype);
                            logger.Info("MediaType        :" + requestSumbit.MediaType);
                            logger.Info("UserData        :" + requestSumbit.UserData.ToString());
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            interactionID = string.Empty;
                            logger.Error("Error occurred while submittting new interaction : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        interactionID = string.Empty;
                    }
                }
                else
                {
                    logger.Warn("PlaceInWorkbin() : Interaction Server protocol is Null..");
                    interactionID = string.Empty;
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while submit the new email interaction" + generalException.ToString());
                interactionID = string.Empty;
            }
            return(interactionID);
        }
コード例 #10
0
        public OutputValues TransferInteractiontoQueue(int proxyClientId, string interactionID, string queueName)
        {
            OutputValues output = OutputValues.GetInstance();

            try
            {
                RequestChangeProperties requestChangeProperties = RequestChangeProperties.Create();
                RequestPlaceInQueue     requestPlaceInQueue     = RequestPlaceInQueue.Create();

                KeyValueCollection attachData = new KeyValueCollection();
                attachData.Add("EmailSkills", queueName);

                requestChangeProperties.ChangedProperties = attachData;
                requestChangeProperties.InteractionId     = interactionID;
                requestChangeProperties.ProxyClientId     = proxyClientId;

                requestPlaceInQueue.InteractionId   = interactionID;
                requestPlaceInQueue.Queue           = queueName;
                requestPlaceInQueue.ProxyClientId   = proxyClientId;
                requestPlaceInQueue.AddedProperties = attachData;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestPlaceInQueue);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------Transfer Interaction By Queue-------------");
                            logger.Info("InteractionId  :" + interactionID);
                            logger.Info("ProxyClientId    :" + proxyClientId);
                            logger.Info("QueueName    :" + queueName);
                            logger.Info("--------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Transfer interaction Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Transfer Interaction By Queue-------------");
                            logger.Info("InteractionId  :" + interactionID);
                            logger.Info("ProxyClientId    :" + proxyClientId);
                            logger.Info("QueueName    :" + queueName);
                            logger.Info("--------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while transferring  interaction : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Transfer Interaction UnSuccessful";
                    }
                    Settings.InteractionProtocol.Send(requestPlaceInQueue);
                    logger.Info("------------Transfer Interaction By Queue-------------");
                    logger.Info("InteractionId  :" + interactionID);
                    logger.Info("ProxyClientId    :" + proxyClientId);
                    logger.Info("QueueName    :" + queueName);
                    logger.Info("--------------------------------------------");
                    logger.Info(requestChangeProperties.ToString());
                    logger.Info(requestPlaceInQueue.ToString());
                }
                else
                {
                    logger.Warn("TransferInteractiontoQueue() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while transfer the interaction" + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #11
0
        public OutputValues TransferInteractiontoAgent(int proxyClientId, string interactionID, string agentID)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestTransfer requestTransfer = RequestTransfer.Create();
                requestTransfer.ProxyClientId = proxyClientId;
                requestTransfer.InteractionId = interactionID;
                requestTransfer.AgentId       = agentID;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestTransfer);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------Transfer Interaction to agent-------------");
                            logger.Info("AgentID  :" + requestTransfer.AgentId);
                            logger.Info("ProxyClientId  :" + requestTransfer.ProxyClientId);
                            logger.Info("InteractionId  :" + requestTransfer.InteractionId);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Transfer interaction Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Transferring Interaction to Agent-------------");
                            logger.Info("AgentID  :" + requestTransfer.AgentId);
                            logger.Info("ProxyClientId  :" + requestTransfer.ProxyClientId);
                            logger.Info("InteractionId  :" + requestTransfer.InteractionId);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while transferring  interaction : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Transfer Interaction UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("TransferInteraction() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while transfer the interaction" + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #12
0
        /// <summary>
        /// Agents the login.
        /// </summary>
        /// <param name="agentId">The agent identifier.</param>
        /// <param name="placeId">The place identifier.</param>
        /// <param name="proxyId">The proxy identifier.</param>
        /// <param name="chatMedia">The chat media.</param>
        /// <param name="chatMediaState">State of the chat media.</param>
        /// <param name="tenantId">The tenant identifier.</param>
        /// <returns></returns>
        public OutputValues AgentLogin(string agentId, string placeId, int proxyId, int tenantDBID, Dictionary <string, int> mediaList)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestAgentLogin requestAgentlogin = RequestAgentLogin.Create();
                requestAgentlogin.AgentId       = agentId;
                requestAgentlogin.PlaceId       = placeId;
                requestAgentlogin.ProxyClientId = proxyId;
                requestAgentlogin.MediaList     = new Genesyslab.Platform.Commons.Collections.KeyValueCollection();
                foreach (KeyValuePair <string, int> media in mediaList)
                {
                    requestAgentlogin.MediaList.Add(media.Key, media.Value);
                }
                requestAgentlogin.TenantId = tenantDBID;
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestAgentlogin);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAgentLogin = (EventAck)message;
                            logger.Info("--------------AgentLogin-----------------");
                            logger.Info("AgentId    :" + agentId);
                            logger.Info("PlaceId    :" + placeId);
                            logger.Info("ProxyClientId    :" + proxyId);
                            foreach (KeyValuePair <string, int> media in mediaList)
                            {
                                logger.Info("Media Name   :" + media.Key + "\t Media State  :" + media.Value);
                            }
                            logger.Info("TenantId    :" + requestAgentlogin.TenantId);
                            logger.Info("Name    :" + eventAgentLogin.Name.ToString());
                            logger.Info("----------------------------------------");
                            logger.Trace(eventAgentLogin.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Agent Login Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError            = (EventError)message;
                            string     LoginErrorCode        = Convert.ToString(eventError.ErrorCode);
                            string     LoginErrorDescription = Convert.ToString(eventError.ErrorDescription);
                            logger.Trace(eventError.ToString());
                            output.ErrorCode   = eventError.ErrorCode;
                            output.MessageCode = "2002";
                            output.Message     = LoginErrorDescription;
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2002";
                        output.Message     = "Agent Login UnSuccessful";
                    }
                }
                else
                {
                    output.MessageCode = "2001";
                    output.Message     = "Interaction Server Protocol is Null";
                    logger.Warn("AgentLogin() : Interaction Server Protocol is Null..");
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while Agent Login request " + commonException.ToString());
                output.MessageCode = "2001";
                output.Message     = commonException.Message;
            }
            return(output);
        }