Skip to content

Add voice functionality #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions app/controllers/call_events_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# app/controllers/call_events_controller.rb
class CallEventsController < ApplicationController
# We disable CSRF for this webhook call
skip_before_action :verify_authenticity_token

def create
if params[:uuid]
Call.where(uuid: params[:uuid])
.first_or_create
.update(
status: params[:status],
conversation_uuid: params[:conversation_uuid]
)
end

head :ok
end
end
26 changes: 26 additions & 0 deletions app/controllers/inbound_calls_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# app/controllers/inbound_calls_controller.rb
class InboundCallsController < ApplicationController
# We disable CSRF for this webhook call
skip_before_action :verify_authenticity_token

def create
Call.where(conversation_uuid: params[:conversation_uuid])
.first_or_create
.update(
to: params[:to],
from: params[:from],
uuid: params[:uuid],
conversation_uuid: params[:conversation_uuid],
is_inbound: true

)

render json: [
{
action: 'talk',

Check failure on line 20 in app/controllers/inbound_calls_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
voiceName: 'Jennifer',

Check failure on line 21 in app/controllers/inbound_calls_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
text: 'Hello, thank you for calling. This is Jennifer from Vonage. Ciao.'

Check failure on line 22 in app/controllers/inbound_calls_controller.rb

View workflow job for this annotation

GitHub Actions / lint

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
}
]
end
end
2 changes: 2 additions & 0 deletions app/helpers/call_events_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module CallEventsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/inbound_calls_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module InboundCallsHelper
end
2 changes: 0 additions & 2 deletions app/views/inbound_sms/create.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/sms_message_status/create.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2lcax3RF4GiKVDTOz34V7q8g1LVIHIVnB/iJJ22nCdQ5ufXCkObPpmoeRjwuS2gjf/AXSCGI2jJBIsRevsrhinIr+Cxv3IIuDAzpJ9ccFefHCwh7/xivb5vkR9M9B7uBTJDZEUua/Klsta3gdWuMhDmFWS2vVnaYQagsc22AZ7SuCBMBL613PwU3ayHl7kru1Ul0vKKVFmnkMXWWtnDkQjmjNjU8r76qqbKnj8qXlqQYgTlXASAlEtO+NofgRvkCBJ4epSdxZ1QZpYB5xkdTovi6/SOYJJHRXPUJLkJNWCqwMBxQnKYZpdZ+T/Zi/hyiwsxawI+vMOO3lRYR+qCs3NcF49GNOyiy7nL2OBDO1e1R6jNal0t6c5rimcEpRoV1DB7rbbPjWIx30ZGXyRy5ksfcBthuQx9x6PzayWU1lMdN/msh2eKskBBNxOg3WchHfwrxs8Pmb7LWEeeb+xu4eC9vU8Q7Of4HQ6DwS0SmaajQnuWCSGc6EOy1--om7fEulVdYgAjk2F--HvQtviBJk3FU1Ozc4qbONQ==
ZpVxnnWvtlkJqhBwrWVi8PMvzvT7/BY+yQh9VJJo6ysrgYmcWuyI3UPKrbCy6sfxCBtdgO7IKFrkTxRpyHedR0i4MDwGgUFJTK8ez6iXtoM4dBnf23usoFvAEuogM1+AAeyqBMAJUdtghY08u8/r5UtNmxgtapJp+Oc3DIiPnYtgvgJ2xFwInuk/VZqFnrHyQOKfqzJ7DGCsPJOuWJqauf6a9BJx67k6hrxzDRze2ybySL1rn/gkfpltkCIPYjebMriDZBi8Wa8Em1/LwvzO9JwadFaPwagrK3d3TCMKsyWsiup8gGOLxABpsTmzLvw2zzeRBEo5SxKiVCabRgBdHrGfTNiFOKjWNzBmLZXT9eJ03Wnakbe3z40h8Y/jDyIJ3PEGOzdQOlG7YtH6JNqyWvfa8AUOgjW8P90uRJr7RwkAC+UgFCgWnuih0JEyRRCybkHOHwu1/dmE2z65GADRbzUyAQfOygR8KCEAk1UW0s3V3TeLOA72amiY--oHceahh7YS8vvw8m--Vfr3zSnGh6xNf+gYox+lzw==
6 changes: 6 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@

# For OutboundCall controller, new & create & show
resources :outbound_calls, only: [:new, :create, :show]

# For CallEvents controller, create
resources :call_events, only: [:create]

# For InboundCalls controller, create
resources :inbound_calls, only: [:create]
end
8 changes: 8 additions & 0 deletions test/controllers/call_events_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "test_helper"

class CallEventsControllerTest < ActionDispatch::IntegrationTest
test "should get create" do
get call_events_create_url
assert_response :success
end
end
8 changes: 8 additions & 0 deletions test/controllers/inbound_calls_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "test_helper"

class InboundCallsControllerTest < ActionDispatch::IntegrationTest
test "should get create" do
get inbound_calls_create_url
assert_response :success
end
end
Loading