1 .TH "GAMMU-SMSD-TABLES" "7" "January 19, 2011" "1.29.0" "Gammu"
3 gammu-smsd-tables \- description of tables for database backends of gammu-smsd(1)
5 .nr rst2man-indent-level 0
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
17 .\" .rstReportMargin pre:
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
25 .\" indent \\n[an-margin]
26 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
27 .nr rst2man-indent-level -1
28 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
31 .\" Man page generated from reStructeredText.
34 The backends themselves are described in their sections, this document
35 describes general database structure and required tables.
37 More SMS daemons can share single database. If you do not specify PhoneID in
38 their configuration, all are treated equally and you have no guarantee which
39 one sends outgoing message. If you configure PhoneID and use it when inserting
40 message to the \fBoutbox\fP table (\fIgammu\-smsd\-inject\fP does this), each SMS
41 daemon will have separate outbox queue.
42 .SH RECEIVING OF MESSAGES
44 Received messages are stored in \fBinbox\fP table.
45 .SH TRANSMITTING OF MESSAGES
47 Transmitted messages are read from table \fBoutbox\fP and possible subsequent parts
48 of the same message from \fBoutbox_multipart\fP.
49 .SH DESCRIPTION OF TABLES
52 Information about running daemons.
55 Table holding single value \- version of a database schema. See HISTORY for
56 details what has changed.
59 Table where received messages will be stored.
64 .B \fBUpdatedInDB\fP (timestamp)
66 when somebody (daemon, user, etc.) updated it
68 .B \fBReceivingDateTime\fP (timestamp)
74 encoded SMS text (for all SMS)
76 .B \fBSenderNumber\fP (varchar(20))
78 decoded SMS sender number
80 .B \fBCoding\fP (enum(\(aqDefault_No_Compression\(aq, \(aqUnicode_No_Compression\(aq, \(aq8bit\(aq, \(aqDefault_Compression\(aq, \(aqUnicode_Compression\(aq))
86 encoded User Data Header text
88 .B \fBSMSCNumber\fP (varchar(20))
92 .B \fBClass\fP (integer)
94 SMS class or \-1 (0 is flash SMS, 1 is normal one)
96 .B \fBTextDecoded\fP (varchar(160))
98 decoded SMS text (for Default Alphabet/Unicode SMS)
100 .B \fBID\fP (integer unsigned)
102 SMS identificator (for using with external applications)
104 .B \fBRecipientID\fP (text)
106 which Gammu daemon has added it
108 .B \fBProcessed\fP (enum(\(aqfalse\(aq, \(aqtrue\(aq))
110 you can use for marking, whether SMS was processed or not
114 Messages enqueued for sending should be placed in this table. If message
115 is multipart, subsequent parts are stored in table outbox_multipart.
120 .B \fBUpdatedInDB\fP (timestamp)
122 when somebody (daemon, user, etc.) updated it
124 .B \fBInsertIntoDB\fP (timestamp)
126 when message was inserted into database
128 .B \fBSendingDateTime\fP (timestamp)
130 set it to some value, when want to force sending after some planned time
134 SMS text encoded using hex values in proper coding. If you want to use
135 TextDecoded field, keep this NULL (or empty).
137 .B \fBDestinationNumber\fP (varchar(20))
141 .B \fBCoding\fP (enum(\(aqDefault_No_Compression\(aq, \(aqUnicode_No_Compression\(aq, \(aq8bit\(aq, \(aqDefault_Compression\(aq, \(aqUnicode_Compression\(aq))
147 User Data Header encoded using hex values which will be used for constructing
148 the message. Without this, message will be sent as plain text.
150 .B \fBClass\fP (integer)
152 SMS class or \-1 (0 is normal SMS, 1 is flash one)
154 .B \fBTextDecoded\fP (varchar(160))
156 SMS text in "human readable" form
158 .B \fBID\fP (integer unsigned)
162 Please note that this number has to be unique also for sentitems table, so
163 reusing message IDs might not be a good idea.
165 .B \fBMultiPart\fP (enum(\(aqfalse\(aq,\(aqtrue\(aq))
167 info, whether there are more SMS from this sequence in outbox_multipart
169 .B \fBRelativeValidity\fP (integer)
171 SMS relative validity like encoded using GSM specs
173 .B \fBSenderID\fP (text)
175 which SMSD instance should send this one sequence
177 .B \fBSendingTimeOut\fP (timestamp)
179 used by SMSD instance for own targets
181 .B \fBDeliveryReport\fP (enum(\(aqdefault\(aq,\(aqyes\(aq,\(aqno\(aq))
183 when default is used, Delivery Report is used or not according to SMSD instance settings; yes forces Delivery Report.
185 .B \fBCreatorID\fP (text)
187 sender identification, it has to match PhoneID in SMSD configuration to make
188 SMSD process this message
192 Data for outgoing multipart messages.
197 .B \fBID\fP (integer unsigned)
199 the same meaning as values in outbox table
203 the same meaning as values in outbox table
205 .B \fBCoding\fP (enum(\(aqDefault_No_Compression\(aq, \(aqUnicode_No_Compression\(aq, \(aq8bit\(aq, \(aqDefault_Compression\(aq, \(aqUnicode_Compression\(aq))
207 the same meaning as values in outbox table
211 the same meaning as values in outbox table
213 .B \fBClass\fP (integer)
215 the same meaning as values in outbox table
217 .B \fBTextDecoded\fP (varchar(160))
219 the same meaning as values in outbox table
221 .B \fBID\fP (integer unsigned)
223 the same meaning as values in outbox table
225 .B \fBSequencePosition\fP (integer)
227 info, what is SMS number in SMS sequence (start at 2, first part is in outbox
232 Information about connected phones. This table is periodically refreshed and
233 you can get information such as battery or signal level from here.
242 .B \fBUpdatedInDB\fP (timestamp)
244 when this record has been updated
246 .B \fBInsertIntoDB\fP (timestamp)
248 when this record has been created (when phone has been connected)
250 .B \fBTimeOut\fP (timestamp)
252 when this record expires
254 .B \fBSend\fP (boolean)
256 indicates whether SMSD is sending messages, depends on configuration directive \fBSend\fP
258 .B \fBReceive\fP (boolean)
260 indicates whether SMSD is receiving messages, depends on configuration directive \fBReceive\fP
266 .B \fBClient\fP (text)
268 client name, usually string Gammu with version
270 .B \fBBattery\fP (integer)
272 battery level in percent (or \-1 if unknown)
274 .B \fBSignal\fP (integer)
276 signal level in percent (or \-1 if unknown)
278 .B \fBSent\fP (integer)
280 Number of sent SMS messages (SMSD does not reset this counter, so it might
283 .B \fBReceived\fP (integer)
285 Number of received SMS messages (SMSD does not reset this counter, so it might
290 Log of sent messages (and unsent ones with error code). Also if delivery
291 reports are enabled, message state is updated after receiving delivery report.
296 .B \fBUpdatedInDB\fP (timestamp)
298 when somebody (daemon, user, etc.) updated it
300 .B \fBInsertIntoDB\fP (timestamp)
302 when message was inserted into database
304 .B \fBSendingDateTime\fP (timestamp)
306 when message has been sent
308 .B \fBDeliveryDateTime\fP (timestamp)
310 Time of receiving delivery report (if it has been enabled).
312 .B \fBStatus\fP (enum(\(aqSendingOK\(aq, \(aqSendingOKNoReport\(aq, \(aqSendingError\(aq, \(aqDeliveryOK\(aq, \(aqDeliveryFailed\(aq, \(aqDeliveryPending\(aq, \(aqDeliveryUnknown\(aq, \(aqError\(aq))
314 Status of message sending. SendingError mens that phone failed to send the
315 message, Error indicates some other error while processing message.
320 Message has been sent, waiting for delivery report.
322 .B \fBSendingOKNoReport\fP
324 Message has been sent without asking for delivery report.
326 .B \fBSendingError\fP
332 Delivery report arrived and reported success.
334 .B \fBDeliveryFailed\fP
336 Delivery report arrived and reports failure.
338 .B \fBDeliveryPending\fP
340 Delivery report announced pending deliver.
342 .B \fBDeliveryUnknown\fP
344 Delivery report reported unknown status.
348 Some other error happened during sending (usually bug in SMSD).
351 .B \fBStatusError\fP (integer)
353 Status of delivery from delivery report message, codes are defined in GSM
354 specification 03.40 section 9.2.3.15 (TP\-Status).
358 SMS text encoded using hex values
360 .B \fBDestinationNumber\fP (varchar(20))
362 decoded destination number for SMS
364 .B \fBCoding\fP (enum(\(aqDefault_No_Compression\(aq, \(aqUnicode_No_Compression\(aq, \(aq8bit\(aq, \(aqDefault_Compression\(aq, \(aqUnicode_Compression\(aq))
370 User Data Header encoded using hex values
372 .B \fBSMSCNumber\fP (varchar(20))
374 decoded number of SMSC, which sent SMS
376 .B \fBClass\fP (integer)
378 SMS class or \-1 (0 is normal SMS, 1 is flash one)
380 .B \fBTextDecoded\fP (varchar(160))
382 SMS text in "human readable" form
384 .B \fBID\fP (integer unsigned)
388 .B \fBSenderID\fP (text)
390 which SMSD instance sent this one sequence
392 .B \fBSequencePosition\fP (integer)
394 SMS number in SMS sequence
396 .B \fBTPMR\fP (integer)
398 Message Reference like in GSM specs
400 .B \fBRelativeValidity\fP (integer)
402 SMS relative validity like encoded using GSM specs
404 .B \fBCreatorID\fP (text)
406 copied from CreatorID from outbox table, matches PhoneID
410 Not used by SMSD currently, included only for application usage.
413 Not used by SMSD currently, included only for application usage.
416 History of schema versions:
421 the changes only affect MySQL structure changing default values for
422 timestamps from \fB0000\-00\-00 00:00:00\fP to \fBCURRENT_TIMESTAMP()\fP by
423 using triggers, to update to this version, just execute triggers
424 definition at the end of SQL file.
428 all fields for storing message text are no longer limited to 160 chars,
429 but are arbitrary length text fields (1.25.92)
433 \fBDeliveryDateTime\fP is now NULL when message is not delivered, added several
438 added sent/received counters to phones table
442 introduced phones table
446 added CreatorID to tables (it holds PhoneID if set)
451 SQL scripts to create all needed tables for most databases are included in
452 Gammu documentation (docs/sql). As well as some PHP scripts interacting with
455 For example to create SQLite tables, issue following command:
459 sqlite3 smsd.db < docs/sql/sqlite.sql
462 .SS Injecting a message using SQL
464 To send a message, you can either use \fIgammu\-smsd\-inject\fP, which does all the
465 magic for you, or you can insert the message manually. The simplest example is
477 \(aqThis is a SQL test message\(aq,
479 \(aqDefault_No_Compression\(aq
483 .SS Injecting long message using SQL
485 Inserting multipart messages is a bit more tricky, you need to construct also
486 UDH header and store it hexadecimally written into UDH field. Unless you have
487 a good reason to do this manually, use \fIgammu\-smsd\-inject\fP.
489 For long text message, the UDH starts with \fB050003\fP followed by byte as a
490 message reference (you can put anything there, but it should be different for
491 each message, \fBD3\fP in following example), byte for number of messages (\fB02\fP
492 in example, it should be unique for each message you send to same phone number)
493 and byte for number of current message (\fB01\fP for first message, \fB02\fP for
496 For example long text message of two parts could look like following:
508 \(aqGammu 1.23.91\(aq,
511 \(aq050003D30201\(aq,
512 \(aqMqukqirip ya konej eqniu rejropocejor hugiygydewl tfej nrupxujob xuemymiyliralj. Te tvyjuh qaxumur ibewfoiws zuucoz tdygu gelum L ejqigqesykl kya jdytbez\(aq,
513 \(aqDefault_No_Compression\(aq
516 INSERT INTO outbox_multipart (
525 \(aq050003D30202\(aq,
526 \(aqu xewz qisubevumxyzk ufuylehyzc. Nse xobq dfolizygqysj t bvowsyhyhyemim ovutpapeaempye giuuwbib.\(aq,
527 <ID_OF_INSERTED_RECORD_IN_OUBOX_TABLE>,
528 \(aqDefault_No_Compression\(aq
534 Adding UDH means that you have less space for text, in above example you
535 can use only 153 characters in single message.
538 Michal Čihař <michal@cihar.com>
540 2009-2011, Michal Čihař <michal@cihar.com>
541 .\" Generated by docutils manpage writer.