]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Improve consistency of party ID privacy usage.
authorMark Michelson <mmichelson@digium.com>
Thu, 21 Aug 2014 21:14:20 +0000 (21:14 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 21 Aug 2014 21:14:20 +0000 (21:14 +0000)
Prior to this change, the Remote-Party-ID header took the position of
"If caller name and number are not explicitly allowed, then they are private"
and P-Asserted-Identity took the position of
"Caller name and number are only private if marked explicitly so"

Now both mechanisms of conveying party identification use the former approach.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@421778 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_pjsip_caller_id.c

index 691cafb8900dd1ef849a34450e8fc6b8ed164a75..90d413579f962a01e45184f39ac2feba338c7dd8 100644 (file)
@@ -467,17 +467,15 @@ static void add_privacy_header(pjsip_tx_data *tdata, const struct ast_party_id *
 
        old_privacy = pjsip_msg_find_hdr_by_name(tdata->msg, &pj_privacy_name, NULL);
 
-       if ((id->name.presentation & AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED ||
-                       (id->name.presentation & AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED) {
-               if (!old_privacy) {
-                       pjsip_generic_string_hdr *privacy_hdr = pjsip_generic_string_hdr_create(
-                                       tdata->pool, &pj_privacy_name, &pj_privacy_value);
-                       pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *)privacy_hdr);
-               }
-       } else {
+       if ((id->name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED &&
+                       (id->name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) {
                if (old_privacy) {
                        pj_list_erase(old_privacy);
                }
+       } else if (!old_privacy) {
+               pjsip_generic_string_hdr *privacy_hdr = pjsip_generic_string_hdr_create(
+                               tdata->pool, &pj_privacy_name, &pj_privacy_value);
+               pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *)privacy_hdr);
        }
 }