--- app_sms.c.orig 2008-10-06 20:42:08.000000000 +1300 +++ app_sms.c 2008-10-08 23:07:03.000000000 +1300 @@ -36,7 +36,7 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 145428 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: Working $") #include #include @@ -86,7 +86,7 @@ " t - use protocol 2 (default used is protocol 1).\n" " p(N) - set the initial delay to N ms (default is 300).\n" " addr and body are a deprecated format to send messages out.\n" - " s - set the Status Report Request (SRR) bit.\n" + " r - set the Status Report Request (SRR) bit.\n" " o - the body should be coded as octets not 7-bit symbols.\n" "Messages are processed as per text file message queues.\n" "smsq (a separate software) is a command to generate message\n" @@ -919,6 +919,10 @@ char buf[30]; FILE *o; + if (ast_tvzero(h->scts)) { + h->scts = ast_tvnow(); + } + snprintf(fn, sizeof(fn), "%s/sms/%s", ast_config_AST_SPOOL_DIR, h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx"); ast_mkdir(fn, 0777); /* ensure it exists */ ast_copy_string(fn2, fn, sizeof(fn2)); @@ -1453,23 +1457,28 @@ 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 */ @@ -1796,7 +1805,7 @@ if (h.opause_0 < 25 || h.opause_0 > 2000) h.opause_0 = 300; /* default 300ms */ ast_verb(1, "initial delay %dms\n", h.opause_0); - + ast_verb(1, "protocol %d\n", h.protocol); /* the following apply if there is an arg3/4 and apply to the created message file */ if (ast_test_flag(&flags, OPTION_SRR)) @@ -1904,9 +1913,8 @@ ast_log(LOG_NOTICE, "ast_read failed\n"); break; } - if (f->frametype == AST_FRAME_VOICE) { + if (f->frametype == AST_FRAME_VOICE) sms_process(&h, f->samples, f->data.ptr); - } ast_frfree(f); }