+CMS ERROR: 340

+CMS ERROR: 340 SearchSearch
Author Message
Raffi Krikorian
New member
Username: Rkrikorian

Post Number: 2
Registered: 06-2008
Posted on Wednesday, May 12, 2010 - 01:24 am:   

When sending messages, I often get +CMS ERROR: 340. Looks like this in the SMSOUT file:
2010-05-11 17:11:48,4BC66305.req,127.0.0.1,818288XXXX,Retry Pending - ERROR - Modem Response (2): +CMS ERROR: 340 -- COM4:,Sender=917776XXXX

This typically puts it in a pending retry state and it eventually goes out. Any idea how to get rid of this error? It slows down throughput.

I'm using a multitech CDMA modem (MTCBA-C-U-N2)

Thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 2095
Registered: 08-2008
Posted on Wednesday, May 12, 2010 - 04:26 pm:   

Hi Raffi,

That is a very odd one. But it is a CDMA modem, so something unusual may be happening.

In the "SMS Message Storage" settings, make sure not to select "Direct to Modem - Phase 2+". It is ok to use "Direct to Modem", but I would avoid "Phase 2+".

The "Phase 2+" bit causes NowSMS to acknowledge receipt of messages with the AT+CNMA command. But the "CMS ERROR: 340" refers to unexpected AT+CNMA commands.

I suspect the modem is getting confused by simultaneous sending and receiving. Hopefully avoiding the "Phase 2+" setting will resolve this.

--
Des
NowSMS Support
Raffi Krikorian
New member
Username: Rkrikorian

Post Number: 3
Registered: 06-2008
Posted on Wednesday, May 12, 2010 - 05:11 pm:   

It was on "Default" - I changed it to "Direct to Modem" but I'm still getting the same errors.

I queued up 10 messages to go out and recieved the error 5 times.

I'm running NowSMS v2010.02.09

Note that I wasn't recieving any messages during the test.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 2098
Registered: 08-2008
Posted on Wednesday, May 12, 2010 - 05:31 pm:   

Are you receiving inbound delivery receipts perhaps?

If you try the "Phase 2+" setting, does it make any difference? (If it doesn't make a difference, go back to the "Direct to Modem" setting before generating the debug file that I'm about to ask for.)

Can you enable the SMSDEBUG.LOG? I'd like to see what it shows happening during all of this activity.

--
Des
NowSMS Support
Raffi Krikorian
New member
Username: Rkrikorian

Post Number: 4
Registered: 06-2008
Posted on Wednesday, May 12, 2010 - 05:48 pm:   

