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

Maria Hientono picture Maria Hientono · May 22, 2012 · Viewed 29.5k times · Source

I have several question about MSISDNs. I understand:

  1. MSISDN is the basically the phone number
  2. It is not IMSI

What i need to know further are:

  1. 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?

  2. 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 Android

    Phone.getDevicePhoneNumber(true); --> for Blackberry

  3. As code above, the return String data is fetched from the device itself or from the SIM Card?

Answer

darryn.ten picture darryn.ten · Jun 21, 2012

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.