Skip to content

Commit 02a3f71

Browse files
authored
Merge pull request #657 from nyaruka/unsendable
Use MsgOut.UnsendableReason instead of checking contact status
2 parents acd61cf + 29e82a4 commit 02a3f71

File tree

7 files changed

+53
-41
lines changed

7 files changed

+53
-41
lines changed

core/models/msgs.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ const (
8787
MsgFailedNoDestination = MsgFailedReason("D")
8888
)
8989

90+
var unsendableToFailedReason = map[flows.UnsendableReason]MsgFailedReason{
91+
flows.UnsendableReasonContactStatus: MsgFailedContact,
92+
flows.UnsendableReasonNoDestination: MsgFailedNoDestination,
93+
}
94+
9095
// BroadcastID is our internal type for broadcast ids, which can be null/0
9196
type BroadcastID null.Int
9297

@@ -361,18 +366,13 @@ func newOutgoingMsg(rt *runtime.Runtime, org *Org, channel *Channel, contact *fl
361366
msg.SetChannel(channel)
362367
msg.SetURN(out.URN())
363368

364-
if org.Suspended() {
369+
if out.UnsendableReason() != flows.NilUnsendableReason {
370+
m.Status = MsgStatusFailed
371+
m.FailedReason = unsendableToFailedReason[out.UnsendableReason()]
372+
} else if org.Suspended() {
365373
// we fail messages for suspended orgs right away
366374
m.Status = MsgStatusFailed
367375
m.FailedReason = MsgFailedSuspended
368-
} else if contact.Status() != flows.ContactStatusActive {
369-
// and blocked, stopped or archived contacts
370-
m.Status = MsgStatusFailed
371-
m.FailedReason = MsgFailedContact
372-
} else if msg.URN() == urns.NilURN || channel == nil {
373-
// if msg is missing the URN or channel, we also fail it
374-
m.Status = MsgStatusFailed
375-
m.FailedReason = MsgFailedNoDestination
376376
} else {
377377
// also fail right away if this looks like a loop
378378
repetitions, err := GetMsgRepetitions(rt.RP, contact, out)
@@ -1071,8 +1071,15 @@ func (b *BroadcastBatch) CreateMessages(ctx context.Context, rt *runtime.Runtime
10711071
return nil, nil
10721072
}
10731073

1074+
unsendableReason := flows.NilUnsendableReason
1075+
if contact.Status() != flows.ContactStatusActive {
1076+
unsendableReason = flows.UnsendableReasonContactStatus
1077+
} else if urn == urns.NilURN || channel == nil {
1078+
unsendableReason = flows.UnsendableReasonNoDestination
1079+
}
1080+
10741081
// create our outgoing message
1075-
out := flows.NewMsgOut(urn, channel.ChannelReference(), text, t.Attachments, t.QuickReplies, nil, flows.NilMsgTopic)
1082+
out := flows.NewMsgOut(urn, channel.ChannelReference(), text, t.Attachments, t.QuickReplies, nil, flows.NilMsgTopic, unsendableReason)
10761083
msg, err := NewOutgoingBroadcastMsg(rt, oa.Org(), channel, contact, out, time.Now(), b.BroadcastID)
10771084
if err != nil {
10781085
return nil, errors.Wrapf(err, "error creating outgoing message")

core/models/msgs_test.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
4444
Attachments []utils.Attachment
4545
QuickReplies []string
4646
Topic flows.MsgTopic
47+
Unsendable flows.UnsendableReason
4748
Flow *testdata.Flow
4849
ResponseTo models.MsgID
4950
SuspendedOrg bool
@@ -120,6 +121,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
120121
Contact: testdata.Cathy,
121122
URN: urns.NilURN,
122123
URNID: models.URNID(0),
124+
Unsendable: flows.UnsendableReasonNoDestination,
123125
Flow: testdata.Favorites,
124126
ExpectedStatus: models.MsgStatusFailed,
125127
ExpectedFailedReason: models.MsgFailedNoDestination,
@@ -133,6 +135,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
133135
Contact: testdata.Cathy,
134136
URN: urns.URN(fmt.Sprintf("tel:+250700000001?id=%d", testdata.Cathy.URNID)),
135137
URNID: testdata.Cathy.URNID,
138+
Unsendable: flows.UnsendableReasonNoDestination,
136139
Flow: testdata.Favorites,
137140
ExpectedStatus: models.MsgStatusFailed,
138141
ExpectedFailedReason: models.MsgFailedNoDestination,
@@ -146,6 +149,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
146149
Contact: blake,
147150
URN: urns.URN(fmt.Sprintf("tel:+250700000007?id=%d", blakeURNID)),
148151
URNID: blakeURNID,
152+
Unsendable: flows.UnsendableReasonContactStatus,
149153
Flow: testdata.Favorites,
150154
ExpectedStatus: models.MsgStatusFailed,
151155
ExpectedFailedReason: models.MsgFailedContact,
@@ -158,6 +162,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
158162
now := time.Now()
159163

160164
for _, tc := range tcs {
165+
desc := fmt.Sprintf("text='%s'", tc.Text)
161166
db.MustExec(`UPDATE orgs_org SET is_suspended = $1 WHERE id = $2`, tc.SuspendedOrg, testdata.Org1.ID)
162167

163168
oa, err := models.GetOrgAssetsWithRefresh(ctx, rt, testdata.Org1.ID, models.RefreshOrg)
@@ -171,7 +176,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
171176
session.SetIncomingMsg(flows.MsgID(tc.ResponseTo), null.NullString)
172177
}
173178

174-
flowMsg := flows.NewMsgOut(tc.URN, assets.NewChannelReference(tc.ChannelUUID, "Test Channel"), tc.Text, tc.Attachments, tc.QuickReplies, nil, tc.Topic)
179+
flowMsg := flows.NewMsgOut(tc.URN, assets.NewChannelReference(tc.ChannelUUID, "Test Channel"), tc.Text, tc.Attachments, tc.QuickReplies, nil, tc.Topic, tc.Unsendable)
175180
msg, err := models.NewOutgoingFlowMsg(rt, oa.Org(), channel, session, flow, flowMsg, now)
176181

177182
assert.NoError(t, err)
@@ -191,8 +196,8 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
191196
}
192197
assert.Equal(t, tc.Flow.ID, msg.FlowID())
193198

194-
assert.Equal(t, tc.ExpectedStatus, msg.Status())
195-
assert.Equal(t, tc.ExpectedFailedReason, msg.FailedReason())
199+
assert.Equal(t, tc.ExpectedStatus, msg.Status(), "status mismatch for %s", desc)
200+
assert.Equal(t, tc.ExpectedFailedReason, msg.FailedReason(), "failed reason mismatch for %s", desc)
196201
assert.Equal(t, tc.ExpectedMetadata, msg.Metadata())
197202
assert.Equal(t, tc.ExpectedMsgCount, msg.MsgCount())
198203
assert.Equal(t, now, msg.CreatedOn())
@@ -216,7 +221,7 @@ func TestNewOutgoingFlowMsg(t *testing.T) {
216221

217222
// check that msg loop detection triggers after 20 repeats of the same text
218223
newOutgoing := func(text string) *models.Msg {
219-
flowMsg := flows.NewMsgOut(urns.URN(fmt.Sprintf("tel:+250700000001?id=%d", testdata.Cathy.URNID)), assets.NewChannelReference(testdata.TwilioChannel.UUID, "Twilio"), text, nil, nil, nil, flows.NilMsgTopic)
224+
flowMsg := flows.NewMsgOut(urns.URN(fmt.Sprintf("tel:+250700000001?id=%d", testdata.Cathy.URNID)), assets.NewChannelReference(testdata.TwilioChannel.UUID, "Twilio"), text, nil, nil, nil, flows.NilMsgTopic, flows.NilUnsendableReason)
220225
msg, err := models.NewOutgoingFlowMsg(rt, oa.Org(), channel, session, flow, flowMsg, now)
221226
require.NoError(t, err)
222227
return msg
@@ -261,6 +266,7 @@ func TestMarshalMsg(t *testing.T) {
261266
[]string{"yes", "no"},
262267
nil,
263268
flows.MsgTopicPurchase,
269+
flows.NilUnsendableReason,
264270
)
265271

266272
// create a non-priority flow message.. i.e. the session isn't responding to an incoming message
@@ -318,6 +324,7 @@ func TestMarshalMsg(t *testing.T) {
318324
"Hi there",
319325
nil, nil, nil,
320326
flows.NilMsgTopic,
327+
flows.NilUnsendableReason,
321328
)
322329
in1 := testdata.InsertIncomingMsg(db, testdata.Org1, testdata.TwilioChannel, testdata.Cathy, "test", models.MsgStatusHandled)
323330
session.SetIncomingMsg(flows.MsgID(in1.ID()), null.String("EX123"))
@@ -359,7 +366,7 @@ func TestMarshalMsg(t *testing.T) {
359366

360367
// try a broadcast message which won't have session and flow fields set
361368
bcastID := testdata.InsertBroadcast(db, testdata.Org1, `eng`, map[envs.Language]string{`eng`: "Blast"}, models.NilScheduleID, []*testdata.Contact{testdata.Cathy}, nil)
362-
bcastMsg1 := flows.NewMsgOut(urn, assets.NewChannelReference(testdata.TwilioChannel.UUID, "Test Channel"), "Blast", nil, nil, nil, flows.NilMsgTopic)
369+
bcastMsg1 := flows.NewMsgOut(urn, assets.NewChannelReference(testdata.TwilioChannel.UUID, "Test Channel"), "Blast", nil, nil, nil, flows.NilMsgTopic, flows.NilUnsendableReason)
363370
msg3, err := models.NewOutgoingBroadcastMsg(rt, oa.Org(), channel, cathy, bcastMsg1, time.Date(2021, 11, 9, 14, 3, 30, 0, time.UTC), bcastID)
364371
require.NoError(t, err)
365372

@@ -492,8 +499,8 @@ func TestGetMsgRepetitions(t *testing.T) {
492499
oa := testdata.Org1.Load(rt)
493500
_, cathy := testdata.Cathy.Load(db, oa)
494501

495-
msg1 := flows.NewMsgOut(testdata.Cathy.URN, nil, "foo", nil, nil, nil, flows.NilMsgTopic)
496-
msg2 := flows.NewMsgOut(testdata.Cathy.URN, nil, "bar", nil, nil, nil, flows.NilMsgTopic)
502+
msg1 := flows.NewMsgOut(testdata.Cathy.URN, nil, "foo", nil, nil, nil, flows.NilMsgTopic, flows.NilUnsendableReason)
503+
msg2 := flows.NewMsgOut(testdata.Cathy.URN, nil, "bar", nil, nil, nil, flows.NilMsgTopic, flows.NilUnsendableReason)
497504

498505
assertRepetitions := func(m *flows.MsgOut, expected int) {
499506
count, err := models.GetMsgRepetitions(rp, cathy, m)
@@ -660,12 +667,12 @@ func TestNewOutgoingIVR(t *testing.T) {
660667

661668
createdOn := time.Date(2021, 7, 26, 12, 6, 30, 0, time.UTC)
662669

663-
flowMsg := flows.NewMsgOut(testdata.Cathy.URN, vonage.ChannelReference(), "Hello", []utils.Attachment{"audio/mp3:http://example.com/hi.mp3"}, nil, nil, flows.NilMsgTopic)
670+
flowMsg := flows.NewIVRMsgOut(testdata.Cathy.URN, vonage.ChannelReference(), "Hello", "eng", "http://example.com/hi.mp3")
664671
dbMsg := models.NewOutgoingIVR(rt.Config, testdata.Org1.ID, conn, flowMsg, createdOn)
665672

666673
assert.Equal(t, flowMsg.UUID(), dbMsg.UUID())
667674
assert.Equal(t, "Hello", dbMsg.Text())
668-
assert.Equal(t, []utils.Attachment{"audio/mp3:http://example.com/hi.mp3"}, dbMsg.Attachments())
675+
assert.Equal(t, []utils.Attachment{"audio:http://example.com/hi.mp3"}, dbMsg.Attachments())
669676
assert.Equal(t, createdOn, dbMsg.CreatedOn())
670677
assert.Equal(t, &createdOn, dbMsg.SentOn())
671678

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/lib/pq v1.10.6
1717
github.com/nyaruka/ezconf v0.2.1
1818
github.com/nyaruka/gocommon v1.30.0
19-
github.com/nyaruka/goflow v0.169.0
19+
github.com/nyaruka/goflow v0.170.0
2020
github.com/nyaruka/logrus_sentry v0.8.2-0.20190129182604-c2962b80ba7d
2121
github.com/nyaruka/null v1.2.0
2222
github.com/nyaruka/redisx v0.2.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ github.com/nyaruka/ezconf v0.2.1 h1:TDXWoqjqYya1uhou1mAJZg7rgFYL98EB0Tb3+BWtUh0=
220220
github.com/nyaruka/ezconf v0.2.1/go.mod h1:ey182kYkw2MIi4XiWe1FR/mzI33WCmTWuceDYYxgnQw=
221221
github.com/nyaruka/gocommon v1.30.0 h1:394CU1fxGXSs+mrd5x8nXnqw2epT9P0ui/9MtSE2ycQ=
222222
github.com/nyaruka/gocommon v1.30.0/go.mod h1:PApT/06fP5Tzs4/kbkJ+rVoyOc9Lbqm1lR0ow8Vqzp0=
223-
github.com/nyaruka/goflow v0.169.0 h1:7njRUHK2vBcw0tZbbMQV81r7H6yf6Ycmh/Om/08OBRg=
224-
github.com/nyaruka/goflow v0.169.0/go.mod h1:BELqxxpx4dqpBvaqM2TSXyq3rdJvX4RPlSAyuevjL+4=
223+
github.com/nyaruka/goflow v0.170.0 h1:D3k6EXzvdrxze0Uz1Ze700WY7ByeoxXmAspKz/VBllM=
224+
github.com/nyaruka/goflow v0.170.0/go.mod h1:BELqxxpx4dqpBvaqM2TSXyq3rdJvX4RPlSAyuevjL+4=
225225
github.com/nyaruka/librato v1.0.0 h1:Vznj9WCeC1yZXbBYyYp40KnbmXLbEkjKmHesV/v2SR0=
226226
github.com/nyaruka/librato v1.0.0/go.mod h1:pkRNLFhFurOz0QqBz6/DuTFhHHxAubWxs4Jx+J7yUgg=
227227
github.com/nyaruka/logrus_sentry v0.8.2-0.20190129182604-c2962b80ba7d h1:hyp9u36KIwbTCo2JAJ+TuJcJBc+UZzEig7RI/S5Dvkc=

services/ivr/twiml/service_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/nyaruka/goflow/assets"
1414
"github.com/nyaruka/goflow/flows/events"
1515
"github.com/nyaruka/goflow/flows/routers/waits/hints"
16-
"github.com/nyaruka/goflow/utils"
1716
"github.com/nyaruka/mailroom/services/ivr/twiml"
1817
"github.com/nyaruka/mailroom/testsuite"
1918

@@ -40,7 +39,7 @@ func TestResponseForSprint(t *testing.T) {
4039
}{
4140
{
4241
[]flows.Event{
43-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", nil, nil, nil, flows.NilMsgTopic)),
42+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "", "")),
4443
},
4544
`<Response><Say>hello world</Say><Hangup></Hangup></Response>`,
4645
},
@@ -58,40 +57,40 @@ func TestResponseForSprint(t *testing.T) {
5857
},
5958
{
6059
[]flows.Event{
61-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", []utils.Attachment{utils.Attachment("audio:/recordings/foo.wav")}, nil, nil, flows.NilMsgTopic)),
60+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "eng", "/recordings/foo.wav")),
6261
},
6362
`<Response><Play>https://mailroom.io/recordings/foo.wav</Play><Hangup></Hangup></Response>`,
6463
},
6564
{
6665
[]flows.Event{
67-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", []utils.Attachment{utils.Attachment("audio:https://temba.io/recordings/foo.wav")}, nil, nil, flows.NilMsgTopic)),
66+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "", "https://temba.io/recordings/foo.wav")),
6867
},
6968
`<Response><Play>https://temba.io/recordings/foo.wav</Play><Hangup></Hangup></Response>`,
7069
},
7170
{
7271
[]flows.Event{
73-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", nil, nil, nil, flows.NilMsgTopic)),
74-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "goodbye", nil, nil, nil, flows.NilMsgTopic)),
72+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "", "")),
73+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "goodbye", "", "")),
7574
},
7675
`<Response><Say>hello world</Say><Say>goodbye</Say><Hangup></Hangup></Response>`,
7776
},
7877
{
7978
[]flows.Event{
80-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "enter a number", nil, nil, nil, flows.NilMsgTopic)),
79+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "enter a number", "", "")),
8180
events.NewMsgWait(nil, nil, hints.NewFixedDigitsHint(1)),
8281
},
8382
`<Response><Gather numDigits="1" timeout="30" action="http://temba.io/resume?session=1&amp;wait_type=gather"><Say>enter a number</Say></Gather><Redirect>http://temba.io/resume?session=1&amp;wait_type=gather&amp;timeout=true</Redirect></Response>`,
8483
},
8584
{
8685
[]flows.Event{
87-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "enter a number, then press #", nil, nil, nil, flows.NilMsgTopic)),
86+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "enter a number, then press #", "", "")),
8887
events.NewMsgWait(nil, nil, hints.NewTerminatedDigitsHint("#")),
8988
},
9089
`<Response><Gather finishOnKey="#" timeout="30" action="http://temba.io/resume?session=1&amp;wait_type=gather"><Say>enter a number, then press #</Say></Gather><Redirect>http://temba.io/resume?session=1&amp;wait_type=gather&amp;timeout=true</Redirect></Response>`,
9190
},
9291
{
9392
[]flows.Event{
94-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "say something", nil, nil, nil, flows.NilMsgTopic)),
93+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "say something", "", "")),
9594
events.NewMsgWait(nil, nil, hints.NewAudioHint()),
9695
},
9796
`<Response><Say>say something</Say><Record action="http://temba.io/resume?session=1&amp;wait_type=record" maxLength="600"></Record><Redirect>http://temba.io/resume?session=1&amp;wait_type=record&amp;empty=true</Redirect></Response>`,

