コード例 #1
0
ファイル: LineControl.cs プロジェクト: gnomix/T.A.L.K.
 private int CallSort(Call c1, Call c2)
 {
     int result = 0;
     try
     {
         switch (sort)
         {
             case "startTime":
                 result = -DateTime.Compare(c1.startTime, c2.startTime);
                 break;
             case "caller":
                 result = String.Compare(c1.caller, c2.caller);
                 break;
             case "callee":
                 result = String.Compare(c1.callee, c2.callee);
                 break;
             default:
                 result = -DateTime.Compare(c1.startTime, c2.startTime);
                 break;
         }
     }
     catch (Exception e)
     {
         log.Error(e.Message);
     }
     return result;
 }
コード例 #2
0
ファイル: LineControl.cs プロジェクト: gnomix/T.A.L.K.
 private bool isExists(Call call, CallType type)
 {
     bool isnew = true;
     switch (type)
     {
         case CallType.missed:
             foreach (Call c in missedCalls)
             {
                 if (c.callId == call.callId)
                 {
                     isnew = false;
                     break;
                 }
             }
             break;
         case CallType.placed:
             foreach (Call c in placedCalls)
             {
                 if (c.callId == call.callId)
                 {
                     isnew = false;
                     break;
                 }
             }
             break;
         case CallType.received:
             foreach (Call c in receivedCalls)
             {
                 if (c.callId == call.callId)
                 {
                     isnew = false;
                     break;
                 }
             }
             break;
     }
     return isnew;
 }
コード例 #3
0
ファイル: LineControl.cs プロジェクト: gnomix/T.A.L.K.
 /// <summary>
 /// Adds a call to a call log
 /// </summary>
 /// <param name="call">
 /// Description de l'appel
 /// <seealso cref="Call"/>
 /// </param>
 public void AddCall(Call call)
 {
     switch (call.type)
     {
         case CallType.missed:
             AddMissedCall(call);
             break;
         case CallType.placed:
             AddPlacedCall(call);
             break;
         case CallType.received:
             AddReceivedCall(call);
             break;
     }
 }
コード例 #4
0
ファイル: LineControl.cs プロジェクト: gnomix/T.A.L.K.
 private void AddReceivedCall(Call call)
 {
     try
     {
         if (isExists(call, CallType.received))
         {
             if (receivedCalls.Count == 100)
             {
                 receivedCalls.Dequeue();
             }
             receivedCalls.Enqueue(call);
         }
     }
     catch (Exception e)
     {
         log.Error("Error while adding received call: " + e.Message);
     }
 }
コード例 #5
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;
            }
        }