[Asterisk-code-review] res pjsip: Fix known compact header issues (asterisk[master])

Joshua Colp asteriskteam at digium.com
Mon Jan 9 07:23:18 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4689 )

Change subject: res_pjsip: Fix known compact header issues
......................................................................


res_pjsip: Fix known compact header issues

ASTERISK-26684 #close

Change-Id: Ifd7e401c45015119dd5e8421dbfe3afa6381744a
---
M res/res_pjsip.c
M res/res_pjsip_diversion.c
M res/res_pjsip_refer.c
3 files changed, 7 insertions(+), 4 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 6df9b70..a7dd09e 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3246,8 +3246,9 @@
 		pjsip_contact_hdr *contact_hdr;
 		pjsip_sip_uri *contact_uri;
 		static const pj_str_t HCONTACT = { "Contact", 7 };
+		static const pj_str_t HCONTACTSHORT = { "m", 1 };
 
-		contact_hdr = pjsip_msg_find_hdr_by_name((*tdata)->msg, &HCONTACT, NULL);
+		contact_hdr = pjsip_msg_find_hdr_by_names((*tdata)->msg, &HCONTACT, &HCONTACTSHORT, NULL);
 		if (contact_hdr) {
 			contact_uri = pjsip_uri_get_uri(contact_hdr->uri);
 			pj_strdup2(pool, &contact_uri->user, endpoint->contact_user);
diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 301d9fc..efb5489 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -277,6 +277,7 @@
 static void diversion_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata)
 {
 	static const pj_str_t contact_name = { "Contact", 7 };
+	static const pj_str_t contact_name_s = { "m", 1 };
 
 	pjsip_status_line status = rdata->msg_info.msg->line.status;
 	pjsip_fromto_hdr *div_hdr;
@@ -292,7 +293,7 @@
 		div_hdr = PJSIP_MSG_TO_HDR(rdata->msg_info.msg);
 	}
 
-	contact_hdr = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &contact_name, NULL);
+	contact_hdr = pjsip_msg_find_hdr_by_names(rdata->msg_info.msg, &contact_name, &contact_name_s, NULL);
 
 	set_redirecting(session, div_hdr, contact_hdr ?	(pjsip_name_addr*)contact_hdr->uri :
 			(pjsip_name_addr*)PJSIP_MSG_FROM_HDR(rdata->msg_info.msg)->uri);
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index c1dee82..107a3e7 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -573,6 +573,7 @@
 	pjsip_generic_string_hdr *referred_by;
 
 	static const pj_str_t str_referred_by = { "Referred-By", 11 };
+	static const pj_str_t str_referred_by_s = { "b", 1 };
 
 	pbx_builtin_setvar_helper(chan, "SIPTRANSFER", "yes");
 
@@ -651,8 +652,8 @@
 
 	pbx_builtin_setvar_helper(chan, "SIPREFERRINGCONTEXT", S_OR(refer->context, NULL));
 
-	referred_by = pjsip_msg_find_hdr_by_name(refer->rdata->msg_info.msg,
-		&str_referred_by, NULL);
+	referred_by = pjsip_msg_find_hdr_by_names(refer->rdata->msg_info.msg,
+		&str_referred_by, &str_referred_by_s, NULL);
 	if (referred_by) {
 		size_t uri_size = pj_strlen(&referred_by->hvalue) + 1;
 		char *uri = ast_alloca(uri_size);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd7e401c45015119dd5e8421dbfe3afa6381744a
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Elson <joshelson at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list