View Source SMPPEX.ESME (smppex v3.2.3)
This is a module for launching an SMPPEX.Session
implementation as an ESME.
To start an ESME one generally should do the following.
- Implement an
SMPPEX.Session
behaviour.
defmodule MyESMESession do
use SMPPEX.Session
# ...Callback implementation
end
- Launch it.
{:ok, esme_session} = SMPPEX.ESME.start_link("127.0.0.1",
2775,
{MyESMESession, some_args})
Summary
Functions
Starts an SMPPEX.Session
implementation as an ESME entitiy,
i.e. makes a transport connection to host
:port
and starts an SMPPEX.Session
to handle the connection with the passed module.
Functions
@spec start_link( host :: term(), port :: non_neg_integer(), {module(), args :: term()}, opts :: Keyword.t() ) :: GenServer.on_start()
Starts an SMPPEX.Session
implementation as an ESME entitiy,
i.e. makes a transport connection to host
:port
and starts an SMPPEX.Session
to handle the connection with the passed module.
The function does not return until ESME successfully connects to the specified
host
and port
and initializes or fails.
module
is the callback module which should implement SMPPEX.ESME
behaviour.
args
is the argument passed to the init
callback.
opts
is a keyword list of different options:
:transport
is Ranch transport used for TCP connection: either:ranch_tcp
(the default) or:ranch_ssl
;:session_module
is a module to use as an alternative toSMPPEX.Session
for handling sessions (if needed). For example,SMPPEX.TelemetrySession
.:timeout
is timeout for transport connect. The default is 5000 ms;:esme_opts
is a keyword list of ESME options::enquire_link_limit
is value for enquire_link SMPP timer, i.e. the interval of SMPP session inactivity after which enquire_link PDU is send to "ping" the connetion. The default value is 30000 ms;:enquire_link_resp_limit
is the maximum time for which ESME waits for enquire_link PDU response. If the response is not received within this interval of time and no activity from the peer occurs, the session is then considered dead and the ESME stops. The default value is 30000 ms;:inactivity_limit
is the maximum time for which the peer is allowed not to send PDUs (which are not response PDUs). If no such PDUs are received within this interval of time, ESME stops. The default is :infinity ms;:response_limit
is the maximum time to wait for a response for a previously sent PDU. If the response is not received within this interval,handle_resp_timeout
callback is triggered for the original pdu. If the response is received later, it is discarded. The default value is 60000 ms.:response_limit_resolution
is the maximum time after reachingresponse_limit
for which a PDU without a response is not collected. Setting to0
will make PDUs without responses to be collected immediately afterresponse_limit
ms. Setting to greater values improve performance since such PDUs are collected in batches. The default value is 100 ms.:session_init_limit
is the maximum time for the session to be unbound. If no bind request succeed within this interval of time, the session stops. The default value is 10000 ms;
:socket_opts
is a keyword list of ranch socket options, see ranch's options for more information If:esme_opts
list of options is ommited, all options take their default values. The wholeopts
argument may also be ommited in order to start ESME with the defaults. The returned value is either{:ok, pid}
or{:error, reason}
.