/// <summary> /// Gets Updated Disposition Code Change /// </summary> /// <param name="ixnId"></param> /// <param name="key"></param> /// <param name="code"></param> public void UpdateDispositionCodeChange(string ixnId, string key, string code) { try { logger.Info("Updating activity log"); if (ChatIXNCollection.ContainsKey(ixnId)) { if (key.Contains(".")) { key = key.Substring(key.LastIndexOf(".")); } EventInvite updateData = ChatIXNCollection[ixnId]; if (updateData != null) { if (updateData.Interaction.InteractionUserData.ContainsKey(key)) { updateData.Interaction.InteractionUserData[key] = code; } else { updateData.Interaction.InteractionUserData.Add(key, code); } if (CallDurationData.ContainsKey(updateData.Interaction.InteractionId)) { TimeSpan ts = System.DateTime.Now.Subtract(CallDurationData[updateData.Interaction.InteractionId]); callDuration = ts.Hours + "Hr " + ts.Minutes + " mins " + ts.Seconds + "secs"; } InboundChatInvite.GetInstance().UpdateRecords(eventInvite, SFDCCallType.InboundChat, callDuration, GetChatInteractionContent(updateData.Interaction.InteractionId).Replace('&', ' ')); } } } catch (Exception generalException) { this.logger.Error("UpdateDispositionCodeChange : Error at updating disposition code Changed : " + generalException.ToString()); } }
/// <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; if (eventInvite.Interaction.InteractionType == "Inbound") { if (eventInvite.VisibilityMode.ToString() != "Coach" && eventInvite.VisibilityMode.ToString() != "Conference") { IsConsultReceived = false; InboundChatInvite.GetInstance().PopupRecords(eventInvite, SFDCCallType.InboundChat); } else { IsConsultReceived = true; InboundChatInvite.GetInstance().PopupRecords(eventInvite, SFDCCallType.ConsultChatReceived); } } else if (eventInvite.Interaction.InteractionType == "Consult") { IsConsultReceived = true; InboundChatInvite.GetInstance().PopupRecords(eventInvite, SFDCCallType.ConsultChatReceived); } break; case EventSessionInfo.MessageId: sessionInfo = (EventSessionInfo)events; try { if (LastSessionId != eventInvite.Interaction.InteractionId) { LastSessionId = eventInvite.Interaction.InteractionId; if (!ChatIXNCollection.ContainsKey(eventInvite.Interaction.InteractionId)) { ChatIXNCollection.Add(eventInvite.Interaction.InteractionId, eventInvite); } if (!CallDurationData.ContainsKey(eventInvite.Interaction.InteractionId)) { CallDurationData.Add(eventInvite.Interaction.InteractionId, System.DateTime.Now); } ChatSessionConnected.GetInstance().PopupRecords(eventInvite, SFDCCallType.InboundChat); } 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; } } if (IsConsultReceived) { ChatSessionEnded.GetInstance().PopupRecords(eventInvite, SFDCCallType.ConsultChatReceived, callDuration, GetChatInteractionContent(sessionInfo.ChatTranscript.SessionId).Replace('&', ' ')); } else { ChatSessionEnded.GetInstance().PopupRecords(eventInvite, SFDCCallType.InboundChat, callDuration, GetChatInteractionContent(sessionInfo.ChatTranscript.SessionId).Replace('&', ' ')); } } } 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()); } }