[asterisk-commits] tilghman: branch 1.6.1 r148986 - in /branches/1.6.1: ./ apps/app_sms.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 14 13:59:43 CDT 2008
Author: tilghman
Date: Tue Oct 14 13:59:43 2008
New Revision: 148986
URL: http://svn.digium.com/view/asterisk?view=rev&rev=148986
Log:
Merged revisions 148985 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r148985 | tilghman | 2008-10-14 13:58:19 -0500 (Tue, 14 Oct 2008) | 6 lines
App is ignoring 'p' parameter -- initial pause.
(closes issue #13617)
Reported by: alecdavis
Patches:
app_sms.13oct.diff.txt uploaded by alecdavis (license 585)
........
Modified:
branches/1.6.1/ (props changed)
branches/1.6.1/apps/app_sms.c
Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.1/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_sms.c?view=diff&rev=148986&r1=148985&r2=148986
==============================================================================
--- branches/1.6.1/apps/app_sms.c (original)
+++ branches/1.6.1/apps/app_sms.c Tue Oct 14 13:59:43 2008
@@ -42,7 +42,7 @@
#include <ctype.h>
#include <sys/stat.h>
-#include "asterisk/paths.h" /* use ast_config_AST_SPOOL_DIR and LOG_DIR */
+#include "asterisk/paths.h" /* use ast_config_AST_SPOOL_DIR and LOG_DIR */
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
@@ -53,7 +53,7 @@
#include "asterisk/utils.h"
#include "asterisk/app.h"
-/* #define OUTALAW */ /* enable this to output Alaw rather than linear */
+/* #define OUTALAW */ /* enable this to output Alaw rather than linear */
/* ToDo */
/* Add full VP support */
@@ -61,8 +61,8 @@
/* Time zones on time stamps */
/* user ref field */
-static volatile unsigned char message_ref; /* arbitary message ref */
-static volatile unsigned int seq; /* arbitrary message sequence number for unqiue files */
+static volatile unsigned char message_ref; /* arbitary message ref */
+static volatile unsigned int seq; /* arbitrary message sequence number for unqiue files */
static char log_file[255];
@@ -113,15 +113,15 @@
#ifdef OUTALAW
static unsigned char wavea[80];
typedef unsigned char output_t;
-static const output_t *wave_out = wavea; /* outgoing samples */
+static const output_t *wave_out = wavea; /* outgoing samples */
#define __OUT_FMT AST_FORMAT_ALAW;
#else
typedef signed short output_t;
-static const output_t *wave_out = wave; /* outgoing samples */
+static const output_t *wave_out = wave; /* outgoing samples */
#define __OUT_FMT AST_FORMAT_SLINEAR
#endif
-#define OSYNC_BITS 80 /* initial sync bits */
+#define OSYNC_BITS 80 /* initial sync bits */
/*!
* The SMS spec ETSI ES 201 912 defines two protocols with different message types.
@@ -131,32 +131,32 @@
* for Protocol 2, 0x00 means that the message is complete;
*/
enum message_types {
- DLL_SMS_MASK = 0x7f, /* mask for the valid bits */
+ DLL_SMS_MASK = 0x7f, /* mask for the valid bits */
/* Protocol 1 values */
- DLL1_SMS_DATA = 0x11, /* data packet */
- DLL1_SMS_ERROR = 0x12,
- DLL1_SMS_EST = 0x13, /* start the connection */
- DLL1_SMS_REL = 0x14, /* end the connection */
- DLL1_SMS_ACK = 0x15,
- DLL1_SMS_NACK = 0x16,
-
- DLL1_SMS_COMPLETE = 0x80, /* packet is complete */
- DLL1_SMS_MORE = 0x00, /* more data to follow */
+ DLL1_SMS_DATA = 0x11, /* data packet */
+ DLL1_SMS_ERROR = 0x12,
+ DLL1_SMS_EST = 0x13, /* start the connection */
+ DLL1_SMS_REL = 0x14, /* end the connection */
+ DLL1_SMS_ACK = 0x15,
+ DLL1_SMS_NACK = 0x16,
+
+ DLL1_SMS_COMPLETE = 0x80, /* packet is complete */
+ DLL1_SMS_MORE = 0x00, /* more data to follow */
/* Protocol 2 values */
- DLL2_SMS_EST = 0x7f, /* magic number. No message body */
- DLL2_SMS_INFO_MO = 0x10,
- DLL2_SMS_INFO_MT = 0x11,
- DLL2_SMS_INFO_STA = 0x12,
- DLL2_SMS_NACK = 0x13,
- DLL2_SMS_ACK0 = 0x14, /* ack even-numbered frame */
- DLL2_SMS_ACK1 = 0x15, /* ack odd-numbered frame */
- DLL2_SMS_ENQ = 0x16,
- DLL2_SMS_REL = 0x17, /* end the connection */
-
- DLL2_SMS_COMPLETE = 0x00, /* packet is complete */
- DLL2_SMS_MORE = 0x80, /* more data to follow */
+ DLL2_SMS_EST = 0x7f, /* magic number. No message body */
+ DLL2_SMS_INFO_MO = 0x10,
+ DLL2_SMS_INFO_MT = 0x11,
+ DLL2_SMS_INFO_STA = 0x12,
+ DLL2_SMS_NACK = 0x13,
+ DLL2_SMS_ACK0 = 0x14, /* ack even-numbered frame */
+ DLL2_SMS_ACK1 = 0x15, /* ack odd-numbered frame */
+ DLL2_SMS_ENQ = 0x16,
+ DLL2_SMS_REL = 0x17, /* end the connection */
+
+ DLL2_SMS_COMPLETE = 0x00, /* packet is complete */
+ DLL2_SMS_MORE = 0x80, /* more data to follow */
};
/* SMS 7 bit character mapping to UCS-2 */
@@ -184,8 +184,8 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-#define SMSLEN 160 /*!< max SMS length */
-#define SMSLEN_8 140 /*!< max SMS length for 8-bit char */
+#define SMSLEN 160 /*!< max SMS length */
+#define SMSLEN_8 140 /*!< max SMS length for 8-bit char */
typedef struct sms_s {
unsigned char hangup; /*!< we are done... */
@@ -244,21 +244,22 @@
int protocol; /*!< ETSI SMS protocol to use (passed at app call) */
int oseizure; /*!< protocol 2: channel seizure bits to send */
int framenumber; /*!< protocol 2: frame number (for sending ACK0 or ACK1) */
- char udtxt[SMSLEN]; /*!< user data (message), PLAIN text */
+ char udtxt[SMSLEN]; /*!< user data (message), PLAIN text */
} sms_t;
/* different types of encoding */
-#define is7bit(dcs) ( ((dcs) & 0xC0) ? (!((dcs)&4) ) : (((dcs) & 0xc) == 0) )
-#define is8bit(dcs) ( ((dcs) & 0xC0) ? ( ((dcs)&4) ) : (((dcs) & 0xc) == 4) )
-#define is16bit(dcs) ( ((dcs) & 0xC0) ? 0 : (((dcs) & 0xc) == 8) )
+#define is7bit(dcs) ( ((dcs) & 0xC0) ? (!((dcs) & 4) ) : (((dcs) & 0xc) == 0) )
+#define is8bit(dcs) ( ((dcs) & 0xC0) ? ( ((dcs) & 4) ) : (((dcs) & 0xc) == 4) )
+#define is16bit(dcs) ( ((dcs) & 0xC0) ? 0 : (((dcs) & 0xc) == 8) )
static void sms_messagetx(sms_t *h);
/*! \brief copy number, skipping non digits apart from leading + */
static void numcpy(char *d, char *s)
{
- if (*s == '+')
+ if (*s == '+') {
*d++ = *s++;
+ }
while (*s) {
if (isdigit(*s)) {
*d++ = *s;
@@ -284,44 +285,51 @@
static long utf8decode(unsigned char **pp)
{
unsigned char *p = *pp;
- if (!*p)
- return 0; /* null termination of string */
+ if (!*p) {
+ return 0; /* null termination of string */
+ }
(*pp)++;
- if (*p < 0xC0)
- return *p; /* ascii or continuation character */
+ if (*p < 0xC0) {
+ return *p; /* ascii or continuation character */
+ }
if (*p < 0xE0) {
- if (*p < 0xC2 || (p[1] & 0xC0) != 0x80)
- return *p; /* not valid UTF-8 */
+ if (*p < 0xC2 || (p[1] & 0xC0) != 0x80) {
+ return *p; /* not valid UTF-8 */
+ }
(*pp)++;
return ((*p & 0x1F) << 6) + (p[1] & 0x3F);
}
if (*p < 0xF0) {
- if ((*p == 0xE0 && p[1] < 0xA0) || (p[1] & 0xC0) != 0x80 || (p[2] & 0xC0) != 0x80)
- return *p; /* not valid UTF-8 */
+ if ((*p == 0xE0 && p[1] < 0xA0) || (p[1] & 0xC0) != 0x80 || (p[2] & 0xC0) != 0x80) {
+ return *p; /* not valid UTF-8 */
+ }
(*pp) += 2;
return ((*p & 0x0F) << 12) + ((p[1] & 0x3F) << 6) + (p[2] & 0x3F);
}
if (*p < 0xF8) {
- if ((*p == 0xF0 && p[1] < 0x90) || (p[1] & 0xC0) != 0x80 || (p[2] & 0xC0) != 0x80 || (p[3] & 0xC0) != 0x80)
- return *p; /* not valid UTF-8 */
+ if ((*p == 0xF0 && p[1] < 0x90) || (p[1] & 0xC0) != 0x80 || (p[2] & 0xC0) != 0x80 || (p[3] & 0xC0) != 0x80) {
+ return *p; /* not valid UTF-8 */
+ }
(*pp) += 3;
return ((*p & 0x07) << 18) + ((p[1] & 0x3F) << 12) + ((p[2] & 0x3F) << 6) + (p[3] & 0x3F);
}
if (*p < 0xFC) {
if ((*p == 0xF8 && p[1] < 0x88) || (p[1] & 0xC0) != 0x80 || (p[2] & 0xC0) != 0x80 || (p[3] & 0xC0) != 0x80
- || (p[4] & 0xC0) != 0x80)
- return *p; /* not valid UTF-8 */
+ || (p[4] & 0xC0) != 0x80) {
+ return *p; /* not valid UTF-8 */
+ }
(*pp) += 4;
return ((*p & 0x03) << 24) + ((p[1] & 0x3F) << 18) + ((p[2] & 0x3F) << 12) + ((p[3] & 0x3F) << 6) + (p[4] & 0x3F);
}
if (*p < 0xFE) {
if ((*p == 0xFC && p[1] < 0x84) || (p[1] & 0xC0) != 0x80 || (p[2] & 0xC0) != 0x80 || (p[3] & 0xC0) != 0x80
- || (p[4] & 0xC0) != 0x80 || (p[5] & 0xC0) != 0x80)
- return *p; /* not valid UTF-8 */
+ || (p[4] & 0xC0) != 0x80 || (p[5] & 0xC0) != 0x80) {
+ return *p; /* not valid UTF-8 */
+ }
(*pp) += 5;
return ((*p & 0x01) << 30) + ((p[1] & 0x3F) << 24) + ((p[2] & 0x3F) << 18) + ((p[3] & 0x3F) << 12) + ((p[4] & 0x3F) << 6) + (p[5] & 0x3F);
}
- return *p; /* not sensible */
+ return *p; /* not sensible */
}
/*! \brief takes a binary header (udhl bytes at udh) and UCS-2 message (udl characters at ud) and packs in to o using SMS 7 bit character codes */
@@ -330,15 +338,16 @@
/* if the input contains invalid characters then the return value is -1 */
static int packsms7(unsigned char *o, int udhl, unsigned char *udh, int udl, unsigned short *ud)
{
- unsigned char p = 0; /* output pointer (bytes) */
- unsigned char b = 0; /* bit position */
- unsigned char n = 0; /* output character count */
+ unsigned char p = 0; /* output pointer (bytes) */
+ unsigned char b = 0; /* bit position */
+ unsigned char n = 0; /* output character count */
unsigned char dummy[SMSLEN];
- if (o == NULL) /* output to a dummy buffer if o not set */
+ if (o == NULL) { /* output to a dummy buffer if o not set */
o = dummy;
-
- if (udhl) { /* header */
+ }
+
+ if (udhl) { /* header */
o[p++] = udhl;
b = 1;
n = 1;
@@ -356,7 +365,7 @@
b = 7 - b;
if (++n >= SMSLEN)
return n;
- }; /* filling to septet boundary */
+ } /* filling to septet boundary */
}
o[p] = 0;
/* message */
@@ -372,7 +381,7 @@
for (v = 0; v < 128 && escapes[v] != u; v++);
if (v < 128) { /* escaped sequence, esc + v */
/* store the low (8-b) bits in o[p], the remaining bits in o[p+1] */
- o[p] |= (27 << b); /* the low bits go into o[p] */
+ o[p] |= (27 << b); /* the low bits go into o[p] */
b += 7;
if (b >= 8) {
b -= 8;
@@ -383,7 +392,7 @@
}
}
if (v == 128)
- return -1; /* invalid character */
+ return -1; /* invalid character */
/* store, same as above */
o[p] |= (v << b);
b += 7;
@@ -416,18 +425,21 @@
o[p++] = udhl;
while (udhl--) {
o[p++] = *udh++;
- if (p >= SMSLEN_8)
+ if (p >= SMSLEN_8) {
return p;
+ }
}
}
while (udl--) {
long u;
u = *ud++;
- if (u < 0 || u > 0xFF)
- return -1; /* not valid */
+ if (u < 0 || u > 0xFF) {
+ return -1; /* not valid */
+ }
o[p++] = u;
- if (p >= SMSLEN_8)
+ if (p >= SMSLEN_8) {
return p;
+ }
}
return p;
}
@@ -445,26 +457,30 @@
unsigned char p = 0;
unsigned char dummy[SMSLEN_8];
- if (o == NULL)
+ if (o == NULL) {
o = dummy;
+ }
/* header - no encoding */
if (udhl) {
o[p++] = udhl;
while (udhl--) {
o[p++] = *udh++;
- if (p >= SMSLEN_8)
+ if (p >= SMSLEN_8) {
return p;
+ }
}
}
while (udl--) {
long u;
u = *ud++;
o[p++] = (u >> 8);
- if (p >= SMSLEN_8)
- return p - 1; /* could not fit last character */
+ if (p >= SMSLEN_8) {
+ return p - 1; /* could not fit last character */
+ }
o[p++] = u;
- if (p >= SMSLEN_8)
+ if (p >= SMSLEN_8) {
return p;
+ }
}
return p;
}
@@ -474,27 +490,27 @@
static int packsms(unsigned char dcs, unsigned char *base, unsigned int udhl, unsigned char *udh, int udl, unsigned short *ud)
{
unsigned char *p = base;
- if (udl == 0)
- *p++ = 0; /* no user data */
- else {
+ if (udl == 0) {
+ *p++ = 0; /* no user data */
+ } else {
int l = 0;
- if (is7bit(dcs)) { /* 7 bit */
- l = packsms7(p + 1, udhl, udh, udl, ud);
- if (l < 0)
+ if (is7bit(dcs)) { /* 7 bit */
+ if ((l = packsms7(p + 1, udhl, udh, udl, ud)) < 0) {
l = 0;
+ }
*p++ = l;
p += (l * 7 + 7) / 8;
- } else if (is8bit(dcs)) { /* 8 bit */
- l = packsms8(p + 1, udhl, udh, udl, ud);
- if (l < 0)
+ } else if (is8bit(dcs)) { /* 8 bit */
+ if ((l = packsms8(p + 1, udhl, udh, udl, ud)) < 0) {
l = 0;
+ }
*p++ = l;
p += l;
- } else { /* UCS-2 */
- l = packsms16(p + 1, udhl, udh, udl, ud);
- if (l < 0)
+ } else { /* UCS-2 */
+ if ((l = packsms16(p + 1, udhl, udh, udl, ud)) < 0) {
l = 0;
+ }
*p++ = l;
p += l;
}
@@ -522,10 +538,11 @@
*o++ = ((t.tm_hour % 10) << 4) + t.tm_hour / 10;
*o++ = ((t.tm_min % 10) << 4) + t.tm_min / 10;
*o++ = ((t.tm_sec % 10) << 4) + t.tm_sec / 10;
- if (z < 0)
+ if (z < 0) {
*o++ = (((-z) % 10) << 4) + (-z) / 10 + 0x08;
- else
+ } else {
*o++ = ((z % 10) << 4) + z / 10;
+ }
}
/*! \brief unpack a date and return */
@@ -540,10 +557,11 @@
t.tm_min = (i[4] & 0xF) * 10 + (i[4] >> 4);
t.tm_sec = (i[5] & 0xF) * 10 + (i[5] >> 4);
t.tm_isdst = 0;
- if (i[6] & 0x08)
+ if (i[6] & 0x08) {
t.tm_min += 15 * ((i[6] & 0x7) * 10 + (i[6] >> 4));
- else
+ } else {
t.tm_min -= 15 * ((i[6] & 0x7) * 10 + (i[6] >> 4));
+ }
return ast_mktime(&t, NULL);
}
@@ -556,7 +574,7 @@
unsigned char b = 0, p = 0;
unsigned short *o = ud;
*udhl = 0;
- if (udhi && l) { /* header */
+ if (udhi && l) { /* header */
int h = i[p];
*udhl = h;
if (h) {
@@ -569,8 +587,9 @@
while (b >= 7) {
b -= 7;
l--;
- if (!l)
+ if (!l) {
break;
+ }
}
}
/* adjust for fill, septets */
@@ -582,20 +601,22 @@
}
while (l--) {
unsigned char v;
- if (b < 2)
- v = ((i[p] >> b) & 0x7F); /* everything in one byte */
- else
+ if (b < 2) {
+ v = ((i[p] >> b) & 0x7F); /* everything in one byte */
+ } else {
v = ((((i[p] >> b) + (i[p + 1] << (8 - b)))) & 0x7F);
+ }
b += 7;
if (b >= 8) {
b -= 8;
p++;
}
/* 0x00A0 is the encoding of ESC (27) in defaultalphabet */
- if (o > ud && o[-1] == 0x00A0 && escapes[v])
+ if (o > ud && o[-1] == 0x00A0 && escapes[v]) {
o[-1] = escapes[v];
- else
+ } else {
*o++ = defaultalphabet[v];
+ }
}
*udl = (o - ud);
}
@@ -621,8 +642,9 @@
}
}
}
- while (l--)
- *o++ = *i++; /* not to UTF-8 as explicitly 8 bit coding in DCS */
+ while (l--) {
+ *o++ = *i++; /* not to UTF-8 as explicitly 8 bit coding in DCS */
+ }
*udl = (o - ud);
}
@@ -648,8 +670,9 @@
}
while (l--) {
int v = *i++;
- if (l--)
+ if (l--) {
v = (v << 8) + *i++;
+ }
*o++ = v;
}
*udl = (o - ud);
@@ -661,26 +684,28 @@
int l = *i++;
if (is7bit(dcs)) {
unpacksms7(i, l, udh, udhl, ud, udl, udhi);
- l = (l * 7 + 7) / 8; /* adjust length to return */
- } else if (is8bit(dcs))
+ l = (l * 7 + 7) / 8; /* adjust length to return */
+ } else if (is8bit(dcs)) {
unpacksms8(i, l, udh, udhl, ud, udl, udhi);
- else
+ } else {
unpacksms16(i, l, udh, udhl, ud, udl, udhi);
+ }
return l + 1;
}
/*! \brief unpack an address from i, return byte length, unpack to o */
static unsigned char unpackaddress(char *o, unsigned char *i)
{
- unsigned char l = i[0],
- p;
- if (i[1] == 0x91)
+ unsigned char l = i[0], p;
+ if (i[1] == 0x91) {
*o++ = '+';
+ }
for (p = 0; p < l; p++) {
- if (p & 1)
+ if (p & 1) {
*o++ = (i[2 + p / 2] >> 4) + '0';
- else
+ } else {
*o++ = (i[2 + p / 2] & 0xF) + '0';
+ }
}
*o = 0;
return (l + 5) / 2;
@@ -690,23 +715,27 @@
static unsigned char packaddress(unsigned char *o, char *i)
{
unsigned char p = 2;
- o[0] = 0; /* number of bytes */
- if (*i == '+') { /* record as bit 0 in byte 1 */
+ o[0] = 0; /* number of bytes */
+ if (*i == '+') { /* record as bit 0 in byte 1 */
i++;
o[1] = 0x91;
- } else
+ } else {
o[1] = 0x81;
+ }
for ( ; *i ; i++) {
- if (!isdigit(*i)) /* ignore non-digits */
+ if (!isdigit(*i)) { /* ignore non-digits */
continue;
- if (o[0] & 1)
+ }
+ if (o[0] & 1) {
o[p++] |= ((*i & 0xF) << 4);
- else
+ } else {
o[p] = (*i & 0xF);
+ }
o[0]++;
}
- if (o[0] & 1)
- o[p++] |= 0xF0; /* pad */
+ if (o[0] & 1) {
+ o[p++] |= 0xF0; /* pad */
+ }
return p;
}
@@ -715,16 +744,18 @@
{
int o;
- if (*h->oa == '\0' && *h->da == '\0')
+ if (*h->oa == '\0' && *h->da == '\0') {
return;
+ }
o = open(log_file, O_CREAT | O_APPEND | O_WRONLY, AST_FILE_MODE);
if (o >= 0) {
char line[1000], mrs[3] = "", *p;
char buf[30];
unsigned char n;
- if (h->mr >= 0)
+ if (h->mr >= 0) {
snprintf(mrs, sizeof(mrs), "%02X", h->mr);
+ }
snprintf(line, sizeof(line), "%s %c%c%c%s %s %s %s ",
isodate(time(NULL), buf, sizeof(buf)),
status, h->rx ? 'I' : 'O', h->smsc ? 'S' : 'M', mrs, h->queue,
@@ -740,10 +771,11 @@
} else if (h->ud[n] == '\r') {
*p++ = '\\';
*p++ = 'r';
- } else if (h->ud[n] < 32 || h->ud[n] == 127)
+ } else if (h->ud[n] < 32 || h->ud[n] == 127) {
*p++ = 191;
- else
+ } else {
*p++ = h->ud[n];
+ }
}
*p++ = '\n';
*p = 0;
@@ -758,15 +790,15 @@
{
char line[1000];
FILE *s;
- char dcsset = 0; /* if DSC set */
+ char dcsset = 0; /* if DSC set */
ast_log(LOG_EVENT, "Sending %s\n", fn);
h->rx = h->udl = *h->oa = *h->da = h->pid = h->srr = h->udhi = h->rp = h->vp = h->udhl = 0;
h->mr = -1;
- h->dcs = 0xF1; /* normal messages class 1 */
+ h->dcs = 0xF1; /* normal messages class 1 */
h->scts = ast_tvnow();
s = fopen(fn, "r");
if (s) {
- if (unlink(fn)) { /* concurrent access, we lost */
+ if (unlink(fn)) { /* concurrent access, we lost */
fclose(s);
return;
}
@@ -774,54 +806,55 @@
char *p;
void *pp = &p;
for (p = line; *p && *p != '\n' && *p != '\r'; p++);
- *p = 0; /* strip eoln */
+ *p = 0; /* strip eoln */
p = line;
- if (!*p || *p == ';')
- continue; /* blank line or comment, ignore */
+ if (!*p || *p == ';') {
+ continue; /* blank line or comment, ignore */
+ }
while (isalnum(*p)) {
*p = tolower (*p);
p++;
}
- while (isspace (*p))
+ while (isspace (*p)) {
*p++ = 0;
+ }
if (*p == '=') {
*p++ = 0;
- if (!strcmp(line, "ud")) { /* parse message (UTF-8) */
+ if (!strcmp(line, "ud")) { /* parse message (UTF-8) */
unsigned char o = 0;
- memcpy(h->udtxt, p, SMSLEN); /* for protocol 2 */
- while (*p && o < SMSLEN)
+ memcpy(h->udtxt, p, SMSLEN); /* for protocol 2 */
+ while (*p && o < SMSLEN) {
h->ud[o++] = utf8decode(pp);
+ }
h->udl = o;
- if (*p)
+ if (*p) {
ast_log(LOG_WARNING, "UD too long in %s\n", fn);
+ }
} else {
- while (isspace (*p))
+ while (isspace (*p)) {
p++;
- if (!strcmp(line, "oa") && strlen(p) < sizeof(h->oa))
+ }
+ if (!strcmp(line, "oa") && strlen(p) < sizeof(h->oa)) {
numcpy (h->oa, p);
- else if (!strcmp(line, "da") && strlen(p) < sizeof(h->oa))
+ } else if (!strcmp(line, "da") && strlen(p) < sizeof(h->oa)) {
numcpy (h->da, p);
- else if (!strcmp(line, "pid"))
+ } else if (!strcmp(line, "pid")) {
h->pid = atoi(p);
- else if (!strcmp(line, "dcs")) {
+ } else if (!strcmp(line, "dcs")) {
h->dcs = atoi(p);
dcsset = 1;
- } else if (!strcmp(line, "mr"))
+ } else if (!strcmp(line, "mr")) {
h->mr = atoi(p);
- else if (!strcmp(line, "srr"))
+ } else if (!strcmp(line, "srr")) {
h->srr = (atoi(p) ? 1 : 0);
- else if (!strcmp(line, "vp"))
+ } else if (!strcmp(line, "vp")) {
h->vp = atoi(p);
- else if (!strcmp(line, "rp"))
+ } else if (!strcmp(line, "rp")) {
h->rp = (atoi(p) ? 1 : 0);
- else if (!strcmp(line, "scts")) { /* get date/time */
- int Y,
- m,
- d,
- H,
- M,
- S;
- if (sscanf (p, "%d-%d-%dT%d:%d:%d", &Y, &m, &d, &H, &M, &S) == 6) {
+ } else if (!strcmp(line, "scts")) { /* get date/time */
+ int Y, m, d, H, M, S;
+ /* XXX Why aren't we using ast_strptime here? */
+ if (sscanf(p, "%d-%d-%dT%d:%d:%d", &Y, &m, &d, &H, &M, &S) == 6) {
struct ast_tm t = { 0, };
t.tm_year = Y - 1900;
t.tm_mon = m - 1;
@@ -831,17 +864,19 @@
t.tm_sec = S;
t.tm_isdst = -1;
h->scts = ast_mktime(&t, NULL);
- if (h->scts.tv_sec == 0)
+ if (h->scts.tv_sec == 0) {
ast_log(LOG_WARNING, "Bad date/timein %s: %s", fn, p);
+ }
}
- } else
+ } else {
ast_log(LOG_WARNING, "Cannot parse in %s: %s=%si\n", fn, line, p);
+ }
}
- } else if (*p == '#') { /* raw hex format */
+ } else if (*p == '#') { /* raw hex format */
*p++ = 0;
if (*p == '#') {
p++;
- if (!strcmp(line, "ud")) { /* user data */
+ if (!strcmp(line, "ud")) { /* user data */
int o = 0;
while (*p && o < SMSLEN) {
if (isxdigit(*p) && isxdigit(p[1]) && isxdigit(p[2]) && isxdigit(p[3])) {
@@ -858,19 +893,21 @@
ast_log(LOG_WARNING, "UD too long / invalid UCS-2 hex in %s\n", fn);
} else
ast_log(LOG_WARNING, "Only ud can use ## format, %s\n", fn);
- } else if (!strcmp(line, "ud")) { /* user data */
+ } else if (!strcmp(line, "ud")) { /* user data */
int o = 0;
while (*p && o < SMSLEN) {
if (isxdigit(*p) && isxdigit(p[1])) {
h->ud[o++] = (((isalpha(*p) ? 9 : 0) + (*p & 0xF)) << 4) + ((isalpha(p[1]) ? 9 : 0) + (p[1] & 0xF));
p += 2;
- } else
+ } else {
break;
+ }
}
h->udl = o;
- if (*p)
+ if (*p) {
ast_log(LOG_WARNING, "UD too long / invalid UCS-1 hex in %s\n", fn);
- } else if (!strcmp(line, "udh")) { /* user data header */
+ }
+ } else if (!strcmp(line, "udh")) { /* user data header */
unsigned char o = 0;
h->udhi = 1;
while (*p && o < SMSLEN) {
@@ -878,37 +915,44 @@
h->udh[o] = (((isalpha(*p) ? 9 : 0) + (*p & 0xF)) << 4) + ((isalpha(p[1]) ? 9 : 0) + (p[1] & 0xF));
o++;
p += 2;
- } else
+ } else {
break;
+ }
}
h->udhl = o;
- if (*p)
+ if (*p) {
ast_log(LOG_WARNING, "UDH too long / invalid hex in %s\n", fn);
- } else
+ }
+ } else {
ast_log(LOG_WARNING, "Only ud and udh can use # format, %s\n", fn);
- } else
+ }
+ } else {
ast_log(LOG_WARNING, "Cannot parse in %s: %s\n", fn, line);
+ }
}
fclose(s);
if (!dcsset && packsms7(0, h->udhl, h->udh, h->udl, h->ud) < 0) {
if (packsms8(0, h->udhl, h->udh, h->udl, h->ud) < 0) {
- if (packsms16(0, h->udhl, h->udh, h->udl, h->ud) < 0)
+ if (packsms16(0, h->udhl, h->udh, h->udl, h->ud) < 0) {
ast_log(LOG_WARNING, "Invalid UTF-8 message even for UCS-2 (%s)\n", fn);
- else {
- h->dcs = 0x08; /* default to 16 bit */
+ } else {
+ h->dcs = 0x08; /* default to 16 bit */
ast_log(LOG_WARNING, "Sending in 16 bit format(%s)\n", fn);
}
} else {
- h->dcs = 0xF5; /* default to 8 bit */
+ h->dcs = 0xF5; /* default to 8 bit */
ast_log(LOG_WARNING, "Sending in 8 bit format(%s)\n", fn);
}
}
- if (is7bit(h->dcs) && packsms7(0, h->udhl, h->udh, h->udl, h->ud) < 0)
+ if (is7bit(h->dcs) && packsms7(0, h->udhl, h->udh, h->udl, h->ud) < 0) {
ast_log(LOG_WARNING, "Invalid 7 bit GSM data %s\n", fn);
- if (is8bit(h->dcs) && packsms8(0, h->udhl, h->udh, h->udl, h->ud) < 0)
+ }
+ if (is8bit(h->dcs) && packsms8(0, h->udhl, h->udh, h->udl, h->ud) < 0) {
ast_log(LOG_WARNING, "Invalid 8 bit data %s\n", fn);
- if (is16bit(h->dcs) && packsms16(0, h->udhl, h->udh, h->udl, h->ud) < 0)
+ }
+ if (is16bit(h->dcs) && packsms16(0, h->udhl, h->udh, h->udl, h->ud) < 0) {
ast_log(LOG_WARNING, "Invalid 16 bit data %s\n", fn);
+ }
}
}
@@ -923,43 +967,45 @@
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_mkdir(fn, 0777); /* ensure it exists */
ast_copy_string(fn2, fn, sizeof(fn2));
snprintf(fn2 + strlen(fn2), sizeof(fn2) - strlen(fn2), "/%s.%s-%d", h->queue, isodate(h->scts.tv_sec, buf, sizeof(buf)), seq++);
snprintf(fn + strlen(fn), sizeof(fn) - strlen(fn), "/.%s", fn2 + strlen(fn) + 1);
- o = fopen(fn, "w");
- if (o == NULL)
+ if ((o = fopen(fn, "w")) == NULL) {
return;
-
- if (*h->oa)
+ }
+
+ if (*h->oa) {
fprintf(o, "oa=%s\n", h->oa);
- if (*h->da)
+ }
+ if (*h->da) {
fprintf(o, "da=%s\n", h->da);
+ }
if (h->udhi) {
unsigned int p;
fprintf(o, "udh#");
- for (p = 0; p < h->udhl; p++)
+ for (p = 0; p < h->udhl; p++) {
fprintf(o, "%02X", h->udh[p]);
+ }
fprintf(o, "\n");
}
if (h->udl) {
unsigned int p;
for (p = 0; p < h->udl && h->ud[p] >= ' '; p++);
- if (p < h->udl)
- fputc(';', o); /* cannot use ud=, but include as a comment for human readable */
+ if (p < h->udl) {
+ fputc(';', o); /* cannot use ud=, but include as a comment for human readable */
+ }
fprintf(o, "ud=");
for (p = 0; p < h->udl; p++) {
unsigned short v = h->ud[p];
- if (v < 32)
+ if (v < 32) {
fputc(191, o);
- else if (v < 0x80)
+ } else if (v < 0x80) {
fputc(v, o);
- else if (v < 0x800)
- {
+ } else if (v < 0x800) {
fputc(0xC0 + (v >> 6), o);
fputc(0x80 + (v & 0x3F), o);
- } else
- {
+ } else {
fputc(0xE0 + (v >> 12), o);
fputc(0x80 + ((v >> 6) & 0x3F), o);
fputc(0x80 + (v & 0x3F), o);
@@ -969,15 +1015,17 @@
for (p = 0; p < h->udl && h->ud[p] >= ' '; p++);
if (p < h->udl) {
for (p = 0; p < h->udl && h->ud[p] < 0x100; p++);
- if (p == h->udl) { /* can write in ucs-1 hex */
+ if (p == h->udl) { /* can write in ucs-1 hex */
fprintf(o, "ud#");
- for (p = 0; p < h->udl; p++)
+ for (p = 0; p < h->udl; p++) {
fprintf(o, "%02X", h->ud[p]);
+ }
fprintf(o, "\n");
- } else { /* write in UCS-2 */
+ } else { /* write in UCS-2 */
fprintf(o, "ud##");
- for (p = 0; p < h->udl; p++)
+ for (p = 0; p < h->udl; p++) {
fprintf(o, "%04X", h->ud[p]);
+ }
fprintf(o, "\n");
}
}
@@ -986,23 +1034,30 @@
char datebuf[30];
fprintf(o, "scts=%s\n", isodate(h->scts.tv_sec, datebuf, sizeof(datebuf)));
}
- if (h->pid)
+ if (h->pid) {
fprintf(o, "pid=%d\n", h->pid);
- if (h->dcs != 0xF1)
+ }
+ if (h->dcs != 0xF1) {
fprintf(o, "dcs=%d\n", h->dcs);
- if (h->vp)
+ }
+ if (h->vp) {
fprintf(o, "vp=%d\n", h->vp);
- if (h->srr)
+ }
+ if (h->srr) {
fprintf(o, "srr=1\n");
- if (h->mr >= 0)
+ }
+ if (h->mr >= 0) {
fprintf(o, "mr=%d\n", h->mr);
- if (h->rp)
+ }
+ if (h->rp) {
fprintf(o, "rp=1\n");
+ }
fclose(o);
- if (rename(fn, fn2))
+ if (rename(fn, fn2)) {
unlink(fn);
- else
+ } else {
ast_log(LOG_EVENT, "Received to %s\n", fn2);
+ }
}
/*! \brief read dir skipping dot files... */
@@ -1019,8 +1074,8 @@
static unsigned char sms_handleincoming (sms_t * h)
{
unsigned char p = 3;
- if (h->smsc) { /* SMSC */
- if ((h->imsg[2] & 3) == 1) { /* SMS-SUBMIT */
+ if (h->smsc) { /* SMSC */
+ if ((h->imsg[2] & 3) == 1) { /* SMS-SUBMIT */
h->udhl = h->udl = 0;
h->vp = 0;
h->srr = ((h->imsg[2] & 0x20) ? 1 : 0);
@@ -1032,21 +1087,23 @@
p += unpackaddress(h->da, h->imsg + p);
h->pid = h->imsg[p++];
h->dcs = h->imsg[p++];
- if ((h->imsg[2] & 0x18) == 0x10) { /* relative VP */
- if (h->imsg[p] < 144)
+ if ((h->imsg[2] & 0x18) == 0x10) { /* relative VP */
+ if (h->imsg[p] < 144) {
h->vp = (h->imsg[p] + 1) * 5;
- else if (h->imsg[p] < 168)
+ } else if (h->imsg[p] < 168) {
h->vp = 720 + (h->imsg[p] - 143) * 30;
- else if (h->imsg[p] < 197)
+ } else if (h->imsg[p] < 197) {
h->vp = (h->imsg[p] - 166) * 1440;
- else
+ } else {
h->vp = (h->imsg[p] - 192) * 10080;
+ }
p++;
- } else if (h->imsg[2] & 0x18)
- p += 7; /* ignore enhanced / absolute VP */
+ } else if (h->imsg[2] & 0x18) {
+ p += 7; /* ignore enhanced / absolute VP */
+ }
p += unpacksms(h->dcs, h->imsg + p, h->udh, &h->udhl, h->ud, &h->udl, h->udhi);
- h->rx = 1; /* received message */
- sms_writefile(h); /* write the file */
+ h->rx = 1; /* received message */
+ sms_writefile(h); /* write the file */
if (p != h->imsg[1] + 2) {
ast_log(LOG_WARNING, "Mismatch receive unpacking %d/%d\n", p, h->imsg[1] + 2);
return 0xFF; /* duh! */
@@ -1055,8 +1112,8 @@
ast_log(LOG_WARNING, "Unknown message type %02X\n", h->imsg[2]);
return 0xFF;
}
- } else { /* client */
- if (!(h->imsg[2] & 3)) { /* SMS-DELIVER */
+ } else { /* client */
+ if (!(h->imsg[2] & 3)) { /* SMS-DELIVER */
*h->da = h->srr = h->rp = h->vp = h->udhi = h->udhl = h->udl = 0;
h->srr = ((h->imsg[2] & 0x20) ? 1 : 0);
h->udhi = ((h->imsg[2] & 0x40) ? 1 : 0);
@@ -1068,18 +1125,18 @@
h->scts = unpackdate(h->imsg + p);
p += 7;
p += unpacksms(h->dcs, h->imsg + p, h->udh, &h->udhl, h->ud, &h->udl, h->udhi);
- h->rx = 1; /* received message */
- sms_writefile(h); /* write the file */
+ h->rx = 1; /* received message */
+ sms_writefile(h); /* write the file */
if (p != h->imsg[1] + 2) {
ast_log(LOG_WARNING, "Mismatch receive unpacking %d/%d\n", p, h->imsg[1] + 2);
- return 0xFF; /* duh! */
+ return 0xFF; /* duh! */
}
} else {
ast_log(LOG_WARNING, "Unknown message type %02X\n", h->imsg[2]);
return 0xFF;
}
}
- return 0; /* no error */
+ return 0; /* no error */
}
#ifdef SOLARIS
@@ -1092,25 +1149,27 @@
*/
static void adddata_proto2(sms_t *h, unsigned char msg, char *data, int size)
{
- int x = h->omsg[1]+2; /* Get current position */
- if (x == 2)
- x += 2; /* First: skip Payload length (set later) */
- h->omsg[x++] = msg; /* Message code */
- h->omsg[x++] = (unsigned char)size; /* Data size Low */
- h->omsg[x++] = 0; /* Data size Hi */
- for (; size > 0 ; size--)
+ int x = h->omsg[1] + 2; /* Get current position */
+ if (x == 2) {
+ x += 2; /* First: skip Payload length (set later) */
+ }
+ h->omsg[x++] = msg; /* Message code */
+ h->omsg[x++] = (unsigned char)size; /* Data size Low */
+ h->omsg[x++] = 0; /* Data size Hi */
+ for (; size > 0 ; size--) {
h->omsg[x++] = *data++;
- h->omsg[1] = x - 2; /* Frame size */
- h->omsg[2] = x - 4; /* Payload length (Lo) */
- h->omsg[3] = 0; /* Payload length (Hi) */
+ }
+ h->omsg[1] = x - 2; /* Frame size */
+ h->omsg[2] = x - 4; /* Payload length (Lo) */
+ h->omsg[3] = 0; /* Payload length (Hi) */
}
static void putdummydata_proto2(sms_t *h)
{
- adddata_proto2(h, 0x10, "\0", 1); /* Media Identifier > SMS */
- adddata_proto2(h, 0x11, "\0\0\0\0\0\0", 6); /* Firmware version */
- adddata_proto2(h, 0x12, "\2\0\4", 3); /* SMS provider ID */
- adddata_proto2(h, 0x13, h->udtxt, h->udl); /* Body */
+ adddata_proto2(h, 0x10, "\0", 1); /* Media Identifier > SMS */
+ adddata_proto2(h, 0x11, "\0\0\0\0\0\0", 6); /* Firmware version */
+ adddata_proto2(h, 0x12, "\2\0\4", 3); /* SMS provider ID */
+ adddata_proto2(h, 0x13, h->udtxt, h->udl); /* Body */
}
static void sms_compose2(sms_t *h, int more)
@@ -1119,25 +1178,27 @@
struct timeval now = h->scts;
char stm[9];
- h->omsg[0] = 0x00; /* set later... */
+ h->omsg[0] = 0x00; /* set later... */
h->omsg[1] = 0;
putdummydata_proto2(h);
- if (h->smsc) { /* deliver */
- h->omsg[0] = 0x11; /* SMS_DELIVERY */
+ if (h->smsc) { /* deliver */
+ h->omsg[0] = 0x11; /* SMS_DELIVERY */
/* Required: 10 11 12 13 14 15 17 (seems they must be ordered!) */
ast_localtime(&now, &tm, NULL);
- sprintf(stm, "%02d%02d%02d%02d", tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min); /* Date mmddHHMM */
- adddata_proto2(h, 0x14, stm, 8); /* Date */
- if (*h->oa == 0)
+ sprintf(stm, "%02d%02d%02d%02d", tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min); /* Date mmddHHMM */
+ adddata_proto2(h, 0x14, stm, 8); /* Date */
+ if (*h->oa == 0) {
strcpy(h->oa, "00000000");
+ }
adddata_proto2(h, 0x15, h->oa, strlen(h->oa)); /* Originator */
- adddata_proto2(h, 0x17, "\1", 1); /* Calling Terminal ID */
- } else { /* submit */
- h->omsg[0] = 0x10; /* SMS_SUBMIT */
+ adddata_proto2(h, 0x17, "\1", 1); /* Calling Terminal ID */
+ } else { /* submit */
+ h->omsg[0] = 0x10; /* SMS_SUBMIT */
/* Required: 10 11 12 13 17 18 1B 1C (seems they must be ordered!) */
- adddata_proto2(h, 0x17, "\1", 1); /* Calling Terminal ID */
- if (*h->da == 0)
+ adddata_proto2(h, 0x17, "\1", 1); /* Calling Terminal ID */
+ if (*h->da == 0) {
strcpy(h->da, "00000000");
+ }
adddata_proto2(h, 0x18, h->da, strlen(h->da)); /* Originator */
adddata_proto2(h, 0x1B, "\1", 1); /* Called Terminal ID */
adddata_proto2(h, 0x1C, "\0\0\0", 3); /* Notification */
@@ -1152,8 +1213,9 @@
char *p;
int f;
- for (p = s, f = 0; f < size && f < MAX_DEBUG_LEN; f++, p += 3)
+ for (p = s, f = 0; f < size && f < MAX_DEBUG_LEN; f++, p += 3) {
sprintf(p, "%02X ", (unsigned char)buf[f]);
+ }
return(s);
}
@@ -1177,15 +1239,17 @@
msgsz = h->imsg[f++];
msgsz += (h->imsg[f++] * 256);
switch (msg) {
- case 0x13: /* Body */
+ case 0x13: /* Body */
ast_verb(3, "SMS-P2 Body#%02X=[%.*s]\n", msg, msgsz, &h->imsg[f]);
- if (msgsz >= sizeof(h->imsg))
+ if (msgsz >= sizeof(h->imsg)) {
msgsz = sizeof(h->imsg) - 1;
- for (i = 0; i < msgsz; i++)
+ }
+ for (i = 0; i < msgsz; i++) {
h->ud[i] = h->imsg[f + i];
+ }
h->udl = msgsz;
break;
- case 0x14: /* Date SCTS */
+ case 0x14: /* Date SCTS */
now = h->scts = ast_tvnow();
ast_localtime(&now, &tm, NULL);
tm.tm_mon = ( (h->imsg[f] * 10) + h->imsg[f + 1] ) - 1;
@@ -1196,30 +1260,32 @@
h->scts = ast_mktime(&tm, NULL);
ast_verb(3, "SMS-P2 Date#%02X=%02d/%02d %02d:%02d\n", msg, tm.tm_mday, tm.tm_mon + 1, tm.tm_hour, tm.tm_min);
break;
- case 0x15: /* Calling line (from SMSC) */
- if (msgsz >= 20)
+ case 0x15: /* Calling line (from SMSC) */
+ if (msgsz >= 20) {
msgsz = 20 - 1;
+ }
ast_verb(3, "SMS-P2 Origin#%02X=[%.*s]\n", msg, msgsz, &h->imsg[f]);
ast_copy_string(h->oa, (char *)(&h->imsg[f]), msgsz + 1);
break;
- case 0x18: /* Destination(from TE/phone) */
- if (msgsz >= 20)
+ case 0x18: /* Destination(from TE/phone) */
+ if (msgsz >= 20) {
msgsz = 20 - 1;
+ }
ast_verb(3, "SMS-P2 Destination#%02X=[%.*s]\n", msg, msgsz, &h->imsg[f]);
ast_copy_string(h->da, (char *)(&h->imsg[f]), msgsz + 1);
break;
- case 0x1C: /* Notify */
+ case 0x1C: /* Notify */
ast_verb(3, "SMS-P2 Notify#%02X=%s\n", msg, sms_hexdump(&h->imsg[f], 3, debug_buf));
break;
default:
ast_verb(3, "SMS-P2 Par#%02X [%d]: %s\n", msg, msgsz, sms_hexdump(&h->imsg[f], msgsz, debug_buf));
break;
}
- f+=msgsz; /* Skip to next */
- }
- h->rx = 1; /* received message */
- sms_writefile(h); /* write the file */
- return 0; /* no error */
+ f+=msgsz; /* Skip to next */
+ }
+ h->rx = 1; /* received message */
+ sms_writefile(h); /* write the file */
+ return 0; /* no error */
}
#if 0
@@ -1243,30 +1309,31 @@
#define DLL2_ACK(h) ((h->framenumber & 1) ? DLL2_SMS_ACK1: DLL2_SMS_ACK1)
switch (p) {
- case DLL2_SMS_EST: /* Protocol 2: Connection ready (fake): send message */
+ case DLL2_SMS_EST: /* Protocol 2: Connection ready (fake): send message */
sms_nextoutgoing (h);
/* smssend(h,"11 29 27 00 10 01 00 00 11 06 00 00 00 00 00 00 00 12 03 00 02 00 04 13 01 00 41 14 08 00 30 39 31 35 30 02 30 02 15 02 00 39 30 "); */
break;
- case DLL2_SMS_INFO_MO: /* transport SMS_SUBMIT */
- case DLL2_SMS_INFO_MT: /* transport SMS_DELIVERY */
+ case DLL2_SMS_INFO_MO: /* transport SMS_SUBMIT */
+ case DLL2_SMS_INFO_MT: /* transport SMS_DELIVERY */
cause = sms_handleincoming_proto2(h);
- if (!cause) /* ACK */
+ if (!cause) { /* ACK */
sms_log(h, 'Y');
+ }
h->omsg[0] = DLL2_ACK(h);
- h->omsg[1] = 0x06; /* msg len */
- h->omsg[2] = 0x04; /* payload len */
- h->omsg[3] = 0x00; /* payload len */
- h->omsg[4] = 0x1f; /* Response type */
- h->omsg[5] = 0x01; /* parameter len */
- h->omsg[6] = 0x00; /* parameter len */
- h->omsg[7] = cause; /* CONFIRM or error */
+ h->omsg[1] = 0x06; /* msg len */
+ h->omsg[2] = 0x04; /* payload len */
+ h->omsg[3] = 0x00; /* payload len */
+ h->omsg[4] = 0x1f; /* Response type */
+ h->omsg[5] = 0x01; /* parameter len */
+ h->omsg[6] = 0x00; /* parameter len */
+ h->omsg[7] = cause; /* CONFIRM or error */
sms_messagetx(h);
break;
- case DLL2_SMS_NACK: /* Protocol 2: SMS_NAK */
- h->omsg[0] = DLL2_SMS_REL; /* SMS_REL */
- h->omsg[1] = 0x00; /* msg len */
+ case DLL2_SMS_NACK: /* Protocol 2: SMS_NAK */
+ h->omsg[0] = DLL2_SMS_REL; /* SMS_REL */
+ h->omsg[1] = 0x00; /* msg len */
sms_messagetx(h);
break;
@@ -1275,7 +1342,7 @@
/* SMS_ACK also transport SMS_SUBMIT or SMS_DELIVERY */
if ( (h->omsg[0] & DLL_SMS_MASK) == DLL2_SMS_REL) {
/* a response to our Release, just hangup */
- h->hangup = 1; /* hangup */
+ h->hangup = 1; /* hangup */
} else {
/* XXX depending on what we are.. */
ast_log(LOG_NOTICE, "SMS_SUBMIT or SMS_DELIVERY");
@@ -1283,7 +1350,7 @@
}
break;
- case DLL2_SMS_REL: /* Protocol 2: SMS_REL (hangup req) */
+ case DLL2_SMS_REL: /* Protocol 2: SMS_REL (hangup req) */
h->omsg[0] = DLL2_ACK(h);
h->omsg[1] = 0;
sms_messagetx(h);
@@ -1294,10 +1361,10 @@
/*! \brief compose a message for protocol 1 */
static void sms_compose1(sms_t *h, int more)
{
- unsigned int p = 2; /* next byte to write. Skip type and len */
-
- h->omsg[0] = 0x91; /* SMS_DATA */
- if (h->smsc) { /* deliver */
+ unsigned int p = 2; /* next byte to write. Skip type and len */
+
+ h->omsg[0] = 0x91; /* SMS_DATA */
[... 609 lines stripped ...]
More information about the asterisk-commits
mailing list