mirror of
https://github.com/RangeNetworks/openbts.git
synced 2025-11-03 05:13:16 +00:00
Fixes #484 in public. We now cache failed RRLP queries per-IMEI in the SR. This also means that the SR now stores the most recent IMEI for a specific IMSI.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3146 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
@@ -185,18 +185,11 @@ void Control::LocationUpdatingController(const L3LocationUpdatingRequest* lur, L
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gConfig.defines("Control.LUR.QueryRRLP")) {
|
|
||||||
// Query for RRLP
|
|
||||||
if (!sendRRLP(mobileID, DCCH)) {
|
|
||||||
LOG(INFO) << "RRLP request failed";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This allows us to configure Open Registration
|
// This allows us to configure Open Registration
|
||||||
bool openRegistration = gConfig.defines("Control.LUR.OpenRegistration");
|
bool openRegistration = gConfig.defines("Control.LUR.OpenRegistration");
|
||||||
|
|
||||||
// Query for IMEI?
|
// Query for IMEI?
|
||||||
if (IMSIAttach && gConfig.defines("Control.LUR.QueryIMEI")) {
|
if (gConfig.defines("Control.LUR.QueryIMEI")) {
|
||||||
DCCH->send(L3IdentityRequest(IMEIType));
|
DCCH->send(L3IdentityRequest(IMEIType));
|
||||||
L3Message* msg = getMessage(DCCH);
|
L3Message* msg = getMessage(DCCH);
|
||||||
L3IdentityResponse *resp = dynamic_cast<L3IdentityResponse*>(msg);
|
L3IdentityResponse *resp = dynamic_cast<L3IdentityResponse*>(msg);
|
||||||
@@ -208,8 +201,26 @@ void Control::LocationUpdatingController(const L3LocationUpdatingRequest* lur, L
|
|||||||
throw UnexpectedMessage();
|
throw UnexpectedMessage();
|
||||||
}
|
}
|
||||||
LOG(INFO) << *resp;
|
LOG(INFO) << *resp;
|
||||||
if (!gTMSITable.IMEI(IMSI,resp->mobileID().digits()))
|
const char* new_imei = resp->mobileID().digits();
|
||||||
|
if (!gTMSITable.IMEI(IMSI,new_imei)){
|
||||||
LOG(WARNING) << "failed access to TMSITable";
|
LOG(WARNING) << "failed access to TMSITable";
|
||||||
|
}
|
||||||
|
|
||||||
|
//query subscriber registry for old imei, update if neccessary
|
||||||
|
char* old_imei;
|
||||||
|
string name = string("IMSI") + IMSI;
|
||||||
|
sqlite3_single_lookup(gSubscriberRegistry.db(), "sip_buddies", "name", name.c_str(),
|
||||||
|
"hardware", old_imei);
|
||||||
|
|
||||||
|
//if we have a new imei and either there's no old one, or it is different...
|
||||||
|
if (new_imei && (!old_imei || strncmp(old_imei,new_imei, 15) != 0)){
|
||||||
|
ostringstream os2;
|
||||||
|
os2 << "update sip_buddies set RRLPSupported = \"1\", hardware = \"" << new_imei << "\" where name = \"IMSI" << IMSI << "\"";
|
||||||
|
LOG(INFO) << "Updating IMSI" << IMSI << " to IMEI:" << new_imei;
|
||||||
|
if (!sqlite3_command(gSubscriberRegistry.db(), os2.str().c_str())) {
|
||||||
|
LOG(INFO) << "sqlite3_command problem";
|
||||||
|
}
|
||||||
|
}
|
||||||
delete msg;
|
delete msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +243,13 @@ void Control::LocationUpdatingController(const L3LocationUpdatingRequest* lur, L
|
|||||||
delete msg;
|
delete msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gConfig.defines("Control.LUR.QueryRRLP")) {
|
||||||
|
// Query for RRLP
|
||||||
|
if (!sendRRLP(mobileID, DCCH)) {
|
||||||
|
LOG(INFO) << "RRLP request failed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We fail closed unless we're configured otherwise
|
// We fail closed unless we're configured otherwise
|
||||||
if (!success && !openRegistration) {
|
if (!success && !openRegistration) {
|
||||||
LOG(INFO) << "registration FAILED: " << mobileID;
|
LOG(INFO) << "registration FAILED: " << mobileID;
|
||||||
|
|||||||
@@ -95,12 +95,17 @@ RRLPServer::RRLPServer(L3MobileIdentity wMobileID, LogicalChannel *wDCCH)
|
|||||||
DCCH = wDCCH;
|
DCCH = wDCCH;
|
||||||
// name of subscriber
|
// name of subscriber
|
||||||
name = string("IMSI") + mobileID.digits();
|
name = string("IMSI") + mobileID.digits();
|
||||||
// don't continue if IMSI has a RRLP support flag and it's false
|
//if IMEI tagging enabled, check if this IMEI (which is updated elsewhere) has RRLP disabled
|
||||||
unsigned int supported = 0;
|
//otherwise just go on
|
||||||
if (sqlite3_single_lookup(gSubscriberRegistry.db(), "sip_buddies", "name", name.c_str(),
|
if (gConfig.defines("Control.LUR.QueryIMEI")){
|
||||||
"RRLPSupported", supported) && !supported) {
|
unsigned int supported = 0;
|
||||||
LOG(INFO) << "RRLP not supported for " << name;
|
//check supported bit
|
||||||
trouble = true;
|
sqlite3_single_lookup(gSubscriberRegistry.db(), "sip_buddies", "name", name.c_str(),
|
||||||
|
"RRLPSupported", supported);
|
||||||
|
if(!supported){
|
||||||
|
LOG(INFO) << "RRLP not supported for " << name;
|
||||||
|
trouble = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,10 +242,13 @@ bool RRLPServer::transact()
|
|||||||
switch (cause) {
|
switch (cause) {
|
||||||
case 97:
|
case 97:
|
||||||
LOG(INFO) << "MS says: message not implemented";
|
LOG(INFO) << "MS says: message not implemented";
|
||||||
// flag unsupported in SR so we don't waste time on it again
|
//Rejection code only useful if we're gathering IMEIs
|
||||||
os2 << "update sip_buddies set RRLPSupported = \"0\" where name = \"" << name << "\"";
|
if (gConfig.defines("Control.LUR.QueryIMEI")){
|
||||||
if (!sqlite3_command(gSubscriberRegistry.db(), os2.str().c_str())) {
|
// flag unsupported in SR so we don't waste time on it again
|
||||||
LOG(INFO) << "sqlite3_command problem";
|
os2 << "update sip_buddies set RRLPSupported = \"0\" where name = \"" << name.c_str() << "\"";
|
||||||
|
if (!sqlite3_command(gSubscriberRegistry.db(), os2.str().c_str())) {
|
||||||
|
LOG(INFO) << "sqlite3_command problem";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case 98:
|
case 98:
|
||||||
|
|||||||
@@ -138,8 +138,16 @@ static const char* createSBTable = {
|
|||||||
"musiconhold VARCHAR(100), "
|
"musiconhold VARCHAR(100), "
|
||||||
"restrictcid CHAR(3), "
|
"restrictcid CHAR(3), "
|
||||||
"calllimit int(5), "
|
"calllimit int(5), "
|
||||||
|
"WhiteListFlag timestamp not null default '0', "
|
||||||
|
"WhiteListCode varchar(8) not null default '0', "
|
||||||
|
"rand varchar(33) default '', "
|
||||||
|
"sres varchar(33) default '', "
|
||||||
|
"ki varchar(33) default '', "
|
||||||
|
"kc varchar(33) default '', "
|
||||||
"RRLPSupported int(1) default 1 not null, "
|
"RRLPSupported int(1) default 1 not null, "
|
||||||
"regTime INTEGER default 0 NOT NULL" // Unix time of most recent registration
|
"hardware VARCHAR(20), "
|
||||||
|
"regTime INTEGER default 0 NOT NULL," // Unix time of most recent registration
|
||||||
|
"a3_a8 varchar(45) default NULL"
|
||||||
")"
|
")"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user