From http://www.newlc.com/en/How-to-retrive-the-IMSI-number.html
IMSI is an abbreviation for "International Mobile Subscriber Identity". The IMSI number is a unique 15-digit code that is attached to every SIM (Subscriber Identification Module) card and makes it possible for mobile networks to identify the home country and network of a subscriber.
The structure of the IMSI is as follow:
MCC | MNC | MSIN |
---|
Where:
MCC is the Mobile Country Code which indicate from which country the SIM comes. This list of country code is defined in recommendation ITU E.212. You can get a list of these on Wikipedia
MNC is the Mobile Network Code and identifies the network operator (Orange, Vodafone, etc....). The link to the Wikipedia list of Mobile Network Code
MSIN is the Mobile Subscriber Identification Number which identifies the user (but is different from the phone number!).
UIQ platform
The IMSI number can be obtained from Sony Ericsson P800 and P900 smartphones for use in C++ applications by reading the contents of the file C:/System/data/imsi.txt
This file will be updated automatically if the SIM card is changed.
Some system processes keep this file open and therefore the file needs to be opened in shared mode for readers. This is done by using the EFileShareReadersOnly flag when opening the file. The following C++ code reads the contents of imsi.txt and displays it on the screen:
Series 60 Platform
On the Series 60 platform, the same is possible for the phones that support the 3rd Party Telephony API (this means phones based on S60 v2 FP3 and later).
The IMSI can be obtained using the following code:
TRequestStatus status;
CTelephony::TSubscriberIdV1 subscriberId;
CTelephony::TSubscriberIdV1Pckg subscriberIdPckg(subscriberId);
telephony->GetSubscriberId(status, subscriberIdPckg));
User::WaitForRequest(status);
User::LeaveIfError(status);
TPtrC theIMSI(subscriberId.iSubscriberId);
fs.Connect();
RFile file;
_LIT(KImsiFileName,"C://System//data//imsi.txt");
TInt res = file.Open(fs,KImsiFileName,
EFileShareReadersOnly|EFileStreamText);
if(res != KErrNone)
{
gConsole->Printf(_L("Open failed: %d/n"),res);
}
else
{
TBuf8<128> buf;
file.Read(buf);
file.Close();
fs.Close();
TBuf<128> printBuf;
printBuf.Copy(buf);
gConsole->Printf(_L("IMSI: "));
gConsole->Printf(printBuf);
gConsole->Printf(_L("/n"));
}