Discussion:
$50 reward for solution to +CME ERROR: 515 when sending sms on gsm modem
Harish Tella
2010-05-04 04:28:53 UTC
Permalink
Hello, I will paypal $50 USD to whoever can help me solve this error. If
multiple people offer a partial solution that works I will split the reward
up equally. I'm in a hurry to solve this and greatly appreciate any help.

Kannel Version: 1.4.3
OS: Ubuntu Karmic Koala (9.10) , Linux 2.6.31-20
Processor: Intel Pent. 4, hyperthreading
Libxml version: unsure how to find this
I got libxml2, version: 2.7.5.dfsg-1ubuntu1.1

Modem:
Multi-Tech MultiModem MTCBA-G-F2 (Serial Connection)
manual:
http://www.multitech.com/en_US/DOCUMENTS/Collateral/manuals/S000304M.pdf
AT commands:
http://www.multitech.com/en_US/DOCUMENTS/Collateral/manuals/S000293J.pdf

Carrier:
AT&T pay as you go SIM, in the U.S.A.

My config files:
kannel.conf:
http://dl.dropbox.com/u/426534/kannel.conf.txt
modems.conf:
http://dl.dropbox.com/u/426534/modems.conf.txt

Text from smsc.log that contains the error:
http://dl.dropbox.com/u/426534/kannel_error.txt

My problem: sometimes my modem fails to send an outgoing message with the
following error.

:--> AT+CMGS=52^M
: <--
: <-- +CME ERROR: 515
: Generic error: +CME ERROR: 515
: send command status: -1

my modem's manual says CME ERROR: 515 means: Please wait, init or command
processing in progress.

The first half of the log linked above is the sequence of things when a
message gets received by the modem and the reply doesn't get sent properly.
The second half is the sequence when the reply goes out properly.

This problem happens randomly. Sometimes I can cause it happen by sending a
lot of texts to the modem in a short burst.

I am not sending the reply sms by returning it in the response when
sms-service calls my server's url. I just have the server return an empty
page. Instead I have the server calling kannel's sendsms url to send the
reply sms. I'm doing it this way because it was the only way I could put
newlines in the sms response. I'm not sure if this makes a difference here.

I thought the error was being caused because the AT+CMGS=52^M command was
sent too soon which is what was causing the error. So I set "need-sleep =
true" and "sendline-sleep = 200" but it didn't help.

Not sure what direction to go from here. Any help is really appreciated.

Harish Tella
Nikos Balkanas
2010-05-04 11:50:46 UTC
Permalink
Hi,

I should wait for more experienced modem people, but I 'll give it a shot.

1) Please read latest User's guide about modem initialization and how to work +CMEE in your init string.
2) Googling for CMGS, I see that this should be the destination number string, i.e. "+8259123456", 129. The second part (129) is optional and indicates whether it is international or local numbering plan. Destination should be in double quotes. Now, 52 doesn't seem to me that it is a valid number.

It would seem improbable such a feature in kannel not to work correctly, but out of curiosity, is it the same the times that it works?

BR,
Nikos
----- Original Message -----
From: Harish Tella
To: ***@kannel.org
Sent: Tuesday, May 04, 2010 7:28 AM
Subject: $50 reward for solution to +CME ERROR: 515 when sending sms on gsm modem


Hello, I will paypal $50 USD to whoever can help me solve this error. If multiple people offer a partial solution that works I will split the reward up equally. I'm in a hurry to solve this and greatly appreciate any help.

Kannel Version: 1.4.3
OS: Ubuntu Karmic Koala (9.10) , Linux 2.6.31-20
Processor: Intel Pent. 4, hyperthreading
Libxml version: unsure how to find this
I got libxml2, version: 2.7.5.dfsg-1ubuntu1.1

Modem:
Multi-Tech MultiModem MTCBA-G-F2 (Serial Connection)
manual:
http://www.multitech.com/en_US/DOCUMENTS/Collateral/manuals/S000304M.pdf
AT commands:
http://www.multitech.com/en_US/DOCUMENTS/Collateral/manuals/S000293J.pdf

Carrier:
AT&T pay as you go SIM, in the U.S.A.

My config files:
kannel.conf:
http://dl.dropbox.com/u/426534/kannel.conf.txt
modems.conf:
http://dl.dropbox.com/u/426534/modems.conf.txt

Text from smsc.log that contains the error:
http://dl.dropbox.com/u/426534/kannel_error.txt

