-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate routes & controllers for messages and calls
- Loading branch information
1 parent
da51f07
commit fff945d
Showing
7 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Stealth | ||
class CallController < ApplicationController | ||
# skip the default Rails CSRF protection for webhook calls... | ||
skip_before_action :verify_authenticity_token, only: [:call_handler] | ||
|
||
def call_handler | ||
service = params[:service] | ||
|
||
case service | ||
when 'bandwidth' | ||
handle_bandwidth(request) | ||
# else | ||
# WIP will add more services here... | ||
end | ||
end | ||
|
||
private | ||
|
||
def handle_bandwidth(request) | ||
event = Stealth::Services::Bandwidth::CallEventHandler.determine_event_type(request) | ||
|
||
case event[:type] | ||
when :call_received | ||
Stealth.trigger_event(:phone_call, :call_receive, event[:service_call]) | ||
# when :text_message_unsubscribe | ||
end | ||
|
||
head :no_content | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Stealth | ||
class ServiceCall | ||
|
||
attr_accessor :call_id, :call_url, :sender_id, :target_id, :timestamp, | ||
:service, :direction, :service_event_type | ||
|
||
def initialize(service:) | ||
@service = service | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters