[Asterisk-code-review] res pjsip caller id chan sip: Comply to RFC 3323 values for ... (asterisk[master])

George Joseph asteriskteam at digium.com
Fri Oct 6 11:39:32 CDT 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/6652 )

Change subject: res_pjsip_caller_id chan_sip: Comply to RFC 3323 values for privacy
......................................................................

res_pjsip_caller_id chan_sip: Comply to RFC 3323 values for privacy

Currently privacy requests are only granted if the Privacy header
value is exactly "id" (defined in RFC 3325). It ignores any other
possible value (or a combination there of). This patch reverses the
logic from testing for "id" to grant privacy, to testing for "none" and
granting privacy for any other value. "none" must not be used in
combination with any other value (RFC 3323 section 4.2).

ASTERISK-27284 #close

Change-Id: If438a21f31a962da32d7a33ff33bdeb1e776fe56
---
M channels/chan_sip.c
M res/res_pjsip_caller_id.c
2 files changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8a30e0c..62ff505 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -18127,7 +18127,7 @@
 	}
 
 	ast_copy_string(privacy, sip_get_header(req, "Privacy"), sizeof(privacy));
-	if (!ast_strlen_zero(privacy) && !strncmp(privacy, "id", 2)) {
+	if (!ast_strlen_zero(privacy) && strcasecmp(privacy, "none")) {
 		callingpres = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
 	}
 	if (!cid_name) {
diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index 470d90f..64191a7 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -149,12 +149,12 @@
 	}
 
 	privacy = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &privacy_str, NULL);
-	if (privacy && !pj_stricmp2(&privacy->hvalue, "id")) {
-		id->number.presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
-		id->name.presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
-	} else {
+	if (!privacy || !pj_stricmp2(&privacy->hvalue, "none")) {
 		id->number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
 		id->name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+	} else {
+		id->number.presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
+		id->name.presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
 	}
 
 	return 0;

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If438a21f31a962da32d7a33ff33bdeb1e776fe56
Gerrit-Change-Number: 6652
Gerrit-PatchSet: 1
Gerrit-Owner: dtryba <daniel at tryba.nl>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171006/10e05cf5/attachment.html>


More information about the asterisk-code-review mailing list