From 48f57268dd50f4854d1352466f36807a5d28f225 Mon Sep 17 00:00:00 2001 From: Igor Navrotskyj Date: Mon, 26 Feb 2024 16:23:25 +0200 Subject: [PATCH] WPRO-942 --- agent_manager/agent_manager.go | 1 + agent_manager/interface.go | 1 - app/agent.go | 11 +++++++++++ queue/app.go | 2 ++ queue/team.go | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/agent_manager/agent_manager.go b/agent_manager/agent_manager.go index 66d6e432..3c7ccea3 100644 --- a/agent_manager/agent_manager.go +++ b/agent_manager/agent_manager.go @@ -170,6 +170,7 @@ func (am *agentManager) SetBreakOut(agent AgentObject) *model.AppError { if err != nil { return err } + agent.StoreStatus(event.AgentStatus) //add channel queue return am.mq.AgentChangeStatus(agent.DomainId(), agent.UserId(), NewAgentEventStatus(agent, event)) } diff --git a/agent_manager/interface.go b/agent_manager/interface.go index 3ceb53f6..b8d33ffb 100644 --- a/agent_manager/interface.go +++ b/agent_manager/interface.go @@ -31,7 +31,6 @@ type AgentObject interface { IsExpire(updatedAt int64) bool - SetBreakOut() *model.AppError SetOnDemand(v bool) IsOnDemand() bool GreetingMedia() *model.RingtoneFile diff --git a/app/agent.go b/app/agent.go index 89c628e5..defb6e99 100644 --- a/app/agent.go +++ b/app/agent.go @@ -1,6 +1,7 @@ package app import ( + "github.com/webitel/call_center/agent_manager" "github.com/webitel/call_center/model" "github.com/webitel/wlog" "net/http" @@ -107,6 +108,16 @@ func (app *App) SetAgentPause(agentId int, payload *string, timeout *int) *model } } +func (app *App) SetAgentBreakOut(agent agent_manager.AgentObject) *model.AppError { + err := app.agentManager.SetBreakOut(agent) + if err != nil { + return err + } + app.Queue().Manager().AgentTeamHook(model.HookAgentStatus, agent) + + return nil +} + func (app *App) hangupNoAnswerChannels(chs []*model.CallNoAnswer) { for _, ch := range chs { if err := app.callManager.HangupById(ch.Id, ch.AppId); err != nil { diff --git a/queue/app.go b/queue/app.go index a787e993..7891de19 100644 --- a/queue/app.go +++ b/queue/app.go @@ -1,6 +1,7 @@ package queue import ( + "github.com/webitel/call_center/agent_manager" "github.com/webitel/call_center/chat" "github.com/webitel/call_center/model" "github.com/webitel/flow_manager/client" @@ -20,4 +21,5 @@ type App interface { NotificationHideMember(domainId int64, queueId int, memberId *int64, agentId int) *model.AppError NotificationInterceptAttempt(domainId int64, queueId int, channel string, attemptId int64, skipAgentId int32) *model.AppError NotificationWaitingList(e *model.MemberWaitingByUsers) *model.AppError + SetAgentBreakOut(agent agent_manager.AgentObject) *model.AppError } diff --git a/queue/team.go b/queue/team.go index 321870b3..7b97ce37 100644 --- a/queue/team.go +++ b/queue/team.go @@ -334,7 +334,7 @@ func (tm *agentTeam) MissedAgentAndWaitingAttempt(attempt *Attempt, agent agent_ } func (tm *agentTeam) SetAgentMaxNoAnswer(agent agent_manager.AgentObject) { - if err := agent.SetBreakOut(); err != nil { + if err := tm.teamManager.app.SetAgentBreakOut(agent); err != nil { wlog.Error(fmt.Sprintf("agent \"%s\" change to [break_out] error %s", agent.Name(), err.Error())) } else { wlog.Debug(fmt.Sprintf("agent \"%s\" changed status to [break_out], maximum no answers in team \"%s\"", agent.Name(), tm.Name()))