diff --git a/components/app/app/workflows/execute_connect.rb b/components/app/app/workflows/execute_connect.rb index f02720553..7fe3d3b07 100644 --- a/components/app/app/workflows/execute_connect.rb +++ b/components/app/app/workflows/execute_connect.rb @@ -78,11 +78,17 @@ def start_stream!(url:, stream_sid:, custom_parameters:) } ) ) + context.write_and_await_response( + Rayo::Command::UpdateCallProgress.new(status: :in_progress) + ) end def stop_stream! context.write_and_await_response( Rayo::Command::TwilioStream::Stop.new(uuid: phone_call.id) ) + context.write_and_await_response( + Rayo::Command::UpdateCallProgress.new(status: :stopped) + ) end end diff --git a/components/app/lib/rayo/command.rb b/components/app/lib/rayo/command.rb index 6e7bcba0b..03fe82fe0 100644 --- a/components/app/lib/rayo/command.rb +++ b/components/app/lib/rayo/command.rb @@ -4,3 +4,4 @@ module Command end require_relative "command/twilio_stream" +require_relative "command/update_call_progress" diff --git a/components/app/lib/rayo/command/update_call_progress.rb b/components/app/lib/rayo/command/update_call_progress.rb new file mode 100644 index 000000000..59960cc96 --- /dev/null +++ b/components/app/lib/rayo/command/update_call_progress.rb @@ -0,0 +1,21 @@ +require "adhearsion/rayo/command_node" + +module Rayo + module Command + class UpdateCallProgress < Adhearsion::Rayo::CommandNode + register :call_progress, :core + + attribute :status + + def rayo_attributes + { "flag" => flag } + end + + private + + def flag + status == :in_progress ? 1 : 0 + end + end + end +end diff --git a/components/app/spec/lib/rayo/command/update_call_progress_spec.rb b/components/app/spec/lib/rayo/command/update_call_progress_spec.rb new file mode 100644 index 000000000..27fc208a9 --- /dev/null +++ b/components/app/spec/lib/rayo/command/update_call_progress_spec.rb @@ -0,0 +1,17 @@ +require "spec_helper" + +module Rayo + module Command + RSpec.describe UpdateCallProgress do + describe "#to_xml" do + it "serializes to Rayo XML" do + xml = Hash.from_xml(UpdateCallProgress.new(status: :in_progress).to_xml) + expect(xml.fetch("call_progress")).to include("flag" => "1") + + xml = Hash.from_xml(UpdateCallProgress.new(status: :stopped).to_xml) + expect(xml.fetch("call_progress")).to include("flag" => "0") + end + end + end + end +end diff --git a/components/freeswitch/conf/autoload_configs/console.conf.xml b/components/freeswitch/conf/autoload_configs/console.conf.xml index 1fdb30868..29d52e7d7 100644 --- a/components/freeswitch/conf/autoload_configs/console.conf.xml +++ b/components/freeswitch/conf/autoload_configs/console.conf.xml @@ -6,6 +6,6 @@ - + diff --git a/components/freeswitch/conf/autoload_configs/rayo.conf.xml b/components/freeswitch/conf/autoload_configs/rayo.conf.xml index fca3084d0..4295acf2e 100644 --- a/components/freeswitch/conf/autoload_configs/rayo.conf.xml +++ b/components/freeswitch/conf/autoload_configs/rayo.conf.xml @@ -2,7 +2,7 @@ - + diff --git a/components/freeswitch/conf/autoload_configs/switch.conf.xml b/components/freeswitch/conf/autoload_configs/switch.conf.xml index f8dfec391..082c22ea8 100644 --- a/components/freeswitch/conf/autoload_configs/switch.conf.xml +++ b/components/freeswitch/conf/autoload_configs/switch.conf.xml @@ -3,7 +3,7 @@ - +