private void HandleVoice(iCallData value) { try { Type objType = null; object obj = null; KeyValueCollection userdata = null; MediaEventHelper objEventHelper = new MediaEventHelper(); if (objEventHelper.ConvertVoiceEvent(ref objType, ref obj, ref userdata, value.EventMessage)) { if (objType != null && obj != null) { if (userdata != null && userdata.ContainsKey("AppName")) { if (userdata.GetAsString("AppName").ToLower() == "cs") { if (_himmsConfiguration.AppLocation == "na") { DoNAPopup(userdata); } else if (_himmsConfiguration.AppLocation == "eu") { DoEUPopup(userdata); } else { _logger.Warn("Invalid application location in the HIMMS integration. Application location: " + _himmsConfiguration.AppLocation); } } else { _logger.Trace("There is invalid value in the 'AppName'"); } } else { _logger.Trace("The 'AppName' key not found in the user data."); } } else { _logger.Warn("The event object is null."); } } else { _logger.Warn("Voice event conversion getting failed"); } } catch (Exception generalException) { _logger.Error("Error occurred as " + generalException.Message); _logger.Trace("Error Trace : " + generalException.StackTrace); } }
private void HandleVoice(iCallData value) { try { Type objType = null; object obj = null; KeyValueCollection userdata = null; MediaEventHelper objEventHelper = new MediaEventHelper(); if (objEventHelper.ConvertVoiceEvent(ref objType, ref obj, ref userdata, value.EventMessage)) { if (objType != null && obj != null && objURLConfiguration.PostType != null) { if (objURLConfiguration.PostType.ToLower() == "querystring") { SendTextData(objType, obj, userdata, value); } else if (objURLConfiguration.PostType.ToLower() == "json") { SendJsonData(objType, obj, userdata, value); } else if (objURLConfiguration.PostType.ToLower() == "form") { SendFormData(objType, obj, userdata, value); } else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "lawson") { PopupLawson(value); } //else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "gvas") // DesktopMessenger.communicateUI.PostDataInGVAS(userdata, objURLConfiguration.ApplicationName, objURLConfiguration.PopupURL); else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "gvas") { // Implemented changes for popup multiple URL in GVAS -- 17-11-2015 by sakthikumar // : Start if (!string.IsNullOrEmpty(objURLConfiguration.PopupURL) && objURLConfiguration.PopupURL.Contains(",")) { string[] urls = objURLConfiguration.PopupURL.Split(','); if (userdata != null && userdata.ContainsKey("AppName") && urls.Where(x => x.StartsWith(userdata.GetAsString("AppName"))).ToList().Count > 0) { url = urls.Where(x => x.StartsWith(userdata.GetAsString("AppName"))).SingleOrDefault().Replace(userdata.GetAsString("AppName") + "=", ""); } } else { url = objURLConfiguration.PopupURL; } // : End if (!string.IsNullOrEmpty(url)) { if (userdata != null && userdata.ContainsKey("AppName") && (userdata.GetAsString("AppName").ToUpper() == "VA" || userdata.GetAsString("AppName").ToUpper() == "NVAS")) { DesktopMessenger.midHandler = this; DesktopMessenger.communicateUI.PostDataInGVAS(userdata, objURLConfiguration.ApplicationName, url); } } else { logger.Warn("Popup url is not configured."); } } else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "evas") { if (userdata != null && userdata.ContainsKey("AppName") && userdata.GetAsString("AppName").ToUpper() == "VA") { if (DesktopMessenger.communicateUI != null) { DesktopMessenger.midHandler = this; DesktopMessenger.communicateUI.PostDataToEvas(userdata, objURLConfiguration.ApplicationName, objURLConfiguration.PopupURL); } else { logger.Warn("The desktop communicator is null."); } } } else if (objURLConfiguration.PostType.ToLower() == "custom" && objURLConfiguration.ApplicationName.ToLower() == "nvas") { if (userdata != null && userdata.ContainsKey("AppName") && userdata.GetAsString("AppName").ToUpper() == "NVAS") { if (DesktopMessenger.communicateUI != null) { DesktopMessenger.midHandler = this; DesktopMessenger.communicateUI.PostDataToNvas(userdata, objURLConfiguration.ApplicationName, objURLConfiguration.PopupURL); } else { logger.Warn("The desktop communicator is null."); } } } else if (objURLConfiguration.PostType.ToLower() == "custom") { SendCustomData(objType, obj, userdata, value); } } } else { logger.Warn("Voice event conversion getting failed"); } } catch (Exception generalException) { logger.Error("Error occurred as " + generalException.Message); } }
/// <summary> /// Provides the observer with new data. /// </summary> /// <param name="value">The current notification information.</param> public void OnNext(iCallData value) { Thread pipeThread = new Thread(delegate() { try { if (value == null || value.EventMessage == null) { logger.Warn("Event detail is null."); return; } if (objConfiguration.MediaType != value.MediaType) { return; } if (objConfiguration.PipeEvent == null || objConfiguration.PipeEvent.Where(x => x == value.EventMessage.Name.ToLower()).ToList().Count == 0) { return; } Type objType = null; object obj = null; KeyValueCollection userdata = null; // For Convert voice if (value.MediaType == MediaType.Voice) { MediaEventHelper objEventHelper = new MediaEventHelper(); if (!objEventHelper.ConvertVoiceEvent(ref objType, ref obj, ref userdata, value.EventMessage)) { logger.Warn("Voice event conversion getting failed"); } } else if (value.MediaType == MediaType.Email) { } else if (value.MediaType == MediaType.Chat) { } else if (value.MediaType == MediaType.SMS) { } // Functionality to send data in the specified format. if (objType != null && obj != null) { switch (objConfiguration.PipeFormat) { case "text": SendTextData(objType, obj, userdata); break; case "json": SendJsonData(objType, obj, userdata); break; case "xml": SendXMLData(objType, obj, userdata); break; case "custom": SendTextData(objType, obj, userdata); break; default: logger.Warn("The specified format not supported in the pipe integration"); break; } } else { logger.Warn("Required data is null."); } } catch (Exception generalException) { logger.Error("Error occurred while writing call data to a file " + generalException.ToString()); } }); pipeThread.Start(); }
public void OnNext(iCallData value) { try { if (value == null || value.EventMessage == null) { logger.Warn("Event detail is null."); return; } if (objConfiguration.MediaType != value.MediaType) { return; } if (value.EventMessage.Name.ToLower() != objConfiguration.FileEvent) { return; } KeyValueCollection userData = null; Type objType = null; object obj = null; MediaEventHelper objEventHelper = new MediaEventHelper(); switch (value.MediaType) { case MediaType.Voice: if (!objEventHelper.ConvertVoiceEvent(ref objType, ref obj, ref userData, value.EventMessage)) { logger.Warn("Voice event conversion getting failed"); } break; case MediaType.Email: if (!objEventHelper.ConvertEmailEvent(ref objType, ref obj, ref userData, value.EventMessage)) { logger.Warn("Voice event conversion getting failed"); } break; case MediaType.Chat: if (!objEventHelper.ConvertChatEvent(ref objType, ref obj, ref userData, value.EventMessage)) { logger.Warn("Voice event conversion getting failed"); } break; case MediaType.SMS: if (!objEventHelper.ConvertVoiceEvent(ref objType, ref obj, ref userData, value.EventMessage)) { logger.Warn("Voice event conversion getting failed"); } break; default: logger.Warn("Unsupported media type"); break; } objEventHelper = null; // Functionality to send data in the specified format. if (objType != null && obj != null) { switch (objConfiguration.FileFormat) { case "text": ProcessTextFile(objType, obj, userData); break; case "json": //SendJsonData(objType, obj, userdata); break; case "xml": //SendXMLData(objType, obj, userdata); break; case "custom": //SendTextData(objType, obj, userdata); break; default: logger.Warn("The specified format not supported in the pipe integration"); break; } } else { logger.Warn("Required data is null."); } //if (ConfigContainer.Instance().AllKeys.Contains("enable.eclipse-integration") && ConfigContainer.Instance().GetAsBoolean("enable.eclipse-integration")) //{ // string sectionName = string.Empty; // if (ConfigContainer.Instance().AllKeys.Contains("file.data-section")) // sectionName = ConfigContainer.Instance().GetAsString("file.data-section"); // if (!string.IsNullOrEmpty(sectionName)) // PopupEclipseIntegration(objType, obj, userData, sectionName); // else // logger.Warn("Data section not available to file subscriber"); // return; //} //if (value.FileData.FileFormat == "text") // WriteTextFile(objType, obj, userData, value); //if (value.FileData.FileFormat == "xml") // WriteXMLFile(objType, obj, userData, value); //else // PopupInformation(objType, obj, userData, value); DesktopMessenger.communicateUI.NotifyFileData(userData, setting.attachDataList, value.FileData.EnableView); } catch (Exception generalException) { logger.Error("Error occurred while writing call data to a file " + generalException.ToString()); } }