Skip to content

Commit

Permalink
WPRO-942
Browse files Browse the repository at this point in the history
  • Loading branch information
navrotskyj committed Feb 26, 2024
1 parent 70ee0e7 commit 48f5726
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions agent_manager/agent_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
1 change: 0 additions & 1 deletion agent_manager/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type AgentObject interface {

IsExpire(updatedAt int64) bool

SetBreakOut() *model.AppError
SetOnDemand(v bool)
IsOnDemand() bool
GreetingMedia() *model.RingtoneFile
Expand Down
11 changes: 11 additions & 0 deletions app/agent.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions queue/app.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion queue/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit 48f5726

Please sign in to comment.