public static CallReleased GetInstance() { if (_releasedObject == null) { _releasedObject = new CallReleased(); } return(_releasedObject); }
private void HandleReleaseEvent(EventReleased released, string duration) { try { if (_eventReleased.CallType == CallType.Inbound) { if (!_isConsultCallReceived) { CallReleased.GetInstance().PopupRecords(_eventReleased, SFDCCallType.InboundVoice, duration); } else { _isConsultCallReceived = false; CallReleased.GetInstance().PopupRecords(_eventReleased, SFDCCallType.ConsultVoiceReceived, duration); } } else if (_eventReleased.CallType == CallType.Unknown || _eventReleased.CallType == CallType.Outbound) { if (_isConsultCallReceived) { CallReleased.GetInstance().PopupRecords(_eventReleased, SFDCCallType.ConsultVoiceReceived, duration); _isConsultCallReceived = false; } else { CallReleased.GetInstance().PopupRecords(_eventReleased, SFDCCallType.OutboundVoiceSuccess, duration); } } else if (_eventReleased.CallType == CallType.Consult) { if (_isConsultCallReceived) { CallReleased.GetInstance().PopupRecords(_eventReleased, SFDCCallType.ConsultVoiceReceived, duration); _isConsultCallReceived = false; } //else // CallReleased.GetInstance().PopupRecords(eventReleased, SFDCCallType.ConsultSuccess, duration); } } catch (Exception generalException) { this._logger.Error("HandleReleaseEvent: Error Occurred while on handling call release event:" + generalException.ToString()); } }
public void UpdateOnDispositionCodeChange(IMessage message, string callDuration) { try { this._logger.Info("UpdateOnDispositionCodeChange: Event Name " + message.ToString()); switch (message.Id) { case EventAttachedDataChanged.MessageId: EventAttachedDataChanged attachedDataChanged = (EventAttachedDataChanged)message; if (Settings.SFDCOptions.CanUseGenesysCallDuration && callDuration != null) { _callDuration = callDuration; } else if (_callDurationData.ContainsKey(attachedDataChanged.ConnID.ToString())) { TimeSpan ts = System.DateTime.Now.Subtract(_callDurationData[attachedDataChanged.ConnID.ToString()]); _callDuration = ts.Hours + " Hr " + ts.Minutes + " Mins " + ts.Seconds + " Secs"; } else { this._logger.Info("UpdateOnDispositionCodeChange: Call Duration data is not found in Collection"); _callDuration = "0 Hr 0 Mins 0 Secs"; } if (attachedDataChanged.CallType == CallType.Inbound) { if (this._consultConnId == attachedDataChanged.ConnID.ToString()) { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.ConsultVoiceReceived, _callDuration); } else { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.InboundVoice, _callDuration); } } else if ((attachedDataChanged.CallType == CallType.Outbound) || (attachedDataChanged.CallType == CallType.Unknown)) { if (this._consultConnId == attachedDataChanged.ConnID.ToString()) { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.ConsultVoiceReceived, _callDuration); } else { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.OutboundVoiceSuccess, _callDuration); } } else if (attachedDataChanged.CallType == CallType.Consult) { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.ConsultVoiceReceived, _callDuration); } break; #region EventReleased case EventReleased.MessageId: EventReleased released = (EventReleased)message; if (Settings.SFDCOptions.CanUseGenesysCallDuration && callDuration != null) { _callDuration = callDuration; } else if (FinishedCallDuration.ContainsKey(released.ConnID.ToString())) { _callDuration = FinishedCallDuration[released.ConnID.ToString()]; } else if (_callDurationData.ContainsKey(released.ConnID.ToString())) { TimeSpan ts = System.DateTime.Now.Subtract(_callDurationData[released.ConnID.ToString()]); _callDuration = ts.Hours + " Hr " + ts.Minutes + " Mins " + ts.Seconds + " Secs"; this._logger.Error("UpdateOnDispositionCodeChange: call duration not found in FinishedCallDuration collection for the connId :" + released.ConnID.ToString()); if (!FinishedCallDuration.ContainsKey(released.ConnID.ToString())) { FinishedCallDuration.Add(released.ConnID.ToString(), _callDuration); } } else { this._logger.Error("UpdateOnDispositionCodeChange: call duration not found in both call data collection for the connId :" + released.ConnID.ToString()); _callDuration = "0 Hr 0 Mins 0 Secs"; } if (released.CallType == CallType.Inbound) { if (this._consultConnId == released.ConnID.ToString()) { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.ConsultVoiceReceived, _callDuration); } else { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.InboundVoice, _callDuration); } } else if ((released.CallType == CallType.Outbound) || (released.CallType == CallType.Unknown)) { if (this._consultConnId == released.ConnID.ToString()) { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.ConsultVoiceReceived, _callDuration); } else { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.OutboundVoiceSuccess, _callDuration); } } else if (released.CallType == CallType.Consult) { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.ConsultVoiceReceived, _callDuration); } break; #endregion EventReleased default: break; } } catch (Exception generalException) { this._logger.Error("UpdateOnDispositionCodeChange: Error Occurred : " + generalException.ToString()); } }
public void ReceiveCalls(IMessage events) { try { if (Settings.SFDCOptions.SFDCPopupPages != null) { if (events != null) { logger.Info("ReceiveCalls : Agent Voice Event " + events.ToString()); switch (events.Id) { #region EventRinging case EventRinging.MessageId: eventRinging = (EventRinging)events; if (eventRinging.CallType == CallType.Inbound) { IsConsultCallReceived = false; CallRinging.GetInstance().PopupRecords(eventRinging, SFDCCallType.Inbound); if (!Settings.UserEventData.ContainsKey(eventRinging.ConnID.ToString())) { Settings.UserEventData.Add(eventRinging.ConnID.ToString(), SFDCCallType.Inbound); } } else if (eventRinging.CallType == CallType.Consult) { IsConsultCallReceived = true; CallRinging.GetInstance().PopupRecords(eventRinging, SFDCCallType.ConsultReceived); if (!Settings.UserEventData.ContainsKey(eventRinging.ConnID.ToString())) { Settings.UserEventData.Add(eventRinging.ConnID.ToString(), SFDCCallType.ConsultReceived); } } break; #endregion #region EventPartyChanged case EventPartyChanged.MessageId: EventPartyChanged partyChanged = (EventPartyChanged)events; IsConsultCallReceived = true; if (CallDurationData.ContainsKey(partyChanged.PreviousConnID.ToString()) && !CallDurationData.ContainsKey(partyChanged.ConnID.ToString())) { CallDurationData.Add(partyChanged.ConnID.ToString(), CallDurationData[partyChanged.PreviousConnID.ToString()]); } if (Settings.UpdateSFDCLog.ContainsKey(partyChanged.PreviousConnID.ToString())) { Settings.UpdateSFDCLog.Add(partyChanged.ConnID.ToString(), Settings.UpdateSFDCLog[partyChanged.PreviousConnID.ToString()]); } this.consultConnId = partyChanged.PreviousConnID.ToString(); break; #endregion #region EventDialing case EventDialing.MessageId: eventDialing = (EventDialing)events; if (eventDialing.Reasons != null && eventDialing.Reasons.ContainsKey("ClickToDial")) { Settings.ClickToDialData.Add(eventDialing.ConnID.ToString(), eventDialing.Reasons.GetAsString("ClickToDial")); } if (eventDialing.CallType == CallType.Unknown || eventDialing.CallType == CallType.Outbound) { CallDialing.GetInstance().PopupRecords(eventDialing, SFDCCallType.OutboundSuccess); if (!Settings.UserEventData.ContainsKey(eventDialing.ConnID.ToString())) { Settings.UserEventData.Add(eventDialing.ConnID.ToString(), SFDCCallType.OutboundSuccess); } } else if (eventDialing.CallType == CallType.Consult) { CallDialing.GetInstance().PopupRecords(eventDialing, SFDCCallType.ConsultSuccess); if (!Settings.UserEventData.ContainsKey(eventDialing.ConnID.ToString())) { Settings.UserEventData.Add(eventDialing.ConnID.ToString(), SFDCCallType.ConsultSuccess); } } break; #endregion #region EventEstablished case EventEstablished.MessageId: eventEstablished = (EventEstablished)events; if (!CallDurationData.ContainsKey(eventEstablished.ConnID.ToString())) { CallDurationData.Add(eventEstablished.ConnID.ToString(), System.DateTime.Now); } if (eventEstablished.CallType == CallType.Inbound) { if (IsConsultCallReceived) { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.ConsultReceived); } else { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.Inbound); } } else if (eventEstablished.CallType == CallType.Unknown || eventEstablished.CallType == CallType.Outbound) { if (IsConsultCallReceived) { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.ConsultReceived); } else { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.OutboundSuccess); } } else if (eventEstablished.CallType == CallType.Consult) { if (IsConsultCallReceived) { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.ConsultReceived); } else { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.ConsultSuccess); } } break; #endregion #region EventReleased case EventReleased.MessageId: eventReleased = (EventReleased)events; if (eventReleased.CallState != 22) { string callDuration = string.Empty; if (CallDurationData.ContainsKey(eventReleased.ConnID.ToString())) { TimeSpan ts = System.DateTime.Now.Subtract(CallDurationData[eventReleased.ConnID.ToString()]); callDuration = ts.Hours + "Hr " + ts.Minutes + " mins " + ts.Seconds + "secs"; if (!FinishedCallDuration.ContainsKey(eventReleased.ConnID.ToString())) { FinishedCallDuration.Add(eventReleased.ConnID.ToString(), callDuration); } else { FinishedCallDuration[eventReleased.ConnID.ToString()] = callDuration; } } if (eventReleased.CallType == CallType.Inbound) { if (!IsConsultCallReceived) { CallReleased.GetInstance().PopupRecords(eventReleased, SFDCCallType.Inbound, callDuration); } else { IsConsultCallReceived = false; CallReleased.GetInstance().PopupRecords(eventReleased, SFDCCallType.ConsultReceived, callDuration); } } else if (eventReleased.CallType == CallType.Unknown || eventReleased.CallType == CallType.Outbound) { if (IsConsultCallReceived) { CallReleased.GetInstance().PopupRecords(eventReleased, SFDCCallType.ConsultReceived, callDuration); IsConsultCallReceived = false; } else { CallReleased.GetInstance().PopupRecords(eventReleased, SFDCCallType.OutboundSuccess, callDuration); } } else if (eventReleased.CallType == CallType.Consult) { if (IsConsultCallReceived) { CallReleased.GetInstance().PopupRecords(eventReleased, SFDCCallType.ConsultReceived, callDuration); IsConsultCallReceived = false; } else { CallReleased.GetInstance().PopupRecords(eventReleased, SFDCCallType.ConsultSuccess, callDuration); } } } break; #endregion #region EventUserEvent case EventUserEvent.MessageId: EventUserEvent userEvent = (EventUserEvent)events; if (userEvent.ConnID != null) { if (Settings.UserEventData.ContainsKey(userEvent.ConnID.ToString())) { if (FinishedCallDuration.ContainsKey(userEvent.ConnID.ToString())) { CallUserEvent.GetInstance().UpdateRecords(userEvent, Settings.UserEventData[userEvent.ConnID.ToString()], FinishedCallDuration[userEvent.ConnID.ToString()]); } else { CallUserEvent.GetInstance().UpdateRecords(userEvent, Settings.UserEventData[userEvent.ConnID.ToString()], ""); } } } break; #endregion #region EventError case EventError.MessageId: EventError eventError = (EventError)events; if (eventError.CallType == CallType.Outbound) { CallEventError.GetInstance().PopupRecords(eventError, SFDCCallType.OutboundFailure); } else if (eventError.CallType == CallType.Consult) { CallEventError.GetInstance().PopupRecords(eventError, SFDCCallType.ConsultFailure); } break; #endregion #region EventAbandoned case EventAbandoned.MessageId: EventAbandoned eventAbandoned = (EventAbandoned)events; if (eventAbandoned.CallType == CallType.Outbound) { CallEventAbandoned.GetInstance().PopupRecords(eventAbandoned, SFDCCallType.OutboundFailure); } else if (eventAbandoned.CallType == CallType.Consult) { CallEventAbandoned.GetInstance().PopupRecords(eventAbandoned, SFDCCallType.ConsultFailure); } break; #endregion #region EventDestinationBusy case EventDestinationBusy.MessageId: EventDestinationBusy destinationBusyEvent = (EventDestinationBusy)events; if (destinationBusyEvent.CallType == CallType.Outbound) { CallEventDestinationBusy.GetInstance().PopupRecords(destinationBusyEvent, SFDCCallType.OutboundFailure); } else if (destinationBusyEvent.CallType == CallType.Consult) { CallEventDestinationBusy.GetInstance().PopupRecords(destinationBusyEvent, SFDCCallType.ConsultFailure); } break; #endregion default: logger.Info("ReceiveCalls : Unhandled Event " + events.Name); break; } } } } catch (Exception generalException) { logger.Error("ReceiveCalls : Error occured while receiving voice events " + generalException.ToString()); } }
public void UpdateActivityForReleasedEvent(IMessage message) { try { this.logger.Info("UpdateActivityForReleasedEvent : Event Name " + message.ToString()); switch (message.Id) { case EventAttachedDataChanged.MessageId: EventAttachedDataChanged attachedDataChanged = (EventAttachedDataChanged)message; if (CallDurationData.ContainsKey(attachedDataChanged.ConnID.ToString())) { TimeSpan ts = System.DateTime.Now.Subtract(CallDurationData[attachedDataChanged.ConnID.ToString()]); callDuration = ts.Hours + "Hr " + ts.Minutes + " mins " + ts.Seconds + "secs"; } if (attachedDataChanged.CallType == CallType.Inbound) { if (this.consultConnId == attachedDataChanged.ConnID.ToString()) { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.ConsultReceived, callDuration); } else { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.Inbound, callDuration); } } else if ((attachedDataChanged.CallType == CallType.Outbound) || (attachedDataChanged.CallType == CallType.Unknown)) { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.OutboundSuccess, callDuration); } else if (attachedDataChanged.CallType == CallType.Consult) { CallAttachedDataChanged.GetInstance().UpdateRecords(attachedDataChanged, SFDCCallType.ConsultSuccess, callDuration); } break; #region EventReleased case EventReleased.MessageId: EventReleased released = (EventReleased)message; if (FinishedCallDuration.ContainsKey(released.ConnID.ToString())) { callDuration = FinishedCallDuration[released.ConnID.ToString()]; } else { callDuration = string.Empty; } if (released.CallType == CallType.Inbound) { if (this.consultConnId == released.ConnID.ToString()) { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.ConsultReceived, callDuration); } else { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.Inbound, callDuration); } } else if ((released.CallType == CallType.Outbound) || (released.CallType == CallType.Unknown)) { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.OutboundSuccess, callDuration); } else if (released.CallType == CallType.Consult) { CallReleased.GetInstance().UpdateRecords(released, SFDCCallType.ConsultSuccess, callDuration); } break; #endregion default: break; } } catch (Exception generalException) { this.logger.Error("UpdateActivityForReleasedEvent : Error Occurred : " + generalException.ToString()); } }