0
votes

I'm new to GSM AT Commands and I'm using ZTE MF190S USB 3G USB Modem with Modem Nodejs Module also tried with MS Hyperterminal.

The problem I'm facing that when I receive SMS using AT+CMGL="ALL" from Whatsapp (as example) I got in sender number field 81084326797126204 which is an invalid phone number and should be "Whatsapp" instead although the manufacture's software is showing message from Whatsapp normally.

Note: I tried to decode it as a Hexadecimal string but not done.

> AT+CSCS="GSM"
> AT+CPMS="ME"
> AT+CMGL="ALL"
//Result
+CMGL: 0,"REC UNREAD","81084326797126204",,"20/05/30,14:53:55+08"
        FEFF000000000000000000000000000000000000020

As described in this link

+CMGL: index,message_status,address,[address_text],[service_center_time_stamp][,address_type,sms_message_body_length]sms_message_body[+CMGL: ...]

The address Field

The third field of the information response of the +CMGL AT command, address, is a string that contains the address/phone number stored in the SMS message header. If the SMS message read is an incoming SMS message, the address field contains the originator address. If the SMS message read is an outgoing SMS message, the address field contains the recipient address. Usually the address field value is a phone number formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For example, "+85291234567".

The address_text Field

The fourth field of the information response of the +CMGL AT command, address_text, is a string that contains the text associated to address in the phonebook. For example, if the text "Alice" is associated to the phone number "91234567" in the phonebook, address_text will be "Alice". The AT command +CSCS (command name in text: Select TE Character Set) can be used to specify the character set for displaying address_text. Note that address_text is an optional field. Some GSM/GPRS modems and mobile phones (examples: most Nokia products, including my Nokia 6021) leave this field empty.

How can I identify the message is from Whatsapp or any other services providers names?

1
Let me understand. You would just like to have The "WhatsApp" string in the fourth parameter of AT+CGML? Is there a reason why you can't just identify those messages by parsing that specific number from every message displayed in the list? Have you tried to insert that number in the phonebook?Roberto Caboni
You would just like to have The "WhatsApp" string in the fourth parameter of AT+CGML? Yes Exactly, i don't know why it's can't be displayed as well as manufacture's software, i think maybe there is missing command to show more details about SMS, i've tried AT+CSDH=1 to get SMS header also tried with Text and PDU modes.Mamdouh Saeed
I've tried to write an answer. I'm not 100% sure it will solve your issue, but it could be helpful anyway for someone with a similar issue.Roberto Caboni

1 Answers

0
votes

You wrote

The fourth field of the information response of the +CMGL AT command, address_text, is a string that contains the text associated to address in the phonebook

If your device used to recognize that number, it probably was in one of device's phonebooks, and maybe it got deleted.

What you can try to do is to store again the number using AT+CPBW command:

AT+CPBW=[<index>][,<number>[,<type>[,<text>]]]

where

  • index is the record position in the phonebook. If omitted the record is stored in the first free position
  • number is the number to be stored in phonebook, in string format
  • type is the number type; 129 for national scheme, 145 for international scheme
  • text is the name of the entry in the phonebook

So, in your case:

AT+CPBW=,"81084326797126204",129,"WhatsApp"

And after it you should see the name appearing in +CGML list. You might need a device reboot after the PB write in order to see the change making effect.

The change is done in the current phonebook, usually the SIM card. It can be queried with command AT+CPBS? (it also allows to change it; see the guide for further explanation).

I suggest exploring the content of every phonebook, in order to discover any device (and SIM) default contents. The command to read phonebook entries is **AT+CPBR**. Providing

AT+CPBR=1,N

all index between 1 and N are shown. If you set N to the size of the phonebook, you can list all the entries in it.