• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

SMS AT commands - how can i identify when a new SMS message is received, and which index number the message is stored under.

I know that "AT+CPMS" checks the message storage space, so i can use this to determine when a new message has arrived - but i do not know which index number the SMS is stored at.

I have to use "AT+CMGR=x" (where x is the index number) to check every possible message index.

"AT+CMGF" will list all messages - but takes far to long (typically about 20 seconds).

How can i identify which index number a new SMS message is stored at.
1 Solution
Firstly the exact behaviour depends on the hardware you are using. Which modem are you using?

The easiest way is to enable incoming message notifications bys using AT+CNMI=?,? you should have a look at the specifications to determine which parameters you need. I use AT+CNMI=3,(1-3) depending what I need [(1-3) meaning 1, 2 or 3].

This will give you a unsolicited responce +CMTI <mem>,<index> for new messages.

The only other way is to get the list of messages AT+CMGL (I assume this is what you meant by CMGF in your question as CMGF sets the message format). You would use AT+CMGL=<type>

There are no other short ways to get the new messages which are standard GSM 07.07 commands. There may be proprietary commands from your modem manufacturer but since the SIM processor is not very fast at finding messages it will always be slow.

Have you tried playing around with the message storage location? If you store messages on the modem instead of on the SIM it should perform much better. You can do this using AT+CPMS

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now