Пример #1
0
        public void UpdateInfo(ChanState info)
        {
            Extension       = info.Extension;
            AgentID         = info.AgentID;
            LoginState      = info.LoginState;
            CallState       = info.CallState;
            RecordState     = info.RecordState;
            RecordReference = info.RecordReference;
            DirectionFlag   = info.DirectionFlag;
            CallerID        = info.CallerID;
            CalledID        = info.CalledID;
            StartRecordTime = info.StartRecordTime;
            StopRecordTime  = info.StopRecordTime;
            RecordLength    = info.RecordLength;

            StrLoginState      = LoginState.ToString();
            StrCallState       = CallState.ToString();
            StrRecordState     = RecordState.ToString();
            StrDirection       = DirectionFlag.ToString();
            StrStartRecordTime = StartRecordTime.ToString("yyyy-MM-dd HH:mm:ss");
            StrStopRecordTime  = StopRecordTime.ToString("yyyy-MM-dd HH:mm:ss");
            StrRecordLength    = RecordLength.ToString();

            Info = info;
        }
Пример #2
0
        public static VoiceChanStateItem CreateItem(ChanState info)
        {
            VoiceChanStateItem item = new VoiceChanStateItem();

            item.ChanObjID       = info.ObjID;
            item.ChanID          = info.ChanID;
            item.VoiceID         = info.ServerID;
            item.Extension       = info.Extension;
            item.AgentID         = info.AgentID;
            item.LoginState      = info.LoginState;
            item.CallState       = info.CallState;
            item.RecordState     = info.RecordState;
            item.RecordReference = info.RecordReference;
            item.DirectionFlag   = info.DirectionFlag;
            item.CallerID        = info.CallerID;
            item.CalledID        = info.CalledID;
            item.StartRecordTime = info.StartRecordTime;
            item.StopRecordTime  = info.StopRecordTime;
            item.RecordLength    = info.RecordLength;

            item.StrLoginState      = item.LoginState.ToString();
            item.StrCallState       = item.CallState.ToString();
            item.StrRecordState     = item.RecordState.ToString();
            item.StrDirection       = item.DirectionFlag.ToString();
            item.StrStartRecordTime = item.StartRecordTime.ToString("yyyy-MM-dd HH:mm:ss");
            item.StrStopRecordTime  = item.StopRecordTime.ToString("yyyy-MM-dd HH:mm:ss");
            item.StrRecordLength    = item.RecordLength.ToString();

            item.Info = info;

            return(item);
        }
Пример #3
0
 private void DealChanStateChanged(NotifyMessage notMessage)
 {
     try
     {
         OperationReturn optReturn;
         if (notMessage.ListData == null || notMessage.ListData.Count < 3)
         {
             CurrentApp.WriteLog("ChanStateChanged", string.Format("ListData is null or count invalid"));
             return;
         }
         string strMonID        = notMessage.ListData[0];
         string strState        = notMessage.ListData[1];
         string strNewChanObjID = notMessage.ListData[2];
         long   newChanObjID;
         if (strMonID == mMonitorObject.MonID)
         {
             MonitorObject obj = mMonitorObject;
             if (!string.IsNullOrEmpty(strNewChanObjID) &&
                 long.TryParse(strNewChanObjID, out newChanObjID) &&
                 newChanObjID > 0)
             {
                 //关联的通道变了,需要重新查询通道信息
                 QueryChanInfo(obj);
                 return;
             }
             optReturn = XMLHelper.DeserializeObject <ChanState>(strState);
             if (!optReturn.Result)
             {
                 CurrentApp.WriteLog("ChanStateChanged", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             ChanState chanState = optReturn.Data as ChanState;
             if (chanState == null)
             {
                 CurrentApp.WriteLog("ChanStateChanged", string.Format("ChannelState object is null"));
                 return;
             }
             if (mMonitorItem != null)
             {
                 if (obj.Role == 1)
                 {
                     mMonitorItem.VoiceChanState = chanState;
                 }
                 if (obj.Role == 2)
                 {
                     mMonitorItem.ScreenChanState = chanState;
                 }
                 mMonitorItem.TimeDeviation = mTimeDeviation;
                 Dispatcher.Invoke(new Action(mMonitorItem.UpdateState));
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Пример #4
0
        private void DealRecordLength(ChanState chanState)
        {
            double   serverTimeDeviation = chanState.TimeDeviation;
            double   thisTimeDeviation   = TimeDeviation;
            double   timeDeviation       = serverTimeDeviation + thisTimeDeviation;
            DateTime now   = DateTime.Now.ToUniversalTime();
            DateTime start = StartRecordTime;

            if (start > DateTime.Parse("2014/1/1"))
            {
                TimeSpan ts = now - start;
                RecordLength = (int)(ts.TotalSeconds - timeDeviation);
            }
        }
Пример #5
0
 private void DealQueryStateResponse(ReturnMessage retMessage)
 {
     try
     {
         OperationReturn optReturn;
         if (retMessage.ListData == null || retMessage.ListData.Count < 2)
         {
             CurrentApp.WriteLog("DealQueryState", string.Format("ListData is null or count invalid"));
             return;
         }
         string strMonID = retMessage.ListData[0];
         string strState = retMessage.ListData[1];
         if (strMonID == mMonitorObject.MonID)
         {
             MonitorObject obj = mMonitorObject;
             optReturn = XMLHelper.DeserializeObject <ChanState>(strState);
             if (!optReturn.Result)
             {
                 CurrentApp.WriteLog("DealQueryState", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message));
                 return;
             }
             ChanState chanState = optReturn.Data as ChanState;
             if (chanState == null)
             {
                 CurrentApp.WriteLog("DealQueryState", string.Format("ChannelState object is null"));
                 return;
             }
             if (mMonitorItem != null)
             {
                 if (obj.Role == 1)
                 {
                     mMonitorItem.VoiceChanState = chanState;
                 }
                 if (obj.Role == 2)
                 {
                     mMonitorItem.ScreenChanState = chanState;
                 }
                 mMonitorItem.TimeDeviation = mTimeDeviation;
                 Dispatcher.Invoke(new Action(mMonitorItem.UpdateState));
             }
         }
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Пример #6
0
 private void UpdateChanState(MonitorObject monObj, ChanState chanState)
 {
     //try
     //{
     //    var item =
     //        mListVoiceChanStateItems.FirstOrDefault(
     //            o => o.VoiceID.ToString() == monObj.Other01 && o.ChanID.ToString() == monObj.Name);
     //    if (item != null)
     //    {
     //        item.UpdateInfo(chanState);
     //    }
     //}
     //catch (Exception ex)
     //{
     //    AppendMessage(string.Format("UpdateChanState fail.\t{0}", ex.Message));
     //}
 }