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

dtryba asteriskteam at digium.com
Mon Oct 2 08:05:28 CDT 2017


dtryba has uploaded this change for review. ( https://gerrit.asterisk.org/6642


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



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

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index aa6813f..05438e8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -18026,7 +18026,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) && strncmp(privacy, "none", 4)) {
 		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 0aca2db..9e74ef8 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==NULL || !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/6642
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: If438a21f31a962da32d7a33ff33bdeb1e776fe56
Gerrit-Change-Number: 6642
Gerrit-PatchSet: 1
Gerrit-Owner: dtryba <daniel at tryba.nl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171002/e5edf7b2/attachment.html>


More information about the asterisk-code-review mailing list