Fixes #692 in public. This updates the SR (ip/port) for a user on every SIP transaction. Also standardizes SR interface to use just strings, no more external char*. Will modify actual SR later.

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3236 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
Kurtis Heimerl
2012-02-25 21:07:11 +00:00
parent 3f264a9e86
commit ec026dfe2e
5 changed files with 129 additions and 115 deletions

View File

@@ -201,26 +201,25 @@ void Control::LocationUpdatingController(const L3LocationUpdatingRequest* lur, L
throw UnexpectedMessage();
}
LOG(INFO) << *resp;
const char* new_imei = resp->mobileID().digits();
if (!gTMSITable.IMEI(IMSI,new_imei)){
string new_imei = resp->mobileID().digits();
if (!gTMSITable.IMEI(IMSI,new_imei.c_str())){
LOG(WARNING) << "failed access to TMSITable";
}
//query subscriber registry for old imei, update if neccessary
string name = string("IMSI") + IMSI;
char* old_imei = gSubscriberRegistry.sqlQuery("hardware", "sip_buddies", "name", name.c_str());
string old_imei = gSubscriberRegistry.imsiGet(name, "hardware");
//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 << "\"";
if (!new_imei.empty() && (old_imei.empty() || old_imei != new_imei)){
LOG(INFO) << "Updating IMSI" << IMSI << " to IMEI:" << new_imei;
if (!gSubscriberRegistry.sqlUpdate(os2.str().c_str())) {
LOG(INFO) << "SR update problem";
if (!gSubscriberRegistry.imsiSet(name,"RRLPSupported", "1")) {
LOG(INFO) << "SR RRLPSupported update problem";
}
if (!gSubscriberRegistry.imsiSet(name,"hardware", new_imei)) {
LOG(INFO) << "SR hardware update problem";
}
}
if (old_imei)
free(old_imei);
delete msg;
}