Skip to content

Commit

Permalink
Add test for Twilio AMD hangup
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Aug 16, 2021
1 parent 7b2edc9 commit 27fdbae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/ivr/ivr.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ func ResumeIVRFlow(
logrus.WithError(err).Error("error interrupting session")
}

return client.WriteErrorResponse(w, fmt.Errorf("call ended due to previous status callback"))
return client.WriteErrorResponse(w, fmt.Errorf("ending call due to previous status callback"))
}

// preprocess this request
Expand Down
11 changes: 11 additions & 0 deletions web/ivr/ivr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ func TestTwilioIVR(t *testing.T) {
expectedStatus: 200,
contains: []string{"<Response><!--status updated: E next_attempt:"},
},
{
label: "subsequent resume which should see we are now errored and hangup",
url: fmt.Sprintf("/ivr/c/%s/handle?action=resume&connection=3", testdata.TwilioChannel.UUID),
form: url.Values{
"CallStatus": []string{"completed"},
"wait_type": []string{"gather"},
"Digits": []string{"56"},
},
expectedStatus: 200,
expectedResponse: `<Response><!--ending call due to previous status callback--><Say>An error has occurred, please try again later.</Say><Hangup></Hangup></Response>`,
},
}

for i, tc := range tcs {
Expand Down

0 comments on commit 27fdbae

Please sign in to comment.