services/ivr/vonage/service_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/nyaruka/goflow/flows"
1313
"github.com/nyaruka/goflow/flows/events"
1414
"github.com/nyaruka/goflow/flows/routers/waits/hints"
15-
"github.com/nyaruka/goflow/utils"
1615
"github.com/nyaruka/mailroom/core/models"
1716
"github.com/nyaruka/mailroom/testsuite"
1817
"github.com/nyaruka/mailroom/testsuite/testdata"
@@ -72,46 +71,46 @@ func TestResponseForSprint(t *testing.T) {
7271
}{
7372
{
7473
[]flows.Event{
75-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", nil, nil, nil, flows.NilMsgTopic)),
74+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "", "")),
7675
},
7776
`[{"action":"talk","text":"hello world"}]`,
7877
},
7978
{
8079
[]flows.Event{
81-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", []utils.Attachment{utils.Attachment("audio:/recordings/foo.wav")}, nil, nil, flows.NilMsgTopic)),
80+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "", "/recordings/foo.wav")),
8281
},
8382
`[{"action":"stream","streamUrl":["/recordings/foo.wav"]}]`,
8483
},
8584
{
8685
[]flows.Event{
87-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", []utils.Attachment{utils.Attachment("audio:https://temba.io/recordings/foo.wav")}, nil, nil, flows.NilMsgTopic)),
86+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "", "https://temba.io/recordings/foo.wav")),
8887
},
8988
`[{"action":"stream","streamUrl":["https://temba.io/recordings/foo.wav"]}]`,
9089
},
9190
{
9291
[]flows.Event{
93-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "hello world", nil, nil, nil, flows.NilMsgTopic)),
94-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "goodbye", nil, nil, nil, flows.NilMsgTopic)),
92+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "hello world", "", "")),
93+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "goodbye", "", "")),
9594
},
9695
`[{"action":"talk","text":"hello world"},{"action":"talk","text":"goodbye"}]`,
9796
},
9897
{
9998
[]flows.Event{
100-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "enter a number", nil, nil, nil, flows.NilMsgTopic)),
99+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "enter a number", "", "")),
101100
events.NewMsgWait(nil, nil, hints.NewFixedDigitsHint(1)),
102101
},
103102
`[{"action":"talk","text":"enter a number","bargeIn":true},{"action":"input","maxDigits":1,"submitOnHash":true,"timeOut":30,"eventUrl":["http://temba.io/resume?session=1\u0026wait_type=gather\u0026sig=OjsMUDhaBTUVLq1e6I4cM0SKYpk%3D"],"eventMethod":"POST"}]`,
104103
},
105104
{
106105
[]flows.Event{
107-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "enter a number, then press #", nil, nil, nil, flows.NilMsgTopic)),
106+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "enter a number, then press #", "", "")),
108107
events.NewMsgWait(nil, nil, hints.NewTerminatedDigitsHint("#")),
109108
},
110109
`[{"action":"talk","text":"enter a number, then press #","bargeIn":true},{"action":"input","maxDigits":20,"submitOnHash":true,"timeOut":30,"eventUrl":["http://temba.io/resume?session=1\u0026wait_type=gather\u0026sig=OjsMUDhaBTUVLq1e6I4cM0SKYpk%3D"],"eventMethod":"POST"}]`,
111110
},
112111
{
113112
[]flows.Event{
114-
events.NewIVRCreated(flows.NewMsgOut(urn, channelRef, "say something", nil, nil, nil, flows.NilMsgTopic)),
113+
events.NewIVRCreated(flows.NewIVRMsgOut(urn, channelRef, "say something", "", "")),
115114
events.NewMsgWait(nil, nil, hints.NewAudioHint()),
116115
},
117116
`[{"action":"talk","text":"say something"},{"action":"record","endOnKey":"#","timeOut":600,"endOnSilence":5,"eventUrl":["http://temba.io/resume?session=1\u0026wait_type=recording_url\u0026recording_uuid=f3ede2d6-becc-4ea3-ae5e-88526a9f4a57\u0026sig=Am9z7fXyU3SPCZagkSpddZSi6xY%3D"],"eventMethod":"POST"},{"action":"input","submitOnHash":true,"timeOut":1,"eventUrl":["http://temba.io/resume?session=1\u0026wait_type=record\u0026recording_uuid=f3ede2d6-becc-4ea3-ae5e-88526a9f4a57\u0026sig=fX1RhjcJNN4xYaiojVYakaz5F%2Fk%3D"],"eventMethod":"POST"}]`,

testsuite/testdata/msgs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func insertOutgoingMsg(db *sqlx.DB, org *Org, channel *Channel, contact *Contact
5454
channelID = channel.ID
5555
}
5656

57-
msg := flows.NewMsgOut(contact.URN, channelRef, text, attachments, nil, nil, flows.NilMsgTopic)
57+
msg := flows.NewMsgOut(contact.URN, channelRef, text, attachments, nil, nil, flows.NilMsgTopic, flows.NilUnsendableReason)
5858

5959
var sentOn *time.Time
6060
if status == models.MsgStatusWired || status == models.MsgStatusSent || status == models.MsgStatusDelivered {

0 commit comments

Comments
 (0)