Change summary
lib/call_attempt.rb | 4 +++-
lib/call_attempt_repo.rb | 4 ++--
lib/trust_level.rb | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
Detailed changes
@@ -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
@@ -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
@@ -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?(*)