Skip to content

Commit

Permalink
Fix command to be a server command
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Mar 22, 2024
1 parent 855e353 commit 15179f9
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 211 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ vendor/ruby
coverage

.idea
.vscode

# terraform
terraform.tfstate.d/
Expand All @@ -22,5 +23,3 @@ examples.txt

node_modules
nohup.out
.vscode
components/freeswitch/src/mod/mod_twilio_stream/.vscode
1 change: 0 additions & 1 deletion components/app/app/workflows/execute_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ def call
def create_audio_stream(**params)
call_platform_client.create_audio_stream(phone_call_id: call_properties.call_sid, **params)
end

end
3 changes: 3 additions & 0 deletions components/app/lib/rayo/command/twilio_stream/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class Base < Adhearsion::Rayo::Command::Execute
attribute :uuid
attribute :metadata

def domain; end
def target_call_id; end

private

def api
Expand Down
18 changes: 16 additions & 2 deletions components/app/spec/lib/rayo/command/twilio_stream/start_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,26 @@ def parse_stanza(xml)
Nokogiri::XML.parse(xml, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS)
end

it "is a server command" do
command = Start.new
command.domain = "mydomain"
command.target_call_id = SecureRandom.uuid

expect(command).to have_attributes(
domain: nil,
target_call_id: nil
)
end

describe "#to_xml" do
it "serializes to Rayo XML" do
metadata = {
call_sid: "call-sid",
account_sid: "account-sid",
stream_sid: "stream-sid"
stream_sid: "stream-sid",
custom_parameters: {
foo: "bar"
}
}.to_json

command = Start.new(
Expand All @@ -26,7 +40,7 @@ def parse_stanza(xml)

expect(xml.fetch("exec")).to include(
"api" => "uuid_twilio_stream",
"args" => "call-id start wss://mystream.ngrok.io/audiostream #{metadata}"
"args" => "call-id start wss://mystream.ngrok.io/audiostream #{Base64.strict_encode64(metadata)}"
)
end
end
Expand Down
3 changes: 1 addition & 2 deletions components/freeswitch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ RUN apt-get update && apt-get install --no-install-recommends -yq gnupg2 wget ca
apt-get -y install --no-install-recommends libfreeswitch-dev

COPY src/mod/mod_twilio_stream /usr/src/mod_twilio_stream
RUN rm -rf /usr/src/mod_twilio_stream/libs && mkdir /usr/src/mod_twilio_stream/libs
WORKDIR /usr/src/mod_twilio_stream/libs
RUN git clone https://github.com/DNedic/lockfree.git
RUN mkdir /usr/src/mod_twilio_stream/build
RUN mkdir -p /usr/src/mod_twilio_stream/build
WORKDIR /usr/src/mod_twilio_stream/build
RUN cmake ..
RUN make
Expand Down
8 changes: 0 additions & 8 deletions components/freeswitch/src/mod/mod_twilio_stream/LICENSE

This file was deleted.

187 changes: 0 additions & 187 deletions components/freeswitch/src/mod/mod_twilio_stream/README.md

This file was deleted.

Empty file.
Submodule lockfree deleted from bc6aff
19 changes: 11 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ services:
- "host.docker.internal:host-gateway"
environment:
FS_ALTERNATIVE_RTP_IP: "18.141.245.230"
FS_EVENT_SOCKET_PASSWORD: secret
FS_EVENT_SOCKET_PORT: secret

expose:
- "5060/udp"
- "5222/tcp"
Expand All @@ -107,6 +110,14 @@ services:
timeout: 5s
retries: 10

freeswitch_event_logger:
build:
context: components/freeswitch_event_logger
image: freeswitch_event_logger:latest
environment:
EVENT_SOCKET_HOST: freeswitch:8021
EVENT_SOCKET_PASSWORD: secret

switch-app:
build:
context: components/app
Expand Down Expand Up @@ -146,11 +157,3 @@ services:
volumes:
- workspace:/workspace
- opensips_fifo:/opensips/fifo

freeswitch_event_logger:
build:
context: components/freeswitch_event_logger
image: freeswitch_event_logger:latest
environment:
EVENT_SOCKET_HOST: freeswitch:8021
EVENT_SOCKET_PASSWORD: secret

0 comments on commit 15179f9

Please sign in to comment.