@@ -59,7 +59,10 @@ protected
find_all(customer, other_tel, direction).then do |(rate, usage, tl, c)|
CallAttempt.for(
customer: customer, rate: rate, usage: usage,
- supported: rate && tl.support_call?(rate, c || 0),
+ supported:
+ rate &&
+ tl.support_call?(rate, c || 0) &&
+ other_tel !~ /\A\+?1?[94]11/,
direction: direction, **kwargs
)
end
@@ -110,6 +110,7 @@ class WebTest < Minitest::Test
redis: FakeRedis.new,
db: FakeDB.new(
["test_usd", "+15557654321", :outbound] => [{ "rate" => 0.01 }],
+ ["test_usd", "+1911", :outbound] => [{ "rate" => 0.01 }],
["test_usd", "+15557654321", :inbound] => [{ "rate" => 0.01 }],
["test_usd", "+14445556666", :inbound] => [{ "rate" => 0.01 }],
["test_usd", "+18001234567", :outbound] => [{ "rate" => 0.00 }],
@@ -272,6 +273,27 @@ class WebTest < Minitest::Test
end
em :test_outbound_unsupported
+ def test_outbound_unsupported_short_numbers_911
+ post(
+ "/outbound/calls",
+ {
+ from: "ccustomerid",
+ to: "+1911",
+ callId: "acall"
+ }.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 " \
+ "supported on your account.</SpeakSentence></Response>",
+ last_response.body
+ )
+ end
+ em :test_outbound_unsupported_short_numbers_911
+
def test_outbound_atlimit
post(
"/outbound/calls",