コード例 #1
0
 public Call[] GetReceivedCalls(string dn, string sort)
 {
     Call[] calls = null;
     try
     {
         if (Global.cacheMgr != null)
         {
             if (Global.cacheMgr.Contains(dn))
             {
                 LineControl lc = (LineControl)Global.cacheMgr.GetData(dn);
                 calls = lc.GetCalls(CallType.received, sort);
             }
         }
         else
         {
             log.Debug("Cache Manager is null");
         }
         return(calls);
     }
     catch (Exception e)
     {
         log.Error("Error while retreiving received calls: " + e.Message);
         return(calls);
     }
 }
コード例 #2
0
        public LineControl LengthyGetLineControl(LineControl lc)
        {
            LineControl lControl = lc;

            log.Debug("Received GetLineControl: " + lc.ToString());
            if (Global.cacheMgr != null)
            {
                if (Global.cacheMgr.Contains(lc.directoryNumber))
                {
                    log.Debug("This line is in cache: " + lc.directoryNumber);
                    lControl = (LineControl)Global.cacheMgr.GetData(lc.directoryNumber);
                    int compteur = 0;
                    while (lControl.Equals(lc) && compteur <= int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerTimeOut")))
                    {
                        Thread.Sleep(int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerSleepTime")));
                        lControl = (LineControl)Global.cacheMgr.GetData(lc.directoryNumber);
                        compteur++;
                    }
                }
            }
            else
            {
                log.Debug("Cache Manager is null");
            }
            log.Debug("Return LineControl: " + lControl.ToString());
            return(lControl);
        }
コード例 #3
0
 public LineControl LengthyGetLineControl(LineControl lc)
 {
     LineControl lControl = lc;
     log.Debug("Received GetLineControl: " + lc.ToString());
     if (Global.cacheMgr != null)
     {
         if (Global.cacheMgr.Contains(lc.directoryNumber))
         {
             log.Debug("This line is in cache: " + lc.directoryNumber);
             lControl = (LineControl)Global.cacheMgr.GetData(lc.directoryNumber);
             int compteur = 0;
             while (lControl.Equals(lc) && compteur <= int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerTimeOut")))
             {
                 Thread.Sleep(int.Parse(WebConfigurationManager.AppSettings.Get("LineControlServerSleepTime")));
                 lControl = (LineControl)Global.cacheMgr.GetData(lc.directoryNumber);
                 compteur++;
             }
         }
     }
     else
     {
         log.Debug("Cache Manager is null");
     }
     log.Debug("Return LineControl: " + lControl.ToString());
     return lControl;
 }
コード例 #4
0
        public IAsyncResult BeginGetLineControl(LineControl lc, AsyncCallback cb, object s)
        {
            LengthyGetLineControlAsyncStub stub = new LengthyGetLineControlAsyncStub(LengthyGetLineControl);
            GetLineControlState            glcs = new GetLineControlState();

            glcs.previousstate = s;
            glcs.stub          = stub;
            return(stub.BeginInvoke(lc, cb, glcs));
        }
コード例 #5
0
ファイル: StateServer.asmx.cs プロジェクト: gnomix/T.A.L.K.
 public bool SetLineControl(LineControl lc)
 {
     bool success = false;
     try
     {
         if (Global.cacheMgr != null)
         {
             log.Debug("Adding or update linecontrol: " + lc.ToString());
             if (Global.cacheMgr.Contains(lc.directoryNumber))
             {
                 object linecontrol = Global.cacheMgr.GetData(lc.directoryNumber);
                 if (linecontrol is AgentLineControl)
                 {
                     AgentLineControl currentAgentLineControl = ((AgentLineControl)Global.cacheMgr.GetData(lc.directoryNumber));
                     currentAgentLineControl.doNotDisturb = lc.doNotDisturb;
                     currentAgentLineControl.forward = lc.forward;
                     currentAgentLineControl.lineControlConnection = lc.lineControlConnection;
                     currentAgentLineControl.mwiOn = lc.mwiOn;
                     currentAgentLineControl.status = lc.status;
                     currentAgentLineControl.monitored = lc.monitored;
                     Global.cacheMgr.Add(lc.directoryNumber, currentAgentLineControl);
                 }
                 else
                 {
                     LineControl currentLineControl = ((LineControl)Global.cacheMgr.GetData(lc.directoryNumber));
                     currentLineControl.doNotDisturb = lc.doNotDisturb;
                     currentLineControl.forward = lc.forward;
                     currentLineControl.lineControlConnection = lc.lineControlConnection;
                     currentLineControl.mwiOn = lc.mwiOn;
                     currentLineControl.status = lc.status;
                     currentLineControl.monitored = lc.monitored;
                     Global.cacheMgr.Add(lc.directoryNumber, currentLineControl);
                 }
                 
             }
             else
             {
                 Global.cacheMgr.Add(lc.directoryNumber, lc);
             }
             success = true;
         }
         return success;
     }
     catch (Exception e)
     {
         log.Error("Error while setting linecontrol : " + e.Message);
         return success;
     }
 }
コード例 #6
0
ファイル: StateServer.asmx.cs プロジェクト: gnomix/T.A.L.K.
        public bool SetLineControl(LineControl lc)
        {
            bool success = false;

            try
            {
                if (Global.cacheMgr != null)
                {
                    log.Debug("Adding or update linecontrol: " + lc.ToString());
                    if (Global.cacheMgr.Contains(lc.directoryNumber))
                    {
                        object linecontrol = Global.cacheMgr.GetData(lc.directoryNumber);
                        if (linecontrol is AgentLineControl)
                        {
                            AgentLineControl currentAgentLineControl = ((AgentLineControl)Global.cacheMgr.GetData(lc.directoryNumber));
                            currentAgentLineControl.doNotDisturb          = lc.doNotDisturb;
                            currentAgentLineControl.forward               = lc.forward;
                            currentAgentLineControl.lineControlConnection = lc.lineControlConnection;
                            currentAgentLineControl.mwiOn     = lc.mwiOn;
                            currentAgentLineControl.status    = lc.status;
                            currentAgentLineControl.monitored = lc.monitored;
                            Global.cacheMgr.Add(lc.directoryNumber, currentAgentLineControl);
                        }
                        else
                        {
                            LineControl currentLineControl = ((LineControl)Global.cacheMgr.GetData(lc.directoryNumber));
                            currentLineControl.doNotDisturb          = lc.doNotDisturb;
                            currentLineControl.forward               = lc.forward;
                            currentLineControl.lineControlConnection = lc.lineControlConnection;
                            currentLineControl.mwiOn     = lc.mwiOn;
                            currentLineControl.status    = lc.status;
                            currentLineControl.monitored = lc.monitored;
                            Global.cacheMgr.Add(lc.directoryNumber, currentLineControl);
                        }
                    }
                    else
                    {
                        Global.cacheMgr.Add(lc.directoryNumber, lc);
                    }
                    success = true;
                }
                return(success);
            }
            catch (Exception e)
            {
                log.Error("Error while setting linecontrol : " + e.Message);
                return(success);
            }
        }
コード例 #7
0
ファイル: StateServer.asmx.cs プロジェクト: gnomix/T.A.L.K.
        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);
            }
        }
