Hi,

We are happy with the patch, any comments from others and otherwise can this
be added to the Kannel CVS?

Thanks to Marius for submitting the patch.

Rgds

-----Original Message-----
From: Marius Huysamen [mailto:[EMAIL PROTECTED] 
Sent: 06 March 2008 09:49 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Kannel AT smsc CNMA-OK patch

Hi Andries

Here is the patch against the CVS version of gateway/gw/smsc/smsc_at.c

Regards
Marius

--- Begin Message ---
Function at2_wait_modem_command in smsc_at.c exits prematurely if 
messages were received, and acknowledged with AT+CNMA, since the modem 
will respond to the CNMA with an OK.

This patch keeps a counter for every OK that should be ignored within 
the function's main loop.

I have been running Kannel versions 1.4.0 and 1.4.1 for more than a year 
with this change in place, and I haven't experienced a "random" modem 
reset since.



--- smsc_at.c.orig	2008-03-01 12:37:35.000000000 +0200
+++ smsc_at.c	2008-03-01 12:43:01.000000000 +0200
@@ -628,6 +628,7 @@
     Msg	*msg;
     int len;
     int cmgr_flag = 0;
+    int expect_extra_ok = 0;
 
     time(&end_time);
     if (timeout == 0)
@@ -650,8 +651,11 @@
                 goto end;
             }
             if (octstr_search(line, octstr_imm("OK"), 0) != -1) {
-                ret = 0;
-                goto end;
+		if(!expect_extra_ok) {
+                    ret = 0;
+                    goto end;
+		} else
+                    --expect_extra_ok;
             }
             if ((gt_flag ) && (octstr_search(line, octstr_imm(">"), 0) != -1)) {
                 ret = 1;
@@ -720,8 +724,10 @@
                         }
 
                         if (!cmgr_flag) {
-                            if (privdata->phase2plus)
+                            if (privdata->phase2plus) {
                                 at2_write_line(privdata, "AT+CNMA");
+                                ++expect_extra_ok;
+                            }
                         }
 
                         O_DESTROY(pdu);




--- End Message ---

Reply via email to