Change summary
test/test_web.rb | 23 +++++++++++++++++++++++
views/inbound/no_customer.slim | 3 +++
web.rb | 2 ++
3 files changed, 28 insertions(+)
Detailed changes
@@ -558,4 +558,27 @@ class WebTest < Minitest::Test
assert_mock Customer::BLATHER
end
em :test_voicemail_short
+
+ def test_voicemail_no_customer
+ post(
+ "/inbound/calls/CALLID/voicemail",
+ {
+ "startTime" => "2021-01-01T00:00:00Z",
+ "endTime" => "2021-01-01T00:00:06Z",
+ "mediaUrl" => "https://voice.bandwidth.com/api/v2/accounts/1/media",
+ "to" => "+15551230000",
+ "from" => "+15557654321"
+ }.to_json,
+ { "CONTENT_TYPE" => "application/json" }
+ )
+
+ assert last_response.ok?
+ assert_equal(
+ "<?xml version=\"1.0\" encoding=\"utf-8\" ?><Response>" \
+ "<SpeakSentence>The number you have dialled is not in service." \
+ "</SpeakSentence></Response>",
+ last_response.body
+ )
+ end
+ em :test_voicemail_no_customer
end
@@ -0,0 +1,3 @@
+doctype xml
+Response
+ SpeakSentence The number you have dialled is not in service.
@@ -301,6 +301,8 @@ class Web < Roda
next render :hangup unless ogm
render :voicemail, locals: { ogm: ogm }
+ }.catch_only(CustomerRepo::NotFound) {
+ render "inbound/no_customer"
}
end
end