Avner

We wrote a patch here to use our Motorola P7389i working as a development
device and because it only supported CMTI we used that. I submitted it
against CVS but due to limited take up of use (once in a blue moon it turns
up) it was left out.

The Siemens M20 should work fine without this I think however if you want to
add against CVS this is the process (add within the while loop in
at2_wait_modem_command())

1. got the CMTI and read which memory location the message is stored in

if (-1 != octstr_search(line, octstr_imm("+CMTI:"), 0)) {
   buf = gw_malloc(5);
   buf2 = gw_malloc(20);
   octstr_get_many_chars(buf, line, octstr_len(line) - 3, 3); /* work out
which message to read */

2. Terminate the string and create the AT command to read the message

   buf[3] = '\0';
   sprintf(buf2, "%s%s", "AT+CMGR=", buf);

3. Read the response header and extract PDU returned

   line = at2_wait_line(privdata,1,0);                        /* read header
*/
   line2 = at2_wait_line(privdata,1,0);                       /* read PDU */
   if(line2 == NULL) {
      error(0,"AT2[%s]: got +CMTI but waiting for next line timed out",
      octstr_get_cstr(privdata->name));
   } else {
      octstr_append_cstr(line,"\n");
      octstr_append(line,line2);
      O_DESTROY(line2);
      at2_pdu_extract(privdata, &pdu, line);

4. Decode the PDU if it's not null

   if(pdu == NULL) {
      error(0,"AT2[%s]: got +CMTI but pdu_extract failed : PDU %s",
      octstr_get_cstr(privdata->name), octstr_get_cstr(line));
   } else {
      /* count message even if I can't decode it */
      if (messages_collected)
         ++(*messages_collected);
      msg = at2_pdu_decode(pdu, privdata);
      if(msg != NULL)
      {
         msg->sms.smsc_id = octstr_duplicate(privdata->conn->id);
         bb_smscconn_receive(privdata->conn, msg);
      }

5. Delete the SMS from Memory

      sprintf(buf2, "%s%s", "AT+CMGD=", buf);             /* delete SMS */
      at2_write_line(privdata, buf2);
      line = at2_wait_line(privdata,1,0);                 /* read response
*/
      gw_free(buf);
      gw_free(buf2);
      O_DESTROY(pdu);
   }

Should do the trick!

Regards

Alex
http://www.skywire.co.uk/

----- Original Message -----
From: "Oded Arbel" <[EMAIL PROTECTED]>
To: "Avner Sternheim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, September 10, 2002 4:30 PM
Subject: RE: Siemens M20 configuration


>
> > -----Original Message-----
> > From: Avner Sternheim [mailto:[EMAIL PROTECTED]]
>
> > You mention that there was a patch for the +cmti, can I use
> > it or sould I
> > implement it myself
>
> There was once a patch submitted to the list. you can find it in the devel
archives. but that patch will not work on current version, as the AT2
implementation was changed drasticly since. you can try to use it as
reference for your own patch. though adding +CMTI support would be nice, I
still think the easier and better solution would be to find and set the
correct +CNMI setting for your modem.
>
> --
> Oded Arbel
> m-Wise mobile solutions
> [EMAIL PROTECTED]
>
> +972-9-9581711 (116)
> +972-67-340014
>
> ::..
> a space shuttle
> lovers flying across the moon
> mournful violins


Reply via email to