private void ParseCall() { // Parse up call CallRecord call_record; if (PreviousConnection == ConnectionType.Serial) { call_record = new CallRecord(SerialPortReceiverClass.PreviousPacket); } else { call_record = new CallRecord(UdpReceiverClass.ReceivedMessage); } if (!call_record.IsValid) { return; } if (PreviousReceptions.Contains(call_record.Reception_String)) { return; } PreviousReceptions.Add(call_record.Reception_String); if (!Program.AppSettings[(int)Program.AppSetting.RELAY_IP].ToLower().Contains("0.0.0.0") && !string.IsNullOrEmpty(Program.AppSettings[(int)Program.AppSetting.RELAY_IP]) && Program.AppSettings[(int)Program.AppSetting.RELAY_IP] != "Do not Relay Data") { if (PreviousConnection == ConnectionType.Serial) { UdpReceiverClass.SendUDP(call_record.Reception_String, Program.AppSettings[(int)Program.AppSetting.RELAY_IP], 3520); } } timerClearPreviousReceptions.Enabled = true; timerClearPreviousReceptions.Stop(); timerClearPreviousReceptions.Interval = 500; timerClearPreviousReceptions.Start(); bool line_number_too_high = false; if (call_record.Line > 12) { line_number_too_high = true; lbHighLineNumber.Visible = true; } string outbound_name = ""; if (call_record.IsOutbound()) { outbound_name = CallLog.GetNameFromNumberInDatabase(call_record.PhoneNumber); } // Show popup if (call_record.IsStartRecord() && !line_number_too_high) { pController.AddPopup(call_record.Line, call_record.IsInbound(), call_record.PhoneNumber, (string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name)); PreviousPacketWasOutbound = !call_record.IsInbound(); } else if (call_record.IsEndRecord()) { PreviousPacketWasOutbound = false; } if (call_record.IsInbound() && bool.Parse(Program.AppSettings[(int)Program.AppSetting.POPUP_INBOUND])) { PreviousCall.Line = call_record.Line; PreviousCall.Number = call_record.PhoneNumber; PreviousCall.Name = (string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name); PreviousCall.IsInbound = true; } else if (call_record.IsOutbound() && bool.Parse(Program.AppSettings[(int)Program.AppSetting.POPUP_OUTBOUND])) { PreviousCall.Line = call_record.Line; PreviousCall.Number = call_record.PhoneNumber; PreviousCall.Name = (string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name); PreviousCall.IsInbound = false; } if (call_record.Detailed && call_record.DetailedType == "N") { string uString = call_record.Line + " " + (call_record.IsInbound() ? "1" : "0") + " " + call_record.PhoneNumber + " " + (string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name); pController.RemovePopup(uString); } if (call_record.Line > 8) { UnHideLines(Lines.EightThroughTwelve); } else if (call_record.Line > 4) { UnHideLines(Lines.FiveThroughEight); } if (line_number_too_high) { if (!call_record.Detailed && call_record.IsStartRecord()) { AddToCallLog((string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name), call_record.PhoneNumber, call_record.DateTime, call_record.Duration, call_record.Line, call_record.InboundOrOutboundOrBlock, call_record.RingNumber.ToString(), call_record.IsEndRecord(), call_record.UniqueID, call_record.Reception_String); } return; } if (PreviousConnection == ConnectionType.Serial) { Common.AttmptWriteToLog(SerialPortReceiverClass.PreviousPacket, true); } else { Common.AttmptWriteToLog(call_record.Reception_String, false); } if (call_record.Detailed) { if (call_record.DetailedType == "R") { tbNames[call_record.Line].Text = "Ringing"; tbNumbers[call_record.Line].Text = "Ringing"; tbNames[call_record.Line].BackColor = Color.Pink; tbNumbers[call_record.Line].BackColor = Color.Pink; } else if (call_record.DetailedType == "F") { if (PreviousPacketWasOutbound) { tbNames[call_record.Line].Text = ""; tbNumbers[call_record.Line].Text = ""; } tbNames[call_record.Line].BackColor = Color.LightYellow; tbNumbers[call_record.Line].BackColor = Color.LightYellow; } else { tbNames[call_record.Line].BackColor = Color.White; tbNumbers[call_record.Line].BackColor = Color.White; } } else { if (call_record.IsEndRecord()) { tbNames[call_record.Line].BackColor = Program.C_CALL_FINISHED_BACKGROUND; tbNumbers[call_record.Line].BackColor = Program.C_CALL_FINISHED_BACKGROUND; } else { if (call_record.IsStartRecord()) { tbNames[call_record.Line].BackColor = Color.White; tbNumbers[call_record.Line].BackColor = Color.White; if (call_record.IsInbound()) { tbNames[call_record.Line].ForeColor = Program.C_INCOMING_CALL_FOREGROUND; tbNumbers[call_record.Line].ForeColor = Program.C_INCOMING_CALL_FOREGROUND; } else { tbNames[call_record.Line].ForeColor = Program.C_OUTGOING_CALL_FOREGROUND; tbNumbers[call_record.Line].ForeColor = Program.C_OUTGOING_CALL_FOREGROUND; } AddToCallLog((string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name), call_record.PhoneNumber, call_record.DateTime, call_record.Duration, call_record.Line, call_record.InboundOrOutboundOrBlock, call_record.RingNumber.ToString(), call_record.IsEndRecord(), call_record.UniqueID, call_record.Reception_String); } } tbNames[call_record.Line].Text = (string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name).Trim(); tbNumbers[call_record.Line].Text = call_record.PhoneNumber.Trim(); } if (call_record.IsEndRecord()) { AddToCallLog((string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name), call_record.PhoneNumber, call_record.DateTime, call_record.Duration, call_record.Line, call_record.InboundOrOutboundOrBlock, call_record.RingNumber.ToString(), call_record.IsEndRecord(), call_record.UniqueID, call_record.Reception_String); CallLog.AddCall(call_record.Line.ToString(), call_record.StartOrEnd, call_record.InboundOrOutboundOrBlock, call_record.Duration.ToString().PadLeft(4, '0'), call_record.CheckSum, call_record.RingNumber.ToString(), call_record.DateTime, call_record.PhoneNumber, (string.IsNullOrEmpty(outbound_name) ? call_record.Name : outbound_name), call_record.UniqueID); if (Program.fOptions != null) { if (Program.fOptions.Visible) { Program.fOptions.RefreshLogCount(); } } } }