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

This guide gives you hints on how you can resolve problems with SMS sending. We assume that you are using a GSM modem for SMS messaging, the modem is attached to the serial port of the computer with a phone-to-pc data cable and SMS receiving works.

Problem description

Ozeki NG SMS Gateway 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 acknowledgment (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 - ERROR 1845: Message could not be sent. Reason:
ERROR 1818: Envelope could not be sent. 0021000B916302450696F100000C25180C168BC16437AA3408\r\nERROR\r\n

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 in the ozeki sms gateway
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 PIC 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 is frozen

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 GSM modem is too slow

Slow GSM modems can also cause this problem. Please read the following page for more information about this topic: How to send SMS using a slow GSM modem

Common reason #7: Your modem might not support PDU mode

Please check the logs and see what was the response to AT+CMGF=0. If the response was NOT an OK, then your modem cannot be used for sending SMS messages in PDU mode.

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