I am not receiving inbound delivery receipts (and I'm not requesting it in my outboud SMS)

I tried it with "Phase +2" and it didn't make a difference.

I changed it back to "Direct to Modem" and queued 5 messages to go out. Attached is the SMSDEBUG.LOG file.

I also noticed that of the 5 messages I sent out, only 3 made it to the handset. Messages Testing40 and Testing43 never made it. The pattern is they were right before the error message.

application/octet-streamSMSDEBUG.LOG
SMSDEBUG.LOG (10.2 k)
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 2099
Registered: 08-2008
Posted on Wednesday, May 12, 2010 - 06:12 pm:   

Interesting. It appears that NowSMS is sending AT+CNMA commands to acknowledge the delivery receipts.

NowSMS should only do this if the "Phase 2+" setting is enabled. However, because of the quirky nature of the responses from that modem (due to it being a CDMA modem that supports some GSM modem commands), "Phase 2+" support is being enabled automatically, even though it should not be.

I am working with our engineering team to get a fix so that the AT+CNMA command is only sent if "Phase 2+" mode is enabled in the configuration.

--
Des
NowSMS Support
Raffi Krikorian
New member
Username: Rkrikorian

Post Number: 5
Registered: 06-2008
Posted on Wednesday, May 12, 2010 - 06:18 pm:   

That's great news Des. We do high volume traffic with these modems, so a fix would be greatly appreciated.
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 7908
Registered: 10-2002
Posted on Wednesday, May 12, 2010 - 10:38 pm:   

Hi Raffi,

An update that properly respects whether or not the "Phase 2+" option is enabled (off by default) has been posted at http://www.nowsms.com/download/nowsmsinterim.zip.

-bn
Raffi Krikorian
New member
Username: Rkrikorian

Post Number: 6
Registered: 06-2008
Posted on Thursday, May 13, 2010 - 01:40 am:   

I installed the update, but now I get a different error:

2010-05-12 17:39:06,4BC67A96.req,127.0.0.1,818288XXXX,Retry Pending - ERROR - Error waiting for response from modem (2) -- COM4:,Sender=917776XXXX

Attached is the smsdebug.log file. Note that "Testing" was a single MT that worked. Testing60 & Testing61 were queued to go out. Testing61 made it to the handset, but Testing60 never arrived.

application/octet-streamSMSDEBUG.LOG
SMSDEBUG.LOG (7.9 k)
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 2108
Registered: 08-2008
Posted on Thursday, May 13, 2010 - 02:30 pm:   

Hi Raffi,

Unfortunately, I think the modem is getting confused by simultaneous sending/receiving.

I don't think there is anything that we can do about this, except maybe add an option to reduce the timeout before deciding that there has been an error. We currently wait 2 minutes, which is excessive.

However, even if we do that, there still appear to be problems.

Let me explain what I see in the SMSDEBUG.LOG.

17:32:00:299 Message "testing" is sent.

17:32:06:002 delivery receipt for "testing" received

17:32:45:580 "Got it" reply received

17:35:08:221 "Got it" reply received (duplicate?)

17:37:03:142 "Testing60" is sent

17:37:05:080 Attempt to send "Testing61"

17:37:05:174 Delivery receipt received, does not match id for "Testing60" ... sequence number suggests that it is for "Testing61", but the modem has not acknowledged that "Testing61" was ever sent.

17:39:05:174 Timeout, modem did not acknowledge that "Testing61" was sent.

17:39:11:111 Second attempt to send "Testing61" is successful.

17:39:13:971 Delivery receipt for second "Testing61" send is received

17:40:15:142 "Got it" reply received


What this tells me is that if "Testing60" was never received, this is unexplainable, because the modem clearly indicated that the message was sent.

That said, we never received a delivery receipt for it.

My best guess is that we are attempting to send messages faster than the modem can handle.

I'd suggest we try adding a 3 second delay after each send attempt, possibly increasing it higher if problems persist.

To add this delay, edit SMSGW.INI, and under the [Modem - drivername] header, add DelayAfterSend=3000 (the delay period value is in milliseconds).

--
Des
NowSMS Support
Raffi Krikorian
New member
Username: Rkrikorian

Post Number: 7
Registered: 06-2008
Posted on Thursday, May 13, 2010 - 05:34 pm:   

The 3 second delay worked but now I'm having a problem with MOs not getting logged to SMSIN file and I see it getting picked up repeatedly in the SMSDEBUG log file (I only sent in 1 MO):

09:25:28:234 [2] ModemTest: COM4:
09:25:28:546 [2] ModemTest: OK
09:25:51:765 [2] ReceiveModemCommand: Processing +CMT: Message
09:25:51:765 [2] ReceiveModemCommand: +CMT:"8182887956","10/05/13,09 :25 :45",129,0,2,0,8
Incoming

09:25:51:765 [3] ThreadProcessInboundSMS: Processing 4BC68A52.in...
09:25:51:765 [3] ThreadProcessInboundSMS: Processing complete 4BC68A52.in...
09:26:58:406 [2] ReceiveModemCommand: Processing +CMT: Message
09:26:58:406 [2] ReceiveModemCommand: +CMT:"8182887956","10/05/13,09 :25 :45",129,0,2,0,8
Incoming

09:26:58:406 [3] ThreadProcessInboundSMS: Processing 4BC68A53.in...
09:26:58:406 [3] ThreadProcessInboundSMS: Processing complete 4BC68A53.in...
09:28:05:077 [2] ReceiveModemCommand: Processing +CMT: Message
09:28:05:077 [2] ReceiveModemCommand: +CMT:"8182887956","10/05/13,09 :25 :45",129,0,2,0,8
Incoming

09:28:05:077 [3] ThreadProcessInboundSMS: Processing 4BC68A54.in...
09:28:05:077 [3] ThreadProcessInboundSMS: Processing complete 4BC68A54.in...
09:28:30:218 [2] ModemTest: COM4:
09:28:30:531 [2] ModemTest: OK
09:31:32:343 [2] ModemTest: COM4:
09:31:32:656 [2] ModemTest: OK
09:33:12:249 [2] ReceiveModemCommand: Processing +CMT: Message
09:33:12:249 [2] ReceiveModemCommand: +CMT:"8182887956","10/05/13,09 :25 :45",129,0,2,0,8
Incoming

09:33:12:249 [3] ThreadProcessInboundSMS: Processing 4BC68A55.in...
09:33:12:249 [3] ThreadProcessInboundSMS: Processing complete 4BC68A55.in...
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 2119
Registered: 08-2008
Posted on Thursday, May 13, 2010 - 06:17 pm:   

Try changing the "SMS Message Storage" setting back to "Default".
Raffi Krikorian
New member
Username: Rkrikorian

Post Number: 8
Registered: 06-2008
Posted on Thursday, May 13, 2010 - 06:57 pm:   

OK. That fixed it.

I see repetitive error items in the SMSDEBUG.LOG file. It's continuously doing this:
10:55:48:125 [2] ModemReceiveMessages: AT+CPMS="SM"

10:55:48:125 [2] ModemReceiveMessages:
+CMS ERROR: 302

10:55:48:187 [2] ModemReceiveMessages: AT+CPMS="ME"

10:55:48:187 [2] ModemReceiveMessages:
+CMS ERROR: 302

10:55:50:250 [2] ModemReceiveMessages: AT+CPMS="SM"

10:55:50:250 [2] ModemReceiveMessages:
+CMS ERROR: 302

10:55:50:312 [2] ModemReceiveMessages: AT+CPMS="ME"

10:55:50:312 [2] ModemReceiveMessages:
+CMS ERROR: 302

10:55:52:375 [2] ModemReceiveMessages: AT+CPMS="SM"

10:55:52:375 [2] ModemReceiveMessages:
+CMS ERROR: 302

10:55:52:437 [2] ModemReceiveMessages: AT+CPMS="ME"

10:55:52:437 [2] ModemReceiveMessages:
+CMS ERROR: 302

10:55:56:437 [2] ModemReceiveMessages: AT+CPMS="SM"

10:55:56:437 [2] ModemReceiveMessages:
+CMS ERROR: 302

10:55:56:500 [2] ModemReceiveMessages: AT+CPMS="ME"

10:55:56:500 [2] ModemReceiveMessages:
+CMS ERROR: 302
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 7910
Registered: 10-2002
Posted on Thursday, May 13, 2010 - 10:10 pm:   

Hi Raffi,

That debug info is annoying, but it is not necessarily a problem.

Older versions of NowSMS would still send those commands, but not log any of the info in the debug log.

I've updated the previous link with an updated version that won't do this:

http://www.nowsms.com/download/nowsmsinterim.zip

Since this is the same link as before, you may need to clear your browser cache to get the fresh copy. The update should identify itself with a date of 2010.05.13.

-bn