When creating some of the SMS demo scripts a basic error was made when deleting the mass of "Hey, welcome to your air time package" SMS messages from the SIM.
Somewhere along the line a few stray messages had not been deleted properly and caused problems until it was noted that the index number of the message did not match the reported one in the demo program (doh!)
Breaking out into a minicom session and directly listing the SMS messages highlighted this :
You can see there that the message index numbers were 24 and 41 (and not 0 and 1!) so running the below commands then solved this problem and zapped the remaining messages
If you want to delete ALL the SMS messages in one go this can also be achieved via a single AT command, see the example below:
Here we have a total of 6 messages, we can the use a AT command "AT+CMGD=1,4" to delete the lot in one go (this has been included as a handy command deleteallsmsmessages in /usr/local/bin)
As expected once this has been competed the messages are now all deleted :
These pages give further information on reading and deleting SMS messages