25.2. Syntax of the +CMGS AT Command in SMS Text Mode
In SMS text mode, the syntax of the +CMGS AT command is: (Optional parameters are enclosed in square brackets.)
+CMGS=address[,address_type]<CR>sms_message_body<Ctrl+z>
Before we discuss each of the parameters, let's see an example that gives you some idea of how an actual command line should look like:
AT+CMGS="+85291234567",145<CR>This is an example for illustrating the syntax of the +CMGS AT command in SMS text mode.<Ctrl+z>
The address Parameter
The first parameter of the +CMGS AT command, address, specifies the destination address to send the SMS message to. Usually it is a mobile number formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For example, "+85291234567", "91234567", etc. Note that the value passed to the address parameter should be a string, i.e. it should be enclosed in double quotes.
The address_type Parameter
The second parameter of the +CMGS AT command, address_type, specifies the type of the address assigned to the address parameter. Two values are commonly used. They are 129 and 145:
129. It means the value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the value of address is an international number, a national number or a number of other types. Example addresses: "85291234567", "91234567".
145. It means the value of address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. Example address: "+85291234567".
As address_type is an optional parameter, it can be omitted. If you do so, the GSM/GPRS modem or mobile phone will use the default value of the address_type parameter, which is:
129 if the value of address does not start with a "+" character. For example, "85291234567".
145 if the value of address starts with a "+" character. For example, "+85291234567".
The <CR> Character
<CR>, which represents the carriage return character, follows the address_type parameter. When the GSM/GPRS modem or mobile phone receives the carriage return character, it will send back a prompt formed by these four characters: the carriage return character, the linefeed character, the ">" character and the space character. If you don't understand what this means, don't worry. This should be clear to you when you see the example in the section "Example Demonstrating How to Use the +CMGS AT Command to Send SMS Text Messages in SMS Text Mode".
The sms_message_body Parameter
The third parameter of the +CMGS AT command, sms_message_body, specifies the body of the SMS message to be sent. Entering the <Esc> character will cancel the +CMGS AT command. If you don't understand what this means, see the example in the section "Example Demonstrating How to Use the +CMGS AT Command to Send SMS Text Messages in SMS Text Mode".
The <Ctrl+z> Character
When you finish entering the SMS message body, you have to enter the <Ctrl+z> character to mark the end of the SMS message body. The GSM/GPRS modem or mobile phone will then attempt to send the SMS message to the SMS center.
Previous Page | Page 45 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)