My problem: sometimes my modem fails to send an outgoing message with the following error.

:--> AT+CMGS=52^M
: <--
: <-- +CME ERROR: 515
: Generic error: +CME ERROR: 515
: send command status: -1

my modem's manual says CME ERROR: 515 means: Please wait, init or command processing in progress.

The first half of the log linked above is the sequence of things when a message gets received by the modem and the reply doesn't get sent properly.
The second half is the sequence when the reply goes out properly.

This problem happens randomly. Sometimes I can cause it happen by sending a lot of texts to the modem in a short burst.

I am not sending the reply sms by returning it in the response when sms-service calls my server's url. I just have the server return an empty page. Instead I have the server calling kannel's sendsms url to send the reply sms. I'm doing it this way because it was the only way I could put newlines in the sms response. I'm not sure if this makes a difference here.

I thought the error was being caused because the AT+CMGS=52^M command was sent too soon which is what was causing the error. So I set "need-sleep = true" and "sendline-sleep = 200" but it didn't help.

Not sure what direction to go from here. Any help is really appreciated.

Harish Tella
Alvaro Cornejo
2010-05-04 13:55:56 UTC
Permalink
For me it seems a problem with your modem due to the modem itself or
with the network.

As posted in a previous mail:

AT+CMGS=XYZ //Tells modem you
want to send message of XYZ octets (excluding the two initial zeros)
0011000B.... what ever the PDU is // full message pdu
<ctrl-z> // end
of PDU => process the message.

ie the sequence is:

2010-04-28 12:53:00 [2611] [6] DEBUG: AT2[gw]: --> AT+CMGS=22^M
2010-04-28 12:53:00 [2611] [6] DEBUG: AT2[gw]: <-- >
2010-04-28 12:53:00 [2611] [6] DEBUG: AT2[gw]: send command status: 1
2010-04-28 12:53:00 [2611] [6] DEBUG: AT2[gw]: -->
0011000881627713150000A70BC8329BFD06DDDF723619
2010-04-28 12:53:00 [2611] [6] DEBUG: AT2[gw]: --> ^Z
2010-04-28 12:53:03 [2611] [6] DEBUG: AT2[gw]: <-- >


When kannel send the CMGS=22 to modem it tells it to be ready to
receive a message for transmition of 22octets in lenght. then waits
for the answer from modem to send the message (send command status: 1)
and then sends the PDU.

In your case, your modems tells kannel it is bussy and can not receive
the new message and retry later. (your error 515).

This could means several thinks that might be happen inside the modem,
and thus kannel can't do anything about it:

- The modem is re-initializing due to a problem in it. Check its
firmware and if available/posible, upgrade it.
- The modem is processing a previous message and can't receive another one
- There is a problem with the networks that is delaying the message
transmission.
- Network is bussy and the modem has its buffer full, so it can't
receive more messages

I'll test with another modem/gsm phone to see if there is a difference.

Also note that networks normally get klugged from time to time and it
is normal to have such error sporadically.

Hope helps

Alvaro



