--- app_sms.c.147592 2008-10-09 09:21:32.000000000 +1300 +++ app_sms.c 2008-10-13 21:24:57.000000000 +1300 @@ -36,7 +36,7 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: Working $") #include #include @@ -1452,31 +1452,38 @@ unsigned char c = 0, p; int len = h->omsg[1] + 2; /* total message length excluding checksum */ - for (p = 0; p < len; p++) /* compute checksum */ + for (p = 0; p < len; p++) { /* compute checksum */ c += h->omsg[p]; + } h->omsg[len] = 0 - c; /* actually, (256 - (c & 0fxx)) & 0xff) */ sms_debug(DIR_TX, h); - h->framenumber++; /* Proto 2 */ - h->obyte = 1; /* send mark ('1') at the beginning */ - h->opause = 200; - /* Change the initial message delay. BT requires 300ms, - * but for others this might be way too much and the phone - * could time out. XXX make it configurable. - */ - if (h->omsg[0] == 0x93) - h->opause = 8 * h->opause_0; /* initial message delay */ + h->framenumber++; /* Proto 2 */ h->obytep = 0; h->obitp = 0; - if (h->protocol == 2) { - h->oseizure = 300; /* Proto 2: 300bits (or more ?) */ - h->obyte = 0; /* Seizure starts with space (0) */ - h->opause = 400; - } else { - h->oseizure = 0; /* Proto 1: No seizure */ + if (h->protocol == 2) { /* Proto 2: */ + h->oseizure = 300; /* 300bits (or more ?) */ + h->obyte = 0; /* Seizure starts with space (0) */ + if (h->omsg[0] == 0x7F) { + h->opause = 8 * h->opause_0; /* initial message delay */ + } else { + h->opause = 400; + } + } else { /* Proto 1: */ + h->oseizure = 0; /* No seizure */ + h->obyte = 1; /* send mark ('1') at the beginning */ + /* Change the initial message delay. BT requires 300ms, + * but for others this might be way too much and the phone + * could time out. XXX make it configurable. + */ + if (h->omsg[0] == 0x93) { + h->opause = 8 * h->opause_0; /* initial message delay */ + } else { + h->opause = 200; + } } /* Note - setting osync triggers the generator */ h->osync = OSYNC_BITS; /* 80 sync bits */ - h->obyten = len + 1; /* bytes to send (including checksum) */ + h->obyten = len + 1; /* bytes to send (including checksum) */ } /*!