[asterisk-commits] russell: trunk r66777 - in /trunk: channels/chan_sip.c configs/sip.conf.sample

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu May 31 12:41:05 MST 2007


Author: russell
Date: Thu May 31 14:41:03 2007
New Revision: 66777

URL: http://svn.digium.com/view/asterisk?view=rev&rev=66777
Log:
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.

Modified:
    trunk/channels/chan_sip.c
    trunk/configs/sip.conf.sample

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=66777&r1=66776&r2=66777
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu May 31 14:41:03 2007
@@ -533,6 +533,19 @@
 #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 @@
 #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 @@
 {
 	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);
@@ -2398,6 +2415,9 @@
 	if (p->outboundproxy) {
 		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)) {
@@ -17341,6 +17361,14 @@
 	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 @@
 				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 @@
 	clear_sip_domains();
 	close(sipsock);
 	sched_context_destroy(sched);
-		
+
+	if (global_disclaimer)
+		free(global_disclaimer);
+
 	return 0;
 }
 

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=66777&r1=66776&r2=66777
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Thu May 31 14:41:03 2007
@@ -461,6 +461,33 @@
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
 ; 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]



More information about the asterisk-commits mailing list