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/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356987 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2012-02-27 16:24:17 +00:00
parent 9ed6de9fd2
commit 299dd5d4fc
4 changed files with 18 additions and 0 deletions

View File

@@ -12542,6 +12542,11 @@ static void add_diversion_header(struct sip_request *req, struct sip_pvt *pvt)
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 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
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 @@ static int reload_config(enum channelreloadreason reason)
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 @@ static int reload_config(enum channelreloadreason reason)
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")) {