Short Message Service / SMS Tutorial



Short Message Service / SMS TutorialSMS (Short Message Service) has achieved huge success in the wireless world. Billions of SMS messages are sent every day. SMS is now a major revenue generator for wireless carriers. A lot of innovative applications are now built on top of the SMS technology and more are being developed.This SMS tutorial provides information about SMS application development. It begins with an introduction of mobile messaging technologies like SMS, concatenated SMS and EMS. You will learn what SMS is, what causes SMS messaging to be so popular worldwide, what applications can be developed with the SMS technology, what SMS center and SMS gateway are, and some other basic concepts of SMS messaging.After that, we will discuss in detail various ways to send and receive SMS messages from a computer, the advantages and disadvantages of each way, what SMS service providers are, the hardware (e.g. GSM / GPRS modem) and software (e.g. HyperTerminal) required to send and receive SMS messages from a computer, and where to find some free SMS messaging libraries and tools.Note to non-developers:This SMS tutorial contains technical information that non-developers may not interested in. If you are an ordinary user who do not want to develop SMS software or applications but just want to send and receive SMS messages from a PC, you may want to go directly to our?quick guide for non-developers.Table of Contents1. Introduction to SMS Messaging1.1. What is SMS (Short Message Service)?1.2. Concatenated SMS Messages / Long SMS Messages1.3. EMS (Enhanced Messaging Service)2. What Makes SMS Messaging So Successful Worldwide?2.1. SMS Messages can be Sent and Read at Any Time2.2. SMS Messages can be Sent to an Offline Mobile Phone2.3. SMS Messaging is Less Disturbing While You can Still Stay in Touch2.4. SMS Messages are Supported by 100% GSM Mobile Phones and They can be Exchanged between Different Wireless Carriers2.5. SMS is a Suitable Technology for Wireless Applications to Build on3. Example Applications of SMS Messaging3.1. Person-to-Person Text Messaging3.2. Provision of Information3.3. Downloading3.4. Alerts and Notifications3.4.1. Email, Fax and Voice Message Notifications3.4.2. E-commerce and Credit Card Transaction Alerts3.4.3. Stock Market Alerts3.4.4. Remote System Monitoring3.5. Two-way Interactive Text Messaging Applications3.6. SMS Marketing4. What is an SMS Center / SMSC?5. Basic Concepts of SMS Technology5.1. Validity Period of an SMS Message5.2. Message Status Reports5.3. Message Submission Reports5.4. Message Delivery Reports6. Intra-operator SMS Messages6.1. Transmission Process of Intra-operator SMS Messages7. Inter-operator SMS Messages7.1. Transmission Process of Inter-operator SMS Messages8. International SMS Messages9. What is an SMS Gateway?9.1. Open Source and Free SMS Gateway Software10. How to Send SMS Messages from a Computer / PC?10.1. The 1st Way: Sending SMS Messages from a Computer Using a Mobile Phone or GSM/GPRS Modem10.1.1. Major Drawback of Sending SMS Messages through a Mobile Phone or GSM/GPRS Modem -- Low SMS Sending Rate10.2. The 2nd Way: Sending SMS Messages from a Computer through a Connection to the SMSC or SMS Gateway of a Wireless Carrier or SMS Service Provider10.2.1. Difficulties in Getting a Direct Connection to the SMSC or SMS Gateway of a Wireless Carrier10.2.2. SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)10.2.3. Sending SMS Messages Using a Protocol / Interface Supported by an SMSC or SMS Gateway11. How to Receive SMS Messages Using a Computer / PC?11.1. The 1st Way: Using a Computer to Receive SMS Messages through a Mobile Phone or GSM/GPRS Modem11.2. The 2nd Way: Using a Computer to Receive SMS Messages through a Connection to the SMSC or SMS Gateway of a Wireless Carrier11.3. The 3rd Way: Using a Computer to Receive SMS Messages through a Connection to the SMS Gateway of an SMS Service Provider11.3.1. SIM Hosting11.3.1.1. Cost of SIM Hosting Service11.3.2. Shared Phone Number11.3.2.1. Registering Keywords11.3.2.2. Cost of Shared Phone Number Service11.4. Receiving SMS Messages Using a Protocol / Interface Supported by an SMSC or SMS Gateway12. Introduction to GSM / GPRS Wireless Modems12.1. What is a GSM Modem?12.2. What is a GPRS Modem?12.3. Which is Better: Mobile Phone or GSM / GPRS Modem?13. How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem?13.1. What is Microsoft HyperTerminal?13.2. The Procedure for Sending AT Commands to a Mobile Phone or GSM/GPRS Modem Using MS HyperTerminal14. Introduction to AT Commands14.1. Basic Commands and Extended Commands15. General Syntax of Extended AT Commands15.1. Information Response and Final Result Code15.2. Case Sensitivity of AT Commands16. Result Codes of AT Commands16.1. Final Result Codes of AT Commands16.1.1. The OK Final Result Code16.1.2. The ERROR Final Result Code16.2. Final Result Code Specific to SMS AT Commands16.2.1. The +CMS ERROR Final Result Code -- Notifies the Occurrences and Causes of Message Service Failures16.2.1.1. Table of +CMS Error Codes and Their Meanings16.3. Unsolicited Result Codes of AT Commands17. AT Command Operations: Test, Set, Read and Execution17.1. Test Command -- Checks Whether a Certain AT Command is Supported17.2. Set Command -- Changes the Settings Used for Certain Tasks17.3. Read Command -- Retrieves the Current Settings Used for Certain Tasks17.4. Execution Command -- Performs an Action or Retrieve Information/Status about the GSM/GPRS Modem or Mobile Phone18. Testing the Communication between the PC and GSM/GPRS Modem or Mobile Phone19. Checking if the GSM/GPRS Modem or Mobile Phone Supports the Use of AT Commands to Send, Receive and Read SMS Messages19.1. Using the AT Command +CSMS to Check if Mobile-originated SMS Messages and Mobile-terminated SMS Messages are Supported19.2. Checking if the AT Commands Required for Sending, Receiving and Reading SMS Messages are Supported19.2.1. Overview of the AT Commands Required19.2.2. Beginning the Check20. Operating Mode: SMS Text Mode and SMS PDU Mode20.1. Comparison of SMS Text Mode and SMS PDU Mode20.2. Selecting the Operating Mode (AT+CMGF)21. Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)21.1. Syntax of the +CSCA AT Command21.1.1. Setting the Service Center Address21.1.2. Reading the Service Center Address21.2. Example Demonstrating How to Use the +CSCA AT Command to Set and Read the Service Center Address22. Preferred Message Storage (AT+CPMS)22.1. Selecting the Message Storage Areas to be Used for SMS Reading, Writing, Deleting, Sending or Receiving22.2. Format of the Information Response of the +CPMS AT Command22.3. Finding the Message Storage Areas Supported by a GSM/GPRS Modem or Mobile Phone22.4. Example Demonstrating How to Use the +CPMS AT Command to Select the Message Storage Areas to be Used22.5. Finding the Message Storage Areas Currently Used, Number of Messages Currently Stored and Maximum Number of Messages Allowed22.5.1. Example23. Writing SMS Messages to Memory / Message Storage (AT+CMGW)23.1. Syntax of the +CMGW AT Command in SMS Text Mode23.2. SMSC Number Stored with the SMS Message (SMS Text Mode)23.3. Format of the Information Response of the +CMGW AT Command in SMS Text Mode23.4. Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text Mode23.5. Syntax of the +CMGW AT Command in SMS PDU Mode23.6. SMSC Number Stored with the SMS Message (SMS PDU Mode)23.7. Format of the Information Response of the +CMGW AT Command in SMS PDU Mode23.8. Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS PDU Mode24. Deleting SMS Messages from Message Storage (AT+CMGD)24.1. Syntax of the +CMGD AT Command24.2. Finding the Supported Indexes and Flag Values24.3. Example Demonstrating How to Use the +CMGD AT Command to Delete SMS Text Messages25. Sending SMS Messages from a Computer / PC Using AT Commands (AT+CMGS, AT+CMSS)25.1. Comparison Table of the AT Commands +CMGS and +CMSS25.2. Syntax of the +CMGS AT Command in SMS Text Mode25.3. Format of the Information Response of the +CMGS AT Command in SMS Text Mode25.4. Example Demonstrating How to Use the +CMGS AT Command to Send SMS Text Messages in SMS Text Mode25.5. Syntax of the +CMGS AT Command in SMS PDU Mode25.5.1. Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT Command25.5.1.1. The SMSC Part25.5.1.2. The TPDU Part (SMS-SUBMIT TPDU)25.6. Format of the Information Response of the +CMGS AT Command in SMS PDU Mode25.7. Example Demonstrating How to Use the +CMGS AT Command to Send SMS Text Messages in SMS PDU Mode25.8. Syntax of the +CMSS AT Command in SMS Text Mode and PDU Mode25.9. Format of the Information Response of the +CMSS AT Command in SMS Text Mode and PDU Mode25.10. SMSC Number to be Used by the +CMSS AT Command to Send SMS Messages25.10.1. SMS Text Mode25.10.2. SMS PDU Mode25.10.2.1. Case 1: SMSC Part is Not "00"25.10.2.2. Case 2: SMSC Part is "00"25.10.3. Reading the SMSC Number Saved with an SMS Message25.10.3.1. SMS Text Mode25.10.3.2. SMS PDU Mode25.11. Example Demonstrating How to Use the +CMSS AT Command to Send Text Messages from a Message Storage Area (SMS Text Mode and SMS PDU Mode)26. Reading SMS Messages from a Message Storage Area Using AT Commands (AT+CMGR, AT+CMGL)26.1. Comparison Table of the AT Commands +CMGR and +CMGL26.2. Using the +CMGR AT Command to Read an SMS Message from a Message Storage Area26.2.1. Syntax of the +CMGR AT Command in SMS Text Mode26.2.2. Format of the Information Response of the +CMGR AT Command in SMS Text Mode26.2.2.1. Incoming SMS Messages and Outgoing SMS Messages26.2.2.2. Details of the Fields that Appear in the +CMGR Information Response26.2.3. Example Demonstrating How to Use the +CMGR AT Command to Read SMS Text Messages from a Message Storage Area (SMS Text Mode)26.2.4. Syntax of the +CMGR AT Command in SMS PDU Mode26.2.5. Format of the Information Response of the +CMGR AT Command in SMS PDU Mode26.2.6. Some Explanation about the Decoding of the SMSC_number_and_TPDU Field Value of the +CMGR AT Command26.2.6.1. Incoming SMS Messages and Outgoing SMS Messages26.2.6.2. The SMSC Part26.2.6.3. The TPDU Part (SMS-DELIVER TPDU)26.2.7. Example Demonstrating How to Use the +CMGR AT Command to Read SMS Text Messages from a Message Storage Area (SMS PDU Mode)26.3. Using the +CMGL AT Command to List SMS Messages of a Certain Status from a Message Storage Area26.3.1. Syntax of the +CMGL AT Command in SMS Text Mode26.3.2. Format of the Information Response of the +CMGL AT Command in SMS Text Mode26.3.3. Finding the Message Status Values Supported by the +CMGL AT Command in SMS Text Mode26.3.4. Example Demonstrating How to Use the +CMGL AT Command to List SMS Text Messages from a Message Storage Area (SMS Text Mode)26.3.5. Syntax of the +CMGL AT Command in SMS PDU Mode26.3.6. Format of the Information Response of the +CMGL AT Command in SMS PDU Mode26.3.7. Finding the Message Status Values Supported by the +CMGL AT Command in SMS PDU Mode26.3.8. Example Demonstrating How to Use the +CMGL AT Command to List SMS Text Messages from a Message Storage Area (SMS PDU Mode)Appendix A: How to Choose an SMS Service Provider (SMS Gateway Provider, SMS Reseller, SMS Broker)?This article discusses 13 factors you have to consider when choosing an SMS service provider (also known as SMS gateway provider, SMS reseller and SMS broker) for your mobile messaging application.Page 1?-?Page 2?-?Page 3Appendix B: Comparison Table of SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)The links to the web site of some SMS service providers (also known as SMS gateway providers, SMS resellers and SMS brokers) are listed in this comparison table. You can find a comparison of different SMS service providers' SMS cost, payment options, network coverage, protocols supported, 2-way SMS messaging service, SMS reverse billing (premium SMS) service, etc.Appendix C: Free Software/Tools and Libraries for Sending and Receiving SMS Messages with a Computer / PCThe links to some free software, tools and libraries for sending and receiving SMS messages with a computer are provided in this article. This article should be useful to both developers and non-developers.Appendix D: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)A reference table that lists all characters and their decimal and hexadecimal codes as defined in the "GSM 7-bit default alphabet" text coding scheme. The corresponding character codes defined in ISO 8859 Latin 1 are also provided in the table for ease of reference.1. Introduction to SMS Messaging1.1. What is SMS (Short Message Service)?SMS stands for Short Message Service. It is a technology that enables the sending and receiving of messages between mobile phones. SMS first appeared in Europe in 1992. It was included in the GSM (Global System for Mobile Communications) standards right at the beginning. Later it was ported to wireless technologies like CDMA and TDMA. The GSM and SMS standards were originally developed byETSI. ETSI is the abbreviation for European Telecommunications Standards Institute. Now the?3GPP(Third Generation Partnership Project) is responsible for the development and maintenance of the GSM and SMS standards.As suggested by the name "Short Message Service", the data that can be held by an SMS message is very limited. One SMS message can contain at most 140 bytes (1120 bits) of data, so one SMS message can contain up to:160 characters if 7-bit character encoding is used. (7-bit character encoding is suitable for encoding Latin characters like English alphabets.)70 characters if 16-bit Unicode UCS2 character encoding is used. (SMS text messages containing non-Latin characters like Chinese characters should use 16-bit character encoding.)SMS text messaging supports languages internationally. It works fine with all languages supported by Unicode, including Arabic, Chinese, Japanese and Korean.Besides text, SMS messages can also carry binary data. It is possible to send ringtones, pictures, operator logos, wallpapers, animations, business cards (e.g. VCards) and WAP configurations to a mobile phone with SMS messages.One major advantage of SMS is that it is supported by 100% GSM mobile phones. Almost all subscription plans provided by wireless carriers include inexpensive SMS messaging service. Unlike SMS, mobile technologies such as WAP and mobile Java are not supported on many old mobile phone models.1.2. Concatenated SMS Messages / Long SMS MessagesOne drawback of the SMS technology is that one SMS message can only carry a very limited amount of data. To overcome this drawback, an extension called concatenated SMS (also known as long SMS) was developed. A concatenated SMS text message can contain more than 160 English characters. Concatenated SMS works like this: The sender's mobile phone breaks down a long message into smaller parts and sends each of them as a single SMS message. When these SMS messages reach the destination, the recipient mobile phone will combine them back to one long message.The drawback of concatenated SMS is that it is less widely supported than SMS on wireless devices.1.3. EMS (Enhanced Messaging Service)Besides the data size limitation, SMS has another major drawback -- an SMS message cannot include rich-media content such as pictures, animations and melodies. EMS (Enhanced Messaging Service) was developed in response to this. It is an application-level extension of SMS. An EMS message can include pictures, animations and melodies. Also, the formatting of the text inside an EMS message is changeable. For example, the message sender can specify whether the text in an EMS message should be displayed in bold or italic, with a large font or a small font.The drawback of EMS is that it is less widely supported than SMS on wireless devices. Also, many EMS-enabled wireless devices only support a subset of the features defined in the EMS specification. A certain EMS feature may be supported on one wireless device but not on the other.2. What Makes SMS Messaging So Successful Worldwide?SMS is a success all over the world. The number of SMS messages exchanged every day is enormous. SMS messaging is now one of the most important revenue sources of wireless carriers. What is so special about SMS that makes it so popular worldwide? Some of the reasons are discussed below.2.1. SMS Messages can be Sent and Read at Any TimeNowadays, almost every person has a mobile phone and carries it most of the time. With a mobile phone, you can send and read SMS messages at any time, no matter you are in your office, on a bus or at home.2.2. SMS Messages can be Sent to an Offline Mobile PhoneUnlike a phone call, you can send an SMS message to your friend even when he/she has not switched on the mobile phone or when he/she is in a place where the wireless signal is temporarily unavailable. The SMS system of the mobile network operator will store the SMS message and later send it to your friend when his/her mobile phone is online.2.3. SMS Messaging is Less Disturbing While You can Still Stay in TouchUnlike a phone call, you do not need to read or reply an SMS message immediately. Besides, writing and reading SMS messages do not make any noise. While you have to run out of a theater or library to answer a phone call, you do not need to do so if SMS messaging is used.2.4. SMS Messages are Supported by 100% GSM Mobile Phones and They can be Exchanged between Different Wireless CarriersSMS messaging is a very mature technology. All GSM mobile phones support it. Not only that you can exchange SMS messages with mobile users of the same wireless carrier, but you can also exchange SMS messages with mobile users of many other wireless carriers worldwide.2.5. SMS is a Suitable Technology for Wireless Applications to Build onHere are some of the reasons that make SMS a suitable technology for wireless applications to build on:Firstly, SMS messaging is supported by 100% GSM mobile phones. Building wireless applications on top of the SMS technology can maximize the potential user base.Secondly, SMS messages are capable of carrying binary data besides text. They can be used to transfer ringtones, pictures, operator logos, wallpapers, animations, VCards, VCals (calendar entries), etc.Thirdly, SMS supports reverse billing, which enables payment to be made conveniently. For example, suppose you want to develop a commercial ringtone download application that charges a fee from the user for each ringtone downloaded. One way to accept payment is to use a reverse billing phone number obtained from a wireless carrier. To buy a ringtone, the user will write an ordinary SMS text message that contains the ID of the ringtone he/she wants to buy and send it to your SMS application's reverse billing phone number. Your SMS application will then send back one or more reverse billing SMS messages that carry the ringtone. The user will be charged a fee for the reverse billing SMS messages he/she received. The fee will be included in the user's monthly mobile phone bill or be deducted from his/her prepaid card credits. Depending on the agreement between you and the wireless carrier, all or part of the money received will be given to you.3. Example Applications of SMS MessagingThere are many different kinds of SMS applications on the market today and many others are being developed. Applications in which SMS messaging can be utilized are virtually unlimited. We will describe some common examples of SMS applications below to give you some ideas of what can be done with SMS messaging.3.1. Person-to-Person Text MessagingPerson-to-person text messaging is the most commonly used SMS application and it is what the SMS technology was originally designed for. In these kinds of text messaging applications, a mobile user types an SMS text message using the keypad of his/her mobile phone, then he/she inputs the mobile phone number of the recipient and clicks a certain option on the screen, such as "Send" or "OK", to send the text message out. When the recipient mobile phone receives the SMS text message, it will notify the user by giving out a sound or vibrating. The user can read the SMS text message some time later or immediately and can send a text message back if he/she wants.A chat application is another kind of person-to-person text messaging application that allows a group of people to exchange SMS text messages interactively. In a chat application, all SMS text messages sent and received are displayed on the mobile phone's screen in order of date and time. SMS text messages written by different mobile users may be displayed in different colors for better readability, like this:Me: Let's have a meeting at 10 am tomorrow to discuss the details of our next SMS text messaging application.Tom: OK.Alan: I have another meeting at 10 am. I suggest having the meeting at 11:30 am tomorrow. What do you think?3.2. Provision of InformationA popular application of the SMS technology other than person-to-person text messaging is the provision of information to mobile users. Many content providers make use of SMS text messages to send information such as news, weather report and financial data to their subscribers. Many of these information services are not free. Reverse billing SMS is a common way used by content providers to bill their users. The user is charged a certain fee for each reverse billing SMS message received. The fee will either be included in the monthly mobile phone bill or be deducted from prepaid card credits.3.3. DownloadingSMS messages can carry binary data and so SMS can be used as the transport medium of wireless downloads. Objects such as ringtones, wallpapers, pictures and operator logos can be encoded in one or more SMS messages depending on the object's size. Like information services, wireless download services are usually not free and reverse billing SMS is a common way used by content providers to bill their customers. The object to be downloaded is encoded in one or more reverse billing SMS messages. The mobile user who requests the object will be charged a certain fee for each reverse billing SMS message received. If the mobile user is using a monthly mobile phone service plan, the download fee will be included in his/her next monthly bill; if the mobile user is using a prepaid SIM card, the download fee will be deducted from the prepaid credits.3.4. Alerts and NotificationsSMS is a very suitable technology for delivering alerts and notifications of important events. This is because of two reasons:A mobile phone is a device that is carried by its owner most of the time. Whenever an SMS text message is received, the mobile phone will notify you by giving out a sound or by vibrating. You can check what the SMS text message contains immediately.SMS technology allows the "push" of information. This is different from the "pull" model where a device has to poll the server regularly in order to check whether there is any new information. The "pull" model is less suitable for alert and notification applications, since it wastes bandwidth and increases server load.Some common examples of SMS alert and notification applications are described below.3.4.1. Email, Fax and Voice Message NotificationsIn an email notification system, a server sends a text message to the user's mobile phone whenever an email arrives at the inbox. The SMS text message can include the sender's email address, the subject and the first few lines of the email body. An email notification system may allow the user to customize various filters so that an SMS alert is sent only if the email message contains certain keywords or if the email sender is an important person. The use cases for fax or voice message are similar.3.4.2. E-commerce and Credit Card Transaction AlertsWhenever an e-commerce or credit card transaction is made, the server sends a text message to the user's mobile phone. The user can know immediately whether any unauthorized transactions have been made.3.4.3. Stock Market AlertsIn a stock market alert application, a program is constantly monitoring and analyzing the stock market. If a certain condition is satisfied, the program will send a text message to the user's mobile phone to notify him/her of the situation. For example, you can configure the alert system such that if the stock price of a company is lower than a certain value or drops by a certain percentage, it will send an SMS alert to you.3.4.4. Remote System MonitoringIn a remote system monitoring application, a program (sometimes with the help of a group of sensors) is constantly monitoring the status of a remote system. If a certain condition is satisfied, the program will send a text message to the system administrator to notify him/her of the situation. For example, a program may be written to "ping" a server regularly. If no response is received from the server, the program can send an SMS alert to the system administrator to notify him/her that the server may be hanged.3.5. Two-way Interactive Text Messaging ApplicationsSMS messaging technology can be used as the underlying communication medium between wireless devices and servers in a two-way interactive text messaging application. For example, search engines are two-way interactive text messaging applications. Let's say there is a dictionary search engine that supports queries in SMS text messages. It may operate like this:To find out the meaning of the term "SMS text messaging", you can type "find: SMS text messaging" in an SMS text message and send it to the search engine's phone number. After receiving your SMS text message, the search engine parses it and finds that it begins with the command "find" and follows by the words "SMS text messaging". The search engine then knows you want to find out the meaning of the term "SMS text messaging". So, it sends a text message, which contains the meaning of the term "SMS text messaging", back to your mobile phone.If the search result is very long and it cannot contain within a single SMS text message, the search engine adds "Page 1 of 2", "Page 1 of 3", etc, at the end of the reply SMS text message. The search engine also creates a session using your mobile phone number as the session ID and stores the term that you searched for (i.e. "SMS text messaging") in the session object.To request the second page, you can send a text message with the content "page: 2" to the search engine's phone number. After receiving your SMS text message, the search engine parses it and finds that it begins with the command "page" and follows by "2". The search engine then knows you want the second page of the search result. It retrieves the term that you searched for last time from the session object and finds that it is "SMS text messaging". The search engine then sends a text message that contains the second page of the search result for the term "SMS text messaging" back to your mobile phone.Many other two-way interactive text messaging applications can be built using a similar way. For example, a company may want to build an SMS messaging application to enable its employees to query the corporate database while they are working outdoors.3.6. SMS MarketingSMS messaging can be used as a marketing tool. An example is an SMS newsletter system. After signing up, the user will receive SMS text messages about the latest discounts and products of the company. If the user has any questions or comments, he/she can send a text message back with the questions or comments in it. The company may include its phone number in the SMS newsletter so that the user can talk to the customer service staff directly if he/she wants to do so.4. What is an SMS Center / SMSC?An SMS center (SMSC) is responsible for handling the SMS operations of a wireless network. When an SMS message is sent from a mobile phone, it will reach an SMS center first. The SMS center then forwards the SMS message towards the destination. An SMS message may need to pass through more than one network entity (e.g. SMSC and SMS gateway) before reaching the destination. The main duty of an SMSC is to route SMS messages and regulate the process. If the recipient is unavailable (for example, when the mobile phone is switched off), the SMSC will store the SMS message. It will forward the SMS message when the recipient is available.Very often an SMSC is dedicated to handle the SMS traffic of one wireless network. A network operator usually manages its own SMSC(s) and locates them inside its wireless network system. However, it is possible for a network operator to use a third-party SMSC that is located outside the wireless network system.You must know the address of the wireless network operator's SMSC in order to use SMS messaging with your mobile phone. Typically an SMSC address is an ordinary phone number in the international format. A mobile phone should have a menu option that can be used to configure the SMSC address. Normally, the SMSC address is pre-set in the SIM card by the wireless network operator, which means you do not need to make any changes to it.5. Basic Concepts of SMS TechnologyIn the following sections, we will introduce to you some basic concepts of the SMS technology.5.1. Validity Period of an SMS MessageAn SMS message is stored temporarily in the SMS center if the recipient mobile phone is offline. It is possible to specify the period after which the SMS message will be deleted from the SMS center so that the SMS message will not be forwarded to the recipient mobile phone when it becomes online. This period is called the validity period.Here is an example that illustrates how validity period can be used. Suppose you find a very interesting program that is showing on TV now. You think your friend may want to watch it. So, you send a text message to tell your friend about the TV program. Let's say the TV program lasts for an hour. Your SMS text message will not be useful to your friend if his mobile phone is not available before the program finishes. In this situation, you may want to send a text message with a validity period of one hour to your friend. The wireless carrier will not deliver the SMS text message to your friend if his mobile phone is not available before the validity period ends.A mobile phone should have a menu option that can be used to set the validity period. After setting it, the mobile phone will include the validity period in the outbound SMS messages automatically.5.2. Message Status ReportsSometimes you may want to know whether an SMS message has reached the recipient mobile phone successfully. To get this information, you need to set a flag in the SMS message to notify the SMS center that you want a status report about the delivery of this SMS message. The status report is sent to you in the form of an SMS message.A mobile phone should have a menu option that can be used to set whether the status report feature is on or off. After setting it, the mobile phone will set the corresponding flag in the outbound SMS messages for you automatically. The status report feature is turned off by default on most mobile phones and GSM / GPRS modems.5.3. Message Submission ReportsAfter leaving the mobile phone, an SMS message goes to the SMS center. When it reaches the SMS center, the SMS center will send back a message submission report to the mobile phone to inform whether there are any errors or failures (e.g. incorrect SMS message format, busy SMS center, etc). If there is no error or failure, the SMS center sends back a positive submission report to the mobile phone. Otherwise it sends back a negative submission report to the mobile phone. The mobile phone may then notify the user that the message submission was failed and what caused the failure.If the mobile phone does not receive the message submission report after a period of time, it concludes that the message submission report has been lost. The mobile phone may then re-send the SMS message to the SMS center. A flag will be set in the new SMS message to inform the SMS center that this SMS message has been sent before. If the previous message submission was successful, the SMS center will ignore the new SMS message but send back a message submission report to the mobile phone. This mechanism prevents the sending of the same SMS message to the recipient multiple times.Sometimes the message submission report mechanism is not used and the acknowledgement of message submission is done in a lower layer.5.4. Message Delivery ReportsAfter receiving an SMS message, the recipient mobile phone will send back a message delivery report to the SMS center to inform whether there are any errors or failures (example causes: unsupported SMS message format, not enough storage space, etc). This process is transparent to the mobile user. If there is no error or failure, the recipient mobile phone sends back a positive delivery report to the SMS center. Otherwise it sends back a negative delivery report to the SMS center.If the sender requested a status report earlier, the SMS center sends a status report to the sender when it receives the message delivery report from the recipient.If the SMS center does not receive the message delivery report after a period of time, it concludes that the message delivery report has been lost. The SMS center then re-sends the SMS message to the recipient.Sometimes the message delivery report mechanism is not used and the acknowledgement of message delivery is done in a lower layer.6. Intra-operator SMS MessagesIf both you and your friend are using the mobile phone service of the same wireless network operator, the transmission of an SMS message from you to your friend will involve only one wireless network operator. This SMS message is called an intra-operator SMS message.Typically, the cost for sending an intra-operator SMS message from a mobile phone is lower than that for sending other kinds of SMS messages such as inter-operator SMS messages. Some wireless network operators allow their subscribers to send unlimited intra-operator SMS messages free of charge.6.1. Transmission Process of Intra-operator SMS MessagesThe transmission of an intra-operator SMS message involves only one SMS center. After leaving the sender, the intra-operator SMS message reaches the SMS center. The SMS center then delivers the SMS message to the recipient mobile phone. If the recipient mobile phone is offline, the SMS center stores the SMS message. It will deliver the SMS message when the recipient mobile phone is online. If the SMS message's validity period expires and the recipient mobile phone is still offline, the SMS center will remove the SMS message.When the SMS center receives the message delivery report from the recipient mobile phone or removes the SMS message (for example, when the validity period expires), it sends a status report to the sender if the sender requested one earlier.The following figure illustrates the transmission process of an intra-operator SMS message:left07. Inter-operator SMS MessagesSuppose you and your friend are using the mobile phone service of wireless network operator A and wireless network operator B respectively. The transmission of an SMS message from you to your friend involves two wireless networks. This SMS message is called an inter-operator SMS message.Typically, the cost for sending an inter-operator SMS message from a mobile phone is higher than that for sending an intra-operator SMS message.7.1. Transmission Process of Inter-operator SMS MessagesThe transmission of an inter-operator SMS message involves one or more SMS centers. Generally, there are two different ways for the transmission of inter-operator SMS messages. In the first way, signaling interconnections are set up between two wireless networks. When the originator SMS center receives an inter-operator SMS message, it gets the routing information from the recipient wireless network and delivers the SMS message to the recipient mobile phone directly. The following figure illustrates the transmission process:left0The first way can be used if the two wireless networks involved in the transmission of the inter-operator SMS message are based on similar technologies. However, if this is not true, the second way has to be used. For example, when an SMS message is sent from a GSM network to a CDMA network. In the second way, the originator SMS center and the recipient SMS center are interconnected through an SMS gateway or with a communication protocol that is supported by both SMS centers. The SMS message first reaches the originator SMS center, which will then forward the SMS message towards the recipient SMS center. The recipient SMS center will be responsible for sending the SMS message to the recipient mobile phone and storing the SMS message if the recipient mobile phone is offline. The following figure illustrates the transmission process:left08. International SMS MessagesInter-operator SMS messages can be further divided into two categories -- local inter-operator SMS messages and international inter-operator SMS messages (international SMS messages). A local inter-operator SMS message is an SMS message that is sent from one wireless network operator to another wireless network operator in the same country, while an international SMS message is an SMS message that is sent from a wireless network operator in one country to a wireless network operator in another country.Usually the cost for sending an international SMS message from a mobile phone is higher than that for sending a local inter-operator SMS message. Hence, the cost for sending an intra-operator SMS message <= the cost for sending a local inter-operator SMS message <= the cost for sending an international SMS message.The interoperability of SMS messaging between two wireless networks locally and even internationally is undoubtedly a main factor that contributes to the success of SMS worldwide.9. What is an SMS Gateway?One problem of SMS messaging is that SMSCs developed by different companies use their own communication protocol and most of these protocols are proprietary. For example, Nokia has an SMSC protocol called CIMD whereas another SMSC vendor, CMG, has an SMSC protocol called EMI. We cannot connect two SMSCs if they do not support a common SMSC protocol. To deal with this problem, an SMS gateway is placed between two SMSCs. This is illustrated in the following figure. The SMS gateway acts as a relay between the two SMSCs. It translates one SMSC protocol to another one. This way can be used by two different wireless carriers to interconnect their SMSCs for purposes such as enabling the exchange of inter-operator SMS messages.Figure 1. An SMS gateway acts as a relay between two SMS centers.left0Besides wireless carriers, content providers and SMS application developers may also find an SMS gateway useful. Let's consider the following situation. Suppose you are the developer of an SMS text messaging application. To send and receive SMS text messages on your server, one way is to connect to the SMSCs of the wireless carriers. Different wireless carriers may use SMSCs from different vendors, which means your SMS text messaging application may need to support multiple SMSC-specific protocols. (This is illustrated in the following figure). As a result, the SMS text messaging application's complexity and development time increases.Figure 2. An SMS text messaging application connects to SMSCs without an SMS gateway.left0To deal with the above problem, an SMS gateway can be set up to handle the connections to the SMSCs. Now the SMS text messaging application only needs to know how to connect to the SMS gateway. To support more SMSCs, you just need to modify the settings of the SMS gateway. No change to the source code of the SMS text messaging application is required. The use of an SMS gateway can greatly shorten the SMS text messaging application's development time.To connect to an SMS gateway, you can use an SMSC protocol such as SMPP and CIMD. Some SMS gateways support an HTTP / HTTPS interface. HTTP / HTTPS is easier to use than SMSC protocols. The drawback is that there may be fewer SMS features to use. For example, an SMS gateway may not support the sending of picture messages through the HTTP / HTTPS interface.Figure 3. An SMS text messaging application connects to SMSCs through an SMS gateway.left0Besides using a direct connection to the SMSC of a wireless carrier, another way to send and receive SMS text messages on a computer is to use a mobile phone or GSM/GPRS modem. To do this, your SMS text messaging application has to know how to communicate with the mobile phone or GSM/GPRS modem using AT commands.Some SMS gateways are capable of handling the connections to mobile phones and GSM/GPRS modems. To send and receive SMS text messages with a mobile phone or GSM/GPRS modem, the SMS text messaging application only needs to know how to talk to the SMS gateway and does not need to know anything about AT commands. More details about GSM/GPRS modems and AT commands will be provided in later sections of this SMS tutorial.Figure 4. An SMS text messaging application connects to a pool of mobile phones or GSM/GPRS modems through an SMS gateway.left09.1. Open Source and Free SMS Gateway SoftwareAs you can see in the above sections, an SMS gateway has a lot of responsibilities in an SMS messaging system. So, SMS gateway software can be very complex and complex software is usually expensive. Fortunately, there are open source SMS gateway software packages that can be downloaded free of charge over the web. One high-quality free SMS gateway software package is Kannel, which is written in the C programming language. Kannel can handle connections to SMSCs, mobile phones and GSM/GPRS modems. It has an HTTP / HTTPS interface for the sending and receiving of SMS messages. More information about Kannel can be found on its web site?. How to Send SMS Messages from a Computer / PC?In general, there are two ways to send SMS messages from a computer / PC to a mobile phone:Connect a mobile phone or GSM/GPRS modem to a computer / PC. Then use the computer / PC and AT commands to instruct the mobile phone or GSM/GPRS modem to send SMS messages.Connect the computer / PC to the SMS center (SMSC) or SMS gateway of a wireless carrier or SMS service provider. Then send SMS messages using a protocol / interface supported by the SMSC or SMS gateway.If you do not want to develop SMS software or applications but just want to use your computer / PC to send text messages, you may want to read our?Quick Guide for Non-Developers.10.1. The 1st Way: Sending SMS Messages from a Computer Using a Mobile Phone or GSM/GPRS ModemThe SMS specification has defined a way for a computer to send SMS messages through a mobile phone or GSM/GPRS modem. A GSM/GPRS modem is a wireless modem that works with GSM/GPRS wireless networks. A wireless modem is similar to a dial-up modem. The main difference is that a wireless modem transmits data through a wireless network whereas a dial-up modem transmits data through a copper telephone line. More information about GSM/GPRS modems will be provided in the section "Introduction to GSM / GPRS Wireless Modems". Most mobile phones can be used as a wireless modem. However, some mobile phones have certain limitations comparing to GSM/GPRS modems. This will be discussed in the section "Which is Better: Mobile Phone or GSM / GPRS Modem" later.To send SMS messages, first place a valid SIM card from a wireless carrier into a mobile phone or GSM/GPRS modem, which is then connected to a computer. There are several ways to connect a mobile phone or GSM/GPRS modem to a computer. For example, they can be connected through a serial cable, a USB cable, a Bluetooth link or an infrared link. The actual way to use depends on the capability of the mobile phone or GSM/GPRS modem. For example, if a mobile phone does not support Bluetooth, it cannot connect to the computer through a Bluetooth link.After connecting a mobile phone or GSM/GPRS modem to a computer, you can control the mobile phone or GSM/GPRS modem by sending instructions to it. The instructions used for controlling the mobile phone or GSM/GPRS modem are called AT commands. (AT commands are also used to control dial-up modems for wired telephone system.) Dial-up modems, mobile phones and GSM/GPRS modems support a common set of standard AT commands. In addition to this common set of standard AT commands, mobile phones and GSM/GPRS modems support an extended set of AT commands. One use of the extended AT commands is to control the sending and receiving of SMS messages.The following table lists the AT commands that are related to the writing and sending of SMS messages:AT commandMeaning+CMGSSend message+CMSSSend message from storage+CMGWWrite message to memory+CMGDDelete message+CMGCSend command+CMMSMore messages to sendOne way to send AT commands to a mobile phone or GSM/GPRS modem is to use a terminal program. A terminal program's function is like this: It sends the characters you typed to the mobile phone or GSM/GPRS modem. It then displays the response it receives from the mobile phone or GSM/GPRS modem on the screen. The terminal program on Microsoft Windows is called HyperTerminal. More details about the use of Microsoft HyperTerminal can be found in the "How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem" section of this SMS tutorial.Below shows a simple example that demonstrates how to use AT commands and the HyperTerminal program of Microsoft Windows to send an SMS text message. The lines in bold type are the command lines that should be entered in HyperTerminal. The other lines are responses returned from the GSM / GPRS modem or mobile phone.ATOKAT+CMGF=1OKAT+CMGW="+85291234567">?A simple demo of SMS text messaging.+CMGW: 1OKAT+CMSS=1+CMSS: 20OKHere is a description of what is done in the above example:Line 1: "AT" is sent to the GSM / GPRS modem to test the connection. The GSM / GPRS modem sends back the result code "OK" (line 2), which means the connection between the HyperTerminal program and the GSM / GPRS modem works fine.Line 3: The AT command +CMGF is used to instruct the GSM / GPRS modem to operate in SMS text mode. The result code "OK" is returned (line 4), which indicates the command line "AT+CMGF=1" has been executed successfully. If the result code "ERROR" is returned, it is likely that the GSM / GPRS modem does not support the SMS text mode. To confirm, type "AT+CMGF=?" in the HyperTerminal program. If the response is "+CMGF: (0,1)" (0=PDU mode and 1=text mode), then SMS text mode is supported. If the response is "+CMGF: (0)", then SMS text mode is not supported.Line 5 and 6: The AT command +CMGW is used to write an SMS text message to the message storage of the GSM / GPRS modem. "+85291234567" is the recipient mobile phone number. After typing the recipient mobile phone number, you should press the Enter button of the keyboard. The GSM / GPRS modem will then return a prompt "> " and you can start typing the SMS text message "A simple demo of SMS text messaging.". When finished, press Ctrl+z of the keyboard.Line 7: "+CMGW: 1" tells us that the index assigned to the SMS text message is 1. It indicates the location of the SMS text message in the message storage.Line 9: The result code "OK" indicates the execution of the AT command +CMGW is successful.Line 10: The AT command +CMSS is used to send the SMS text message from the message storage of the GSM / GPRS modem. "1" is the index of the SMS text message obtained from line 7.Line 11: "+CMSS: 20" tells us that the reference number assigned to the SMS text message is 20.Line 13: The result code "OK" indicates the execution of the AT command +CMSS is successful.To send SMS messages from an application, you have to write the source code for connecting to and sending AT commands to the mobile phone or GSM/GPRS modem, just like what a terminal program does. You can write the source code in C, C++, Java, Visual Basic, Delphi or other programming languages you like. However, writing your own code has a few disadvantages:You have to learn how to use AT commands.You have to learn how to compose the bits and bytes of an SMS message. For example, to specify the character encoding (e.g. 7-bit encoding and 16-bit Unicode encoding) of an SMS message, you need to know which bits in the message header should be modified and what value should be assigned.Sending SMS messages with a mobile phone or GSM/GPRS modem has a drawback -- the SMS transmission speed is low. As your SMS messaging application becomes more popular, it has to handle a larger amount of SMS traffic and finally the mobile phone or GSM/GPRS modem will not be able to take the load. To obtain a high SMS transmission speed, a direct connection to an SMSC or SMS gateway of a wireless carrier or SMS service provider is needed. However, AT commands are not used for communicating with an SMS center or SMS gateway. This means your have to make a big change to your SMS messaging application in order to move from a wireless-modem-based solution to a SMSC-based solution.In most cases, instead of writing your own code for interacting with the mobile phone or GSM/GPRS modem via AT commands, a better solution is to use a high-level SMS messaging API (Application programming interface) / SDK (Software development kit) / library. The API / SDK / library encapsulates the low-level details. So, an SMS application developer does not need to know AT commands and the composition of SMS messages in the bit-level. Some SMS messaging APIs / SDKs / libraries support SMSC protocols in addition to AT commands. To move from a wireless-modem-based SMS solution to a SMSC-based SMS solution, usually you just need to modify a configuration file / property file or make a few changes to your SMS messaging application's source code.The links to some open source and free SMS messaging libraries can be found in the article "Free Libraries/Tools for Sending/Receiving SMS with a Computer".Another way to hide the low-level AT command layer is to place an SMS gateway between the SMS messaging application and the mobile phone or GSM/GPRS modem. (This has been described in the section "What is an SMS Gateway?" earlier.) Simple protocols such as HTTP / HTTPS can then be used for sending SMS messages in the application. If an SMSC protocol (e.g. SMPP, CIMD, etc) is used for communicating with the SMS gateway instead of HTTP / HTTPS, an SMS messaging API / SDK / library can be very helpful to you since it encapsulates the SMSC protocol's details.Usually a list of supported / unsupported mobile phones or wireless modems is provided on the web site of an SMS messaging API / SDK / library or an SMS gateway software package. Remember to check the list if you are going to use an SMS messaging API / SDK / library or an SMS gateway software package.10.1.1. Major Drawback of Sending SMS Messages through a Mobile Phone or GSM/GPRS Modem -- Low SMS Sending RateUsing a mobile phone or GSM/GPRS modem to send SMS messages has a major drawback, that is the SMS sending rate is too low. Only 6-10 SMS messages can be sent per minute (when the "SMS over GSM" mode is used). The performance is not affected by the connection between the computer and the mobile phone or GSM/GPRS modem (i.e. the SMS sending rate is about the same no matter the mobile phone or GSM/GPRS modem is connected to the computer through a serial cable, USB cable, Bluetooth link or infrared link) and does not depend on whether a mobile phone or GSM/GPRS modem is used (i.e. the SMS sending rate is about the same no matter a mobile phone or a GSM/GPRS modem is used). The determining factor for the SMS sending rate is the wireless network.10.2. The 2nd Way: Sending SMS Messages from a Computer through a Connection to the SMSC or SMS Gateway of a Wireless Carrier or SMS Service ProviderThe way for sending SMS messages from a computer through a mobile phone or GSM/GPRS modem has a major limitation, that is the SMS sending rate is too low. If you need a high SMS sending rate, obtaining a direct connection to the SMS center (SMSC) or SMS gateway of a wireless carrier is necessary. The connection may be made through the Internet, X.25 or dial-up. If you cannot get a direct connection to the SMSC or SMS gateway of a wireless carrier, another choice is to get a connection to the SMS gateway of an SMS service provider, which will forward SMS messages towards a suitable SMSC.10.2.1. Difficulties in Getting a Direct Connection to the SMSC or SMS Gateway of a Wireless CarrierIt can be difficult for small businesses or individual application developers to obtain a direct connection to the SMSC or SMS gateway of a wireless carrier since a wireless carrier may only provide such service to those who have huge SMS traffic. Buying SMS messages in bulk means the total fee will be very high (although the fee per SMS message will be low).Besides, the information about the service (for example, cost of the service, protocols supported, network coverage) is usually not stated clearly on a wireless carrier's web site. This is because the wireless carrier staff wants to know more about your SMS messaging application, such as its nature and traffic requirement, before offering a price and providing further information to you. To decide which wireless carrier's service plan is the best, you have to discuss with the sales staff of each wireless carriers. This is troublesome if you just want to send a small number of SMS messages. (Of course if you need to send a large amount of SMS messages, say one million SMS messages per month, negotiating with the wireless carrier staff for a more favorable agreement is a necessary step.)A more convenient way to send SMS messages is to use the SMS connectivity service of an SMS service provider, which is described in the next section.10.2.2. SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)There is a demand for SMS connectivity from applications that does not require the sending or receiving of large amount of SMS messages. One example is a remote monitoring system. If the remote monitoring system finds that a certain server is not responding, it will send an SMS alert to the system administrator's mobile phone. This remote monitoring system will have a very small amount of SMS traffic per month since the servers being monitored should be working fine most of the time.Since a wireless carrier usually does not provide direct SMSC or SMS gateway access to users without a large amount of SMS traffic, some companies come out to fill the gap. These companies are called SMS service providers. There is no minimal purchase requirement or monthly minimum usage requirement for many SMS service providers.SMS service providers are also known as SMS gateway providers, SMS resellers and SMS brokers because of the following reasons:SMS gateway providers?-- An SMS service provider provides an SMS gateway for its users to send SMS messages to. This SMS gateway will then route the SMS messages to another SMS gateway or SMSC.SMS resellers and SMS brokers?-- SMS service providers buy a large amount of SMS messages from a lot of wireless carriers at a low price per SMS message. They then sell the SMS messages at a price higher than the cost.Unlike wireless carriers, many SMS service providers provide detail information about their SMS connectivity service on their web site. For example, you may find the cost of the service, network coverage, protocols supported, developers' guide, etc, on the web site. Thus, the service of different SMS service providers can be compared easily. If you are not happy with, say the price or network coverage of an SMS service provider, you can simply leave its web site and find another SMS service provider.Another advantage of using the SMS connectivity services of SMS service providers is that their network coverage is very good. They work hard to cover as many wireless networks as possible so as to make their services attractive. Some SMS service providers can send SMS messages not only to GSM wireless networks, but also to CDMA and TDMA wireless networks.It is easy to send SMS messages with an SMS service provider. Here are the typical steps:Register for an account on the SMS service provider's web site. (An SMS service provider may allow newly registered users to send a few free SMS messages for testing its service quality.)Log into the account.Buy a number of credits or SMS text messages online. Many SMS service providers support credit card payment and some also support PayPal.Send SMS messages using a protocol / interface (e.g. HTTP, email, FTP) supported by the SMS service provider.SMS service providers can be divided into two categories depending on how they require you to pay for their SMS messaging service:Credit-based?-- You purchase a number of credits from the SMS service provider's web site. Sending one SMS message will cost you one or more credits, depending on the country you send the SMS message to. For example, sending an SMS text message to India might cost you one credit while sending an SMS text message to the US might cost you two credits.SMS-based?-- You purchase a number of SMS messages from the SMS service provider's web site. The cost per SMS message is the same for all destinations. For example, if you purchase ten SMS messages, you can send at most ten SMS messages no matter the destination is India or the US.The cost per SMS message sent depends on which SMS service provider you choose and how many SMS messages you purchase. It starts at around US $0.06 to US $0.07 per SMS message. The more SMS messages you purchased, the lower the cost of sending one SMS message.A comparison of some SMS service providers can be found in "SMS Gateway Providers Comparison Table". You may also want to have a look at the article "How to Choose an SMS Gateway Provider" to learn some of the things that you should consider when choosing an SMS gateway provider for your SMS application.10.2.3. Sending SMS Messages Using a Protocol / Interface Supported by an SMSC or SMS GatewayAfter setting up an account with a wireless carrier or an SMS service provider, you can start sending SMS messages using a protocol / interface supported by the SMSC or SMS gateway. To communicate with an SMSC, an SMSC protocol is required. Most of these SMSC protocols are proprietary to the company that developed the SMSC. One widely used SMSC protocol is SMPP (Short Message Peer to Peer). It was originally a proprietary SMSC protocol created by Logica (an SMSC vendor). Now SMPP is an open SMSC protocol whose development is controlled by a non-profit organization SMS Forum. The following table lists some of the SMSC protocols and the SMSC vendors who develop the protocols:SMSC vendorSMSC protocolCMG (CMG and Logica have merged intoLogicaCMG.)EMI (External Machine Interface)UCP (Universal Computer Protocol)Logica (CMG and Logica have merged intoLogicaCMG.)(Now the?SMS Forum?is responsible for the development of SMPP.)SMPP (Short Message Peer to Peer)NokiaCIMD (Computer Interface to Message Distribution)SEMA Group (Now? HYPERLINK "" Airwide Solutions)OIS (Open Interface Specification)SMS2000SMS gateways of SMS service providers and wireless carriers very often support one or more of the following protocols / interfaces: HTTP, HTTPS (HTTP + SSL encryption), XML over HTTP / HTTPS, SMTP (email to SMS), FTP. Some also support the SMPP protocol, which is usually used by advanced users. SMSC protocols other than SMPP are not commonly supported.It is very easy to send SMS messages if you use a simple protocol like HTTP / HTTPS. Here is an example. To send an SMS message "It is easy to send text messages" to the mobile phone number 61234567, you submit an HTTP GET to the SMS gateway using an URL that looks something like this: the above URL:"" is the host name of the SMS gateway that the SMS text message should be sent to."sendsms" is the file name of the CGI program that will be executed on the SMS gateway."account=account123" is used to assign the value?account123?to the?account?parameter. Theaccount?parameter specifies which account that the cost of the SMS text message should be deducted from."password=password123" is used to assign the value?password123?to the?password?parameter. The?password?parameter specifies the password of the account."destination=61234567" is used to assign the value?61234567?to the?destination?parameter. Thedestination?parameter specifies the recipient's mobile phone number."textmessage=It+is+easy+to+send+text+messages" is used to assign the value?It is easy to send text messages?to the?textmessage?parameter. The?textmessage?parameter specifies the SMS text message to be sent. There exists some "+" characters because the space character is a special character and it should be escaped if it appears in an URL. The escaped character of the space character is the "+" character.After receiving your HTTP request, the SMS gateway will forward your SMS text message towards the recipient. The SMS gateway will then send back an HTTP response that contains a return value. The return value indicates whether there are any errors. For example, a certain SMS gateway may use the return value 0 to indicate that there is no error, the return value 1 to indicate the error "The account does not have enough credits", the return value 2 to indicate the error "The SMS message is too long", etc.Note that the parameters that can be passed in an HTTP request and the return values varies between SMS gateways of different SMS service providers and wireless carriers. To send the same SMS message "It is easy to send text messages" to the same mobile phone number 61234567 but with a different SMS service provider, the URL to be used may become:, note that data transmitted over the Internet using the HTTP protocol is not secure. This means other people can read your account name and password you included in the above URL. To send data securely, you should use the HTTPS protocol instead of HTTP (i.e. change "http" at the beginning of the above URL to "https"), like this:. How to Receive SMS Messages Using a Computer / PC?In general, there are three ways to receive SMS messages using your computer / PC:Connect a mobile phone or GSM/GPRS modem to a computer / PC. Then use the computer / PC and AT commands to get the received SMS messages from the mobile phone or GSM/GPRS modem.Get access to the SMS center (SMSC) or SMS gateway of a wireless carrier. Any SMS messages received will be forwarded to your computer / PC using a protocol / interface supported by the SMSC or SMS gateway.Get access to the SMS gateway of an SMS service provider. Any SMS messages received will be forwarded to your computer / PC using a protocol / interface supported by the SMS gateway.If you do not want to develop SMS software or applications but just want to use your computer / PC to receive text messages, you may want to read our?Quick Guide for Non-Developers.11.1. The 1st Way: Using a Computer to Receive SMS Messages through a Mobile Phone or GSM/GPRS ModemReceiving SMS messages through a mobile phone or GSM/GPRS modem has a major advantage over the other two ways -- wireless carriers usually do not charge any fees for receiving incoming SMS messages with their SIM cards. The disadvantage of receiving SMS messages this way is that a mobile phone or GSM/GPRS modem cannot handle a large amount of SMS traffic. One way to overcome this is to load balance the SMS traffic with a pool of mobile phones or GSM/GPRS modems. Each mobile phone or GSM/GPRS modem will have its own SIM card and mobile phone number.In terms of programming, sending and receiving SMS messages through a mobile phone or GSM/GPRS modem are similar. What you need to do is to send instructions (in the form of AT commands) to the mobile phone or GSM/GPRS modem.The following table lists the AT commands that are related to the receiving and reading of SMS messages:AT commandMeaning+CNMINew message indications+CMGLList messages+CMGRRead messages+CNMANew message acknowledgementBelow shows a simple example that demonstrates how to use AT commands and the HyperTerminal program of Microsoft Windows to read SMS text messages received by a GSM / GPRS modem or mobile phone. The lines in bold type are the command lines that should be entered in HyperTerminal. The other lines are responses returned from the GSM / GPRS modem or mobile phone.ATOKAT+CMGF=1OKAT+CMGL="ALL"+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32"Hello, welcome to our SMS tutorial.+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32"A simple demo of SMS text messaging.OKHere is a description of what is done in the above example:Line 1: "AT" is sent to the GSM / GPRS modem to test the connection. The GSM / GPRS modem sends back the result code "OK" (line 2), which means the connection between the HyperTerminal program and the GSM / GPRS modem works fine.Line 3: The AT command +CMGF is used to instruct the GSM / GPRS modem to operate in SMS text mode. The result code "OK" is returned (line 4), which indicates the command line "AT+CMGF=1" has been executed successfully. If the result code "ERROR" is returned, it is likely that the GSM / GPRS modem does not support the SMS text mode. To confirm, type "AT+CMGF=?" in the HyperTerminal program. If the response is "+CMGF: (0,1)" (0=PDU mode and 1=text mode), then SMS text mode is supported. If the response is "+CMGF: (0)", then SMS text mode is not supported.Line 5-9: The AT command +CMGL is used to list all SMS text messages in the message storage of the GSM / GPRS modem. There are two SMS text messages in the message storage: "Hello, welcome to our SMS tutorial." and "A simple demo of SMS text messaging.". "+85291234567" is the sender mobile phone number. "06/11/11,00:30:29+32" and "06/11/11,00:32:20+32" tell us when the SMS text messages were received by the SMSC. "+32" is the time zone. Note that the unit is a quarter of an hour. So, +32 means GMT+8 hours, since 32 quarters of an hour = 8 hours. "REC READ" indicates both of the SMS text messages have been read before.Line 11: The result code "OK" indicates the execution of the AT command +CMGL is successful.To enable an application to receive SMS messages, you have to write the source code for connecting to and sending AT commands to the mobile phone or GSM/GPRS modem, just like what a terminal program (such as HyperTerminal of Microsoft Windows) does. You can write the source code in C, C++, Java, Visual Basic, Delphi or other programming languages you like.However, like what we have discussed in the earlier section "The 1st Way: Sending SMS Messages from a Computer Using a Mobile Phone or GSM/GPRS Modem", usually a better solution is to use a high-level SMS messaging API (Application programming interface) / SDK (Software development kit) / library instead of writing your own code for interacting with the mobile phone or GSM/GPRS modem via AT commands. The API / SDK / library encapsulates the low-level details. So, an SMS application developer does not need to know AT commands and the composition of SMS messages in the bit-level. Some SMS messaging APIs / SDKs / libraries support SMSC protocols in addition to AT commands. To move from a wireless-modem-based SMS solution to a SMSC-based SMS solution, usually you just need to modify a configuration file / property file or make a few changes to your SMS messaging application's source code. The links to some open source and free SMS messaging libraries can be found in the article "Free Libraries/Tools for Sending/Receiving SMS with a Computer".Another high-level solution is to place an SMS gateway between the SMS messaging application and the mobile phone or GSM/GPRS modem. The SMS messaging application can then use simple protocols such as HTTP / HTTPS for receiving SMS messages. If an SMSC protocol (e.g. SMPP, CIMD, etc) is used for communicating with the SMS gateway instead of HTTP / HTTPS, an SMS messaging API / SDK / library can be very helpful to you since it encapsulates the SMSC protocol's details.11.2. The 2nd Way: Using a Computer to Receive SMS Messages through a Connection to the SMSC or SMS Gateway of a Wireless CarrierLike sending SMS messages, receiving SMS messages through a mobile phone or GSM/GPRS modem has a major limitation, that is the SMS transmission rate is too low. If you need a high SMS transmission rate, one way is to obtain a direct connection to the SMS center (SMSC) or SMS gateway of a wireless carrier. The connection may be made through the Internet, X.25 or dial-up.To receive SMS messages through a direct connection to the SMSC or SMS gateway of a wireless carrier, usually you need to contact the wireless carrier staff to discuss the details. A wireless carrier may only provide such service to those who have huge SMS traffic and the total fee can be very high. (However, if you divide the total fee by the number of SMS messages that is allowed to receive through the SMSC or SMS gateway, you may find that the fee per incoming SMS message is very low.) The service may involve a one-time setup fee, a monthly subscription fee and/or a per-message fee. To know the exact cost of the service, protocols supported, network coverage and other information, usually you have to contact the wireless carrier staff.11.3. The 3rd Way: Using a Computer to Receive SMS Messages through a Connection to the SMS Gateway of an SMS Service ProviderAnother way to receive SMS messages using a computer is through a connection to the SMS gateway of an SMS service provider. SMS service providers generally support two kinds of solution:SIM hosting?-- The SMS service provider hosts a SIM card for you. All SMS messages sent to the mobile phone number of the SIM card will be forwarded to your system using a protocol / interface supported by the SMS gateway of the SMS service provider.Shared phone number?-- The SMS service provider provides you a phone number that is shared by its customers for receiving SMS messages. You have to specify one or more keywords to associate with your SMS application. If an SMS message is received and its content begins with a keyword specified by you, it will be forwarded to your system using a protocol / interface supported by the SMS gateway of the SMS service provider.Some SMS service providers also provide SMS messaging solutions that are customized to your needs. For example, if you need to receive SMS messages from users in a few countries, an SMS service provider may help you open dedicated phone numbers in those countries and forward the received SMS messages to you in a unified way. To use such SMS messaging services, you have to contact the SMS service provider to discuss the details.11.3.1. SIM HostingIn this approach, an SMS service provider hosts a SIM card for you. The SIM card's mobile phone number will serve as a dedicated phone number of your SMS application. To use the service, you mail your SIM card to the SMS service provider. Later if you end the service, the SMS service provider will mail the SIM card back to you. The SIM card will be put into a GSM/GPRS modem, which is connected to an SMS gateway. The SMS gateway will forward all received SMS messages to your computer using a certain protocol / interface. For example, HTTP, HTTPS, XML over HTTP/HTTPS, SMTP (SMS to email), SMPP, etc.Like receiving SMS messages using your own mobile phone or GSM/GPRS modem, SIM hosting has a major weakness -- it cannot handle a large amount of SMS traffic. The advantage of SIM hosting is that you do not need to buy, set up and manage the necessary equipment. Also, you do not need to write any code to control the receiving of SMS messages from a GSM/GPRS modem via low-level AT commands, which means you can concentrate on the business logic of your SMS application. The SMS service provider may provide you a detail log of the incoming SMS messages.11.3.1.1. Cost of SIM Hosting ServiceSIM hosting service typically involves a one-time setup fee and a monthly hosting fee. Usually there is no per-message cost. Some SMS service providers do not state the cost of SIM hosting service on their website, which means you have to contact their staff directly.If the SMS service provider is located overseas, the SIM card needs to support foreign network roaming. SMS roaming fees may be charged by the wireless carrier that provides you the SIM card.11.3.2. Shared Phone NumberIn this approach, the SMS service provider rents dedicated phone numbers from wireless carriers. Each phone number will then be shared by a number of the SMS service provider's customers for receiving SMS messages. Since the phone number is provided by a wireless carrier directly (not through a SIM card) and the SMS service provider has a high speed connection to the SMSC or SMS gateway of the wireless carrier, the SMS service provider is capable of handling a large amount of SMS messages with the phone number. As a result, the users of such shared phone number service can enjoy a higher SMS transmission rate than using SIM hosting services or using their own wireless modem. The cost of shared phone number service is less expensive than renting your own dedicated phone number from a wireless carrier. A detail log of the received SMS messages is sometimes provided by SMS service providers.Like using SIM hosting service, using shared phone number service has the advantage that you do not need to buy, set up and manage any equipment (e.g. GSM / GPRS modems) and write any low-level code for receiving SMS messages. Hence, an SMS application developer can concentrate on the business logic of his/her SMS messaging application.The weakness of shared phone number service is that the bandwidth is shared, i.e. the performance drops if the number of users sharing the phone number increases, or if the amount of incoming SMS traffic required by other users increases.11.3.2.1. Registering KeywordsSince multiple users share a single phone number, when the SMS gateway of the SMS service provider receives an SMS message, it needs a way to determine which user to forward the SMS message to. SMS service providers' engineers come up with a solution like this: First, a user registers one or more keywords to associate with his/her SMS messaging application. Later when the SMS gateway receives an SMS message that begins with one of the keywords, it will forward the SMS message to that SMS messaging application.Here is an example for illustration. Suppose you want to develop an SMS messaging application that provides free ringtone download service. A user will be able to perform two functions: listing the free ringtones that are available and requesting a ringtone to be sent to a mobile phone.To receive SMS messages from users, you can subscribe to the shared phone number service of an SMS service provider and register two keywords,?list?and?download, to be associated with your SMS messaging application.To request the list of free ringtones that are available on your server, the user can send the following SMS text message to the shared phone number:listWhen the SMS gateway of the SMS service provider receives the above SMS text message, it parses its content and extracts the keyword?list. It then searches a database to find out which SMS messaging application is associated with the keyword?list. As your SMS messaging application is associated with the keyword?list, the SMS text message will be forwarded to your SMS messaging application.The keyword?list?indicates that the user wants the list of free ringtones that are available on your server. Hence, your SMS messaging application should return an SMS text message that contains something like this:Free ringtones available:1. Ringtone ABC2. Ringtone CDEF3. Ringtone X4. Ringtone YTo download the second ringtone, the user can send an SMS text message that looks like this to the shared phone number:download 2Since the keyword?download?is also associated with your SMS messaging application, the SMS gateway will forward the above SMS text message to your SMS messaging application. This time the keyword?download?indicates that the user wants to download a ringtone. Your SMS messaging application should encode the second ringtone in an SMS message and send it to the user.11.3.2.2. Cost of Shared Phone Number ServiceShared phone number service typically involves a monthly subscription fee, a per-message fee and/or a per-keyword fee. A few SMS service providers also charge a one-time setup fee. Some SMS service providers do not state the cost of shared phone number service on their web site, which means you have to contact their staff directly.11.4. Receiving SMS Messages Using a Protocol / Interface Supported by an SMSC or SMS GatewayAfter setting up an account with a wireless carrier or an SMS service provider, the SMSC or SMS gateway will start forwarding inbound SMS messages to your SMS application using a certain a protocol / interface. To communicate with an SMSC, an SMSC protocol is required. As mentioned in earlier sections of this SMS tutorial, most of these SMSC protocols are proprietary to the company that developed the SMSC. One widely used SMSC protocol is SMPP (Short Message Peer to Peer). It was originally a proprietary SMSC protocol created by Logica (an SMSC vendor). Now SMPP is an open SMSC protocol whose development is controlled by a non-profit organization SMS Forum. The following table lists some of the SMSC protocols and the SMSC vendors who develop the protocols:SMSC vendorSMSC protocolCMG (CMG and Logica have merged intoLogicaCMG.)EMI (External Machine Interface)UCP (Universal Computer Protocol)Logica (CMG and Logica have merged intoLogicaCMG.)(Now the?SMS Forum?is responsible for the development of SMPP.)SMPP (Short Message Peer to Peer)NokiaCIMD (Computer Interface to Message Distribution)SEMA Group (Now?Airwide Solutions)OIS (Open Interface Specification)SMS2000SMS gateways of SMS service providers and wireless carriers very often support one or more of the following protocols / interfaces: HTTP, HTTPS (HTTP + SSL encryption), XML over HTTP / HTTPS, SMTP (SMS to email), FTP. Some also support the SMPP protocol, which is usually used by advanced users. SMSC protocols other than SMPP are not commonly supported.It is very easy to receive SMS messages from an SMS gateway if you use a simple protocol like HTTP / HTTPS. Let's take HTTP as an example. First, you log into your account and register a callback URL that points to a server-side script written by you. The server-side script is hosted on a web server / application server and it will be responsible for processing the received SMS messages. Commonly used server-side technologies include ASP, Java Servlet / JSP, Perl and PHP. If your server-side script is written in PHP, the callback URL should look something like this: an SMS message is received, the SMS gateway will submit an HTTP GET to your web server / application server using the above callback URL. Details of the inbound SMS message such as its content, the sender's mobile phone number, the time and date that the SMS message is received, etc, will be appended to the callback URL. For example, suppose someone with the mobile phone number 61234567 sends an SMS text message "It is easy to receive text messages" to your SMS application's phone number. When the SMS gateway receives the SMS text message, it submits an HTTP GET to your web server / application server using an URL that looks like this: the above URL:"" is the host name of your web server / application server that is responsible for processing the inbound SMS text message."receiveSMS.php" is the file that contains the PHP script for processing the inbound SMS text message."sender=61234567" assigns the value?61234567?to the?sender?parameter. The?sender?parameter specifies the originating mobile phone number."textmessage=It+is+easy+to+receive+text+messages" assigns the value?It is easy to receive text messages?to the?textmessage?parameter. The?textmessage?parameter specifies the content of the inbound SMS text message. The "+" character is the escaped character of the space character. The space character is a special character and it cannot appear in an URL without escaping."date_time=20060101+1830" assigns the value?20060101 1830?to the?date_time?parameter. Thedate_time?parameter specifies the date and time that the SMS text message was received. In this example,?20060101 1830?means the SMS text message was received on 1 January 2006 at 6:30 pm. The date and time format may be different if you use the SMS gateway of a different SMS service provider or wireless carrier.After processing the inbound SMS text message, you may want to send a reply SMS text message to the originator. Usually this can be done simply by including the reply SMS text message in the HTTP response you send back to the SMS gateway. The SMS gateway will then forward the included text message towards the mobile phone number 61234567. The cost for sending the SMS text message will be deducted from your account.Note that the parameters that are included in the callback URL varies between SMS gateways of different SMS service providers or wireless carriers. For example, if a different SMS gateway is used, the previous SMS message "It is easy to receive text messages" may be forwarded to your web server / application server using a different URL, like below:, note that data transmitted over the Internet using the HTTP protocol is not secure. This means other people can read the data included in the above URL. Some SMS gateways allow the use of the HTTPS protocol instead of HTTP in a callback URL (i.e. change "http" at the beginning of the above URL to "https") so that inbound SMS messages can be submitted to your web server / application server securely. (HTTPS must be enabled on your web server / application server.). Introduction to GSM / GPRS Wireless Modems12.1. What is a GSM Modem?A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves.A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer.Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.As mentioned in earlier sections of this SMS tutorial, computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. You can use a GSM modem just like a dial-up modem.In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, you can do things like:Reading, writing and deleting SMS messages.Sending SMS messages.Monitoring the signal strength.Monitoring the charging status and charge level of the battery.Reading, writing and searching phone book entries.The number of SMS messages that can be processed by a GSM modem per minute is very low -- only about six to ten SMS messages per minute.12.2. What is a GPRS Modem?A GPRS modem is a GSM modem that additionally supports the GPRS technology for data transmission. GPRS stands for General Packet Radio Service. It is a packet-switched technology that is an extension of GSM. (GSM is a circuit-switched technology.) A key advantage of GPRS over GSM is that GPRS has a higher data transmission speed.GPRS can be used as the bearer of SMS. If SMS over GPRS is used, an SMS transmission speed of about 30 SMS messages per minute may be achieved. This is much faster than using the ordinary SMS over GSM, whose SMS transmission speed is about 6 to 10 SMS messages per minute. A GPRS modem is needed to send and receive SMS over GPRS. Note that some wireless carriers do not support the sending and receiving of SMS over GPRS.If you need to send or receive MMS messages, a GPRS modem is typically needed.12.3. Which is Better: Mobile Phone or GSM / GPRS Modem?In general, a GSM/GPRS modem is recommended for use with a computer to send and receive messages. This is because some mobile phones have certain limitations comparing to GSM/GPRS modems. Some of the limitations are described below:Some mobile phone models (example: Ericsson R380) cannot be used with a computer to receive concatenated SMS messages.What is a concatenated SMS message?A concatenated SMS message is a message that contains more than 140 bytes. (A normal SMS message can only contain at most 140 bytes.) Concatenated SMS works like this: the sender's mobile device breaks a message longer than 140 bytes into smaller parts. Each of these parts are then fitted in a single SMS message and sent to the recipient. When these SMS messages reach the destination, the recipient's mobile device will combine them back to one message.What is the cause of the problem?When the mobile phone receives the SMS messages that are parts of a concatenated SMS message, it combines them to one message automatically. The correct behavior should be: when the mobile phone receives the SMS messages that are parts of a concatenated SMS message, it forwards them to the computer without combining them.Many mobile phone models cannot be used with a computer to receive MMS messages. Because when they receive a MMS notification, they handle it automatically instead of forwarding it to the computer.A mobile phone may not support some AT commands, command parameters and parameter values. For example, some mobile phones do not support the sending and receiving of SMS messages in text mode. So, the AT command "AT+CMGF=1" (it instructs the mobile phone to use text mode) will cause an error message to be returned. Usually GSM/GPRS modems support a more complete set of AT commands than mobile phones.Most SMS messaging applications have to be available 24 hours a day. (For example, an SMS messaging application that provides ringtone downloading service should be running all the time so that a user can download ringtones any time he/she wants.) If such SMS messaging applications use mobile phones to send and receive SMS messages, the mobile phones have to be switched on all the time. However, some mobile phone models cannot operate with the battery removed even when an AC adaptor is connected, which means the battery will be charged 24 hours a day.Besides the above issues, mobile phones and GSM/GPRS modems are more or less the same for sending and receiving SMS messages from a computer. Actually, you can consider an AT-command-enabled mobile phone as "GSM/GPRS modem + keypad + display + ...".There is not much difference between mobile phones and GSM/GPRS modems in terms of SMS transmission rate, since the determining factor for the SMS transmission rate is the wireless network.13. How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem?13.1. What is Microsoft HyperTerminal?Microsoft HyperTerminal is a small program that comes with Microsoft Windows. You can use it to send AT commands to your mobile phone or GSM/GPRS modem. It can be found at?Start?->?Programs?->Accessories?->?Communications?->?HyperTerminal. If you cannot find it and you are using Windows 98, then probably you have not installed it. You can go to?Control Panel?->?Add/Remove Programs?->Windows Setup?tab ->?Communications?list box item ->?Details?button to install MS HyperTerminal.Before you start programming your SMS application, you may want to check if your mobile phone, GSM/GPRS modem and SIM card are working properly first. The MS HyperTerminal is a handy tool when it comes to testing your GSM devices. It is a good idea to test your GSM devices beforehand. When a problem occurs, sometimes it is difficult to tell what causes the problem. The cause can be your program, the GSM device or the SIM card. If you test your GSM device and SIM card with MS HyperTerminal and they operate properly, then it is very likely that the problem is caused by your program.For Linux users, minicom can be used instead of HyperTerminal.13.2. The Procedure for Sending AT Commands to a Mobile Phone or GSM/GPRS Modem Using MS HyperTerminalTo use MS HyperTerminal to send AT commands to your mobile phone or GSM/GPRS modem, you can follow the procedure below:Put a valid SIM card into the mobile phone or GSM/GPRS modem. You can obtain a SIM card by subscribing to the GSM service of a wireless network operator.Connect your mobile phone or GSM/GPRS modem to a computer and set up the corresponding wireless modem driver. You should find the wireless modem driver in the CD or disk that was provided by the manufacturer. If the manufacturer does not provide such CD or disk with your mobile phone or GSM/GPRS modem, you can go to the manufacturer's web site and see whether the wireless modem driver can be downloaded there. If the wireless modem driver cannot be found on the web site, you can still use Windows' standard modem driver.Run MS HyperTerminal by selecting?Start?->?Programs?->?Accessories?->?Communications?->HyperTerminal.In the?Connection Description?dialog box, enter a name and choose an icon you like for the connection. Then click the?OK?button.Figure 5. The screenshot of MS HyperTerminal's Connection Description dialog box in Windows 98.left0In the?Connect To?dialog box, choose the COM port that your mobile phone or GSM/GPRS modem is connecting to in the?Connect using?combo box. For example, choose COM1 if your mobile phone or GSM/GPRS modem is connecting to the COM1 port. Then click the?OK?button.(Sometimes there will have more than one COM port in the?Connect using?combo box. To know which COM port is used by your mobile phone or GSM/GPRS modem, follow the procedure below:In Windows 98:Go to?Control Panel?->?Modem. Then click the?Diagnostics?tab. In the list box, you can see which COM port the mobile phone or GSM/GPRS modem is connected to.In Windows 2000 and Windows XP:Go to?Control Panel?->?Phone and Modem Options. Then click the?Modems?tab. In the list box, you can see which COM port the mobile phone or GSM/GPRS modem is connected to.)Figure 6. The screenshot of MS HyperTerminal's Connect To dialog box in Windows 98.left0The?Properties?dialog box comes out. Enter the correct port settings for your mobile phone or GSM/GPRS modem. Then click the?OK?button.(To find the correct port settings that should be used with your mobile phone or GSM/GPRS modem, one way is to consult the manual of your mobile phone or GSM/GPRS modem. Another way is to check the port settings used by the wireless modem driver that you installed earlier.To check the port settings used by the wireless modem driver on Windows 98, follow these steps:a. Go to?Control Panel?->?Modem.b. Select your mobile phone or GSM/GPRS modem in the list box.c. Click the?Properties?button.d. The?Properties?dialog box appears. The?Maximum speeds?field on the?General?tab corresponds to HyperTerminal's?Bits per second?field. Click the?Connection?tab and you can find the settings for data bits, parity and stop bits. Click the?Advanced?button and you can find the setting for flow control.To check the port settings used by the wireless modem driver on Windows 2000 and Windows XP, follow these steps:a. Go to?Control Panel?->?Phone and Modem Options?->?Modems?tab.b. Select your mobile phone or GSM/GPRS modem in the list box.c. Click the?Properties?button.d. The?Properties?dialog box appears. Click the?Advanced?tab and then click the?Change Default Preferences?button.e. The?Change Default Preferences?dialog box appears. The?Port speed?field on the?General?tab corresponds to HyperTerminal's?Bits per second?field. You can also find the setting for flow control on the?General?tab. On the?Advanced?tab, you can find the settings for data bits, parity and stop bits.)Figure 7. The screenshot of MS HyperTerminal's Properties dialog box in Windows 98.left0Type "AT" in the main window. A response "OK" should be returned from the mobile phone or GSM/GPRS modem.Type "AT+CPIN?" in the main window. The AT command "AT+CPIN?" is used to query whether the mobile phone or GSM/GPRS modem is waiting for a PIN (personal identification number, i.e. password). If the response is "+CPIN: READY", it means the SIM card does not require a PIN and it is ready for use. If your SIM card requires a PIN, you need to set the PIN with the AT command "AT+CPIN=<PIN>".Figure 8. The screenshot of MS HyperTerminal's main window in Windows 98.left0If you get the responses above, your mobile phone or GSM/GPRS modem is working properly. You can start typing your own AT commands to control the mobile phone or GSM/GPRS modem.Further details about how to use AT commands to send and receive SMS messages will be provided in the following sections.14. Introduction to AT CommandsAT commands are instructions used to control a modem. AT is the abbreviation of ATtention. Every command line starts with "AT" or "at". That's why modem commands are called AT commands. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones. Besides this common AT command set, GSM/GPRS modems and mobile phones support an AT command set that is specific to the GSM technology, which includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages).Note that the starting "AT" is the prefix that informs the modem about the start of a command line. It is not part of the AT command name. For example, D is the actual AT command name in ATD and +CMGS is the actual AT command name in AT+CMGS. However, some books and web sites use them interchangeably as the name of an AT command.Here are some of the tasks that can be done using AT commands with a GSM/GPRS modem or mobile phone:Get basic information about the mobile phone or GSM/GPRS modem. For example, name of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR).Get basic information about the subscriber. For example, MSISDN (AT+CNUM) and IMSI number (International Mobile Subscriber Identity) (AT+CIMI).Get the current status of the mobile phone or GSM/GPRS modem. For example, mobile phone activity status (AT+CPAS), mobile network registration status (AT+CREG), radio signal strength (AT+CSQ), battery charge level and battery charging status (AT+CBC).Establish a data connection or voice connection to a remote modem (ATD, ATA, etc).Send and receive fax (ATD, ATA, AT+F*).Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write (AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS messages (AT+CNMI).Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook entries.Perform security-related tasks, such as opening or closing facility locks (AT+CLCK), checking whether a facility is locked (AT+CLCK) and changing passwords (AT+CPWD).(Facility lock examples: SIM lock [a password must be given to the SIM card every time the mobile phone is switched on] and PH-SIM lock [a certain SIM card is associated with the mobile phone. To use other SIM cards with the mobile phone, a password must be entered.])Control the presentation of result codes / error messages of AT commands. For example, you can control whether to enable certain error messages (AT+CMEE) and whether error messages should be displayed in numeric format or verbose format (AT+CMEE=1 or AT+CMEE=2).Get or change the configurations of the mobile phone or GSM/GPRS modem. For example, change the GSM network (AT+COPS), bearer service type (AT+CBST), radio link protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and storage of SMS messages (AT+CPMS).Save and restore configurations of the mobile phone or GSM/GPRS modem. For example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging such as the SMS center address.Note that mobile phone manufacturers usually do not implement all AT commands, command parameters and parameter values in their mobile phones. Also, the behavior of the implemented AT commands may be different from that defined in the standard. In general, GSM/GPRS modems designed for wireless applications have better support of AT commands than ordinary mobile phones.In addition, some AT commands require the support of mobile network operators. For example, SMS over GPRS can be enabled on some GPRS mobile phones and GPRS modems with the +CGSMS command (command name in text: Select Service for MO SMS Messages). But if the mobile network operator does not support the transmission of SMS over GPRS, you cannot use this feature.14.1. Basic Commands and Extended CommandsThere are two types of AT commands: basic commands and extended commands.Basic commands are AT commands that do not start with "+". For example, D (Dial), A (Answer), H (Hook control) and O (Return to online data state) are basic commands.Extended commands are AT commands that start with "+". All GSM AT commands are extended commands. For example, +CMGS (Send SMS message), +CMSS (Send SMS message from storage), +CMGL (List SMS messages) and +CMGR (Read SMS messages) are extended commands.15. General Syntax of Extended AT CommandsThe general syntax of extended AT commands is straightforward. The syntax rules are provided below. The syntax of basic AT commands is slightly different. We will not cover the syntax of basic AT commands in this SMS tutorial since all SMS messaging commands are extended AT commands.Syntax rule 1. All command lines must start with "AT" and end with a carriage return character. (We will use?<CR>?to represent a carriage return character in this SMS tutorial.) In a terminal program like HyperTerminal of Microsoft Windows, you can press the Enter key on the keyboard to output a carriage return character.Example: To list all unread inbound SMS messages stored in the message storage area, type "AT", then the extended AT command "+CMGL", and finally a carriage return character, like this:AT+CMGL<CR>Syntax rule 2. A command line can contain more than one AT command. Only the first AT command should be prefixed with "AT". AT commands in the same command-line string should be separated with semicolons.Example: To list all unread inbound SMS messages stored in the message storage area and obtain the manufacturer name of the mobile device, type "AT", then the extended AT command "+CMGL", followed by a semicolon and the next extended AT command "+CGMI":AT+CMGL;+CGMI<CR>An error will occur if both AT commands are prefixed with "AT", like this:AT+CMGL;AT+CGMI<CR>Syntax rule 3. A string is enclosed between double quotes.Example: To read all SMS messages from message storage in SMS text mode (at this time you do not need to know what SMS text mode is. More information will be provided later in this SMS tutorial), you need to assign the string "ALL" to the extended AT command +CMGL, like this:AT+CMGL="ALL"<CR>Syntax rule 4. Information responses and?result codes?(including both final result codes and unsolicited result codes) always start and end with a carriage return character and a linefeed character.Example: After sending the command line "AT+CGMI<CR>" to the mobile device, the mobile device should return a response similar to this:<CR><LF>Nokia<CR><LF><CR><LF>OK<CR><LF>The first line is the information response of the AT command +CGMI and the second line is the final result code.?<CR>?and?<LF>?represent a carriage return character and a linefeed character respectively. The final result code "OK" marks the end of the response. It indicates no more data will be sent from the mobile device to the computer / PC.When a terminal program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. Hence, the command line "AT+CGMI<CR>" that you entered and the corresponding response will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows:AT+CGMINokiaOK15.1. Information Response and Final Result CodeDon't forget the meanings of information response and final result code stated above, since you will see these two terms frequently as you go through this SMS tutorial.AT+CGMI??<-- Command line enteredNokia??<-- Information responseOK??<-- Final result code15.2. Case Sensitivity of AT CommandsIn the SMS specification, all AT commands are in uppercase letters. However, many GSM/GPRS modems and mobile phones allow you to type AT commands in either uppercase or lowercase letters. For example, on Nokia 6021, AT commands are case-insensitive and the following two command lines are equivalent:AT+CMGL<CR>at+cmgl<CR>16. Result Codes of AT CommandsResult codes are messages sent from the GSM/GPRS modem or mobile phone to provide you information about the execution of an AT command and the occurrence of an event. Two types of result codes are useful to you when dealing with AT commands for SMS messaging:Final result codesUnsolicited result codes16.1. Final Result Codes of AT CommandsA final result code marks the end of an AT command response. It is an indication that the GSM/GPRS modem or mobile phone has finished the execution of a command line. Two frequently used final result codes are OK and ERROR. Only one final result code will be returned for each command line. Thus, you will not see both OK and ERROR in the response of a command line.16.1.1. The OK Final Result CodeThe OK final result code indicates that a command line has been executed successfully by the GSM/GPRS modem or mobile phone. It always starts and ends with a carriage return character and a linefeed character.Here is an example for illustration. Let's say you send the command line "AT+CMGL;+CGMI<CR>" to your GSM/GPRS modem. The AT command "+CMGL" is used to list SMS messages stored in the message storage area and the AT command "+CGMI" is used to get the manufacturer name of the GSM/GPRS modem. If everything works properly without any errors, the command line, together with the response returned, should be something similar to this:AT+CMGL;+CGMI<CR><CR><LF>+CMGL: 1,"REC UNREAD","+85291234567",,"06/11/11,00:30:29+32"<CR><LF>Welcome to our SMS tutorial.<CR><LF><CR><LF>Nokia<CR><LF><CR><LF>OK<CR><LF>As mentioned earlier, when a terminal program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. Hence, the command line you entered, together with the response returned, will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows:AT+CMGL;+CGMI+CMGL: 1,"REC UNREAD","+85291234567",,"06/11/11,00:30:29+32"Welcome to our SMS tutorial.NokiaOK16.1.2. The ERROR Final Result CodeThe ERROR final result code indicates that an error occurs when the GSM/GPRS modem or mobile phone tries to execute a command line. After the occurrence of an error, the GSM/GPRS modem or mobile phone will not process the remaining AT commands in the command-line string.Below are some common causes of error:The syntax of the command line is incorrect.The value specified to a certain parameter is invalid.The name of the AT command is spelt incorrectly.The GSM/GPRS modem or mobile phone does not support one or more of the AT commands, command parameters or parameter values in the command-line string.Like the OK final result code, the ERROR final result code always starts and ends with a carriage return character and a linefeed character.Here is an example for illustration. Suppose you want to instruct your GSM/GPRS modem to list SMS messages from the message storage area and get the manufacturer name of the GSM/GPRS modem. You intend to type the command line "AT+CMGL;+CGMI<CR>" but make a careless mistake by typing "+CMFL" instead of "+CMGL". The GSM/GPRS modem will return the ERROR final result code, as shown below:AT+CMFL;+CGMI<CR><CR><LF>ERROR<CR><LF>As an error occurs when the GSM/GPRS modem processes "+CMFL", the GSM/GPRS modem stops the execution of the command line and so the second AT command "+CGMI" is not processed.If you type the second AT command "+CGMI" incorrectly instead of the first AT command "+CMGL", the GSM/GPRS modem will output the result of the execution of the AT command "+CMGL" before outputting the ERROR final result code, like this:AT+CMGL;+CGMU<CR><CR><LF>+CMGL: 1,"REC UNREAD","+85291234567",,"06/11/11,00:30:29+32"<CR><LF>Welcome to our SMS tutorial.<CR><LF><CR><LF>ERROR<CR><LF>As mentioned earlier, when a terminal program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. Hence, the command line you entered, together with the response returned, will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows:AT+CMGL;+CGMU+CMGL: 1,"REC UNREAD","+85291234567",,"06/11/11,00:30:29+32"Welcome to our SMS tutorial.ERROR16.2. Final Result Code Specific to SMS AT CommandsThe final result codes OK and ERROR are available to all AT commands. Unlike OK and ERROR, the +CMS ERROR final result code is only available to SMS AT commands. It notifies you about the occurrence of a message service failure.16.2.1. The +CMS ERROR Final Result Code -- Notifies the Occurrences and Causes of Message Service FailuresThe +CMS ERROR final result code is returned when a message service failure occurs. An error code is provided for programmers to check what causes the message service failure. The +CMS ERROR final result code is specific to SMS AT commands, i.e. the +CMS ERROR final result code will only be outputted by AT commands that are used to perform tasks related to SMS messaging. Below are the SMS AT commands that may output the final result code +CMS ERROR:+CMGC (command name in text: Send Command)+CMGD (command name in text: Delete Message)+CMGL (command name in text: List Messages)+CMGR (command name in text: Read Message)+CMGS (command name in text: Sending Message)+CMGW (command name in text: Write Message to Memory)+CMSS (command name in text: Send Message from Storage)+CNMA (command name in text: New Message Acknowledgement to ME/TA)+CNMI (command name in text: New Message Indications to TE)+CPMS (command name in text: Preferred Message Storage)+CRES (command name in text: Restore Settings)+CSAS (command name in text: Save Settings)+CSMS (command name in text: Select Message Service)The syntax of the +CMS ERROR final result code is:<CR><LF>+CMS ERROR:?error_code<CR><LF>Just as the final result codes OK and ERROR, the +CMS ERROR final result code always starts and ends with a carriage return character and a linefeed character.?error_code?is an integer that is associated to a certain error. A list of some error codes and their meanings can be found in "Table of +CMS Error Codes and Their Meanings".As mentioned earlier, after the execution of a command line, only one final result code is returned. Hence, when an error occurs, you will not find both +CMS ERROR and ERROR in the command response. For errors related to SMS messaging, the +CMS ERROR final result code is returned. For other errors such as invalid command syntax and unsupported AT command, the ERROR final result code is returned as usual.Below shows some common causes of +CMS errors:A SIM card is not present in the GSM/GPRS modem or mobile phone.The SIM card requires a password (e.g. PIN, PIN2, PUK and PUK2) but you have not entered it.An invalid memory index is assigned to an AT command.The memory of the GSM/GPRS modem, mobile phone or SIM card for storing SMS messages is full.The SMSC address is unknown or incorrect.Following is an example that demonstrates the usage of the +CMS ERROR result code. Let's say there is only one SMS text message stored on our Nokia 6021 and it is stored in the memory location at index 1. If we enter the command line "AT+CMGR=11" (it means "to read the SMS message at memory index 11"), Nokia 6021 will return a +CMS error:AT+CMGR=11<CR><CR><LF>+CMS ERROR: 321<CR><LF>As mentioned earlier, when a terminal program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. Hence, the command line you entered, together with the response returned, will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows:AT+CMGR=11+CMS ERROR: 321To find out the meaning of the +CMS error code 321, go to "Table of +CMS Error Codes and Their Meanings". From there, we know that the read message operation failed because an invalid memory index was assigned to the AT command +CMGR.Note that after the occurrence of a +CMS error, the GSM/GPRS modem or mobile phone will not process the remaining AT commands in the command line. Thus, if the command line sent to Nokia 6021 is "AT+CMGR=11;+CGMI" (+CGMI is the AT command for retrieving the manufacturer name of the GSM/GPRS modem or mobile phone), you will get the following result in Windows' HyperTerminal:AT+CMGR=11;+CGMI+CMS ERROR: 321But if the positions of the two AT commands in the command line are exchanged, Nokia 6021 will output the result of the execution of the AT command +CGMI before outputting the +CMS ERROR result code. Below is the result displayed in Windows' HyperTerminal:AT+CGMI;+CMGR=11Nokia+CMS ERROR: 32116.2.1.1. Table of +CMS Error Codes and Their MeaningsThe following table lists some of the +CMS error codes and their meanings.+CMS error codeMeaning300Mobile equipment (ME) failure. Mobile equipment refers to the mobile device that communicates with the wireless network. Usually it is a mobile phone or GSM/GPRS modem. The SIM card is defined as a separate entity and is not part of mobile equipment.301SMS service of mobile equipment (ME) is reserved. See +CMS error code 300 for the meaning of mobile equipment.302The operation to be done by the AT command is not allowed.303The operation to be done by the AT command is not supported.304One or more parameter values assigned to the AT command are invalid. (For?PDU mode)305One or more parameter values assigned to the AT command are invalid. (For?Text mode)310There is no SIM card.311The SIM card requires a PIN to operate. The AT command +CPIN (command name in text: Enter PIN) can be used to send the PIN to the SIM card.312The SIM card requires a PH-SIM PIN to operate. The AT command +CPIN (command name in text: Enter PIN) can be used to send the PH-SIM PIN to the SIM card.313SIM card failure.314The SIM card is busy.315The SIM card is wrong.316The SIM card requires a PUK to operate. The AT command +CPIN (command name in text: Enter PIN) can be used to send the PUK to the SIM card.320Memory/message storage failure.321The memory/message storage index assigned to the AT command is invalid.322The memory/message storage is out of space.330The SMS center (SMSC) address is unknown.331No network service is available.332Network timeout occurred.340There is no need to send message acknowledgement by the AT command +CNMA (command name in text: New Message Acknowledgement to ME/TA).500An unknown error occurred.16.3. Unsolicited Result Codes of AT CommandsUnsolicited result codes are messages sent from the GSM/GPRS modem or mobile phone to provide you information about the occurrence of an event. For example, you can use the +CNMI AT command (command name in text: New Message Indications to TE) to request the GSM/GPRS modem or mobile phone to send the unsolicited result code "+CMTI" to your computer / PC every time a new SMS message is received from the SMS center.Here are the unsolicited result codes that are related to SMS messaging:+CDSA GSM/GPRS modem or mobile phone uses +CDS to forward a newly received SMS status report to the computer / PC.+CDSIA GSM/GPRS modem or mobile phone uses +CDSI to notify the computer / PC that a new SMS status report has been received and the memory location where it is stored.+CMTA GSM/GPRS modem or mobile phone uses +CMT to forward a newly received SMS message to the computer / PC.+CMTIA GSM/GPRS modem or mobile phone uses +CMTI to notify the computer / PC that a new SMS message has been received and the memory location where it is stored.17. AT Command Operations: Test, Set, Read and ExecutionThere are four types of AT command operations:Test operation. A test operation is used to check whether a certain AT command is supported by the GSM/GPRS modem or mobile phone.Set operation. A set operation is used to change the settings used by the GSM/GPRS modem or mobile phone for certain tasks.Read operation. A read operation is used to retrieve the current settings used by the GSM/GPRS modem or mobile phone for certain tasks.Execution operation. An execution operation is used to perform an action or retrieve information/status about the GSM/GPRS modem or mobile phone.The command syntax for performing an operation will be described in detail in the following sections.17.1. Test Command -- Checks Whether a Certain AT Command is SupportedA test operation is used to check whether a certain AT command is supported by the GSM/GPRS modem or mobile phone. All extended AT commands support the test operation. The syntax is:command=?where?command?is an AT command. When an AT command is used in the above syntax to perform a test operation, it is called a test command.Here is an example. The AT command +CGMI (command name in text: Request Manufacturer Identification) is used to get the manufacturer name of the GSM/GPRS modem or mobile phone. To test whether +CGMI is supported, you can make use of the test command "+CGMI=?". The complete command line that should be entered is:AT+CGMI=?If the GSM/GPRS modem or mobile phone supports the AT command +CGMI, the result code "OK" will be returned, like this:AT+CGMI=?OKIf the GSM/GPRS modem or mobile phone does not support the AT command +CGMI, the result code "ERROR" will be returned, like this:AT+CGMI=?ERRORIn the above example, the AT command +CGMI does not have any parameters. If the AT command to be tested has parameter(s), the parameter value(s) supported by the GSM/GPRS modem or mobile phone may be printed additionally. Below is an example that illustrates the format of the response. +COMMAND1 is a fictitious AT command that has four parameters.AT+COMMAND1=?+COMMAND1: (0,1),(0-10),(0,1,5-10),("GSM","UCS2")OKThe supported values of each of the four parameters are enclosed in parentheses. Commas are used to delimit the parentheses and the values inside parentheses. A hyphen is used to indicate a range of values. The values inside parentheses can be of the string type.In the above example, the response of the test command "+COMMAND1=?" provides us the following information:(0,1). The first parameter accepts either 0 or 1.(0-10). The second parameter accepts any integer between 0 and 10.(0,1,5-10). The third parameter accepts 0, 1 or any integer between 5 and 10.("GSM","UCS2"). The fourth parameter accepts either the string "GSM" or "UCS2".To a few AT commands, the test operation does not return the parameter values supported. Instead, it returns the values that are allowed to appear in the information response of the AT command. An example is the +CBC AT command (command name in text: Battery Charge). The +CBC command is used to retrieve the connection status and charge level of the battery of the mobile device. Two values are returned in the information response of the +CBC AT command. The format is:+CBC:?connection_status,charge_levelFor example, if the battery is placed in the mobile device with no charger connected and the charge level is 80%, the result of the execution of the +CBC AT command will be:AT+CBC+CBC: 0,80OKIf you run the test command "+CBC=?", all the supported values that are allowed to appear in the connection status field and charge level field will be provided. With my Nokia 6021, the result is:AT+CBC=?+CBC: (0,1),(0-100)OK"(0,1)" means the connection status field in the information response of the +CBC AT command can contain either 0 or 1, while "(0-100)" means the charge level field can contain any integer between 0 and 100.17.2. Set Command -- Changes the Settings Used for Certain TasksA set operation changes the settings used by the GSM/GPRS modem or mobile phone for certain tasks. The syntax is:command=value1,value2,...valueNwhere?command?is an AT command and?value1?to?valueN?are the values you want to set. When an AT command is used in the above syntax to perform a set operation, it is called a set command.Here is an example. The AT command?+CSCA?(command name in text: Service Centre Address) is used to set the SMSC (SMS center) address for sending SMS messages. It takes two parameters that specify the SMSC address and type of address. To set the SMSC address to +85291234567, enter the following command line in a terminal program such as MS Windows' HyperTerminal:AT+CSCA="+85291234567",145If the set command runs successfully, the result code "OK" will be returned:AT+CSCA="+85291234567",145OKSome AT commands have optional parameters. You can choose not to assign values to them. For example, the second parameter of the +CSCA AT command is optional. If no value is assigned to the second parameter, the GSM/GPRS modem or mobile phone will use the default parameter value, which is 145 if the SMSC address starts with "+" (the plus character). Hence, this command line:AT+CSCA="+85291234567"is equivalent to:AT+CSCA="+85291234567",145Typically the values you specified with set commands are placed in volatile memory. If the GSM/GPRS modem or mobile phone is switched off or rebooted, the values you specified with set commands will be gone. When the GSM/GPRS modem or mobile phone is powered on again, all settings are back to the defaults.For some commonly used settings, there are AT commands for saving/restoring the settings to/from non-volatile memory. For example, the AT commands +CSAS (command name in text: Save Settings) and +CRES (command name in text: Restore Settings) can be used to save and restore settings related to SMS messaging such as the SMS center address.17.3. Read Command -- Retrieves the Current Settings Used for Certain TasksA read operation retrieves the current settings used by the GSM/GPRS modem or mobile phone for certain tasks. The syntax is:command?where?command?is an AT command. When an AT command is used in the above syntax to perform a read operation, it is called a read command. The read operation is supported by all AT commands that are capable of the set operation.Here is an example that illustrates how to use a read command. The AT command?+CSCA?(command name in text: Service Centre Address) is used to set the SMSC (SMS center) address for sending SMS messages. It takes two parameters that specify the SMSC address and type of address. Suppose you set the SMSC address to +85291234567 in Microsoft HyperTerminal, like this:AT+CSCA="+85291234567",145OKAfter that, if you enter the read command "+CSCA?", the GSM/GPRS modem or mobile phone will return the SMSC address and type of address that you set in the previous step:AT+CSCA?+CSCA: "+85291234567",145OK17.4. Execution Command -- Performs an Action or Retrieve Information/Status about the GSM/GPRS Modem or Mobile PhoneAn execution operation is used to perform an action (for example, send or read an SMS message) or retrieve information/status about the GSM/GPRS modem or mobile phone (for example, retrieve the current battery charge level, battery charging status or radio signal strength of the mobile network). The syntax is:command=value1,value2,...valueNwhere?command?is an AT command and?value1?to?valueN?are the values to assign to the AT command. If the AT command does not have any parameters, the part "=value1,value2,...valueN" should be omitted. When an AT command is used in the above syntax to perform an execution operation, it is called an execution command.Here is an example illustrating the use of an execution command. The AT command +CMSS (command name in text: Send Message from Storage) can be used to perform an execution operation to send an SMS message stored in message storage. It has three parameters. They specify the index of the memory location that stores the SMS message, the destination phone number and the type of the phone number respectively. To send the SMS message at index 1 to the phone number +85291234567, the following command line can be used:AT+CMSS=1,"+85291234567",145Some AT commands have optional parameters. You can choose not to assign values to them. For example, the third parameter of the +CMSS AT command is optional. If no value is assigned to the third parameter, the GSM/GPRS modem or mobile phone will use the default parameter value, which is 145 if the destination phone number starts with "+" (the plus character). Hence, this command line:AT+CMSS=1,"+85291234567"is equivalent to:AT+CMSS=1,"+85291234567",145Unlike set commands, execution commands do not store the parameter values assigned to them. So, no read command is available for retrieving the last parameter values assigned to an execution command. For example, if you send the command line "AT+CMSS?" to your GSM/GPRS modem or mobile phone, the ERROR result code will be returned:AT+CMSS?ERROR18. Testing the Communication between the PC and GSM/GPRS Modem or Mobile PhoneSuppose you have connected your GSM/GPRS modem or mobile phone to your PC / computer and started a terminal program (such as HyperTerminal on Microsoft Windows). Now you are ready to enter your first command. The first thing that is usually done is to test the communication between the PC and GSM/GPRS modem/mobile phone to confirm that everything is working properly so far. Simply enter "AT" in the terminal program to perform the test. When the GSM/GPRS modem or mobile phone receives "AT", it will send back the final result code "OK" to indicate that it has received your command successfully, like this:ATOK19. Checking if the GSM/GPRS Modem or Mobile Phone Supports the Use of AT Commands to Send, Receive and Read SMS MessagesAfter testing the communication between the PC and GSM/GPRS modem/mobile phone, the next thing that you may want to do is to check if the GSM/GPRS modem or mobile phone supports the use of AT commands to send, receive and read SMS messages. Most GSM/GPRS modems support all three functions. However, only some mobile phones support all of them.Sending SMS MessagesTo find out whether a GSM/GPRS modem or mobile phone supports the sending of SMS messages through AT commands, you have to:Use the AT command +CSMS (command name in text: Select Message Service) to check whether mobile-originated SMS messages are supported.Perform test operations to check whether +CMGS (command name in text: Send Message) and/or +CMSS (command name in text: Send Message from Storage) are supported.(You may want to check the AT commands +CMGW [command name in text: Write Message to Memory] and +CMGD [command name in text: Delete Message] in addition as they are sometimes used together with +CMSS.)Receiving SMS Messages and Reading SMS Messages from Message StorageTo find out whether a GSM/GPRS modem or mobile phone supports the receiving and reading of SMS messages through AT commands, you have to:Use the AT command +CSMS (command name in text: Select Message Service) to check whether mobile-terminated SMS messages are supported.Perform test operations to check whether +CNMI (command name in text: New Message Indications to TE), +CMGL (command name in text: List Messages) and/or +CMGR (command name in text: Read Message) are supported.If the GSM/GPRS modem or mobile phone supports the +CNMI AT command, it can send a notification or directly forward the message to the PC whenever a new SMS message arrives.If the GSM/GPRS modem or mobile phone does not support +CNMI but supports +CMGL and/or +CMGR, the PC has to poll the GSM/GPRS modem or mobile phone repeatedly in order to know if any new SMS messages have arrived.19.1. Using the AT Command +CSMS to Check if Mobile-originated SMS Messages and Mobile-terminated SMS Messages are SupportedOne use of the AT command +CSMS (command name in text: Select Message Service) is to check the message types supported by the GSM/GPRS modem or mobile phone. There are three message types: mobile-originated SMS messages, mobile-terminated SMS messages and cell broadcast messages.Mobile-originated SMS messages refer to SMS messages that are sent from a mobile device to an SMSC, i.e. outbound SMS messages.Mobile-terminated SMS messages refer to SMS messages that are sent from an SMSC to a mobile device, i.e. inbound SMS messages.Cell broadcast messages are text messages pushed to subscribers located in a certain mobile network area by the network operator. These text messages may contain news, weather information, etc.Here is an example that demonstrates how to use the +CSMS AT command to check if mobile-originated and mobile-terminated SMS messages are supported. First, send the read command "+CSMS?" to the GSM/GPRS modem or mobile phone. The response returned from our Nokia 6021 to HyperTerminal is shown below:AT+CSMS?+CSMS: 0,1,1,1OKAs you can see, the information response contains four values. The second, third and fourth values indicate whether Nokia 6021 supports mobile-terminated SMS messages, mobile-originated SMS messages and cell broadcast messages respectively. If the value is 1, it means the message type is supported. If the value is 0, it means the message type is not supported.For Nokia 6021:The third value in the information response is 1, which indicates Nokia 6021 supports mobile-originated SMS messages. So, Nokia 6021 is capable of sending SMS messages to an SMSC.The second value in the information response is 1, which indicates Nokia 6021 supports mobile-terminated SMS messages. So, Nokia 6021 is capable of receiving SMS messages from an SMSC.If the final result code "ERROR" is returned (as shown below), it is likely that the +CSMS AT command is not supported by the mobile device.AT+CSMS?ERRORTo confirm, send the test command "+CSMS=?" to the GSM/GPRS modem or mobile phone. If the final result code "ERROR" is returned (as shown below), it means the mobile device does not support the +CSMS AT command.AT+CSMS=?ERRORNote that +CSMS is a mandatory command in the AT command set for SMS messaging. If it is not supported, normally the whole AT command set for SMS messaging is not supported.19.2. Checking if the AT Commands Required for Sending, Receiving and Reading SMS Messages are SupportedThe next thing to do is to check if the AT commands required for sending, receiving and reading SMS messages are supported by the mobile phone or GSM/GPRS modem. As pointed out earlier in this SMS tutorial, you can check if a certain AT command is supported by performing a test operation. Simply execute an AT command with "=?" attached at its end. For example, "AT+CMGS=?".Before we begin the check, let's go through an overview of the AT commands that are required for sending, receiving and reading SMS messages. You will learn which AT commands should be checked and get a general idea about when these AT commands should be used.19.2.1. Overview of the AT Commands RequiredFor Sending SMS MessagesTo send SMS messages via AT commands, the GSM/GPRS modem or mobile phone has to support either +CMGS (command name in text: Send Message) or +CMSS (command name in text: Send Message from Storage). You may also find +CMGW (command name in text: Write Message to Memory) and +CMGD (command name in text: Delete Message) useful, since they are sometimes used together with +CMSS. +CMSS is used to send an SMS message located in the message storage area. If an SMS message does not exist in the message storage area, you must first use the AT command +CMGW to write the SMS message to the message storage area before you can use the AT command +CMSS to send the SMS message to the SMSC. After message submission, you may use the AT command +CMGD to delete the SMS message to free some space from the message storage area.For Receiving and Reading SMS MessagesTo receive and read SMS messages via AT commands, the GSM/GPRS modem or mobile phone has to support the AT command +CNMI (command name in text: New Message Indications to TE. TE stands for Terminal Equipment, which is the equipment that controls the GSM/GPRS modem or mobile phone. For example, a PC / computer), +CMGL (command name in text: List Messages), or +CMGR (command name in text: Read Messages).The AT command +CNMI is used to specify how newly arrived SMS messages should be handled. You can tell the GSM/GPRS modem or mobile phone either to forward newly arrived SMS messages directly to the PC, or to save them in message storage and then notify the PC about their locations in message storage.The AT command +CMGL is used to read all SMS messages that have a certain status (e.g. "received unread", "received read", etc) from the message storage area, while the AT command +CMGR is used to read the SMS message saved at a certain location of the message storage area.19.2.2. Beginning the CheckNow that you've learned the AT commands required for outbound and inbound SMS messaging are +CMGS, +CMSS, +CNMI, +CMGL and +CMGR. You can begin the check by performing a test operation with each of the AT commands. For example, you can execute the command line "AT+CMGS=?" to check whether +CMGS is supported, like this:AT+CMGS=?OKThe final result code "OK" indicates the AT command +CMGS is supported. If the GSM/GPRS modem or mobile phone returns the final result code "ERROR", it means the command is not supported.A quicker way is to copy and paste the following command line to the terminal program and execute it:AT+CMGS=?;+CMSS=?;+CNMI=?;+CMGL=?;+CMGR=?As an example, here shows the response returned from my Nokia 6021 to HyperTerminal after the execution of above command line:AT+CMGS=?;+CMSS=?;+CNMI=?;+CMGL=?;+CMGR=?+CNMI: (0-2),(0-3),(0,2,3),(0-2),(0,1)+CMGL: (0-4)OKThe return of the final result code "OK" indicates all AT commands under test are supported. If the final result code "ERROR" is returned, it means one or more AT commands are not supported.20. Operating Mode: SMS Text Mode and SMS PDU ModeThe SMS specification has defined two modes in which a GSM/GPRS modem or mobile phone can operate. They are called SMS text mode and SMS PDU mode. (PDU stands for Protocol Data Unit.) The mode that a GSM/GPRS modem or mobile phone is operating in determines the syntax of some SMS AT commands and the format of the responses returned after execution. Below are the SMS AT commands affected:+CMGS (Send Message)+CMSS (Send Message from Storage)+CMGR (Read Message)+CMGL (List Messages)+CMGW (Write Message to Memory)+CNMA (New Message Acknowledgement to ME/TA)+CMGC (Send Command)The syntax of the?unsolicited result codes?below also depends on the mode in which the GSM/GPRS modem or mobile phone is operating:+CMT (Used to forward received SMS messages to the computer / PC.)+CBM (Used to forward received cell broadcast messages to the computer / PC.)+CDS (Used to forward received status reports to the computer / PC.)These two AT commands are useful to you only if SMS text mode is used:+CSMP (Set Text Mode Parameters)+CSDH (Show Text Mode Parameters)20.1. Comparison of SMS Text Mode and SMS PDU ModeBelow we compare SMS text mode and SMS PDU mode from various aspects. The comparison should help you learn the differences between these two modes and decide which mode should be used by your SMS messaging application.Syntax of SMS AT Commands and ResponsesWhen the GSM/GPRS modem or mobile phone is operating in different modes, the syntax of certain SMS AT commands and the responses returned after command execution is different. Here's an example for illustration. Let's say you would like to send the SMS message "It is easy to send text messages." to the mobile phone number +85291234567. In SMS text mode, this is the command line that you should enter:AT+CMGS="+85291234567"<CR>It is easy to send text messages.<Ctrl+z>However, if the GSM/GPRS modem or mobile phone is operating in SMS PDU mode, executing the above command line will cause an error to occur. This is because the syntax of the +CMGS AT command is different in SMS PDU mode. To do the same task, the following command line should be used instead:AT+CMGS=42<CR>07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E<Ctrl+z>Defined Values for Certain ParametersWhen the GSM/GPRS modem or mobile phone is operating in different modes, the defined values for certain parameters are different. Usually string values are defined for text mode while numeric values are defined for PDU mode. For example, the +CMGL AT command is used to list SMS messages stored in message storage. It takes one parameter that specifies the status of the SMS messages to be retrieved. The following table lists the defined values for the parameter in text mode and PDU mode:Message statusDefined values in text modeDefined values in PDU modeReceived unread"REC UNREAD"0Received read"REC READ"1Stored unsent"STO UNSENT"2Stored sent"STO SENT"3All messages"ALL"4Suppose you would like to list all SMS messages from message storage. If the GSM/GPRS modem or mobile phone is operating in SMS text mode, you should assign the string value "ALL" to the +CMGL AT command, like this:AT+CMGL="ALL"In SMS PDU mode, the numeric value 4 should be assigned to the +CMGL AT command instead:AT+CMGL=4Input/Output Format of SMS Messages Used by SMS AT CommandsWhen the GSM/GPRS modem or mobile phone is operating in different modes, the input/output format of SMS messages used by SMS AT commands is different. In SMS text mode, headers and body of SMS messages are inputted/outputted as separate parameters/fields. In SMS PDU mode, TPDUs (Transport Protocol Data Units) in hexadecimal format are inputted and outputted. Headers and body of SMS messages are encoded in the TPDUs.Here is an example for illustration. To send the SMS message "It is easy to send text messages." to the mobile phone number +85291234567, the following command line should be used in SMS text mode. As you can see below, the destination phone number header and message body are provided to the +CMGS AT command as separate parameters.AT+CMGS="+85291234567"<CR>It is easy to send text messages.<Ctrl+z>To send the same SMS text message in SMS PDU mode, the following command line should be used instead. The message body, destination phone number header and some other headers are encoded in the hexadecimal sequence.AT+CMGS=42<CR>07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E<Ctrl+z>Ease of UseAs you can see in the previous example, it is easier to use AT commands in SMS text mode. You do not have to learn about the structure of different types of TPDUs in the bit level and the encoding and decoding of the hexadecimal sequence.Supported Features of SMS MessagingAlthough it is easier to use AT commands in SMS text mode, it supports fewer features of SMS messaging than SMS PDU mode. This is because you do not have complete control over the header values and message body in SMS text mode. Some tasks, although can be done in text mode, require the programmer to have knowledge about PDU mode and TPDU. For example, to request a status report from SMSC in SMS text mode, you have to set bit 5 of the first octet of the SMS-SUBMIT TPDU to 1 by the AT command +CSMP (command name in text: Set Text Mode Parameters). Similar tasks include setting the message validity period and sending a flash SMS message that immediately pops up on the phone screen when it arrives at the destination.Level of SupportSMS PDU mode is more commonly supported by GSM/GPRS modems and mobile phones than SMS text mode.20.2. Selecting the Operating Mode (AT+CMGF)The AT command +CMGF (command name in text: Message Format) is used to select the operating mode of the GSM/GPRS modem or mobile phone. It takes one parameter. The value of the parameter can either be 0 or 1. The values 0 and 1 refer to SMS PDU mode and SMS text mode respectively. SMS PDU mode is the default mode if it is implemented on the mobile device.To find out the operating mode(s) supported by a GSM/GPRS modem or mobile phone, perform a test operation with the +CMGF AT command. Below shows the response returned from my Nokia 6021 mobile phone after the execution of the command line "AT+CMGF=?":AT+CMGF=?+CMGF: (0,1)OKThe information response "+CMGF: (0,1)" indicates Nokia 6021 supports both PDU mode and text mode.To change the operating mode of a GSM/GPRS modem or mobile phone, perform a set operation with the +CMGF AT command. The following example demonstrates how to set the operating mode to SMS text mode:AT+CMGF=1OKIf the operating mode specified is not supported by the GSM/GPRS modem or mobile phone, the final result code "ERROR" will be returned.To find out the operating mode currently used by a GSM/GPRS modem or mobile phone, perform a read operation with the +CMGF AT command. Here is an example:AT+CMGF?+CMGF: 0OKThe response above indicates the GSM/GPRS modem or mobile phone is using SMS PDU mode.21. Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)Before you send SMS messages, one important thing that should be done is to make sure the correct service center address (SMSC address) has been set properly. Typically a service center address/SMSC address is a phone number formatted using the ISDN / telephony numbering plan (ITU E.164/E.163). For example, +85291234567. The AT command +CSCA (command name in text: Service Centre Address) can be used to set or read the service center address through which SMS messages are sent. The setting will be used by the AT commands?+CMGW?(command name in text: Write Message to Memory) and?+CMGS?(command name in text: Send Message).In SMS text mode, the only way to specify the service center address to be used by +CMGW and +CMGS is through +CSCA. However, in SMS PDU mode, it is possible to specify the service center address to the AT commands +CMGW and +CMGS directly as a parameter value.The mobile network operator usually pre-sets the correct service center number in the default profile of settings stored in the SIM card. Most mobile phones provide some ways for the user to view or change the service center number saved in the profiles of settings. For example, on my Nokia 6021 mobile phone, the message center number saved in the default profile of settings can be viewed and changed by going to?Menu?->?Messages?->?Message settings?->?Text messages?->?Sending profile?->?Default profile?->?Message centre number.Some GSM/GPRS modems and mobile phones (for example, Nokia 6021, Sony Ericsson T68i, Philips 598, etc) use the service center number in the default profile of settings as the default value of the +CSCA AT command. As a result, if the service center number in the default profile of settings is correct, you do not need to use the +CSCA AT command to set the service center number.NoteTo some mobile devices such as Nokia 6021, the +CSCA AT command does not save the service center number in non-volatile memory. Hence, if you switch off the GSM/GPRS modem or mobile phone, the setting will be gone. To save the service center number set with the AT command +CSCA, you have to make use of the AT command +CSAS (command name in text: Save Settings). To restore the saved service center number, the AT command +CRES (command name in text: Restore Settings) is required.The command behavior is different on some mobile devices such as Sony Ericsson T68i and Philips 598. Every time the AT command +CSCA is used to change the SMSC address, the new SMSC address is saved to non-volatile memory.21.1. Syntax of the +CSCA AT Command21.1.1. Setting the Service Center AddressTo set the service center address, perform a set operation with the +CSCA AT command using the following syntax: (Optional parameters are enclosed in square brackets.)+CSCA=address[,address_type]The address ParameterThe first parameter of the +CSCA AT command,?address, specifies the SMSC address to be set. Usually it is a phone number formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For example, "+85291234567". Note that the value assigned to the?address?parameter should be a string, which means you should use double quotes to enclose the phone number.The address_type ParameterThe second parameter of the +CSCA AT command,?address_type, specifies the type of the SMSC address assigned to the?address?parameter. Two values, 129 and 145, are commonly used.129. Meaning: The SMSC address is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the SMSC address is an international number, a national number or a number of other types. Example addresses: "85291234567" and "91234567".145. Meaning: The SMSC 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 SMSC address does not start with a "+" character. For example, "85291234567".145 if the SMSC address starts with a "+" character. For example, "+85291234567".21.1.2. Reading the Service Center AddressTo read the service center address, you can perform a read operation using the +CSCA read command "+CSCA?". The information response returned has the following format:+CSCA:?address,address_typeThe definition of?address?and?address_type?is the same as above.21.2. Example Demonstrating How to Use the +CSCA AT Command to Set and Read the Service Center AddressNow let's see an example that demonstrates how to use the +CSCA AT command to set and read the service center address. As said earlier, sometimes a proper service center address is in use by default and there is no need to make any changes. So first let's type the read command "+CSCA?" in a terminal program (for example, HyperTerminal in Microsoft Windows) to check if a proper service center address is in use currently. The response returned from a GSM/GPRS modem or mobile phone should be something like this:AT+CSCA?+CSCA: "+85291111111",145OKIf you find that the service center address is not correct, use the +CSCA AT command to change it, like this:AT+CSCA="+85290000000",145OKThe final result code OK indicates the service center address was set successfully. If the execution of the command line fails, the final result code will be ERROR.22. Preferred Message Storage (AT+CPMS)The AT command +CPMS (command name in text: Preferred Message Storage) serves several purposes. It can be used to:1. Select the message storage area that will be used when sending, receiving, reading, writing or deleting SMS messages.2. Find the number of messages that are currently stored in the message storage area.3. Find the maximum number of messages that can be stored in the message storage area.22.1. Selecting the Message Storage Areas to be Used for SMS Reading, Writing, Deleting, Sending or ReceivingTo select the message storage areas to be used for SMS reading, writing, deleting, sending or receiving, you should perform a set operation with the +CPMS AT command. The syntax is: (Optional parameters are enclosed in square brackets.)+CPMS=message_storage1[,message_storage2[,message_storage3]]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+CPMS="ME","SM","MT"The message_storage1 ParameterThe first parameter of the +CPMS AT command,?message_storage1, specifies the message storage area that will be used when reading or deleting SMS messages. (For details about reading SMS messages, see AT commands?+CMGR?and?+CMGL. For details about deleting SMS messages, see the AT command?+CMGD.)The message_storage2 ParameterThe second parameter of the +CPMS AT command,?message_storage2, specifies the message storage area that will be used when sending SMS messages from message storage or writing SMS messages. (For details about sending SMS messages from message storage, see the AT command?+CMSS. For details about writing SMS messages, see the AT command?+CMGW.)The message_storage3 ParameterThe third parameter of the +CPMS AT command,?message_storage3, specifies the preferred message storage area for storing newly received SMS messages. If you use the +CNMI AT command (command name in text: New Message Indications to TE) to tell the GSM/GPRS modem or mobile phone to forward newly received SMS messages directly to the PC instead of storing them in the message storage area, you do not need to care about the?message_storage3?parameter.Values that May be Assigned to the Parameters of the +CPMS AT CommandHere are the values defined in the SMS specification that may be assigned to the parametersmessage_storage1,?message_storage2?and?message_storage3:SM. It refers to the message storage area on the SIM card.ME. It refers to the message storage area on the GSM/GPRS modem or mobile phone. Usually its storage space is larger than that of the message storage area on the SIM card.MT. It refers to all message storage areas associated with the GSM/GPRS modem or mobile phone. For example, suppose a mobile phone can access two message storage areas: "SM" and "ME". The "MT" message storage area refers to the "SM" message storage area and the "ME" message storage area combined together.BM. It refers to the broadcast message storage area. It is used to store cell broadcast messages.SR. It refers to the status report message storage area. It is used to store status reports.TA. It refers to the terminal adaptor message storage area.Note that a GSM/GPRS modem or mobile phone may not support all the above values and it may support other manufacturer specific values. To learn how to find the values supported by your GSM/GPRS modem or mobile phone, please refer to the section "Finding the Message Storage Areas Supported by a GSM/GPRS Modem or Mobile Phone".22.2. Format of the Information Response of the +CPMS AT CommandIf the GSM/GPRS modem or mobile phone executes the +CPMS set command successfully, it will return an information response to the computer / PC. The information response of the +CPMS AT command has the following format:+CPMS:?used_space1,max_space1,used_space2,max_space2,used_space3,max_space3used_space1?is the number of messages currently stored in the message storage area specified by the?message_storage1?parameter.max_space1?is the maximum number of messages that can be stored in the message storage area specified by the?message_storage1?parameter.used_space2?is the number of messages currently stored in the message storage area specified by the?message_storage2?parameter.max_space2?is the maximum number of messages that can be stored in the message storage area specified by the?message_storage2?parameter.used_space3?is the number of messages currently stored in the message storage area specified by the?message_storage3?parameter.max_space3?is the maximum number of messages that can be stored in the message storage area specified by the?message_storage3?parameter.22.3. Finding the Message Storage Areas Supported by a GSM/GPRS Modem or Mobile PhoneBefore we can use the +CPMS AT command to select the message storage areas to be used for various SMS operations, we have to know what message storage areas are supported by the GSM/GPRS modem or mobile phone. Among the six types of message storage area mentioned in the last section, "SM", "ME" and "MT" are commonly supported by GSM/GPRS modems and mobile phones. To find out the message storage areas that are supported by your GSM/GPRS modem or mobile phone, you can perform a test operation with the +CPMS AT command using the command line below:AT+CPMS=?If the GSM/GPRS modem or mobile phone executes the above command line successfully, it will return an information response to the computer / PC. The information response of the +CPMS AT command has the following format:+CPMS: (storage1a,storage1b,...),(storage2a,storage2b,...),(storage3a,storage3b,...)The first, second and third parentheses contain the values supported by the?message_storage1parameter, the?message_storage2?parameter and the?message_storage3?parameter respectively.22.4. Example Demonstrating How to Use the +CPMS AT Command to Select the Message Storage Areas to be UsedNow let's see an example that demonstrates how to use the +CPMS AT command to select the message storage areas to be used for various SMS operations.Finding the Message Storage Areas Supported by the GSM/GPRS Modem or Mobile PhoneFirst, enter the command line "AT+CPMS=?" in a terminal program (for example, Windows' HyperTerminal program) to find the message storage areas supported by the GSM/GPRS modem or mobile phone. Below shows the response returned from my Nokia 6021 to Windows' HyperTerminal program after the execution of the command line "AT+CPMS=?":AT+CPMS=?+CPMS: ("ME","SM"),("ME","SM"),("MT")OKThe information response above indicates Nokia 6021 supports the use of "ME" or "SM" for SMS reading, deleting, sending and writing, while it only supports the use of "MT" for storing inbound SMS messages.Selecting Message Storage AreasAfter knowing what message storage areas are selectable, we can now perform a set operation to select the message storage areas. For example, let's say you want to instruct the GSM/GPRS modem or mobile phone to use:the phone message storage area for SMS reading and deleting,the SIM message storage area for SMS writing and sending, andboth the phone message storage area and SIM message storage area for storing inbound SMS messages.You should assign the string values "ME", "SM" and "MT" to the +CPMS AT command. Following shows the response returned from my Nokia 6021 mobile phone to HyperTerminal:AT+CPMS="ME","SM","MT"+CPMS: 2,150,2,10,4,160OKAs you can see, there are six values in the information response of the +CPMS AT command. Following is a description of them.The First and Second Fields: 2,150The value 2 indicates there are currently two messages stored in the ME message storage area. 150 is the maximum number of messages that can be stored in the ME message storage area.The Third and Fourth Fields: 2,10The value 2 indicates there are currently two messages stored in the SM message storage area. 10 is the maximum number of messages that can be stored in the SM message storage area.The Fifth and Sixth Fields: 4,160The value of the fifth field of the +CPMS information response, 4, indicates there are currently four messages stored in the MT message storage area. The same result can also be obtained by calculating manually like this:Number of messages currently stored in the ME message storage area + Number of messages currently stored in the SM message storage area= 2 + 2= 4The value of the sixth field of the +CPMS information response, 160, is the maximum number of messages that can be stored in the MT message storage area. The same result can also be obtained by calculating manually like this:Maximum number of messages that can be stored in the ME message storage area + Maximum number of messages that can be stored in the SM message storage area= 150 + 10= 16022.5. Finding the Message Storage Areas Currently Used, Number of Messages Currently Stored and Maximum Number of Messages AllowedTo find out the message storage areas currently used, the number of messages currently stored in a certain message storage area, and the maximum number of messages that are allowed to be stored in a certain message storage area, you can perform a read operation with the +CPMS AT command using the command line below:AT+CPMS?If the GSM/GPRS modem or mobile phone executes the above command line successfully, it will return an information response to the computer / PC. The +CPMS information response has the following format:+CPMS:?message_storage1,used_space1,max_space1,message_storage2,used_space2,max_space2,message_storage3,used_space3,max_space3The message_storage1 FieldThe first field of the information response of the +CPMS AT command,?message_storage1, contains a string that indicates the message storage area to be used when reading or deleting SMS messages. (For details about reading SMS messages, see AT commands?+CMGR?and?+CMGL. For details about deleting SMS messages, see the AT command?+CMGD.)The used_space1 FieldThe second field of the information response of the +CPMS AT command,?used_space1, contains an integer that indicates the number of messages currently stored in the message storage areamessage_storage1.The max_space1 FieldThe third field of the information response of the +CPMS AT command,?max_space1, contains an integer that indicates the maximum number of messages that can be stored in the message storage areamessage_storage1.The message_storage2 FieldThe fourth field of the information response of the +CPMS AT command,?message_storage2, contains a string that indicates the message storage area to be used when sending SMS messages from message storage or writing SMS messages. (For details about sending SMS messages from message storage, see the AT command?+CMSS. For details about writing SMS messages, see the AT command+CMGW.)The used_space2 FieldThe fifth field of the information response of the +CPMS AT command,?used_space2, contains an integer that indicates the number of messages currently stored in the message storage areamessage_storage2.The max_space2 FieldThe sixth field of the information response of the +CPMS AT command,?max_space2, contains an integer that indicates the maximum number of messages that can be stored in the message storage area?message_storage2.The message_storage3 FieldThe seventh field of the information response of the +CPMS AT command,?message_storage3, contains a string that indicates the preferred message storage area to be used for storing newly received SMS messages.The used_space3 FieldThe eighth field of the information response of the +CPMS AT command,?used_space3, contains an integer that indicates the number of messages currently stored in the message storage areamessage_storage3.The max_space3 FieldThe ninth field of the information response of the +CPMS AT command,?max_space3, contains an integer that indicates the maximum number of messages that can be stored in the message storage area?message_storage3.22.5.1. ExampleThe example below shows the response returned by my Nokia 6021 mobile phone to Windows' HyperTerminal program after the read command "+CPMS?" has been executed:AT+CPMS?+CPMS: "ME",2,150,"SM",2,10,"MT",4,160OKAs you can see, there are nine values in the information response of the +CPMS AT command. Following is a description of them.The First, Second and Third Fields: "ME",2,150The string value "ME" indicates that the phone message storage area will be used for SMS reading and deleting. The value 2 indicates that there are currently two messages stored in the phone message storage area. 150 is the maximum number of messages that can be stored in the phone message storage area.The Fourth, Fifth and Sixth Fields: "SM",2,10The string value "SM" indicates the SIM message storage area will be used for SMS writing and sending. The value 2 tells us that there are currently two messages stored in the SIM message storage area. 10 is the maximum number of messages that can be stored in the SIM message storage area.The Seventh, Eighth and Ninth Fields: "MT",4,160The string value "MT" indicates that both the phone message storage area and SIM message storage area will be used for storing inbound SMS messages. The value 4 tells us that there are currently four messages stored in the phone message storage area and SIM message storage area. 160 is the maximum number of messages that can be stored in the phone message storage area and SIM message storage area.23. Writing SMS Messages to Memory / Message Storage (AT+CMGW)The AT command +CMGW (command name in text: Write Message to Memory) is used to write an SMS message to memory (i.e. message storage). The memory/message storage area to which SMS messages are written is specified by the +CPMS AT command (command line in text: Preferred Message Storage). Details about the +CPMS AT command can be found in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.23.1. Syntax of the +CMGW AT Command in SMS Text ModeIn SMS text mode, the syntax of the +CMGW AT command is: (Optional parameters are enclosed in square brackets.)+CMGW[=address[,address_type[,message_status]]]<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+CMGW="+85291234567",145,"STO UNSENT"<CR>This is an example for illustrating the syntax of the +CMGW AT command in SMS text mode.<Ctrl+z>The address ParameterThe first parameter of the +CMGW 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" and "91234567". Note that the value passed to the?address?parameter should be a string, i.e. it should be enclosed in double quotes.The?address?parameter is optional and so it can be omitted. Later when you want to send the SMS message out, you can specify the destination address by the?+CMSS AT command?(command name in text: Send Message from Storage).The address_type ParameterThe second parameter of the +CMGW 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. Meaning: 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. Meaning: 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 message_status ParameterThe third parameter of the +CMGW AT command,?message_status, specifies the status of the SMS message to be written. The SMS specification has defined four status values:REC UNREAD. It refers to the message status "received unread".REC READ. It refers to the message status "received read".STO UNSENT. It refers to the message status "stored unsent". This is the default value.STO SENT. It refers to the message status "stored sent".Note that the value assigned to the?message_status?parameter should be a string. Thus, it should be enclosed in double quotes.As?message_status?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?message_status?parameter, which is "STO UNSENT".The <CR> Character<CR>, which represents the carriage return character, follows the?message_status?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 +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text Mode".The sms_message_body ParameterThe fourth parameter of the +CMGW AT command,?sms_message_body, specifies the SMS message body to be written to the memory/message storage area. Entering the?<Esc>?character will cancel the +CMGW AT command. If you don't understand what this means, see the example in the section "Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text Mode".The <Ctrl+z> CharacterWhen 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 write the SMS message to the memory/message storage area.23.2. SMSC Number Stored with the SMS Message (SMS Text Mode)In SMS text mode, the +CMGW AT command does not have a parameter that allows you to specify an SMSC number. (Note that the +CMGW AT command does have such parameter when the GSM/GPRS modem or mobile phone is operating in SMS PDU mode.) However, when an SMS message is written to message storage, an SMSC number is actually stored with it. The SMSC number stored is the one specified by the?+CSCA AT command?(command name in text: Service Centre Address). Later if you send the SMS message, it will be transmitted through this SMSC. Once an SMS message has been written to message storage, it is not possible to change the SMSC number stored with the SMS message by using AT commands.Note that it is possible that the command behavior on your mobile device is slightly different from what was described above.More information about this issue is available in the "SMSC Number to be Used by the +CMSS AT Command to Send SMS Messages" section of this SMS tutorial.23.3. Format of the Information Response of the +CMGW AT Command in SMS Text ModeIf the GSM/GPRS modem or mobile phone writes the SMS message to the message storage area successfully, it will return an information response to the computer / PC. In SMS text mode, the information response of the +CMGW AT command has the following format:+CMGW:?indexindex?is an integer that tells us the memory location to which the SMS message was written in the message storage area.23.4. Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS Text ModeNow let's see a more detailed example that demonstrates how to use the +CMGW AT command to write SMS text messages to message storage in SMS text mode and how the +CMGW AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS Text ModeFirst, enter the command line "AT+CMGF=1" in a terminal program (for example, HyperTerminal in Microsoft Windows) to instruct the GSM/GPRS modem or mobile phone to operate in SMS text mode. This step is necessary because the default mode is SMS PDU mode. Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=1":AT+CMGF=1OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS text mode. To check whether the GSM/GPRS modem or mobile phone supports SMS text mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The value 0 represents SMS PDU mode and the value 1 represents SMS text mode. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Selecting the Message Storage Area to Write SMS Text Messages toSecond, use the AT command +CPMS (command name in text: Preferred Message Storage) to select the message storage area to write SMS text messages to. For example, to instruct the GSM/GPRS modem or mobile phone to use the message storage area in the SIM card for the AT command +CMGW, assign the string value "SM" to the second parameter of the +CPMS AT command, like this:AT+CPMS="ME","SM"The first parameter of the +CPMS AT command is used to select the message storage area for reading and deleting SMS messages. It has no use to us here. So, it does not matter what value is assigned to the first parameter.Now press the Enter key on the keyboard and you should see something similar to this:AT+CPMS="ME","SM"+CPMS: 2,150,2,10,4,160OKDetailed information about the +CPMS AT command is available in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.Setting the SMSC Number to be Stored with the SMS Text MessageThird, use the AT command +CSCA (command name in text: Service Centre Address) to set the SMSC number to be stored with the SMS text message. Later if you send the SMS text message, it will be transmitted via the SMSC at this number. Usually the default setting is correct and you do not need to make any changes. Below demonstrates how to use the +CSCA AT command to set "+85290000000" as the SMSC number:AT+CSCA="+85290000000"OKDetailed information about the +CSCA AT command can be found in the "Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)" section of this SMS tutorial.Writing Text MessagesFourth, you can now use the +CMGW AT command to write a text message to the message storage area. Suppose you want the destination mobile phone number to be +85291234567 and the message status to be "stored unsent", you should enter something like this in the terminal program:AT+CMGW="+85291234567",145,"STO UNSENT"Then, press the Enter key of the keyboard to send a carriage return character to the GSM/GPRS modem or mobile phone. The GSM/GPRS modem or mobile phone will send back a prompt formed by four characters. They are the carriage return character, the linefeed character, the ">" character and the space character. If all characters are to be displayed, the characters you have sent to and received from the GSM/GPRS modem or mobile phone so far are:AT+CMGW="+85291234567",145,"STO UNSENT"<CR><CR><LF>><Space>However, the carriage return character and linefeed character have special meanings to a terminal program. When a terminal program sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. So, here is what you will actually see in a terminal program such as HyperTerminal:AT+CMGW="+85291234567",145,"STO UNSENT">?If you want to cancel the write command at this point, press the Esc key on the keyboard. The GSM/GPRS modem or mobile phone will then return the OK final result code. Here shows the response returned from Nokia 6021:AT+CMGW="+85291234567",145,"STO UNSENT">???OKSome mobile devices return a slightly different response. One example is Philips 598:AT+CMGW="+85291234567",145,"STO UNSENT">?OKIf you do not want to cancel the write command, enter the body of the SMS text message that you want to write to the message storage area. Press Enter on the keyboard if you want to start a new line. When finished, press Ctrl+z on the keyboard. The GSM/GPRS modem or mobile phone then attempts to write the text message to the message storage area and returns a response to the computer / PC. Suppose the SMS text message is "It is easy to write text messages.". Below shows what you should see in a terminal program:AT+CMGW="+85291234567",145,"STO UNSENT"> It is easy to write text messages.+CMGW: 3OKThe value in the information response is the index that indicates the location where the SMS text message is stored in the message storage area. In the above example, the information response tells us that the SMS text message "It is easy to write text messages." has been written to the memory location at index 3.The final result code OK tells us the execution of the +CMGW AT command is successful. If it fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR. For example, if the message storage area is out of storage space, the GSM/GPRS modem or mobile phone will return +CMS error 322, like this:AT+CMGW="+85291234567",145,"STO UNSENT"> It is easy to write text messages.+CMS ERROR: 32223.5. Syntax of the +CMGW AT Command in SMS PDU ModeIn SMS PDU mode, the syntax of the +CMGW AT command is: (Optional parameters are enclosed in square brackets.)+CMGW=TPDU_length[,message_status]<CR>SMSC_number_and_TPDU<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+CMGW=42,2<CR>07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E<Ctrl+z>The TPDU_length ParameterThe first parameter of the +CMGW AT command,?TPDU_length, specifies the length (in octets. 1 octet = 8 bits) of the TPDU (Transfer Protocol Data Unit) assigned to the?SMSC_number_and_TPDU?parameter. In the earlier example command line, the value assigned to the?SMSC_number_and_TPDU?parameter is:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EIt can be divided into two parts. The following part is the TPDU:01000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EThe TPDU is coded in hexadecimal format. Each character represents 4 bits, i.e. 1/2 octet. The TPDU has 84 characters and so there are totally 42 octets. That's why the value assigned to the?TPDU_lengthparameter is 42.The message_status ParameterThe second parameter of the +CMGW AT command,?message_status, specifies the status of the SMS message to be written. The SMS specification has defined four status values:0. It refers to the message status "received unread".1. It refers to the message status "received read".2. It refers to the message status "stored unsent". This is the default value.3. It refers to the message status "stored sent".As?message_status?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?message_status?parameter, which is 2.Note: To some mobile devices (for example, Sony Ericsson T68i and Philips 598), an error will occur if the TPDU type is SMS-SUBMIT and the?message_status?parameter value is 0 or 1, or if the TPDU type is SMS-DELIVER and the?message_status?parameter value is 2 or 3.The <CR> Character<CR>, which represents the carriage return character, follows the?message_status?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 +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS PDU Mode".The SMSC_number_and_TPDU ParameterThe third parameter of the +CMGW AT command,?SMSC_number_and_TPDU, specifies the SMSC number and the TPDU in hexadecimal format. 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 +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS PDU Mode".In the earlier example command line, the value assigned to the?SMSC_number_and_TPDU?parameter is:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EHere is some of the information encoded in the above hexadecimal sequence:TPDU type: SMS-SUBMITSMSC number: +85290000000Destination phone number: +85291234567Text message: "It is easy to send text messages."If you want to learn how the hexadecimal sequence is coded, please go to the section titled "Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT Command" of this SMS tutorial.Besides the TPDU type SMS-SUBMIT, the +CMGW AT command accepts other TPDU types such as SMS-DELIVER.The <Ctrl+z> CharacterWhen you finish entering the value for the?SMSC_number_and_TPDU?parameter, you have to enter the<Ctrl+z>?character to mark the end of the value. The GSM/GPRS modem or mobile phone will then attempt to write the SMS message to the message storage area.23.6. SMSC Number Stored with the SMS Message (SMS PDU Mode)In SMS PDU mode, you can specify an SMSC number to the +CMGW AT command through theSMSC_number_and_TPDU?parameter. If no SMSC number is specified, the GSM/GPRS modem or mobile phone retrieves the SMSC number specified by the?+CSCA?AT command (command name in text: Service Centre Address) and stores it with the SMS message. Later if you send the SMS message, it will be transmitted through this SMSC. Once an SMS message has been written to message storage, it is not possible to change the SMSC number stored with the SMS message by using AT commands.Note that it is possible that the command behavior on your mobile device is slightly different from what was described above.More information about this issue is available in the "SMSC Number to be Used by the +CMSS AT Command to Send SMS Messages" section of this SMS tutorial.23.7. Format of the Information Response of the +CMGW AT Command in SMS PDU ModeIf the GSM/GPRS modem or mobile phone writes the SMS message to the message storage area successfully, it will return an information response to the computer / PC. In SMS PDU mode, the information response of the +CMGW AT command has the following format:+CMGW:?indexHere is an example that gives you some idea of how an actual information response should look like:+CMGW: 5The index FieldThe information response of the +CMGW AT command has only one field called?index. The field contains an integer that tells us the memory location to which the SMS message was written in the message storage area.23.8. Example Demonstrating How to Use the +CMGW AT Command to Write SMS Text Messages to Message Storage in SMS PDU ModeNow let's see a more detailed example that demonstrates how to use the +CMGW AT command to write SMS text messages to message storage in SMS PDU mode and how the +CMGW AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS PDU ModeFirst, instruct the GSM/GPRS modem or mobile phone to operate in SMS PDU mode by entering the command line "AT+CMGF=0" in a terminal program (for example, HyperTerminal in Microsoft Windows). Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=0":AT+CMGF=0OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS PDU mode. To check whether the GSM/GPRS modem or mobile phone supports SMS PDU mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The values 0 and 1 represent SMS PDU mode and SMS text mode respectively. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Selecting the Message Storage Area to Write SMS Text Messages toSecond, use the AT command +CPMS (command name in text: Preferred Message Storage) to select the message storage area to write SMS text messages to. For example, to instruct the GSM/GPRS modem or mobile phone to use the message storage area in the SIM card for the AT command +CMGW, assign the string value "SM" to the second parameter of the +CPMS AT command, like this:AT+CPMS="ME","SM"The first parameter of the +CPMS AT command is used to select the message storage area for reading and deleting SMS messages. It has no use to us here. So, it does not matter what value is assigned to the first parameter.Now press the Enter key on the keyboard and you should see something similar to this:AT+CPMS="ME","SM"+CPMS: 2,150,2,10,4,160OKDetailed information about the +CPMS AT command is available in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.(Optional in SMS PDU Mode) Setting the SMSC Number to be Stored with the SMS Text MessageThird, use the AT command +CSCA (command name in text: Service Centre Address) to set the SMSC number to be stored with the SMS text message. Later if you send the SMS text message, it will be transmitted via the SMSC at this number. Usually the default setting is correct and you do not need to make any changes. In SMS PDU mode, you can skip this step since you can pass the SMSC number directly to the +CMGW AT command as a parameter. This is different from SMS text mode, in which the only way to set the SMSC number to be stored with the SMS text message is by using the +CSCA AT command.Below demonstrates how to use the +CSCA AT command to set "+85290000000" as the SMSC number:AT+CSCA="+85290000000"OKDetailed information about the +CSCA AT command can be found in the "Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)" section of this SMS tutorial.Writing Text MessagesFourth, you can now use the +CMGW AT command to write a text message to the message storage area. Suppose you want the SMS center number to be +85290000000, the destination mobile phone number to be +85291234567, and the text message to be "It is easy to send text messages.", the hexadecimal sequence to be passed to the +CMGW AT command should be:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72Eand the length of the SMS-SUBMIT TPDU embedded in the hexadecimal sequence is 42 octets. If you forget how these values are obtained, you may want to go back to the earlier section "Syntax of the +CMGW AT Command in SMS PDU Mode".Now pass the length of the SMS-SUBMIT TPDU to the +CMGW AT command by entering the following command line in the terminal program:AT+CMGW=42Then, press the Enter key of the keyboard to send a carriage return character to the GSM/GPRS modem or mobile phone. The GSM/GPRS modem or mobile phone will send back a prompt formed by four characters. They are the carriage return character, the linefeed character, the ">" character and the space character. If all characters are to be displayed, the characters you have sent to and received from the GSM/GPRS modem or mobile phone so far are:AT+CMGW=42<CR><CR><LF>><Space>However, the carriage return character and linefeed character have special meanings to a terminal program. When a terminal program sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. So, here is what you will actually see in a terminal program such as HyperTerminal:AT+CMGW=42>?If you want to cancel the write command at this point, press the Esc key on the keyboard. The GSM/GPRS modem or mobile phone will then return the OK final result code. Here shows the response returned from Nokia 6021 (or Sony Ericsson T68i):AT+CMGW=42>???OKSome mobile devices return a slightly different response. One example is Philips 598:AT+CMGW=42>?OKIf you do not want to cancel the write command, enter the hexadecimal sequence containing the SMS text message that you want to write to the message storage area. When finished, press Ctrl+z on the keyboard. The GSM/GPRS modem or mobile phone then attempts to write the text message to the message storage area and returns a response to the computer / PC. Below shows what you should see in a terminal program:AT+CMGW=42> 07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E+CMGW: 3OKThe value in the +CMGW information response is the index that indicates the memory location to which the SMS text message was written. From above, we know that the SMS text message was written to the memory location at index 3.The final result code OK tells us the writing of the text message to message storage was successful. If the execution of the +CMGW AT command fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR. For example, if the message storage area is out of storage space, the GSM/GPRS modem or mobile phone will return +CMS error 322, like this:AT+CMGW=42> 07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E+CMS ERROR: 32224. Deleting SMS Messages from Message Storage (AT+CMGD)The AT command +CMGD (command name in text: Delete Message) is used to delete SMS message(s) from message storage. The message storage area from which SMS messages are deleted is specified by the +CPMS AT command (command name in text: Preferred Message Storage). Details about the +CPMS AT command can be found in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.24.1. Syntax of the +CMGD AT CommandThe syntax of the +CMGD AT command is: (Optional parameters are enclosed in square brackets.)+CMGD=index[,flag]In the above line,?index?is an integer specifying the location of the SMS message to be deleted from the message storage area by the +CMGD AT command, and?flag?is an integer specifying whether to delete SMS messages according to their message status. The SMS specification has defined these?flagvalues: 0, 1, 2, 3 and 4.0. Meaning: Delete only the SMS message stored at the location?index?from the message storage area. This is the default value.1. Meaning: Ignore the value of?index?and delete all SMS messages whose status is "received read" from the message storage area.2. Meaning: Ignore the value of?index?and delete all SMS messages whose status is "received read" or "stored sent" from the message storage area.3. Meaning: Ignore the value of?index?and delete all SMS messages whose status is "received read", "stored unsent" or "stored sent" from the message storage area.4. Meaning: Ignore the value of?index?and delete all SMS messages from the message storage area.To find the?flag?values supported by your GSM/GPRS modem or mobile phone, you can perform a test operation using the +CMGD AT command. See the next section for the details.24.2. Finding the Supported Indexes and Flag ValuesPerforming a test operation with the +CMGD AT command allows you to find all indexes that are supported by the?index?parameter. The test operation may also return all supported values of the?flagparameter. Here is the format of the information response returned after the execution of the test command "+CMGD=?": (Optional fields are enclosed in square brackets.)+CMGD: (list_of_indexes)[,(list_of_flag_values)]The values inside the first parentheses are the values that are supported by the?index?parameter of the +CMGD AT command.The values inside the second parentheses are the values that are supported by the?flag?parameter of the +CMGD AT command.?Note: A GSM/GPRS modem or mobile phone might not provide these values since the SMS specification defines them as optional.As an example, here is the response returned from my Nokia 6021 mobile phone to Windows' HyperTerminal program after the execution of the test command "+CMGD=?":AT+CMGD=?+CMGD: (1-10),(0-4)OKFrom above, we know that the Nokia 6021 mobile phone allows any integer between 1 and 10 to be assigned to the?index?parameter of the +CMGD AT command. Also, the Nokia 6021 mobile phone supports all of the five?flag?values defined in the SMS specification.Do you remember that we described the format of values inside parentheses in the section "Test Command -- Checks Whether a Certain AT Command is Supported"? If not, you may want to go back and have a look. Here are a few examples showing some of the possibilities: "(0-4)", "(0,1,2,3,4)", "(0,2-4)".24.3. Example Demonstrating How to Use the +CMGD AT Command to Delete SMS Text MessagesNow let's see an example that demonstrates how to use the +CMGD AT command to delete an SMS text message from the message storage area. Suppose you have written an SMS text message to the message storage area by the +CMGW AT command (details about the +CMGW AT command can be found in the earlier section "Writing SMS Messages to Memory / Message Storage (AT+CMGW)" of this SMS tutorial), like this:AT+CMGW="+85291234567"> A simple demo of SMS text messaging.+CMGW: 1OKThe information response of the +CMGW AT command tells us that the SMS text message is stored in the memory location at index 1. To delete the SMS text message, specify 1 to the?index?parameter of the +CMGD AT command, like this:(Important note: Make sure you are writing text messages to and deleting text messages from the same message storage area. If not, you may delete the wrong text message. Details about message storage areas can be found in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.)AT+CMGD=1OKThe final result code OK indicates the SMS text message "A simple demo of SMS text messaging." was deleted successfully. If the operation fails, the final result code returned will either be ERROR or +CMS ERROR.Here is another example. Suppose you want to delete all SMS messages stored in the message storage area. To do this, assign 4 to the?flags?parameter of the +CMGD AT command. The value assigned to theindex?parameter does not matter since it will be ignored by the GSM/GPRS modem or mobile phone.AT+CMGD=1,4OK25. Sending SMS Messages from a Computer / PC Using AT Commands (AT+CMGS, AT+CMSS)Either of the AT commands +CMGS (command name in text: Send Message) and +CMSS (command name in text: Send Message from Storage) can be used to send SMS messages from a computer / PC. The key difference between them is that the +CMGS AT command takes the SMS message to be sent as a parameter, while the +CMSS AT command takes the index number that specifies the location of the SMS message in the message storage area as a parameter. Following is an example for illustrating the difference. Suppose you want to send the text message "Sending text messages is easy." from a computer / PC to the mobile phone number 91234567 using the +CMGS AT command in SMS text mode. Here is the command line to be used:AT+CMGS="91234567"<CR>Sending text messages is easy.<Ctrl+z>To send the same text message using the +CMSS AT command, first you have to use the?AT command +CMGW?(command name in text: Write Message to Memory) to write the text message to the message storage area. In SMS text mode, the command line should be:AT+CMGW="91234567"<CR>Sending text messages is easy.<Ctrl+z>Let's say the SMS text message is now located at index 3 of the message storage area. You can use the +CMSS AT command to send the text message to the message center by the following command line:AT+CMSS=3As storage space is limited, if every SMS text message sent is left in the message storage area, there will come a time when no more SMS text messages can be written. To free some storage space, you can use the?AT command +CMGD?(command name in text: Delete Message) to delete the SMS text message from the message storage area, like this:AT+CMGD=3As you can see above, sending an SMS message by the +CMSS AT command is a bit cumbersome, since it involves more steps and AT commands. However, a copy of the sent SMS message can be saved in the message storage area. This is not achievable with the +CMGS AT command.In some situations, it is more convenient to send SMS messages by the +CMSS AT command than the +CMGS AT command. For example, if you have to send the same SMS message to multiple recipients, using the +CMSS AT command is more convenient:AT+CMSS=3,"91234567"AT+CMSS=3,"97777777"AT+CMSS=3,"96666666"...Note: To keep things simple in the above examples, we assume that the same message storage area is used by the AT commands +CMSS, +CMGW, +CMGD and for receiving SMS messages. But this may not be true in real situations. To learn how to set the message storage areas to be used by different SMS operations, please refer to the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.25.1. Comparison Table of the AT Commands +CMGS and +CMSSThe comparison table below summarizes the differences between the AT commands +CMGS and +CMSS that are discussed in the previous section.+CMGS AT command+CMSS AT commandParameters+CMGS takes the SMS message to be sent as a parameter.+CMSS takes the index number that specifies the location of the SMS message in the message storage area as a parameter.Sending new SMS messagesUsing +CMGS is more convenient. +CMGS can be used to send new SMS messages without the help of other AT commands.However, no copy of the SMS message sent is saved in the message storage area.+CMSS has to be used together with +CMGW and +CMGD for sending new SMS messages. As a result, the process involves more steps and is a bit cumbersome.However, a copy of the SMS message sent can be saved in the message storage area.Sending the same SMS message to multiple recipientsUsing +CMGS is less convenient.Using +CMSS is more convenient.25.2. Syntax of the +CMGS AT Command in SMS Text ModeIn 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 ParameterThe 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 ParameterThe 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 ParameterThe 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> CharacterWhen 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.25.3. Format of the Information Response of the +CMGS AT Command in SMS Text ModeIf the GSM/GPRS modem or mobile phone sends the SMS message successfully, it will return an information response to the computer / PC. In SMS text mode, the information response of the +CMGS AT command has the following format: (Optional fields are enclosed in square brackets.)+CMGS:?message_reference[,service_center_time_stamp]Here is an example that gives you some idea of how an actual information response should look like:+CMGS: 5,"07/02/05,08:30:45+32"The message_reference FieldThe first field of the information response of the +CMGS AT command,?message_reference, contains an integer in the range from 0 to 255. It is a reference number allocated by the GSM/GPRS modem or mobile phone to the SMS message sent.The service_center_time_stamp FieldThe second field of the information response of the +CMGS AT command,?service_center_time_stamp, contains a string that tells the time and date at which the SMS message arrived at the service center (i.e. SMSC). The time stamp format is "yy/MM/dd,hh:mm:ss±zz". (yy = year, MM = month, dd = day, hh = hour, mm = minute, ss = second, zz = time zone. Note: the unit of time zone is a quarter of an hour.)For example, "07/02/05,08:30:45+32" represents 5 February 2007, 8:30:45 GMT+8 hours. "+32" means GMT+8 hours, since 32 quarters of an hour = 8 hours.Note that?service_center_time_stamp?is an optional field. A GSM/GPRS modem or mobile phone includes this field in the information response only if the messaging service value set by the AT command +CSMS (command name in text: Select Message Service) is 1 and the mobile network supports the use of this messaging service value. By default the messaging service value is 0. Usually this is the value to be used and the?service_center_time_stamp?field is not shown.25.4. Example Demonstrating How to Use the +CMGS AT Command to Send SMS Text Messages in SMS Text ModeNow let's see a more detailed example that demonstrates how to use the +CMGS AT command to send SMS text messages in SMS text mode and how the +CMGS AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS Text ModeFirst, enter the command line "AT+CMGF=1" in a terminal program (for example, HyperTerminal in Microsoft Windows) to instruct the GSM/GPRS modem or mobile phone to operate in SMS text mode. This step is necessary because the default mode is SMS PDU mode. Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=1":AT+CMGF=1OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS text mode. To check whether the GSM/GPRS modem or mobile phone supports SMS text mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The value 0 represents SMS PDU mode and the value 1 represents SMS text mode. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Setting the SMSC Number to be Used to Send SMS Text MessagesSecond, use the AT command +CSCA (command name in text: Service Centre Address) to set the SMSC number to be used to send SMS text messages. Usually the default setting is correct and you do not need to make any changes. Below demonstrates how to use the +CSCA AT command to set "+85290000000" as the SMSC number:AT+CSCA="+85290000000"OKDetailed information about the +CSCA AT command can be found in the "Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)" section of this SMS tutorial.Sending Text MessagesThird, use the +CMGS AT command to send a text message to the SMSC. Suppose you want to send a text message to the mobile phone number +85291234567, you should enter something like this in a terminal program:AT+CMGS="+85291234567"Then, press the Enter key of the keyboard to send a carriage return character to the GSM/GPRS modem or mobile phone. The GSM/GPRS modem or mobile phone will send back a prompt formed by four characters. They are the carriage return character, the linefeed character, the ">" character and the space character. If all characters are to be displayed, the characters you have sent to and received from the GSM/GPRS modem or mobile phone so far are:AT+CMGS="+85291234567"<CR><CR><LF>><Space>However, the carriage return character and linefeed character have special meanings to a terminal program. When a terminal program sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. So, here is what you will actually see in a terminal program such as HyperTerminal:AT+CMGS="+85291234567">?If you want to cancel the send command at this point, press the Esc key on the keyboard. The GSM/GPRS modem or mobile phone will then return the OK final result code. Here shows the response returned from Nokia 6021:AT+CMGS="+85291234567">???OKSome mobile devices return a slightly different response. One example is Philips 598:AT+CMGS="+85291234567">?OKIf you do not want to cancel the send command, enter the body of the SMS text message that you want to send from your computer / PC. Press Enter on the keyboard if you want to start a new line. When finished, press Ctrl+z on the keyboard. The GSM/GPRS modem or mobile phone then attempts to send the SMS text message to the SMSC and returns a response to the computer / PC. Suppose the SMS text message is "It is easy to send text messages.". Below shows what you should see in a terminal program:AT+CMGS="+85291234567"> It is easy to send text messages.+CMGS: 12OKThe value in the information response, 12, is the message reference number allocated to the SMS text message. The final result code OK indicates the sending of the SMS text message was successful. If the execution of the +CMGS AT command fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.25.5. Syntax of the +CMGS AT Command in SMS PDU ModeIn SMS PDU mode, the syntax of the +CMGS AT command is:+CMGS=TPDU_length<CR>SMSC_number_and_TPDU<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=42<CR>07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E<Ctrl+z>The TPDU_length ParameterThe first parameter of the +CMGS AT command, TPDU_length, specifies the length (in octets. 1 octet = 8 bits) of the TPDU (Transfer Protocol Data Unit) assigned to the SMSC_number_and_TPDU parameter. In the earlier example command line, the value assigned to the SMSC_number_and_TPDU parameter is:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EIt can be divided into two parts. The following part is the TPDU:01000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EThe TPDU is coded in hexadecimal format. Each character represents 4 bits, i.e. 1/2 octet. The TPDU has 84 characters and so there are totally 42 octets. That's why the value assigned to the?TPDU_lengthparameter is 42.The <CR> Character<CR>, which represents the carriage return character, follows the?TPDU_length?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 PDU Mode".The SMSC_number_and_TPDU ParameterThe second parameter of the +CMGS AT command,?SMSC_number_and_TPDU, specifies the SMSC number and the TPDU in hexadecimal format. 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 PDU Mode".The <Ctrl+z> CharacterWhen you finish entering the value for the?SMSC_number_and_TPDU?parameter, you have to enter the<Ctrl+z>?character to mark the end of the value. The GSM/GPRS modem or mobile phone will then attempt to send the SMS message to the SMS center.25.5.1. Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT CommandThis section provides some explanation about the coding of the?SMSC_number_and_TPDU?parameter value of the +CMGS AT command. Let's consider the?SMSC_number_and_TPDU?parameter value in the earlier example command line:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EThe above value can be divided into two parts, as shown below. The first part contains information about the SMSC to be used for sending the SMS message. The second part is the TPDU.07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E25.5.1.1. The SMSC PartThe SMSC part can be further divided into three sub-fields, like this:07 91 5892000000F0The First Sub-field: Length of the Second and Third Sub-fieldsThe first sub-field specifies the length in octets of the following two sub-fields. There are 14 hexadecimal digits in "915892000000F0" and each hexadecimal digit represents 4 bits. So, there are totally 7 octets. That's why the value of the first sub-field is 0x07.The Second Sub-field: Type of SMSC NumberThe second sub-field specifies the type of the SMSC number assigned to the third sub-field. Two values are commonly used. They are 0x81 (129 in decimal) and 0x91 (145 in decimal):0x81. It means the SMSC number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the SMSC number is an international number, a national number or a number of other types. For example, suppose the SMSC number provided to you by the mobile network operator for sending SMS messages is "+85290000000". If the value of the second sub-field is 0x81, the SMSC number assigned to the third sub-field can be either "85290000000" (country code included) or "90000000" (country code omitted).0x91. It means the SMSC number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. For example, suppose the SMSC number provided to you by the mobile network operator for sending SMS messages is "+85290000000". If the value of the second sub-field is 0x91, the SMSC number assigned to the third sub-field should be "85290000000".The Third Sub-field: SMSC NumberThe third sub-field specifies the SMSC number for sending the SMS message. 0x5892000000F0 represents the phone number +85290000000. Here's how the value 0x5892000000F0 is obtained:Starting from the left, group the digits of the phone number 85290000000 into pairs, like this: 85 29 00 00 00 0.As the last group has only one digit, we add an "F" to make up a pair. The result is 85 29 00 00 00 0F.Swap the digits in each pair and you will get 58 92 00 00 00 F0.NoteIt is possible to tell the GSM/GPRS modem or mobile phone to use the SMSC number specified by the AT command +CSCA (command name in text: Service Centre Address) for sending SMS messages. Just assign the value 0x00 to the first sub-field and omit the second and third sub-fields, i.e. the SMSC part becomes:0025.5.1.2. The TPDU Part (SMS-SUBMIT TPDU)The TPDU part can be divided into nine sub-fields, as shown below. This is a TPDU of the type SMS-SUBMIT.01 00 0B 91 5892214365F7 00 00 21 493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EThe First Sub-field: First Octet of the TPDUThe first sub-field is the first octet of the TPDU. It tells the GSM/GPRS modem or mobile phone several things:the type of the TPDUwhether the SMSC should reject duplicated TPDUswhether a validity period exists in the TPDU, and the format of the validity period if it existswhether a reply path is requestedwhether a user data header exists in the TPDUwhether a status report is requested from the SMSCThe value 0x01 means:the type of the TPDU is SMS-SUBMITthe SMSC should not reject duplicated TPDUsno validity period exists in the TPDUno reply path is requestedno user data header exists in the TPDUno status report is requested from the SMSCThe Second Sub-field: Message Reference NumberThe second sub-field specifies the message reference number. It is an integer in the range from 0 to 255. The value 0x00 tells the GSM/GPRS modem or mobile phone to assign a message reference number to the SMS message automatically.The Third Sub-field: Length of the Destination Phone NumberThe third sub-field specifies the length in digits of the destination phone number. The destination phone number specified in the fifth sub-field is "+85291234567", which has 11 digits. Thus, the value of the third sub-field is 0x0B (i.e. 11 in decimal).The Fourth Sub-field: Type of the Destination Phone NumberThe fourth sub-field specifies the type of the destination phone number assigned to the fifth sub-field. Two values are commonly used. They are 0x81 (129 in decimal) and 0x91 (145 in decimal):0x81. It means the destination phone number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the destination phone number is an international number, a national number or a number of other types. For example, suppose you want to send an SMS message to the phone number "+85291234567". If the value of the fourth sub-field is 0x81, the destination phone number assigned to the fifth sub-field can be either "85291234567" (country code included) or "91234567" (country code omitted).0x91. It means the destination phone number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. For example, suppose you want to send an SMS message to the phone number "+85291234567". If the value of the fourth sub-field is 0x91, the destination phone number assigned to the fifth sub-field should be "85291234567".The Fifth Sub-field: Destination Phone NumberThe fifth sub-field specifies the destination phone number. The value 0x5892214365F7 represents the phone number +85291234567. Here's how the value 0x5892214365F7 is obtained:Starting from the left, group the digits of the phone number 85291234567 into pairs, like this: 85 29 12 34 56 7.As the last group has only one digit, we add an "F" to make up a pair. The result is 85 29 12 34 56 7F.Swap the digits in each pair and you will get 58 92 21 43 65 F7.The Sixth Sub-field: Protocol IdentifierThe sixth sub-field specifies the protocol identifier. Its value should be 0x00 for normal cases.The Seventh Sub-field: Data Coding SchemeThe seventh sub-field specifies the data coding scheme. With 0x00, we inform the GSM/GPRS modem or mobile phone that the text in the SMS message body is encoded according to the "GSM 7-bit default alphabet" text coding scheme.The Eighth Sub-field: Length of the SMS Message BodyThe eighth sub-field specifies the length of the SMS message body in septets (1 septet = 7 bits). The value 0x21 means there are 33 septets (or characters, since each character is represented by 7 bits according to the "GSM 7-bit default alphabet" text coding scheme) in the SMS message body.The Ninth Sub-field: SMS Message BodyThe ninth sub-field specifies the SMS message body. The value 0x493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E represents the text message "It is easy to send text messages.". Below shows how the hexadecimal value is obtained:Encode the SMS text message "It is easy to send text messages." according to the character set "GSM 7-bit default alphabet". For example, 0x49 is used to represent the first character "I" in the SMS text message, 0x74 is used to represent the second character "t", etc. To find the code representing a certain character, see "Appendix: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)" of this SMS tutorial.After encoding, the SMS text message "It is easy to send text messages." becomes:49 74 20 69 73 20 65 61 73 79 20 74 6F 20 73 65 6E 64 20 74 65 78 74 20 6D 65 73 73 61 67 65 73 2EWith the character set "GSM 7-bit default alphabet", each character is represented by 7 bits. If the SMS text message is encoded as above, 1 bit is wasted in every octet. To prevent this from happening, the SMS specification requires us to pack the 7-bit characters in octets. The packing process is described below:The binary representation of the first character is 1001001. Since the most significant bit of the first octet is unused, we fill it by the least significant bit of the second character, which is 0. (The binary representation of the second character is 1110100.) As a result, the first octet contains the binary value?01001001, which is 0x49 in hexadecimal format.As the least significant bit of the second character has been moved to the first octet, the second octet now contains the binary value 111010 and the two bits at the leftmost position of the second octet is unused. We fill them by the two least significant bits of the third character, which are both 0. (The binary representation of the third character is 0100000.) As a result, the second octet contains?00111010, which is 0x3A in hexadecimal format.Similarly, since the two least significant bits of the third character have been moved to the second octet, the third octet now contains the binary value 01000 and the three bits at the leftmost position of the third octet is unused. So, we fill them by the three least significant bits of the fourth character, which are 0, 0 and 1. (The binary representation of the fourth character is 1101001.) Now the third octet contains the binary value?00101000, which is 0x28 in hexadecimal format.The packing process continues. This is illustrated in the following table.Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0Octet 101001001=0x49Octet 200111010=0x3AOctet 300101000=0x28Octet 400111101=0x3DOctet 500000111=0x07Octet 610010101=0x95Octet 711000011=0xC3Octet 811110011=0xF3Octet 900111100=0x3COctet 1010001000=0x88Octet 1111111110=0xFEOctet 1200000110=0x06Octet 1311001101=0xCDOctet 1411001011=0xCBOctet 1501101110=0x6EOctet 1600110010=0x32Octet 1710001000=0x88Octet 1801011110=0x5EOctet 1911000110=0xC6Octet 2011010011=0xD3Octet 2101000001=0x41Octet 2211101101=0xEDOctet 2311110010=0xF2Octet 2401111100=0x7COctet 2500011110=0x1EOctet 2600111110=0x3EOctet 2710010111=0x97Octet 2811100111=0xE7Octet 2900101110=0x2E25.6. Format of the Information Response of the +CMGS AT Command in SMS PDU ModeIf the GSM/GPRS modem or mobile phone sends the SMS message successfully, it will return an information response to the computer / PC. In SMS PDU mode, the information response of the +CMGS AT command has the following format: (Optional fields are enclosed in square brackets.)+CMGS:?message_reference[,SMS-SUBMIT-REPORT_TPDU]The message_reference FieldThe first field of the information response of the +CMGS AT command,?message_reference, contains an integer in the range from 0 to 255. This field tells you the reference number that was allocated to your SMS message.The SMS-SUBMIT-REPORT_TPDU FieldThe second field of the information response of the +CMGS AT command,?SMS-SUBMIT-REPORT_TPDU, contains a TPDU of the type SMS-SUBMIT-REPORT in hexadecimal format. It carries a positive submission report returned from the SMSC. It acknowledges the GSM/GPRS modem or mobile phone that the submission of the SMS message to the SMSC was successful. The value of theSMS-SUBMIT-REPORT_TPDU?field is a string and so it is always enclosed in quotes.Note that?SMS-SUBMIT-REPORT_TPDU?is an optional field. A GSM/GPRS modem or mobile phone includes this field in the information response only if the messaging service value set by the AT command +CSMS (command name in text: Select Message Service) is 1 and the mobile network supports the use of this messaging service value. By default the messaging service value is 0. Usually this is the value to be used and the?SMS-SUBMIT-REPORT_TPDU?field is not shown.25.7. Example Demonstrating How to Use the +CMGS AT Command to Send SMS Text Messages in SMS PDU ModeNow let's see a more detailed example that demonstrates how to use the +CMGS AT command to send SMS text messages in SMS PDU mode and how the +CMGS AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS PDU ModeFirst, instruct the GSM/GPRS modem or mobile phone to operate in SMS PDU mode by entering the command line "AT+CMGF=0" in a terminal program (for example, HyperTerminal in Microsoft Windows). Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=0":AT+CMGF=0OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS PDU mode. To check whether the GSM/GPRS modem or mobile phone supports SMS PDU mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The value 0 represents SMS PDU mode and the value 1 represents SMS text mode. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.(Optional in SMS PDU Mode) Setting the SMSC Number to be Used to Send SMS Text MessagesSecond, set the SMSC number to be used to send SMS text messages by the AT command +CSCA (command name in text: Service Centre Address). Usually the default setting is correct and you do not need to make any changes. In SMS PDU mode, you can skip this step since you can pass the SMSC number to the +CMGS AT command as a parameter. This is different from SMS text mode, in which the only way to set the SMSC number for sending SMS text messages is by using the +CSCA AT command.Below demonstrates how to use the +CSCA AT command to set "+85290000000" as the SMSC number:AT+CSCA="+85290000000"OKDetailed information about the +CSCA AT command can be found in the "Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)" section of this SMS tutorial.Sending Text MessagesThird, use the +CMGS AT command to send a text message to the SMSC. Suppose you want to send the text message "It is easy to send text messages." to the mobile phone number +85291234567 through the SMS center at +85290000000, the hexadecimal sequence to be passed to the +CMGS AT command should be:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72Eand the length of the SMS-SUBMIT TPDU embedded in the hexadecimal sequence is 42 octets. We have discussed how to obtain these values in previous sections and so we will not talk about them again here.Now pass the length of the SMS-SUBMIT TPDU to the +CMGS AT command by entering the following command line in a terminal program:AT+CMGS=42Then, press the Enter key of the keyboard to send a carriage return character to the GSM/GPRS modem or mobile phone. The GSM/GPRS modem or mobile phone will send back a prompt formed by four characters. They are the carriage return character, the linefeed character, the ">" character and the space character. If all characters are to be displayed, the characters you have sent to and received from the GSM/GPRS modem or mobile phone so far are:AT+CMGS=42<CR><CR><LF>><Space>However, the carriage return character and linefeed character have special meanings to a terminal program. When a terminal program sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. So, here is what you will actually see in a terminal program such as HyperTerminal:AT+CMGS=42>?If you want to cancel the send command at this point, press the Esc key on the keyboard. The GSM/GPRS modem or mobile phone will then return the OK final result code. Here shows the response returned from Nokia 6021 (or Sony Ericsson T68i):AT+CMGS=42>???OKSome mobile devices return a slightly different response. One example is Philips 598:AT+CMGS=42>?OKIf you do not want to cancel the send command, enter the hexadecimal sequence containing the SMS text message that you want to send from your computer / PC. When finished, press Ctrl+z on the keyboard. The GSM/GPRS modem or mobile phone then attempts to send the SMS text message to the SMSC and returns a response to the computer / PC. Below shows what you should see in a terminal program:AT+CMGS=42> 07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E+CMGS: 12OKThe value in the information response, 12, is the message reference number allocated to the SMS text message by the GSM/GPRS modem or mobile phone. The final result code OK indicates the sending of the SMS text message was successful. If the execution of the +CMGS AT command fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.25.8. Syntax of the +CMSS AT Command in SMS Text Mode and PDU ModeUnlike +CMGS, the syntax of the +CMSS AT command is the same in both SMS text mode and PDU mode. Below shows the syntax of the +CMSS AT command: (Optional parameters are enclosed in square brackets.)+CMSS=index[,address[,address_type]]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+CMSS=5,"+85291234567",145The index ParameterThe first parameter of the +CMSS AT command,?index, specifies the location of the SMS message in the message storage area.The address ParameterThe second parameter of the +CMSS 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?parameter is optional and it can be omitted. If you do so, the +CMSS AT command will use the address stored in the SMS message header as the destination address.The address_type ParameterThe third parameter of the +CMSS 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".25.9. Format of the Information Response of the +CMSS AT Command in SMS Text Mode and PDU ModeIf the GSM/GPRS modem or mobile phone sends the SMS message successfully, it will return an information response to the computer / PC. The format of the +CMSS information response in SMS text mode and that in SMS PDU mode differ by a single parameter.In SMS text mode, the information response of the +CMSS AT command has the following format: (Optional fields are enclosed in square brackets.)+CMSS:?message_reference[,service_center_time_stamp]Here is an example that gives you some idea of how an actual information response should look like:+CMSS: 5,"07/02/05,08:30:45+32"In SMS PDU mode, the information response of the +CMSS AT command has the following format: (Optional fields are enclosed in square brackets.)+CMSS:?message_reference[,SMS-SUBMIT-REPORT_TPDU]The message_reference FieldThe first field of the information response of the +CMSS AT command,?message_reference, contains an integer in the range from 0 to 255. It is a reference number allocated by the GSM/GPRS modem or mobile phone to the SMS message sent.The service_center_time_stamp FieldIn SMS text mode, the second field of the information response of the +CMSS AT command isservice_center_time_stamp. It contains a string that indicates the time and date at which the SMS message arrived at the service center (i.e. SMSC). The time stamp format is "yy/MM/dd,hh:mm:ss±zz", where yy = year, MM = month, dd = day, hh = hour, mm = minute, ss = second, zz = time zone. Note: the unit of time zone is a quarter of an hour.For example, "07/02/05,08:30:45+32" represents 5 February 2007, 8:30:45 GMT+8 hours. "+32" means GMT+8 hours, since 32 quarters of an hour = 8 hours.Note that?service_center_time_stamp?is an optional field. A GSM/GPRS modem or mobile phone includes this field in the information response only if the messaging service value set by the AT command +CSMS (command name in text: Select Message Service) is 1 and the mobile network supports the use of this messaging service value. By default the messaging service value is 0. Usually this is the value to be used and the?service_center_time_stamp?field is not shown.The SMS-SUBMIT-REPORT_TPDU FieldIn SMS PDU mode, the second field of the information response of the +CMSS AT command is?SMS-SUBMIT-REPORT_TPDU. It contains a TPDU of the type SMS-SUBMIT-REPORT in hexadecimal format. It carries a positive submission report returned from the SMSC. It acknowledges the GSM/GPRS modem or mobile phone that the submission of the SMS message to the SMSC was successful. The value of the?SMS-SUBMIT-REPORT_TPDU?field is a string and so it is always enclosed in quotes.Note that?SMS-SUBMIT-REPORT_TPDU?is an optional field. A GSM/GPRS modem or mobile phone includes this field in the information response only if the messaging service value set by the AT command +CSMS (command name in text: Select Message Service) is 1 and the mobile network supports the use of this messaging service value. By default the messaging service value is 0. Usually this is the value to be used and the?SMS-SUBMIT-REPORT_TPDU?field is not shown.25.10. SMSC Number to be Used by the +CMSS AT Command to Send SMS MessagesEarlier in this SMS tutorial, we described how the?AT command +CSCA?(command name in text: Service Centre Address) could be used to set the SMSC number for sending SMS messages. The AT command +CSCA is straightforward to use. However, the following fact complicates things a bit: an SMS message can have an SMSC number stored with it in message storage and this SMSC number is used by the +CMSS AT command to send the SMS message.25.10.1. SMS Text ModeIn SMS text mode, when you use the?AT command +CMGW?(command name in text: Write Message to Memory) to write an SMS message to the message storage area, the SMSC number specified by the AT command +CSCA is saved with the SMS message. The +CMSS AT command will use this SMSC number to send the SMS message.To understand better, let's consider the following example. Suppose we use the AT command +CSCA to change the SMSC number to +85290000000, like this:AT+CSCA="+85290000000"Then we use the AT command +CMGW to write the text message "Sending text messages is easy." to the message storage area. In SMS text mode, the command line should be something like this:AT+CMGW<CR>Sending text messages is easy.<Ctrl+z>After that, we use the AT command +CSCA to change the SMSC number to +85291111111:AT+CSCA="+85291111111"At this point, if we use the +CMSS AT command to send the text message out, the GSM/GPRS modem or mobile phone will perform the task using the SMSC number +85290000000, not the current number +85291111111.Once an SMS message has been written to the message storage area, there is no way to change the SMSC number saved with it via AT commands. But you can always create a new SMS message with the same message body but with a different SMSC number.Note: It is possible that the command behavior on your mobile device is slightly different from what was described above. So, you may want to do something similar to the above example to find out the exact command behavior on your mobile device.25.10.2. SMS PDU ModeIn SMS PDU mode, when you use the AT command +CMGW to write an SMS message to the message storage area, a certain SMSC number is saved with the SMS message. This SMSC number will be used by the AT command +CMSS for sending the SMS message out. The value assigned to theSMSC_number_and_TPDU?parameter of the AT command +CMGW determines what SMSC number is saved with the SMS message.Note that once an SMS message has been written to the message storage area, there is no way to change the SMSC number saved with it via AT commands. But you can always create a new SMS message with the same message body but with a different SMSC number.The value of the?SMSC_number_and_TPDU?parameter can be divided into two parts: the SMSC part and TPDU part. Following is an example that gives you some idea of how an actual value of theSMSC_number_and_TPDU?parameter should look like. The SMSC part is displayed in bold type.07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E25.10.2.1. Case 1: SMSC Part is Not "00"If the SMSC part is not "00", a certain SMSC number is encoded in the SMSC part. It will be saved with the SMS message in message storage. The AT command +CMSS will use this SMSC number for sending the SMS message. In the above example, the SMSC number +85290000000 is encoded in "07915892000000F0".25.10.2.2. Case 2: SMSC Part is "00"If the SMSC part is "00", no SMSC number is encoded in the SMSC part. The AT command +CMGW will retrieve the SMSC number specified by the AT command +CSCA, generate an SMSC part from the SMSC number, and replace the old SMSC part "00" with the newly generated SMSC part. In other words, the SMSC number specified by the AT command +CSCA will be saved with the SMS message. This SMSC number will be used by the AT command +CMSS for sending the SMS message out.To understand better, let's consider the following example. Suppose we use the AT command +CSCA to change the SMSC number to +85290000000, like this:AT+CSCA="+85290000000"Then we use the AT command +CMGW to write the text message "It is easy to send text messages." to the message storage area. In SMS PDU mode, the command line should be something like this: (The SMSC part is displayed in bold type.)AT+CMGW=42<CR>0001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E<Ctrl+z>After that, we use the?AT command +CMGR?(command line in text: Read Message) to read the SMS text message. The information response returned is shown below. (The SMSC part is displayed in bold type.)+CMGR: 2,,4207915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EAs you can see, the hexadecimal value returned is different from what we assigned to the AT command +CMGW. The old SMSC part "00" was replaced by the new SMSC part "07915892000000F0", which specifies the SMSC number +85290000000.More DetailsMore details about the?SMSC_number_and_TPDU?parameter of the AT command +CMGW can be found from the section "Syntax of the +CMGW AT Command in SMS PDU Mode" of this SMS tutorial.NoteMobile devices such as Nokia 6021 and Philips 598 work in the way described above. However, it is possible that the command behavior on your mobile device is slightly different from what was described. So, you may want to do something similar to the above example to find out the exact command behavior on your mobile device.One mobile phone that has a different command behavior is Sony Ericsson T68i. The difference is the time at which the old SMSC part "00" is replaced by the newly generated SMSC part. On Sony Ericsson T68i, the replacement is done when the +CMSS AT command is executed. To understand better, let's consider the following example. Suppose we use the AT command +CSCA to change the SMSC number to +85290000000, like this:AT+CSCA="+85290000000"Then we use the AT command +CMGW to write the text message "It is easy to send text messages." to the message storage area. In SMS PDU mode, the command line should be something like this: (The SMSC part is displayed in bold type.)AT+CMGW=42<CR>0001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E<Ctrl+z>After that, we use the AT command +CMGR to read the SMS text message. The information response returned is shown below. (The SMSC part is displayed in bold type.)+CMGR: 2,,420001440B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EAs you can see, the SMSC part is the same as the one we assigned to the +CMGW AT command.Now use the +CMSS AT command to send the text message out. Then use the AT command +CMGR to read the SMS text message again. This time you should find that the SMSC part was changed to "07915892000000F0", which specifies the SMSC number +85290000000.+CMGR: 2,,4207915892000000F001440B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E25.10.3. Reading the SMSC Number Saved with an SMS MessageSometimes 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).25.10.3.1. SMS Text ModeIn 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:AT+CSDH=1OKAT+CMGR=5+CMGR: "STO UNSENT","+85291234567",,145,17,0,0,167,"+85290000000",145,30It is easy to send text messages.OKThe value of the ninth field of the +CMGR information response, i.e. +85290000000, is the SMSC number saved with the SMS text message.25.10.3.2. SMS PDU ModeIf 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:AT+CMGR=5+CMGR: 2,,4207915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EOKThe hexadecimal sequence of the fourth field of the +CMGR information response is:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EIt can be divided into two parts: the SMSC part and TPDU part. Here is the SMSC part:07915892000000F0The SMSC part can be further divided into three sub-fields, like this:07 91 5892000000F0The 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.25.11. Example Demonstrating How to Use the +CMSS AT Command to Send Text Messages from a Message Storage Area (SMS Text Mode and SMS PDU Mode)Now let's see a more detailed example that demonstrates how to use the +CMSS AT command to send text messages from a message storage area and how the +CMSS AT command should be used together with other AT commands. Since the syntax of the +CMSS AT command is the same in both SMS text mode and SMS PDU mode, the information provided below applies to both modes.Selecting the Message Storage Area to Write Text Messages to and Send Text Messages fromFirst, use the +CPMS AT command (command name in text: Preferred Message Storage) to select the message storage area to write text messages to (+CMGW AT command) and send text messages from (+CMSS AT command). For example, to use the message storage area in the SIM card for writing and sending SMS text messages, assign the string value "SM" to the second parameter of the +CPMS AT command, like this:AT+CPMS="ME","SM"The first parameter of the +CPMS AT command is used to select the message storage area for reading and deleting SMS messages. It has no use to us here. So, it does not matter what value is assigned to the first parameter.Now press the Enter key on the keyboard and you should see something similar to this:AT+CPMS="ME","SM"+CPMS: 2,150,2,10,4,160OKDetailed information about the +CPMS AT command is available in the "Preferred Message Storage (AT+CPMS)" section of this SMS tutorial.Setting the SMSC Number to be Used to Send SMS Text MessagesSecond, use the AT command +CSCA (command name in text: Service Centre Address) to set the SMSC number to be used to send SMS text messages. Usually the default setting is correct and you do not need to make any changes. Below demonstrates how to use the +CSCA AT command to set "+85290000000" as the SMSC number:AT+CSCA="+85290000000"OKDetailed information about the +CSCA AT command can be found in the "Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)" section of this SMS tutorial.Writing Text MessagesThird, use the +CMGW AT command (command line in text: Write Message to Memory) to write the text message to message storage. Suppose the recipient mobile phone number is +85291234567. If the GSM/GPRS modem or mobile phone is operating in SMS text mode, you should enter something like this in the terminal program and press the Enter key of the keyboard:AT+CMGW="+85291234567"The GSM/GPRS modem or mobile phone will return a prompt, as shown below:AT+CMGW="+85291234567">?Now enter the body of the SMS text message "It is easy to send text messages." and press Ctrl+z on the keyboard to finish. You should see something like this in the terminal program:AT+CMGW="+85291234567"> It is easy to send text messages.+CMGW: 3OKThe value 3 in the +CMGW information response is the index that specifies the location where the text message is stored in the message storage area. Later, we have to use this index to tell the +CMSS AT command which text message should be sent.If the GSM/GPRS modem or mobile phone is operating in SMS PDU mode, here's what you should type and see in the terminal program:AT+CMGW=42> 0001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E+CMGW: 3OKFor further details the +CMGW AT command, please refer to the earlier section "Writing SMS Messages to Memory / Message Storage (AT+CMGW)" of this SMS tutorial.Sending Text Messages from Message StorageFourth, specify the index "3" to the +CMSS AT command to send the text message out:AT+CMSS=3+CMSS: 20OK"20" is the message reference number allocated by the GSM/GPRS modem or mobile phone to the text message. The final result code OK indicates the text message was sent to the SMSC successfully. If the execution of the AT command +CMSS fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.In the above example, the?address?parameter of the AT command +CMSS is omitted. Thus, the mobile phone number stored with the SMS text message (i.e. +85291234567) will be used as the destination address. Suppose you want to send the text message to another mobile phone number, say +85298765432, you should assign "+85298765432" to the?address?parameter of +CMSS, as shown below:AT+CMSS=3,"+85298765432"+CMSS: 21OK26. Reading SMS Messages from a Message Storage Area Using AT Commands (AT+CMGR, AT+CMGL)To enable a computer / PC to read SMS messages from a message storage area, the GSM/GPRS modem or mobile phone has to support either of the AT commands +CMGR (command name in text: Read Messages) and +CMGL (command name in text: List Messages). The +CMGR AT command is used to read an SMS message at a certain location of the message storage area, while the +CMGL AT command is used to read SMS messages that have a certain status from the message storage area. The status can be "received unread", "received read", "stored unsent", "stored sent", etc. The +CMGL AT command also allows you to retrieve all SMS messages stored in the message storage area.Following is an example for illustrating the difference between +CMGR and +CMGL. Suppose you want to use your computer / PC to read a text message from the message storage area and you know the index at which the SMS text message is located. In this case, you should use the +CMGR AT command. Here is the command line to be typed (assume the SMS text message is stored at index 3):AT+CMGR=3The GSM/GPRS modem or mobile phone should return something like this:+CMGR: "REC READ","+85291234567",,"07/02/18,00:12:05+32"Hello, welcome to our SMS tutorial.OKSuppose you are now in another situation. You want to use your computer / PC to retrieve all inbound SMS messages that have not been read before. In this case, you should use the +CMGL AT command. In SMS text mode, the command line to be used should be:AT+CMGL="REC UNREAD"The GSM/GPRS modem or mobile phone should return something like this:+CMGL: 1,"REC UNREAD","+85291234567",,"07/02/18,00:05:10+32"Reading text messages is easy.+CMGL: 2,"REC UNREAD","+85291234567",,"07/02/18,00:07:22+32"A simple demo of SMS text messaging.OKThe +CMGL AT command can also be used to read all SMS messages stored in the message storage area. To do so in SMS text mode, the command line should be:AT+CMGL="ALL"This time the response of the GSM/GPRS modem or mobile phone should be something like this:+CMGL: 1,"REC READ","+85291234567",,"07/02/18,00:05:10+32"Reading text messages is easy.+CMGL: 2,"REC READ","+85291234567",,"07/02/18,00:07:22+32"A simple demo of SMS text messaging.+CMGL: 3,"REC READ","+85291234567",,"07/02/18,00:12:05+32"Hello, welcome to our SMS tutorial.OKAs you can see above, the +CMGR AT command can only be used to read one SMS message at a time, while the +CMGL AT command can be used to read multiple SMS messages at a time.Another difference between the AT commands +CMGR and +CMGL is that +CMGR can be used to retrieve more message details than +CMGL when the GSM/GPRS modem or mobile phone is operating in SMS text mode. Here are the message details that can be retrieved by the +CMGR AT command in SMS text mode:Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Originator/recipient phone number stored in the SMS message header and the type of the phone number.Text associated to the originator/recipient phone number in the phonebook.Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only).The first octet (1 octet = 8 bits) of the TPDU (Transport Protocol Data Unit) of the SMS message.The protocol identifier value in the TPDU of the SMS message.The data coding scheme value in the TPDU of the SMS message.SMSC number stored with the SMS message and the type of the SMSC number.Validity period of the SMS message (available to outgoing SMS messages only).Body of the SMS message and its length.Here are the message details that can be retrieved by the +CMGL AT command in SMS text mode:The index specifying the location of the SMS message in the message storage area.Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Originator/recipient phone number stored in the SMS message header and the type of the phone number.Text associated to the originator/recipient phone number in the phonebook.Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only).Body of the SMS message and its length.If you compare the above two lists, you will find that the following message details can only be retrieved by the +CMGR AT command but not the +CMGL AT command:The first octet of the TPDU of the SMS message.The protocol identifier value in the TPDU of the SMS message.The data coding scheme value in the TPDU of the SMS message.SMSC number stored with the SMS message and the type of the SMSC number.Validity period of the SMS message (available to outgoing SMS messages only).Note: If the GSM/GPRS modem or mobile phone is operating in SMS PDU mode, the message details that can be retrieved by +CMGR and +CMGL are the same.26.1. Comparison Table of the AT Commands +CMGR and +CMGLThe comparison table below summarizes the differences between the AT commands +CMGR and +CMGL that are discussed in the previous section.+CMGR AT command+CMGL AT commandUsage+CMGR is used to read an SMS message at a certain location of the message storage area.+CMGL is used to read SMS messages that have a certain status (examples: "received unread", "received read", "stored unsent" and "stored sent") from the message storage area. It also allows you to retrieve all SMS messages stored in the message storage area.Number of SMS messages returned+CMGR returns one SMS message.+CMGL returns one or more SMS messages.Message details returned (SMS text mode)(Note: +CMGR does not provide the index of the SMS message in the response because it is the parameter value you passed to +CMGR.)Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Originator/recipient phone number stored in the SMS message header and the type of the phone number.Text associated to the originator/recipient phone number in the phonebook.Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only).The first octet (1 octet = 8 bits) of the TPDU (Transport Protocol Data Unit) of the SMS message.The protocol identifier value in the TPDU of the SMS message.The data coding scheme value in the TPDU of the SMS message.SMSC number stored with the SMS message and the type of the SMSC number.Validity period of the SMS message (available to outgoing SMS messages only).Body of the SMS message and its length.The index specifying the location of the SMS message in the message storage area.Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Originator/recipient phone number stored in the SMS message header and the type of the phone number.Text associated to the originator/recipient phone number in the phonebook.Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only).Body of the SMS message and its length.Message details returned (SMS PDU mode)Same26.2. Using the +CMGR AT Command to Read an SMS Message from a Message Storage AreaThe AT command +CMGR (command name in text: Read Message) is used to read a message from a message storage area. The location of the message to be read from the message storage area is specified by an index number. The message to be retrieved by the AT command +CMGR does not necessarily have to be an SMS message. It can be of other message types such as status reports and cell broadcast messages, but we will only focus on SMS messages here.In SMS text mode, you can retrieve the following information about an SMS message with the AT command +CMGR:Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Originator/recipient phone number stored in the SMS message header and the type of the phone number.Text associated to the originator/recipient phone number in the phonebook.Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only).The first octet (1 octet = 8 bits) of the TPDU (Transport Protocol Data Unit) of the SMS message.The protocol identifier value in the TPDU of the SMS message.The data coding scheme value in the TPDU of the SMS message.SMSC number stored with the SMS message and the type of the SMSC number.Validity period of the SMS message (available to outgoing SMS messages only).Body of the SMS message and its length.In SMS PDU mode, the list becomes:Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Text associated to the originator/recipient phone number in the phonebook.SMSC number stored with the SMS message and the type of the SMSC number.TPDU of the SMS message and its length.After using the +CMGR AT command to read an SMS message with the "received unread" status, the status will be changed to "received read".The message storage area from which SMS messages are read is specified by the +CPMS AT command (command name in text: Preferred Message Storage). Details about the +CPMS AT command can be found in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.26.2.1. Syntax of the +CMGR AT Command in SMS Text ModeThe syntax of the +CMGR AT command in SMS text mode is:+CMGR=indexindex?is an integer specifying the location of the SMS message to be read from the message storage area.26.2.2. Format of the Information Response of the +CMGR AT Command in SMS Text ModeIf the GSM/GPRS modem or mobile phone successfully reads the SMS message from message storage, it will return an information response to the computer / PC. In SMS text mode, the format of the information response of the +CMGR AT command is different for different message types. In the sections that follow, we assume the message to be read is an SMS message but not of other message types like status reports and cell broadcast messages.26.2.2.1. Incoming SMS Messages and Outgoing SMS MessagesIf the SMS message retrieved is an SMS message received from the SMS center (i.e. incoming SMS message), the information response of the +CMGR AT command in SMS text mode has the following format: (Optional fields are enclosed in square brackets.)+CMGR:?message_status,address,[address_text],service_center_time_stamp[,address_type,TPDU_first_octet,protocol_identifier,data_coding_scheme,service_center_address,service_center_address_type,sms_message_body_length]<CR><LF>sms_message_bodyIf the SMS message retrieved is an SMS message that you wrote to the message storage area for sending out (i.e. outgoing SMS message), the format is: (Optional fields are enclosed in square brackets.)+CMGR:?message_status,address,[address_text][,address_type,TPDU_first_octet,protocol_identifier,data_coding_scheme,[validity_period],service_center_address,service_center_address_type,sms_message_body_length]<CR><LF>sms_message_bodyAs you can see above, the format of the +CMGR information response for incoming SMS messages and for outgoing SMS messages is slightly different. The differences are:The?service_center_time_stamp?field only exists in the information response for incoming SMS messages.The?validity_period?field only exists in the information response for outgoing SMS messages.Before we discuss each of the fields that appear in the +CMGR information response, let's see two examples that give you some idea of how an actual +CMGR information response should look like:For incoming SMS messages:+CMGR: "REC READ","+85291234567",,"07/04/20,10:08:02+32",145,4,0,0,"+85290000000",145,49It is easy to read text messages via AT commands.For outgoing SMS messages:+CMGR: "STO SENT","+85291234567",,145,17,0,0,167,"+85290000000",145,36A simple demo of SMS text messaging.26.2.2.2. Details of the Fields that Appear in the +CMGR Information ResponseThe message_status FieldThe first field of the information response of the +CMGR AT command,?message_status, is a string that indicates the status of the SMS message. It can be one of the following four values:REC UNREAD. It refers to the message status "received unread".REC READ. It refers to the message status "received read".STO UNSENT. It refers to the message status "stored unsent".STO SENT. It refers to the message status "stored sent".The address FieldThe second field of the information response of the +CMGR 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 FieldThe third field of the information response of the +CMGR 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.The service_center_time_stamp FieldThe fourth field of the +CMGR information response for incoming SMS messages,service_center_time_stamp, is a string that contains the time and date at which the SMS message arrived at the service center (i.e. SMSC). The time stamp format is "yy/MM/dd,hh:mm:ss±zz" (yy = year, MM = month, dd = day, hh = hour, mm = minute, ss = second, zz = time zone [Note: the unit of time zone is a quarter of an hour]).?For example, "07/02/05,08:30:45+32" represents 5 February 2007, 8:30:45 GMT+8 hours. (+32 means GMT+8 hours, since 32 quarters of an hour = 8 hours.)Note that?service_center_time_stamp?is an optional field. This field is available to incoming SMS messages but not to outgoing SMS messages since outgoing SMS messages have not gone through an SMSC.The address_type FieldThe fifth (fourth) field of the +CMGR information response for incoming SMS messages (outgoing SMS messages),?address_type, is an integer that indicates the type of the address contained in the?addressfield. Usually it is one of the following two values:129. Meaning: 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. Meaning: 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".Note that?address_type?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the fieldaddress_type?will be shown in the information response of the +CMGR AT command.The TPDU_first_octet FieldThe sixth (fifth) field of the +CMGR information response for incoming SMS messages (outgoing SMS messages),?TPDU_first_octet, contains the first octet (expressed as an integer) of the TPDU of the SMS message.Note that?TPDU_first_octet?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the fieldTPDU_first_octet?will be shown in the information response of the +CMGR AT command.The protocol_identifier FieldThe seventh (sixth) field of the +CMGR information response for incoming SMS messages (outgoing SMS messages),?protocol_identifier, contains the value (expressed as an integer) of the TP-Protocol-Identifier parameter in the TPDU of the SMS message.Note that?protocol_identifier?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the fieldprotocol_identifier?will be shown in the information response of the +CMGR AT command.The data_coding_scheme FieldThe eighth (seventh) field of the +CMGR information response for incoming SMS messages (outgoing SMS messages),?data_coding_scheme, contains the value (expressed as an integer) of the TP-Data-Coding-Scheme parameter in the TPDU of the SMS message.Note that?data_coding_scheme?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the fielddata_coding_scheme?will be shown in the information response of the +CMGR AT command.The validity_period FieldThe eighth field of the +CMGR information response for outgoing SMS messages,?validity_period, contains the validity period assigned to the SMS message. There are three possible validity period formats: relative format, absolute format and enhanced format. To find out the format of?validity_period, examine the value of the TP-Validity-Period-Format parameter in the TPDU of the SMS message. It is located at bit 4 and bit 3 of the first octet of the TPDU. (Note: Bit 0 is the rightmost bit.) For example, let's say the value of the?TPDU_first_octet?Field is 17. Its binary representation is 00010001. As you can see, bit 4 is 1 and bit 3 is 0.If the relative format is used (bit 4 = 1, bit 3 = 0),?validity_period?will be an integer in the range from 0 to 255 that indicates the period after which the SMSC should delete the SMS message, counted from the time at which the SMSC receives the SMS message. The validity period can be calculated by the following formulae:If?validity_period?is in the range from 0 to 143, validity period = (validity_period?+ 1) x 5 minutes.If?validity_period?is in the range from 144 to 167, validity period = 12 hours + ((validity_period?- 143) x 0.5 hours).If?validity_period?is in the range from 168 to 196, validity period = (validity_period?- 166) x 1 day.If?validity_period?is in the range from 197 to 255, validity period = (validity_period?- 192) x 1 week.If the absolute format is used (bit 4 = 1, bit 3 =1),?validity_period?will be a string that contains the time and date at which the SMSC should delete the SMS message. The time/date format is "yy/MM/dd,hh:mm:ss±zz" (yy = year, MM = month, dd = day, hh = hour, mm = minute, ss = second, zz = time zone [Note: the unit of time zone is a quarter of an hour]).?For example, "07/02/05,08:30:45+32" represents 5 February 2007, 8:30:45 GMT+8 hours. (+32 means GMT+8 hours, since 32 quarters of an hour = 8 hours.)If the enhanced format is used (bit 4 = 0, bit 3 = 1),?validity_period?will be a hexadecimal coded string. Since the enhanced format is not commonly used, we do not discuss the details here.Note that?validity_period?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the fieldvalidity_period?will be shown in the information response of the +CMGR AT command. Also, note thatvalidity_period?is available to outgoing SMS messages but not to incoming SMS messages, since there is no such value stored in the headers of incoming SMS messages.The service_center_address FieldThe ninth field of the information response of the +CMGR AT command,?service_center_address, is a string that contains the SMSC address stored with the SMS message. Usually it is a phone number formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163). For example, "+85291234567".Note that?service_center_address?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the fieldservice_center_address?will be shown in the information response of the +CMGR AT command.The service_center_address_type FieldThe tenth field of the information response of the +CMGR AT command,?service_center_address_type, is an integer that indicates the type of the SMSC address contained in the?service_center_address?field. Usually it is one of the following two values:129. Meaning: The SMSC address,?service_center_address, is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether?service_center_address?is an international number, a national number or a number of other types. Example addresses: "85291234567" and "91234567".145. Meaning: The SMSC address,?service_center_address, is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. Example address: "+85291234567".Note that?service_center_address_type?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the field?service_center_address_type?will be shown in the information response of the +CMGR AT command.The sms_message_body_length FieldThe eleventh field of the information response of the +CMGR AT command,?sms_message_body_length, is an integer that indicates the number of characters contained in the?sms_message_body?field. For example, there are 48 characters in "It is easy to read text messages via AT commands". If the value of the?sms_message_body?field is "It is easy to read text messages via AT commands", the value of thesms_message_body_length?field will be 48.Note that?sms_message_body_length?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the field?sms_message_body_length?will be shown in the information response of the +CMGR AT command.The sms_message_body FieldThe twelfth field of the information response of the +CMGR AT command,?sms_message_body, contains the body of the SMS message.26.2.3. Example Demonstrating How to Use the +CMGR AT Command to Read SMS Text Messages from a Message Storage Area (SMS Text Mode)Now let's see a more detailed example that demonstrates how to use the +CMGR AT command to read SMS text messages from a message storage area when SMS text mode is used, and how the +CMGR AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS Text ModeFirst, enter the command line "AT+CMGF=1" in a terminal program (for example, HyperTerminal in Microsoft Windows) to instruct the GSM/GPRS modem or mobile phone to operate in SMS text mode. This step is necessary because the default mode is SMS PDU mode. Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=1":AT+CMGF=1OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS text mode. To check whether the GSM/GPRS modem or mobile phone supports SMS text mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The value 0 represents SMS PDU mode and the value 1 represents SMS text mode. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Selecting the Message Storage Area to Read SMS Text Messages fromSecond, use the AT command +CPMS (command name in text: Preferred Message Storage) to select the message storage area to read SMS text messages from. For example, to instruct the GSM/GPRS modem or mobile phone to use the message storage area in the SIM card for the AT command +CMGR, enter the command line 'AT+CPMS="SM"' in the terminal program. Then press the Enter key on the keyboard and you should see something similar to this:AT+CPMS="SM"+CPMS: 2,10,2,10,3,160OKDetailed information about the +CPMS AT command is available in the "Preferred Message Storage (AT+CPMS)" section of this SMS tutorial.Reading Text MessagesThird, you can now use the +CMGR AT command to read a text message from the message storage area. Let's say you would like to read the text message at index 1. You should enter the following command line in the terminal program:AT+CMGR=1Then press the Enter key on the keyboard and the GSM/GPRS modem or mobile phone will execute the command line "AT+CMGR=1". If it reads the SMS text message successfully, the result returned should look something like this:AT+CMGR=1+CMGR: "REC UNREAD","+85291234567",,"07/02/18,00:05:10+32"It is easy to read text messages via AT commands.OKHere is a brief description of the various field values in the information response above:The value of the first field, "REC UNREAD", indicates the status of the text message is "received unread", which means it is a text message received from the SMSC and it has not been read.The value of the second field, "+85291234567", is the sender's phone number.The value of the third field should be a string that contains the text associated to the sender's phone number "+85291234567" in the phonebook. In this example, this field is empty. One possible reason is that the GSM/GPRS modem or mobile phone (for example, Nokia 6021 and many other Nokia products) does not support this field.The value of the fourth field, "07/02/18,00:05:10+32", tells us that the SMSC received the text message at 00:05:10 (GMT+8) on 18 Feb 2007. (Don't forget the unit of time zone is a quarter of an hour. Since 32 quarters of an hour = 8 hours, "+32" means GMT+8 hours.)The value of the fifth field, "It is easy to read text messages via AT commands.", is the body of the SMS message.The final result code OK indicates the SMS text message was read from the message storage area successfully. If the execution of the +CMGR AT command fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.After using the +CMGR AT command to read the SMS text message, its status was changed from "received unread" to "received read". So, if the command line "AT+CMGR=1" is executed again, you will see a slightly different result (note the part highlighted in bold type):AT+CMGR=1+CMGR:?"REC READ","+85291234567",,"07/02/18,00:05:10+32"It is easy to read text messages via AT commands.OKThe SMS text message "It is easy to read text messages via AT commands." is an incoming text message. If the SMS text message retrieved is an outgoing text message, the format of the +CMGR information response will be different. To see the differences, first write a new outgoing text message to the message storage area using the?+CMGW AT command?(command name in text: Write Message to Memory), like this:AT+CMGW="+85291234567"> A simple example of SMS text messaging.+CMGW: 2OK(Note: Make sure the same message storage area is selected for writing and reading text messages. See "Selecting the Message Storage Areas to be Used for SMS Reading, Writing, Deleting, Sending or Receiving" if you do not know how this can be done.)Then read both text messages using the +CMGR AT command:AT+CMGR=1;+CMGR=2+CMGR: "REC READ","+85291234567",,"07/02/18,00:05:10+32"It is easy to read text messages via AT commands.+CMGR: "STO UNSENT","+85291234567",A simple example of SMS text messaging.OKAs you can see, the +CMGR information response of the incoming text message contains the service center timestamp field, while that of the outgoing text message does not.As mentioned in the earlier section "Format of the Information Response of the +CMGR AT Command in SMS Text Mode" of this SMS tutorial, eight optional fields are not shown in the information response of the +CMGR AT command by default. They are?address_type,?TPDU_first_octet,?protocol_identifier,data_coding_scheme,?validity_period,?service_center_address,?service_center_address_type?andsms_message_body_length. To show these optional fields, you have to specify the value 1 to the +CSDH AT command (command name in text: Show Text Mode Parameters), like this:AT+CSDH=1OKNow send the command line "AT+CMGR=1;+CMGR=2" to the GSM/GPRS modem or mobile phone again and you should obtain the following result:AT+CMGR=1;+CMGR=2+CMGR: "REC READ","+85291234567",,"07/02/18,00:05:10+32",145,4,0,0,"+85290000000",145,49It is easy to read text messages via AT commands.+CMGR: "STO UNSENT","+85291234567",,145,17,0,0,167,"+85290000000",145,39A simple example of SMS text messaging.OKSuppose there is no message located at index 3 of the message storage area. If you specify the index 3 to the +CMGR AT command, the GSM/GPRS modem or mobile phone will return +CMS error 321 (which means the index is invalid), like this:AT+CMGR=3+CMS ERROR: 32126.2.4. Syntax of the +CMGR AT Command in SMS PDU ModeThe syntax of the +CMGR AT command in SMS PDU mode is the same as that in SMS text mode:+CMGR=indexIn the above line,?index?is an integer specifying the location of the SMS message to be read from the message storage area.26.2.5. Format of the Information Response of the +CMGR AT Command in SMS PDU ModeIf the GSM/GPRS modem or mobile phone reads the SMS message from message storage successfully, it will return an information response to the computer / PC. In SMS PDU mode, the information response of the +CMGR AT command has the following format: (Optional fields are enclosed in square brackets.)+CMGR:?message_status,[address_text],TPDU_length<CR><LF>SMSC_number_and_TPDUBefore we discuss each of the fields that appear in the +CMGR information response, let's see an example that gives you some idea of how an actual +CMGR information response should look like:+CMGR: 0,,6207915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EOKThe message_status FieldThe first field of the information response of the +CMGR AT command,?message_status, is an integer that indicates the status of the SMS message. It can be one of the following four values:0. It refers to the message status "received unread".1. It refers to the message status "received read".2. It refers to the message status "stored unsent".3. It refers to the message status "stored sent".The address_text FieldThe second field of the information response of the +CMGR AT command,?address_text, is a string that contains the text associated to?address?in the phonebook, where?address?is the phone number encoded in the TPDU of the?SMSC_number_and_TPDU?field. For example, if the phone number encoded in the TPDU is "91234567" and 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.The TPDU_length FieldThe third field of the information response of the +CMGR AT command,?TPDU_length, is an integer that indicates the length (in octets. 1 octet = 8 bits) of the TPDU contained in the?SMSC_number_and_TPDUfield. In the earlier example command line, the value of the?SMSC_number_and_TPDU?field is:07915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EIt can be divided into two parts. The following part is the TPDU:040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EThe TPDU is coded in hexadecimal format. Each character represents 4 bits, i.e. 1/2 octet. The TPDU has 124 characters and so there are totally 62 octets. That's why the value of the?TPDU_length?field is 62.The SMSC_number_and_TPDU FieldThe fourth field of the information response of the +CMGR AT command,?SMSC_number_and_TPDU, specifies the SMSC number and the TPDU (Transfer Protocol Data Unit) in hexadecimal format. If the SMS message to be read is an incoming SMS message, the TPDU will be of the type SMS-DELIVER. If the SMS message to be read is an outgoing SMS message, the TPDU will be of the type SMS-SUBMIT.26.2.6. Some Explanation about the Decoding of the SMSC_number_and_TPDU Field Value of the +CMGR AT CommandThis section provides some explanation about the decoding of the?SMSC_number_and_TPDU?field value of the +CMGR AT command so that you can extract the information you need from it. Let's consider theSMSC_number_and_TPDU?field value in the earlier example command line:07915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EThe above value can be divided into two parts, as shown below. The first part contains information about the SMSC. The second part is the TPDU.07915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72E26.2.6.1. Incoming SMS Messages and Outgoing SMS MessagesThe SMS message discussed above is an incoming SMS message. The first part indicates which SMSC the SMS message was received from, and the second part is a TPDU of the type SMS-DELIVER. If the SMS message retrieved by the +CMGR AT command is an outgoing SMS message, the first part indicates which SMSC will be used to send the SMS message, and the second part is a TPDU of the type SMS-SUBMIT, whose format is different from that of an SMS-DELIVER TPDU.The format of the?SMSC_number_and_TPDU?field value of an outgoing SMS message is the same as that mentioned in the earlier section "Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT Command". Thus, we will not discuss about it again here. In the following sections, we assume the SMS message retrieved by the +CMGR AT command is an incoming SMS message and the TPDU is of the type SMS-DELIVER.26.2.6.2. The SMSC PartThe SMSC part can be further divided into three sub-fields, like this:07 91 5892000000F0The First Sub-field: Length of the Second and Third Sub-fieldsThe first sub-field specifies the length in octets of the following two sub-fields. There are 14 hexadecimal digits in "915892000000F0" and each hexadecimal digit represents 4 bits, i.e. 1/2 octet. So, there are totally 7 octets. That's why the value of the first sub-field is 0x07.The Second Sub-field: Type of SMSC NumberThe second sub-field specifies the type of the SMSC number assigned to the third sub-field. Two values are commonly used. They are 0x81 (129 in decimal) and 0x91 (145 in decimal):0x81. It means the SMSC number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the SMSC number is an international number, a national number or a number of other types. For example, suppose the SMSC number from which the SMS message was received is "+85290000000". If the value of the second sub-field is 0x81, the SMSC number assigned to the third sub-field may be "85290000000" (country code included) or "90000000" (country code omitted).0x91. It means the SMSC number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. For example, suppose the SMSC number from which the SMS message was received is "+85290000000". If the value of the second sub-field is 0x91, the SMSC number assigned to the third sub-field should be "85290000000".The Third Sub-field: SMSC NumberThe third sub-field specifies the SMSC number from which the SMS message was received. 0x5892000000F0 represents the phone number +85290000000. Here's how the value 0x5892000000F0 is obtained:Starting from the left, group the digits of the phone number 85290000000 into pairs, like this: 85 29 00 00 00 0.As the last group has only one digit, we add an "F" to make up a pair. The result is 85 29 00 00 00 0F.Swap the digits in each pair and you will get 58 92 00 00 00 F0.26.2.6.3. The TPDU Part (SMS-DELIVER TPDU)The TPDU part can be divided into nine sub-fields, as shown below. This is a TPDU of the type SMS-DELIVER.04 0B 91 5892214365F7 00 00 70402132522423 31 493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EThe First Sub-field: First Octet of the TPDUThe first sub-field is the first octet of the TPDU. It tells us several things:the type of the TPDUwhether the SMSC has messages that are waiting to be sent to uswhether a reply path existswhether a user data header exists in the TPDUwhether a status report is requested by the sender of the SMS messageThe value 0x04 means:the type of the TPDU is SMS-DELIVERthe SMSC has no message that is waiting to be sent to usno reply path existsno user data header exists in the TPDUno status report is requested by the sender of the SMS messageThe Second Sub-field: Length of the Sender Phone NumberThe second sub-field specifies the length in digits of the sender phone number. The sender phone number specified in the fourth sub-field is "+85291234567", which has 11 digits. Thus, the value of the second sub-field is 0x0B (i.e. 11 in decimal).The Third Sub-field: Type of the Sender Phone NumberThe third sub-field specifies the type of the sender phone number assigned to the fourth sub-field. Two values are commonly used. They are 0x81 (129 in decimal) and 0x91 (145 in decimal):0x81. It means the sender phone number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) but it is not sure whether the sender phone number is an international number, a national number or a number of other types. For example, suppose there is an incoming SMS message that was originated from the phone number "+85291234567". If the value of the third sub-field is 0x81, the sender phone number assigned to the fourth sub-field may be "85291234567" (country code included) or "91234567" (country code omitted).0x91. It means the sender phone number is formatted using the typical ISDN / telephony numbering plan (ITU E.164/E.163) and it is an international number. For example, suppose there is an incoming SMS message that was originated from the phone number "+85291234567". If the value of the third sub-field is 0x91, the sender phone number assigned to the fourth sub-field should be "85291234567".The Fourth Sub-field: Sender Phone NumberThe fourth sub-field specifies the sender phone number. The value 0x5892214365F7 represents the phone number +85291234567. Here's how the value 0x5892214365F7 is obtained:Starting from the left, group the digits of the phone number 85291234567 into pairs, like this: 85 29 12 34 56 7.As the last group has only one digit, we add an "F" to make up a pair. The result is 85 29 12 34 56 7F.Swap the digits in each pair and you will get 58 92 21 43 65 F7.The Fifth Sub-field: Protocol IdentifierThe fifth sub-field specifies the protocol identifier. Its value should be 0x00 for normal cases.The Sixth Sub-field: Data Coding SchemeThe sixth sub-field specifies the data coding scheme. The value 0x00 indicates that the text in the SMS message body is encoded according to the "GSM 7-bit default alphabet" text coding scheme.The Seventh Sub-field: Service Center Time StampThe seventh sub-field specifies the time and data at which the SMS message arrived at the service center (i.e. SMSC). The value 0x70402132522423 represents 12 April 2007, 23:25:42 GMT+8 hours. Here's how the value 0x70402132522423 is decoded:Starting from the left, group the digits of the value 0x70402132522423 into pairs, like this: 70 40 21 32 52 24 23.Swap the digits in each pair and you will get 07 04 12 23 25 42 32. Starting from the left, the values represent year, month, day, hour, minute, second and time zone respectively. Note that the unit of time zone is a quarter of an hour.The decoding of the time zone field requires a bit more explanation. The binary representation of the hexadecimal value 0x32 is 00110010. It can be divided into three parts, like this:0 011 0010The first part represents the plus-minus sign. If the value of the first part is 0, the sign is "+". If it is 1, the sign is "-". The second part represents the most significant digit of the time zone. "011" is equal to 3 in decimal. The third part represents the least significant digit of the time zone. "0010" is equal to 2 in decimal. Overall, "00110010" represents GMT+32 quarters of an hour = GMT+8 hours.The Eighth Sub-field: Length of the SMS Message BodyThe eighth sub-field specifies the length of the SMS message body in septets (1 septet = 7 bits). The value 0x31 means there are 49 septets (or characters, since each character is represented by 7 bits according to the "GSM 7-bit default alphabet" text coding scheme) in the SMS message body.The Ninth Sub-field: SMS Message BodyThe ninth sub-field specifies the SMS message body. The value below:0x493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72Erepresents the text message "It is easy to read text messages via AT commands.". Below shows how to convert the hexadecimal value to text:Group the digits of the hexadecimal value into pairs, as shown below. Each pair represents one octet of data.49 3A 28 3D 07 95 C3 F3 3C 88 FE 06 C9 CB 61 32 88 5E C6 D3 41 ED F2 7C 1E 3E 97 E7 20 7B 3A 0C 0A 52 41 E3 77 BB 1D 76 93 E7 2EThe binary representation of the first octet is 01001001. With the character set "GSM 7-bit default alphabet", each character is represented by 7 bits. The seven least significant bits, 1001001, represent the first character. The hexadecimal value of 1001001 is 0x49, which represents the character "I" according to the character set "GSM 7-bit default alphabet". To find out which character is represented by a certain hexadecimal code, see "Appendix: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)" of this SMS tutorial.The binary representation of the second octet is 00111010. Now move the most significant bit of the first octet to the rightmost position of the second octet. The result is 001110100. The seven least significant bits, 1110100, represent the second character. The hexadecimal value of 1110100 is 0x74, which represents the character "t" according to the character set "GSM 7-bit default alphabet".Similarly, move the two unused bits at the leftmost position of the second octet to the rightmost position of the third octet. The binary representation of the third octet is 00101000 and so the result is 0010100000. The seven least significant bits, 0100000, represent the third character. The hexadecimal value of 0100000 is 0x20, which represents the space character according to the character set "GSM 7-bit default alphabet".The unpacking process continues. This is illustrated in the following table.Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0Character 11001001=0x49Character 21110100=0x74Character 30100000=0x20Character 41101001=0x69Character 51110011=0x73Character 60100000=0x20Character 71100101=0x65Character 81100001=0x61Character 91110011=0x73Character 101111001=0x79Character 110100000=0x20Character 121110100=0x74Character 131101111=0x6FCharacter 140100000=0x20Character 151110010=0x72Character 161100101=0x65Character 171100001=0x61Character 181100100=0x64Character 190100000=0x20Character 201110100=0x74Character 211100101=0x65Character 221111000=0x78Character 231110100=0x74Character 240100000=0x20Character 251101101=0x6DCharacter 261100101=0x65Character 271110011=0x73Character 281110011=0x73Character 291100001=0x61Character 301100111=0x67Character 311100101=0x65Character 321110011=0x73Character 330100000=0x20Character 341110110=0x76Character 351101001=0x69Character 361100001=0x61Character 370100000=0x20Character 381000001=0x41Character 391010100=0x54Character 400100000=0x20Character 411100011=0x63Character 421101111=0x6FCharacter 431101101=0x6DCharacter 441101101=0x6DCharacter 451100001=0x61Character 461101110=0x6ECharacter 471100100=0x64Character 481110011=0x73Character 490101110=0x2E026.2.7. Example Demonstrating How to Use the +CMGR AT Command to Read SMS Text Messages from a Message Storage Area (SMS PDU Mode)Now let's see a more detailed example that demonstrates how to use the +CMGR AT command to read SMS text messages from a message storage area when SMS PDU mode is used, and how the +CMGR AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS PDU ModeFirst, instruct the GSM/GPRS modem or mobile phone to operate in SMS PDU mode by entering the command line "AT+CMGF=0" in a terminal program (for example, HyperTerminal in Microsoft Windows). Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=0":AT+CMGF=0OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS PDU mode. To check whether the GSM/GPRS modem or mobile phone supports SMS PDU mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The value 0 represents SMS PDU mode and the value 1 represents SMS text mode. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Selecting the Message Storage Area to Read SMS Text Messages fromSecond, use the AT command +CPMS (command name in text: Preferred Message Storage) to select the message storage area to read SMS text messages from. For example, to instruct the GSM/GPRS modem or mobile phone to use the message storage area in the SIM card for the AT command +CMGR, enter the command line 'AT+CPMS="SM"' in the terminal program. Then press the Enter key on the keyboard and you should see something similar to this:AT+CPMS="SM"+CPMS: 2,10,2,10,3,160OKDetailed information about the +CPMS AT command is available in the "Preferred Message Storage (AT+CPMS)" section of this SMS tutorial.Reading Text MessagesThird, you can now use the +CMGR AT command to read a text message from the message storage area. Let's say you want to read the SMS text message at index 1. You should enter the following command line in a terminal program:AT+CMGR=1Then press the Enter key on the keyboard and the GSM/GPRS modem or mobile phone will execute the command line "AT+CMGR=1". If it reads the text message successfully, the result returned should look something like this:AT+CMGR=1+CMGR: 0,,6207915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EOKHere is a brief description of the various field values in the information response above:The value of the first field, 0, indicates the status of the SMS message is "received unread", i.e. it is an SMS text message received from the SMSC and it has not been read.The value of the second field should be a string that contains the text associated to the sender's phone number "+85291234567" in the phonebook. In this example, this field is empty. One possible reason is that the GSM/GPRS modem or mobile phone (for example, Nokia 6021 and many other Nokia products) does not support this field.The value of the third field, 62, indicates the TPDU encoded in the hexadecimal sequence consists of 62 octets.The details of the SMS text message are encoded in the hexadecimal sequence. Examples include the sender's phone number, the body of the SMS text message, the time and date at which the SMS text message arrived at the SMS center, etc. We have discussed how to decode the hexadecimal sequence in the section titled "Some Explanation about the Decoding of the SMSC_number_and_TPDU Field Value of the +CMGR AT Command" of this SMS tutorial. Thus, we will not talk about it again here.The final result code OK indicates the SMS text message was read from the message storage area successfully. If the execution of the +CMGR AT command fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.After using the +CMGR AT command to read the SMS text message, its status was changed from "received unread" to "received read". So, if the command line "AT+CMGR=1" is executed again, you will see a slightly different result (note the part highlighted in bold type):AT+CMGR=1+CMGR:?1,,6207915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EOKThe SMS text message retrieved above is an incoming text message. Note that if the SMS text message retrieved is an outgoing text message, the data contained in the hexadecimal sequence will have a different format and it should be decoded according to the section "Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT Command" of this SMS tutorial.Suppose there is no message located at index 3 of the message storage area. If you specify the index 3 to the +CMGR AT command, the GSM/GPRS modem or mobile phone will return +CMS error 321 (which means the index is invalid), like this:AT+CMGR=3+CMS ERROR: 32126.3. Using the +CMGL AT Command to List SMS Messages of a Certain Status from a Message Storage AreaThe AT command +CMGL (command name in text: List Messages) is used to list messages of a certain status (for example, "received unread" and "received read") from a message storage area. The messages listed by the AT command +CMGL do not necessarily have to be SMS messages. They can be of other message types such as status reports and cell broadcast messages, but we will only focus on SMS messages here.In SMS text mode, you can retrieve the following information about an SMS message with the AT command +CMGL:The index specifying the location of the SMS message in the message storage area.Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Originator/recipient phone number stored in the SMS message header and the type of the phone number.Text associated to the originator/recipient phone number in the phonebook.Time and date at which the SMS message arrived at the SMSC (available to incoming SMS messages only).Body of the SMS message and its length.In SMS PDU mode, the list becomes:The index specifying the location of the SMS message in the message storage area.Status of the SMS message ("received unread", "received read", "stored unsent", "stored sent", etc).Text associated to the originator/recipient phone number in the phonebook.SMSC number stored with the SMS message and the type of the SMSC number.TPDU of the SMS message and its length.If the status of a message is "received unread", after being retrieved by the +CMGL AT command, the status is changed to "received read".The message storage area from which SMS messages are read is specified by the +CPMS AT command (command name in text: Preferred Message Storage). Details about the +CPMS AT command can be found in the earlier section "Preferred Message Storage (AT+CPMS)" of this SMS tutorial.26.3.1. Syntax of the +CMGL AT Command in SMS Text ModeThe syntax of the +CMGL AT command in SMS text mode is: (Optional parameter is enclosed in square brackets.)+CMGL[=message_status]The?message_status?parameter takes a string that specifies the message status to be used to find messages to return. The SMS specification has defined five message status values, which are shown below. You can perform a test operation to find the actual values supported by your GSM/GPRS modem or mobile phone. See the "Finding the Message Status Values Supported by the +CMGL AT Command in SMS Text Mode" section for the details. Usually all five status values are supported.REC UNREAD. It refers to the message status "received unread". It is the default value.REC READ. It refers to the message status "received read".STO UNSENT. It refers to the message status "stored unsent".STO SENT. It refers to the message status "stored sent".ALL. It tells the +CMGL AT command to list all messages.For example, if "REC READ" is specified to the?message_status?parameter, the +CMGL AT command will list all messages that have the "received read" status from the message storage area.Note that?message_status?is an optional parameter. If it is omitted, the +CMGL AT command will use the default value "REC UNREAD".26.3.2. Format of the Information Response of the +CMGL AT Command in SMS Text ModeIf the GSM/GPRS modem or mobile phone reads the SMS messages from message storage successfully, it will return an information response to the computer / PC. Suppose the messages to be listed are SMS messages (not of other message types like status reports and cell broadcast messages), the information response of the +CMGL AT command in SMS text mode has the following format: (Optional fields are enclosed in square brackets.)+CMGL:?index,message_status,address,[address_text],[service_center_time_stamp][,address_type,sms_message_body_length]<CR><LF>sms_message_body[<CR><LF>+CMGL: ...]Before we discuss each of the fields that appear in the +CMGL information response, let's see an example that gives you some idea of how an actual +CMGL information response should look like:+CMGL: 1,"REC READ","+85291234567",,"07/05/01,08:00:15+32",145,37It is easy to list SMS text messages.The index FieldThe first field of the information response of the +CMGL AT command,?index, is an integer that specifies the location of the SMS message in the message storage area.The message_status FieldThe second field of the information response of the +CMGL AT command,?message_status, is a string that indicates the status of the SMS message. It can be one of the following four values:REC UNREAD. It refers to the message status "received unread".REC READ. It refers to the message status "received read".STO UNSENT. It refers to the message status "stored unsent".STO SENT. It refers to the message status "stored sent".The address FieldThe 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 FieldThe 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.The service_center_time_stamp FieldThe fifth field of the information response of the +CMGL AT command,?service_center_time_stamp, is a string that contains the time and date at which the SMS message arrived at the service center (i.e. SMSC). The time stamp format is "yy/MM/dd,hh:mm:ss±zz" (yy = year, MM = month, dd = day, hh = hour, mm = minute, ss = second, zz = time zone [Note: the unit of time zone is a quarter of an hour]).For example, "07/02/05,08:30:45+32" represents 5 February 2007, 8:30:45 GMT+8 hours. (+32 means GMT+8 hours, since 32 quarters of an hour = 8 hours.)Note that?service_center_time_stamp?is an optional field. This field is available to incoming SMS messages but not to outgoing SMS messages, since outgoing SMS messages have not gone through an SMSC.The address_type FieldThe sixth field of the information response of the +CMGL AT command,?address_type, is an integer that indicates the type of the address contained in the?address?field. Usually it is one of the following two values:129. Meaning: 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. Meaning: 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".Note that?address_type?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the fieldaddress_type?will be shown in the information response of the +CMGL AT command.The sms_message_body_length FieldThe seventh field of the information response of the +CMGL AT command,?sms_message_body_length, is an integer that indicates the number of characters contained in the?sms_message_body?field. For example, there are 36 characters in "It is easy to list SMS text messages". If the value of thesms_message_body?field is "It is easy to list SMS text messages", the value of thesms_message_body_length?field will be 36.Note that?sms_message_body_length?is an optional field and it is not shown by default. The AT command +CSDH (command name in text: Show Text Mode Parameters) can be used to control whether the field?sms_message_body_length?will be shown in the information response of the +CMGL AT command.The sms_message_body FieldThe eighth field of the information response of the +CMGL AT command,?sms_message_body, contains the body of the SMS message.Multiple SMS Messages in the Information ResponseIf there are multiple SMS messages to be returned, the information response of the +CMGL AT command will contain more than one "+CMGL: ...". Two characters,?<CR><LF>, are used to delimit two "+CMGL: ...". Here is an example for illustration. Suppose the command line 'AT+CMGL="ALL"' is executed and three SMS messages are listed. If all characters are shown, the command line and the response returned will be displayed like this:AT+CMGL="ALL"<CR><CR><LF>+CMGL: ...<CR><LF>+CMGL: ...<CR><LF>+CMGL: ...<CR><LF><CR><LF>OK<CR><LF>In a terminal program such as HyperTerminal of Microsoft Windows, a carriage return character causes the cursor to be moved to the beginning of the current line, and a linefeed character causes the cursor to be moved to the same position on the next line. Hence, the above result will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows:AT+CMGL="ALL"+CMGL: ...+CMGL: ...+CMGL: ...OK26.3.3. Finding the Message Status Values Supported by the +CMGL AT Command in SMS Text ModeAs mentioned earlier, the +CMGL AT command takes one parameter,?message_status. Performing a test operation with the +CMGL AT command allows you to find all message status values that are supported by the?message_status?parameter. Here is the syntax of the information response returned after the execution of the test command "+CMGL=?":+CMGL: (message_status1,message_status2,...)In SMS text mode, the values inside the above parentheses (message_status1,?message_status2, etc) are of the string type. The SMS specification has defined five message status values: "REC UNREAD", "REC READ", "STO UNSENT", "STO SENT" and "ALL". They are supported by most GSM/GPRS modems and mobile phones. A description of these five message status values can be found in the earlier section "Syntax of the +CMGL AT Command in SMS Text Mode".As an example, here is the response returned from my Nokia 6021 mobile phone to the HyperTerminal program in Windows after the execution of the test command "+CMGL=?":AT+CMGL=?+CMGL: ("REC UNREAD","REC READ","STO UNSENT","STO SENT","ALL")OKFrom above, we know that the Nokia 6021 mobile phone supports all of the five message status values defined in the SMS specification.26.3.4. Example Demonstrating How to Use the +CMGL AT Command to List SMS Text Messages from a Message Storage Area (SMS Text Mode)Now let's see a more detailed example that demonstrates how to use the +CMGL AT command to list SMS text messages from a message storage area when SMS text mode is used, and how the +CMGL AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS Text ModeFirst, enter the command line "AT+CMGF=1" in a terminal program (for example, HyperTerminal in Microsoft Windows) to instruct the GSM/GPRS modem or mobile phone to operate in SMS text mode. This step is necessary because the default mode is SMS PDU mode. Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=1":AT+CMGF=1OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS text mode. To check whether the GSM/GPRS modem or mobile phone supports SMS text mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The values 0 and 1 represent SMS PDU mode and text mode respectively. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Selecting the Message Storage Area to Read SMS Text Messages fromSecond, use the AT command +CPMS (command name in text: Preferred Message Storage) to select the message storage area to read SMS text messages from. For example, to instruct the GSM/GPRS modem or mobile phone to use the message storage area in the SIM card for the AT command +CMGL, enter the command line 'AT+CPMS="SM"' in the terminal program. The result should be like this:AT+CPMS="SM"+CPMS: 2,10,2,10,5,160OKDetailed information about the +CPMS AT command is available in the "Preferred Message Storage (AT+CPMS)" section of this SMS tutorial.Listing SMS Text MessagesThird, you can now use the +CMGL AT command to list SMS text messages from the message storage area. Let's say you want to retrieve all new SMS messages received. As the status of new inbound SMS messages is "received unread", you should specify "REC UNREAD" to the +CMGL AT command, as shown below:AT+CMGL="REC UNREAD"Since "REC UNREAD" is the default parameter value, you can simply omit it, like this:AT+CMGLNow press the Enter key on the keyboard. The GSM/GPRS modem or mobile phone will then execute the command line "AT+CMGL" and return all text messages that have the "REC UNREAD" status in the message storage area. In a terminal program such as HyperTerminal of Microsoft Windows, the result should look something like this:AT+CMGL+CMGL: 2,"REC UNREAD","+85291234567",,"07/02/18,00:05:10+32"A simple demo of SMS text messaging.+CMGL: 3,"REC UNREAD","+85291234567",,"07/02/18,00:07:22+32"It is easy to list SMS text messages.OKFrom above, we know that the message storage area contains two new inbound SMS text messages. The first one is "A simple demo of SMS text messaging." and the second one is "It is easy to list SMS text messages.". Let's take the first SMS text message as an example to illustrate the meaning of different field values in the information response:The value of the first field, 2, tells us the text message is stored in the memory location at index 2.The value of the second field, "REC UNREAD", indicates the status of the text message is "received unread".The value of the third field, "+85291234567", is the sender's phone number.The value of the fourth field should be a string that contains the text associated to the sender's phone number "+85291234567" in the phonebook. In this example, this field is empty. One possible reason is that the GSM/GPRS modem or mobile phone (for example, Nokia 6021 and many other Nokia products) does not support this field.The value of the fifth field, "07/02/18,00:05:10+32", tells us that the SMSC received the text message at 00:05:10 (GMT+8) on 18 Feb 2007. (Don't forget the unit of time zone is a quarter of an hour. Since 32 quarters of an hour = 8 hours, "+32" means GMT+8 hours.)The value of the sixth field, "A simple demo of SMS text messaging.", is the body of the SMS text message.The final result code OK indicates the SMS text messages were read from the message storage area successfully. If the execution of the +CMGL AT command fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.Now if the command line "AT+CMGL" is executed again, no text message will be listed. Here shows the response returned from Philips 598:AT+CMGLOKThe response returned from Nokia 6021 is slightly different, as shown below. There seems to be a minor bug in Nokia's implementation. Two extra characters?<CR><LF>?are outputted and this does not follow the general syntax of extended AT commands.AT+CMGLOKNo SMS text message is listed because the status of the SMS text messages "A simple demo of SMS text messaging." and "It is easy to list SMS text messages." has been changed from "received unread" to "received read" after being read by the +CMGL AT command. To see these two SMS text messages again, specify either "REC READ" or "ALL" to the +CMGL AT command, like this:AT+CMGL="ALL"+CMGL: 1,"STO SENT","+85291234567",,Hello, welcome to our SMS tutorial.+CMGL: 2,"REC READ","+85291234567",,"07/02/18,00:05:10+32"A simple demo of SMS text messaging.+CMGL: 3,"REC READ","+85291234567",,"07/02/18,00:07:22+32"It is easy to list SMS text messages.OKAs mentioned in the earlier section "Format of the Information Response of the +CMGL AT Command in SMS Text Mode", two optional fields?address_type?and?sms_message_body_length?are not shown in the information response of the +CMGL AT command by default. To show these optional fields, you have to specify the value 1 to the +CSDH AT command (command name in text: Show Text Mode Parameters):AT+CSDH=1OKExecute the command line 'AT+CMGL="ALL"' again and the result should be:AT+CMGL="ALL"+CMGL: 1,"STO SENT","+85291234567",,,145,35Hello, welcome to our SMS tutorial.+CMGL: 2,"REC READ","+85291234567",,"07/02/18,00:05:10+32",145,36A simple demo of SMS text messaging.+CMGL: 3,"REC READ","+85291234567",,"07/02/18,00:07:22+32",145,37It is easy to list SMS text messages.OKThe value of the?address_type?fields (the sixth field from the left) of all three SMS text messages is 145, which indicates the phone numbers stored with these three SMS text messages are typical phone numbers in international format. The values of the?sms_message_body_length?fields (the seventh field from the left) of the three SMS text messages are 35, 36 and 37. They indicate the SMS text messages contain 35 characters, 36 characters and 37 characters respectively.26.3.5. Syntax of the +CMGL AT Command in SMS PDU ModeThe syntax of the +CMGL AT command in SMS PDU mode is: (Optional parameter is enclosed in square brackets.)+CMGL[=message_status]The?message_status?parameter takes an integer that specifies the message status to be used to find messages to return. The SMS specification has defined five message status values, which are shown below. You can perform a test operation to find the actual values supported by your GSM/GPRS modem or mobile phone. See the "Finding the Message Status Values Supported by the +CMGL AT Command in SMS PDU Mode" section for the details. Usually all five status values are supported.0. It refers to the message status "received unread". It is the default value.1. It refers to the message status "received read".2. It refers to the message status "stored unsent".3. It refers to the message status "stored sent".4. It tells the +CMGL AT command to list all messages.For example, if 1 is specified to the?message_status?parameter, the +CMGL AT command will list all messages that have the "received read" status from the message storage area.Note that?message_status?is an optional parameter. If it is omitted, the +CMGL AT command will use the default value 0.26.3.6. Format of the Information Response of the +CMGL AT Command in SMS PDU ModeIf the GSM/GPRS modem or mobile phone reads the SMS message from message storage successfully, it will return an information response to the computer / PC. In SMS PDU mode, the information response of the +CMGL AT command has the following format: (Optional fields are enclosed in square brackets.)+CMGL:?index,message_status,[address_text],TPDU_length<CR><LF>SMSC_number_and_TPDU[<CR><LF>+CMGL: ...]Before we discuss each of the fields that appear in the +CMGL information response, let's see an example that gives you some idea of how an actual +CMGL information response should look like:+CMGL: 1,0,,6207915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EThe index FieldThe first field of the information response of the +CMGL AT command,?index, is an integer that specifies the location of the SMS message in the message storage area.The message_status FieldThe second field of the information response of the +CMGL AT command,?message_status, is an integer that indicates the status of the SMS message. It can be one of the following four values:0. It refers to the message status "received unread".1. It refers to the message status "received read".2. It refers to the message status "stored unsent".3. It refers to the message status "stored sent".The address_text FieldThe third 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, where?address?is the phone number encoded in the TPDU of the?SMSC_number_and_TPDU?field. For example, if the phone number encoded in the TPDU is "91234567" and 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 leave this field empty. (Examples: Philips 598 supports this field, while most Nokia products, including my Nokia 6021, and Sony Ericsson T68i does not.)The TPDU_length FieldThe fourth field of the information response of the +CMGL AT command,?TPDU_length, is an integer that indicates the length (in octets. 1 octet = 8 bits) of the TPDU contained in the?SMSC_number_and_TPDUfield. In the earlier example command line, the value of the?SMSC_number_and_TPDU?field is:07915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EIt can be divided into two parts. The following part is the TPDU:040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EThe TPDU is coded in hexadecimal format. Each character represents 4 bits, i.e. 1/2 octet. The TPDU has 124 characters and so there are totally 62 octets. That's why the value of the?TPDU_length?field is 62.The SMSC_number_and_TPDU FieldThe fifth field of the information response of the +CMGL AT command,?SMSC_number_and_TPDU, specifies the SMSC number and the TPDU (Transfer Protocol Data Unit) in hexadecimal format.If the SMS message to be read is an incoming SMS message, the value of the SMSC_number_and_TPDU field will be something like this:07915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EThe TPDU embedded in the above hexadecimal sequence is of the type SMS-DELIVER. Here is some of the information encoded in the hexadecimal sequence:SMSC number from which the SMS message was received: +85290000000Sender phone number: +85291234567Time and date at which the SMSC received the SMS message: 12 April 2007, 23:25:42 GMT+8 hoursText message: "It is easy to read text messages via AT commands."For the details about how the hexadecimal sequence of an incoming SMS message is coded, please refer to the section titled "Some Explanation about the Decoding of the SMSC_number_and_TPDU Field Value of the +CMGR AT Command" of this SMS tutorial.If the SMS message to be read is an outgoing SMS message, the value of theSMSC_number_and_TPDU?field will be something like this:07915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72EThe TPDU embedded in the above hexadecimal sequence is of the type SMS-SUBMIT. Its format is different from that of an SMS-DELIVER TPDU. Below shows some of the information encoded in the hexadecimal sequence above:SMSC number to be used if the SMS message is sent out: +85290000000Destination phone number: +85291234567Text message: "It is easy to send text messages."For the details about how the hexadecimal sequence of an outgoing SMS message is coded, please refer to the section titled "Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT Command" of this SMS tutorial.Multiple SMS Messages in the Information ResponseIf there are multiple SMS messages to be returned, the information response of the +CMGL AT command will contain more than one "+CMGL: ...". Two characters,?<CR><LF>, are used to delimit two "+CMGL: ...". Here is an example for illustration. Suppose the command line "AT+CMGL=4" (this command line tells the GSM/GPRS modem or mobile phone to retrieve all messages from message storage) is executed and three SMS messages are listed. If all characters are shown, the command line and the response returned will be displayed like this:AT+CMGL=4<CR><CR><LF>+CMGL: ...<CR><LF>+CMGL: ...<CR><LF>+CMGL: ...<CR><LF><CR><LF>OK<CR><LF>In a terminal program such as HyperTerminal of Microsoft Windows, a carriage return character causes the cursor to be moved to the beginning of the current line, and a linefeed character causes the cursor to be moved to the same position on the next line. Hence, the above result will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows:AT+CMGL=4+CMGL: ...+CMGL: ...+CMGL: ...OK26.3.7. Finding the Message Status Values Supported by the +CMGL AT Command in SMS PDU ModeAs mentioned earlier, the +CMGL AT command takes one parameter,?message_status. Performing a test operation with the +CMGL AT command allows you to find all message status values that are supported by the?message_status?parameter. Here is the format of the information response returned after the execution of the test command "+CMGL=?":+CMGL: (list_of_status_values)In SMS PDU mode, the values inside the above parentheses are integers. The SMS specification has defined five message status values: 0, 1, 2, 3 and 4. They are supported by most GSM/GPRS modems and mobile phones. A description of these five message status values can be found in the earlier section "Syntax of the +CMGL AT Command in SMS PDU Mode".As an example, here is the response returned from my Nokia 6021 mobile phone to the HyperTerminal program in Windows after the execution of the test command "+CMGL=?":AT+CMGL=?+CMGL: (0-4)OKFrom above, we know that the Nokia 6021 mobile phone supports all of the five message status values defined in the SMS specification.Do you remember that we described the format of values inside parentheses in the section "Test Command -- Checks Whether a Certain AT Command is Supported"? If not, you may want to go back and have a look. Here are a few examples showing some of the possibilities: "(0-4)", "(0,1,2,3,4)", "(0,2-4)".26.3.8. Example Demonstrating How to Use the +CMGL AT Command to List SMS Text Messages from a Message Storage Area (SMS PDU Mode)Now let's see a more detailed example that demonstrates how to use the +CMGL AT command to list SMS text messages from a message storage area when SMS PDU mode is used, and how the +CMGL AT command should be used together with other AT commands.Instructing the GSM/GPRS Modem or Mobile Phone to Operate in SMS PDU ModeFirst, instruct the GSM/GPRS modem or mobile phone to operate in SMS PDU mode by entering the command line "AT+CMGF=0" in a terminal program (for example, HyperTerminal in Microsoft Windows). Below shows the response returned from Nokia 6021 to HyperTerminal after the execution of the command line "AT+CMGF=0":AT+CMGF=0OKThe final result code OK indicates the +CMGF AT command was executed successfully. If the final result code ERROR is returned, it is likely that the GSM/GPRS modem or mobile phone does not support SMS PDU mode. To check whether the GSM/GPRS modem or mobile phone supports SMS PDU mode, enter the command line "AT+CMGF=?" in the terminal program. Here is the response returned from Nokia 6021 to HyperTerminal:AT+CMGF=?+CMGF: (0,1)OKThe values in the parentheses indicate the modes that the GSM/GPRS modem or mobile phone can operate in. The value 0 represents SMS PDU mode and the value 1 represents SMS text mode. From the above response, we know that Nokia 6021 can operate in either SMS PDU mode or SMS text mode. See the section titled "Selecting the Operating Mode (AT+CMGF)" of this SMS tutorial if you want to learn further details about the +CMGF AT command.Selecting the Message Storage Area to Read SMS Text Messages fromSecond, use the AT command +CPMS (command name in text: Preferred Message Storage) to select the message storage area to read SMS text messages from. For example, to instruct the GSM/GPRS modem or mobile phone to use the message storage area in the SIM card for the AT command +CMGL, enter the command line 'AT+CPMS="SM"' in the terminal program. Then press the Enter key on the keyboard and you should see something similar to this:AT+CPMS="SM"+CPMS: 2,10,2,10,3,160OKDetailed information about the +CPMS AT command is available in the "Preferred Message Storage (AT+CPMS)" section of this SMS tutorial.Listing SMS Text MessagesThird, use the +CMGL AT command to list SMS text messages from the message storage area. Suppose you would like to retrieve all new SMS messages received. As the status of new inbound SMS messages is "received unread", you should specify 0 to the +CMGL AT command, as shown below:AT+CMGL=0Since 0 is the default parameter value, you can simply omit it, like this:AT+CMGLNow press the Enter key on the keyboard and the GSM/GPRS modem or mobile phone will execute the command line "AT+CMGL". If successful, it returns all messages that have the "received unread" status in the message storage area. In a terminal program such as HyperTerminal of Microsoft Windows, the result should look something like this:AT+CMGL+CMGL: 2,0,,5107915892000000F0040B915892214365F70000701010221555232441D03CDD86B3CB2072B9FD06BDCDA069730AA297F17450BB3C9F87CF69F7D905+CMGL: 3,0,,6207915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EOKFrom above, we know that the message storage area contains two new inbound SMS text messages. Let's take the first SMS text message as an example to illustrate the meaning of different field values in the +CMGL information response above:The value of the first field, 2, tells us the text message is stored in the memory location at index 2.The value of the second field, 0, indicates the status of the text message is "received unread".The value of the third field should be a string that contains the text associated to the sender's phone number "+85291234567" in the phonebook. In this example, this field is empty. One possible reason is that the GSM/GPRS modem or mobile phone (for example, Nokia 6021 and many other Nokia products) does not support this field.The value of the fourth field, 51, tells us the TPDU encoded in the hexadecimal sequence consists of 51 octets.The details of the SMS text message are encoded in the hexadecimal sequence. Examples include the sender's phone number, the body of the SMS text message, the time and date at which the SMS text message arrived at the SMS center, etc. We have discussed how to decode the hexadecimal sequence of an inbound SMS text message in the section titled "Some Explanation about the Decoding of the SMSC_number_and_TPDU Field Value of the +CMGR AT Command" of this SMS tutorial. Thus, we will not talk about it again here.For the decoding of the hexadecimal sequence of an outgoing SMS text message, please refer to the "Some Explanation about the Coding of the SMSC_number_and_TPDU Parameter Value of the +CMGS AT Command" section of this SMS tutorial.The final result code OK informs us that the SMS text messages were read from message storage successfully. If the execution of the +CMGL AT command fails, the GSM/GPRS modem or mobile phone will return either the final result code ERROR or +CMS ERROR.After using the +CMGL AT command to list the SMS text messages, their status was changed from "received unread" to "received read". So, if the command line "AT+CMGL" is executed again, no text message will be returned. Here shows the response returned from Philips 598:AT+CMGLOKThe response returned from Nokia 6021 is slightly different, as shown below. There seems to be a minor bug in Nokia's implementation. Two extra characters?<CR><LF>?are outputted and this does not follow the general syntax of extended AT commands.AT+CMGLOKTo see the two text messages again, specify either 1 or 4 to the +CMGL AT command. The value 1 instructs +CMGL to list all messages that have the "received read" status from message storage, while the value 4 instructs +CMGL to list all messages from message storage. The response returned from the GSM/GPRS modem or mobile phone is slightly different from the earlier one. The changes are highlighted in bold type below:AT+CMGL=1+CMGL: 2,1,,5107915892000000F0040B915892214365F70000701010221555232441D03CDD86B3CB2072B9FD06BDCDA069730AA297F17450BB3C9F87CF69F7D905+CMGL: 3,1,,6207915892000000F0040B915892214365F700007040213252242331493A283D0795C3F33C88FE06C9CB6132885EC6D341EDF27C1E3E97E7207B3A0C0A5241E377BB1D7693E72EOKHow to Choose an SMS Service Provider (SMS Gateway Provider, SMS Reseller, SMS Broker)?IntroductionThis article discusses 13 questions that you should ask yourself when choosing an SMS service provider. An SMS service provider is a business entity that provides SMS messaging services but is not a mobile network operator. It acts as a middleman between mobile network operators and SMS service users. An SMS service provider signs agreements with a lot of mobile network operators to obtain their permission to exchange SMS messages with their mobile networks, and offers an interface for users to send and receive SMS messages. Some of the interfaces are very simple to use since they hide most of the technical details of SMS messaging. Some others are more powerful that support more features. SMS service providers are also known as SMS gateway providers, SMS resellers or SMS brokers. This is because:SMS gateway provider. An SMS service provider provides an SMS gateway for its users to send SMS messages to. This SMS gateway will then route the SMS messages to another SMS gateway or SMSC.SMS reseller / SMS broker. SMS service providers buy a large amount of SMS messages from a lot of wireless carriers at a low price per SMS message. They then sell the SMS messages at a price higher than the cost.More information about SMS service providers can be found in the "SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)" section of our?SMS tutorial. Links to the web site of some SMS service providers and a comparison between their SMS messaging services are available in "Comparison Table of SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)".1. How much does it cost to send 1 SMS message?Cost of service is an important factor that you need to consider when choosing an SMS gateway provider for your SMS application. Typically, SMS gateway providers can be divided into 2 categories in terms of how they require you to pay for their SMS service:Credit-basedYou purchase a number of credits from the SMS gateway provider. Sending one SMS message will cost you one or more credits, depending on the country you send the SMS message to. For example, sending an SMS text message to India might cost you one credit while sending an SMS text message to the United States might cost you two credits.SMS-basedYou purchase a number of SMS messages from the SMS gateway provider. The cost for sending one SMS message is the same for all destinations. For example, if you purchase ten SMS messages, you can send at most ten SMS messages no matter the destination is India or the United States.In general:??Cost per credit (credit-based payment) < Cost per SMS message (SMS-based payment)So, is credit-based payment always better? Not definitely. Let's take a look at the following example:SMS gateway provider A (Credit-based payment): Cost per credit = US $0.06SMS gateway provider B (SMS-based payment): Cost per SMS message = US $0.1?SMS gateway provider ASMS gateway provider BTo country X(Suppose 1 credit is required.)Cost per SMS message = $0.06Cost per SMS message = $0.1To country Y(Suppose 3 credits are required.)Cost per SMS message = $0.06 * 3 = $0.18Cost per SMS message = $0.1From the above table, you can see that if your SMS messaging application targets on country X, you should choose SMS gateway provider A since sending an SMS message to country X with SMS gateway provider A is cheaper. Similarly, if your SMS messaging application targets on country Y, you should choose SMS gateway provider B. If your SMS messaging application targets both countries, then of course you should route all SMS messages destined for country X to SMS gateway provider A, and those destined for country Y to SMS gateway provider B.For most of the SMS gateway providers, the cost for sending one SMS message decreases with your purchasing amount. For example, the pricing structure of SMS gateway provider B and SMS gateway provider C might be like this:Number of SMS messages purchasedSMS gateway provider BSMS gateway provider C1 to 10,000Cost per SMS message = $0.1Cost per SMS message = $0.0910,001 to 20,000Cost per SMS message = $0.08Cost per SMS message = $0.08>=20,001Cost per SMS message = $0.06Cost per SMS message = $0.07For the above table, you can see that if you plan to purchase 1 to 10,000 SMS messages at a time, you should choose SMS gateway provider C since its cost per SMS message is lower. But if you plan to purchase more than or equal to 20,001 SMS messages at a time, you should choose SMS gateway provider B.2. Are there any hidden costs?A few SMS gateway providers do not write clearly all the fees involved in the pricing page of their web site. They hide some of the fees so that their SMS messaging service looks cheaper. When you go checkout, you may find that some additional fees are required. For example, setup fees.3. Are there any minimum purchase requirements or monthly minimum usage requirements?Some SMS gateway providers have a minimum purchase requirement. For example, an SMS gateway provider might require you to buy 1,000 credits or more each time. If you are not sure whether your SMS application will be a success, an SMS gateway provider with no minimum purchase requirement will be your choice. You can start by purchasing a small amount of SMS messages or credits. Later as your SMS application gets more users, you can purchase more.Usually SMS gateway providers do not have any monthly minimum usage requirements. Monthly minimum usage requirement is more common in SMS messaging services provided by mobile network operators. For example, a mobile network operator might only provide SMS messaging services to customers that have a monthly traffic of, say at least 50,000 SMS messages.If your SMS application has a very small amount of SMS traffic, an SMS gateway provider with no monthly minimum usage requirement will be your choice. For example, if your SMS application is a remote monitoring system that sends an SMS alert to the system administrator whenever it finds any server is not responding, you should choose an SMS gateway provider that does not have any monthly minimum usage requirements. This is because the servers being monitored should be running properly most of the time and the remote monitoring system seldom sends an SMS message.4. Will the purchased credits or SMS messages expire after a certain period?For some SMS gateway providers, the credits or SMS messages purchased can only be used within a certain period. After which the credits or SMS messages will expire and cannot be used any more. If you choose an SMS gateway provider that imposes such restriction, you should be more conservative when estimating the amount of SMS traffic of your SMS application.5. How good is the SMS gateway provider's network coverage?Network coverage is an important factor you need to consider, since it is possible that an SMS gateway provider cannot deliver SMS messages to your SMS application's targeted countries or mobile operators. You can very often find a detailed list of the supported countries and mobile operators on the web site of an SMS gateway provider.However, it should be noted that the network coverage web page may not be updated. Even if it is updated, some SMS gateway providers cannot guarantee that you can definitely send SMS messages to a mobile operator listed on their network coverage web page. This is due to the fact that an SMS message may be routed to other gateways not controlled directly by the SMS gateway providers themselves.In addition, it should be noted that for some SMS gateway providers, SMS messages cannot reach mobile phone numbers that have been ported between mobile operators.Many SMS gateway providers give new users a few free SMS messages. You can use them to test the SMS gateway provider's network coverage.6. How good is the SMS gateway provider's network quality?A few SMS gateway providers offer a very low price per SMS message, but their network quality is poor and an SMS message may not reach its destination, or it may only reach the destination after a long delay. So, remember to test an SMS gateway provider's network quality. Many SMS gateway providers offer a small amount of free SMS messages to new users. You can use them to test the network quality.Some SMS gateway providers offer several message routing options. You can decide whether to route SMS messages through more reliable but more expensive networks, or less reliable but cheaper networks.7. Is the protocol / interface you intend to use supported by the SMS gateway?Protocols / interfaces commonly supported by SMS gateway providers for sending and receiving SMS messages include:HTTP. It is the most commonly supported protocol for sending and receiving SMS messages. It is very simple to use.HTTPS (HTTP + SSL encryption). Data transmitted over HTTP is not secure. If you do not want your data to be seen by others on the Internet, you should use HTTPS instead. With HTTPS, data are encrypted before transmitting over the Internet, thus protecting the data from eavesdropping.XML over HTTP / HTTPS. One or more SMS messages are put in an XML file and uploaded to the SMS gateway provider's server. XML over HTTP / HTTPS is a better choice than HTTP / HTTPS for sending bulk SMS messages since it enables the submission of a large amount of SMS messages in a single HTTP request.SMTP (email to SMS / SMS to email). Choose SMTP if you want to send or receive SMS messages in the form of email.FTP. One or more SMS messages are put in a text file and uploaded to the SMS gateway provider's FTP server. Like XML over HTTP / HTTPS, FTP is a better choice than HTTP / HTTPS for sending bulk SMS messages since it enables the submission of a large amount of SMS messages in a single upload.SMPP. The SMPP protocol is usually used by advanced users. It is a binary protocol for communicating with SMSCs (SMS centers) and SMS gateways. SMPP is suitable for sending and receiving bulk SMS messages.An SMS gateway provider usually supports only a subset of the above protocols / interfaces. A few SMS gateway providers also provide their users a COM object free of charge. You can integrate the COM object into your ASP pages or Microsoft Windows-based programs (COM is a Microsoft technology) and call the methods of the COM object to submit SMS messages to the SMS gateway.8. Is the SMS gateway provider's API well documented and easy to use? Is there any sample code provided?Well-documented APIs (Application Programming Interfaces) and sample code are invaluable to developers. They can help save a lot of development time.One good use of the API documentation during the SMS gateway provider selection process is to check whether an SMS gateway provider supports a particular feature required by your SMS application. For example, to find out whether an SMS gateway provider supports the sending of concatenated SMS messages, you can check the API documentation to see if there is a description of the commands and parameters for sending concatenated SMS messages.Some SMS gateway providers require you to register an account or make a purchase before you can download the API documentation or sample code from their web site. Such SMS gateway providers are less preferable.9. What payment options does the SMS gateway provider offer?Very often SMS messages or credits are purchased from a web site. So, most SMS gateway providers support online credit card payment. Some also accept PayPal, check payment, direct deposit or wire transfer.10. Is it easy to manage your account? Can you easily check the number of credits or SMS messages left in your account?Most SMS gateway providers provide a web-based account management system. The basic functions of the account management systems provided by different SMS gateway providers are more or less the same. For example, most of them allow you to check the number of credits/SMS messages left in your account and buy new credits/SMS messages online. The difference is in ease of use. Some SMS gateway providers offer an account management system that is easy to use and learn. The user interface is clean and intuitive. The menu items are well organized. Plenty of hints and tips are available. Some wizards are provided to guide users through a process step by step. These features help you work more efficient and make fewer errors.Some SMS gateway providers' account management system supports more features than the others. Here are some examples:Access via HTTPS (HTTP + SSL encryption). Some account management systems are accessible via HTTPS. With an HTTPS connection, the data transmitted between your computer and the web server over the Internet is encrypted. So, your data (for example, the user name and password you entered in the login page) is protected from eavesdropping.IP locking. Some account management systems allow you to associate a few IP addresses to your account. Only computers with those IP addresses can send or receive SMS messages via the SMS gateway provider. This feature enhances your account's security.Low credits/SMS messages alert. Some account management systems will send a text message to the email address or mobile phone number you specified when the number of remaining credits/SMS messages in your account is lower than a certain value.Detailed reports. Some account management systems provide detailed reports of the SMS messages sent and received. You can request reports of a certain day or date range. The reports usually include fields such as the total number of SMS message sent or received, the date and time that an individual SMS message was sent or received, and the originating/recipient mobile phone number. Some account management systems also allow you to download a report as a CSV (Comma Separated Values) file or Microsoft Excel file, which can be imported into a spreadsheet program to do things such as generating charts from the data.Sub users management. Some account management systems allow you to add sub users to your account. You and the sub users share the same account but they use their own user name and password. You, as the administrator, can view reports of the SMS messages sent and received by a certain sub user. The ability to add sub users is particularly useful to large companies where many applications or staff members need to send or receive SMS messages.SMS message routing options. Some SMS gateway providers offer several message routing options that can be set or changed with their account management system. For example, an SMS gateway provider might allow you to specify:whether to route SMS messages at a certain cost (sometimes you may not want to allow your staff members to send SMS messages to destinations that cost too many credits),whether to route SMS messages to a certain destination (suppose your company sets up an SMS messaging system for staff members to contact clients in the UK, you may want to disable the sending of SMS messages to other countries),which network to route SMS messages through (do you want to route SMS messages through more reliable but more expensive networks, or less reliable but cheaper networks?).11. Does the SMS gateway provider provide any free SMS messages for testing?Needless to say, you must test an SMS gateway thoroughly before you can know whether it is suitable for your SMS application. As mentioned earlier, you should test whether you can successfully send SMS messages to or receive SMS messages from your targeted countries, mobile operators or mobile phone numbers through the SMS gateway provider. You should also test the SMS gateway provider's network quality.It will be great if the SMS gateway provider provides some free SMS messages for testing. However, it won't cost you too much even if you pay for the testing SMS messages yourself, suppose that the SMS gateway provider does not require a minimum purchase of, say, 100,000 SMS messages.12. Does your SMS application require 2-way SMS messaging services?SMS messaging services can be grouped into two categories: 1-way and 2-way. 1-way SMS messaging services allow you to send SMS messages, while 2-way SMS messaging services allow you to send and receive SMS messages. All SMS gateway providers provide 1-way SMS messaging services. However, only some of them provide 2-way SMS messaging services. The reason is that it is technically more difficult for an SMS gateway provider to enable its users to receive SMS messages than to send SMS messages.13. How good is the SMS gateway provider's support service?A good SMS gateway provider should have a support team that has a complete understanding of its system. The team members should be able to answer and tackle all sorts of questions and problems. In particular, they should be familiar with compatibility issues related to different mobile network operators. The support service's quality is a reflection of the company's quality. To find out how good an SMS gateway provider's support service is, one way is to email a question to the support team. Then ask yourself the following questions:Do they reply?How long does it take for them to reply?Does the reply answer your question well?Are they familiar with the topic?Ask some follow-up questions. Do they have patience? Does the reply answer your question well?Most SMS gateway providers provide support service by email. If you prefer telephone support service, you should choose an SMS gateway provider that provides a customer support phone parison Table of SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)This web page contains a comparison table of some SMS service providers that we found on the web. (SMS service providers are also called SMS gateway providers, SMS resellers or SMS brokers. See "SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)" for the details.) The SMS service providers in the comparison table are listed in order of Google PageRank that we saw on Google Toolbar at the time we checked their web sites. PageRank is a technology developed by Google to determine how important a web page is. Usually highly-regarded web sites have higher Google PageRank values. If two SMS service providers have the same Google PageRank value, we will list them in alphabetical order.In the comparison table:The first field "Last updated date" shows the date that we last checked the SMS gateway provider's web site. Since SMS gateway providers may change the information on their web sites from time to time, you should visit their web sites to obtain the most up-to-date and detailed information about their SMS messaging services.The definition of "credit-based" and "SMS-based" can be found in the article "How to Choose an SMS Service Provider (SMS Gateway Provider, SMS Reseller, SMS Broker)? -- 1. How much does it cost to send 1 SMS message?".All prices shown are VAT excluded, unless otherwise stated."?" means the information cannot be found on the SMS gateway provider's website, or the information is not available without registering an account.Note that we have not tried the services of most SMS gateway providers listed on this web page. So, we are not sure about their service quality. You have to test the SMS gateway providers yourself. (Some SMS gateway providers give new users a number of free SMS messages for testing purposes.)Finding More SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)Besides the SMS gateway providers included on this web page, there are many more SMS gateway providers that can be found on the web. Have a look at the?Google Directory / Open Directory?or search with Google using keywords such as:bulk smssms gateway providersms service providerTo scroll the table, use the scroll bars on the right and bottom of the table. A?full-page version?is available additionally.Last updated dateURL to the SMS gateway provider's web siteGoogle PageRankCredit-based or SMS-based?Cost for sending SMS messagesSetup fees for 1-way SMS messagingMinimum purchase requirementsMonthly minimum usage requirementsWill purchased credits or SMS messages expire?Payment optionsNetwork coverageProtocols or interfaces supportedAPI documentsNumber of free SMS messages or credits2-way SMS messaging:SIM card hosting2-way SMS messaging:Shared virtual mobile number (keyword sharing)2-way SMS messaging:Dedicated virtual mobile number2-way SMS messaging:Shared short code (keyword sharing, not for SMS billing)2-way SMS messaging:Dedicated short code (not for SMS billing)Short code for SMS reverse billing / premium SMS5 Jun 2008(Details)For the "SMS Gateway (API)", "Communicator" and "Messenger Pro" products:0.034 - 0.044 Euros per creditFor the "Wholesale" product:0.015 - 0.025 Euros per credit(Details)For the "SMS Gateway (API)", "Communicator" and "Messenger Pro" products:Sending one plain text SMS message requires 0.8 to 3 credits.For the "Wholesale" product:Sending one plain text SMS message requires 1 to 5.5 credits.(Details)None(Details)For the "SMS Gateway (API)" product:You need to buy at least 400 credits.(Details)You need to have at least 5000 credits in your account before asking them to set up the SMPP API for you.(Details)For the "Communicator" and "Messenger Pro" products:You need to buy at least 300 credits.(Details)For the "Wholesale Gateway" product:You need to buy at least 100000 credits.(Details)None (Details), except the SMPP API, where a monthly minimum usage of 5000 credits is required. (Details)An account will expire if no SMS message is sent within 6 months.(Details)Credit cards, wire transfer, Euro and UK deposits, South African deposits, PayPal and MoneyBookers.(Details)(Details)HTTP / HTTPS, SMTP (email to SMS), SMPP, XML, FTP and COM Object(Details)Available for download without account registration.(Details:?HTTP / HTTPS,SMTP (email to SMS),SMPP,?XML,?FTP?and?COM Object)For the "SMS Gateway (API)" product:10 free credits upon account activation.(Details)For the "Communicator" product:10 free credits upon account activation.(Details)For the "Messenger-PRO" product:5 credits for Messenger-PRO users.(Details)For the "Wholesale Gateway" product:Free credits are available for testing, but the actual number of free credits is not mentioned.(Details)??Standard number:Setup fee: € 100Monthly fee: € 75 for a standard number in the +44[D] range, € 25 for a standard number in all other ranges.Switching fee: 1/3 credit per inbound SMS messageTagged number:Setup fee: € 50Monthly fee: € 15Switching fee: 1/3 credit per inbound SMS messageTagged number range:Setup fee: € 100Monthly fee: € 30 - € 90Switching fee: 1/3 credit per inbound SMS message(Pricing details)(Network coverage)?USA short code:Setup fee: $1700. An additional $500 is required for T-Mobile USA.Monthly fee: $1100 for random short code, $1600 for vanity short code. (Vanity short code: you select a specific number as the short code.)Switching fee: 1/3 credit per inbound SMS message(Pricing details)(Network coverage)UK dedicated short code:Setup fee: ?720Monthly fee: ?630Switching fee: 1/3 credit per inbound SMS messageUK shared short code:1st keyword: ?500 setup fee, ?175 monthly fee2nd to 4th keyword: ?125 setup fee, ?125 monthly fee5th keyword and higher: ?100 setup fee, ?100 monthly feeSpelling variance: ?35 setup fee, ?100 monthly feeSwitching fee: 1/3 credit per inbound SMS messageSouth Africa dedicated short code:Setup fee: 2000 South African RandsMonthly fee: 500 South African RandsSwitching fee: 1/3 credit per inbound SMS messageSouth Africa shared short code:1st keyword: 1000 Rands setup fee, 300 Rands monthly fee2nd to 4th keyword: 500 Rands setup fee, 300 Rands monthly fee5th keyword and higher: 500 Rands setup fee, 200 Rands monthly feeSpelling variance: 100 Rands setup fee, 300 Rands monthly feeSwitching fee: 1/3 credit per inbound SMS messageNamibia dedicated short code:Setup fee: 2000 South African RandsMonthly fee: 2025 South African Rands if prepay for 3 months, 1350 South African Rands if prepay for 12 months.Switching fee: 1/3 credit per inbound SMS message(Details)1 Jun 2006 coverage?is available on the web site.MSIP (mBlox Simple Interface Protocol), SMPP / SMPP over SSL and XML(Details)You need to contact their staff for the interface specifications.(Details)??Two-way SMS messaging service is available. The web page does not state clearly whether shared mobile numbers are available.(Details)(Geographical coverage)??Available for Australia, Austria, Belgium, Canada, Denmark, Finland, France, Germany, Ireland, the Netherlands, Norway, Spain, Sweden, the United Kingdom and the United States(Details)(Geographical coverage. Note: the map on this web page cannot be seen with Firefox.)1 Jun 2006(Details)Economy option:? 0.021 - ? 0.031 per SMS messageStandard option:? 0.027 - ? 0.12 per SMS messagePremium (UK only) option:? 0.037 - ? 0.12 per SMS messagePremium (global) option:? 0.0558 - ? 0.15 per SMS message(Details)?Economy option:You need to buy at least 1000 SMS messages.Standard option, Premium (UK only) option, and Premium (global) option:You need to buy at least 50 SMS messages.(Details)?It depends on the option you chosen.(Three options are available:prepay,?contract [rollover messages]?and?contract [expiring messages])(Details)?(Details)HTTP / HTTPS, email to SMS, SMPP / SMPP (SSL)(Details)XML / SOAP(Details)Available without account registration.(Details for HTTP / HTTPS, email to SMS, SMPP / SMPP (SSL))(Details for XML / SOAP)?Setup fee: ?1500Monthly fee: ?50(Details)Free of charge for all account holders (10 keywords)(Details 1,?Details 2)Setup fee: ?1000PCM hosting charge for initial virtual mobile number: ?125Additional charge per extra virtual mobile number, PCM: ?110 - ?70(Details)??Available for the UKSetup charge: ?950 - ?850Monthly access charge: ?800(Details)8 Jun 2008, SMTP, SMPP and XML(Details)????????22 Jan 2010(Details)"BulkSMS International" regional site:€0.036 - €0.047 per credit(Details)Sending one SMS message requires 0.58 - 7.08 credits. (i.e. €0.02088 - €0.33276)(Details)Tagline discount: 15%(15% off the cost of an SMS message for users who select the option of appending their SMS messages with the tagline "".)(Details 1.?Details 2)"BulkSMS UK" regional site:?0.039 - ?0.05 per credit(Details)Sending one SMS message requires 0.5 - 6.08 credits. (i.e. ?0.0195 - ?0.304)(Details)Tagline discount: 15%(Details)"BulkSMS South Africa" regional site:R0.25 - R0.42 per credit (VAT included)(Details)Sending one SMS message requires 1 - 5.95 credits. (i.e. R0.25 - R2.499, VAT included)(Details)Tagline discount: 25%(Details)"BulkSMS Espana" regional site:€0.067 - €0.095 per credit(Details)Sending one SMS message requires 0.3 - 3.7 credits. (i.e. €0.0201 - €0.3515)(Details)Tagline discount: 10%(Details)"BulkSMS USA" regional site:US$0.0455 - US$0.053 per credit(Details)Sending one SMS message requires 0.69 - 8.46 credits. (i.e. US$0.031395 - US$0.44838)(Details)"BulkSMS Deutschland" regional site:€0.064 - €0.11 per credit(Details)Sending one SMS message requires 0.33 - 4 credits. (i.e. €0.02112 - €0.44)(Details)Tagline discount: 10%(Details)None(Details)"BulkSMS International" regional site:You need to buy at least 200 credits (€9.4).(Details)"BulkSMS UK" regional site:You need to buy at least 300 credits (?15).(Details)"BulkSMS South Africa" regional site:You need to buy at least 200 credits (R84.36).(Details)"BulkSMS Espana" regional site:You need to buy at least 50 credits (€4.75).(Details)"BulkSMS USA" regional site:You need to buy at least 200 credits (US$10.6).(Details)"BulkSMS Deutschland" regional site:You need to buy at least 25 credits (€2.75).(Details)None(Details)No(Details)Credit / debit card, wire transfer / bank deposit, PayPal and MoneyBookers(Details)(Details)HTTP, FTP(Details)Email to SMS(Details)Available without account registration.(Details:?HTTP,?FTP?andemail to SMS)5 free credits upon account activation.(Details)?Included for routing groups "Standard" and "Premium".(Details)- 6 months at €12 per month- 1 year at €9 per month(Details)€0.012 per incoming SMS message may be charged should incoming volumes exceed outgoing volumes.(Details)??South Africa dedicated short code:Setup fee: 1710 South African Rands (VAT included)Administrative fee: 570 South African Rands per month (VAT included)(Vodacom requires a monthly minimum volume of 3000 SMS messages.)(Details)South Africa shared short code:1st to 5th keyword: 570 South African Rands per annum per keyword (i.e. 47.5 Rands per month per keyword) (VAT included)6th keyword and higher: 114 South African Rands per annum per keyword (i.e. 9.5 Rands per month per keyword) (VAT included)(Details 1.?Details 2)27 Sept 2010(Details)US$ 0.03 - US$ 0.05 per SMSmessageMaintenance fee: US$ 9.99 per month(Details)None(Details)None(Details)None(But there is a monthly maintenance fee of US$ 9.99.)(Details)N/A(Their SMS services are post-pay.)(Details)Credit cards and Net 30(Details)(Details)HTTP(Details)Available without account registration.(Details)You can request a free trial license key to test their SMS messaging service before you buy. To do so, you need to contact their sales team.(Details)?Included in every account.Normal SMS rate applies. (i.e. US$ 0.03 - US$ 0.05 per incoming SMS message.)(Details)Available for an additional fee of US$ 5 per month per number.Normal SMS rate applies. (i.e. US$ 0.03 - US$ 0.05 per incoming SMS message.)(Details)Not available(Details)Not available(Details)Not available(Details)1 Jun 2006(Details)Available for download without account registration.(Details)??????Available for Malaysia, the Philippines, Singapore and Thailand(Details)2 Jun 2006 need to contact their staff for the pricing information.(See "What are your per message prices?" in the?FAQ?web page.)Whether there are setup fees depends on your requirements. You need to contact their staff for the pricing information.(See "What will it cost me to set-up such a service?" in theFAQ?web page.)????(Details)XML, SOAP, SMTP, SMPPIt is possible to connect via VPN (IPSec) or SSL.(Details)Available for download without account registration.(Details)You can try their SMS messaging service before you buy. To do so, you need to contact their sales team.(For the details, see "Can I try your service before I buy?" in the?FAQ?web page.)A 2-way SMS messaging service called "One World One Number" is available. You have to contact their staff for the details.(Details)??Available for Germany, Ireland, Netherlands, Switzerland, the UK and the US.(Pricing information:?Germany,? HYPERLINK "" Ireland,Netherlands,?Switzerland,?UK,?US)(Other details)2 Jun 2006(Details)?0.0073 - ?0.01 per credit(Details)None(Details)None(Details)None(Details)Purchased credits will expire after 12 months.(Details)Visa card, PayPal, money transfer, money deposit and cheque(Details)(Details)HTTP, SMTP(Details)Available for download without account registration.(Details)?No SIM hosting service is provided. But you can host the SIM card by yourself or a third party and forward the SMS messages received to TM4B's platform to take advantage of its keyword management feature.(Details)Annual cost: ?99(Details)UK mobile numbers are available.One dedicated keyword with an unlimited number of sub-keywords:Annual cost: ?39Using sub-keywords under the shared "tm4b" keyword:Free of charge(Details 1,?details 2)UK mobile numbers are available.Annual cost: ?349(Details 1,?details 2)UK short codes are available.One dedicated keyword with an unlimited number of sub-keywords:Annual cost: ?149Using sub-keywords under the shared "tm4b" keyword:Free of charge(Details 1,?details 2)UK short codes are available.You need to contact their staff for the details.(Details 1,?details 2)?2 Jun 2006(Details)?0.05 - ?0.085 per SMS messageBuying 100000 SMS messages: the price is not available and you need to contact their staff.(Details)There is no setup fee if you do not use the dynamic from-ID/originator feature.Setup fee of the dynamic from-ID/originator feature: ?50.(Details)You need to buy at least 100 SMS messages.(Details)None(See "Is there a minimum monthly purchase required?" in the?FAQ?web page)Purchased credits will expire after 12 months. The expiry date can be extended.(Details)Credit / debit card, cheque and bank transfer(Details)Covers more than 500 mobile networks in more than 200 countries. You need to contact their staff for the details.(See "Can I send messages abroad?" in the?FAQ?web page)HTTP, email to SMS, CSV (Comma Separated Values) file upload via HTTP or email(Details)Available for download without account registration.(See "How can I send an SMS with the Kapow! Service?" in the?FAQ?web page)50 free SMS messages with your first order(Details)You can trial their SMS service before you buy SMS messages.(See "Am I able to trial the service before I buy some credits?" in the?FAQ?web page)?Setup fee: ?50Monthly fee: ?25(Details)Setup fee: ?500Monthly fee: ?50(Details)??UK dedicated short code:Setup fee: ?500Monthly fee: ?700UK shared short code:Setup fee: ?50Monthly fee: ?100(Details)2 Jun 2006 the "International Bulk (Excluding Europe)" plan:Credit-basedFor the "Bulk SMS Europe" plan:SMS-based(Details)For the "International Bulk (Excluding Europe)" plan:0.010 - 0.011 Euros per creditFor the "Bulk SMS Europe" plan:0.024 - 0.026 Euros per SMS message(Details)They provide other SMS packages that start from a price of 15 Euros. The pricing information is not available without login.(Details)?For the "International Bulk (Excluding Europe)" plan:You need to buy at least 200000 credits.For the "Bulk SMS Europe" plan:You need to buy at least 500000 SMS messages.(Details)??PayPal, , direct deposit(Details)(Details 1,?details 2)HTTP, SMPP(Details)??None. But they offer a free program that you can use to host a SIM card by yourself.(Details)Two-way SMS messaging services are available.(Details)Short codes are available but MySMSAddress does not state whether they provide SMS billing services.(Details)2 Jun 2006(Details)0.039 - 0.070 GBP (British Pound) per SMS message(Details)Additional internetworking fees are required to send an SMS message to some mobile network operators.(Details)To send SMS messages to the US, you need a dedicated short code. The service pricing is not available on the web site. You have to contact their staff for the details.(Details)None(Details)To send SMS messages to the US, you need a dedicated short code. A setup fee is required.(Details)You need to buy at least 2000 SMS messages.(Details)?Purchased SMS messages must be used within one month.(Details 1,?details 2)?(Details)HTTP / HTTPS, SMPP, XML / SOAP(Details)Available without account registration.(Details:?HTTP / HTTPS, SMPP,?XML / SOAP)?Setup fee: 1000 GBP (British Pound)Monthly hosting fee: 200 GBP(Details)Setup fee: 0 GBP (British Pound)Monthly fee: 150 GBP(Details)Setup fee: 1000 GBP (British Pound)Monthly fee for the service: 300 GBPMonthly fee for each virtual mobile number: 50 - 2 GBP(Details)For Ireland:Setup fee: 500 EurosMonthly fee for the service: 300 Euros(Details)??Available with some mobile network operators inAustralia,?Canada,?Ireland, the?UK?and the?USA(Overview)2 Jun 2006(Details)For the Default Routing profile:€ 0.0310 - € 0.0670 per SMS message(Details)Sending SMS messages to some mobile network operators requires additional internetworking fees. Details can be found at?here.For the Premium Routing profile (Italy):€ 0.0685 - € 0.1042 per SMS message(Details)None(Details)For both the Default Routing profile and?the Premium Routing profile (Italy):You need to buy at least 500 SMS messages.(Details)??Credit card(Details) (There are some credit card logos at the bottom of the web page.)(Details)HTTP, SMTP (email to SMS), ActiveX / COM, EMI / UCP(Details)Available for download without account registration.(Details)??Cost per keyword: 45 Euros per year(Details 1,?details 2)????2 Jun 2006(Details)For the SMS Basic option:€ 0.038 - € 0.067 per SMS messageFor the SMS Premium option:€ 0.12 - € 0.14 per SMS message(Details)None(Details)For the SMS Basic option:You need to buy at least 1000 SMS messages.For the SMS Premium option:You need to buy at least 2000 SMS messages(Details)??Credit card(Details)(Details)HTTP, XML(Details)Available only after login.(Details)3 SMS messages(Details)??????2 Jun 2006(Details)US$ 0.0055 - US$ 0.007 per credit(Sending one SMS message requires 8 - 30 credits.)(Details)None(Details)You need to buy at least 1000 credits.(Details)None(Details)?Credit card or wire transfer(Details)PayPal(See the paragraph under the heading "Immediate Crediting with Online Purchase" on thehome page)(Details)HTTP, email to SMS(Details)The HTTP interface's technical specification is available for download at?here.White papers and sample scripts are available for download after signing up. (See Q1 and Q8 in the? HYPERLINK "" FAQweb page.)3 SMS messages(See the paragraph under the heading "Free Trial" on thehome page)The "Pricing" web page states that:Setup fee: US$100Monthly hosting fee: US$100However, the "Info-on-Demand" web page states that:Setup fee: US$2000Monthly hosting fee: US$50Available. But the cost of service is not stated.(Details)???They do not state clearly in the web page whether they provide SMS billing services.(Details)19 Jan 2010$ 0.032 - US$ 0.16 per SMSmessage(Details)?????(Details)Email to SMS(Details)????????Free Software/Tools and Libraries for Sending and Receiving SMS Messages with a Computer / PCHyperlinks to some free software, tools and libraries for sending and receiving SMS messages with a computer / PC are listed below. Many of the software, tools and libraries shown below are not only free, but are open source.For Non-DevelopersMicrosoft SMS SenderMicrosoft SMS Sender is a piece of free Windows software that can be used to send SMS text messages from a computer via a GSM mobile phone. Localized versions are available in more than 20 languages, including Arabic, simplified Chinese, French, German, Italian, Russian and Spanish. One major limitation of Microsoft SMS Sender is that it cannot receive SMS messages from the cell phone. Besides, it does not support message formats other than ordinary SMS text messages. For example, concatenated SMS messages, flash SMS messages, MMS messages, ring tones and logos are not supported.For Both Developers and Non-DevelopersGnokiiGnokii is a free and open source command line tool that can be used to send and receive SMS messages through a mobile phone or GSM modem. It can also be used to read and write entries of the phone book and calendar, handle logos, load ring tones, etc. In addition, the Gnokii project contains a modem driver called gnokiid, which allows you to use some old Nokia mobile phones (for example, Nokia 5110 and Nokia 6110) that do not support AT commands as ordinary AT-compatible modems.Gnokii works fine with mobile phones that support AT commands. Gnokii supports a lot of mobile phone models from Nokia, even some of those that use Nokia's proprietary protocol instead of AT commands for communicating with a computer. A list of the mobile phones and GSM modems supported by Gnokii can be found on its web site.If you are not an SMS software developer, you may want to use XGnokii or Gnocky instead of the command-line program. XGnokii and Gnocky provide a good-looking and intuitive GUI, which is easier to use than the command-line program. XGnokii is included in the Gnokii package, while Gnocky can be downloaded separately from the Gnokii web site. Some screenshots of XGnokii and Gnocky can be found at?here.If you are an SMS software developer and would like to write a program to send and receive SMS messages via a mobile phone or GSM modem from a computer, you may find Gnokii useful. By making use of the functions of Gnokii, you do not need to learn how to program with AT commands in order to control the mobile phone or GSM modem. It is easy to write a script or program to drive the command-line Gnokii in the background. Another choice is to use libgnokii, the back-end library that provides basic functions to Gnokii.GammuLike Gnokii, Gammu is a free and open source command line tool that can be used to send and receive SMS messages from a computer via a mobile phone or GSM modem. Gammu was started based on Gnokii's experience but it evolves independently. Besides sending and receiving SMS messages, Gammu can be used to perform many different tasks such as reading and writing entries of the phone book and calendar, handling logos, loading ring tones, managing bookmarks, changing WAP settings, making data calls, etc.Gammu supports mobile phones that can work in AT command mode. Like Gnokii, Gammu supports lots of Nokia mobile phones, even some of those that use Nokia's proprietary protocol instead of AT commands for communicating with a computer. A list of the mobile phones and GSM modems supported can be found on Gammu's web site.If you are not an SMS software developer, you may want to use Wammu instead of the command-line Gammu. Wammu is a program developed with wxPython. It provides a good-looking and intuitive GUI, which is easier to use than Gammu. Some screenshots of Wammu can be found at?here.If you are an SMS software developer and want to write a program to send and receive SMS messages from a computer via a mobile phone or GSM modem, you may find Gammu useful. By making use of the functions of Gammu, you do not need to learn about AT commands in order to control the mobile phone or GSM modem. It is easy to write a script or program to drive the command-line Gammu in the background. Another choice is to use LibGammu, the back-end library that provides basic functions to Gammu.In addition, you can find two pieces of software, Python-Gammu and Gammu+, on Gammu's web site. Python-Gammu is a Python module that allows software developers to get access to Gammu's functions in Python scripts. Gammu+ is a C++ version of Gammu. Gammu+ and Gammu are released under different licenses.gsmlib?and? HYPERLINK "" xgsmlibgsmlib is an open source and free library that works under a variety of OSs such as Linux, FreeBSD and MS Windows. You can use it to send and receive SMS messages with a PC through a GSM mobile phone or GSM modem. You can also use it to read/write SMS messages and phone book entries from/to the SIM card or store of a mobile phone. Besides the library, some command line tools that give access to the functions of the library are available.gsmlib supports mobile phones that can work in AT mode. Most GSM phones can work in AT mode these days. A list of the mobile phones and GSM modems supported can be found on gsmlib's web site.If you are not an SMS software developer, you may want to use xgsmlib instead of the command-line tools of gsmlib. xgsmlib is a graphical user interface for gsmlib. It runs under GNOME. Sending and receiving SMS messages with xgsmlib is easier and more intuitive than with gsmlib's command line tools. Some screenshots of xgsmlib can be found at?here.If you are an SMS software developer and need to write a program to send and receive SMS messages from a computer via a mobile phone or GSM modem, you can directly link the gsmlib library to your program and call its functions. In this way, you do not need to learn how to program with AT commands in order to control the mobile phone or GSM modem. Another way is to write a script or program to drive gsmlib's command line programs in the background.For DevelopersKannelKannel is a famous, powerful, open source and free SMS gateway and WAP gateway. You can use it to connect to a mobile operator's SMS center (SMSC), or using a GSM mobile phone or GSM modem as a virtual SMS center. Kannel can handle multiple SMS centers and virtual SMS centers. You can specify the SMS center or virtual SMS center that an SMS message should be routed to. This feature is useful in situations such as when you have multiple SMS center/virtual SMS center connections and some of them are cheaper or faster to deliver SMS messages.Kannel supports the use of AT-capable mobile phones as virtual SMS centers. Most GSM mobile phones are capable to work with AT commands these days. A small list of mobile phones and GSM modems that are known to work as virtual SMS centers with Kannel is available on its web site.The SMSC access protocols supported by Kannel include SMPP, CIMD, UCP / EMI and SMS2000 / OIS. In addition, Kannel has an HTTP / HTTPS interface that you can use to send and receive SMS messages.As Kannel is a complex program with lots of functions, it may be hard to use for beginners.OpenSMPP APIOpenSMPP API is an open source and free Java API. It can be used to communicate with an SMS center (SMSC) or SMS gateway using the SMPP (Short Message Peer to Peer) protocol. SMS software developers can use this library to connect to an SMSC or SMS gateway and send/receive SMS messages. OpenSMPP API was formerly known as Logica SMPP API since it was originally developed by Logica (an SMSC vendor). Later Logica did not maintain the API any more, but you can still find their web site at??(note that the web site has not been updated for a long time). Now the?SMS Forum?develops and maintains the API. (The SMS Forum is a non-profit organization that controls the development of the SMPP protocol.)SMPP Client Test Tool (SCTT)?(After clicking on this link, you will see the SMS Forum Terms and Conditions. Accept it and you will see a form. In the "Select Item" combo box, choose one of the three "SMPP Client Test Tool" items, e.g. "SMPP Client Test Tool (Linux)".)SMPP Client Test Tool is a free SMSC simulator provided by the SMS Forum (a non-profit organization that is now responsible for the development of the SMPP protocol). You can use it to test an SMPP client (e.g. your SMS messaging application) without a real SMSC or SMS gateway. The SMPP Client Test Tool can be run on three platforms: Linux, Solaris and HP-UX.SMPPSimLike SCTT, SMPPSim is a free SMSC simulator. You can use it to test your SMPP application without a real SMSC or SMS gateway. SMPPSim has a web-based graphical user interface (screenshots 1,screenshots 2). As SMPPSim is written in Java, it can be run on Java-capable platforms such as Microsoft Windows and Linux.SMSLib (jSMSEngine)SMSLib is an open source and free library for Java and Microsoft .NET. SMSLib for Java was formerly called jSMSEngine. With SMSLib, you can easily write a Java or .NET program to send and receive SMS messages from a computer via a GSM mobile phone or GSM modem without learning AT commands. If you write your SMS software in Java, you can take advantage of Java's code portability feature -- your SMS software can be executed in many different operating systems such as Microsoft Windows, Linux, Solaris and Mac OS. SMSLib supports concatenated SMS messages and flash SMS messages, but it does not support ring tones and logos.SMSLib supports mobile phones that can work in AT mode. Most GSM mobile phones can work in AT mode these days.Developing SMS software with SMSLib for dotNet requires Microsoft .NET Framework 2.0 SDK. For SMSLib for Java, it is recommended to use J2SE SDK 5.0, since the author of SMSLib wrote and tested SMSLib with J2SE SDK 5.0.The SMSLib package contains a standalone SMS application called SMSServer. It uses SMSLib as its back-end library. You can use SMSServer to send/receive SMS messages without developing your own program. For example, you can prepare an XML file with the SMS messages you want to send, give the XML file to SMSServer and SMSServer will send the SMS messages out automatically.GSMI/GSMD::GnokiiGSMI/GSMD::Gnokii is a Perl module for Gnokii. Gnokii's readme file includes a brief description of it. Perl programmers can use this Perl module to get access to Gnokii's functions.Appendix: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)The following table lists all characters and their decimal and hexadecimal codes as defined in the "GSM 7-bit default alphabet" text coding scheme. The corresponding character codes defined in ISO 8859 Latin 1 are also provided in the table for ease of reference. The GSM 7-bit default alphabet consists of 128 characters totally and each character is represented by 7 bits. 10 extra characters are defined in the GSM 7-bit default alphabet extension table and they have to be represented through an escape mechanism using the escape character (0x1B). The 10 extra characters are:Form feedCaret / circumflexLeft curly bracketRight curly bracketBackslashLeft square bracketTildeRight square bracketVertical barEuro signThe codes of the 10 characters above begin with 0x1B (i.e. the escape character), which indicates they are escaped sequences. For example, the code of the Euro sign is 0x1B65.If the receiving entity (for example, a mobile phone) does not understand the escape mechanism, the escape character should be shown as the space character on the display device.CharacterGSM 7-bit default alphabet(Decimal)GSM 7-bit default alphabet(Hexadecimal)ISO 8859 Latin 1(Decimal)ISO 8859 Latin 1(Hexadecimal)@At sign0006440?Pound sign101163A3$Dollar sign2023624?Yuan/Yen sign303165A5èSmall letter e with grave accent404232E8éSmall letter e with acute accent505233E9ùSmall letter u with grave accent606249F9ìSmall letter i with grave accent707236ECòSmall letter o with grave accent808242F2?Capital letter C with cedilla909199C7Linefeed100A100A?Capital letter O with stroke110B216D8?Small letter o with stroke120C248F8Carriage return130D130D?Capital letter A with ring140E197C5?Small letter a with ring150F229E5ΔCapital letter Greek delta1610_Underscore1711955FΦCapital letter Greek phi1812ΓCapital letter Greek gamma1913ΛCapital letter Greek lambda2014ΩCapital letter Greek omega2115ΠCapital letter Greek pi2216ΨCapital letter Greek psi2317ΣCapital letter Greek sigma2418ΘCapital letter Greek theta2519ΞCapital letter Greek xi261AEscape271BForm feed27 101B0A120C^Caret / Circumflex27 201B14945E{Left curly bracket27 401B281237B}Right curly bracket27 411B291257D\Backslash27 471B2F925C[Left square bracket27 601B3C915B~Tilde27 611B3D1267E]Right square bracket27 621B3E935D|Vertical bar27 641B401247C€Euro sign27 1011B65?Capital letter AE281C198C6?Small letter ae291D230E6?Small letter German Eszett301E223DF?Capital letter E with acute accent311F201C9Space32203220!Exclamation mark33213321"Quotation mark34223422#Number sign35233523¤Currency sign3624164A4%Percent sign37253725&Ampersand38263826'Apostrophe39273927(Left parenthesis40284028)Right parenthesis41294129*Asterisk422A422A+Plus sign432B432B,Comma442C442C-Minus sign / Hyphen452D452D.Full stop / Period462E462E/Slash472F472F0Digit zero483048301Digit one493149312Digit two503250323Digit three513351334Digit four523452345Digit five533553356Digit six543654367Digit seven553755378Digit eight563856389Digit nine57395739:Colon583A583A;Semicolon593B593B<Less-than sign603C603C=Equals sign613D613D>Greater-than sign623E623E?Question mark633F633F?Inverted exclamation mark6440161A1ACapital letter A65416541BCapital letter B66426642CCapital letter C67436743DCapital letter D68446844ECapital letter E69456945FCapital letter F70467046GCapital letter G71477147HCapital letter H72487248ICapital letter I73497349JCapital letter J744A744AKCapital letter K754B754BLCapital letter L764C764CMCapital letter M774D774DNCapital letter N784E784EOCapital letter O794F794FPCapital letter P80508050QCapital letter Q81518151RCapital letter R82528252SCapital letter S83538353TCapital letter T84548454UCapital letter U85558555VCapital letter V86568656WCapital letter W87578757XCapital letter X88588858YCapital letter Y89598959ZCapital letter Z905A905A?Capital letter A with diaeresis915B196C4?Capital letter O with diaeresis925C214D6?Capital letter N with tilde935D209D1?Capital letter U with diaeresis945E220DC§Section sign955F167A7?Inverted question mark9660191BFaSmall letter a97619761bSmall letter b98629862cSmall letter c99639963dSmall letter d1006410064eSmall letter e1016510165fSmall letter f1026610266gSmall letter g1036710367hSmall letter h1046810468iSmall letter i1056910569jSmall letter j1066A1066AkSmall letter k1076B1076BlSmall letter l1086C1086CmSmall letter m1096D1096DnSmall letter n1106E1106EoSmall letter o1116F1116FpSmall letter p1127011270qSmall letter q1137111371rSmall letter r1147211472sSmall letter s1157311573tSmall letter t1167411674uSmall letter u1177511775vSmall letter v1187611876wSmall letter w1197711977xSmall letter x1207812078ySmall letter y1217912179zSmall letter z1227A1227A?Small letter a with diaeresis1237B228E4?Small letter o with diaeresis1247C246F6?Small letter n with tilde1257D241F1üSmall letter u with diaeresis1267E252FCàSmall letter a with grave accent1277F224E0 ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download