Msisdn:Is It a Sim Card Data? Why All the Provided Function (From Blackberry and Android) to Fetch Msisdn Not Reliable

MSISDN : Is it a SIM Card Data? Why all The Provided Function (from Blackberry and Android) to fetch MSISDN not reliable?

I have some insight into the matter for you.

  1. The MSISDN can be stored on the SIM card, however most network providers (all providers in South Africa) do not store the MSISDN on the SIM card. There are several reasons for this, the most notable being:
    • Dynamic MSISDN allocation: Prepaid SIMs are sometime allocated an MSISDN when they are first used. This means that the network has a pool of available MSISDNs and allocate them whenever a new prepaid SIM comes online. This means that when the SIMs are shipped they do not have an MSISDN yet, which means you can't store an MSISDN prior to shipping the SIMs. Some networks 'expire' MSISDN allocations after a period of inactivity, especially when their available numbers are running low, and return these numbers to the available pool.
    • Mobile Number Portability: Some countries allow mobile subscribers to keep their MSISDN but change networks. This means that the MSISDN will be moved from a SIM that is for 1 network to a SIM that is for another network.

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.

Getting reliable MSISDN from Android Phone? VoiceMailNumber Line1Number

It wont be 100% reliable if you use getVoiceMailNumber(). A lot of times this may give the phone number but what if the handset gets a firmware update and this number changes to something else? say a short code? So no, it is not reliable.

If you can get the number from getLine1Number() then why dont you prompt user to enter the number? You can verify it by sending that number an SMS message with a short code, which the user will be required to enter in the app before proceeding further.

Get MSISDN from the SIM using Android

The MSISDN (aka the mobile phone number) isn't a SIM data, so you can't retrieve it. The SIM card has an IMSI (International Mobile Subsriber Identity) that is sent to the HLR (Home Location Register) in charge of doing the mapping MSISDN/IMSI.
Mobile phone operators could store the MSISDN on the SIM card if they wanted to, but since it is not required in the GSM protocol it isn't.

Sorry!

For more info look at this discussion Getting phone number also How android get MSISDN

EDIT:

To get IMSI number,

 TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();

but a few handsets only return 6 digits instead of 15. So, you can use,

According to this post: http://www.anddev.org/tinytut_-_getting_the_imsi_-_imei_sim-device_unique_ids-t446.html

String imei = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);

For more info look at This Question and class SystemProperties

How to fetch current sim number

It is not guaranteed that getLine1Number() will always return SIM card's number on all devices. Because the availability of number depends on its storage in the SIM card.

If the number is not stored/available in SIM card then the method will return empty string.

In order to get user's phone number, you should send an sms from user's device to your server or device (same as Viber or other app does). And for a good practice make sure it is done with user's acknowledgement.

Not able to get the SIM number when I use Airtel provider SIM card in Android?

It is because the MSISDN number is not filled on the SIM card by the operator. unfortunately nothing you can do about that.

Thread with some insight on it here



Related Topics



Leave a reply



Submit