public override LogResult Process() { LogResult logResult; logResult = base.Process(); switch (logResult.code) { case LogCode.LOG_EVENT: Match eventMatch; string csvstring = (string)logResult.result; eventMatch = Regex.Match(csvstring, LogCPReader.msgPattern, RegexOptions.IgnorePatternWhitespace); if (eventMatch.Success) { csmevent = new CSMEvent(); csmevent.eventInfo.TimeStamp = logResult.timestamp; csmevent.eventInfo.MonitorHandlerExtension = eventMatch.Groups["MONITOR"].Value; csmevent.node = new List <TreeNode>(); List <string> groups = eventMatch.Groups["INFO"].Value.Split(',').ToList(); switch (eventMatch.Groups["TYPE"].Value) { case "CC": csmevent.eventInfo.Type = "Call Cleared"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.eventInfo.Cause = groups[1]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferred CID", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transfer destination", groups[3]))); break; case "CO": csmevent.eventInfo.Type = "Conferenced"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Subject EXT", groups[0]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "PGCID", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "SGCID", groups[2]))); csmevent.eventInfo.PGCID = groups[1]; csmevent.eventInfo.SGCID = groups[2]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Conference controller EXT", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Number of parties", groups[4]))); for (int i = 5, j = 1; i < groups.Count - 1; i += 2, j++) { csmevent.node.Add(new TreeNode(String.Format("Party #{0}: {1}", j, groups[i]))); csmevent.node.Add(new TreeNode(String.Format("Party #{0}: {1}", j, groups[i + 1]))); } csmevent.eventInfo.Cause = groups[groups.Count - 1]; break; case "XC": csmevent.eventInfo.Type = "Connection Cleared"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Cleared EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Terminating EXT", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[3]))); csmevent.eventInfo.Cause = groups[4]; break; case "DE": csmevent.eventInfo.Type = "Delivered"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Alerting internal EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Alerting outside number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Alerting device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller name", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk name", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[10]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[11]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Account code", groups[12]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[13]))); csmevent.eventInfo.Cause = groups[14]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "ACD/UCD group", groups[15]))); break; case "DI": csmevent.eventInfo.Type = "Diverted"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Diverted from EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "New destination EXT", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Diverted to outside EXT", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[4]))); csmevent.eventInfo.Cause = groups[5]; break; case "ER": csmevent.eventInfo.Type = "Established Routing"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering internal EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering outside number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[10]))); csmevent.eventInfo.Cause = groups[11]; break; case "ES": csmevent.eventInfo.Type = "Established"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering internal EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering outside number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[10]))); csmevent.eventInfo.Cause = groups[11]; break; case "FA": csmevent.eventInfo.Type = "Failed"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Failed EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Called number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[3]))); csmevent.eventInfo.Cause = groups[4]; break; case "HE": csmevent.eventInfo.Type = "Held"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Activate hold EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[2]))); csmevent.eventInfo.Cause = groups[3]; break; case "NT": csmevent.eventInfo.Type = "Network Reached"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk used", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Dialed number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[3]))); csmevent.eventInfo.Cause = groups[4]; break; case "OR": csmevent.eventInfo.Type = "Originated"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Dialed number", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Account code", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[6]))); csmevent.eventInfo.Cause = groups[7]; break; case "QU": csmevent.eventInfo.Type = "Queued"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Queued EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller name", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk name", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Number queued", groups[10]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Acoount code", groups[11]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[12]))); csmevent.eventInfo.Cause = groups[13]; break; case "RE": csmevent.eventInfo.Type = "Retrieved"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[2]))); csmevent.eventInfo.Cause = groups[3]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal retrieved EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving device outside number", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving device trunk number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving device type", groups[7]))); break; case "SI": csmevent.eventInfo.Type = "Service Initiated"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Initiating EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[2]))); csmevent.eventInfo.Cause = groups[3]; if (groups.Count > 4) { csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Callback target EXT", groups[4]))); } break; case "TR": csmevent.eventInfo.Type = "Transferred"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferred CID", groups[0]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferring EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferred EXT", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Announcement CID", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Destination EXT", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller name", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller EXT", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk name", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[10]))); csmevent.eventInfo.Cause = groups[11]; break; default: csmevent.eventInfo.Type = String.Format("{0} ({1})", csmevent.eventInfo.Type, eventMatch.Groups["TYPE"].Value); int index = 1; foreach (string item in groups) { csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", index++, item))); } break; } csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "ID", eventMatch.Groups["ID"].Value))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Type", eventMatch.Groups["TYPE"].Value))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Cause", csmevent.eventInfo.Cause))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Monitor", csmevent.Monitor))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Resync Code", eventMatch.Groups["RESYNC_CODE"].Value))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Mon cross Ref ID", eventMatch.Groups["MON_REF"].Value))); logResult.result = csmevent; } else { logResult.code = LogCode.LOG_NOTHING; } break; } return(logResult); }
public override LogResult Process() { LogResult logResult; logResult = base.Process(); switch (logResult.code) { case LogCode.LOG_EVENT: string jsonString = (string)logResult.result; Dictionary <string, object> jsonDict; object outObject; Match eventMatch; try { eventMatch = Regex.Match(jsonString, LogMCDReader.msgPattern, RegexOptions.IgnorePatternWhitespace); if (eventMatch.Success) { csmevent = new CSMEvent(); csmevent.eventInfo.TimeStamp = logResult.timestamp; jsonString = eventMatch.Groups["MESSAGE"].Value; // Workaround for parked events if (jsonString.Contains("{*** Processing Parked Event ***}")) { jsonString = jsonString.Replace("{*** Processing Parked Event ***}", ""); csmevent.eventInfo.isParked = true; } jsonString = jsonWorkAround(jsonString); JavaScriptSerializer mySer = new JavaScriptSerializer(); jsonDict = mySer.Deserialize <Dictionary <string, object> >(jsonString); jsonDict = (Dictionary <string, object>)jsonDict["MitaiEvent"]; csmevent.node = GenerateTree(jsonDict).ToList(); if (jsonDict.TryGetValue("Type", out outObject)) { eventMatch = Regex.Match((string)jsonDict["Type"], @"^(?<TYPE>\D+)\((?<TYPENUM>\d+)\)"); if (eventMatch.Success) { csmevent.eventInfo.Type = eventMatch.Groups["TYPE"].Value; csmevent.eventInfo.TypeNumber = eventMatch.Groups["TYPENUM"].Value; } } if (jsonDict.TryGetValue("Cause", out outObject)) { eventMatch = Regex.Match((string)outObject, @"^(?<CAUSE>\D+)\((?<CAUSENUM>\d+)\)"); if (eventMatch.Success) { csmevent.eventInfo.Cause = eventMatch.Groups["CAUSE"].Value; csmevent.eventInfo.CauseNumber = eventMatch.Groups["CAUSENUM"].Value; } } if (jsonDict.TryGetValue("MonitorHandle", out outObject)) { eventMatch = Regex.Match((string)outObject, @"^(?<MONITOR>.+)\((?<MONITORNUM>.*)\)"); if (eventMatch.Success) { csmevent.eventInfo.MonitorHandler = eventMatch.Groups["MONITOR"].Value; csmevent.eventInfo.MonitorHandlerExtension = eventMatch.Groups["MONITORNUM"].Value; eventMatch = Regex.Match(eventMatch.Groups["MONITORNUM"].Value, @"(?<MONITORNODE>.*)\|(?<MONITORNUM>.*)"); if (eventMatch.Success) { csmevent.eventInfo.MonitorHandlerNode = eventMatch.Groups["MONITORNODE"].Value; csmevent.eventInfo.MonitorHandlerExtension = eventMatch.Groups["MONITORNUM"].Value; } } } if (jsonDict.TryGetValue("CGCID", out outObject)) { csmevent.eventInfo.CGCID = (string)outObject; } if (jsonDict.TryGetValue("PGCID", out outObject)) { csmevent.eventInfo.PGCID = (string)outObject; } if (jsonDict.TryGetValue("SGCID", out outObject)) { csmevent.eventInfo.SGCID = (string)outObject; } logResult.result = csmevent; } else { logResult.code = LogCode.LOG_NOTHING; } } catch (ArgumentException ex) { csmevent.eventInfo.Type = "Exception"; csmevent.eventInfo.Cause = "Invalid JSON"; csmevent.node = new List <TreeNode> { new TreeNode(String.Format("Exception: {0}", ex.Message)), new TreeNode(String.Format("JSON: {0}", jsonString)) }; } break; default: break; } return(logResult); }
public override LogResult Process() { LogResult logResult; logResult = base.Process(); switch (logResult.code) { case LogCode.LOG_EVENT: string jsonString = (string)logResult.result; Dictionary<string, object> jsonDict; object outObject; Match eventMatch; try { eventMatch = Regex.Match(jsonString, LogMCDReader.msgPattern, RegexOptions.IgnorePatternWhitespace); if (eventMatch.Success) { csmevent = new CSMEvent(); csmevent.eventInfo.TimeStamp = logResult.timestamp; jsonString = eventMatch.Groups["MESSAGE"].Value; // Workaround for parked events if (jsonString.Contains("{*** Processing Parked Event ***}")) { jsonString = jsonString.Replace("{*** Processing Parked Event ***}", ""); csmevent.eventInfo.isParked = true; } jsonString = jsonWorkAround(jsonString); JavaScriptSerializer mySer = new JavaScriptSerializer(); jsonDict = mySer.Deserialize<Dictionary<string, object>>(jsonString); jsonDict = (Dictionary<string, object>)jsonDict["MitaiEvent"]; csmevent.node = GenerateTree(jsonDict).ToList(); if (jsonDict.TryGetValue("Type", out outObject)) { eventMatch = Regex.Match((string)jsonDict["Type"], @"^(?<TYPE>\D+)\((?<TYPENUM>\d+)\)"); if (eventMatch.Success) { csmevent.eventInfo.Type = eventMatch.Groups["TYPE"].Value; csmevent.eventInfo.TypeNumber = eventMatch.Groups["TYPENUM"].Value; } } if (jsonDict.TryGetValue("Cause", out outObject)) { eventMatch = Regex.Match((string)outObject, @"^(?<CAUSE>\D+)\((?<CAUSENUM>\d+)\)"); if (eventMatch.Success) { csmevent.eventInfo.Cause = eventMatch.Groups["CAUSE"].Value; csmevent.eventInfo.CauseNumber = eventMatch.Groups["CAUSENUM"].Value; } } if (jsonDict.TryGetValue("MonitorHandle", out outObject)) { eventMatch = Regex.Match((string)outObject, @"^(?<MONITOR>.+)\((?<MONITORNUM>.*)\)"); if (eventMatch.Success) { csmevent.eventInfo.MonitorHandler = eventMatch.Groups["MONITOR"].Value; csmevent.eventInfo.MonitorHandlerExtension = eventMatch.Groups["MONITORNUM"].Value; eventMatch = Regex.Match(eventMatch.Groups["MONITORNUM"].Value, @"(?<MONITORNODE>.*)\|(?<MONITORNUM>.*)"); if (eventMatch.Success) { csmevent.eventInfo.MonitorHandlerNode = eventMatch.Groups["MONITORNODE"].Value; csmevent.eventInfo.MonitorHandlerExtension = eventMatch.Groups["MONITORNUM"].Value; } } } if (jsonDict.TryGetValue("CGCID", out outObject)) { csmevent.eventInfo.CGCID = (string)outObject; } if (jsonDict.TryGetValue("PGCID", out outObject)) { csmevent.eventInfo.PGCID = (string)outObject; } if (jsonDict.TryGetValue("SGCID", out outObject)) { csmevent.eventInfo.SGCID = (string)outObject; } logResult.result = csmevent; } else { logResult.code = LogCode.LOG_NOTHING; } } catch (ArgumentException ex) { csmevent.eventInfo.Type = "Exception"; csmevent.eventInfo.Cause = "Invalid JSON"; csmevent.node = new List<TreeNode> { new TreeNode(String.Format("Exception: {0}", ex.Message)), new TreeNode(String.Format("JSON: {0}", jsonString)) }; } break; default: break; } return logResult; }
public override LogResult Process() { LogResult logResult; logResult = base.Process(); switch (logResult.code) { case LogCode.LOG_EVENT: Match eventMatch; string csvstring = (string)logResult.result; eventMatch = Regex.Match(csvstring, LogCPReader.msgPattern, RegexOptions.IgnorePatternWhitespace); if (eventMatch.Success) { csmevent = new CSMEvent(); csmevent.eventInfo.TimeStamp = logResult.timestamp; csmevent.eventInfo.MonitorHandlerExtension = eventMatch.Groups["MONITOR"].Value; csmevent.node = new List<TreeNode>(); List<string> groups = eventMatch.Groups["INFO"].Value.Split(',').ToList(); switch (eventMatch.Groups["TYPE"].Value) { case "CC": csmevent.eventInfo.Type = "Call Cleared"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.eventInfo.Cause = groups[1]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferred CID", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transfer destination", groups[3]))); break; case "CO": csmevent.eventInfo.Type = "Conferenced"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Subject EXT", groups[0]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "PGCID", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "SGCID", groups[2]))); csmevent.eventInfo.PGCID = groups[1]; csmevent.eventInfo.SGCID = groups[2]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Conference controller EXT", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Number of parties", groups[4]))); for(int i = 5, j = 1; i < groups.Count -1; i += 2, j++) { csmevent.node.Add(new TreeNode(String.Format("Party #{0}: {1}", j, groups[i]))); csmevent.node.Add(new TreeNode(String.Format("Party #{0}: {1}", j, groups[i+1]))); } csmevent.eventInfo.Cause = groups[groups.Count-1]; break; case "XC": csmevent.eventInfo.Type = "Connection Cleared"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Cleared EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Terminating EXT", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[3]))); csmevent.eventInfo.Cause = groups[4]; break; case "DE": csmevent.eventInfo.Type = "Delivered"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Alerting internal EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Alerting outside number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Alerting device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller name", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk name", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[10]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[11]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Account code", groups[12]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[13]))); csmevent.eventInfo.Cause = groups[14]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "ACD/UCD group", groups[15]))); break; case "DI": csmevent.eventInfo.Type = "Diverted"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Diverted from EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "New destination EXT", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Diverted to outside EXT", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[4]))); csmevent.eventInfo.Cause = groups[5]; break; case "ER": csmevent.eventInfo.Type = "Established Routing"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering internal EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering outside number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[10]))); csmevent.eventInfo.Cause = groups[11]; break; case "ES": csmevent.eventInfo.Type = "Established"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering internal EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering outside number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Answering device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[10]))); csmevent.eventInfo.Cause = groups[11]; break; case "FA": csmevent.eventInfo.Type = "Failed"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Failed EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Called number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[3]))); csmevent.eventInfo.Cause = groups[4]; break; case "HE": csmevent.eventInfo.Type = "Held"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Activate hold EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[2]))); csmevent.eventInfo.Cause = groups[3]; break; case "NT": csmevent.eventInfo.Type = "Network Reached"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk used", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Dialed number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[3]))); csmevent.eventInfo.Cause = groups[4]; break; case "OR": csmevent.eventInfo.Type = "Originated"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Dialed number", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Account code", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[6]))); csmevent.eventInfo.Cause = groups[7]; break; case "QU": csmevent.eventInfo.Type = "Queued"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Queued EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal calling EXT", groups[2]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller name", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller number", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk name", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Calling device type", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Originally called device", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Last redirection EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Number queued", groups[10]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Acoount code", groups[11]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[12]))); csmevent.eventInfo.Cause = groups[13]; break; case "RE": csmevent.eventInfo.Type = "Retrieved"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[2]))); csmevent.eventInfo.Cause = groups[3]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Internal retrieved EXT", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving device outside number", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving device trunk number", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Retrieving device type", groups[7]))); break; case "SI": csmevent.eventInfo.Type = "Service Initiated"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "CGCID", groups[0]))); csmevent.eventInfo.CGCID = groups[0]; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Initiating EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[2]))); csmevent.eventInfo.Cause = groups[3]; if (groups.Count > 4) { csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Callback target EXT", groups[4]))); } break; case "TR": csmevent.eventInfo.Type = "Transferred"; csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferred CID", groups[0]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferring EXT", groups[1]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Transferred EXT", groups[3]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Announcement CID", groups[4]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Destination EXT", groups[5]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller name", groups[6]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Outside caller EXT", groups[7]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk name", groups[8]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Trunk outside EXT", groups[9]))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Local CNX state", groups[10]))); csmevent.eventInfo.Cause = groups[11]; break; default: csmevent.eventInfo.Type = String.Format("{0} ({1})", csmevent.eventInfo.Type, eventMatch.Groups["TYPE"].Value); int index = 1; foreach (string item in groups) { csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", index++, item))); } break; } csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "ID", eventMatch.Groups["ID"].Value))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Type", eventMatch.Groups["TYPE"].Value))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Cause", csmevent.eventInfo.Cause))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Monitor", csmevent.Monitor))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Resync Code", eventMatch.Groups["RESYNC_CODE"].Value))); csmevent.node.Add(new TreeNode(String.Format("{0}: {1}", "Mon cross Ref ID", eventMatch.Groups["MON_REF"].Value))); logResult.result = csmevent; } else { logResult.code = LogCode.LOG_NOTHING; } break; } return logResult; }
private void treeLog_MouseDown(object sender, MouseEventArgs e) { if (ModelingForm == null) { if (e.Button == MouseButtons.Middle) { TreeNode node = treeLog.GetNodeAt(e.X, e.Y); if (node != null && node.Parent == null) { treeLog.SelectedNode = node; CSMEvent tag = (CSMEvent)node.Tag; ModelingForm = new Form(); ModelingForm.SuspendLayout(); ModelingForm.StartPosition = FormStartPosition.Manual; ModelingForm.Left = Cursor.Position.X + 5; ModelingForm.Top = Cursor.Position.Y + 5; ModelingForm.Width = 0; ModelingForm.Height = 0; ModelingForm.FormBorderStyle = FormBorderStyle.None; ModelingForm.Name = "frmModeling"; ModelingForm.BackColor = System.Drawing.Color.LightGray; RichTextBox eee = new RichTextBox(); eee.Margin = new System.Windows.Forms.Padding(0); eee.Font = new System.Drawing.Font("Calibri", 10); eee.Multiline = true; eee.ReadOnly = true; eee.Text = tag.eventInfo.Modeling; int globalindex = 0; foreach (string line in eee.Lines) { int index = line.IndexOf(" = ", 0); if (index > -1) { eee.SelectionStart = globalindex + index + 3; eee.SelectionLength = line.Length - index - 3; eee.SelectionFont = new System.Drawing.Font(eee.Font, FontStyle.Bold); } globalindex += line.Length + 1; } if (tag.eventInfo.SGCID != default(string)) { eee.SelectionStart = 0; eee.SelectionLength = 0; eee.SelectionFont = new System.Drawing.Font(eee.Font, FontStyle.Bold); eee.SelectedText = String.Format("SGCID: {0}{1}", tag.eventInfo.SGCID, Environment.NewLine); } if (tag.eventInfo.PGCID != default(string)) { eee.SelectionStart = 0; eee.SelectionLength = 0; eee.SelectionFont = new System.Drawing.Font(eee.Font, FontStyle.Bold); eee.SelectedText = String.Format("PGCID: {0}{1}", tag.eventInfo.PGCID, Environment.NewLine); } if (tag.eventInfo.CGCID != default(string)) { eee.SelectionStart = 0; eee.SelectionLength = 0; eee.SelectionFont = new System.Drawing.Font(eee.Font, FontStyle.Bold); eee.SelectedText = String.Format("CGCID: {0}{1}", tag.eventInfo.CGCID, Environment.NewLine); } //Monitor eee.SelectionStart = 0; eee.SelectionLength = 0; eee.SelectionFont = new System.Drawing.Font(eee.Font, FontStyle.Bold); eee.SelectedText = String.Format("Monitor: {0}{1}", tag.Monitor, Environment.NewLine); //Event eee.SelectionStart = 0; eee.SelectionLength = 0; eee.SelectionFont = new System.Drawing.Font(eee.Font, FontStyle.Bold); eee.SelectedText = String.Format("Event: {0}{1}", tag.eventInfo.Type, Environment.NewLine); eee.Size = eee.PreferredSize; ModelingForm.Controls.AddRange(new Control[] { eee }); ModelingForm.AutoSize = true; ModelingForm.Show(this); ModelingForm.ResumeLayout(); } } else if (e.Button == MouseButtons.Right) { TreeNode node = treeLog.GetNodeAt(e.X, e.Y); if (node != null && node.Parent == null) { treeLog.SelectedNode = node; string result = (node.Text + Environment.NewLine).TrimStart(); foreach (TreeNode inode in node.Nodes) { result += " " + inode.Text + Environment.NewLine; } Clipboard.SetText(result); } } } else { ModelingForm.Close(); ModelingForm = null; } }