Hi, I am not sure about the legal details. However I believe there is an option to get IMSI number.
Refer this link - this java class has methods to retrieve IMSI code. (Even works for Dual SIM!!)
getStringOfInt(context, "<predictedMethodName>", 0);
getStringOfInt(context, "<predictedMethodName>", 1);
Actually, the lines of code provided above retrieves the information we request. You may have to try additional predicated method names, if the provided methods doesn't work for you.
Hope this helps.