|-----------------------------------------------------------------------------------------------------------------|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y Nextel
en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias via
SMS y GPRS online
Visitenos en www.perusms.NET www.smsglobal.com.mx y
www.pravcom.com
Post by Nikos Balkanas
Hi,
I should wait for more experienced modem people, but I 'll give it a shot.
1) Please read latest User's guide about modem initialization and how to
work +CMEE in your init string.
2) Googling for CMGS, I see that this should be the destination number
string, i.e. "+8259123456", 129. The second part (129) is optional and
indicates whether it is international or local numbering plan.
Destination should be in double quotes. Now, 52 doesn't seem to me that  it
is a valid number.
It would seem improbable such a feature in kannel not to work correctly, but
out of curiosity, is it the same the times that it works?
BR,
Nikos
----- Original Message -----
From: Harish Tella
Sent: Tuesday, May 04, 2010 7:28 AM
Subject: $50 reward for solution to +CME ERROR: 515 when sending sms on gsm modem
Hello, I will paypal $50 USD to whoever can help me solve this error. If
multiple people offer a partial solution that works I will split the reward
up equally. I'm in a hurry to solve this and greatly appreciate any help.
Kannel Version: 1.4.3
OS: Ubuntu Karmic Koala (9.10) , Linux 2.6.31-20
Processor: Intel Pent. 4, hyperthreading
Libxml version: unsure how to find this
I got libxml2, version:  2.7.5.dfsg-1ubuntu1.1
Multi-Tech MultiModem MTCBA-G-F2 (Serial Connection)
http://www.multitech.com/en_US/DOCUMENTS/Collateral/manuals/S000304M.pdf
http://www.multitech.com/en_US/DOCUMENTS/Collateral/manuals/S000293J.pdf
AT&T pay as you go SIM, in the U.S.A.
http://dl.dropbox.com/u/426534/kannel.conf.txt
http://dl.dropbox.com/u/426534/modems.conf.txt
http://dl.dropbox.com/u/426534/kannel_error.txt
My problem: sometimes my modem fails to send an outgoing message with the following error.
:--> AT+CMGS=52^M
: <--
: <-- +CME ERROR: 515
: Generic error: +CME ERROR: 515
: send command status: -1
my modem's manual says CME ERROR: 515 means: Please wait, init or command
processing in progress.
The first half of the log linked above is the sequence of things when a
message gets received by the modem and the reply doesn't get sent properly.
The second half is the sequence when the reply goes out properly.
This problem happens randomly. Sometimes I can cause it happen by sending a
lot of texts to the modem in a short burst.
I am not sending the reply sms by returning it in the response when
sms-service calls my server's url. I just have the server return an empty
page. Instead I have the server calling kannel's sendsms url to send the
reply sms. I'm doing it this way because it was the only way I could put
newlines in the sms response. I'm not sure if this makes a difference here.
I thought the error was being caused because the AT+CMGS=52^M command was
sent too soon which is what was causing the error. So I set "need-sleep =
true" and "sendline-sleep = 200" but it didn't help.
Not sure what direction to go from here. Any help is really appreciated.
Harish Tella
Harish Tella
2010-05-09 20:59:08 UTC
Permalink
I think I've found a workable solution to this problem.

I simply set my init-string to:

init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1

instead of

init-string = AT+CNMI=2,1,0,0,0;+CPMS="SM","SM","SM";+CMEE=1

Basically the +CPMS sets the modems to use its own flash memory instead of the
sim card memory.

I still sometimes get the CME 515 error when trying to send a message, but
somehow using the modem's flash memory the modem remembers the failed message
and tries to send it again.

Sometimes messages get left over in the memory (same was happening when using
sim as the storage) , so I turned on sim-buffering to
try and clean those up. It does this but sometimes ends up reading a message
twice but I can live with that. It also sometimes results in my modem generating
a lot of errors.

2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: --> AT+CPMS?^M
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: <-- +CME ERROR: 515
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Generic error: +CME
ERROR: 515
2010-05-09 10:47:41 [3083] [6] DEBUG: failed to send mem select command to
modem -1
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: memory check error
2010-05-09 10:47:41 [3083] [6] INFO: AT2[/dev/ttyS0]: Closing device
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Couldn't connect(retrying
in 10 seconds).
2010-05-09 10:47:51 [3083] [6] INFO: AT2[/dev/ttyS0]: opening device

But I have the max-error-count = 1 and a restart usually takes
care of that.

I dont want memory to get filled up, anyone know of a way to clean memory
without having to use the sim buffering setting?

I am getting rid of the config files linked in my original post and will paste
them here for anyone looking in the future.

Lastly I'll be donating the $50 to the kannel project once I get paid. Thanks
for the help.

kannel.conf:
--------------------

group = core
admin-port = 13000
smsbox-port = 13001
admin-password = ********
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
access-log = "/var/log/kannel/bearerbox.access"
sms-resend-freq = 10

group = smsc
smsc = at
modemtype = wavecom
device =/dev/ttyS0
my-number = ********
sim-buffering = true
max-error-count = 1
log-level = 0
log-file = "/var/log/kannel/smsc.log"

group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender = ********
log-level = 0
log-file = "/var/log/kannel/smsbox.log"

group = sendsms-user
username = foo
password = bar

----------------
modems.conf
-------------------------

group = modems
id = wavecom
name = Wavecom
detect-string = "WAVECOM"
init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1
message-storage = "ME"
need-sleep = true
sendline-sleep = 300
reset-string = "AT+CFUN=1"
speed = 9600
Nikos Balkanas
2010-05-09 21:57:38 UTC
Permalink
Hi,

You can use a variant of the CMGD command. For a full description check
http://www.developershome.com/sms/cmgdCommand.asp

