diff --git a/lib/call_attempt_repo.rb b/lib/call_attempt_repo.rb index 0c9b268ee8aeba8341cde3a09a7cd1329b260a7a..0aed365720435be88ee27c72bd4b911fbcd1b3fd 100644 --- a/lib/call_attempt_repo.rb +++ b/lib/call_attempt_repo.rb @@ -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 diff --git a/test/test_web.rb b/test/test_web.rb index 97bdada96654f473c9e4d61d8fa98035a9856cf0..0f34bdab14cf5e4c260eb3367c6dbecb0c66a671 100644 --- a/test/test_web.rb +++ b/test/test_web.rb @@ -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( + "" \ + "The number you have dialled is not " \ + "supported on your account.", + last_response.body + ) + end + em :test_outbound_unsupported_short_numbers_911 + def test_outbound_atlimit post( "/outbound/calls",