void _connection_NewMessage(object sender, MessageArgs e) { if (e.Message != null && e.Message is DialerMessage) { if ((e.Message as DialerMessage).Header.Name == "AGTCallNotify") { if ((e.Message as DialerMessage).Segments.Contains(Enum.GetName(typeof(Common.CallType), CurrentJob.Type).ToUpper())) { if((e.Message as DialerMessage).Segments.Count >= 5 && (e.Message as DialerMessage).Segments[4].Split(',').Count() >= 2) CurrentCall.AccountNumber = (e.Message as DialerMessage).Segments[4].Split(',')[1]; } else { var segs = (e.Message as DialerMessage).Segments.Skip(2).ToList(); if (segs.Count > 0) { CurrentCall.Screens.Clear(); CurrentCall.Screens.AddRange(CurrentJob.Screens); for (int i = 0; i < segs.Count(); i++) { string[] pieces = segs[i].Split(','); Screen screen = CurrentCall.Screens.FirstOrDefault(s => s.Fields.Count(f => f.Name == pieces[0]) > 0); if (screen != null) { DataField field = screen.Fields.OfType<DataField>().FirstOrDefault(f => f.Name == pieces[0]); if (field != null) { field.Value = pieces[1]; field.IsDirty = false; } } } } } if (++callNotifications == 3) { MoveToState(AgentState.OnCall); callNotifications = 0; } } else if ((e.Message as DialerMessage).Header.Name == "AGTAutoReleaseLine") MoveToState(AgentState.Disconnected); else if ((e.Message as DialerMessage).Header.Name == "AGTJobTransLink") { MoveToState(AgentState.LoggedOn); Attach(new Job { Name = (e.Message as DialerMessage).Segments[2], Status = JobStatus.Active, Type = CurrentJob.Type }); } } OnNewMessage(e); }
private void OnNewMessage(MessageArgs e) { if (NewMessage != null) NewMessage(this, e); }