]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Send real CallerID information with P-Assserted-Identity (RFC-3325)
authorJonathan Rose <jrose@digium.com>
Wed, 26 Mar 2014 15:50:48 +0000 (15:50 +0000)
committerJonathan Rose <jrose@digium.com>
Wed, 26 Mar 2014 15:50:48 +0000 (15:50 +0000)
Prior too this patch, the P-Asserted-Identity header would include anonymous
caller id information which seems to go against the point of the
P-Asserted-Identity header. Now the real caller ID information will be
included in this header. Also, no privacy header would be included.
This patch adds 'Privacy: id' to outgoing SIP messages that include the
P-Asserted-Identity header.

(closes issue AST-1301)

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

channels/chan_sip.c
configs/sip.conf.sample

index e78ebfa99c3726943311a50404b80702fa163d5b..8f01e9a407a55e1cf964af8d18703e51aae70748 100644 (file)
@@ -11406,7 +11406,6 @@ static int add_rpid(struct sip_request *req, struct sip_pvt *p)
        const char *fromdomain;
        const char *privacy = NULL;
        const char *screen = NULL;
-       const char *anonymous_string = "\"Anonymous\" <sip:anonymous@anonymous.invalid>";
 
        if (!ast_test_flag(&p->flags[0], SIP_SENDRPID)) {
                return 0;
@@ -11434,12 +11433,11 @@ static int add_rpid(struct sip_request *req, struct sip_pvt *p)
        lid_num = ast_uri_encode(lid_num, tmp2, sizeof(tmp2), 0);
 
        if (ast_test_flag(&p->flags[0], SIP_SENDRPID_PAI)) {
+               ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+               add_header(req, "P-Asserted-Identity", ast_str_buffer(tmp));
                if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) {
-                       ast_str_set(&tmp, -1, "%s", anonymous_string);
-               } else {
-                       ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+                       add_header(req, "Privacy", "id");
                }
-               add_header(req, "P-Asserted-Identity", ast_str_buffer(tmp));
        } else {
                ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>;party=%s", lid_name, lid_num, fromdomain, p->outgoing_call ? "calling" : "called");
 
index cd12029bdc561f2325724578e8f8a533d53784ea..3e1cb08a8daee8d17184d6e41047d267fe1a45ed 100644 (file)
@@ -1301,7 +1301,8 @@ srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
 ;allow=g723.1                    ; Asterisk only supports g723.1 pass-thru!
 ;allow=g729                      ; Pass-thru only unless g729 license obtained
 ;callingpres=allowed_passed_screen ; Set caller ID presentation
-                                 ; See README.callingpres for more information
+                                 ; See function CALLERPRES documentation for possible
+                                 ; values.
 
 ;[xlite1]
 ; Turn off silence suppression in X-Lite ("Transmit Silence"=YES)!