You are on page 1of 2

EXTRAS

Connecting directly to SMSEagle SQL database

SMSEagle’s database operates on PostgreSQL database engine. You may use a direct access to database for
reading/writing SMS messages directly from/to database via SQL queries.

The database access for external applications is disabled by default. In order to enable it, go to webGUI >
menu Settings and enable to following setting:

Once database access is enabled, it is possible to connect to the database from external application using
the following credentials:

P OSTGRE SQL DATABASE CREDENTIALS

Host: IP address of your device

Database name: smseagle

User: smseagleuser

Password: postgreeagle

Injecting short SMS using SQL

The simplest example is short text message (limited to 160 chars):

INSERT INTO outbox (


DestinationNumber,
TextDecoded,
CreatorID,
Coding,
Class,
SenderID
) VALUES (
'1234567',
'This is a SQL test message',
'Program',
'Default_No_Compression',
-1,

154 | SMSEagle NXS-9700 | User’s Manual


'smseagle1'
);

INSERT INTO user_outbox (


id_outbox,
id_user
) SELECT CURRVAL(pg_get_serial_sequence('outbox','ID')), 1;

In the above example the message will belong to user with id_user 1 (default 'admin'). You can find id_user
values for other users in table public."user".

Injecting long SMS using SQL

Inserting multipart messages is a bit trickier, you need to construct also UDH header and store it
hexadecimally written into UDH field. Unless you have a good reason to do this manually, use API.

For long text message, the UDH starts with 050003 followed by byte as a message reference (you can put
any hex value there, but it should be different for each message, D3 in following example), byte for number
of messages (02 in example, it should be unique for each message you send to same phone number) and
byte for number of current message (01 for first message, 02 for second, etc.).

For example, long text message of two parts could look like following:

INSERT INTO outbox (


"DestinationNumber",
"CreatorID",
"MultiPart",
"UDH",
"TextDecoded",
"Coding",
"Class",
"SenderID"
) VALUES (
'1234567',
'Program',
'true',
'050003D30201',
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, qui',
'Default_No_Compression',
-1,
'smseagle1'
)

INSERT INTO outbox_multipart (


"ID",
"SequencePosition",

155 | SMSEagle NXS-9700 | User’s Manual

You might also like