Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AT command to know own phone number

Tags:

at-command

I have been working lately on AT commands testing. I had difficulties in finding the own number when the sim is not subscribed for SMS and voice calls(in some special cases where sim is used for lab experimenting). Is there any way to know own phone number using AT command. Say for airtel(india) the ussd code for own msisdn number is *121*9#. So if I dial ATD*121*9#, will I get the message displayed on AT command user interface. Or is there another way to know the own phone number? Help greatly appreciated.

like image 695
Sarwan Avatar asked Sep 22 '14 08:09

Sarwan


People also ask

How can I see my own number?

Check Your Phone Settings The most popular way to locate your phone number on Android is to go to Settings > About phone/device > Status/phone identity > Network. This varies marginally on Apple products, where you can go to Settings > Phone > My Number.

What do I do if I forgot my phone number?

Make a call from your phone to another phone. A friend should be able to tell you. Also check your contacts. Some phones keep your own number in there.

How do I know my number in TNT?

Open Settings on Android Probably the easiest way to know your SIM card number with any network is to open Settings and then going to About phone > Status > My phone number.


4 Answers

AT+CNUM returns the MSISDNs related to the subscriber.

But in many cases it will just return OK. This is because +CNUM command reads a special phone book storage area reserved for the SIM's own phone numbers. The service provider may or may not store the phone number for you.

If you want to read the MSISDN with the +CNUM command and it is not currently programmed, follow the procedure below (but please know that almost every other device has it's own set of rules for AT commands so it may vary from device to device, but the concept will be same): at+cnum?

+CME ERROR: unknown

at+cpbs? - display the active phonebook storage

+CPBS: "SM",250,250

OK

at+cpbs=ON - select the active phonebook storage to MSISDN list

OK

at+cpbs? - display the active phonebook storage,

+CPBS: "ON",0,3 - MSISDN list is empty

OK

at+cpbw=,"+918723976327" - enter your own MSISDN

OK

at+cpbs? - display the active phonebook storage,

+CPBS: "ON",1,3 - MSISDN list has one item

OK

at+cpbr=1 - reading MSISDN list, position 1

+CPBR: 1,"+918723976327",145,"" - own MSISDN

OK

at+cnum

+CNUM: ,"+918723976327",145 - own MSISDN

Hope this helps!

like image 137
Aman Burman Avatar answered Oct 11 '22 19:10

Aman Burman


AT+CNUM should return your own phone number.

like image 30
Eric Fournie Avatar answered Oct 11 '22 19:10

Eric Fournie


If everything else fails, another option is to try to send an SMS to yourself. In my case it worked flawlessy.

AT+CMGF=1
OK
AT+CMGS="my mobile number"
> This is a test.
>
+CMGS: 119

You should end the SMS message with CTRLZ.

like image 24
ntd Avatar answered Oct 11 '22 19:10

ntd


Information from the standard AT command set, available from 3GPP

AT+CNUM returns the subscriber number - but implementation of this AT command is optional.

You can also use the AT commands for USSD transactions, e.g. +CUSD Section 7.15 of TS 27.007 and related commands, to get the subscriber number.

like image 32
user1725145 Avatar answered Oct 11 '22 19:10

user1725145