Ejemplo n.º 1
0
        public static CallDataRecord CallDataRecordFromLogString(string log)
        {
            CallDataRecord result = null;

            Match m = recordRegex.Match(log);

            if (m.Success)
            {
                string callId    = m.Groups[1].Value;
                string name      = m.Groups[2].Value;
                string value     = m.Groups[3].Value;
                string timestamp = m.Groups[4].Value;

                string currentState = "";

                if (!callIdsTable.ContainsKey(callId))
                {
                    callIdsTable[callId] = callId;
                }

                if (!namesTable.ContainsKey(name))
                {
                    namesTable[name] = name;
                }

                if (name == "State")
                {
                    currentStatesTable[callId] = value;
                }
                else if (name == "Restoring Call" && value == "Restoring Call")
                {
                    // a call being restored after a restart doesn't have a state yet
                    currentStatesTable[callId] = "";
                }

                if (currentStatesTable.ContainsKey(callId))
                {
                    currentState = currentStatesTable[callId];
                }

                result = new CallDataRecord(callIdsTable[callId], currentState, namesTable[name], value, DateTime.Parse(timestamp));
            }

            return(result);
        }
Ejemplo n.º 2
0
        private void DisplayCallEvents(BindingSource callEventsBindingSource)
        {
            mLogRecordDataGridView.DataSource = callEventsBindingSource;

            mLogRecordDataGridView.Columns[0].Visible = (1 < mCallIdDataGridView.SelectedRows.Count);

            for (int row_idx = 0; row_idx < mLogRecordDataGridView.RowCount - 1; ++row_idx)
            {
                CallDataRecord thisRow = mLogRecordDataGridView.Rows[row_idx].DataBoundItem as CallDataRecord;
                CallDataRecord nextRow = mLogRecordDataGridView.Rows[row_idx + 1].DataBoundItem as CallDataRecord;

                if (thisRow.CallId != nextRow.CallId)
                {
                    mLogRecordDataGridView.Rows[row_idx].DividerHeight = 3;
                }
            }

            logRecordFilterEnableCheckBox.Enabled = dataRecordFilterDialog.Filter.Active;
        }
Ejemplo n.º 3
0
        public static List <CallDataRecord> ParseFile(string filepath)
        {
            var result = new List <CallDataRecord>();

            using (var r = new StreamReader(new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
            {
                while (!r.EndOfStream)
                {
                    string line = r.ReadLine();

                    CallDataRecord cdr = CallDataRecordFromLogString(line);

                    if (cdr != null)
                    {
                        result.Add(cdr);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 4
0
 public static bool PassesRecordFilter(string recordNamePattern, string recordValuePattern, bool caseSensitive, bool useRegex, CallDataRecord record)
 {
     return(PassesStringFilter(recordNamePattern, record.Name, caseSensitive, useRegex) &&
            PassesStringFilter(recordValuePattern, record.Value, caseSensitive, useRegex));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CallCdrWorker"/> class.
 /// </summary>
 internal CallCdrWorker()
 {
     this.database       = Pool.Database.Get();
     this.callDataRecord = new CallDataRecord();
 }
Ejemplo n.º 6
0
 public bool Passes(CallDataRecord callDataRecord)
 {
     return(FilterHelper.PassesRecordFilter(RecordName, RecordValue, CaseSensitive, UseRegex, callDataRecord) &&
            FilterHelper.PassesTimeFilter(callDataRecord.Timestamp, TimeAfterActive, TimeAfter, TimeBeforeActive, TimeBefore, false));
 }
Ejemplo n.º 7
0
 public static string LogStringFromCallDataRecord(CallDataRecord cdr)
 {
     return(String.Format("{0}|{1}|{2}|{3}", cdr.CallId, cdr.Name, cdr.Value, cdr.Timestamp.ToString("yyyy-MM-dd HH:mm:ss.fff")));
 }