diff options
author | Corey Farrell <git@cfware.com> | 2017-10-24 10:43:15 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2017-10-24 11:03:22 -0500 |
commit | c75a7351bd882cb230843351dd4d3262402a3e26 (patch) | |
tree | c95db85934e8b20b0e3583130e4e7e574829ffb1 /channels | |
parent | 558431635c6e7e808d0c20ce186a20223ee3206f (diff) |
chan_sip: Fix SUBSCRIBE with missing "Expires" header.
When chan_sip receives a SUBSCRIBE request with no "Expires" header it
processes the request as an unsubscribe. This is incorrect, per RFC3264
when the "Expires" header is missing a default expiry should be used.
ASTERISK-18140
Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8833e7111..cdd78fd7e 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -28511,7 +28511,13 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, p->lastinvite = seqno; } if (!p->needdestroy) { - p->expiry = atoi(sip_get_header(req, "Expires")); + const char *expires_str = sip_get_header(req, "Expires"); + + if (ast_strlen_zero(expires_str)) { + p->expiry = default_expiry; + } else { + p->expiry = atoi(expires_str); + } /* check if the requested expiry-time is within the approved limits from sip.conf */ if (p->expiry > max_subexpiry) { |