Esempio n. 1
0
 public static ChatInvite GetInstance()
 {
     if (_inviteObject == null)
     {
         _inviteObject = new ChatInvite();
     }
     return(_inviteObject);
 }
Esempio n. 2
0
 /// <summary>
 /// Gets Updated Disposition Code Change
 /// </summary>
 /// <param name="ixnId"></param>
 /// <param name="key"></param>
 /// <param name="code"></param>
 public void UpdateDispositionCodeChange(IXNCustomData dispCode)
 {
     try
     {
         this._logger.Info("UpdateDispositionCodeChange()");
         GetChatData(dispCode.InteractionId, dispCode);
         ChatInvite.GetInstance().UpdateRecords(dispCode, dispCode.InteractionType);
     }
     catch (Exception generalException)
     {
         this._logger.Error("UpdateDispositionCodeChange: Error at updating disposition code Changed : " + generalException.ToString());
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Receives Chat Events
        /// </summary>
        /// <param name="events"></param>
        public void ReceiveChatEvents(IMessage events)
        {
            try
            {
                if (Settings.SFDCOptions.SFDCPopupPages != null)
                {
                    if (events != null)
                    {
                        _logger.Info("Agent Chat Event : " + events.Name);
                        switch (events.Id)
                        {
                        case EventInvite.MessageId:
                            _eventInvite = (EventInvite)events;
                            Settings.ChatProxyClientId = _eventInvite.ProxyClientId;
                            IXNCustomData ixnData = new IXNCustomData();
                            ixnData.InteractionId    = _eventInvite.Interaction.InteractionId;
                            ixnData.InteractionEvent = _eventInvite;
                            if (!_chatIXNCollection.ContainsKey(_eventInvite.Interaction.InteractionId))
                            {
                                _chatIXNCollection.Add(_eventInvite.Interaction.InteractionId, _eventInvite);
                            }
                            GetChatData(_eventInvite.Interaction.InteractionId, ixnData);
                            if (_eventInvite.Interaction.InteractionType == "Inbound")
                            {
                                if (_eventInvite.VisibilityMode.ToString() != "Coach" && _eventInvite.VisibilityMode.ToString() != "Conference")
                                {
                                    ChatInvite.GetInstance().PopupRecords(ixnData, SFDCCallType.InboundChat);
                                }
                                else
                                {
                                    ChatInvite.GetInstance().PopupRecords(ixnData, SFDCCallType.ConsultChatReceived);
                                }
                            }
                            else if (_eventInvite.Interaction.InteractionType == "Consult")
                            {
                                ChatInvite.GetInstance().PopupRecords(ixnData, SFDCCallType.ConsultChatReceived);
                            }
                            break;

                        case EventSessionInfo.MessageId:
                            _sessionInfo = (EventSessionInfo)events;
                            try
                            {
                                if (Settings.SFDCOptions.ChatAttachActivityId && Settings.SFDCListener.ChatActivityIdCollection.Keys.Contains(_sessionInfo.ChatTranscript.SessionId.ToString()) && _sessionInfo.SessionStatus == SessionStatus.Alive)
                                {
                                    Settings.SFDCListener.SetAttachedData(_sessionInfo.ChatTranscript.SessionId.ToString(), Settings.SFDCOptions.ChatAttachActivityIdKeyname, Settings.SFDCListener.ChatActivityIdCollection[_sessionInfo.ChatTranscript.SessionId.ToString()], Settings.ChatProxyClientId);
                                    Settings.SFDCListener.ChatActivityIdCollection.Remove(_sessionInfo.ChatTranscript.SessionId.ToString());
                                }
                                if (_lastSessionId != _eventInvite.Interaction.InteractionId)
                                {
                                    _lastSessionId = _eventInvite.Interaction.InteractionId;

                                    if (!_callDurationData.ContainsKey(_eventInvite.Interaction.InteractionId))
                                    {
                                        _callDurationData.Add(_eventInvite.Interaction.InteractionId, System.DateTime.Now);
                                    }
                                }
                                if (_sessionInfo.SessionStatus == SessionStatus.Over)
                                {
                                    if (_callDurationData.ContainsKey(_sessionInfo.ChatTranscript.SessionId))
                                    {
                                        TimeSpan ts = System.DateTime.Now.Subtract(_callDurationData[_sessionInfo.ChatTranscript.SessionId]);
                                        _callDuration = ts.Hours + "Hr " + ts.Minutes + " mins " + ts.Seconds + "secs";
                                        if (!FinishedCallDuration.ContainsKey(_sessionInfo.ChatTranscript.SessionId))
                                        {
                                            FinishedCallDuration.Add(_sessionInfo.ChatTranscript.SessionId, _callDuration);
                                        }
                                        else
                                        {
                                            FinishedCallDuration[_sessionInfo.ChatTranscript.SessionId] = _callDuration;
                                        }
                                    }
                                }
                            }
                            catch (Exception generalException)
                            {
                                this._logger.Error(generalException.ToString());
                            }
                            break;

                        default:
                            _logger.Info("Unhandled Event " + events.Name);
                            break;
                        }
                    }
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("ReceiveChatEvents : Error occured while receiving Chat events " + generalException.ToString());
            }
        }