Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove legacy functionality to look for missed call trigger if there's no incoming call trigger #682

Merged
merged 1 commit into from
Oct 24, 2022
Merged
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
18 changes: 1 addition & 17 deletions web/ivr/ivr.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"time"

"github.com/go-chi/chi"
"github.com/nyaruka/gocommon/httpx"
"github.com/nyaruka/gocommon/jsonx"
"github.com/nyaruka/gocommon/urns"
Expand All @@ -17,8 +18,6 @@ import (
"github.com/nyaruka/mailroom/core/tasks/handler"
"github.com/nyaruka/mailroom/runtime"
"github.com/nyaruka/mailroom/web"

"github.com/go-chi/chi"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -159,21 +158,6 @@ func handleIncoming(ctx context.Context, rt *runtime.Runtime, oa *models.OrgAsse
return call, nil
}

// no session means no trigger, create a missed call event instead
// we first create an incoming call channel event and see if that matches
event = models.NewChannelEvent(models.MOMissEventType, oa.OrgID(), ch.ID(), contact.ID(), urnID, nil, false)
err = event.Insert(ctx, rt.DB)
if err != nil {
return call, svc.WriteErrorResponse(w, errors.Wrapf(err, "error inserting channel event"))
}

// try to handle it, this time looking for a missed call event
_, err = handler.HandleChannelEvent(ctx, rt, models.MOMissEventType, event, nil)
if err != nil {
logrus.WithError(err).WithField("http_request", r).Error("error handling missed call")
return call, svc.WriteErrorResponse(w, errors.Wrapf(err, "error handling missed call"))
}

// write our empty response
return call, svc.WriteEmptyResponse(w, "missed call handled")
}
Expand Down