|
NAMEgammu-smsd-sql - gammu-smsd(1) backend using SQL abstraction layer to use any supported database as a message storageDESCRIPTIONSQL service stores all its data in database. It can use one of these SQL backends (configuration option Driver in smsd section):
SQL CONNECTION PARAMETERSCommon for all backends:
Specific for DBI:
SEE ALSO: The variables are fully described in gammurc
documentation.
TABLESNew in version 1.37.1.You can customize name of all tables in the [tables]. The SQL queries will reflect this, so it's enough to change table name in this section.
You can change any table name using these: [tables] inbox = special_inbox SQL QUERIESAlmost all queries are configurable. You can edit them in [sql] section. There are several variables used in SQL queries. We can separate them into three groups:
Phone Specific Parameters
SMS Specific Parameters
CONFIGURABLE QUERIESAll configurable queries can be set in [sql] section. Sequence of rows in selects are mandatory.All default queries noted here are noted for MySQL. Actual time and time addition are selected for default queries during initialization.
DELETE FROM phones WHERE IMEI = %I
INSERT INTO phones (IMEI, ID, Send, Receive, InsertIntoDB, TimeOut, Client, Battery, Signal) VALUES (%I, %P, %1, %2, NOW(), (NOW() + INTERVAL 10 SECOND) + 0, %N, -1, -1) Query specific parameters:
SELECT ID, Status, SendingDateTime, DeliveryDateTime, SMSCNumber FROM sentitems WHERE DeliveryDateTime IS NULL AND SenderID = %P AND TPMR = %t AND DestinationNumber = %R
UPDATE sentitems SET DeliveryDateTime = %C, Status = %1, StatusError = %e WHERE ID = %2 AND TPMR = %t Query specific parameters:
UPDATE sentitems SET Status = %1, StatusError = %e WHERE ID = %2 AND TPMR = %t Query specific parameters:
INSERT INTO inbox (ReceivingDateTime, Text, SenderNumber, Coding, SMSCNumber, UDH, Class, TextDecoded, RecipientID) VALUES (%d, %E, %R, %c, %F, %u, %x, %T, %P)
UPDATE phones SET Received = Received + 1 WHERE IMEI = %I
UPDATE outbox SET SendingTimeOut = (NOW() + INTERVAL 60 SECOND) + 0 WHERE ID = %1 AND (SendingTimeOut < NOW() OR SendingTimeOut IS NULL) The default query calculates sending timeout based on LoopSleep value. Query specific parameters:
SELECT ID, InsertIntoDB, SendingDateTime, SenderID FROM outbox WHERE SendingDateTime < NOW() AND SendingTimeOut < NOW() AND SendBefore >= CURTIME() AND SendAfter <= CURTIME() AND ( SenderID is NULL OR SenderID = '' OR SenderID = %P ) ORDER BY InsertIntoDB ASC LIMIT %1 Query specific parameters:
SELECT Text, Coding, UDH, Class, TextDecoded, ID, DestinationNumber, MultiPart, RelativeValidity, DeliveryReport, CreatorID FROM outbox WHERE ID=%1 Query specific parameters:
SELECT Text, Coding, UDH, Class, TextDecoded, ID, SequencePosition FROM outbox_multipart WHERE ID=%1 AND SequencePosition=%2 Query specific parameters:
DELETE FROM outbox WHERE ID=%1 Query specific parameters:
DELETE FROM outbox_multipart WHERE ID=%1 Query specific parameters:
INSERT INTO outbox (CreatorID, SenderID, DeliveryReport, MultiPart, InsertIntoDB, Text, DestinationNumber, RelativeValidity, Coding, UDH, Class, TextDecoded) VALUES (%1, %P, %2, %3, NOW(), %E, %R, %V, %c, %u, %x, %T) Query specific parameters:
INSERT INTO outbox_multipart (SequencePosition, Text, Coding, UDH, Class, TextDecoded, ID) VALUES (%4, %E, %c, %u, %x, %T, %5) Query specific parameters:
INSERT INTO sentitems (CreatorID,ID,SequencePosition,Status,SendingDateTime, SMSCNumber, TPMR, SenderID,Text,DestinationNumber,Coding,UDH,Class,TextDecoded, InsertIntoDB,RelativeValidity) VALUES (%A, %1, %2, %3, NOW(), %F, %4, %P, %E, %R, %c, %u, %x, %T, %5, %V) Query specific parameters:
UPDATE phones SET Sent= Sent + 1 WHERE IMEI = %I
UPDATE phones SET TimeOut= (NOW() + INTERVAL 10 SECOND) + 0, Battery = %1, Signal = %2 WHERE IMEI = %I Query specific parameters:
UPDATE outbox SET SendngTimeOut = (NOW() + INTERVAL 600 SECOND) + 0, Retries = %2 WHERE ID = %1 Query specific parameters:
AUTHORMichal Čihař <michal@cihar.com>COPYRIGHT2009-2015, Michal Čihař <michal@cihar.com>
Visit the GSP FreeBSD Man Page Interface. |