BR,
Nikos
----- Original Message -----
From: "Harish Tella" <***@gmail.com>
To: <***@kannel.org>
Sent: Sunday, May 09, 2010 11:59 PM
Subject: Re: $50 reward for solution to +CME ERROR: 515 when sending sms on
gsm modem
Post by Harish Tella
I think I've found a workable solution to this problem.
init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1
instead of
init-string = AT+CNMI=2,1,0,0,0;+CPMS="SM","SM","SM";+CMEE=1
Basically the +CPMS sets the modems to use its own flash memory instead of the
sim card memory.
I still sometimes get the CME 515 error when trying to send a message, but
somehow using the modem's flash memory the modem remembers the failed message
and tries to send it again.
Sometimes messages get left over in the memory (same was happening when using
sim as the storage) , so I turned on sim-buffering to
try and clean those up. It does this but sometimes ends up reading a message
twice but I can live with that. It also sometimes results in my modem generating
a lot of errors.
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: --> AT+CPMS?^M
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: <-- +CME ERROR: 515
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Generic error: +CME
ERROR: 515
2010-05-09 10:47:41 [3083] [6] DEBUG: failed to send mem select command to
modem -1
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: memory check error
2010-05-09 10:47:41 [3083] [6] INFO: AT2[/dev/ttyS0]: Closing device
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Couldn't connect(retrying
in 10 seconds).
2010-05-09 10:47:51 [3083] [6] INFO: AT2[/dev/ttyS0]: opening device
But I have the max-error-count = 1 and a restart usually takes
care of that.
I dont want memory to get filled up, anyone know of a way to clean memory
without having to use the sim buffering setting?
I am getting rid of the config files linked in my original post and will paste
them here for anyone looking in the future.
Lastly I'll be donating the $50 to the kannel project once I get paid. Thanks
for the help.
--------------------
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = ********
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
access-log = "/var/log/kannel/bearerbox.access"
sms-resend-freq = 10
group = smsc
smsc = at
modemtype = wavecom
device =/dev/ttyS0
my-number = ********
sim-buffering = true
max-error-count = 1
log-level = 0
log-file = "/var/log/kannel/smsc.log"
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender = ********
log-level = 0
log-file = "/var/log/kannel/smsbox.log"
group = sendsms-user
username = foo
password = bar
----------------
modems.conf
-------------------------
group = modems
id = wavecom
name = Wavecom
detect-string = "WAVECOM"
init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1
message-storage = "ME"
need-sleep = true
sendline-sleep = 300
reset-string = "AT+CFUN=1"
speed = 9600
Harish Tella
2010-06-10 19:03:03 UTC
Permalink
I know this is old but I want to post this so others may benefit.

I followed Nikos's suggestion and found used

modem.conf:
keepalive-cmd = "AT+CMGD=1,2"

kannel.conf:
keepalive = 60

this seems to keep things running perfectly, and deletes any messages that
have been read each time the keepalive command is run. Don't have to keep
sim-buffering on now.
Post by Nikos Balkanas
Hi,
You can use a variant of the CMGD command. For a full description check
http://www.developershome.com/sms/cmgdCommand.asp
BR,
Nikos
Sent: Sunday, May 09, 2010 11:59 PM
Subject: Re: $50 reward for solution to +CME ERROR: 515 when sending sms on
gsm modem
I think I've found a workable solution to this problem.
Post by Harish Tella
init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1
instead of
init-string = AT+CNMI=2,1,0,0,0;+CPMS="SM","SM","SM";+CMEE=1
Basically the +CPMS sets the modems to use its own flash memory instead of the
sim card memory.
I still sometimes get the CME 515 error when trying to send a message, but
somehow using the modem's flash memory the modem remembers the failed message
and tries to send it again.
Sometimes messages get left over in the memory (same was happening when using
sim as the storage) , so I turned on sim-buffering to
try and clean those up. It does this but sometimes ends up reading a message
twice but I can live with that. It also sometimes results in my modem generating
a lot of errors.
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: --> AT+CPMS?^M
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: <-- +CME ERROR: 515
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Generic error: +CME
ERROR: 515
2010-05-09 10:47:41 [3083] [6] DEBUG: failed to send mem select command to
modem -1
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: memory check error
2010-05-09 10:47:41 [3083] [6] INFO: AT2[/dev/ttyS0]: Closing device
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Couldn't connect(retrying
in 10 seconds).
2010-05-09 10:47:51 [3083] [6] INFO: AT2[/dev/ttyS0]: opening device
But I have the max-error-count = 1 and a restart usually takes
care of that.
I dont want memory to get filled up, anyone know of a way to clean memory
without having to use the sim buffering setting?
I am getting rid of the config files linked in my original post and will paste
them here for anyone looking in the future.
Lastly I'll be donating the $50 to the kannel project once I get paid. Thanks
for the help.
--------------------
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = ********
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
access-log = "/var/log/kannel/bearerbox.access"
sms-resend-freq = 10
group = smsc
smsc = at
modemtype = wavecom
device =/dev/ttyS0
my-number = ********
sim-buffering = true
max-error-count = 1
log-level = 0
log-file = "/var/log/kannel/smsc.log"
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender = ********
log-level = 0
log-file = "/var/log/kannel/smsbox.log"
group = sendsms-user
username = foo
password = bar
----------------
modems.conf
-------------------------
group = modems
id = wavecom
name = Wavecom
detect-string = "WAVECOM"
init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1
message-storage = "ME"
need-sleep = true
sendline-sleep = 300
reset-string = "AT+CFUN=1"
speed = 9600
Alvaro Cornejo
2010-05-10 13:23:41 UTC
Permalink
sim-buffering is for MO retrival from the modem, ie, periodically,
kannel will query the modem to see if there is a MO stored in modem.
This is the "oposte" from CNMI that will tell the modem to pass the MO
to kannel.

