Sim number identification of a mobile

Please, help me to find a mobile number of a sim in a phone (May be single sim or dual sim)

This says it automatically gives the preferred SIM:
Telephony manager

This should work, but I haven’t tested it out with dual SIM:
AndroID