Hello devel,

  I heard the preffered method is submitting patches is cvs diff -u.
  Even though I have a little bit of experience with both SMS as well
  as WAP (stack) development, I am new to Kannel.
  I must say, the code is very well modularized and also well
  documented (a thank-you to the authors ;]).

  Below is a patch to have kannel respond to +CMTI, sms incoming
  notifications.
  For me, this was neccesary because my phone (Siemens SL45i) does not
  send full pdu's to the TE, but rather sends indications at last.

  See below the patch. My question about it is:
  Am I not breaking things with this? I realize that
  at2_wait_modem_command is called cross-recursively with this patch.
  Error status is not checked... Because in case of an error, there is
  little that I can do about it (except maybe a log message).

  Also, maybe the return value of at2_wait_modem_command can be
  erroneous. But I am still not that much into the code to see if that
  is correct. Feedback is appreciated. For me, at least - so far it
  works well.

  To test this patch, set init-string = "AT+CNMI=1,1,0,2,1" (the
  second parameter has to be 1).
  Also, sim-buffering is set to false at best, since both methods
  could intervene each other.

  Any feedback?

===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at2.c,v
retrieving revision 1.5
diff -u -r1.5 smsc_at2.c
--- gw/smsc/smsc_at2.c  6 Sep 2002 09:35:09 -0000       1.5
+++ gw/smsc/smsc_at2.c  18 Sep 2002 21:04:35 -0000
@@ -493,6 +493,11 @@
     int len;
     int cmgr_flag = 0;
 
+    // Chimit: we use cmd to request a message from store at an incoming SMS 
+indication
+    //         cmti_pos is going to hold the memory position at which the message 
+came in
+    char cmd[20];
+    char cmti_pos[20];
+
     time(&end_time);
     if (timeout == 0)
         timeout = 3;
@@ -534,6 +539,24 @@
                 ret = 1;
                 goto end;
             }
+           // Chimit: These 18 lines handle incoming message indication for phones 
+that do not
+           //         support full PDU notification, like Siemens SL45i.
+           //         Todo: Some phones have messages come in at another message 
+store than
+           //               the preferred message store for reading (ericsson, as I 
+may recall?).
+           //               This is not handled in this code.
+           if (octstr_search(line, octstr_imm("+CMTI:"), 0) != -1) {
+               // we received an incoming message indication
+               debug("smsc_at2.c", 0, "+CMTI incoming SMS indication: %s", 
+octstr_get_cstr(line));
+               // determine which memory position
+               strcpy(cmti_pos, octstr_get_cstr(line) + 12);
+               // now read the message
+               sprintf(cmd, "AT+CMGR=%s", cmti_pos);
+               at2_send_modem_command(privdata, cmd, 7, 0);
+               // and delete it
+               sprintf(cmd, "AT+CMGD=%s", cmti_pos);
+               at2_send_modem_command(privdata, cmd, 7, 0);
+               continue;
+           }
             if (octstr_search(line, octstr_imm("+CMT:"), 0) != -1 ||
                octstr_search(line, octstr_imm("+CDS:"), 0) != -1 ||
                 ((octstr_search(line, octstr_imm("+CMGR:"), 0) != -1) && (cmgr_flag = 
1)) ) {
                   

-- 
Best regards,
 Rene                          mailto:[EMAIL PROTECTED]


Reply via email to