Module: Phone::Bpo
- Defined in:
- app/services/phone/bpo.rb
Overview
Shared identification of BPO (outsourced 24/7 answering service) calls.
Calls transferred to the BPO cascade from Switchvox account 1216
("BPO American"), extension 602 ("BPO 24x7"), out to the BPO's PSTN number
over the Twilio trunk. Both the Twilio recording importer and the BPO call
recording linker key off this single definition.
Usage:
Phone::Bpo.bpo_call_logs.where(start_time: 1.day.ago..)
Phone::Bpo.bpo_number?('+1 (864) 208-2683') # => true
Constant Summary collapse
- ACCOUNT_ID =
Switchvox "BPO American" (also used in Report::TechCallsReport)
1216- EXTENSION =
"BPO 24x7" (also Report::CallRecordingGaps::NON_RECORDED_EXTENSIONS)
602- NUMBERS =
cascade target seen in CDRs/Twilio
['+18642082683'].freeze
Class Method Summary collapse
-
.bpo_call_logs(scope = CallLog.all) ⇒ Object
CallLogs handed to the BPO (to_account_id 1216 <=> to_ext 602 — same rows).
-
.bpo_number?(number) ⇒ Boolean
Loose number compare — normalized to the last 10 digits.
-
.normalize(number) ⇒ Object
Digits only, last 10 (strips country code, punctuation, SIP noise).
Class Method Details
.bpo_call_logs(scope = CallLog.all) ⇒ Object
CallLogs handed to the BPO (to_account_id 1216 <=> to_ext 602 — same rows).
20 21 22 |
# File 'app/services/phone/bpo.rb', line 20 def self.bpo_call_logs(scope = CallLog.all) scope.where(to_account_id: ACCOUNT_ID) end |
.bpo_number?(number) ⇒ Boolean
Loose number compare — normalized to the last 10 digits.
25 26 27 28 |
# File 'app/services/phone/bpo.rb', line 25 def self.bpo_number?(number) normalized = normalize(number) normalized.present? && NUMBERS.any? { |n| normalize(n) == normalized } end |
.normalize(number) ⇒ Object
Digits only, last 10 (strips country code, punctuation, SIP noise).
31 32 33 |
# File 'app/services/phone/bpo.rb', line 31 def self.normalize(number) number.to_s.gsub(/\D/, '').last(10).presence end |