Change summary
lib/cdr.rb | 4 ++--
test/test_cdr.rb | 1 +
web.rb | 4 +++-
3 files changed, 6 insertions(+), 3 deletions(-)
Detailed changes
@@ -71,10 +71,10 @@ class CDR
)
end
- def self.for_outbound(event)
+ def self.for_outbound(customer_id, event)
self.for(
event,
- customer_id: event["from"].sub(/^\+/, ""),
+ customer_id: customer_id,
tel: event["to"],
direction: :outbound
)
@@ -24,6 +24,7 @@ class CDRTest < Minitest::Test
def test_for_outbound
cdr = CDR.for_outbound(
+ "test",
"to" => "+15551234567",
"from" => "+test",
"startTime" => "2020-01-01T00:00:00Z",
@@ -385,7 +385,9 @@ class Web < Roda
customer_id = params["from"].sub(/^(?:\+|c)/, "")
customer_id = from.sub(/^1/, "") if customer_id.length > 10
call_attempt_repo.ending_call(customer_id, params["callId"])
- cdr_repo.put(CDR.for_outbound(params)).catch(&method(:log_error))
+ cdr_repo
+ .put(CDR.for_outbound(customer_id, params))
+ .catch(&method(:log_error))
end
"OK"
end