[Asterisk-code-review] res pjsip: Allow global headers to be overridden. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed Sep 7 16:02:03 CDT 2016


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/3842

Change subject: res_pjsip: Allow global headers to be overridden.
......................................................................

res_pjsip: Allow global headers to be overridden.

Currently when you add global headers from the dialplan both
the header in the dialplan and the globally configured header
are added to the resulting SIP INVITE. This change makes it
so the headers in the dialplan take precedence and are the
only ones added.

Change-Id: I36f864298f38db3632ad503edc11267cb8ffb3ad
---
M res/res_pjsip/pjsip_global_headers.c
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/42/3842/1

diff --git a/res/res_pjsip/pjsip_global_headers.c b/res/res_pjsip/pjsip_global_headers.c
index 735008d..501f5f5 100644
--- a/res/res_pjsip/pjsip_global_headers.c
+++ b/res/res_pjsip/pjsip_global_headers.c
@@ -87,6 +87,14 @@
 		return;
 	}
 	AST_LIST_TRAVERSE(headers, iter, next) {
+		pj_str_t name;
+		pjsip_generic_string_hdr *hdr;
+
+		hdr = pjsip_msg_find_hdr_by_name(tdata->msg, pj_cstr(&name, iter->name), NULL);
+		if (hdr) {
+			continue;
+		}
+
 		ast_sip_add_header(tdata, iter->name, iter->value);
 	};
 	tdata->mod_data[global_header_mod.id] = &handled_id;

-- 
To view, visit https://gerrit.asterisk.org/3842
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36f864298f38db3632ad503edc11267cb8ffb3ad
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list