[asterisk-commits] jrose: trunk r356987 - in /trunk: ./ channels/ channels/sip/include/ configs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 27 10:24:24 CST 2012
Author: jrose
Date: Mon Feb 27 10:24:17 2012
New Revision: 356987
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=356987
Log:
Adds an option to sip.conf that prevents diversion headers from being added.
send_diversion=no will prevent Diversion headers from being added to SIP
requests. This doesn't prevent Diversion from being added with dialplan
such as with SIPAddHeader.
(closes issue ASTERISK-16862)
Reported by: rsw686
Review: https://reviewboard.asterisk.org/r/1769/
Modified:
trunk/CHANGES
trunk/channels/chan_sip.c
trunk/channels/sip/include/sip.h
trunk/configs/sip.conf.sample
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=356987&r1=356986&r2=356987
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Feb 27 10:24:17 2012
@@ -65,6 +65,8 @@
which set the force_rport and comedia options automatically if Asterisk
detects that an incoming SIP request crossed a NAT after being sent by
the remote endpoint.
+ * Adds an option send_diversion which can be disabled to prevent
+ diversion headers from automatically being added to invites.
Chan_local changes
------------------
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=356987&r1=356986&r2=356987
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Feb 27 10:24:17 2012
@@ -12542,6 +12542,11 @@
const char *reason;
char header_text[256];
+ /* We skip this entirely if the configuration doesn't allow diversion headers */
+ if (!sip_cfg.send_diversion) {
+ return;
+ }
+
if (!pvt->owner) {
return;
}
@@ -18827,6 +18832,7 @@
ast_cli(a->fd, " Trust RPID: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_TRUSTRPID)));
ast_cli(a->fd, " Send RPID: %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_SENDRPID)));
ast_cli(a->fd, " Legacy userfield parse: %s\n", AST_CLI_YESNO(sip_cfg.legacy_useroption_parsing));
+ ast_cli(a->fd, " Send Diversion: %s\n", AST_CLI_YESNO(sip_cfg.send_diversion));
ast_cli(a->fd, " Caller ID: %s\n", default_callerid);
if ((default_fromdomainport) && (default_fromdomainport != STANDARD_SIP_PORT)) {
ast_cli(a->fd, " From: Domain: %s:%d\n", default_fromdomain, default_fromdomainport);
@@ -29166,6 +29172,7 @@
sip_set_default_format_capabilities(sip_cfg.caps);
sip_cfg.regextenonqualify = DEFAULT_REGEXTENONQUALIFY;
sip_cfg.legacy_useroption_parsing = DEFAULT_LEGACY_USEROPTION_PARSING;
+ sip_cfg.send_diversion = DEFAULT_SEND_DIVERSION;
sip_cfg.notifyringing = DEFAULT_NOTIFYRINGING;
sip_cfg.notifycid = DEFAULT_NOTIFYCID;
sip_cfg.notifyhold = FALSE; /*!< Keep track of hold status for a peer */
@@ -29467,6 +29474,8 @@
sip_cfg.regextenonqualify = ast_true(v->value);
} else if (!strcasecmp(v->name, "legacy_useroption_parsing")) {
sip_cfg.legacy_useroption_parsing = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "send_diversion")) {
+ sip_cfg.send_diversion = ast_true(v->value);
} else if (!strcasecmp(v->name, "callerid")) {
ast_copy_string(default_callerid, v->value, sizeof(default_callerid));
} else if (!strcasecmp(v->name, "mwi_from")) {
Modified: trunk/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/include/sip.h?view=diff&rev=356987&r1=356986&r2=356987
==============================================================================
--- trunk/channels/sip/include/sip.h (original)
+++ trunk/channels/sip/include/sip.h Mon Feb 27 10:24:17 2012
@@ -219,6 +219,7 @@
#define DEFAULT_ACCEPT_OUTOFCALL_MESSAGE TRUE
#define DEFAULT_REGEXTENONQUALIFY FALSE
#define DEFAULT_LEGACY_USEROPTION_PARSING FALSE
+#define DEFAULT_SEND_DIVERSION TRUE
#define DEFAULT_T1MIN 100 /*!< 100 MS for minimal roundtrip time */
#define DEFAULT_MAX_CALL_BITRATE (384) /*!< Max bitrate for video */
#ifndef DEFAULT_USERAGENT
@@ -733,6 +734,7 @@
int callevents; /*!< Whether we send manager events or not */
int regextenonqualify; /*!< Whether to add/remove regexten when qualifying peers */
int legacy_useroption_parsing; /*!< Whether to strip useroptions in URI via semicolons */
+ int send_diversion; /*!< Whether to Send SIP Diversion headers */
int matchexternaddrlocally; /*!< Match externaddr/externhost setting against localnet setting */
char regcontext[AST_MAX_CONTEXT]; /*!< Context for auto-extensions */
char messagecontext[AST_MAX_CONTEXT]; /*!< Default context for out of dialog msgs. */
Modified: trunk/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=356987&r1=356986&r2=356987
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Mon Feb 27 10:24:17 2012
@@ -475,6 +475,11 @@
; for improving compatability with devices that like to use
; user options for whatever reason. The behavior is similar to
; how SIP URI's were typically handled in 1.6.2, hence the name.
+
+;send_diversion=no ; Default "yes" ; Asterisk normally sends Diversion headers with certain SIP
+ ; invites to relay data about forwarded calls. If this option
+ ; is disabled, Asterisk won't send Diversion headers unless
+ ; they are added manually.
; The shrinkcallerid function removes '(', ' ', ')', non-trailing '.', and '-' not
; in square brackets. For example, the caller id value 555.5555 becomes 5555555
More information about the asterisk-commits
mailing list