Skip to content
New issue

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

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

Already on GitHub? # to your account

Simpler IVR part 1 #661

Merged
merged 3 commits into from
Sep 19, 2022
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
12 changes: 6 additions & 6 deletions core/handlers/ivr_created.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ func handleIVRCreated(ctx context.Context, rt *runtime.Runtime, tx *sqlx.Tx, oa
"text": event.Msg.Text(),
}).Debug("ivr say")

// get our channel connection
conn := scene.Session().ChannelConnection()
if conn == nil {
return errors.Errorf("ivr session must have a channel connection set")
// get our call
call := scene.Session().Call()
if call == nil {
return errors.Errorf("ivr session must have a call set")
}

// if our call is no longer in progress, return
if conn.Status() != models.ConnectionStatusInProgress {
if call.Status() != models.CallStatusInProgress {
return nil
}

msg := models.NewOutgoingIVR(rt.Config, oa.OrgID(), conn, event.Msg, event.CreatedOn())
msg := models.NewOutgoingIVR(rt.Config, oa.OrgID(), call, event.Msg, event.CreatedOn())

// register to have this message committed
scene.AppendToEventPreCommitHook(hooks.CommitIVRHook, msg)
Expand Down
114 changes: 57 additions & 57 deletions core/ivr/ivr.go

Large diffs are not rendered by default.

Loading