Beispiel #1
0
        /// <summary>
        /// Changes the properties.
        /// </summary>
        /// <param name="interactionId">The interaction identifier.</param>
        /// <param name="proxyId">The proxy identifier.</param>
        /// <param name="dispositionNotes">The disposition notes.</param>
        /// <returns></returns>
        public OutputValues ChangeProperties(string interactionId, int proxyId, KeyValueCollection addedProperties, KeyValueCollection changedProperties)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            RequestChangeProperties requestChangeProperties = RequestChangeProperties.Create();

            try
            {
                requestChangeProperties.InteractionId = interactionId;
                requestChangeProperties.ProxyClientId = proxyId;
                if (changedProperties != null)
                {
                    requestChangeProperties.ChangedProperties = changedProperties;
                }
                if (addedProperties != null)
                {
                    requestChangeProperties.AddedProperties = addedProperties;
                }
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage response = Settings.InteractionProtocol.Request(requestChangeProperties);
                    if (response.Id == EventPropertiesChanged.MessageId || response.Id == EventAck.MessageId)
                    {
                        logger.Info("------------RequestChangeProperties-------------");
                        logger.Info("InteractionId  :" + interactionId);
                        logger.Info("ProxyClientId    :" + proxyId);
                        logger.Info(" RequestChangeProperties : response :" + response.ToString());
                        logger.Info("-------------------------------------------------");
                        logger.Trace(response.ToString());
                        output.MessageCode = "200";
                        output.Message     = "Change Properties Successful";
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Don't Change Properties Successful";
                    }
                }
                else
                {
                    logger.Warn("ChangeProperties() : Interaction Server Protocol is Null..");
                }
            }
            catch (ProtocolException protocolException)
            {
                logger.Error("Error occurred while change properties request " + protocolException.ToString());
                output.MessageCode = "2001";
                output.Message     = protocolException.Message;
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while change properties request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
        /// <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);
        }
