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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 8 13:25:58 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

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(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved



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: merged
Gerrit-Change-Id: I36f864298f38db3632ad503edc11267cb8ffb3ad
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list