Packages

An Elixir protocol for the FreeSWITCH's Event Socket, providing support for outbound method.

Retired package: Release invalid - not compile correctly

Current section

Files

Jump to
event_socket_outbound lib event_socket_outbound.ex
Raw

lib/event_socket_outbound.ex

defmodule EventSocketOutbound do
@moduledoc """
A wrapper to start a TCP listener suitable for FreeSWITCH event socket outbound.
"""
@doc """
Start a TCP listener which implements a protocol handler for FreeSwitch events and commands
"""
def start(opts \\ []) do
port = Keyword.get(opts, :port, 8084)
acceptors = Keyword.get(opts, :acceptors, 10)
ref = Keyword.get(opts, :ref, make_ref())
:ranch.start_listener(
ref,
:ranch_tcp,
%{num_acceptors: acceptors, socket_opts: [{:port, port}]},
EventSocketOutbound.Protocol,
:ranch
)
end
end