Beispiel #3
0
        /// <summary>
        /// Leaves the interaction from conference.
        /// </summary>
        /// <param name="interactionID">The interaction identifier.</param>
        /// <param name="proxyID">The proxy identifier.</param>
        /// <param name="agentID">The agent identifier.</param>
        /// <param name="_chatClosingProtocol">The _chat closing protocol.</param>
        /// <returns></returns>
        public static Pointel.Interactions.Chat.Core.General.OutputValues LeaveInteractionFromConference(string interactionID, int proxyID, string agentID)
        {
            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
            {
                Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestLeaveInteraction requestLeaveInteraction = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestLeaveInteraction.Create();
                requestLeaveInteraction.InteractionId = interactionID;
                requestLeaveInteraction.ProxyClientId = proxyID;
                requestLeaveInteraction.Reason        = null;
                //ReasonInfo reasonInfo = ReasonInfo.Create();
                //reasonInfo.ReasonDescription = agentID.ToString() + " Leaving from the Conference";
                //requestLeaveInteraction.Reason = reasonInfo;
                requestLeaveInteraction.Extension = null;
                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 response = Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol.Request(requestLeaveInteraction);
                    if (response != null)
                    {
                        switch (response.Id)
                        {
                        case Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck.MessageId:
                            logger.Info("------------LeaveInteractionFromConference-------------");
                            logger.Info("InteractionId      :" + interactionID);
                            logger.Info("ProxyClientId      :" + proxyID);
                            logger.Info("AgentId            :" + agentID);
                            logger.Info("-------------------------------------------------------");
                            logger.Trace(response.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Leave Interaction From Conference Successful";
                            break;

                        case Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventError.MessageId:
                            logger.Trace(response.ToString());
                            output.MessageCode = "2001";
                            output.Message     = "Don't Leave Interaction From Conference Successful";
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Don't Leave Interaction From Conference Successful";
                    }
                }
                else
                {
                    logger.Warn("LeaveInteractionFromConference() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Leave Interaction From Conference request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
        public Dictionary <ContactDetails, string> GetContactId(string tenantId, MediaTypes mediaType, KeyValueCollection userData)
        {
            Dictionary <ContactDetails, string> contactDetails = null;
            OutputValues output = Pointel.Interactions.Contact.Core.Request.RequestToIdentifyContact.IdentifyContact(mediaType.ToString().ToLower(), ConfigContainer.Instance().TenantDbId, userData);

            if (output.MessageCode == "200")
            {
                IMessage message = output.IContactMessage;
                if (message != null)
                {
                    contactDetails = new Dictionary <ContactDetails, string>();
                    switch (message.Id)
                    {
                    case EventIdentifyContact.MessageId:
                        EventIdentifyContact eventIdentifyContact = (EventIdentifyContact)message;
                        logger.Trace(eventIdentifyContact.ToString());
                        if (eventIdentifyContact.ContactId != null)
                        {
                            contactDetails.Add(ContactDetails.ContactId, eventIdentifyContact.ContactId);
                        }
                        else if (eventIdentifyContact.ContactIdList != null)
                        {
                            if (eventIdentifyContact.ContactIdList.Count > 0)
                            {
                                contactDetails.Add(ContactDetails.ContactId, eventIdentifyContact.ContactIdList[0].ToString());
                            }
                        }
                        if (eventIdentifyContact.OtherFields != null)
                        {
                            foreach (var fields in eventIdentifyContact.OtherFields.Keys)
                            {
                                ContactDetails tempenum;
                                if (Enum.TryParse(fields.ToString(), true, out tempenum))
                                {
                                    contactDetails.Add(tempenum, eventIdentifyContact.OtherFields[fields.ToString()].ToString());
                                }
                            }
                        }
                        break;

                    case Genesyslab.Platform.Contacts.Protocols.ContactServer.Events.EventError.MessageId:
                        Genesyslab.Platform.Contacts.Protocols.ContactServer.Events.EventError eventError = (Genesyslab.Platform.Contacts.Protocols.ContactServer.Events.EventError)message;
                        logger.Trace(eventError.ToString());
                        break;
                    }
                    return(contactDetails);
                }
            }
            return(contactDetails);
        }
Beispiel #5
0
 /// <summary>
 /// Deletes the case information.
 /// </summary>
 /// <param name="interactionid">The interactionid.</param>
 /// <param name="keyvalues">The keyvalues.</param>
 /// <returns></returns>
 public static Pointel.Interactions.Chat.Core.General.OutputValues DeleteCaseInformation(string interactionId, int proxyClientID, Genesyslab.Platform.Commons.Collections.KeyValueCollection keyvalues)
 {
     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
     {
         Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestChangeProperties deletedProperties = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestChangeProperties.Create();
         deletedProperties.InteractionId = interactionId;
         deletedProperties.ProxyClientId = proxyClientID;
         if (keyvalues != null)
         {
             deletedProperties.DeletedProperties = keyvalues;
         }
         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 response = Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol.Request(deletedProperties);
             if (response.Id == Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventPropertiesChanged.MessageId || response.Id == Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck.MessageId)
             {
                 logger.Info("------------DeleteCaseInformation-------------");
                 logger.Info("InteractionId  :" + interactionId);
                 logger.Info("ProxyClientId    :" + proxyClientID);
                 logger.Info("KVC : " + keyvalues.ToString());
                 logger.Info("AddCaseInformation : response :" + response.ToString());
                 logger.Info("---------------------------------------------");
                 logger.Trace(response.ToString());
                 output.MessageCode = "200";
                 output.Message     = "Delete Case Information Successful";
             }
             else
             {
                 logger.Trace(response.ToString());
                 output.MessageCode = "2001";
                 output.Message     = "Add Properties UnSuccessful";
             }
         }
         else
         {
             logger.Warn("AddCaseInformation() : Interaction Server Protocol is Null..");
         }
     }
     catch (Exception generalException)
     {
         logger.Error("Error occurred while doing Add Case Information:" + generalException.ToString());
         output.MessageCode = "2001";
         output.Message     = generalException.Message;
     }
     return(output);
 }
Beispiel #6
0
        public static IMessage RequestUpdateInteraction(InteractionContent interactionContent, InteractionAttributes interactionAttributes, BaseEntityAttributes baseEntityAttributes)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            IMessage iMessage = null;
            RequestUpdateInteraction updateInteraction = new RequestUpdateInteraction();

            if (interactionContent != null)
            {
                updateInteraction.InteractionContent = interactionContent;
            }
            if (interactionAttributes != null)
            {
                updateInteraction.InteractionAttributes = interactionAttributes;
            }
            if (baseEntityAttributes != null)
            {
                updateInteraction.EntityAttributes = baseEntityAttributes;
            }
            if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
            {
                logger.Info("------------RequestUpdateInteraction-------------");
                logger.Info("Interaction Attributes : " + (updateInteraction.InteractionAttributes != null ? "null" : updateInteraction.InteractionAttributes.ToString()));
                logger.Info("Entity Attributes : " + (updateInteraction.InteractionAttributes != null ? "null" : updateInteraction.EntityAttributes.ToString()));
                logger.Info("---------------------------------------------------");
                iMessage          = Settings.UCSProtocol.Request(updateInteraction);
                updateInteraction = null;
                logger.Trace("Response : " + (iMessage != null ? "null" : iMessage.ToString()));
            }
            else
            {
                logger.Warn("Error occurred as : Universal Contact Server protocol is Null or Closed");
            }
            return(iMessage);
        }
        /// <summary>
        /// Gets the contact list.
        /// </summary>
        /// <param name="tenantId">The tenant identifier.</param>
        /// <returns></returns>
        public static OutputValues GetContactList(int tenantId, List <string> attributeNames, int startIndex)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestGetContacts requestGetContacts = new RequestGetContacts();
                requestGetContacts.IndexOfFirst = startIndex;
                StringList stringList = new StringList();
                for (int count = 0; count < attributeNames.Count; count++)
                {
                    stringList.Add(attributeNames[count].ToString());
                }
                //stringList.Add("EmailAddress");
                //stringList.Add("FirstName");
                //stringList.Add("LastName");
                requestGetContacts.AttributeList = stringList;
                requestGetContacts.TenantId      = tenantId;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("------------GetContacts-------------");
                    logger.Info("TenantId    :" + tenantId);
                    logger.Info("AttributeList: " + stringList);
                    logger.Info("-------------------------------------");
                    IMessage message = Settings.UCSProtocol.Request(requestGetContacts);
                    if (message != null)
                    {
                        logger.Trace(message.ToString());
                        output.IContactMessage = message;
                        output.MessageCode     = "200";
                        output.Message         = "Get Contacts Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Get Contacts Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetContactList() : Universal Contact Server Protocol is Null");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error Occurred while Get Contacts request" + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
Beispiel #8
0
        public static Pointel.Interactions.Chat.Core.General.OutputValues ResumeInteraction(int proxyID, string sessionID, KeyValueCollection extensions, ReasonInfo reason)
        {
            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
            {
                Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestResume requestResume = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestResume.Create();
                requestResume.InteractionId = sessionID;
                requestResume.ProxyClientId = proxyID;
                requestResume.Extension     = extensions;
                requestResume.Reason        = reason;
                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(requestResume);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck.MessageId:
                            logger.Info("------------RequestResume-------------");
                            logger.Info("SessionID  :" + sessionID);
                            logger.Info("ProxyID    :" + proxyID);
                            logger.Info("--------------------------------------");
                            logger.Info(requestResume.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Interaction Resume 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.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = "ResumeInteraction() : " + LoginErrorDescription;
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Chat Media Resume Interaction UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("ResumeInteraction() : IXN Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Resume Interaction request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
Beispiel #9
0
 /// <summary>
 /// Changes the properties.
 /// </summary>
 /// <param name="interactionId">The interaction identifier.</param>
 /// <param name="proxyId">The proxy identifier.</param>
 /// <param name="dispositionNotes">The disposition notes.</param>
 /// <returns></returns>
 public static Pointel.Interactions.Chat.Core.General.OutputValues ChangeProperties(string interactionId, int proxyId, Genesyslab.Platform.Commons.Collections.KeyValueCollection addedProperties, Genesyslab.Platform.Commons.Collections.KeyValueCollection changedProperties)
 {
     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();
     Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestChangeProperties requestChangeProperties = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionManagement.RequestChangeProperties.Create();
     try
     {
         requestChangeProperties.InteractionId = interactionId;
         requestChangeProperties.ProxyClientId = proxyId;
         if (changedProperties != null)
         {
             requestChangeProperties.ChangedProperties = changedProperties;
         }
         if (addedProperties != null)
         {
             requestChangeProperties.AddedProperties = addedProperties;
         }
         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 response = Pointel.Interactions.Chat.Core.Util.Settings.IxnServerProtocol.Request(requestChangeProperties);
             if (response.Id == Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventPropertiesChanged.MessageId || response.Id == Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Events.EventAck.MessageId)
             {
                 logger.Info("------------RequestChangeProperties-------------");
                 logger.Info("InteractionId  :" + interactionId);
                 logger.Info("ProxyClientId    :" + proxyId);
                 logger.Info(" RequestChangeProperties : response :" + response.ToString());
                 logger.Info("-------------------------------------------------");
                 logger.Trace(response.ToString());
                 output.MessageCode = "200";
                 output.Message     = "Change Properties Successful";
             }
             else
             {
                 output.MessageCode = "2001";
                 output.Message     = "Don't Change Properties Successful";
             }
         }
         else
         {
             logger.Warn("ChangeProperties() : Interaction Server Protocol is Null..");
         }
     }
     catch (Genesyslab.Platform.Commons.Protocols.ProtocolException protocolException)
     {
         logger.Error("Error occurred while change properties request " + protocolException.ToString());
         output.MessageCode = "2001";
         output.Message     = protocolException.Message;
     }
     catch (Exception generalException)
     {
         logger.Error("Error occurred while change properties request " + generalException.ToString());
         output.MessageCode = "2001";
         output.Message     = generalException.Message;
     }
     return(output);
 }
        /// <summary>
        /// Adds the agent favorite response.
        /// </summary>
        /// <param name="stdResponse">The standard response.</param>
        /// <param name="agentId">The agent identifier.</param>
        /// <returns></returns>
        public static OutputValues AddAgentFavoriteResponse(string stdResponse, string agentId)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); 
            OutputValues output = OutputValues.GetInstance();
            try
            {
                RequestAddAgentStdRespFavorite requestAddAgentStdRespFavorite = new RequestAddAgentStdRespFavorite();
                requestAddAgentStdRespFavorite.StandardResponse = stdResponse;
                // requestAddFavouriteResponse.Name = stdName;
                // string strAgentID = "1001";
                int? agentid = int.Parse(agentId.ToString());
                requestAddAgentStdRespFavorite.AgentId = agentid;
                // requestAddFavouriteResponse.Name = stdResponse;
                // requestAddFavouriteResponse.Name = name;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("------------AddAgentFavoriteResponse-------------");
                    logger.Info("StandardResponse  :" + stdResponse);
                    logger.Info("AgentId    :" + agentId);
                    logger.Info("-------------------------------------------------");
                    IMessage response = Settings.UCSProtocol.Request(requestAddAgentStdRespFavorite);
                    if (response != null)
                    {
                        logger.Trace(response.ToString());
                        output.IContactMessage = response;
                        output.MessageCode = "200";
                        output.Message = "Add Agent Standard Response Favorite Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode = "2001";
                        output.Message = "Don't Add Agent Standard Response Favorite.";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode = "2001";
                    output.Message = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("AddAgentFavoriteResponse() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Add Agent Standard Response Favorite request " + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode = "2001";
                output.Message = generalException.Message;
            }
            return output;

        }
        /// <summary>
        /// Gets the interactions count.
        /// </summary>
        /// <param name="mediaType">Type of the media.</param>
        /// <returns></returns>
        public static OutputValues GetInteractionsCount(string mediaType)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestGetInteractionsWithStatus requestGetInteractionsWithStatus = new RequestGetInteractionsWithStatus();
                requestGetInteractionsWithStatus.MediaType          = mediaType;
                requestGetInteractionsWithStatus.InteractionType    = "Inbound";
                requestGetInteractionsWithStatus.InteractionSubtype = "InboundNew";
                requestGetInteractionsWithStatus.Status             = new Genesyslab.Platform.Contacts.Protocols.ContactServer.NullableStatuses(Statuses.InProcess);
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("--------GetInteractionsCount---------");
                    logger.Info("MediaType    :" + mediaType);
                    logger.Info("-------------------------------------");
                    IMessage response = Settings.UCSProtocol.Request(requestGetInteractionsWithStatus);
                    if (response != null)
                    {
                        logger.Trace(response.ToString());
                        output.IContactMessage = response;
                        output.MessageCode     = "200";
                        output.Message         = "Get Interaction Count Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Get Interaction Count Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetInteractionsCount() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error Occurred while Get Interaction Count request" + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
Beispiel #12
0
        /// <summary>
        /// Gets the recent interaction list.
        /// </summary>
        /// <param name="universalContactServerProtocol">The universal contact server protocol.</param>
        /// <param name="mediaType">Type of the media.</param>
        /// <param name="interactionID">The interaction unique identifier.</param>
        /// <returns></returns>
        public static IMessage GetInteractionContent(string interactionID, bool isAttachments)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            IMessage message = null;

            try
            {
                RequestGetInteractionContent requestGetInteractionContent = RequestGetInteractionContent.Create();
                requestGetInteractionContent.InteractionId      = interactionID;
                requestGetInteractionContent.IncludeAttachments = isAttachments;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("------------RequestToGetInteractionContent-------------");
                    logger.Info("InteractionId  :" + interactionID);
                    logger.Info("-------------------------------------------------------");
                    message = Settings.UCSProtocol.Request(requestGetInteractionContent);
                    if (message != null)
                    {
                        logger.Trace(message.ToString());
                    }
                    else
                    {
                        logger.Trace("null response from RequestGetInteractionContent");
                    }
                }
                else
                {
                    logger.Warn("Universal Contact Server protocol is Null or Closed");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while sending Request Get Interaction Content as : " + generalException.ToString());
            }
            return(message);
        }
        /// <summary>
        /// Gets the content of the response.
        /// </summary>
        /// <param name="tenantID">The tenant unique identifier.</param>
        /// <returns></returns>
        public static OutputValues GetResponseContent(int tenantID)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                logger.Debug("Getting the AllAttributes from the UCS server");
                RequestGetAllCategories getAllCategories = new RequestGetAllCategories();
                getAllCategories.TenantId = tenantID;
                getAllCategories.Language = "English";
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("--------GetResponseContent---------");
                    logger.Info("TenantId    :" + tenantID);
                    logger.Info("-----------------------------------");
                    IMessage response = Settings.UCSProtocol.Request(getAllCategories);
                    if (response != null)
                    {
                        logger.Trace(response.ToString());
                        output.IContactMessage = response;
                        output.MessageCode     = "200";
                        output.Message         = "Get  All Response Content Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Get All Response Content Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetResponseContent() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception ex)
            {
                output.IContactMessage = null;
                output.Message         = "Error occurred while get all standard response ";
                output.MessageCode     = "2001";
                logger.Error("GetResponseContent()" + ex.ToString());
            }
            return(output);
        }
        public static OutputValues IdentifyContact(string mediaType, int tenantId, KeyValueCollection userData)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestIdentifyContact requestIdentifyContact = RequestIdentifyContact.Create();
                requestIdentifyContact.TenantId      = tenantId;
                requestIdentifyContact.MediaType     = mediaType;
                requestIdentifyContact.CreateContact = true;
                requestIdentifyContact.OtherFields   = userData;
                logger.Info("------------RequestIdentifyContact-------------");
                logger.Info(requestIdentifyContact.ToString());
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.UCSProtocol.Request(requestIdentifyContact);
                    if (message != null)
                    {
                        logger.Trace(message.ToString());
                        output.IContactMessage = message;
                        output.MessageCode     = "200";
                        output.Message         = "Identify Contact Successfully";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Identify Contact Successfully";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("RequestToIdentifyContact() : Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Request To Identify Contact " + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
        /// <summary>
        /// Removes the attach document.
        /// </summary>
        /// <param name="interactionId">The interaction identifier.</param>
        /// <param name="documentId">The document identifier.</param>
        /// <returns></returns>
        public static OutputValues RemoveAttachDocument(string interactionId, string documentId)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestRemoveDocument requestRemoveDocument = new RequestRemoveDocument();
                requestRemoveDocument.InteractionId = interactionId;
                requestRemoveDocument.DocumentId    = documentId;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("--------RemoveAttachDocument------------");
                    logger.Info("InteractionId    :" + interactionId);
                    logger.Info("DocumentId    :" + documentId);
                    logger.Info("----------------------------------------");
                    IMessage response = Settings.UCSProtocol.Request(requestRemoveDocument);
                    if (response != null)
                    {
                        logger.Trace(response.ToString());
                        output.IContactMessage = response;
                        output.MessageCode     = "200";
                        output.Message         = "Remove Attach Document Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Remove Attach Document Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("RemoveAttachDocument() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error Occurred while Remove Attach Document request" + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
        public static OutputValues RequestInsertContact(int tenantId, AttributesList attribute)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestInsert reqInsertContact = new RequestInsert();
                reqInsertContact.TenantId   = tenantId;
                reqInsertContact.Attributes = attribute;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("------------RequestInsertContact-------------");
                    logger.Info("Tenant ID  : " + tenantId);
                    logger.Info("---------------------------------------------------");
                    IMessage message = Settings.UCSProtocol.Request(reqInsertContact);
                    if (message != null)
                    {
                        logger.Trace(message.ToString());
                        output.IContactMessage = message;
                        output.MessageCode     = "200";
                        output.Message         = "Contact Inserted Successfully";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Can't Insert Contact Successfully";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("RequestDeleteContact() : Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Insert Contact " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }

            return(output);
        }
 /// <summary>
 /// Joins the consult chat session.
 /// </summary>
 /// <param name="sessionID">The session unique identifier.</param>
 /// <param name="subject">The subject.</param>
 /// <param name="message">The message.</param>
 /// <param name="userData">The user data.</param>
 /// <returns></returns>
 public static Pointel.Interactions.Chat.Core.General.OutputValues JoinConsultChatSession(string sessionID, string subject, string message, 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
     {
         Genesyslab.Platform.WebMedia.Protocols.BasicChat.Requests.RequestJoin requestJoinChat = Genesyslab.Platform.WebMedia.Protocols.BasicChat.Requests.RequestJoin.Create();
         Genesyslab.Platform.WebMedia.Protocols.BasicChat.MessageText          newMessageText  = Genesyslab.Platform.WebMedia.Protocols.BasicChat.MessageText.Create();
         newMessageText.Text         = message;
         requestJoinChat.MessageText = newMessageText;
         requestJoinChat.SessionId   = sessionID;
         requestJoinChat.UserData    = userData;
         requestJoinChat.Visibility  = Genesyslab.Platform.WebMedia.Protocols.BasicChat.Visibility.Int;
         requestJoinChat.Subject     = subject;
         if (Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol != null && Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.State == Genesyslab.Platform.Commons.Protocols.ChannelState.Opened)
         {
             Genesyslab.Platform.Commons.Protocols.IMessage iMessage = Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.Request(requestJoinChat);
             if (iMessage != null)
             {
                 logger.Info("------------JoinConsultChatSession-------------");
                 logger.Info("SessionID  :" + sessionID);
                 logger.Info("subject    :" + subject);
                 logger.Info("MessageText:" + message);
                 logger.Info("----------------------------------------");
                 logger.Trace(iMessage.ToString());
                 output.RequestJoinIMessage = iMessage;
                 output.MessageCode         = "200";
                 output.Message             = "Join Consult Chat Session Successful";
             }
             else
             {
                 logger.Warn("JoinConsultChatSession() : IMessage is Null..");
             }
         }
         else
         {
             logger.Warn("JoinConsultChatSession() : Interaction Server protocol is Null..");
         }
     }
     catch (Exception generalException)
     {
         logger.Error("Error occurred while Join the consult chat session request " + generalException.ToString());
         output.MessageCode = "2001";
         output.Message     = generalException.Message;
     }
     return(output);
 }
Beispiel #18
0
        /// <summary>
        /// Gets the standard response.
        /// </summary>
        /// <param name="standardresponseId">The standard response identifier.</param>
        /// <returns></returns>
        public static OutputValues GetStandardResponse(string standardresponseId)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestGetStandardResponse requestGetStandardResponse = new RequestGetStandardResponse();
                requestGetStandardResponse.StandardResponseId = standardresponseId;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("--------GetStandardResponse------------");
                    logger.Info("StandardResponseId    :" + standardresponseId);
                    logger.Info("---------------------------------------");
                    IMessage message = Settings.UCSProtocol.Request(requestGetStandardResponse);
                    if (message != null)
                    {
                        logger.Trace(message.ToString());
                        output.IContactMessage = message;
                        output.MessageCode     = "200";
                        output.Message         = "Get Standard Response Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Get Standard Response Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetStandardResponse() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error Occurred while Get Standard Response request" + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
Beispiel #19
0
        /// <summary>
        /// Deletes the interaction from ucs.
        /// </summary>
        /// <param name="interactionID">The interaction unique identifier.</param>
        /// <returns></returns>
        public static OutputValues DeleteInteractionFromUCS(string interactionID)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestDeleteInteraction requestDeleteInteraction = new RequestDeleteInteraction();
                requestDeleteInteraction.InteractionId = interactionID;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("--------DeleteInteractionFromUCS------------");
                    logger.Info("InteractionId    :" + interactionID);
                    logger.Info("--------------------------------------------");
                    IMessage response = Settings.UCSProtocol.Request(requestDeleteInteraction);
                    if (response != null)
                    {
                        logger.Trace(response.ToString());
                        output.IContactMessage = response;
                        output.MessageCode     = "200";
                        output.Message         = "Delete Interaction from UCS Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Delete Interaction from UCS UnSuccessful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("DeleteInteractionFromUCS() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error Occurred while Delete Interaction from UCS" + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
Beispiel #20
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);
        }
Beispiel #21
0
 public void PopupMID(string mid)
 {
     try
     {
         if (!string.IsNullOrEmpty(_caseId) && _caseId != "invalid" && _caseId != "unknown")
         {
             Navigate(_himmsConfiguration.CaseIdPopupUrl + "?extcaseId=" + _caseId, "caseManagement");
         }
         //PopupCaseID(_himmsConfiguration.CaseIdPopupUrl + "?extcaseId=" + _caseId, "caseManagement");
         else if (!string.IsNullOrEmpty(mid) && mid != "invalid" && mid != "unknown")
         {
             string url = _himmsConfiguration.MIDPopupUrl + "?mid=" + mid;
             //PopupMID(url, "MerchantPopup");
             Navigate(url, "MerchantPopup");
         }
     }
     catch (Exception generalException)
     {
         _logger.Error("Error occurred as " + generalException.Message);
         _logger.Trace("Error Trace : " + generalException.StackTrace);
     }
 }
        /// <summary>
        /// Gets the contacts.
        /// </summary>
        /// <param name="contactId">The contact identifier.</param>
        /// <param name="media">The media.</param>
        /// <param name="tenantId">The tenant identifier.</param>
        /// <returns></returns>
        public static OutputValues GetContacts(SearchCriteriaCollection searchCriteriaCollection, string contactID, int tenantId, int pagemaxSize, List <string> attributesNames)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                RequestGetInteractionsForContact requestGetContacts = RequestGetInteractionsForContact.Create();
                requestGetContacts.DataSource   = new NullableDataSourceType(DataSourceType.Main);
                requestGetContacts.SortCriteria = new SortCriteriaCollection();
                SortCriteriaCollection sortCC = new SortCriteriaCollection();
                SortCriteria           sortc  = new SortCriteria()
                {
                    AttrName = InteractionSearchCriteriaConstants.StartDate, SortOperator = new NullableSortMode(SortMode.Descending), SortIndex = 0
                };
                sortCC.Add(sortc);
                requestGetContacts.SortCriteria   = sortCC;
                requestGetContacts.SearchCriteria = searchCriteriaCollection;
                StringList stringList = new StringList();
                if (attributesNames != null && attributesNames.Count > 0)
                {
                    for (int index = 0; index < attributesNames.Count; index++)
                    {
                        stringList.Add(attributesNames[index]);
                    }
                }
                requestGetContacts.AttributeList = stringList;
                requestGetContacts.TenantId      = tenantId;
                requestGetContacts.ContactId     = contactID;
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("---------------------------------------------------------");
                    IMessage message = Settings.UCSProtocol.Request(requestGetContacts);
                    if (message != null)
                    {
                        logger.Trace(message.ToString());
                        output.IContactMessage = message;
                        output.MessageCode     = "200";
                        output.Message         = "Get Interactions For Contact Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Get Interactions For Contact Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetContacts() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error Occurred while Get Interactions For Contact request" + generalException.ToString());
                output.IContactMessage = null;
                output.MessageCode     = "2001";
                output.Message         = generalException.Message;
            }
            return(output);
        }
        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);
        }
Beispiel #24
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);
        }
        /// <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);
        }
        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);
        }
        public OutputValues GetInteractionProperties(int proxyClientId, string interactionId)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestGetInteractionProperties requestGetInteractionProperties = RequestGetInteractionProperties.Create();
                requestGetInteractionProperties.InteractionId = interactionId;
                requestGetInteractionProperties.ProxyClientId = proxyClientId;


                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestGetInteractionProperties);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventInteractionProperties.MessageId:
                            EventInteractionProperties eventInteractionProperties = (EventInteractionProperties)message;
                            logger.Info("------------Get Interaction Properties-------------");
                            logger.Info("InteractionID  :" + interactionId);
                            logger.Info("ProxyID        :" + proxyClientId);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventInteractionProperties.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Place in Queue Successful";
                            output.IMessage    = message;
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on getting interaction properties-------------");
                            logger.Info("InteractionID  :" + interactionId);
                            logger.Info("ProxyID        :" + proxyClientId);
                            logger.Info("----------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Warn("Error occurred while getting interaction properties : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Get Interaction Properties UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("GetInteractionProperties() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while getting interaction properties " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
Beispiel #29
0
        /// <summary>
        /// Accepts the chat 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 static Pointel.Interactions.Chat.Core.General.OutputValues AcceptChatInteraction(int ticketID, string interactionID, int proxyID)
        {
            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
            {
                Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionDelivery.RequestAccept requestAccept = Genesyslab.Platform.OpenMedia.Protocols.InteractionServer.Requests.InteractionDelivery.RequestAccept.Create();
                requestAccept.TicketId      = ticketID;
                requestAccept.InteractionId = interactionID;
                requestAccept.ProxyClientId = Convert.ToInt32(proxyID);
                //added 27-02-2015
                requestAccept.InitialInFocusState = true;
                //end
                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(requestAccept);
                    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("------------Accepted  Chat 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 Chat 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 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     = "Chat Media Agent Not Ready UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("AcceptChatInteraction() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Accept the chat request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
        /// <summary>
        /// Provides the observer with new data.
        /// </summary>
        /// <param name="value">The current notification information.</param>

        #region OnNext

        public void OnNext(iCallData value)
        {
            string result = string.Empty;

            try
            {
                if (value != null && value.EventMessage != null)
                {
                    switch (value.EventMessage.Id)
                    {
                    case EventRinging.MessageId:
                        EventRinging NewCustomerDataRinging = (EventRinging)value.EventMessage;
                        logger.Trace(NewCustomerDataRinging.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(NewCustomerDataRinging.Name))
                            {
                                SaveDataDB(NewCustomerDataRinging.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                            //default Ringing
                            else if (value.CrmDbData.CallDataEventDBType == null && value.CrmDbData.CallDataEventDBType.Length == 0)
                            {
                                SaveDataDB(NewCustomerDataRinging.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventReleased.MessageId:
                        EventReleased eventReleased = (EventReleased)value.EventMessage;
                        logger.Trace(eventReleased.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventReleased.Name))
                            {
                                SaveDataDB(eventReleased.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventEstablished.MessageId:
                        EventEstablished eventEstablished = (EventEstablished)value.EventMessage;
                        logger.Trace(eventEstablished.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventEstablished.Name))
                            {
                                SaveDataDB(eventEstablished.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventHeld.MessageId:
                        EventHeld eventHeld = (EventHeld)value.EventMessage;
                        logger.Trace(eventHeld.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventHeld.Name))
                            {
                                SaveDataDB(eventHeld.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventPartyChanged.MessageId:
                        EventPartyChanged eventPartyChanged = (EventPartyChanged)value.EventMessage;
                        logger.Trace(eventPartyChanged.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventPartyChanged.Name))
                            {
                                SaveDataDB(eventPartyChanged.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventAttachedDataChanged.MessageId:
                        EventAttachedDataChanged eventAttachedDataChanged = (EventAttachedDataChanged)value.EventMessage;
                        logger.Trace(eventAttachedDataChanged.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventAttachedDataChanged.Name))
                            {
                                SaveDataDB(eventAttachedDataChanged.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventDialing.MessageId:
                        EventDialing eventDialing = (EventDialing)value.EventMessage;
                        logger.Trace(eventDialing.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventDialing.Name))
                            {
                                SaveDataDB(eventDialing.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventRetrieved.MessageId:
                        EventRetrieved eventRetrieved = (EventRetrieved)value.EventMessage;
                        logger.Trace(eventRetrieved.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventRetrieved.Name))
                            {
                                SaveDataDB(eventRetrieved.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventAbandoned.MessageId:
                        EventAbandoned eventAbandoned = (EventAbandoned)value.EventMessage;
                        logger.Trace(eventAbandoned.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventAbandoned.Name))
                            {
                                SaveDataDB(eventAbandoned.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventPartyAdded.MessageId:
                        EventAbandoned eventPartyAdded = (EventAbandoned)value.EventMessage;
                        logger.Trace(eventPartyAdded.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventPartyAdded.Name))
                            {
                                SaveDataDB(eventPartyAdded.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;

                    case EventPartyDeleted.MessageId:
                        EventPartyDeleted eventPartyDeleted = (EventPartyDeleted)value.EventMessage;
                        logger.Trace(eventPartyDeleted.ToString());
                        if (setting.EnableCrmDbCommunication)
                        {
                            if (value.CrmDbData.CallDataEventDBType.Contains(eventPartyDeleted.Name))
                            {
                                SaveDataDB(eventPartyDeleted.UserData, value, parameter: value.CrmDbData.ParameterName);
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while writing call data to a file " + generalException.ToString());
            }
        }