Class: WebhookProcessors::SwitchvoxProcessor
- Inherits:
-
Object
- Object
- WebhookProcessors::SwitchvoxProcessor
- Defined in:
- app/services/webhook_processors/switchvox_processor.rb
Overview
Processes Switchvox PBX webhook callbacks (Event Triggers).
Currently supports:
- new_voicemail: Stores voicemail metadata, can correlate with email-delivered audio
- incoming_call: Future - screen pop, CRM lookup
- call_hangup: Future - call analytics
The primary voicemail audio retrieval is via email (VoicemailsMailbox),
but this webhook provides:
- Faster notification than email
- Additional metadata not in email (queue info, extension details)
- Fallback if email delivery fails
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(webhook_log) ⇒ SwitchvoxProcessor
constructor
A new instance of SwitchvoxProcessor.
Constructor Details
#initialize(webhook_log) ⇒ SwitchvoxProcessor
Returns a new instance of SwitchvoxProcessor.
25 26 27 28 |
# File 'app/services/webhook_processors/switchvox_processor.rb', line 25 def initialize(webhook_log) @webhook_log = webhook_log @data = webhook_log.data.with_indifferent_access end |
Class Method Details
.call(webhook_log) ⇒ Object
21 22 23 |
# File 'app/services/webhook_processors/switchvox_processor.rb', line 21 def self.call(webhook_log) new(webhook_log).call end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/services/webhook_processors/switchvox_processor.rb', line 30 def call case @webhook_log.category when 'new_voicemail' process_new_voicemail when 'checked_voicemail' process_checked_voicemail when 'incoming_call' process_incoming_call when 'route_to_extension' process_route_to_extension when 'call_answered' process_call_answered when 'call_hangup' process_call_hangup when 'outgoing_call' process_outgoing_call when 'agent_login', 'agent_logout' process_agent_status_change else Rails.logger.info "[SwitchvoxProcessor] Unhandled category: #{@webhook_log.category}" { status: 'logged', category: @webhook_log.category } end end |