aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8bae5f760..725b1fbbc 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -9388,7 +9388,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)) {