--- apps/app_sms.c~ 2010-09-30 16:39:45.000000000 +0100 +++ apps/app_sms.c 2011-08-22 11:01:53.532275714 +0100 @@ -211,6 +211,7 @@ static const unsigned short escapes[] = typedef struct sms_s { unsigned char hangup; /*!< we are done... */ + unsigned char sent_rel; /*!< have sent REL message... */ unsigned char err; /*!< set for any errors */ unsigned char smsc:1; /*!< we are SMSC */ unsigned char rx:1; /*!< this is a received message */ @@ -1460,6 +1461,7 @@ static void sms_nextoutgoing (sms_t * h) } else { h->omsg[0] = 0x94; /* SMS_REL */ h->omsg[1] = 0; + h->sent_rel = 1; } } sms_messagetx(h); @@ -1797,8 +1799,12 @@ static void sms_process(sms_t * h, int s h->iphasep -= 80; if (h->ibitn++ == 9) { /* end of byte */ if (!bit) { /* bad stop bit */ - ast_log(LOG_NOTICE, "bad stop bit"); - h->ierr = 0xFF; /* unknown error */ + if (h->sent_rel) + h->hangup = 1; + else { + ast_log(LOG_NOTICE, "bad stop bit\n"); + h->ierr = 0xFF; /* unknown error */ + } } else { if (h->ibytep < sizeof(h->imsg)) { h->imsg[h->ibytep] = h->ibytev; @@ -1860,7 +1866,7 @@ static int sms_exec(struct ast_channel * int res = -1; sms_t h = { 0 }; /* argument parsing support */ - struct ast_flags flags; + struct ast_flags flags = { 0 }; char *parse, *sms_opts[OPTION_ARG_ARRAY_SIZE] = { 0, }; char *p; AST_DECLARE_APP_ARGS(sms_args, --- utils/smsq.c~ 2009-04-14 06:27:53.000000000 +0100 +++ utils/smsq.c 2011-08-22 10:48:39.450384584 +0100 @@ -177,9 +177,8 @@ static char txqcheck (char *dir, char *q { try++; snprintf(ogname, sizeof(ogname), "outgoing/smsq.%s.%s.%d", dir, queue, try); - if (!link (temp, ogname)) + if (!rename (temp, ogname)) { /* queued OK */ - unlink (temp); return 1; } }