]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fixes missing Contact header angle brackets
authorDavid Vossel <dvossel@digium.com>
Mon, 7 Dec 2009 18:07:38 +0000 (18:07 +0000)
committerDavid Vossel <dvossel@digium.com>
Mon, 7 Dec 2009 18:07:38 +0000 (18:07 +0000)
(closes issue #16298)
Reported by: mgernoth
Patches:
      reg_parse_issue_1.4.diff uploaded by dvossel (license 671)
Tested by: dvossel

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

channels/chan_sip.c

index 098f6b6ad52000c6a586dea2b1cf223613657bcc..a40e5aa004015bafde3a9ee73602886c711c68a2 100644 (file)
@@ -6411,7 +6411,9 @@ static int respprep(struct sip_request *resp, struct sip_pvt *p, const char *msg
                add_header(resp, "Expires", tmp);
                if (p->expiry) {        /* Only add contact if we have an expiry time */
                        char contact[SIPBUFSIZE];
-                       snprintf(contact, sizeof(contact), "%s;expires=%d", (p->method == SIP_SUBSCRIBE ? p->our_contact : p->fullcontact), p->expiry);
+                       const char *contact_uri = p->method == SIP_SUBSCRIBE ? p->our_contact : p->fullcontact;
+                       char *brackets = strchr(contact_uri, '<');
+                       snprintf(contact, sizeof(contact), "%s%s%s;expires=%d", brackets ? "" : "<", contact_uri, brackets ? "" : ">", p->expiry);
                        add_header(resp, "Contact", contact);   /* Not when we unregister */
                }
        } else if (!ast_strlen_zero(p->our_contact) && resp_needs_contact(msg, p->method)) {