/// <summary> /// Popup SFDC Records on EventAbandoned Event /// </summary> /// <param name="eventAbandoned"></param> /// <param name="callType"></param> public void PopupRecords(EventAbandoned eventAbandoned, SFDCCallType callType) { try { this._logger.Info("CallEventAbandoned PopupRecords method Invoked for the " + callType.ToString() + " call"); if (Settings.ClickToDialData.ContainsKey(eventAbandoned.ConnID.ToString())) { this._voiceEvents.GetClickToDialLogs(eventAbandoned, eventAbandoned.ConnID.ToString(), callType, Settings.ClickToDialData[eventAbandoned.ConnID.ToString()], "not reachable"); } else if (Settings.SFDCOptions.EnablePopupDialedFromDesktop) { if (callType == SFDCCallType.OutboundVoiceFailure) { _sfdcPopupData = this._voiceEvents.GetOutboundFailurePopupData(eventAbandoned, callType, "not reachable"); if (_sfdcPopupData != null) { _sfdcPopupData.InteractionId = eventAbandoned.ConnID.ToString(); this._searchHandler.ProcessSearchData(eventAbandoned.ConnID.ToString(), _sfdcPopupData, callType); } else { this._logger.Info("Search data is empty"); } } } } catch (Exception generalException) { _logger.Info("PopupRecords : Error Occurred : " + generalException.ToString()); } }
public void ReceiveCalls(IMessage events, TimeSpan?callDuration = null) { try { if (Settings.SFDCOptions.SFDCPopupPages != null) { if (events != null) { try { this._logger.Info("ReceiveCalls: Voice Event Received : " + events.ToString()); } catch { this._logger.Error("Error occurred while printing Voice Event in Log"); } switch (events.Id) { #region EventRinging case EventRinging.MessageId: _eventRinging = (EventRinging)events; IsCallTransfered = false; ConsultText = string.Empty; if (_eventRinging.UserData != null && _eventRinging.UserData.ContainsKey(Settings.SFDCOptions.ConsultAttachDataKey)) { IsCallTransfered = true; ConsultText = _eventRinging.UserData.GetAsString(Settings.SFDCOptions.ConsultAttachDataKey); this._logger.Info("EventRinging : Consult Attach data key found for the ConnId :" + _eventRinging.ConnID.ToString() + " value : " + ConsultText); } if (_eventRinging.CallType == CallType.Inbound) { if (!IsCallTransfered) { _isConsultCallReceived = false; CallRinging.GetInstance().PopupRecords(_eventRinging, SFDCCallType.InboundVoice); } else { _isConsultCallReceived = true; this._consultConnId = _eventRinging.ConnID.ToString(); CallRinging.GetInstance().PopupRecords(_eventRinging, SFDCCallType.ConsultVoiceReceived); } } else if (_eventRinging.CallType == CallType.Consult) { _isConsultCallReceived = true; CallRinging.GetInstance().PopupRecords(_eventRinging, SFDCCallType.ConsultVoiceReceived); } else if (_eventRinging.CallType == CallType.Outbound) { if (IsCallTransfered) { _isConsultCallReceived = true; this._consultConnId = _eventRinging.ConnID.ToString(); CallRinging.GetInstance().PopupRecords(_eventRinging, SFDCCallType.ConsultVoiceReceived); } } break; #endregion EventRinging #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())) { if (!Settings.UpdateSFDCLog.ContainsKey(partyChanged.ConnID.ToString())) { Settings.UpdateSFDCLog.Add(partyChanged.ConnID.ToString(), Settings.UpdateSFDCLog[partyChanged.PreviousConnID.ToString()]); } else { Settings.UpdateSFDCLog[partyChanged.ConnID.ToString()] = Settings.UpdateSFDCLog[partyChanged.PreviousConnID.ToString()]; } } this._consultConnId = partyChanged.ConnID.ToString(); if (partyChanged.UserData != null && partyChanged.UserData.ContainsKey(Settings.SFDCOptions.ConsultAttachDataKey)) { IsCallTransfered = true; ConsultText = partyChanged.UserData.GetAsString(Settings.SFDCOptions.ConsultAttachDataKey); this._logger.Info("PartyChanged : Consult Attach data key found for the ConnId :" + partyChanged.ConnID.ToString() + " value : " + ConsultText); } string duration = "0 Hr 0 Mins 0 Secs"; if (_callDurationData.ContainsKey(partyChanged.ConnID.ToString())) { TimeSpan ts = System.DateTime.Now.Subtract(_callDurationData[partyChanged.ConnID.ToString()]); duration = ts.Hours + " Hr " + ts.Minutes + " Mins " + ts.Seconds + " Secs"; } CallPartyChanged.GetInstance().PopupRecords(partyChanged, SFDCCallType.ConsultVoiceReceived, duration); break; #endregion EventPartyChanged #region EventDialing case EventDialing.MessageId: _eventDialing = (EventDialing)events; if (Settings.SFDCListener.Click2EmailData.ContainsKey("ClickToDial")) { //Settings.ClickToDialData.Add(_eventDialing.ConnID.ToString(), _eventDialing.Reasons.GetAsString("ClickToDial")); Settings.ClickToDialData.Add(_eventDialing.ConnID.ToString(), Settings.SFDCListener.Click2EmailData["ClickToDial"]); Settings.SFDCListener.Click2EmailData.Clear(); } if (_eventDialing.CallType == CallType.Unknown || _eventDialing.CallType == CallType.Outbound) { CallDialing.GetInstance().PopupRecords(_eventDialing, SFDCCallType.OutboundVoiceSuccess); } break; #endregion EventDialing #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.ConsultVoiceReceived); } else { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.InboundVoice); } } else if (eventEstablished.CallType == CallType.Unknown || eventEstablished.CallType == CallType.Outbound) { if (_isConsultCallReceived) { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.ConsultVoiceReceived); } else { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.OutboundVoiceSuccess); } } else if (eventEstablished.CallType == CallType.Consult) { if (_isConsultCallReceived) { CallConnected.GetInstance().PopupRecords(eventEstablished, SFDCCallType.ConsultVoiceReceived); } } break; #endregion EventEstablished #region EventReleased case EventReleased.MessageId: _eventReleased = (EventReleased)events; this._logger.Info("Event Release Call State: " + _eventReleased.CallState.ToString()); if (_eventReleased.CallState != 22) { if (Settings.SFDCOptions.CanUseGenesysCallDuration && callDuration != null) { _callDuration = callDuration.Value.Hours + " Hr " + callDuration.Value.Minutes + " Mins " + callDuration.Value.Seconds + " Secs";; this._logger.Info("ConnectionId : " + _eventReleased.ConnID.ToString() + " Call duration is " + _callDuration); } else 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"; this._logger.Info("ConnectionId : " + _eventReleased.ConnID.ToString() + " Call duration is " + _callDuration); if (!FinishedCallDuration.ContainsKey(_eventReleased.ConnID.ToString())) { FinishedCallDuration.Add(_eventReleased.ConnID.ToString(), _callDuration); } else { FinishedCallDuration[_eventReleased.ConnID.ToString()] = _callDuration; } } else { _callDuration = "0 Hr 0 Mins 0 Secs"; this._logger.Info("Call duration not found for the connection Id : " + _eventReleased.ConnID.ToString()); } HandleReleaseEvent(_eventReleased, _callDuration); } else { this._logger.Info("The call has been rejected for the connectionId : " + _eventReleased.ConnID.ToString()); HandleCallRejected(_eventReleased, "0 Hr 0 Mins 0 Secs"); } break; #endregion EventReleased #region EventError case EventError.MessageId: EventError eventError = (EventError)events; this._logger.Info("EventError occurred for the connectionId : " + eventError.ConnID.ToString()); if (eventError.CallType == CallType.Outbound) { CallEventError.GetInstance().PopupRecords(eventError, SFDCCallType.OutboundVoiceFailure); } break; #endregion EventError #region EventAbandoned case EventAbandoned.MessageId: EventAbandoned eventAbandoned = (EventAbandoned)events; this._logger.Info("EventAbandoned occurred for the connectionId : " + eventAbandoned.ConnID.ToString()); if (eventAbandoned.CallType == CallType.Outbound) { CallEventAbandoned.GetInstance().PopupRecords(eventAbandoned, SFDCCallType.OutboundVoiceFailure); } break; #endregion EventAbandoned #region EventDestinationBusy case EventDestinationBusy.MessageId: EventDestinationBusy destinationBusyEvent = (EventDestinationBusy)events; this._logger.Info("EventDestinationBusy occurred for the connectionId : " + destinationBusyEvent.ConnID.ToString()); if (destinationBusyEvent.CallType == CallType.Outbound) { CallEventDestinationBusy.GetInstance().PopupRecords(destinationBusyEvent, SFDCCallType.OutboundVoiceFailure); } break; #endregion EventDestinationBusy default: _logger.Info("ReceiveCalls: Unhandled Event " + events.Name); break; } } } } catch (Exception generalException) { _logger.Error("ReceiveCalls: Error occurred while receiving voice events " + generalException.ToString()); } }
/// <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()); } }
/// <summary> /// Attributes the filter. /// </summary> /// <param name="value">The value.</param> /// <param name="userData">The user data.</param> /// <returns></returns> #region AttributeFilter private string AttributeFilter(iCallData value, KeyValueCollection userData) { //foreach (string key in value.CrmDbData.AttributeFilter) //{ foreach (KeyValuePair <string, string> keys in value.CrmDbData.ParameterValue) { //if (key != "") // if (userData.AllKeys.Contains(key)) // { // result += key + "=" + Convert.ToString(userData[key]) + value.CrmDbData.Delimiter; // } // else { switch (value.EventMessage.Id) { case EventRinging.MessageId: EventRinging NewCustomerDataRinging = (EventRinging)value.EventMessage; if (NewCustomerDataRinging.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(NewCustomerDataRinging[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(NewCustomerDataRinging["AgentID"]); break; case EventReleased.MessageId: EventReleased eventReleased = (EventReleased)value.EventMessage; if (eventReleased.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventReleased[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventReleased["AgentID"]); break; case EventEstablished.MessageId: EventEstablished eventEstablished = (EventEstablished)value.EventMessage; if (eventEstablished.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventEstablished[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventEstablished["AgentID"]); break; case EventAttachedDataChanged.MessageId: EventAttachedDataChanged eventAttachedDataChanged = (EventAttachedDataChanged)value.EventMessage; if (eventAttachedDataChanged.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventAttachedDataChanged[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventAttachedDataChanged["AgentID"]); break; case EventHeld.MessageId: EventHeld eventHeld = (EventHeld)value.EventMessage; if (eventHeld.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventHeld[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventHeld["AgentID"]); break; case EventPartyChanged.MessageId: EventPartyChanged eventPartyChanged = (EventPartyChanged)value.EventMessage; if (eventPartyChanged.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventPartyChanged[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventPartyChanged["AgentID"]); break; case EventDialing.MessageId: EventDialing eventDialing = (EventDialing)value.EventMessage; if (eventDialing.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventDialing[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventDialing["AgentID"]); break; case EventRetrieved.MessageId: EventRetrieved eventRetrieved = (EventRetrieved)value.EventMessage; if (eventRetrieved.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventRetrieved[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventRetrieved["AgentID"]); break; case EventAbandoned.MessageId: EventAbandoned eventAbandoned = (EventAbandoned)value.EventMessage; if (eventAbandoned.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventAbandoned[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventAbandoned["AgentID"]); break; case EventPartyAdded.MessageId: EventAbandoned eventPartyAdded = (EventAbandoned)value.EventMessage; if (eventPartyAdded.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventPartyAdded[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventPartyAdded["AgentID"]); break; case EventPartyDeleted.MessageId: EventPartyDeleted eventPartyDeleted = (EventPartyDeleted)value.EventMessage; if (eventPartyDeleted.Contains(keys.Key)) { result += keys.Value + "=" + Convert.ToString(eventPartyDeleted[keys.Key]) + value.CrmDbData.Delimiter; } else { result += keys.Value + "=" + "''" + value.CrmDbData.Delimiter; } Settings.AgentId = Convert.ToString(eventPartyDeleted["AgentID"]); break; } } } result = result.Substring(0, result.Length - 1); return(result); }
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 static void InsertCallDetails(object msg) { IMessage message = msg as IMessage; if (message != null) { switch (message.Id) { case EventRinging.MessageId: { EventRinging eventRinging = message as EventRinging; ProcessInsertCallDetails(eventRinging.GetType(), eventRinging); break; } case EventReleased.MessageId: { EventReleased eventRelease = message as EventReleased; ProcessInsertCallDetails(eventRelease.GetType(), eventRelease); break; } case EventEstablished.MessageId: { EventEstablished eventEstablished = message as EventEstablished; ProcessInsertCallDetails(eventEstablished.GetType(), eventEstablished); break; } case EventPartyInfo.MessageId: { EventPartyInfo eventPartyInfo = message as EventPartyInfo; ProcessInsertCallDetails(eventPartyInfo.GetType(), eventPartyInfo); break; } case EventHeld.MessageId: { EventHeld eventHeld = message as EventHeld; ProcessInsertCallDetails(eventHeld.GetType(), eventHeld); break; } case EventPartyChanged.MessageId: { EventPartyChanged eventPartyChanged = message as EventPartyChanged; ProcessInsertCallDetails(eventPartyChanged.GetType(), eventPartyChanged); break; } case EventAttachedDataChanged.MessageId: { EventAttachedDataChanged eventDataChanged = message as EventAttachedDataChanged; ProcessInsertCallDetails(eventDataChanged.GetType(), eventDataChanged); break; } case EventDialing.MessageId: { EventDialing eventDialing = message as EventDialing; ProcessInsertCallDetails(eventDialing.GetType(), eventDialing); break; } case EventRetrieved.MessageId: { EventRetrieved eventRetrieved = message as EventRetrieved; ProcessInsertCallDetails(eventRetrieved.GetType(), eventRetrieved); break; } case EventAbandoned.MessageId: { EventAbandoned eventAbandoned = message as EventAbandoned; ProcessInsertCallDetails(eventAbandoned.GetType(), eventAbandoned); break; } case EventPartyAdded.MessageId: { EventPartyAdded eventPartyAdded = message as EventPartyAdded; ProcessInsertCallDetails(eventPartyAdded.GetType(), eventPartyAdded); break; } case EventPartyDeleted.MessageId: { EventPartyDeleted eventpartyDeleted = message as EventPartyDeleted; ProcessInsertCallDetails(eventpartyDeleted.GetType(), eventpartyDeleted); break; } } } if (message.Id == EventRinging.MessageId) { // ProcessEventRaising(message as EventRinging); } else if (message.Id == EventReleased.MessageId) { // ProcessEventRelease(message as EventReleased); EventReleased eventRelease = message as EventReleased; ProcessInsertCallDetails(eventRelease.GetType(), eventRelease); } }
public static string GetSendCallDetailString(IMessage message) { string queryString = string.Empty; try { if (message != null) { switch (message.Id) { case EventRinging.MessageId: { EventRinging eventRinging = message as EventRinging; queryString = ProcessKeyName(eventRinging.GetType(), eventRinging); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventRinging.UserData); break; } case EventReleased.MessageId: { EventReleased eventRelease = message as EventReleased; queryString = ProcessKeyName(eventRelease.GetType(), eventRelease); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventRelease.UserData); break; } case EventEstablished.MessageId: { EventEstablished eventEstablished = message as EventEstablished; queryString = ProcessKeyName(eventEstablished.GetType(), eventEstablished); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventEstablished.UserData); break; } case EventPartyInfo.MessageId: { EventPartyInfo eventPartyInfo = message as EventPartyInfo; queryString = ProcessKeyName(eventPartyInfo.GetType(), eventPartyInfo); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventPartyInfo.UserData); break; } case EventHeld.MessageId: { EventHeld eventHeld = message as EventHeld; queryString = ProcessKeyName(eventHeld.GetType(), eventHeld); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventHeld.UserData); break; } case EventPartyChanged.MessageId: { EventPartyChanged eventPartyChanged = message as EventPartyChanged; queryString = ProcessKeyName(eventPartyChanged.GetType(), eventPartyChanged); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventPartyChanged.UserData); break; } case EventAttachedDataChanged.MessageId: { EventAttachedDataChanged eventDataChanged = message as EventAttachedDataChanged; queryString = ProcessKeyName(eventDataChanged.GetType(), eventDataChanged); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventDataChanged.UserData); break; } case EventDialing.MessageId: { EventDialing eventDialing = message as EventDialing; queryString = ProcessKeyName(eventDialing.GetType(), eventDialing); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventDialing.UserData); break; } case EventRetrieved.MessageId: { EventRetrieved eventRetrieved = message as EventRetrieved; queryString = ProcessKeyName(eventRetrieved.GetType(), eventRetrieved); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventRetrieved.UserData); break; } case EventAbandoned.MessageId: { EventAbandoned eventAbandoned = message as EventAbandoned; queryString = ProcessKeyName(eventAbandoned.GetType(), eventAbandoned); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventAbandoned.UserData); break; } case EventPartyAdded.MessageId: { EventPartyAdded eventPartyAdded = message as EventPartyAdded; queryString = ProcessKeyName(eventPartyAdded.GetType(), eventPartyAdded); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventPartyAdded.UserData); break; } case EventPartyDeleted.MessageId: { EventPartyDeleted eventpartyDeleted = message as EventPartyDeleted; queryString = ProcessKeyName(eventpartyDeleted.GetType(), eventpartyDeleted); queryString += ((queryString.Length > 0) ? Settings.GetInstance().PortSetting.SendDataDelimiter : "") + ProcessUserData(eventpartyDeleted.UserData); break; } } } } catch (Exception ex) { throw ex; } return(queryString); }
public bool ConvertChatEvent(ref Type objType, ref object obj, ref KeyValueCollection userData, IMessage objEvent) { // ID = 0; if (objEvent != null) { switch (objEvent.Id) { case EventRinging.MessageId: EventRinging eventRinging = (EventRinging)objEvent; objType = eventRinging.GetType(); obj = eventRinging; userData = eventRinging.UserData; break; case EventReleased.MessageId: EventReleased eventReleased = (EventReleased)objEvent; objType = eventReleased.GetType(); obj = eventReleased; userData = eventReleased.UserData; break; case EventEstablished.MessageId: EventEstablished eventEstablished = (EventEstablished)objEvent; objType = eventEstablished.GetType(); obj = eventEstablished; userData = eventEstablished.UserData; break; case EventHeld.MessageId: EventHeld eventHeld = (EventHeld)objEvent; objType = eventHeld.GetType(); obj = eventHeld; userData = eventHeld.UserData; break; case EventPartyChanged.MessageId: EventPartyChanged eventPartyChanged = (EventPartyChanged)objEvent; objType = eventPartyChanged.GetType(); obj = eventPartyChanged; userData = eventPartyChanged.UserData; break; case EventAttachedDataChanged.MessageId: EventAttachedDataChanged eventAttachedDataChanged = (EventAttachedDataChanged)objEvent; objType = eventAttachedDataChanged.GetType(); obj = eventAttachedDataChanged; userData = eventAttachedDataChanged.UserData; break; case EventDialing.MessageId: EventDialing eventDialing = (EventDialing)objEvent; objType = eventDialing.GetType(); obj = eventDialing; userData = eventDialing.UserData; break; case EventRetrieved.MessageId: EventRetrieved eventRetrieved = (EventRetrieved)objEvent; objType = eventRetrieved.GetType(); obj = eventRetrieved; userData = eventRetrieved.UserData; break; case EventAbandoned.MessageId: EventAbandoned eventAbandoned = (EventAbandoned)objEvent; objType = eventAbandoned.GetType(); obj = eventAbandoned; userData = eventAbandoned.UserData; break; case EventPartyAdded.MessageId: EventAbandoned eventPartyAdded = (EventAbandoned)objEvent; objType = eventPartyAdded.GetType(); obj = eventPartyAdded; userData = eventPartyAdded.UserData; break; case EventPartyDeleted.MessageId: EventPartyDeleted eventPartyDeleted = (EventPartyDeleted)objEvent; objType = eventPartyDeleted.GetType(); obj = eventPartyDeleted; userData = eventPartyDeleted.UserData; break; } } return(obj != null && objType != null); }
// public long// ID = 0; public bool ConvertVoiceEvent(ref Type objType, ref object obj, ref KeyValueCollection userData, IMessage objEvent) { // ID = 0; if (objEvent != null) { switch (objEvent.Id) { case EventRinging.MessageId: EventRinging eventRinging = (EventRinging)objEvent; // ID =eventRinging.ConnID.ToLong(); objType = eventRinging.GetType(); obj = eventRinging; userData = eventRinging.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventRinging.ConnID.ToString()); } break; case EventReleased.MessageId: EventReleased eventReleased = (EventReleased)objEvent; // ID = eventReleased.ConnID.ToString().ToLong(); objType = eventReleased.GetType(); obj = eventReleased; userData = eventReleased.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventReleased.ConnID.ToString()); } break; case EventEstablished.MessageId: EventEstablished eventEstablished = (EventEstablished)objEvent; // ID = eventEstablished.ConnID.ToString().ToLong(); objType = eventEstablished.GetType(); obj = eventEstablished; userData = eventEstablished.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventEstablished.ConnID.ToString()); } break; case EventHeld.MessageId: EventHeld eventHeld = (EventHeld)objEvent; // ID = eventHeld.ConnID.ToString().ToLong(); objType = eventHeld.GetType(); obj = eventHeld; userData = eventHeld.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventHeld.ConnID.ToString()); } break; case EventPartyChanged.MessageId: EventPartyChanged eventPartyChanged = (EventPartyChanged)objEvent; // ID = eventPartyChanged.ConnID.ToString().ToLong(); objType = eventPartyChanged.GetType(); obj = eventPartyChanged; userData = eventPartyChanged.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventPartyChanged.ConnID.ToString()); } break; case EventAttachedDataChanged.MessageId: EventAttachedDataChanged eventAttachedDataChanged = (EventAttachedDataChanged)objEvent; // ID = eventAttachedDataChanged.ConnID.ToString().ToLong(); objType = eventAttachedDataChanged.GetType(); obj = eventAttachedDataChanged; userData = eventAttachedDataChanged.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventAttachedDataChanged.ConnID.ToString()); } break; case EventDialing.MessageId: EventDialing eventDialing = (EventDialing)objEvent; // ID = eventDialing.ConnID.ToString().ToLong(); objType = eventDialing.GetType(); obj = eventDialing; userData = eventDialing.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventDialing.ConnID.ToString()); } break; case EventRetrieved.MessageId: EventRetrieved eventRetrieved = (EventRetrieved)objEvent; // ID = eventRetrieved.ConnID.ToString().ToLong(); objType = eventRetrieved.GetType(); obj = eventRetrieved; userData = eventRetrieved.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventRetrieved.ConnID.ToString()); } break; case EventAbandoned.MessageId: EventAbandoned eventAbandoned = (EventAbandoned)objEvent; // ID = eventAbandoned.ConnID.ToString().ToLong(); objType = eventAbandoned.GetType(); obj = eventAbandoned; userData = eventAbandoned.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventAbandoned.ConnID.ToString()); } break; case EventPartyAdded.MessageId: EventAbandoned eventPartyAdded = (EventAbandoned)objEvent; // ID = eventPartyAdded.ConnID.ToString().ToLong(); objType = eventPartyAdded.GetType(); obj = eventPartyAdded; userData = eventPartyAdded.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventPartyAdded.ConnID.ToString()); } break; case EventPartyDeleted.MessageId: EventPartyDeleted eventPartyDeleted = (EventPartyDeleted)objEvent; // ID = eventPartyDeleted.ConnID.ToString().ToLong(); objType = eventPartyDeleted.GetType(); obj = eventPartyDeleted; userData = eventPartyDeleted.UserData; if (userData != null && !userData.ContainsKey("ConnectionId")) { userData.Add("ConnectionId", eventPartyDeleted.ConnID.ToString()); } break; } } return(obj != null && objType != null); }