ODBC account allows you to use a database as an SME.
This type of account uses ODBC interface to communicate with a database.
ODBC account enables external entities (e.g. application, web service, etc.) to exchange messages with SMS Studio.
The contents of this topic:
The structure of the database
The database design is symmetrical to allow bidirectional communication between SMS Studio and external applications. The database should contain the following tables:
ID - the auto-incremented integer value that is used as the unique ID of the record in the table.
RefID - the unique integer value, assigned by external application.
MsgText - the text of the message.
MsgType - the type of the message - 0 for text, 1 for binary.
Sender - the address of the sender of the message.
Recipient - the address of the recipient of the message.
ID - the auto-incremented integer value that is used as the unique ID of the record in the table.
RefID - the unique integer value, taken from the Incoming table, identifying the incoming message.
Status - the integer value representing the status of the incoming message.
ID - the auto-incremented integer value that is used as the unique ID of the record in the table.
RefID - the unique integer value, assigned by SMS Studio.
MsgText - the text of the message.
MsgType - the type of the message - 0 for text, 1 for binary.
Sender - the address of the sender of the message.
Recipient - the address of the recipient of the message.
ID - the auto-incremented integer value that is used as the unique ID of the record in the table.
RefID - the unique integer value, taken from the Outgoing table, identifying the outgoing message.
Status - the integer value representing the status of the outgoing message.
TableName - the name of the table from the database.
LastReadID - the ID value of the last record read from the table.
The Status field of the IncomingStatus and OutgoingStatus tables may contain the following values:
Using the database
SMS Studio uses the following algorithm to read Incoming and OutogingStatus tables:
1. Read the DatabaseState table to obtain the LastReadID value for the table of interest.
2. Read only the records from the table with the ID value greater than the LastReadID value.
3. Update the DatabaseState table to remember the greatest ID value read in the step 2.
4. Optionally, delete the records read in step 2.
It is recommended that an external entity, which reads the Outgoing and IncomingStatus tables, uses the same algorithm.
Sending messages
SMS Studio writes outgoing messages to the Outgoing table.
If the OutgoingStatus table is not in use, the message will be considered as sent when it is written to the database.
If the OutgoingStatus table is in use, the message will be considered as submitted when it is written to the database. Along with each outgoing message in the Outgoing table, SMS Studio will supply a unique RefID value. The external entity is then responsible to return the status of the outgoing message by inserting a record into the OutgoingStatus table which should contain the RefID value and the Status of the outgoing message.
Example
1. When a message is stored in the Outbox to be sent by the ODBC Connection, SMS Studio will store this message into the Outgoing table as a new record:
RefID: 321654, MsgText: Hello, MsgType: 0, Sender: 5555, Recipient: 1234
The status of this message in the Outbox will be set to Submitted.
2. An external application is responsible to provide the sending status of this message, by inserting a new record into the OutgoingStatus table:
RefID: 321654, Status: 0 or 1
When SMS Studio collects this record, the status of this message in the Outbox will be set to Not sent or Sent.
3. An external application may also supply delivery status of this message, by inserting a new record into the OutgoingStatus table:
RefID: 321654, Status: 2 or 3
When SMS Studio collects this record, the status of this message in the Outbox will be set to Not delivered or Delivered.
Receiving messages
SMS Studio collects incoming messages from the Incoming table.
If the IncomingStatus table is in use, along with each incoming message in the Incoming table an external application should also write a unique RefID value. If the external application can not supply the RefID value, it should set it to 0 and SMS Studio will then use the ID value of the record instead. When a message is stored in the Inbox, or a delivery report is routed back, SMS Studio will insert a new record in the IncomingStatus table which will contain the RefID value and the new Status of the incoming message.
Example
1. An external application stores the following record into the Incoming table:
RefID: 123456, MsgText: Hello, MsgType: 0, Sender: 1234, Recipient: 5555
2. When SMS Studio collects this message, it will be stored in the Inbox. The status of this operation will be written as a new record in the IncomingStatus table:
RefID: 123456, Status: 1
3. If this message was routed and a delivery report is sent back to SMS Studio, then a new record will be inserted in the IncomingStatus table:
RefID: 123456, Status: 2 or 3
ODBC Connection Dialog
See Connection Dialog for description of the Connection, Account and Statistics tabs.
| Copyright © 2002-2007 CodeSegment. All rights reserved. |