I jz look into 1.2.1 version. And it has exact code that running into my
last bug (buffer bug). If you want to keep using 1.2.1 you could try to
modify gw/smsc/smsc_at2.c. Replace 3 functions in that files (Below, I
copy&paste those 3 functions from cvs-version..), and recompile them.

On Mon, 2003-11-17 at 23:52, Mike Nugent wrote:
> Thank you for your response (I'm cc'ing the list so it will be in the
> archives for other people).
> 
> I'm running ver 1.2.1.  The at2 configuration I'm using was written
> using the documentation at:
> http://www.kannel.org/download/1.2.1/userguide-1.2.1/userguide.html#AEN848
> (you have to scroll down a bit).
> 
> I am running this in a production server and I would prefer to run a
> stable version over a cvs version.  Do you still suggest that I give the
> CVS version a shot?  Are the buffering issues you spoke of present in
> ver 1.2.1 also?  Should I try the at smsc instead of the at2 smsc?
> 

In my case, my GSM modem can not use 'at' smsc at all, so I have to
stick with 'at2' smsc. If you run a production server, then better you
try all dirty things in research server.

> Thanks,

======================================================================

int at2_write_line(PrivAT2data *privdata, char *line)
{
    int count;
    int s = 0;
    int write_count = 0, data_written = 0;
    Octstr *linestr = NULL;

    linestr = octstr_format("%s\r", line);

    debug("bb.smsc.at2", 0, "AT2[%s]: --> %s^M",
octstr_get_cstr(privdata->name), line);

    count = octstr_len(linestr);
    while (count > data_written) {
        errno = 0;
        s = write(privdata->fd, octstr_get_cstr(linestr) + data_written, count
- data_written);
        if (s < 0 && errno == EAGAIN && write_count < RETRY_SEND) {
            gwthread_sleep(1);
            ++write_count;
        } else if (s > 0) {
            data_written += s;
            write_count = 0;
        } else
            break;
    };
    O_DESTROY(linestr);
    if (s < 0) {
        error(errno, "AT2[%s]: Couldnot write to device.", 
              octstr_get_cstr(privdata->name));
        tcflush(privdata->fd, TCOFLUSH);
        return s;
    }
    tcdrain(privdata->fd);
    gwthread_sleep((double) (privdata->modem == NULL ? 
        100 : privdata->modem->sendline_sleep) / 1000);
    return s;
}


int at2_write_ctrlz(PrivAT2data *privdata)
{
    int s;
    char *ctrlz = "\032" ;
    int write_count = 0;
    
    debug("bb.smsc.at2", 0, "AT2[%s]: --> ^Z",
octstr_get_cstr(privdata->name));
    while (1) {
        errno = 0;
        s = write(privdata->fd, ctrlz, 1);
        if (s < 0 && errno == EAGAIN && write_count < RETRY_SEND) {
            gwthread_sleep(1);
            ++write_count;
        } else
            break;
    };
    if (s < 0) {
        error(errno, "AT2[%s]: Couldnot write to device.", 
              octstr_get_cstr(privdata->name));
        tcflush(privdata->fd, TCOFLUSH);
        return s;
    }
    tcdrain(privdata->fd);
    gwthread_sleep((double) (privdata->modem == NULL ?
        100 : privdata->modem->sendline_sleep) / 1000);
    return s;
}
      

int at2_write(PrivAT2data *privdata, char *line)
{
    int count, data_written = 0, write_count = 0;
    int s = 0;

    debug("bb.smsc.at2", 0, "AT2[%s]: --> %s",
octstr_get_cstr(privdata->name), line);

    count = strlen(line);
    while(count > data_written) {
        s = write(privdata->fd, line + data_written, count -
data_written);
        if (s < 0 && errno == EAGAIN && write_count < RETRY_SEND) {
            gwthread_sleep(1);
            ++write_count;
        } else if (s > 0) {
            data_written += s;
            write_count = 0;
        } else
            break;
    }

    if (s < 0) {
        error(errno, "AT2[%s]: Couldnot write to device.",
              octstr_get_cstr(privdata->name));
        tcflush(privdata->fd, TCOFLUSH);
        return s;
    }
    tcdrain(privdata->fd);
    gwthread_sleep((double) (privdata->modem == NULL ?
        100 : privdata->modem->sendline_sleep) / 1000);
    return s;
}


======================================================================
-- 
cogito ergo sum

GPG fingerprint:
 E2BC 9029 F3FB 90C7 2FAB 9E42 421E F015 119E 0D5D
GPG Public key:
  http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x119E0D5D

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to