Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Mar 27, 2024
1 parent bd02905 commit a844b3e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 29 deletions.
6 changes: 4 additions & 2 deletions components/app/app/workflows/execute_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ def call

url = verb.stream_noun.url
custom_parameters = verb.stream_noun.parameters
response = create_media_stream(url:, custom_parameters:)
response = create_media_stream(url:, custom_parameters:, tracks: :inbound)

execute_command(url:, custom_parameters:, stream_sid: response.id)
end

private

def create_media_stream(**params)
call_platform_client.create_media_stream(phone_call_id: call_properties.call_sid, **params)
call_platform_client.create_media_stream(
phone_call_id: call_properties.call_sid, **params
)
end

def execute_command(stream_sid:, **)
Expand Down
2 changes: 1 addition & 1 deletion components/app/spec/call_controllers/connect_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
expect(command.metadata).to include(
call_sid: controller.call_properties.call_sid,
account_sid: controller.call_properties.account_sid,
stream_sid: "143fb02b-f0ce-4258-b957-ebdd60a2945d" # From VCR Cassette
stream_sid: "0edc29ef-e45f-408a-89f2-3266ce3352b6" # From VCR Cassette
)
end
expect(controller).to have_received(:play_audio).with("http://api.twilio.com/cowbell.mp3")
Expand Down
53 changes: 27 additions & 26 deletions components/app/spec/fixtures/vcr_cassettes/media_stream.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/app/spec/workflows/execute_connect_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
expect(call_platform_client).to have_received(:create_media_stream).with(
url: "wss://example.com/audio",
phone_call_id: "call-sid",
tracks: :inbound,
custom_parameters: {
"foo" => "bar",
"bar" => "baz"
Expand Down

0 comments on commit a844b3e

Please sign in to comment.