Skip to content

Commit

Permalink
Patch mod_rayo to fix idle timeout for connect verb
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Jan 24, 2025
1 parent 9d3425c commit f1f3aab
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 3 deletions.
6 changes: 6 additions & 0 deletions components/app/app/workflows/execute_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions components/app/lib/rayo/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ module Command
end

require_relative "command/twilio_stream"
require_relative "command/update_call_progress"
21 changes: 21 additions & 0 deletions components/app/lib/rayo/command/update_call_progress.rb
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions components/app/spec/lib/rayo/command/update_call_progress_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</mappings>
<settings>
<param name="colorize" value="false"/>
<param name="loglevel" value="info"/>
<param name="loglevel" value="debug"/>
</settings>
</configuration>
2 changes: 1 addition & 1 deletion components/freeswitch/conf/autoload_configs/rayo.conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<configuration name="rayo.conf" description="Rayo server config">
<settings>
<param name="max-idle-sec" value="300"/>
<param name="max-idle-sec" value="5"/>
<param name="add-variables-to-events" value="true"/>
</settings>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<configuration name="switch.conf" description="Core Configuration">
<settings>
<param name="colorize-console" value="false"/>
<param name="loglevel" value="info"/>
<param name="loglevel" value="debug"/>

<param name="max-sessions" value="150"/>
<param name="sessions-per-second" value="1000"/>
Expand Down

0 comments on commit f1f3aab

Please sign in to comment.