Skip to content

Commit

Permalink
Merge pull request #38 from istresearch/develop into main
Browse files Browse the repository at this point in the history
v4.0.15
  • Loading branch information
baracudda authored Jul 25, 2022
2 parents 16f2cfb + 81133a5 commit 5eca2cf
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.14
4.0.15
2 changes: 1 addition & 1 deletion core/ivr/vonage/vonage.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/nyaruka/mailroom/core/models"

"github.com/buger/jsonparser"
jwt "github.com/dgrijalva/jwt-go"
jwt "github.com/golang-jwt/jwt/v4"
"github.com/gomodule/redigo/redis"
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
Expand Down
15 changes: 13 additions & 2 deletions core/models/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ func FindMatchingIncomingCallTrigger(oa *OrgAssets, contact *flows.Contact) *Tri
}

// FindMatchingMissedCallTrigger finds the best match trigger for missed incoming calls
func FindMatchingMissedCallTrigger(oa *OrgAssets) *Trigger {
func FindMatchingMissedCallTrigger(oa *OrgAssets, contact *flows.Contact) *Trigger {
candidates := findTriggerCandidates(oa, MissedCallTriggerType, nil)

return findBestTriggerMatch(candidates, nil, nil)
return findBestTriggerMatch(candidates, nil, contact)
}

// FindMatchingNewConversationTrigger finds the best match trigger for new conversation channel events
Expand Down Expand Up @@ -198,8 +198,19 @@ func findTriggerCandidates(oa *OrgAssets, type_ TriggerType, filter func(*Trigge
candidates := make([]*Trigger, 0, 10)

for _, t := range oa.Triggers() {
//logrus.WithField("type_", type_).
// WithField("trigtype", t.TriggerType()).
// WithField("is_filter_nil", (filter == nil)).
// WithField("filter_result", (filter == nil || filter(t))).
// Debug("[TRACE] findTrig")
if t.TriggerType() == type_ && (filter == nil || filter(t)) {
candidates = append(candidates, t)
//logrus.WithField("t.id", t.ID()).
// WithField("t.flow_id", t.FlowID()).
// WithField("t.chan_id", t.ChannelID()).
// WithField("t.grp_ids", t.IncludeGroupIDs()).
// WithField("t.trigtyp", t.TriggerType()).
// Debug("[TRACE] foundTrig")
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/tasks/handler/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func HandleChannelEvent(ctx context.Context, rt *runtime.Runtime, eventType mode
trigger = models.FindMatchingReferralTrigger(oa, channel, event.ExtraValue("referrer_id"))

case models.MOMissEventType:
trigger = models.FindMatchingMissedCallTrigger(oa)
trigger = models.FindMatchingMissedCallTrigger(oa, contact)

case models.MOCallEventType:
trigger = models.FindMatchingIncomingCallTrigger(oa, contact)
Expand Down
4 changes: 4 additions & 0 deletions core/tasks/ivr/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ type MockClient struct {
callError error
}

func (c *MockClient) EventForCallDataRequest(r *http.Request) (models.ChannelEventType, int) {
return models.MTMissEventType, 0
}

func (c *MockClient) RequestCall(number urns.URN, handleURL string, statusURL string) (ivr.CallID, *httpx.Trace, error) {
return c.callID, nil, c.callError
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ require (
github.com/Masterminds/semver v1.5.0
github.com/apex/log v1.1.4
github.com/aws/aws-sdk-go v1.35.20
github.com/buger/jsonparser v1.0.0
github.com/buger/jsonparser v1.1.1
github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/edganiukov/fcm v0.4.0
github.com/getsentry/raven-go v0.1.2-0.20190125112653-238ebd86338d // indirect
github.com/go-chi/chi v4.1.2+incompatible
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/golang/protobuf v1.4.0
github.com/gomodule/redigo v2.0.0+incompatible
github.com/gorilla/schema v1.1.0
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac=
github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ=
github.com/buger/jsonparser v1.0.0 h1:etJTGF5ESxjI0Ic2UaLQs2LQQpa8G9ykQScukbh4L8A=
github.com/buger/jsonparser v1.0.0/go.mod h1:tgcrVJ81GPSF0mz+0nu1Xaz0fazGPrmmJfJtxjbHhUQ=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894 h1:JLaf/iINcLyjwbtTsCJjc6rtlASgHeIJPrB6QmwURnA=
github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/edganiukov/fcm v0.4.0 h1:PAZamwbiW2AegM5hGqYNv+djE1xxLyH7zMN6MwWpvoQ=
github.com/edganiukov/fcm v0.4.0/go.mod h1:3gL1BLvC3w05anUsF2Wbd1Sz+ZdCu8qsNCa1LyRfwFo=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
Expand Down Expand Up @@ -61,6 +60,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me
github.com/gofrs/uuid v3.3.0+incompatible h1:8K4tyRfvU1CYPgJsveYFQMhpFd/wXNM7iK6rR7UHz84=
github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
Expand Down

0 comments on commit 5eca2cf

Please sign in to comment.