Académique Documents
Professionnel Documents
Culture Documents
7 6 5 3,4
Reply path, not used in text mode User Data Header Information Set this bit to request a delivery report Validity Period, set b4=1 if a VP value is present Reject Duplicates, do not return a message ID when a message with the same destination and ID is still pending Message Type Indicatorb1=0 & b0=0 -> SMS-DELIVERb1=0 & b0=1 -> SMS-SUBMIT
Bit 0 of the message is always set when sending messages (SMS-SUBMIT). So the first value should be 1 or higher. The second parameter sets the Validity Period of the message. This value is encoded as follows: 0 - 143 144 - 167 168 - 196 197 - 255 (VP + 1) x 5 minutes 12 Hours + ((VP-143) x 30 minutes) (VP-166) x 1 day (VP-192) x 1 week
The third parameter contains the PID (Protocol Identifier). This parameter is only used for advanced messaging. The fourth parameter contains the DCS (Data Coding Scheme). This parameter is used to select the characterset/messagetype. When setting the DCS parameter to '0' standard 7 bit text is send. When setting this parameter to '16' the message is sent as a flash message. To send a message with a validity period of 1 day, the parameters have to be set like this: Bit 0 and 4 of the first field has to be set, so the first value will become 1 + 16 = 17. Send the following command to the modem to set this parameters: AT+CSMP=17,167,0,16 <ENTER> If the modem responds with "OK" ,the modem is ready to send (flash) text messages with a validity period of 1 day. Sending the message To send the SMS message, type the following command: AT+CMGS="+31638740161" <ENTER> Replace the above phone number with your own cell phone number. The modem will respond with: >
You can now type the message text and send the message using the <CTRL>-<Z> key combination: Hello World ! <CTRL-Z> After some seconds the modem will respond with the message ID of the message, indicating that the message was sent correctly: +CMGS: 62 The message will arrive on the mobile phone shortly. Sending an Unicode SMS message Some modems also have the capability to send Unicode or UCS2 messages without encoding a PDU. You can send Unicode messages by only converting the Unicode data to a HEX string and send this string to the modem. To check whether your modem supports this mode, just type the following command: AT+CSCS=? This commands displays the codepages supported by the modem. The modem will respond like this: +CSCS: ("GSM","PCCP437","CUSTOM","HEX") If this string contains "HEX" or "UCS2", Unicode seems to be supported. To specify that you will use an HEX string to send the message, set the codepage to "HEX" or "UCS2" depending on the modem response. In our example we will set the modem to "HEX" : AT+CSCS="HEX" <ENTER> Next, we have to specify the correct DCS (Data Coding Scheme) for Unicode messages, which is 0x08. We can set this value by changing the fourth parameter of the AT+CSMP command to '8': AT+CSMP=1,167,0,8 <ENTER> The modem is now ready to send messages as Unicode. Now is the time to send the actual message: AT+CMGS="+31638740161" <ENTER> Replace the above phone number with your own cell phone number. The modem will respond with: >
The only thing you have to program by yourself, is a simple routine which converts the Unicode string to an hexidecimal string like this: Which is 'Hello' in arabic will be converted like this: "06450631062D06280627" You can send this hexidecimal string to the modem: 06450631062D06280627 <CTRL-Z> After some seconds the modem will respond with the message ID of the message, indicating that the message was sent correctly: +CMGS: 63 The message will arrive on the mobile phone shortly.
A GSM phone or modem receives messages automatically. Basically you are just retrieving the messages from the memory of the device or SIM card. To select the message storage used to read the messages from, you have to use the "AT+CPMS" command. You can select one of the following message storages, not all storages are supported on every device. Storage ID Description SM Read SMS messages from the SIM card. This storage is supported on every GSM phone, because a SIM card should always be present. Usually a SIM card can store up to 15 messages. Read SMS messages from the modem or mobile phone memory. The number of messages that can be stored here depends on the size of the phones memory. Read SMS messages from all storages on the mobile phone. For instance when the phone supports "ME" and "SM", the "MT" memory combines the "ME" and "SM" memories as if it was a single storage. This storage is only used to read stored incoming cell broadcast messages. It is normally not used to store SMS messages. When you enable status reports when sending SMS messages, the status reports that are received are stored in this memory. These reports can read the same way as SMS messages.
ME
MT
BM
SR
To find out which storages are supported by your mobile phone, use the command line below: AT+CPMS=? The modem will respond with a list of supported storages, for instance: +CPMS: (("SM","BM","SR"),("SM")) The storage can be selected using the following command: AT+CPMS=<read>[,<send>,<receive>] <ENTER> The first parameter sets the storage to read from the second optional specifies the storage to send messages from and the last optional parameter tells the device where to store newly received messages. For example, to read messages from the SIM card use: AT+CPMS="SM" <ENTER> The modem should respond with the following string:
+CPMS: <used_space>,<max_space> <ENTER> The used_space indicates the number of messages currently in this memory, the max_space the number of messages that can be stored. Listing the messages Once you have successfully set the messages storage, you can list the messages available using the list command: AT+CMGL="ALL" <ENTER> Please not that "ALL" has to be send in uppercase on some modems. The modem will respond with a list of decoded SMS messages: +CMGL: 1,"REC UNREAD","+31625012354",,"07/07/05,09:55:16+08" Test message 1 +CMGL: 2,"REC UNREAD","+31625012354",,"07/07/05,09:56:03+08" Test message 2 OK The response messages are formatted like this: +CMGL: <index>,<status>,<from_address>,<mr>,<scts><CRLF><data> index status from_address mr scts data The memory index number, use this index to read or delete this message.
The status of this message. For received messages this can be "REC READ" or "REC UNREAD" on whether the messages has been read or listed before. The subscriber number of the person who sent the message. The reference number of this message. Most modems keep this field empty. The time the message was forwarded to this phone or modem. The actual message data in plain text
Reading a message To list a single message, you have to use the read command. You must use the list command first, so you know the indexes of the messages in the storage. For instance, to read the message on memory location '2' use: AT+CMGR=2 <ENTER>
The modem will list the single message: +CMGR: "REC READ","+31625012254",,"07/07/05,09:56:03+08" Test message 2 OK Please note that the status of the message is now "REC_READ" instead of "REC_UNREAD" because we read the message. Deleting a message Once you have read a message, you can free the memory by deleting the message from the storage. For instance, to delete the message on memory location '2' use: AT+CMGD=2 <ENTER> The modem will delete the single message.
When the error starts with "+CME ERROR", it means that the error is a device specific error code. For instance, you are trying to read a phonebook entry before entering a pincode. When there is a network error, for instance, when you try to send an SMS message when there is no network coverage, you will receive an error which starts with "+CMS ERROR". To enable these extended commands, execute the following commands, or add them to your modems init string: AT+CMEE=1 AT&W Below you can find a list containing almost every error code supported by GSM devices. We try to keep this list up to date, so please send your comments to webmaster@smssolutions.net or post them in our forum.
CME ERROR's (GSM Equipment related codes)
Error CME ERROR: 0 CME ERROR: 1 CME ERROR: 2 CME ERROR: 3 CME ERROR: 4 CME ERROR: 5 CME ERROR: 6 CME ERROR: 7 CME ERROR: 10 CME ERROR: 11 CME ERROR: 12 CME ERROR: 13 CME ERROR: 14 CME ERROR: 15 CME ERROR: 16 CME ERROR: 17 CME ERROR: 18 CME ERROR: 20 Description Phone failure No connection to phone Phone adapter link reserved Operation not allowed Operation not supported PH_SIM PIN required PH_FSIM PIN required PH_FSIM PUK required SIM not inserted SIM PIN required SIM PUK required SIM failure SIM busy SIM wrong Incorrect password SIM PIN2 required SIM PUK2 required Memory full
Error CME ERROR: 21 CME ERROR: 22 CME ERROR: 23 CME ERROR: 24 CME ERROR: 25 CME ERROR: 26 CME ERROR: 27 CME ERROR: 30 CME ERROR: 31 CME ERROR: 32 CME ERROR: 40 CME ERROR: 41 CME ERROR: 42 CME ERROR: 43 CME ERROR: 44 CME ERROR: 45 CME ERROR: 46 CME ERROR: 47 CME ERROR: 48
Description Invalid index Not found Memory failure Text string too long Invalid characters in text string Dial string too long Invalid characters in dial string No network service Network timeout Network not allowed, emergency calls only Network personalization PIN required Network personalization PUK required Network subset personalization PIN required Network subset personalization PUK required Service provider personalization PIN required Service provider personalization PUK required Corporate personalization PIN required Corporate personalization PUK required PH-SIM PUK required
CME ERROR: 100 Unknown error CME ERROR: 103 Illegal MS CME ERROR: 106 Illegal ME CME ERROR: 107 GPRS services not allowed CME ERROR: 111 PLMN not allowed CME ERROR: 112 Location area not allowed CME ERROR: 113 Roaming not allowed in this location area CME ERROR: 126 Operation temporary not allowed CME ERROR: 132 Service operation not supported CME ERROR: 133 Requested service option not subscribed CME ERROR: 134 Service option temporary out of order
10
Error
Description
CME ERROR: 148 Unspecified GPRS error CME ERROR: 149 PDP authentication failure CME ERROR: 150 Invalid mobile class CME ERROR: 256 Operation temporarily not allowed CME ERROR: 257 Call barred CME ERROR: 258 Phone is busy CME ERROR: 259 User abort CME ERROR: 260 Invalid dial string CME ERROR: 261 SS not executed CME ERROR: 262 SIM Blocked CME ERROR: 263 Invalid block CME ERROR: 772 SIM powered down
CMS ERROR's (GSM Network related codes) Error CMS ERROR: 1 CMS ERROR: 8 CMS ERROR: 10 CMS ERROR: 21 CMS ERROR: 27 CMS ERROR: 28 CMS ERROR: 29 CMS ERROR: 30 CMS ERROR: 38 CMS ERROR: 41 CMS ERROR: 42 CMS ERROR: 47 CMS ERROR: 50 CMS ERROR: 69 Description Unassigned number Operator determined barring Call bared Short message transfer rejected Destination out of service Unindentified subscriber Facility rejected Unknown subscriber Network out of order Temporary failure Congestion Recources unavailable Requested facility not subscribed Requested facility not implemented
11
Error
Description
CMS ERROR: 81 CMS ERROR: 95 CMS ERROR: 96 CMS ERROR: 97 CMS ERROR: 98 CMS ERROR: 99
Invalid short message transfer reference value Invalid message unspecified Invalid mandatory information Message type non existent or not implemented Message not compatible with short message protocol Information element non-existent or not implemente
CMS ERROR: 111 Protocol error, unspecified CMS ERROR: 127 Internetworking , unspecified CMS ERROR: 128 Telematic internetworking not supported CMS ERROR: 129 Short message type 0 not supported CMS ERROR: 130 Cannot replace short message CMS ERROR: 143 Unspecified TP-PID error CMS ERROR: 144 Data code scheme not supported CMS ERROR: 145 Message class not supported CMS ERROR: 159 Unspecified TP-DCS error CMS ERROR: 160 Command cannot be actioned CMS ERROR: 161 Command unsupported CMS ERROR: 175 Unspecified TP-Command error CMS ERROR: 176 TPDU not supported CMS ERROR: 192 SC busy CMS ERROR: 193 No SC subscription CMS ERROR: 194 SC System failure CMS ERROR: 195 Invalid SME address CMS ERROR: 196 Destination SME barred CMS ERROR: 197 SM Rejected-Duplicate SM CMS ERROR: 198 TP-VPF not supported CMS ERROR: 199 TP-VP not supported CMS ERROR: 208 D0 SIM SMS Storage full CMS ERROR: 209 No SMS Storage capability in SIM
12
Error
Description
CMS ERROR: 210 Error in MS CMS ERROR: 211 Memory capacity exceeded CMS ERROR: 212 Sim application toolkit busy CMS ERROR: 213 SIM data download error CMS ERROR: 255 Unspecified error cause CMS ERROR: 300 ME Failure CMS ERROR: 301 SMS service of ME reserved CMS ERROR: 302 Operation not allowed CMS ERROR: 303 Operation not supported CMS ERROR: 304 Invalid PDU mode parameter CMS ERROR: 305 Invalid Text mode parameter CMS ERROR: 310 SIM not inserted CMS ERROR: 311 SIM PIN required CMS ERROR: 312 PH-SIM PIN required CMS ERROR: 313 SIM failure CMS ERROR: 314 SIM busy CMS ERROR: 315 SIM wrong CMS ERROR: 316 SIM PUK required CMS ERROR: 317 SIM PIN2 required CMS ERROR: 318 SIM PUK2 required CMS ERROR: 320 Memory failure CMS ERROR: 321 Invalid memory index CMS ERROR: 322 Memory full CMS ERROR: 330 SMSC address unknown CMS ERROR: 331 No network service CMS ERROR: 332 Network timeout CMS ERROR: 340 No +CNMA expected CMS ERROR: 500 Unknown error CMS ERROR: 512 User abort
13
Error
Description
CMS ERROR: 513 Unable to store CMS ERROR: 514 Invalid Status CMS ERROR: 515 Device busy or Invalid Character in string CMS ERROR: 516 Invalid length CMS ERROR: 517 Invalid character in PDU CMS ERROR: 518 Invalid parameter CMS ERROR: 519 Invalid length or character CMS ERROR: 520 Invalid character in text CMS ERROR: 521 Timer expired CMS ERROR: 522 Operation temporary not allowed CMS ERROR: 532 SIM not ready CMS ERROR: 534 Cell Broadcast error unknown CMS ERROR: 535 Protocol stack busy CMS ERROR: 538 Invalid parameter
14
What are DTMF tones ? There are companies which have a telephone system which can be controlled by DTMF tones (for instance: pager systems). To use these services you need to have a phone which is capable to send DTMF tones. DTMF stands for Dual Tone Multiple Frequency. When a key on the phone is pressed during a phone call this character is send using DTMF. The following characters can be send using DTMF: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,* and #. The DTMF keypad is laid out in a 4? matrix, with each row representing a low frequency, and 4 each column representing a high frequency (see table). Pressing a single key such as '1' will send a sinusoidal tone of the two frequencies 697 and 1209 hertz (Hz). The original keypads had levers inside, so each button activated two contacts. The multiple tones are the reason for
15
calling the system multifrequency. These tones are then decoded by the switching center to determine which key was pressed. 1209Hz 1 4 7 * 1336Hz 2 5 8 0 1477Hz 3 6 9 # 1633Hz A B C D
How to send DTMF tones Of course you can send DTMF phones using your fixed line phone or cellphone, but if you want to automate the sending of these tones over a phone connection, it becomes difficult because most modems can only send DTMF to dial a number, but when the connection is made, there is no way to send these tones. Some GSM modems do have this featuresuch as the WaveCom and the Multitech GSM modems. Sending DTMF tones using a GSM modem The following code sample demonstrates how to send a numeric text message to a pager using a GSM modem. The sample checks if there is a PIN code on the SIM card in the GSM modem and sets the code. If the code is correct, the modem will dial the number in voice mode, waits till the connection has been established and sends the DTMF code. Finally, the connection is terminated. The following AT Commands are used: ATDxxxxxxxxxxxxxxx; The ATD command is used to dial a number. The semi-colon at the end of this number indicates that this connection has to be setup as a voice call. When leaving this semi-colon, the connection is set up as a data call. AT+VTD=xx This command is optional, and is used to set the DTMF tone duration in 100mS steps. AT+VTS=x To send the actual DTMF code, you have to call this command for every digit sent. To send, for instance "*1234#", you have to send: AT+VTD=*;+VTD=1;+VTD=2;+VTD=3;+VTD=4;+VTD=# ATH0
16
17