public void AddBCMProfile(BcmProfile bp) { if (m_BcmProfiles.ContainsKey(bp.BcmID)) { m_log.Log("Warning - bcmprofile " + bp.BcmID + " already in base config"); } else { m_BcmProfiles.Add(bp.BcmID, bp); } if (m_BcmProfiles.ContainsKey(bp.Name)) { m_log.Log("Warning - bcmprofile " + bp.Name + " already in base config"); } else { m_BcmProfiles.Add(bp.Name, bp); } // add also state-based/change profiles m_BcmProfiles.Add(bp.Name + "_Talking", bp); m_BcmProfiles.Add(bp.Name + "_Idle", bp); m_BcmProfiles.Add(bp.Name + "_PaperWork", bp); m_BcmProfiles.Add(bp.Name + "_Working", bp); m_BcmProfiles.Add(bp.Name + "_WrapUp", bp); m_BcmProfiles.Add(bp.Name + "_Offline", bp); m_BcmProfiles.Add(bp.Name + "_Online", bp); }
public void AddUpdate(string sUser, string sUpdate) { try { DBUpdate dbu = new DBUpdate(); dbu.sUser = sUser; dbu.sValue = sUpdate; lock (this) { m_DirUpdates.Add(dbu); } } catch (Exception e) { m_log.Log("Exception in AddUpdate:" + e); } }
public bool ReadConfig() { XmlReader rd = null; try { string sE; m_CfgFile = m_path + "\\" + m_id + ".xml"; rd = XmlReader.Create(m_CfgFile); try { m_lastModTime = System.IO.File.GetLastWriteTime(m_CfgFile); } catch (Exception ef) { m_log.Log("Cannot get last modification time for " + m_path + "\\" + m_id + ".xml" + ", defaulting to current" + ef); m_lastModTime = DateTime.Now; } while (rd.Read()) { if (rd.IsStartElement()) { sE = rd.Name; switch (sE) { case "LyncStates": readLyncStates(rd); break; case "BCM_to_Lync": readBcm2LyncRules(rd); break; case "Lync_to_BCM": readLync2BcmRules(rd); break; default: break; } } } rd.Close(); return(true); } catch (Exception e) { m_log.Log("Exception in readConfig: ", e); try { if (rd != null) { rd.Close(); } } catch (Exception er) { m_log.Log("Exception 2 in readConfig: ", er); } } return(false); }
//////////////////////////////////////////////////////// // Startup public bool Start(string sServerAddress, string sUserName, string sUserPassword) { m_PSI = new PSI(); m_sPSIUrl = sServerAddress; m_PSI.Url = m_sPSIUrl; m_sPSIUser = sUserName; m_sPSIPass = sUserPassword; m_log.Log("BcmControl.Start PSIUrl=" + m_sPSIUrl); if (Util.IsNullOrEmpty(m_sPSIUser) || Util.IsNullOrEmpty(m_sPSIPass)) { m_log.Log("Using empty credentials for PSI (no user/password set)"); } else { m_log.Log("Using credentials for PSI " + m_sPSIUser + "," + m_sPSIPass); m_CCache = new System.Net.CredentialCache(); m_CCache.Add(new System.Uri(m_sPSIUrl), "Basic", new System.Net.NetworkCredential(m_sPSIUser, m_sPSIPass)); m_PSI.Credentials = m_CCache; } try { CreateSessionResult r; string stmp; r = m_PSI.CreateSession(); m_PSI_Session = r.SessionID; m_log.Log("Created PSI session " + m_PSI_Session); if (GetProfileConfig() == false) { m_log.Log("Cannot get profile configuration, ending..."); return(false); } if (GetUserConfig() == false) { m_log.Log("Cannot get user configuration, ending..."); return(false); } m_EvtFlags = EventFlags.All; string stype = m_CFG.GetParameter("EventFlags", "All"); if (stype == "Call_and_Login") { m_EvtFlags = EventFlags.Call_and_Login; } if (stype == "Call") { m_EvtFlags = EventFlags.Call; } if (stype == "Call_and_Service") { m_EvtFlags = EventFlags.Call_and_Service; } if (stype == "Login") { m_EvtFlags = EventFlags.Login; } if (stype == "Login_and_Service") { m_EvtFlags = EventFlags.Login_and_Service; } stmp = m_CFG.GetParameter("BCM_LyncStateAsEntry", "0"); if (stmp == "1") { stmp = m_CFG.GetParameter("BCM_DB_Directory", "none"); if (stmp.Length > 0 && stmp != "none") { m_BcmDB = new Bcm_DB(); m_BcmDB.init(m_CFG, m_log, stmp); m_use_dir_entry = 1; } } } catch (Exception x) { m_log.Log("Error in Bcm_Control start - cannot create session for PSI (" + x + ")"); return(false); } return(true); }