コード例 #8
0
ファイル: StateServer.asmx.cs プロジェクト: gnomix/T.A.L.K.
        public bool SetAgentLineControl(string extension, string agentid, AgentState state, CallCenterCall ccc)
        {
            bool success = false;

            try
            {
                if (Global.cacheMgr != null)
                {
                    log.Debug("Adding or update agentlinecontrol: " + extension + state.ToString());
                    if (Global.cacheMgr.Contains(extension) && Global.cacheMgr.GetData(extension) is AgentLineControl)
                    {
                        AgentLineControl currentAgentLineControl = ((AgentLineControl)Global.cacheMgr.GetData(extension));
                        currentAgentLineControl.agentstate     = state;
                        currentAgentLineControl.callcentercall = ccc;
                        Global.cacheMgr.Add(extension, currentAgentLineControl);
                    }
                    else
                    {
                        AgentLineControl alc = new AgentLineControl();
                        LineControl      lc  = ((LineControl)Global.cacheMgr.GetData(extension));
                        alc.agentid               = agentid;
                        alc.agentstate            = state;
                        alc.callcentercall        = ccc;
                        alc.directoryNumber       = lc.directoryNumber;
                        alc.doNotDisturb          = lc.doNotDisturb;
                        alc.forward               = lc.forward;
                        alc.lineControlConnection = lc.lineControlConnection;
                        alc.mwiOn     = lc.mwiOn;
                        alc.status    = lc.status;
                        alc.monitored = lc.monitored;
                        Global.cacheMgr.Add(extension, alc);
                    }
                    success = true;
                }
                return(success);
            }
            catch (Exception e)
            {
                log.Error("Error while setting agentlinecontrol : " + e.Message);
                return(success);
            }
        }
コード例 #9
0
        public override bool Equals(object obj)
        {
            bool b = base.Equals(obj);

            try
            {
                if (b)
                {
                    if (obj != null)
                    {
                        if (obj is LineControl)
                        {
                            LineControl lc = obj as LineControl;
                            if (lc.directoryNumber == this.directoryNumber)
                            {
                                if (lc.lineControlConnection != null)
                                {
                                    foreach (LineControlConnection lcc in lc.lineControlConnection)
                                    {
                                        //find same connection
                                        if (this.lineControlConnection != null)
                                        {
                                            foreach (LineControlConnection lcci in this.lineControlConnection)
                                            {
                                                if (lcci.callid == lcc.callid)
                                                {
                                                    if (!lcci.Equals(lcc))
                                                    {
                                                        b = false;
                                                        break;
                                                    }
                                                }
                                                else
                                                {
                                                    b = false;
                                                    break;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            b = false;
                                        }
                                        if (!b)
                                        {
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    if (this.lineControlConnection != null)
                                    {
                                        b = false;
                                    }
                                }
                            }
                            else
                            {
                                b = false;
                            }
                        }
                        else
                        {
                            throw new Exception("Can't evaluate this object " + this.directoryNumber + ", " + obj.ToString());
                        }
                    }
                }
                return(b);
            }
            catch (Exception e)
            {
                log.Error("Unable to compare linecontrol: " + e.Message);
                return(b);
            }
        }
コード例 #10
0
 public IAsyncResult BeginGetLineControl(LineControl lc, AsyncCallback cb, object s)
 {
     LengthyGetLineControlAsyncStub stub = new LengthyGetLineControlAsyncStub(LengthyGetLineControl);
     GetLineControlState glcs = new GetLineControlState();
     glcs.previousstate = s;
     glcs.stub = stub;
     return stub.BeginInvoke(lc, cb, glcs);
 }
コード例 #11
0
ファイル: StateServer.asmx.cs プロジェクト: gnomix/T.A.L.K.
        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;
            }
        }