diff --git a/lib/call_attempt.rb b/lib/call_attempt.rb index 7d7d6f08cc4ecdc3ae80d13097892440e40a6ebc..bfe9fdd10ff19b94b4120ae894903cfd900244bf 100644 --- a/lib/call_attempt.rb +++ b/lib/call_attempt.rb @@ -46,6 +46,7 @@ class CallAttempt direction Either(:inbound, :outbound) limit_remaining Integer max_minutes Integer + anyroute Bool() end def to_render @@ -250,10 +251,11 @@ class CallAttempt end end - register do |customer:, **kwargs| + register do |customer:, supported:, **kwargs| new( **kwargs .merge(customer_id: customer.customer_id, sgx: customer.sgx) + .merge(anyroute: supported == :anyroute) .slice(*value_semantics.attributes.map(&:name)) ) end diff --git a/lib/call_attempt_repo.rb b/lib/call_attempt_repo.rb index a6f0ebc8f4188b55f919db1f7c314d4b61405688..aec1d69f811e7b22463c2aafe3e250a089de926e 100644 --- a/lib/call_attempt_repo.rb +++ b/lib/call_attempt_repo.rb @@ -64,8 +64,8 @@ protected customer: customer, rate: rate, usage: usage, supported: rate && - tl.support_call?(rate, c || 0) && - other_tel !~ /\A\+?1?[94]11\Z/, + other_tel !~ /\A\+?1?[94]11\Z/ && + tl.support_call?(rate, c || 0), direction: direction, **kwargs ) end diff --git a/lib/trust_level.rb b/lib/trust_level.rb index e17e9af7ac1655888b3ff1692c22fd820b3925fb..2db2c6538df503d1b90c23a89c23e92b179fcf0b 100644 --- a/lib/trust_level.rb +++ b/lib/trust_level.rb @@ -133,7 +133,7 @@ module TrustLevel end def support_call?(_, concurrency) - concurrency < 10 + concurrency < 10 ? :anyroute : false end def send_message?(messages_today) @@ -187,7 +187,7 @@ module TrustLevel end def support_call?(*) - true + :anyroute end def send_message?(*)