Database schema for EMG

Below we explain the columns in the various EMG database tables.

Table cfg_connectors

Base connector configuration.

Only read by EMG, never updated.

ColumnDescription
idAuto-generated unique id (primary key)
nameConnector name
connector_orderNumeric sort order value that can be used to sort connectors in specific order
updatedTimestamp when record last updated
disabledIf set to 1, connector will be considered disabled
noteOptional textual description

Table cfg_connectoroptions

Additional connector configuration options.

Only read by EMG, never updated.

ColumnDescription
idAuto-generated unique id (primary key)
connectoridConnector id
keyorderNumeric sort order value that can be used to sort options in specific order
updatedTimestamp when record last updated
disabledIf set to 1, connector will be considered disabled
keynameConnector option name
valueConnector option value
noteOptional textual description

Table cfg_general

General configuration options.

ColumnDescription
idAuto-generated unique id (primary key)
keyorderNumeric sort order value that can be used to sort options in specific order
keynameGeneral option name
valueGeneral option value
updatedTimestamp when record last updated

Table cfg_plugins

Plugin configuration.

ColumnDescription
idAuto-generated unique id (primary key)
namePlugin name
instancesNumber of plugin instances
libraryPath to plugin file in file system
configOptional config option
offsetOffset
updatedTimestamp when record last updated
disabledIf set to 1, connector will be considered disabled
noteOptional textual description
dbprofileDatabase profile info to send to plugin method “create_config”. Added in EMG 7.1.

Table cfg_satpools

SAT pool configuration.

ColumnDescription
idAuto-generated unique id (primary key)
nameSAT pool name
addressrangeAddress range for pool
threadedThreaded conversations flag
quoted_replyQuoted replies flag
ignore_destaddrIgnore destaddr flag
randomRandom flag
expireExpire time for SAT pool entries, in seconds
updatedTimestamp when record last updated
disabledIf set to 1, connector will be considered disabled
noteOptional textual description

Table connectorlog

Connector log.

Normally not enabled.

Table emgsystem

System information, such as schema version.

ColumnDescription
keynameKey
valuevalue

Keys used:

KeyDescription
emgschemaEMG schema versio, for example “37”
dbconfig_lastokTimestamp for last successfully generated configuration
dbconfig_lastok_XTimestamp for last successfully generated configuration in a multi-node environment (X=Node id)
hourly_summary_last_tsUsed by “hourly_summary.pl” aggregation script to keep track of last message timestamp (used from script version 42720)

Table emguser

EMG accounts

ColumnDescriptionUpdated by EMG?
useridAuto-generated unique id (primary key) 
createdTimestamp when user created 
usernameUsername 
passwordPassword (clear text) 
md5passwordPassword (MD5 hash) 
creditssendCredits for sending, integer partYes
creditssenddecCredits for sending, decimal part in 1 / 1 000 000 
creditsreceiveNOT USED 
charge_balanceNew in EMG 5.3: Account balance for sending messages 
maxsessionsMax number of simultaneous sessions 
throughputMax throughput 
lastloginLast successful loginYes
lastfailedloginLast failed loginYes
lastipIP address last seenYes
lockeduntilAccount locked until time specified 
allowpostpaidIs charge_balance or creditssend < 0 allowed? (1 = Yes) 
idletimeout  
failedloginsNOT USED 
usergroupUser is administrator if set to ‘ADMIN’ 
fullnameName of customer contact person 
companyCompany name 
routeUser-specific route (connector name) 
routedlrUser specific route (connector name) for delivery reports 
routingFile name for user-specific routing file to use 
routesatUser-specific route for SAT replies 
phoneCustomer phone number 
forcesourceaddrForced source address for messages received from customer 
satpoolcreateUser-specific SAT pool 
chargesFile name for charges (billing info) 
extra1Extra field for information of choice 
extra2Extra field for information of choice 
extra3Extra field for information of choice 
extra4Extra field for information of choice 
extra5Extra field for information of choice 
extra6Extra field for information of choice 
extra7Extra field for information of choice 
extra8Extra field for information of choice 
extra9Extra field for information of choice 
modeCan be set to “RX” to force user to bind as a “receiver” (only receive, not send messages). 
cert_fingerprintIf set any fingerprint for a certificate presented by user must match. 
min_vpIf user sends a value for validity period less than min_vp it will be adjusted to min_vp. 
max_vpIf user sends a value for validity period larger than max_vp it will be adjusted to max_vp. Added in EMG 7.1. 
dlr_delayOptional delay in seconds to hold dlr before forwarding it to user. Added in EMG 7.1. 
charge_balance_postpaid_limitLower limit for charge_balance when customer is portpaid. As the value is compared to charge_balance, it should be a negative value. If the value is null, there is no limit. Added in EMG 7.1. 

Table emguseraccess

EMG account access entries.

Columns “ipadress” and “ipstr” are mutually exclusive meaning only one of them can be used and the other must be set to null.

ColumnDescription
useraccessidAuto-generated unique id (primary key)
useridReference to emguser.id
ipaddressIP address
ipstrIP address as text (must be used for IPv6)
ipwidthNetwork mask, bits (0 = Any, 24 = IPv4 C-net, 32 = IPv4 host)
connectorConnector name, “*” for any

Table messagebody

Message body.

ColumnDescription
idEMG message id (primary key)
dataMessage data, hex encoded

Table messageoption

Additional message options.

ColumnDescription
useraccessidAuto-generated unique id (primary key)
idEMG message id
optionkeyMessage option key
dataMessage option value

Table monthlysummary

Not used. Replaced by EMG Portal table “emgp_hourly_summary”.

Table pdulog

PDU log, if enabled.

Same information as written to PDU log files can be written to database.

ColumnDescription
idAuto-generated unique id (primary key)
createdTimestamp when record created, second precision
msecsMillisecond precision
trnTransaction number, when available
rwSet to “R” when operation read and “W” when operation written
connectorConnector name
instanceConnector instance number
operationPDU operation
statusPDU status
pduTextual representation of pdu data

Table routelog

Message log.

All columns are written by EMG.

ColumnDescription
ColumnDescription
msgidEMGs unique message id
starttimeTimestamp when entry created (message received)
startmsecsMillisecs for starttime
endtimeTimestamp when message sent out
endmsecsMiilisecs for endtime
inconnectorConnector name where message received
outconnectorConnector name where message sent out
sourceaddrSender address
destaddrRecipient address
statusMessage status (MGP status code)
reasonProtocol error code on errir
startsecsTimestamp when message received (secs since Jan 1, 1970)
endsecsTimestamp when message sent out (secs since Jan 1, 1970)
noteMessage note (option MGP_OPTION_NOTE)
usernameAuthenticated user when message received by EMG
smscidMessage id received when sent out
reasontextReason text from delivery report, if any
lastdlrsecsTimestamp when last delivery report received for message (secs since Jan 1, 1970)
lastdlrmsecsMillisecs for lastdlrsecs
npdusActual pdus when message sent out (message parts)
bufferedstatusStatus reported by intermediate delivery report
msgtypeMessage type (1 = SMS, 5 = Delivery report)
origidId of original message in SAT conversations
chargeMessage fee
charge_costMessage cost
charge_price_idId for row in price table that was used for “charge”, optional, application-level
charge_cost_price_idId for row in price table that was used for “charge_cost”, optional, application-level