SMS using GSM Modems - Problem with AT+CMGS command, CMS ERROR

This guide gives you some information for a better understanding of how SMS sending works on GSM phones and GSM modems with Ozeki Message Server 6, and it gives you some hints on how to resolve problems you might encounter.

Checking the modem connection

We assume, that the GSM modem (or GSM phone) you use is attached to the serial port of the computer with a phone-to-pc data cable and you can communicate with it. (You can test modem communication with hyper terminal). If you are able to communicate with the modem using hyper terminal, you can probably receive SMS messages. If you are unable to receive SMS messages, it might be possible that you have a PIN code set on the SIM card. In this case put the SIM card into a standard phone and remove the PIN code protection.

How does SMS sending work, what can be the problem?

Ozeki Message Server 6 uses the AT+CMGS command to send SMS messages. This command sends a PDU encoded SMS message to the mobile network. If the mobile network accepts the message a callback reference id is returned. (This id is used in delivery reports.)

If everything goes well the communication looks returns an OK response with a callback reference id (Figure 1). Please note that the number 134 was returned by the GSM network as the callback reference ID after sending the SMS PDU.

2007.12.06. 17:40:05 - <- AT+CMGS=24
2007.12.06. 17:40:05 - <-
2007.12.06. 17:40:05 - <- >
2007.12.06. 17:40:05 - -> 0021000B916302450696F100000C25180C168BC16437AA3408
2007.12.06. 17:40:07 - <- 0021000B916302450696F100000C25180C168BC16437AA3408
2007.12.06. 17:40:07 - <- +CMGS: 134
2007.12.06. 17:40:07 - <-
2007.12.06. 17:40:07 - <- OK

Figure 1 - Normal operation

If something goes wrong you will see an error message instead of the positive acknowledgement (Figure 2).

2007.12.06. 17:40:09 - <- AT+CMGS=24
2007.12.06. 17:40:09 - <-
2007.12.06. 17:40:09 - <- >
2007.12.06. 17:40:09 - -> 0021000B916302450696F100000C25180C168BC16437AA3408
2007.12.06. 17:40:13 - <- 0021000B916302450696F100000C25180C168BC16437AA3408
2007.12.06. 17:40:13 - <- ERROR
2007.12.06. 17:40:13 - <-
2007.12.06. 17:40:13 - GSM Modem 1 : Send error: message transmission failed
(ERROR,pdu:24,0021000B916302450696F100000C25180C168BC16437AA3408) :

Figure 2 - Could not send message

How to resolve this SMS Sending problem

In order to resolve this issue, you must find out what can cause this problem. The following list contains the most common reasons with tips on how to solve them.

Common reason #1: Invalid SMSC setting

The Short Message Service Center (SMSC) address is often not configured properly in the software. Please note that the correct SMSC should be specified for your GSM network and the SMSC number must be entered in International format with a leading plus sign.

smsc settings
Figure 3 - SMSC settings

Common reason #2: Insufficient money on SIM Card

To test if this is the problem, put your SIM card into a regular GSM handset and send an SMS message. If you could send a message this is not the problem you are looking for.

Common reason #3: The SIM card has a PIN code

Please put the SIM into a regular GSM handset and make sure it does not require a PIN code when the phone is restarted. You should NOT have any PIN code protection configured on the SIM.

Common reason #4: No network coverage

You should check your antenna and the you can verify the signal strength and network registration by issuing the AT+CREG and the AT+CSQ commands in hyperterminal.

Common reason #5: The GSM modem froze

Please power off your GSM modem and power it back on. (Ozeki NG SMS Gateway performs a port open/port close procedure when it detects this error, because this procedure often resets the GSM modem.)

Common reason #6: The default SMSC on the SIM card is invalid

You can tell Ozeki Message Server 6 to include the SMSC in each PDU sent over the mobile network. To do this check the "Include SCA in PDU" checkbox on the modem configuration form (Figure 4):

make modifications on the modem configuration form
Figure 4 - Make modifications on the modem configuration form

Other reasons:

It might be possible that you did not receive a plain 'ERROR' response, but you have received a 'CMS+ERROR' response. In this case please read the following webpage to figure out what causes the error: CMS Error codes

More information