mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 19:43:03 +00:00
apps/app_sms: Add an option to prevent SMS content from being logged
In some countries, privacy laws specify that SMS content cannot be saved by a provider. This patch adds a new option to the SMS application, 'n', which prevents the SMS content from being written to the SMS log. ASTERISK-22591 #close Reported by: Jan Juergens patches: DisableSmsContentLoggingByParam.patch uploaded by Jan Juergens (License 6538) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
6
CHANGES
6
CHANGES
@@ -26,6 +26,12 @@ ConfBridge
|
|||||||
- record_command: a command to execute when recording is finished
|
- record_command: a command to execute when recording is finished
|
||||||
Note that these options may also be with the CONFBRIDGE function.
|
Note that these options may also be with the CONFBRIDGE function.
|
||||||
|
|
||||||
|
SMS
|
||||||
|
------------------
|
||||||
|
* Added the 'n' option, which prevents the SMS from being written to the log
|
||||||
|
file. This is needed for those countries with privacy laws that require
|
||||||
|
providers to not log SMS content.
|
||||||
|
|
||||||
|
|
||||||
Channel Drivers
|
Channel Drivers
|
||||||
------------------
|
------------------
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
<option name="o">
|
<option name="o">
|
||||||
<para>The body should be coded as octets not 7-bit symbols.</para>
|
<para>The body should be coded as octets not 7-bit symbols.</para>
|
||||||
</option>
|
</option>
|
||||||
|
<option name="n">
|
||||||
|
<para>Do not log any SMS content to log file (privacy).</para>
|
||||||
|
</option>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="addr" />
|
<parameter name="addr" />
|
||||||
@@ -220,6 +223,7 @@ typedef struct sms_s {
|
|||||||
unsigned char sent_rel:1; /*!< have sent REL message... */
|
unsigned char sent_rel:1; /*!< have sent REL message... */
|
||||||
unsigned char smsc:1; /*!< we are SMSC */
|
unsigned char smsc:1; /*!< we are SMSC */
|
||||||
unsigned char rx:1; /*!< this is a received message */
|
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 queue[30]; /*!< queue name */
|
||||||
char oa[20]; /*!< originating address */
|
char oa[20]; /*!< originating address */
|
||||||
char da[20]; /*!< destination address */
|
char da[20]; /*!< destination address */
|
||||||
@@ -790,20 +794,25 @@ static void sms_log(sms_t * h, char status)
|
|||||||
status, h->rx ? 'I' : 'O', h->smsc ? 'S' : 'M', mrs, h->queue,
|
status, h->rx ? 'I' : 'O', h->smsc ? 'S' : 'M', mrs, h->queue,
|
||||||
S_OR(h->oa, "-"), S_OR(h->da, "-") );
|
S_OR(h->oa, "-"), S_OR(h->da, "-") );
|
||||||
p = line + strlen(line);
|
p = line + strlen(line);
|
||||||
for (n = 0; n < h->udl; n++) {
|
|
||||||
if (h->ud[n] == '\\') {
|
if (h->nolog) {
|
||||||
*p++ = '\\';
|
p += snprintf(p, 1000 - strlen(line), "udl=%d", h->udl);
|
||||||
*p++ = '\\';
|
} else {
|
||||||
} else if (h->ud[n] == '\n') {
|
for (n = 0; n < h->udl; n++) {
|
||||||
*p++ = '\\';
|
if (h->ud[n] == '\\') {
|
||||||
*p++ = 'n';
|
*p++ = '\\';
|
||||||
} else if (h->ud[n] == '\r') {
|
*p++ = '\\';
|
||||||
*p++ = '\\';
|
} else if (h->ud[n] == '\n') {
|
||||||
*p++ = 'r';
|
*p++ = '\\';
|
||||||
} else if (h->ud[n] < 32 || h->ud[n] == 127) {
|
*p++ = 'n';
|
||||||
*p++ = 191;
|
} else if (h->ud[n] == '\r') {
|
||||||
} else {
|
*p++ = '\\';
|
||||||
*p++ = h->ud[n];
|
*p++ = 'r';
|
||||||
|
} else if (h->ud[n] < 32 || h->ud[n] == 127) {
|
||||||
|
*p++ = 191;
|
||||||
|
} else {
|
||||||
|
*p++ = h->ud[n];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*p++ = '\n';
|
*p++ = '\n';
|
||||||
@@ -1853,6 +1862,7 @@ enum sms_flags {
|
|||||||
OPTION_PAUSE = (1 << 3), /* pause before sending data, in ms */
|
OPTION_PAUSE = (1 << 3), /* pause before sending data, in ms */
|
||||||
OPTION_SRR = (1 << 4), /* set srr */
|
OPTION_SRR = (1 << 4), /* set srr */
|
||||||
OPTION_DCS = (1 << 5), /* set dcs */
|
OPTION_DCS = (1 << 5), /* set dcs */
|
||||||
|
OPTIONS_NO_LOG = (1 << 6), /* Don't log SMS content */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sms_opt_args {
|
enum sms_opt_args {
|
||||||
@@ -1866,6 +1876,7 @@ AST_APP_OPTIONS(sms_options, {
|
|||||||
AST_APP_OPTION('t', OPTION_TWO),
|
AST_APP_OPTION('t', OPTION_TWO),
|
||||||
AST_APP_OPTION('r', OPTION_SRR),
|
AST_APP_OPTION('r', OPTION_SRR),
|
||||||
AST_APP_OPTION('o', OPTION_DCS),
|
AST_APP_OPTION('o', OPTION_DCS),
|
||||||
|
AST_APP_OPTION('n', OPTIONS_NO_LOG),
|
||||||
AST_APP_OPTION_ARG('p', OPTION_PAUSE, OPTION_ARG_PAUSE),
|
AST_APP_OPTION_ARG('p', OPTION_PAUSE, OPTION_ARG_PAUSE),
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@@ -1926,6 +1937,7 @@ static int sms_exec(struct ast_channel *chan, const char *data)
|
|||||||
|
|
||||||
h.smsc = ast_test_flag(&flags, OPTION_BE_SMSC);
|
h.smsc = ast_test_flag(&flags, OPTION_BE_SMSC);
|
||||||
h.protocol = ast_test_flag(&flags, OPTION_TWO) ? 2 : 1;
|
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])) {
|
if (!ast_strlen_zero(sms_opts[OPTION_ARG_PAUSE])) {
|
||||||
h.opause_0 = atoi(sms_opts[OPTION_ARG_PAUSE]);
|
h.opause_0 = atoi(sms_opts[OPTION_ARG_PAUSE]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user