private SFDCUserActivity() { this.logger = Log.GenInstance(); this.voiceUserActivityOptions = Settings.UserActivityVoiceOptions; this.chatUserActivityOptions = Settings.UserActivityChatOptions; this.voiceUserActivityLog = (Settings.VoiceActivityLogCollection.ContainsKey("useractivity")) ? Settings.VoiceActivityLogCollection["useractivity"] : null; this.chatUserActivityLog = (Settings.ChatActivityLogCollection.ContainsKey("useractivity")) ? Settings.ChatActivityLogCollection["useractivity"] : null; this.sfdcObject = SFDCUtility.GetInstance(); }
private SFDCLead() { this.logger = Log.GenInstance(); this.sfdcObject = SFDCUtility.GetInstance(); this.leadVoiceOptions = Settings.LeadVoiceOptions; this.leadChatOptions = Settings.LeadChatOptions; this.LeadLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("lead")) ? Settings.VoiceActivityLogCollection["lead"] : null; this.LeadChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("lead")) ? Settings.ChatActivityLogCollection["lead"] : null; this.LeadRecordConfig = Settings.LeadNewRecordConfigs; }
/// <summary> /// Constructor /// </summary> private SFDCAccount() { this.logger = Log.GenInstance(); this.accountVoiceOptions = Settings.AccountVoiceOptions; this.accountChatOptions = Settings.AccountChatOptions; AccountLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("account")) ? Settings.VoiceActivityLogCollection["account"] : null; AccountChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("account")) ? Settings.ChatActivityLogCollection["account"] : null; AccountRecordConfig = Settings.AccountNewRecordConfigs; this.sfdcObject = SFDCUtility.GetInstance(); }
private SFDCCustomObject() { this.logger = Log.GenInstance(); this.customvoiceOptions = Settings.CustomObjectVoiceOptions; this.customchatOptions = Settings.CustomObjectChatOptions; this.CustomVoiceLogConfigs = Settings.VoiceActivityLogCollection; this.CustomRecordConfigs = Settings.CustomObjectNewRecordConfigs; this.CustomChatLogConfigs = Settings.ChatActivityLogCollection; this.sfdcObject = SFDCUtility.GetInstance(); }
/// <summary> /// Constructor /// </summary> private SFDCCase() { this.logger = Log.GenInstance(); this.CaseVoiceOptions = Settings.CaseVoiceOptions; this.CaseChatOptions = Settings.CaseChatOptions; this.CaseLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("case")) ? Settings.VoiceActivityLogCollection["case"] : null; this.CaseChatLogOptions = (Settings.ChatActivityLogCollection.ContainsKey("case")) ? Settings.ChatActivityLogCollection["case"] : null; this.CaseRecordConfig = Settings.CaseNewRecordConfigs; this.sfdcObject = SFDCUtility.GetInstance(); }
/// <summary> /// Constructor /// </summary> private SFDCContact() { this.logger = Log.GenInstance(); this.sfdcObject = SFDCUtility.GetInstance(); this.contactVoiceOptions = Settings.ContactVoiceOptions; this.contactChatOptions = Settings.ContactChatOptions; this.ContactLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("contact")) ? Settings.VoiceActivityLogCollection["contact"] : null; ContactChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("contact")) ? Settings.ChatActivityLogCollection["contact"] : null; ContactRecordConfig = Settings.ContactNewRecordConfigs; }
private SFDCOpportunity() { this.logger = Log.GenInstance(); this.opportunityVoiceOptions = Settings.OpportunityVoiceOptions; this.opportunityChatOptions = Settings.OpportunityChatOptions; this.OpportunityLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("opportunity")) ? Settings.VoiceActivityLogCollection["opportunity"] : null; this.OpportunityChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("opportunity")) ? Settings.ChatActivityLogCollection["opportunity"] : null; this.OpportunityRecordConfig = Settings.OpportunityNewRecordConfigs; this.sfdcObject = SFDCUtility.GetInstance(); }
private SFDCUserActivity() { this._logger = Log.GenInstance(); this._voiceUserActivityOptions = Settings.UserActivityVoiceOptions; this._chatUserActivityOptions = Settings.UserActivityChatOptions; this._voiceUserActivityLog = (Settings.VoiceActivityLogCollection.ContainsKey("useractivity")) ? Settings.VoiceActivityLogCollection["useractivity"] : null; this._chatUserActivityLog = (Settings.ChatActivityLogCollection.ContainsKey("useractivity")) ? Settings.ChatActivityLogCollection["useractivity"] : null; this._sfdcUtility = SFDCUtility.GetInstance(); this._emailUserActivityOptions = Settings.UserActivityEmailOptions; this._emailUserActivityLog = (Settings.EmailActivityLogCollection.ContainsKey("useractivity")) ? Settings.EmailActivityLogCollection["useractivity"] : null; }
/// <summary> /// Constructor /// </summary> private SFDCCase() { this._logger = Log.GenInstance(); this._caseVoiceOptions = Settings.CaseVoiceOptions; this._caseChatOptions = Settings.CaseChatOptions; this._caseLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("case")) ? Settings.VoiceActivityLogCollection["case"] : null; this._caseChatLogOptions = (Settings.ChatActivityLogCollection.ContainsKey("case")) ? Settings.ChatActivityLogCollection["case"] : null; this._caseEmailRecordConfig = (Settings.EmailNewRecordCollection.ContainsKey("case")) ? Settings.EmailNewRecordCollection["case"] : null; this._caseVoiceRecordConfig = (Settings.VoiceNewRecordCollection.ContainsKey("case")) ? Settings.VoiceNewRecordCollection["case"] : null; this._caseChatRecordConfig = (Settings.ChatNewRecordCollection.ContainsKey("case")) ? Settings.ChatNewRecordCollection["case"] : null; this._sfdcUtility = SFDCUtility.GetInstance(); this._caseEmailOptions = Settings.CaseEmailOptions; this._caseEmailLogOptions = (Settings.EmailActivityLogCollection.ContainsKey("case")) ? Settings.EmailActivityLogCollection["case"] : null; this._sfdcUtilityHelper = SFDCUtiltiyHelper.GetInstance(); }
/// <summary> /// Constructor /// </summary> private SFDCContact() { this.logger = Log.GenInstance(); this.sfdcUtility = SFDCUtility.GetInstance(); this.contactVoiceOptions = Settings.ContactVoiceOptions; this.contactChatOptions = Settings.ContactChatOptions; this.ContactLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("contact")) ? Settings.VoiceActivityLogCollection["contact"] : null; ContactChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("contact")) ? Settings.ChatActivityLogCollection["contact"] : null; this.ContactEmailRecordConfig = (Settings.EmailNewRecordCollection.ContainsKey("contact")) ? Settings.EmailNewRecordCollection["contact"] : null; this.ContactVoiceRecordConfig = (Settings.VoiceNewRecordCollection.ContainsKey("contact")) ? Settings.VoiceNewRecordCollection["contact"] : null; this.ContactChatRecordConfig = (Settings.ChatNewRecordCollection.ContainsKey("contact")) ? Settings.ChatNewRecordCollection["contact"] : null; this.ContactEmailLogConfig = (Settings.EmailActivityLogCollection.ContainsKey("contact")) ? Settings.EmailActivityLogCollection["contact"] : null; this.contactEmailOptions = Settings.ContactEmailOptions; this.sfdcUtilityHelper = SFDCUtiltiyHelper.GetInstance(); }
private SFDCOpportunity() { this._logger = Log.GenInstance(); this._opportunityVoiceOptions = Settings.OpportunityVoiceOptions; this._opportunityChatOptions = Settings.OpportunityChatOptions; this._opportunityLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("opportunity")) ? Settings.VoiceActivityLogCollection["opportunity"] : null; this._opportunityChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("opportunity")) ? Settings.ChatActivityLogCollection["opportunity"] : null; this._opportunityEmailRecordConfig = (Settings.EmailNewRecordCollection.ContainsKey("opportunity")) ? Settings.EmailNewRecordCollection["opportunity"] : null; this._opportunityVoiceRecordConfig = (Settings.VoiceNewRecordCollection.ContainsKey("opportunity")) ? Settings.VoiceNewRecordCollection["opportunity"] : null; this._opportunityChatRecordConfig = (Settings.ChatNewRecordCollection.ContainsKey("opportunity")) ? Settings.ChatNewRecordCollection["opportunity"] : null; this._sfdcUtility = SFDCUtility.GetInstance(); this._sfdcUtilityHelper = SFDCUtiltiyHelper.GetInstance(); this._opportunityEmailLogConfig = (Settings.EmailActivityLogCollection.ContainsKey("opportunity")) ? Settings.EmailActivityLogCollection["opportunity"] : null; this._opportunityEmailOptions = Settings.OpportunityEmailOptions; }
private SFDCCustomObject() { this.logger = Log.GenInstance(); this.customvoiceOptions = Settings.CustomObjectVoiceOptions; this.customchatOptions = Settings.CustomObjectChatOptions; this.CustomVoiceLogConfigs = Settings.VoiceActivityLogCollection; this.CustomVoiceRecordConfigs = Settings.VoiceNewRecordCollection; this.CustomEmailRecordConfigs = Settings.EmailNewRecordCollection; this.CustomChatRecordConfigs = Settings.ChatNewRecordCollection; this.CustomChatLogConfigs = Settings.ChatActivityLogCollection; this.sfdcUtility = SFDCUtility.GetInstance(); this.CustomEmailLogConfigs = Settings.EmailActivityLogCollection; this.customemailOptions = Settings.CustomObjectEmailOptions; this.sfdcUtilityHelper = SFDCUtiltiyHelper.GetInstance(); }
/// <summary> /// Constructor /// </summary> private SFDCAccount() { this._logger = Log.GenInstance(); this._accountVoiceOptions = Settings.AccountVoiceOptions; this._accountChatOptions = Settings.AccountChatOptions; _accountLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("account")) ? Settings.VoiceActivityLogCollection["account"] : null; _accountChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("account")) ? Settings.ChatActivityLogCollection["account"] : null; this._accountEmailRecordConfig = (Settings.EmailNewRecordCollection.ContainsKey("account")) ? Settings.EmailNewRecordCollection["account"] : null; this._accountVoiceRecordConfig = (Settings.VoiceNewRecordCollection.ContainsKey("account")) ? Settings.VoiceNewRecordCollection["account"] : null; this._accountChatRecordConfig = (Settings.ChatNewRecordCollection.ContainsKey("account")) ? Settings.ChatNewRecordCollection["account"] : null; this._sfdcUtility = SFDCUtility.GetInstance(); this._accountEmailOptions = Settings.AccountEmailOptions; this._accountEmailLogConfig = Settings.EmailActivityLogCollection.ContainsKey("account") ? Settings.EmailActivityLogCollection["account"] : null; this._sfdcUtilityHelper = SFDCUtiltiyHelper.GetInstance(); }
/// <summary> /// Creates an Instance of the Class /// </summary> public ChatEvents() { this.logger = Log.GenInstance(); this.leadOptions = Settings.LeadChatOptions; this.contactOptions = Settings.ContactChatOptions; this.accountOptions = Settings.AccountChatOptions; this.caseOptions = Settings.CaseChatOptions; this.opportunityOptions = Settings.OpportunityChatOptions; this.userActivityLog = (Settings.ChatActivityLogCollection.ContainsKey("useractivity")) ? Settings.ChatActivityLogCollection["useractivity"] : null; this.sfdcObject = SFDCUtility.GetInstance(); this.activityLogs = Settings.ChatActivityLogCollection; this.customObjectOptions = Settings.CustomObjectChatOptions; this.userActivityOptions = Settings.UserActivityChatOptions; this.PopupPages = Settings.SFDCOptions.SFDCPopupPages; }
private SFDCLead() { this.logger = Log.GenInstance(); this.sfdcUtility = SFDCUtility.GetInstance(); this.leadVoiceOptions = Settings.LeadVoiceOptions; this.leadChatOptions = Settings.LeadChatOptions; this.LeadLogConfig = (Settings.VoiceActivityLogCollection.ContainsKey("lead")) ? Settings.VoiceActivityLogCollection["lead"] : null; this.LeadChatLogConfig = (Settings.ChatActivityLogCollection.ContainsKey("lead")) ? Settings.ChatActivityLogCollection["lead"] : null; this.LeadEmailRecordConfig = (Settings.EmailNewRecordCollection.ContainsKey("lead")) ? Settings.EmailNewRecordCollection["lead"] : null; this.LeadVoiceRecordConfig = (Settings.VoiceNewRecordCollection.ContainsKey("lead")) ? Settings.VoiceNewRecordCollection["lead"] : null; this.LeadChatRecordConfig = (Settings.ChatNewRecordCollection.ContainsKey("lead")) ? Settings.ChatNewRecordCollection["lead"] : null; this.LeadEmailLogConfig = (Settings.EmailActivityLogCollection.ContainsKey("lead")) ? Settings.EmailActivityLogCollection["lead"] : null; this.LeadEmailWorkbinConfig = (Settings.EmailActivityLogCollection.ContainsKey("workbin")) ? Settings.EmailActivityLogCollection["workbin"] : null; this.leadEmailOptions = Settings.LeadEmailOptions; this.sfdcUtilityHelper = SFDCUtiltiyHelper.GetInstance(); }
/// <summary> /// Creates an Instance of the Class /// </summary> public ChatManager() { this._logger = Log.GenInstance(); this._leadOptions = Settings.LeadChatOptions; this._contactOptions = Settings.ContactChatOptions; this._accountOptions = Settings.AccountChatOptions; this._caseOptions = Settings.CaseChatOptions; this._opportunityOptions = Settings.OpportunityChatOptions; this._userActivityLog = (Settings.ChatActivityLogCollection.ContainsKey("useractivity")) ? Settings.ChatActivityLogCollection["useractivity"] : null; this._sFDCUtility = SFDCUtility.GetInstance(); this._activityLogs = Settings.ChatActivityLogCollection; this._customObjectOptions = Settings.CustomObjectChatOptions; this._userActivityOptions = Settings.UserActivityChatOptions; this._popupPages = Settings.SFDCOptions.SFDCPopupPages; this._generalOptions = Settings.SFDCOptions; this._sfdcUtilityHelper = SFDCUtiltiyHelper.GetInstance(); }
private void Process(IAsyncResult result) { try { lastPingTime = DateTime.Now; HttpListener listener = (HttpListener)result.AsyncState; listener.IgnoreWriteExceptions = true; if (listener.IsListening && !AdapeterStopped) { HttpListenerContext context = listener.EndGetContext(result); HttpListenerRequest request = context.Request; // Obtain a response object. HttpListenerResponse response = context.Response; string filename = context.Request.Url.AbsolutePath; string ack = context.Request.QueryString["ack"]; filename = filename.Substring(1); if (string.IsNullOrEmpty(filename)) { if (File.Exists(Path.Combine(_rootDirectory, startPage))) { filename = startPage; } } #region Dial Region if (filename.Equals("dial")) { try { string phoneno = context.Request.QueryString["phoneno"]; logger.Info("Phone number received from salesforce : " + phoneno); if (!String.IsNullOrEmpty(phoneno)) { //phoneno = TruncateNumbers(phoneno, 10); logger.Info("Invoking Call dialing procedure"); this.makeOutboundCall.MakeVoiceCall(phoneno, context.Request.QueryString["Type"], context.Request.QueryString["Id"]); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); return; } } catch (Exception generalException) { logger.Error("Process : Error occurred while processing dial request : " + generalException.ToString()); } } #endregion Dial Region #region SessionId Region if (filename.Equals("sessionid")) { try { string sessionId = context.Request.QueryString["sessionid"]; context.Response.ContentType = "text/html"; context.Response.AddHeader("Date", DateTime.Now.ToString("r")); logger.Info("SessionId Received from Salesforce : " + (string.IsNullOrEmpty(sessionId) ? "0 Length" : Convert.ToString(sessionId.Length))); if (Settings.SFDCOptions.CanEnableSessionIDInLog) { logger.Info("Received session id is:" + sessionId); } if (!string.IsNullOrEmpty(sessionId)) { //if (!string.IsNullOrEmpty(SFDCUtility.SForce.SessionHeaderValue.sessionId) && // (SFDCUtility.SForce.SessionHeaderValue.sessionId == sessionId)) //{ // logger.Info("Same SessionId Received from Salesforce, TestRequest not invoked"); //} //else { SFDCUtility.SForce.SessionHeaderValue.sessionId = sessionId; SessionKeepAliveInit(); if (!NewSessionIDFlag) { logger.Info("New SessionId Received from Salesforce, Invoking Salesforce TestRequest"); new System.Threading.Tasks.Task(() => Pointel.Salesforce.Adapter.SFDCModels.SFDCUtility.GetInstance().SendTestRequest()).Start(); } else { logger.Info("sessionId received retrying search operation"); SFDCUtility sFDCUtility = SFDCUtility.GetInstance(); if (sFDCUtility != null) { Settings.SFDCListener.SendSessionStatus(SFDCSessionStatus.Connected); logger.Info("sFDCUtility.SessionSearchCollection count :" + sFDCUtility.SessionSearchCollection.Count); logger.Info("sFDCUtility.SessionCreateActivityCollection count :" + sFDCUtility.SessionCreateActivityCollection.Count); logger.Info("sFDCUtility.SessionUpdateActivityCollection count :" + sFDCUtility.SessionUpdateActivityCollection.Count); if (sFDCUtility.SessionSearchCollection.Count > 0) { foreach (var tuple in sFDCUtility.SessionSearchCollection.ToArray()) { logger.Info("search method invoked for interaction id :" + tuple.Item1); VoiceEvents.GetInstance().ProcessSearchData(tuple.Item1, tuple.Item3, tuple.Item2); } NewSessionIDFlag = false; } if (sFDCUtility.SessionCreateActivityCollection.Count > 0) { foreach (var tuple in sFDCUtility.SessionCreateActivityCollection.ToArray()) { logger.Info("Create activity log method invoked for interaction id :" + tuple.Item1); sFDCUtility.CreateActivityLog(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); } NewSessionIDFlag = false; } if (sFDCUtility.SessionUpdateActivityCollection.Count > 0) { foreach (var tuple in sFDCUtility.SessionUpdateActivityCollection.ToArray()) { logger.Info("update activity log method invoked for interaction id :" + tuple.Item1); sFDCUtility.UpdateActivityLog(tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5); } NewSessionIDFlag = false; } } else { logger.Error("SFDCHttpServer: Session id: SFDC utility object is null cannot perform retry"); } } } } context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); return; } catch (Exception generalException) { logger.Error("Process : Error occurred while receiving sesssionId : " + generalException.ToString()); } } #endregion SessionId Region #region TimeZone Region if (filename.Equals("timezone")) { try { string timeZone = context.Request.QueryString["timezone"]; logger.Info("TimeZone received from Salesforce :" + timeZone); if (!string.IsNullOrEmpty(timeZone)) { timeZone = timeZone.Substring(1, timeZone.IndexOf(')') - 1); if (CanGetTimeZoneFromSFDC) { Settings.SFDCOptions.SFDCTimeZone = timeZone; logger.Info("TimeZone value taken as :" + timeZone); } } context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); return; } catch (Exception generalException) { logger.Error("Process : Error occurred while receiving TimeZone from SFDC : " + generalException.ToString()); } } #endregion TimeZone Region #region ScriptError Region if (filename.Equals("scripterror")) { try { logger.Error("Script Error Received from SFDC Script : " + context.Request.QueryString["log"]); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); return; } catch (Exception generalException) { logger.Error("Process : Error occurred receiving script error : " + generalException.ToString()); } } #endregion ScriptError Region #region SFDCConnection Opened if (filename.Equals("opened")) { flagPrompt = true; if (IsFirstRequestMade && Settings.SFDCOptions.NotifyAllConnectionStateChange) { Settings.SFDCListener.SendSessionStatus(SFDCSessionStatus.Connected); } connectionStatus = true; if (IsFirstRequestMade) { this.logger.Info("Salesforce Connected with SFDC Adapter....."); } else { this.logger.Info("Adapter page loaded in Salesforce,SessionId is not verfied yet.."); } if (IsFirstRequestMade && Settings.SFDCOptions.AlertSFDCConnectionStatus) { Settings.SFDCListener.SFDCConnectionStatus(LogMode.Info, Settings.SFDCOptions.SFDCConnectionSuccessMessage); } context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); } #endregion SFDCConnection Opened #region SFDCConnection Closed if (filename.Equals("closed")) { if (Settings.SFDCOptions.NotifyAllConnectionStateChange) { Settings.SFDCListener.SendSessionStatus(SFDCSessionStatus.NotConnected); } connectionStatus = false; this.logger.Warn("Salesforce DisConnected from SFDC Adapter....."); if (Settings.SFDCOptions.AlertSFDCConnectionStatus) { Settings.SFDCListener.SFDCConnectionStatus(LogMode.Error, Settings.SFDCOptions.SFDCConnectionFailureMessage); } context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); } #endregion SFDCConnection Closed #region Push Region if (filename.Equals("push")) { try { if (!Settings.SFDCListener.IsSFDCConnected) { if (IsFirstRequestMade && Settings.SFDCOptions.NotifyAllConnectionStateChange) { Settings.SFDCListener.SendSessionStatus(SFDCSessionStatus.Connected); } if (IsFirstRequestMade && Settings.SFDCOptions.AlertSFDCConnectionStatus) { Settings.SFDCListener.SFDCConnectionStatus(LogMode.Info, Settings.SFDCOptions.SFDCConnectionSuccessMessage); } } int i = 0; string noEvent = " { \"Event\": " + "\"" + "Ping" + "\"" + ", \"ANI\": " + "\"" + "test" + "\"" + " }"; byte[] pingResponse = ASCIIEncoding.ASCII.GetBytes(noEvent); while (i <= 20) { if (ack == "true") { context.Response.OutputStream.Write(pingResponse, 0, pingResponse.Length); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); return; } if (sessionFlag) { sessionFlag = false; string session = " { \"Event\": " + "\"" + "sessionid" + "\"" + ", \"ANI\": " + "\"" + "test" + "\"" + " }"; byte[] sessionResponse = ASCIIEncoding.ASCII.GetBytes(session); context.Response.OutputStream.Write(sessionResponse, 0, sessionResponse.Length); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); return; } if (flagPrompt && Settings.SFDCOptions.CanEditDialNo) { flagPrompt = false; string promptEvent = " { \"Event\": " + "\"" + "init" + "\"" + ", \"EnablePrompt\": " + "\"" + "true" + "\"" + " }"; byte[] promptResponse = ASCIIEncoding.ASCII.GetBytes(promptEvent); context.Response.OutputStream.Write(promptResponse, 0, promptResponse.Length); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); } if (Settings.SFDCPopupData.Count > 0) { foreach (string key in Settings.SFDCPopupData.Keys) { sfdcData = Settings.SFDCPopupData[key]; Settings.SFDCPopupData.Remove(key); break; } try { jsonEvent = JsonConvert.SerializeObject(sfdcData); byte[] respons = ASCIIEncoding.ASCII.GetBytes(jsonEvent); context.Response.OutputStream.Write(respons, 0, respons.Length); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); try { logger.Info("\n******Sending popup data to SalesForce ******" + sfdcData.ToString() + "\n***************************************"); } catch (Exception) { } } catch (Exception generalException) { logger.Error("Error occurred while sending search and Activity Log data to salesforce : " + generalException.ToString()); } return; } Thread.Sleep(200); i++; } context.Response.OutputStream.Write(pingResponse, 0, pingResponse.Length); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.OutputStream.Close(); return; } catch (HttpListenerException listenerException) { logger.Warn("Process : Listener write operation can't be performed : " + listenerException.ToString()); } catch (Exception generalException) { logger.Error("Process : Error occurred while sending json data to Salesforce : " + generalException.ToString()); } } #endregion Push Region #region Basic Function filename = Path.Combine(_rootDirectory, filename); if (File.Exists(filename)) { try { Stream input = new FileStream(filename, FileMode.Open, FileAccess.Read); //Adding permanent http response headers string mime; context.Response.ContentType = _mimeTypeMappings.TryGetValue(Path.GetExtension(filename), out mime) ? mime : "application/octet-stream"; context.Response.ContentLength64 = input.Length; context.Response.AddHeader("Date", DateTime.Now.ToString("r")); context.Response.AddHeader("Last-Modified", System.IO.File.GetLastWriteTime(filename).ToString("r")); byte[] buffer = new byte[1024 * 16]; int nbytes; while ((nbytes = input.Read(buffer, 0, buffer.Length)) > 0) { context.Response.OutputStream.Write(buffer, 0, nbytes); } input.Close(); context.Response.OutputStream.Flush(); context.Response.StatusCode = (int)HttpStatusCode.OK; } catch (Exception generalException) { logger.Error("process() : Error occurred while executing start page file from process method " + generalException.ToString()); context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; } } else { context.Response.StatusCode = (int)HttpStatusCode.NotFound; } #endregion Basic Function context.Response.OutputStream.Close(); } } catch (Exception generalException) { logger.Error("Process : Error occurred while processing request from Salesforce or AID : " + generalException.ToString()); } }