View Source SMPPEX.ESME (smppex v3.2.1)

This is a module for launching an SMPPEX.Session implementation as an ESME.

To start an ESME one generally should do the following.

  1. Implement an SMPPEX.Session behaviour.

defmodule MyESMESession do
  use SMPPEX.Session

  # ...Callback implementation

end
  1. Launch it.

{:ok, esme_session} = SMPPEX.ESME.start_link("127.0.0.1",
                                             2775,
                                             {MyESMESession, some_args})

Link to this section 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.

Link to this section Functions

Link to this function

start_link(host, port, mod_with_args, opts \\ [])

View Source
@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 to SMPPEX.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:
    • :timer_resolution is interval of internal ticks on which time related events happen, like checking timeouts for pdus, checking SMPP timers, etc. The default is 100 ms;
    • :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.
    • :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 whole opts argument may also be ommited in order to start ESME with the defaults. The returned value is either {:ok, pid} or {:error, reason}.