MSISDN : 是SIM卡数据吗?为什么所有提供的功能(来自 Blackberry 和 Android)获取 MSISDN 都不可靠?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10695601/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MSISDN : Is it a SIM Card Data? Why all The Provided Function (from Blackberry and Android) to fetch MSISDN not reliable?
提问by Maria Hientono
I have several question about MSISDNs. I understand:
我有几个关于 MSISDN 的问题。我明白:
- MSISDN is the basically the phone number
- It is not IMSI
- MSISDN基本上是电话号码
- 这不是 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?
MSISDN 号码是否被烧毁(存储)在 SIM 卡中?如果是,是否所有提供商都确保 SIM 卡中有 MSISDN 信息?如果不是,请澄清一下,没有任何编程代码可以获取MSISDN号?
有些人建议按以下代码获取 MSISDN。但是,如果设备中未设置“我的电话号码”,则两个代码都返回 null。相反,如果设置了“我的电话号码”,它将返回。因此,问题是:“我的电话号码”是否等于 MSISDN?
TelephonyManager.getLine1Number();
--> 安卓Phone.getDevicePhoneNumber(true);
--> 黑莓如上代码,返回的String数据是从设备本身还是从SIM卡中获取?
回答by darryn.ten
I have some insight into the matter for you.
我对你有一些了解。
- The MSISDN canbe 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.
- MSISDN可以存储在 SIM 卡上,但是大多数网络提供商(南非的所有提供商)不会将 MSISDN 存储在 SIM 卡上。造成这种情况的原因有很多,最值得注意的是:
- 动态 MSISDN 分配:预付费 SIM 在首次使用时有时会被分配一个 MSISDN。这意味着网络有一个可用的 MSISDN 池,并在新的预付费 SIM 上线时分配它们。这意味着在运送 SIM 卡时,它们还没有 MSISDN,这意味着您无法在运送 SIM 卡之前存储 MSISDN。一些网络在一段时间不活动后“过期”MSISDN 分配,特别是当它们的可用号码不足时,并将这些号码返回到可用池。
- 移动号码可移植性:一些国家/地区允许移动用户保留其 MSISDN 但更改网络。这意味着 MSISDN 将从用于 1 个网络的 SIM 移动到用于另一个网络的 SIM。
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.
因此,用户经常会以 SIM 卡上的 MSISDN 条目为空。用户仍然可以自己在 SIM 卡上存储 MSISDN,但这也允许他们存储任意号码,并且不能保证它是设置的,甚至是订户的实际电话号码。
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.
2. 您询问的那些电话会提取存储在 SIM 卡中的号码。如果未设置号码,您将不会得到它,如果用户设置了错误的号码,那么您将获得不正确的详细信息。
3. Correct, this string is fetched from the SIM itself.
3. 正确,这个字符串是从 SIM 卡本身获取的。
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.
当移动运营商在标题中包含 MSISDN 时,我检测 MSISDN 的唯一半可靠方法是通过 WAP/WEB(您可以执行一些 webview 技巧以查看正在通过的标题) - 但是您只能在网络连接时看到这些支持它,如果用户使用移动数据 - 即如果用户使用 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.
我能想到的另一种机制(我能想到的唯一保证机制)是通过 USSD 会话,因为您总是从运营商那里获得正确的 MSISDN,但我还没有找到以编程方式打开 USSD 会话并阅读的方法响应(至少在 Android 中)。我有一个 USSD 服务,它的唯一输出是 MSISDN,但不幸的是,这还没有证明对我有用。
回答by Szilard Barany
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):
由于在您发布问题后的最后一个小时内没有人回复,以下是我所知道的(虽然我不是这方面的专家,只是有一些经验):
- MSISDN is the phone number; the number people can call you on.
- It cannot be "burnt" into the sim card as you can change sim card (upgrade or changing to other operator) and keep your phone number = MSISDN. I think there is a mapping table at the operators that covert from sim card ID to MSISDN and back when call/data transfer is made. The MSISDN might be stored on the card.
- MSISDN 是电话号码;人们可以给你打电话的号码。
- 它不能“烧”到sim卡中,因为您可以更换sim卡(升级或更换其他运营商)并保留您的电话号码= MSISDN。我认为运营商有一个映射表,可以在进行呼叫/数据传输时将 SIM 卡 ID 转换为 MSISDN 并返回。MSISDN 可能存储在卡上。
回答by Mikhail Levin
You should take into account that MSISDN has BIGINT type. Therefore outputting it make type transformation in advance, like this
您应该考虑到 MSISDN 具有 BIGINT 类型。因此输出它提前进行类型转换,像这样