25.10.3. Reading the SMSC Number Saved with an SMS Message
Sometimes you may want to find out the SMSC number saved with an SMS message. It is not difficult to do so. The following sections discuss how this can be done through the AT command +CMGR (command name in text: Read Message).
188.8.131.52. SMS Text Mode
In SMS text mode, first assign the value 1 to the AT command +CSDH (command name in text: Show Text Mode Parameters) to tell the GSM/GPRS modem or mobile phone that we want detailed header information. Then use the AT command +CMGR to read the SMS message from the message storage area. The SMSC number can be found in the ninth field of the +CMGR information response.
Here is an example for illustration. Suppose there is an SMS text message "It is easy to send text messages." located at index 5 of the message storage area. To read the SMSC number saved with it, enter the command line "AT+CSDH=1" and then "AT+CMGR=5". The result shown in a terminal program such as HyperTerminal of Microsoft Windows should be something like this:
+CMGR: "STO UNSENT","+85291234567",,145,17,0,0,167,"+85290000000",145,30
It is easy to send text messages.
The value of the ninth field of the +CMGR information response, i.e. +85290000000, is the SMSC number saved with the SMS text message.
184.108.40.206. SMS PDU Mode
If the GSM/GPRS modem or mobile phone is operating in SMS PDU mode, first use the +CMGR AT command to read the SMS message from the message storage area. Then decode the hexadecimal sequence of the fourth field of the +CMGR information response.
Here is an example for illustration. Suppose there is an SMS text message "It is easy to send text messages." located at index 5 of the message storage area. To read the SMSC number saved with it, enter the command line "AT+CMGR=5". In SMS PDU mode, the result shown in a terminal program such as HyperTerminal of Microsoft Windows should be something like this:
The hexadecimal sequence of the fourth field of the +CMGR information response is:
It can be divided into two parts: the SMSC part and TPDU part. Here is the SMSC part:
The SMSC part can be further divided into three sub-fields, like this:
07 91 5892000000F0
The value of the first sub-field 0x07 tells us that the second and third sub-fields consist of 7 octets totally. The value of the second sub-field 0x91 indicates the SMSC number encoded in the third sub-field is in the typical international numbering format. The value of the third sub-field 0x5892000000F0 tells us the SMSC number saved with the SMS text message. To decode the hexadecimal value, group the digits into pairs, like this: 58 92 00 00 00 F0. Then swap the digits in each pair and you will get 85 29 00 00 00 0F. Remove the last "F", because it was placed there to fill the empty bits of the last octet and it is not part of the SMSC number. After that, combine the digits and you will get the SMSC number +85290000000.
More information about the sub-fields is available in the section "The SMSC Part" of this SMS tutorial.
|Previous Page||Page 53 of 65||Next Page|
- 1. Introduction to SMS Messaging
- 2. What Makes SMS Messaging So Successful Worldwide?
- 3. Example Applications of SMS Messaging
- 4. What is an SMS Center / SMSC?
- 5. Basic Concepts of SMS Technology
- 6. Intra-operator SMS Messages
- 7. Inter-operator SMS Messages
- 8. International SMS Messages
- 9. What is an SMS Gateway?
- 10. How to Send SMS Messages from a Computer / PC?
- 11. How to Receive SMS Messages Using a Computer / PC?
- 12. Introduction to GSM / GPRS Wireless Modems
- 13. How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem?
- 14. Introduction to AT Commands
- 15. General Syntax of Extended AT Commands
- 16. Result Codes of AT Commands
- 17. AT Command Operations: Test, Set, Read and Execution
- 18. Testing the Communication between the PC and GSM/GPRS Modem or Mobile Phone
- 19. Checking if the GSM/GPRS Modem or Mobile Phone Supports the Use of AT Commands to Send, Receive and Read SMS Messages
- 20. Operating Mode: SMS Text Mode and SMS PDU Mode
- 21. Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)
- 22. Preferred Message Storage (AT+CPMS)
- 23. Writing SMS Messages to Memory / Message Storage (AT+CMGW)
- 24. Deleting SMS Messages from Message Storage (AT+CMGD)
- 25. Sending SMS Messages from a Computer / PC Using AT Commands (AT+CMGS, AT+CMSS)
- 26. Reading SMS Messages from a Message Storage Area Using AT Commands (AT+CMGR, AT+CMGL)
- 27. Appendix A: How to Choose an SMS Service Provider (SMS Gateway Provider, SMS Reseller, SMS Broker)?
- 28. Appendix B: Comparison Table of SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)
- 29. Appendix C: Free Software/Tools and Libraries for Sending and Receiving SMS Messages with a Computer / PC
- 30. Appendix D: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)