Skip to content

Commit

Permalink
Merge pull request #51 from webitel/v23.12
Browse files Browse the repository at this point in the history
V23.12
  • Loading branch information
navrotskyj authored Jan 18, 2024
2 parents b33afc7 + ee77da4 commit 8f59ff1
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
8 changes: 8 additions & 0 deletions call_manager/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Call interface {
AddAction(action CallAction)

BridgeId() *string
Answered() bool

AcceptAt() int64
BridgeAt() int64
Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions chat/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions model/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
3 changes: 2 additions & 1 deletion queue/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type Channel interface {
Id() string
Stats() map[string]string
Answered() bool
}

type ChannelEvent struct {
Expand All @@ -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"`
Expand Down
7 changes: 7 additions & 0 deletions queue/queue_agent_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
13 changes: 13 additions & 0 deletions queue/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 8f59ff1

Please sign in to comment.