I have several question about MSISDNs. I understand:
- MSISDN is the basically the phone number
- It is not IMSI
What i need to know further are:
Is MSISDN number burnt (stored) in SIM Card? If it is yes, are all providers make sure that there is MSISDN information in SIM Card? If it is no, to be clarified, None of programming code can fetch the MSISDN number?
Some people suggest to fetch MSISDN as below code. But both the code return null if "My Phone Number" is not set in device. On the other way around, it will return the "My Phone Number" if it is set. Thus, the question is: "My Phone Number" equals to MSISDN?
TelephonyManager.getLine1Number();
--> for AndroidPhone.getDevicePhoneNumber(true);
--> for BlackberryAs code above, the return String data is fetched from the device itself or from the SIM Card?
I have some insight into the matter for you.
So the user often ends up with the MSISDN entry on the SIM being blank. The user can still store the MSISDN on the SIM themselves, but this also allows them to store any arbitrary number, and it is not guaranteed to be set or to even be the subscribers actual phone number.
2. Those calls you asked about fetch the number that is stored in the SIM card. If the number is not set you won't get it, and if the user has the wrong number set then you will have the incorrect details.
3. Correct, this string is fetched from the SIM itself.
The only semi-reliable way I have for detecting MSISDN is via WAP/WEB when the Mobile Operator includes the MSISDN in the headers (you can do some webview trickery to see what headers are coming through) - however you only see these if the network supports it and if the user is on Mobile Data - i.e. It won't work if the user is on WiFi.
The other mechanism I can think of (the only guaranteed mechanism I can think of) is via a USSD session, as you always get the correct MSISDN from the operator, but I haven't found a way of programatically opening a USSD session and reading the response (in Android at least). I have a USSD service whose only output is the MSISDN but unfortunately this hasn't proven usable to me yet.
Since nobody replied in the last hour since you posted your question, here is what I know (although I am not an expert in this area, just have some experience):
You should take into account that MSISDN has BIGINT type. Therefore outputting it make type transformation in advance, like this