Summary:ASTERISK-18140: Expires handling in SUBSCRIBE confuses the absence of the Expires header field with an unsubscribe action.
Reporter:Jonathan Cloots (nossy)Labels:
Date Opened:2011-07-14 14:28:58Date Closed:2017-10-25 07:45:00
Versions:Frequency of

  SUBSCRIBE requests SHOULD (NOT MUST) contain an "Expires" header (defined in SIP
  [1]).  This expires value indicates the duration of the subscription.
  In order to keep subscriptions effective beyond the duration
  communicated in the "Expires" header, subscribers need to refresh
  subscriptions on a periodic basis using a new SUBSCRIBE message on
  the same dialog as defined in SIP [1].

  >>If no "Expires" header is present in a SUBSCRIBE request, the implied
  default is defined by the event package being used.<<

  200-class responses to SUBSCRIBE requests also MUST contain an
  "Expires" header.  The period of time in the response MAY be shorter
  but MUST NOT be longer than specified in the request.  The period of
  time in the response is the one which defines the duration of the

  An "expires" parameter on the "Contact" header has no semantics for
  SUBSCRIBE and is explicitly not equivalent to an "Expires" header in
  a SUBSCRIBE request or response.

  *A natural consequence of this scheme is that a SUBSCRIBE with an
  "Expires" of 0 constitutes a request to unsubscribe from an event.

     In addition to being a request to unsubscribe, a SUBSCRIBE message
     with "Expires" of 0 also causes a fetch of state; see section

  Notifiers may also wish to cancel subscriptions to events; this is
  useful, for example, when the resource to which a subscription refers
  is no longer available.  Further details on this mechanism are
  discussed in section 3.2.2.

I guess the gist of it is, that asterisk should be able to provide a subscription /subscriber/ with a reasonable expirey, based on it's own internal configuration.
Comments:By: Jonathan Cloots (nossy) 2011-07-14 14:33:48.224-0500

the __get_header result is dumped into an atoi as far as I can see, which doesn't quite comply with the semantics as specified in the rfc...

By: Leif Madsen (lmadsen) 2011-08-30 13:26:31.326-0500

What version are you testing this against? I want to set the applicable fields.

By: Friendly Automation (friendly-automation) 2017-10-25 07:45:01.696-0500

Change 6902 merged by Joshua Colp:
chan_sip: Fix SUBSCRIBE with missing "Expires" header.


By: Friendly Automation (friendly-automation) 2017-10-25 08:00:07.022-0500

Change 6901 merged by Jenkins2:
chan_sip: Fix SUBSCRIBE with missing "Expires" header.


By: Friendly Automation (friendly-automation) 2017-10-25 08:18:25.086-0500

Change 6900 merged by Joshua Colp:
chan_sip: Fix SUBSCRIBE with missing "Expires" header.