Difference between revisions of "SMS-CB: Analisa Dari Source Code OpenBTS"
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
Line 20: | Line 20: | ||
with the smallest SEND TIME on each iteration and then updating the SEND TIME to the current Unix time. | with the smallest SEND TIME on each iteration and then updating the SEND TIME to the current Unix time. | ||
To schedule messages for delivery, an external application, provided by the operator, creates new entries in the SMSCB database table with a SEND TIME value of zero. To stop delivery of a message permanently, delete its record from the table. To suspend delivery of a message, set its SEND TIME to the future time at which delivery is to resume. | To schedule messages for delivery, an external application, provided by the operator, creates new entries in the SMSCB database table with a SEND TIME value of zero. To stop delivery of a message permanently, delete its record from the table. To suspend delivery of a message, set its SEND TIME to the future time at which delivery is to resume. | ||
+ | |||
+ | |||
+ | GS = 3 (Cell-wide broadcast) | ||
+ | MESSAGE_CODE = 11 11101110 = 1210, the two bits in front being emergency popup, the rest being pre-defined padding | ||
+ | UPDATE_NUMBER = 0 | ||
+ | LANGUAGE_CODE = 0000 0001 = 1 for english | ||
+ | MSID = 4370 for required emergency alert (?) | ||
Latest revision as of 06:22, 5 September 2015
Sumber: http://wush.net/svn/range/software/public/openbts/trunk/Control/SMSCB.cpp
Specification 03.41 describes a hierarchy of servers to distribute content for the SMSCB service and a protocol in L3 for delivery of SMSCB content to the BTS.A.4. GENERAL PACKET RADIO SERVICE (GPRS) OpenBTS does not follow this model. Instead, OpenBTS takes messages for delivery from an sqlite3 database table at a path specified in the “Control.SMSCB.Table” parameter. The schema is:
CREATE TABLE IF NOT EXISTS SMSCB ( GS INTEGER NOT NULL, -- See GSM 03.41 9.3.2.1. MESSAGE_CODE INTEGER NOT NULL, -- See GSM 03.41 9.3.2.1. UPDATE_NUMBER INTEGER NOT NULL, -- See GSM 03.41 9.3.2.1. MSGID INTEGER NOT NULL, -- See GSM 03.41 9.3.2.2. LANGUAGE_CODE INTEGER NOT NULL, -- See GSM 03.41 9.3.2.3 and GSM 03.38. MESSAGE TEXT NOT NULL, -- the actual message text, ASCII SEND_TIME INTEGER DEFAULT 0, -- Unix time when this message was last sent SEND_COUNT INTEGER DEFAULT 0 -- number of times this message has been sent )
Inside OpenBTS, the SMSCB sending loop scans this table at the SMSCB message rate, sending the message with the smallest SEND TIME on each iteration and then updating the SEND TIME to the current Unix time. To schedule messages for delivery, an external application, provided by the operator, creates new entries in the SMSCB database table with a SEND TIME value of zero. To stop delivery of a message permanently, delete its record from the table. To suspend delivery of a message, set its SEND TIME to the future time at which delivery is to resume.
GS = 3 (Cell-wide broadcast) MESSAGE_CODE = 11 11101110 = 1210, the two bits in front being emergency popup, the rest being pre-defined padding UPDATE_NUMBER = 0 LANGUAGE_CODE = 0000 0001 = 1 for english MSID = 4370 for required emergency alert (?)
format database
// Get the message parameters. // These column numbers need to line up with the argeuments to the SELEECT. unsigned GS = (unsigned)sqlite3_column_int(stmt,0); unsigned messageCode = (unsigned)sqlite3_column_int(stmt,1); unsigned updateNumber = (unsigned)sqlite3_column_int(stmt,2); unsigned messageID = (unsigned)sqlite3_column_int(stmt,3); char* messageText = strdup((const char*)sqlite3_column_text(stmt,4)); unsigned languageCode = (unsigned)sqlite3_column_int(stmt,5); unsigned sendCount = (unsigned)sqlite3_column_int(stmt,6); unsigned rowid = (unsigned)sqlite3_column_int(stmt,7); // Done with the database entry. // Finalize ASAP to unlock the database. sqlite3_finalize(stmt);
Query SQLITE3
"SELECT" " GS,MESSAGE_CODE,UPDATE_NUMBER,MSGID,MESSAGE,LANGUAGE_CODE,SEND_COUNT,ROWID" " FROM SMSCB" " WHERE SEND_TIME==(SELECT min(SEND_TIME) FROM SMSCB)";