Index: apps/app_sms.c
===================================================================
--- apps/app_sms.c (revision 401881)
+++ apps/app_sms.c (working copy)
@@ -87,6 +87,9 @@
+
@@ -218,6 +221,7 @@
unsigned char err; /*!< set for any errors */
unsigned char smsc:1; /*!< we are SMSC */
unsigned char rx:1; /*!< this is a received message */
+ unsigned char nolog:1; /*!< do not log plain text SMS content (privacy) */
char queue[30]; /*!< queue name */
char oa[20]; /*!< originating address */
char da[20]; /*!< destination address */
@@ -787,20 +791,28 @@
status, h->rx ? 'I' : 'O', h->smsc ? 'S' : 'M', mrs, h->queue,
S_OR(h->oa, "-"), S_OR(h->da, "-") );
p = line + strlen(line);
- for (n = 0; n < h->udl; n++) {
- if (h->ud[n] == '\\') {
- *p++ = '\\';
- *p++ = '\\';
- } else if (h->ud[n] == '\n') {
- *p++ = '\\';
- *p++ = 'n';
- } else if (h->ud[n] == '\r') {
- *p++ = '\\';
- *p++ = 'r';
- } else if (h->ud[n] < 32 || h->ud[n] == 127) {
- *p++ = 191;
- } else {
- *p++ = h->ud[n];
+
+ if(h->nolog)
+ {
+ p += snprintf(p, 1000 - strlen(line), "udl=%d", h->udl);
+ }
+ else
+ {
+ for (n = 0; n < h->udl; n++) {
+ if (h->ud[n] == '\\') {
+ *p++ = '\\';
+ *p++ = '\\';
+ } else if (h->ud[n] == '\n') {
+ *p++ = '\\';
+ *p++ = 'n';
+ } else if (h->ud[n] == '\r') {
+ *p++ = '\\';
+ *p++ = 'r';
+ } else if (h->ud[n] < 32 || h->ud[n] == 127) {
+ *p++ = 191;
+ } else {
+ *p++ = h->ud[n];
+ }
}
}
*p++ = '\n';
@@ -1843,6 +1855,7 @@
OPTION_PAUSE = (1 << 3), /* pause before sending data, in ms */
OPTION_SRR = (1 << 4), /* set srr */
OPTION_DCS = (1 << 5), /* set dcs */
+ OPTIONS_NO_LOG = (1 << 6), /* Don't log SMS content */
};
enum sms_opt_args {
@@ -1856,6 +1869,7 @@
AST_APP_OPTION('t', OPTION_TWO),
AST_APP_OPTION('r', OPTION_SRR),
AST_APP_OPTION('o', OPTION_DCS),
+ AST_APP_OPTION('n', OPTIONS_NO_LOG),
AST_APP_OPTION_ARG('p', OPTION_PAUSE, OPTION_ARG_PAUSE),
} );
@@ -1916,6 +1930,7 @@
h.smsc = ast_test_flag(&flags, OPTION_BE_SMSC);
h.protocol = ast_test_flag(&flags, OPTION_TWO) ? 2 : 1;
+ h.nolog = ast_test_flag(&flags, OPTIONS_NO_LOG) ? 1 : 0;
if (!ast_strlen_zero(sms_opts[OPTION_ARG_PAUSE])) {
h.opause_0 = atoi(sms_opts[OPTION_ARG_PAUSE]);
}