summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-05-31 19:41:03 +0000
committerRussell Bryant <russell@russellbryant.com>2007-05-31 19:41:03 +0000
commit3d2b58751fabf5716318acd085543e0b00f11b49 (patch)
tree9be79060aa7fabecfd6415e6d001f2d96f758341
parentce4051a80378d70c9a55a1530844e3d6525ac78e (diff)
To satisfy some legal concerns, add an option for chan_sip to include a
disclaimer along with SIP messages in the header, X-Disclaimer. This is off by default. Also, the text of the disclaimer can be customized in sip.conf. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@66777 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c37
-rw-r--r--configs/sip.conf.sample27
2 files changed, 63 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ebec59f26..2087d191c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -533,6 +533,19 @@ static const struct cfsip_options {
#define DEFAULT_USERAGENT "Asterisk PBX" /*!< Default Useragent: header unless re-defined in sip.conf */
#endif
+/*! An option disclaimer that will be added to all SIP messages. */
+static struct ast_str *global_disclaimer;
+
+#define DEFAULT_DISCLAIMER \
+ "This message and all contents are covered by the Electronic Communications " \
+ "Privacy Act, 18 U.S.C. Sections 2510-2521, is confidential and may be legally " \
+ "privileged. It is intended to be conveyed only to the designated recipient(s). " \
+ "If you are not the intended recipient, you are hereby notified that any " \
+ "retention, dissemination, distribution or copying of this communication is " \
+ "strictly prohibited and that use, dissemination, distribution or reproduction " \
+ "of this message by unintended recipients is not authorized and may be unlawful. " \
+ "Please reply to sender that you have received the message in error, " \
+ "then delete it. Thank you."
/* Default setttings are used as a channel setting and as a default when
configuring devices */
@@ -817,6 +830,7 @@ struct sip_auth {
#define SIP_PAGE2_TEXTSUPPORT (1 << 28) /*!< 28: Global text enable */
#define SIP_PAGE2_DEBUG_TEXT (1 << 29) /*!< 29: Global text debug */
#define SIP_PAGE2_OUTGOING_CALL (1 << 30) /*!< 30: Is this an outgoing call? */
+#define SIP_PAGE2_DISCLAIMER (1 << 31) /*!< 31: Include disclaimer in SIP requests and responses. */
#define SIP_PAGE2_FLAGS_TO_COPY \
(SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
@@ -2364,6 +2378,9 @@ static int send_response(struct sip_pvt *p, struct sip_request *req, enum xmitty
{
int res;
+ if (ast_test_flag(&global_flags[1], SIP_PAGE2_DISCLAIMER) && !ast_strlen_zero(global_disclaimer->str))
+ add_header(req, "X-Disclaimer", global_disclaimer->str);
+
add_blank(req);
if (sip_debug_test_pvt(p)) {
const struct sockaddr_in *dst = sip_real_dst(p);
@@ -2399,6 +2416,9 @@ static int send_request(struct sip_pvt *p, struct sip_request *req, enum xmittyp
p->sa = p->outboundproxy->ip;
}
+ if (ast_test_flag(&global_flags[1], SIP_PAGE2_DISCLAIMER) && !ast_strlen_zero(global_disclaimer->str))
+ add_header(req, "X-Disclaimer", global_disclaimer->str);
+
add_blank(req);
if (sip_debug_test_pvt(p)) {
if (ast_test_flag(&p->flags[0], SIP_NAT_ROUTE))
@@ -17341,6 +17361,14 @@ static int reload_config(enum channelreloadreason reason)
ast_clear_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT);
ast_clear_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT);
+ /* Set the default disclaimer settings */
+ ast_clear_flag(&global_flags[1], SIP_PAGE2_DISCLAIMER);
+ if (!global_disclaimer) {
+ if (!(global_disclaimer = ast_str_create(80)))
+ return -1;
+ }
+ ast_str_set(&global_disclaimer, 0, DEFAULT_DISCLAIMER);
+
/* Read the [general] config section of sip.conf (or from realtime config) */
for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
if (handle_common_options(&global_flags[0], &dummy[0], v))
@@ -17593,6 +17621,10 @@ static int reload_config(enum channelreloadreason reason)
default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE;
} else if (!strcasecmp(v->name, "matchexterniplocally")) {
global_matchexterniplocally = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "enabledisclaimer")) {
+ ast_set2_flag(&global_flags[1], ast_true(v->value), SIP_PAGE2_DISCLAIMER);
+ } else if (!strcasecmp(v->name, "disclaimertext")) {
+ ast_str_set(&global_disclaimer, 0, v->value);
}
}
@@ -18611,7 +18643,10 @@ static int unload_module(void)
clear_sip_domains();
close(sipsock);
sched_context_destroy(sched);
-
+
+ if (global_disclaimer)
+ free(global_disclaimer);
+
return 0;
}
diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample
index b01f37122..2f3342649 100644
--- a/configs/sip.conf.sample
+++ b/configs/sip.conf.sample
@@ -463,6 +463,33 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
;-----------------------------------------------------------------------------------
+;---- Disclaimer Settings ----------------------------------------------------------
+;
+;enabledisclaimer = no ; This option enables sending a disclaimer along with all
+; ; SIP messages. Generally, this would be some sort of legal
+; ; statement. Note that the legal implications of using this
+; ; with a SIP proxy are not quite clear if the disclaimer
+; ; indicates that the message contents can not be used by
+; ; any party excepted the intended recipient, so it should
+; ; probably not be used in a network that contains proxies.
+; ; The default is "no".
+;
+;dislciamertext = Your custom disclaimer here.
+; ; You can configure a custom disclaimer with this option.
+; ; Note that you must keep the entire disclaimer on one line.
+; ; The default text is:
+; ; "This message and all contents are covered by the Electronic Communications "
+; ; "Privacy Act, 18 U.S.C. Sections 2510-2521, is confidential and may be legally "
+; ; "privileged. It is intended to be conveyed only to the designated recipient(s). "
+; ; "If you are not the intended recipient, you are hereby notified that any "
+; ; "retention, dissemination, distribution or copying of this communication is "
+; ; "strictly prohibited and that use, dissemination, distribution or reproduction "
+; ; "of this message by unintended recipients is not authorized and may be unlawful. "
+; ; "Please reply to sender that you have received the message in error, "
+; ; "then delete it. Thank you."
+;
+;-----------------------------------------------------------------------------------
+
[authentication]
; Global credentials for outbound calls, i.e. when a proxy challenges your
; Asterisk server for authentication. These credentials override