]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_caller_id chan_sip: Comply to RFC 3323 values for privacy
authorDaniel Tryba <daniel@pocos.nl>
Mon, 2 Oct 2017 12:48:41 +0000 (14:48 +0200)
committerDaniel Tryba <daniel@tryba.nl>
Tue, 3 Oct 2017 20:05:33 +0000 (22:05 +0200)
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

channels/chan_sip.c
res/res_pjsip_caller_id.c

index aa6813fd37746ecc57f4e084577b5a108381db9b..724021eeab1c68678466906ee96b9c208c7dc4e5 100644 (file)
@@ -18026,7 +18026,7 @@ static int get_pai(struct sip_pvt *p, struct sip_request *req)
        }
 
        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) {
index 0aca2db2a47cc0a1f11e2e4c8c25f27be7339473..0c1325c47292d00c9e6d0c50989481d108e88d14 100644 (file)
@@ -149,12 +149,12 @@ static int set_id_from_pai(pjsip_rx_data *rdata, struct ast_party_id *id)
        }
 
        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;