esmpp connects erlang applications to SMSCs via the SMPP v3.4 protocol.
- bind_transmitter
- bind_receiver
- bind_transceiver
- submit_sm
- deliver_sm
- enquire_link
Other commands will be supported in the future versions.
Required: OTP 18 and later
esmpp can be added as a dependency via hex.pm
{deps, [
{esmpp, "0.0.13"}
]}.
Then include esmpp in your application's .app.src
file
{applications, [
kernel,
stdlib,
esmpp
]}.
Simply call esmpp:start_link/1
with the following options as map:
name
- If provided, the internalgen_server
will be registered with this name. seegen_server:start_link/4
mode
- Type of SMPP binding for the client.transmitter
,transceiver
, orreceiver
host
- Hostname or IP address of the SMPP serverport
- Port of the SMPP serversystem_id
- Identifier for the SMPP clientpassword
- Password used to authenticate with thesystem_id
system_type
- Identifier for the type of SMPP Clientcallback_mo
- Module and function tuple to be executed when a mobile originating message has been receivedcallback_dr
- Module and function tuple to be executed when a delivery receipt has been received
{ok, C} = esmpp:start_link(#{
mode => transceiver,
host => "127.0.0.1",
port => 2775,
system_id => "smppclient",
password => "password",
system_type => "Test",
callback_dr => {mymodule, myfunction}
}).
SMS messages are sent by calling esmpp:send_sms/4
, esmpp:send_sms/5
, or esmpp:send_sms/6
. The first four parameters are as follows:
Connection
- Process identifier ofesmpp
'sgen_server
returned byesmpp:start_link/1
Sender
- Number or mask to be set as sender of the messageDestination
- MSISDN to receive the messageMessage
- UTF-8 encoded message
The last parameter in esmpp:send_sms/5
is an optional map with the following possible keys:
service_type
- Indicates the SMS application service associated with the messageprotocol_id
- Network specific protocol identifierpriority_flag
- Designates the priority level of the message.0
is the lowest, while3
is the highestdelivery_time
- Either the absolute date and time or relative time from the current SMSC time which the delivery of the message is to be first attemptedvalidity_period
- SMSC expiration time that indicates when the message should be discarded when the message is not deliveredreg_delivery
- Indicates if a delivery receipt will be requested from the SMSC.- 0 - No delivery receipt requested
- 1 - Delivery receipt requested (success or failure)
- 2 - Delivery receipt requested (failure only)
replace_flag
- Used to request the SMSC to replace a previously submitted message, that is pending delivery. The SMSC will replace the existing message if the source address, destination address, and service type match the same fields in the new message
The last parameter in esmpp:send_sms/6
is another optional map of the optional parameters to be passed in the last part of the submit_sm
packet. Complete information is at the generated documentation inside doc/
Ids = esmpp:send_sms(C, <<"12345">>, <<"639473371390">>, <<"Hello">>).
All functions return a list of message id tuples:
[{message_id, MessageId}]
MessageId
is a (binary) string that was associated to the submitted message in the SMPP server.
Messages that are outside the standard GSM 03.38 character set are automatically detected and encoded with UTF-16. This includes emojis.
Long messages are automatically concatenated when they exceed the standard 140 byte limit.
- Create common tests
- Implement remaining commands