Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V24.10 #83

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions app/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,19 @@ func (app *App) SetAgentBreakOut(agent agent_manager.AgentObject) *model.AppErro

func (app *App) hangupNoAnswerChannels(chs []*model.CallNoAnswer) {
for _, ch := range chs {
if err := app.callManager.HangupById(ch.Id, ch.AppId); err != nil {
app.Log.Error(err.Error(),
wlog.Err(err),
wlog.String("call_id", ch.Id),
)
if ch.Id != nil && ch.AppId != nil {
if err := app.callManager.HangupById(*ch.Id, *ch.AppId); err != nil {
app.Log.Error(err.Error(),
wlog.Err(err),
wlog.String("call_id", *ch.Id),
)
}
} else {
// low cps race call DEV-4783
att, ok := app.Queue().Manager().GetAttempt(ch.AttemptId)
if ok {
att.SetCancel()
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ func loadConfig() (*model.Config, error) {
//return nil, err
}

if !config.Log.Console && !config.Log.Otel && len(config.Log.File) == 0 {
config.Log.Console = true
}

return &config, nil
}
5 changes: 3 additions & 2 deletions model/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ type CallActionHangup struct {
}

type CallNoAnswer struct {
Id string `json:"id" db:"id"`
AppId string `json:"app_id" db:"app_id"`
Id *string `json:"id" db:"id"`
AppId *string `json:"app_id" db:"app_id"`
AttemptId int64 `json:"attempt_id" db:"attempt_id"`
}

type AmdAiResult struct {
Expand Down
2 changes: 1 addition & 1 deletion model/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type LogSettings struct {
Json bool `json:"json" flag:"log_json|false|Log format JSON" env:"LOG_JSON"`
Otel bool `json:"otel" flag:"log_otel|false|Log OTEL" env:"LOG_OTEL"`
File string `json:"file" flag:"log_file||Log file directory" env:"LOG_FILE"`
Console bool `json:"console" flag:"log_console|1|Log console" env:"LOG_CONSOLE"`
Console bool `json:"console" flag:"log_console|false|Log console" env:"LOG_CONSOLE"`
}

type CallSettings struct {
Expand Down
8 changes: 8 additions & 0 deletions queue/attempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,14 @@ func (a *Attempt) SetCancel() {
}
}

func (a *Attempt) Canceled() bool {
a.RLock()
c := a.canceled
a.RUnlock()

return c
}

func (a *Attempt) Cancel() <-chan struct{} {
return a.cancel
}
Expand Down
6 changes: 6 additions & 0 deletions queue/call_progressive.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ func (queue *ProgressiveCallQueue) run(attempt *Attempt, team *agentTeam, agent
})
}

if attempt.Canceled() {
queue.queueManager.SetAttemptAbandonedWithParams(attempt, queue.MaxAttempts+1, 0, nil)
queue.queueManager.LeavingMember(attempt)
return
}

//FIXME update member call id
team.Distribute(queue, agent, NewDistributeEvent(attempt, agent.UserId(), queue, agent, queue.Processing(), nil, mCall))
attempt.memberChannel = mCall
Expand Down
10 changes: 6 additions & 4 deletions store/sqlstore/agent_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,17 @@ WHERE (q_1.team_id IS NULL OR a_1.team_id = q_1.team_id)

func (s *SqlAgentStore) GetNoAnswerChannels(agentId int, queueTypes []int) ([]*model.CallNoAnswer, *model.AppError) {
var res []*model.CallNoAnswer
_, err := s.GetMaster().Select(&res, `select c.id, c.app_id
_, err := s.GetMaster().Select(&res, `select c.id, c.app_id, at.id attempt_id
from call_center.cc_member_attempt at
left join call_center.cc_queue q on q.id = at.queue_id
left join call_center.cc_calls c
on case when q.type = 4 then c.id::text = at.member_call_id else c.id::text = at.agent_call_id end
and c.answered_at isnull
and c.id notnull
where at.agent_id = :AgentId
and c.answered_at isnull
and c.id notnull
and (:QueueTypes::smallint[] isnull or q.type = any(:QueueTypes::smallint[]))`, map[string]interface{}{
and at.channel = 'call'
and at.state = 'offering'
and (:QueueTypes::smallint[] isnull or q.type = any (:QueueTypes::smallint[]))`, map[string]interface{}{
"AgentId": agentId,
"QueueTypes": pq.Array(queueTypes),
})
Expand Down
Loading