From 43926f6cd68497fdb2daa66c994b7dacd7ebe99f Mon Sep 17 00:00:00 2001 From: Igor Navrotskyj Date: Mon, 8 Jan 2024 12:40:43 +0200 Subject: [PATCH 1/2] DEV-3659 --- model/resource.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/model/resource.go b/model/resource.go index 6445fe51..e4e05a65 100644 --- a/model/resource.go +++ b/model/resource.go @@ -106,8 +106,9 @@ type BridgeRequest struct { func (g *SipGateway) Bridge(params BridgeRequest) string { res := []string{ - fmt.Sprintf("leg_timeout=%d", params.Timeout), - fmt.Sprintf("progress_timeout=%d", params.Timeout), + //fmt.Sprintf("leg_timeout=%d", params.Timeout), + fmt.Sprintf("leg_progress_timeout=%d", params.Timeout), + fmt.Sprintf("bridge_answer_timeout=%d", params.Timeout), fmt.Sprintf("wbt_parent_id=%s", params.ParentId), fmt.Sprintf("origination_caller_id_number=%s", params.Display), From ee77da40f9703f5b8cb60593597a343bc95caf5e Mon Sep 17 00:00:00 2001 From: Igor Navrotskyj Date: Thu, 18 Jan 2024 13:01:50 +0200 Subject: [PATCH 2/2] WTEL-4153 --- call_manager/call.go | 8 ++++++++ chat/session.go | 7 +++++++ queue/events.go | 3 ++- queue/queue_agent_task.go | 7 +++++++ queue/schema.go | 13 +++++++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/call_manager/call.go b/call_manager/call.go index da17f281..aae8faad 100644 --- a/call_manager/call.go +++ b/call_manager/call.go @@ -33,6 +33,7 @@ type Call interface { AddAction(action CallAction) BridgeId() *string + Answered() bool AcceptAt() int64 BridgeAt() int64 @@ -510,6 +511,13 @@ func (call *CallImpl) AcceptAt() int64 { return call.acceptAt } +func (call *CallImpl) Answered() bool { + call.RLock() + a := call.acceptAt + call.RUnlock() + return a > 0 +} + func (call *CallImpl) BridgeAt() int64 { return call.bridgeAt } diff --git a/chat/session.go b/chat/session.go index ec3b6328..a5efa5c3 100644 --- a/chat/session.go +++ b/chat/session.go @@ -67,6 +67,13 @@ func (c *ChatSession) SessionId() string { return c.InviteId } +func (c *ChatSession) Answered() bool { + c.RLock() + a := c.AnsweredAt + c.RUnlock() + + return a > 0 +} func (c *ChatSession) SetActivity() { c.Lock() diff --git a/queue/events.go b/queue/events.go index 878a5c28..3f59560d 100644 --- a/queue/events.go +++ b/queue/events.go @@ -10,6 +10,7 @@ import ( type Channel interface { Id() string Stats() map[string]string + Answered() bool } type ChannelEvent struct { @@ -19,7 +20,7 @@ type ChannelEvent struct { Timestamp int64 `json:"timestamp"` } -//TODO refactoring call event to CC +// TODO refactoring call event to CC type Distribute struct { AppId string `json:"app_id"` Channel string `json:"channel"` diff --git a/queue/queue_agent_task.go b/queue/queue_agent_task.go index 0a8c98d6..2527113e 100644 --- a/queue/queue_agent_task.go +++ b/queue/queue_agent_task.go @@ -68,6 +68,13 @@ func (t *TaskChannel) setState(state TaskState) { t.stateC <- t.state } +func (t *TaskChannel) Answered() bool { + t.RLock() + a := t.bridgedAt + t.RUnlock() + return a > 0 +} + func (t *TaskChannel) SetAnswered() *model.AppError { t.Lock() defer t.Unlock() diff --git a/queue/schema.go b/queue/schema.go index 3e39939b..f1e0a26e 100644 --- a/queue/schema.go +++ b/queue/schema.go @@ -176,6 +176,19 @@ func (qm *QueueManager) AfterDistributeSchema(att *Attempt) (*model.SchemaResult st := time.Now() + // TODO WTEL-4153 + if att.Result() == "" && att.memberChannel != nil { + if att.agentChannel != nil && att.agentChannel.Answered() && att.memberChannel.Answered() { + vars["cc_result"] = "success" + } else { + vars["cc_result"] = "abandoned" + } + + if !att.memberChannel.Answered() { + vars["cc_result"] = "failed" + } + } + res, err := qm.app.FlowManager().Queue().ResultAttempt(&flow.ResultAttemptRequest{ DomainId: att.queue.DomainId(), SchemaId: *att.queue.AfterSchemaId(),