Ejemplo n.º 1
0
        public bool AddCallLogs(string dn, Call call)
        {
            bool success = false;

            try
            {
                LineControl lc = null;
                if (Global.cacheMgr != null)
                {
                    if (Global.cacheMgr.Contains(dn))
                    {
                        lc = ((LineControl)Global.cacheMgr.GetData(dn));
                    }
                    else
                    {
                        lc = new LineControl();
                        lc.directoryNumber = dn;
                        lc.status          = Status.unknown;
                        lc.doNotDisturb    = false;
                        lc.forward         = "";
                        lc.mwiOn           = false;
                        lc.monitored       = "";
                    }
                    if (call.endTime == null || call.endTime.Year == 1)
                    {
                        call.endTime = DateTime.Now;
                    }
                    log.Debug("Adding call to cache, " + dn + ": " + call.ToString());
                    lc.AddCall(call);
                    Global.cacheMgr.Add(dn, lc);
                    if (Global.codif != null)
                    {
                        log.Debug("Adding call to the database...");

                        CodificationService.AddCall(call, dn);
                    }

                    success = true;
                }
                return(success);
            }
            catch (Exception e)
            {
                log.Error("Error while adding call log: " + e.Message + " inner: " + e.InnerException.ToString());
                return(success);
            }
        }
Ejemplo n.º 2
0
        public bool AddCallLogs(string dn, Call call)
        {
            bool success = false;
            try
            {
                LineControl lc = null;
                if (Global.cacheMgr != null)
                {
                    if (Global.cacheMgr.Contains(dn))
                    {
                        lc = ((LineControl)Global.cacheMgr.GetData(dn));
                    }
                    else
                    {
                        lc = new LineControl();
                        lc.directoryNumber = dn;
                        lc.status = Status.unknown;
                        lc.doNotDisturb = false;
                        lc.forward = "";
                        lc.mwiOn = false;
                        lc.monitored = "";
                    }
                    if (call.endTime == null || call.endTime.Year == 1)
                    {
                        call.endTime = DateTime.Now;
                    }
                    log.Debug("Adding call to cache, " + dn + ": " + call.ToString());
                    lc.AddCall(call);
                    Global.cacheMgr.Add(dn, lc);
                    if (Global.codif != null)
                    {
                        
                        log.Debug("Adding call to the database...");
                        
                        CodificationService.AddCall(call, dn);
                    }

                    success = true;
                }
                return success;
            }
            catch (Exception e)
            {
                log.Error("Error while adding call log: " + e.Message + " inner: " + e.InnerException.ToString());
                return success;
            }
        }