ecimd2 - Erlang/OTP CIMD2 Client

Build Status Hex.pm

ecimd2 connects erlang applications to Nokia SMSCs via the CIMD2 protocol.

Supported Operations

Other commands will be supported in the future versions.

OTP Version

Required: OTP 18 and later

Setup

ecimd2 can be added as a dependency via hex.pm

{deps, [
{ecimd2, "0.0.7"}
]}.

Then include ecimd2 in your application's .app.src file

{applications, [
kernel,
stdlib,
ecimd2
]}.

Usage

Calling ecimd2:start_link/1 will start a connection to the SMSC. The following options are available inside a map as a parameter:

{ok, C} = ecimd2:start_link(#{
host => "127.0.0.1",
port => 16001,
username => "cimd2client",
password => "password",
callback_dr => {mymodule, myfunction}
}).

Sending SMS

SMS messages are sent by calling ecimd2:send_sms/6. The function parameters are as follows:

Ids = ecimd2:send_sms(C, <<"12345">>, <<"TestSender">>, <<"+639473371390">>, <<"Hello">>).

Return Type

The send_sms function will return a list of message id tuples:

[{message_id, MessageId}]

MessageId is a (binary) string that was associated to the submitted message in the SMSC. Since CIMD2 lacks a message identifier in it's protocol, the MessageId returned in the function is a combination of timestamp and destination address from the submit operation response parameters.

UCS2/UTF-16 Support

Messages that are outside the standard GSM 03.38 character set are automatically detected and encoded with UTF-16. This includes emojis.

Long Messages

Long messages are automatically concatenated when they exceed the standard 140 byte limit.