private void InteractionManager_InteractionEvent(object sender, Infrastructure.EventArgs <Core.Model.Interactions.IInteraction> e) { var interaction = e.Value; if (interaction != null) { if (interaction.State == InteractionStateType.Connected) { KeyValueCollection userData = interaction.ExtractAttachedData(); if (userData != null && Model != null && userData.Contains("CiscoCallID")) { string callId = userData["CiscoCallID"].ToString(); // MessageBox.Show(userData["CiscoCallID"].ToString()); if (callId != null) { _callId = callId; _interactionId = interaction.InteractionId; _caseId = interaction.CaseId; if (FinesseEventListener.Instance.CiscoVoices == null) { FinesseEventListener.Instance.CiscoVoices = new System.Collections.Generic.Dictionary <string, FinView>(); } if (!FinesseEventListener.Instance.CiscoVoices.ContainsKey(_callId)) { FinesseEventListener.Instance.CiscoVoices.Add(_callId, this); } Model.LoadInteraction(callId); Model.FinAgent.AnswerCall(callId); // Auto Answer for the call. Mamdouh Temp } } } } }
private void InteractionManager_InteractionEvent(object sender, Infrastructure.EventArgs <Core.Model.Interactions.IInteraction> e) { var interaction = e.Value; string state = interaction.EntrepriseInteractionCurrent.State.ToString().ToLower(); if (!(interactionID == e.Value.InteractionId)) { interactionID = e.Value.InteractionId; FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module , A new interaction Event"); try { if (interaction != null) { FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module , We have new interaction event" + interaction.State); if (interaction is IInteractionEmail || interaction is IInteractionChat) // We have email interaction received { _interactionId = interaction.InteractionId; _caseId = interaction.CaseId; FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module , we have a new interaction of type Email or Chat"); if (interaction.State == InteractionStateType.Connected) // Interaction is connected , now we should popup { FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module , Interaction of email or chat is connected"); KeyValueCollection userData = interaction.ExtractAttachedData(); userData.Add("CustomerCIC", "123492"); userData.Add("FromAddress", "*****@*****.**"); userData.Add("ToAddress", "*****@*****.**"); //TODO Mamdouh Add Customer CIC and From Address and To Address if (userData != null && Model != null && userData.Contains("CustomerCIC")) { string customerCIC = userData["CustomerCIC"].ToString(); string fromAddress = userData["FromAddress"].ToString(); string toAddress = userData["ToAddress"].ToString(); FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module CIC is:" + customerCIC); if (customerCIC != null) { //check the CIC length is 16 digits string CICFormatted = customerCIC; while (CICFormatted.Length < 16) { CICFormatted = "0" + CICFormatted; } _customerCIC = CICFormatted; Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("CallVar4", _customerCIC); data.Add("InetractionID", _interactionId); data.Add("CaseID", _caseId); data.Add("AgentID", interaction.Agent.UserName); data.Add("AgentExt", "NA"); data.Add("FromAddress", fromAddress); data.Add("ToAddress", toAddress); data.Add("DialNumber", "8016"); //We should popup interaction ID now if (interaction is IInteractionEmail) { FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module Fire WS Event Start Email from address" + fromAddress); WSEventListener.Instance.FireWSEvent(data, EventType.EMAIL, EventDirection.START); } if (interaction is IInteractionChat) { FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module Fire WS Event Start Chat"); WSEventListener.Instance.FireWSEvent(data, EventType.CHAT, EventDirection.START); } } } } else if (interaction.State == InteractionStateType.Ended || interaction.State == InteractionStateType.Dropped) { KeyValueCollection userData = interaction.ExtractAttachedData(); if (userData != null && Model != null && userData.Contains("CustomerCIC")) { string customerCIC = userData["CustomerCIC"].ToString(); if (customerCIC != null) { _customerCIC = customerCIC; Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("CallVar4", _customerCIC); data.Add("InetractionID", _interactionId); data.Add("CaseID", _caseId); //We should popup interaction ID now if (interaction is IInteractionEmail) { WSEventListener.Instance.FireWSEvent(data, EventType.EMAIL, EventDirection.END); } if (interaction is IInteractionChat) { WSEventListener.Instance.FireWSEvent(data, EventType.CHAT, EventDirection.END); } } } } } } } catch (Exception ex) { FinesseEventListener.Instance.FinAgent.FireLogMessage("USD Module , Exception during the event:" + ex.StackTrace + "\n and the message is" + ex.Message); } } }