SMSServer - Database Interface

Introduction

With this interface, SMSServer uses three database tables to do its job:

SMSServer database interface was developed and tested with:

It was also reported to work with PostgreSQL.

Database structure

Inbound SMS Table

This table should be named smserver_in, unless specified otherwise in the configuration file. SMSServer will read inbound messages from your gateway(s) and will insert them in this table. The table structure should be as follows:

Field NameTypeTechnical InfoDescription
idINTAutonumber/identity fieldThe table's primary key.
processINTNOT NULLWhen new rows (i.e. messages) are created, SMSServer sets this field to 0. You can use this field for your own purposes.
originatorCHAR(16)NOT NULLThe originator of the received message.
typeCHAR(1)NOT NULL"I" for inbound message, "S" for status report message.
encodingCHAR(1)NOT NULL"7" for 7bit, "8" for 8bit and "U" for Unicode/UCS2.
message_dateDATETIMENOT NULLThe message date (retrieved by the message headers).
receive_dateDATETIMENOT NULLThe datetime when message was received.
textCHAR(xxx)NOT NULLThe body of the message.
original_ref_noCHAR(64)NULLAvailable only for status report messages: refers to the RefNo of the original outbound message.
original_receive_dateDATETIMENULLAvailable only for status report messages: refers to the receive date of the original outbound message.
gateway_idCHAR(64)NOT NULLThe ID of the gateway from which the message was received.

Outbound SMS Table

This table should be named smsserver_out , unless specified otherwise in the configuration file. SMSServer will read rows from this table and will dispatch them from your gateway(s). The table structure should be as follows:

Field NameTypeTechnical InfoDescription
idINTAutonumber/identity fieldThe table's primary key.
typeCHAR(1)NOT NULLThe message type. This should be "O" for normal outbound messages, or "W" for wap si messages.
recipientCHAR(16)NOT NULLThe recipient's number to whom the message should be sent.
textCHAR(xxx)NOT NULLThe message text.
wap_urlCHAR(xxx)NOT NULL for WAP SI messages!The WAP SI URL address.
wap_expiry_dateDATETIMENULLThe WAP SI expiry date. If no value is given, SMSServer will calculate a 7 day ahead expiry date.
wap_signalCHAR(1)NULLThe WAP SI signal. Use "N" for NONE, "L" for LOW, "M" for MEDIUM, "H" for HIGH, "D" for DELETE. If no value/invalid value is given, the NONE signal will be used.
create_dateDATETIMENOT NULL, Default value: current date/timeThe datetime when this record was created.
originatorCHAR(16)NOT NULL, Default value: ''The originator. Normally you should leave this blank.
encodingCHAR(1)NOT NULL, Default value: '7'"7" for 7bit, "8" for 8bit and "U" for Unicode/UCS2.
status_reportINTNOT NULL, Default value: 0Set to 1 if you require a status report message to be generated.
flash_smsINTNOT NULL, Default value: 0Set to 1 if you require your message to be sent as a flash message.
src_portINTNOT NULL, Default value: -1Set to source port (for midlets)
dst_portINTNOT NULL, Default value: -1Set to destination port (for midlets)
sent_dateDATETIMENULLThe sent date. This field is updated by SMSServer when it sends your message.
ref_noCHAR(64)NULLThe Reference ID of your message. This field is updated by SMSServer when it sends your message.
priorityINTNOT NULL, Default value: 0Lower (or negative) values mean lower priority than higher (or positive) values. By convention, a priority of a value 0 (zero) is considered the normal priority. High priority messages get sent first than others.
statusCHAR(1)NOT NULL, Default value "U""U" : unsent, "Q" : queued, "S" : sent, "F" : failed. This field is updated by SMSServer when it sends your message. If set in the configuration file, this field takes extra values depending on the received status report message: "D" : delivered, "P" : pending, "A" : aborted.
errorsINTNOT NULL, Default value: 0The number of retries SMSServer did to send your message. This field is updated by SMSServer.
gateway_idCHAR(64)NOT NULL, Default value is the star characterSet it to the star character if you want to leave to SMSServer the decision as to which gateway to use to send your message. Set it to a specific Gateway ID to force SMSServer to send your message via this gateway.

Voice Calls Table

This table should be named smsserver_calls , unless specified otherwise in the configuration file. SMSServer will use this table for logging all voice calls it receives (and eventually drops). SMSServer always creates and never deletes records in this table. The table structure should be as follows:

Field NameTypeTechnical InfoDescription
idINTAutonumber/identity fieldThe table's primary key.
call_dateDATETIMENOT NULLThe date/time of the received call.
gateway_idCHAR(64)NOT NULLThe id of the gateway which received the call.
caller_idCHAR(16)NOT NULLThe caller id.

Configuration File

This interface requires the following configuration settings:

OptionDescription
urlThe URL of the database which hosts SMSServer tables.
driverThe database driver class.
usernameThe database username.
passwordThe database password.
typeAllowed values: "mssql" for MS SQL Server, "mysql" for MySQL, "oracle" for Oracle.
tables.sms_inThis is the name of the "smsserver_in" table, should you choose to name it differently.
tables.sms_outThis is the name of the "smsserver_out" table, should you choose to name it differently.
tables.callsThis is the name of the "smsserver_calls" table, should you choose to name it differently.
batch_sizeMaximum number of messages to send from the database at each processing cycle
retriesThis setting defines the number of retries SMSServer should give a failing-to-be-sent message before it decides to really mark it as a "failed" one and leave it aside.
update_outbound_on_statusreportDefault is "no". If set to "yes", SMSServer will automatically update the status field of the outbound table (smsserver_out) according to the status of the relevant status report messages it receives. So in order to activate this feature set the above setting to "yes" and make sure you request status reports for all of your outbound messages.

Example:

interface.0=db1, Database
db1.url=jdbc:sqlserver://localhost:1433;SelectMethod=cursor;DatabaseName=smslib
db1.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db1.username=smslib
db1.password=smslib
db1.type=mssql
db1.tables.sms_in=smssvr_in
db1.tables.sms_out=smssvr_out
db1.tables.calls=smssvr_calls
db1.batch_size=50
db1.retries=2
db1.update_outbound_on_statusreport=yes

Sample database creation files

You can find sample database creation scripts in the "misc\SMSServer Database Scripts" directory.