Your original problem was with MT. CMGS was telling the modem to
receive an MT, and it was responding to that with a busy error, that
could come from the modem processing an MO...

Regards

Alvaro




|-----------------------------------------------------------------------------------------------------------------|
Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
celular y Nextel
en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias via
SMS y GPRS online
Visitenos en www.perusms.NET www.smsglobal.com.mx y
www.pravcom.com
Post by Harish Tella
I think I've found a workable solution to this problem.
init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1
instead of
init-string = AT+CNMI=2,1,0,0,0;+CPMS="SM","SM","SM";+CMEE=1
Basically the +CPMS sets the modems to use its own flash memory instead of the
sim card memory.
I still sometimes get the CME 515 error when trying to send a message, but
somehow using the modem's flash memory the modem remembers the failed message
and tries to send it again.
Sometimes messages get left over in the memory (same was happening when using
sim as the storage) , so I turned on sim-buffering to
try and clean those up. It does this but sometimes ends up reading a message
twice but I can live with that. It also sometimes results in my modem generating
a lot of errors.
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: --> AT+CPMS?^M
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: <-- +CME ERROR: 515
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Generic error: +CME
ERROR: 515
2010-05-09 10:47:41 [3083] [6] DEBUG: failed to send mem select command to
modem -1
2010-05-09 10:47:41 [3083] [6] DEBUG: AT2[/dev/ttyS0]: memory check error
2010-05-09 10:47:41 [3083] [6] INFO: AT2[/dev/ttyS0]: Closing device
2010-05-09 10:47:41 [3083] [6] ERROR: AT2[/dev/ttyS0]: Couldn't connect(retrying
in 10 seconds).
2010-05-09 10:47:51 [3083] [6] INFO: AT2[/dev/ttyS0]: opening device
But I have the max-error-count = 1 and a restart usually takes
care of that.
I dont want memory to get filled up, anyone know of a way to clean memory
without having to use the sim buffering setting?
I am getting rid of the config files linked in my original post and will paste
them here for anyone looking in the future.
Lastly I'll be donating the $50 to the kannel project once I get paid. Thanks
for the help.
--------------------
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = ********
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
access-log = "/var/log/kannel/bearerbox.access"
sms-resend-freq = 10
group = smsc
smsc = at
modemtype = wavecom
device =/dev/ttyS0
my-number = ********
sim-buffering = true
max-error-count = 1
log-level = 0
log-file = "/var/log/kannel/smsc.log"
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender = ********
log-level = 0
log-file = "/var/log/kannel/smsbox.log"
group = sendsms-user
username = foo
password = bar
----------------
modems.conf
-------------------------
group = modems
id = wavecom
name = Wavecom
detect-string = "WAVECOM"
init-string = AT+CNMI=2,1,0,0,0;+CPMS="ME","ME","ME";+CMEE=1
message-storage = "ME"
need-sleep = true
sendline-sleep = 300
reset-string = "AT+CFUN=1"
speed = 9600
Loading...