RFC 3265

Session Initiation Protocol (SIP)-Specific Event Notification

๐Ÿ“… published July 2002, from ietf

Session Initiation Protocol (SIP)-Specific Event Notification โœจ

Okay bestie, let's start with the ID card ๐Ÿชช๐Ÿ’– This is RFC 3265, and it's all about SIP-Specific Event Notification. It was written by A. B. Roach from dynamicsoft and dated June 2002. It's a Standards Track doc in the Network Working Group series, and it updates RFC 2543. The header doesn't list anything it obsoletes. Now let's get into it ๐ŸŒธ

Status of This Memo ๐Ÿ“œ

This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.

Copyright (C) The Internet Society (2002). All Rights Reserved.

Abstract ๐Ÿฆ‹

This document describes an extension to the Session Initiation Protocol (SIP). The purpose of this extension is to provide an extensible framework by which SIP nodes can request notification from remote nodes indicating that certain events have occurred.

Concrete uses of the mechanism described in this document may be standardized in the future.

Note that the event notification mechanisms defined herein are not intended to be a general-purpose infrastructure for all classes of event subscription and notification.

Table of Contents ๐Ÿ“‹

1.       Introduction...........................................  3
1.1.     Overview of Operation..................................  4
1.2.     Documentation Conventions..............................  4
2.       Definitions............................................  5
3.       Node Behavior..........................................  6
3.1.     Description of SUBSCRIBE Behavior......................  6
3.1.1.   Subscription Duration..................................  6
3.1.2.   Identification of Subscribed Events and Event Classes..  6
3.1.3.   Additional SUBSCRIBE Header Values.....................  7
3.1.4.   Subscriber SUBSCRIBE Behavior..........................  7
3.1.5.   Proxy SUBSCRIBE Behavior...............................  9
3.1.6.   Notifier SUBSCRIBE Behavior............................ 10
3.2.     Description of NOTIFY Behavior......................... 13
3.2.1.   Identification of Reported Events, Event Classes, and
         Current State.......................................... 13
3.2.2.   Notifier NOTIFY Behavior............................... 14
3.2.3.   Proxy NOTIFY Behavior.................................. 15
3.2.4.   Subscriber NOTIFY Behavior............................. 16
3.3.     General................................................ 18
3.3.1.   Detecting support for SUBSCRIBE and NOTIFY............. 18
3.3.2.   CANCEL requests........................................ 18
3.3.3.   Forking................................................ 18
3.3.4.   Dialog creation and termination........................ 18
3.3.5.   State Agents and Notifier Migration.................... 19
3.3.6.   Polling Resource State................................. 20
3.3.7.   Allow-Events header usage.............................. 21
3.3.8.   PINT Compatibility..................................... 21
4.       Event Packages......................................... 21
4.1.     Appropriateness of Usage............................... 21
4.2.     Event Template-packages................................ 22
4.3.     Amount of State to be Conveyed......................... 22
4.3.1.   Complete State Information............................. 23
4.3.2.   State Deltas........................................... 23
4.4.     Event Package Responsibilities......................... 24
4.4.1.   Event Package Name..................................... 24
4.4.2.   Event Package Parameters............................... 24
4.4.3.   SUBSCRIBE Bodies....................................... 24
4.4.4.   Subscription Duration.................................. 25
4.4.5.   NOTIFY Bodies.......................................... 25
4.4.6.   Notifier processing of SUBSCRIBE requests.............. 25
4.4.7.   Notifier generation of NOTIFY requests................. 25
4.4.8.   Subscriber processing of NOTIFY requests............... 26
4.4.9.   Handling of forked requests............................ 26
4.4.10.  Rate of notifications.................................. 26
4.4.11.  State Agents........................................... 27
4.4.12.  Examples............................................... 27
4.4.13.  Use of URIs to Retrieve State.......................... 27
5.       Security Considerations................................ 28
5.1.     Access Control......................................... 28
5.2.     Notifier Privacy Mechanism............................. 28
5.3.     Denial-of-Service attacks.............................. 28
5.4.     Replay Attacks......................................... 29
5.5.     Man-in-the middle attacks.............................. 29
5.6.     Confidentiality........................................ 29
6.       IANA Considerations.................................... 30
6.1.     Registration Information............................... 30
6.2.     Registration Template.................................. 31
6.3.     Header Field Names..................................... 31
6.4.     Response Codes......................................... 32
7.       Syntax................................................. 32
7.1.     New Methods............................................ 32
7.1.1.   SUBSCRIBE method....................................... 34
7.1.2.   NOTIFY method.......................................... 34
7.2.     New Headers............................................ 34
7.2.1.   "Event" header......................................... 34
7.2.2.   "Allow-Events" Header.................................. 35
7.2.3.   "Subscription-State" Header............................ 35
7.3.     New Response Codes..................................... 35
7.3.1.   "202 Accepted" Response Code........................... 35
7.3.2.   "489 Bad Event" Response Code.......................... 35
7.4.     Augmented BNF Definitions.............................. 35
8.       Normative References................................... 36
9.       Informative References................................. 37
10.      Acknowledgements....................................... 37
11.      Notice Regarding Intellectual Property Rights.......... 37
12.      Author's Address....................................... 37
13.      Full Copyright Statement............................... 38

1. Introduction โœจ

The ability to request asynchronous notification of events proves useful in many types of SIP services for which cooperation between end-nodes is required. Examples of such services include automatic callback services (based on terminal state events), buddy lists (based on user presence events), message waiting indications (based on mailbox state change events), and PSTN and Internet Internetworking (PINT) [2] status (based on call state events).

The methods described in this document provide a framework by which notification of these events can be ordered.

The event notification mechanisms defined herein are not intended to be a general-purpose infrastructure for all classes of event subscription and notification. Meeting requirements for the general problem set of subscription and notification is far too complex for a single protocol. Our goal is to provide a SIP-specific framework for event notification which is not so complex as to be unusable for simple features, but which is still flexible enough to provide powerful services. Note, however, that event packages based on this framework may define arbitrarily elaborate rules which govern the subscription and notification for the events or classes of events they describe.

This document does not describe an extension which may be used directly; it must be extended by other documents (herein referred to as "event packages"). In object-oriented design terminology, it may be thought of as an abstract base class which must be derived into an instantiatable class by further extensions. Guidelines for creating these extensions are described in section 4. ๐Ÿงš

1.1. Overview of Operation ๐ŸŒˆ

The general concept is that entities in the network can subscribe to resource or call state for various resources or calls in the network, and those entities (or entities acting on their behalf) can send notifications when those states change.

A typical flow of messages would be:

Subscriber          Notifier
    |-----SUBSCRIBE---->|     Request state subscription
    |<-------200--------|     Acknowledge subscription
    |<------NOTIFY----- |     Return current state information
    |--------200------->|
    |<------NOTIFY----- |     Return current state information
    |--------200------->|

Subscriptions are expired and must be refreshed by subsequent SUBSCRIBE messages. ๐Ÿ”

1.2. Documentation Conventions ๐Ÿ“š

There are several paragraphs throughout this document which provide motivational or clarifying text. Such passages are non-normative, and are provided only to assist with reader comprehension. These passages are set off from the remainder of the text by being indented thus:

This is an example of non-normative explanatory text. It does not form part of the specification, and is used only for clarification.

Numbers in square brackets (e.g., [1]) denote a reference to one of the entries in the reference sections; see sections 8 and 9.

The all-capital terms "MUST", "SHOULD", "MAY", "SHOULD NOT", "MUST NOT", and "RECOMMENDED" are used as defined in RFC 2119 [5]. ๐Ÿ’…

The use of quotation marks next to periods and commas follows the convention used by the American Mathematical Society; although contrary to traditional American English convention, this usage lends clarity to certain passages. ๐Ÿซถ


Part 1 of 8 is done, bestie ๐Ÿ’œ Part 2 is next, and it's where we get into the actual Definitions and Node Behavior ๐Ÿฆ‹

2. Definitions ๐Ÿ“šโœจ

  • Event Package: okay so an event package is an extra spec that defines a set of state info a notifier reports to a subscriber ๐Ÿ’…. It also defines more syntax and semantics, built on the framework in this doc, that are needed to carry that state info ๐ŸŽ€.
  • Event Template-Package: a special kind of event package ๐ŸŒˆ that defines a set of states which may be applied to ALL possible event packages, including itself ๐Ÿ‘‘.
  • Notification: the act of a notifier sending a NOTIFY message to a subscriber so they know the state of a resource ๐Ÿฆ‹.
  • Notifier: a user agent that generates NOTIFY requests to tell subscribers about a resource's state ๐Ÿ’–. Notifiers typically also accept SUBSCRIBE requests to create subscriptions.
  • State Agent: a notifier that publishes state info on behalf of a resource ๐Ÿงš. To do that, it may need to gather the state info from multiple sources. State agents always have complete state info for the resource they're making notifications for ๐Ÿ’œ.
  • Subscriber: a user agent that receives NOTIFY requests from notifiers ๐Ÿซถ. These NOTIFY requests contain info about the state of a resource the subscriber cares about. Subscribers typically also generate SUBSCRIBE requests and send them to notifiers to create subscriptions.
  • Subscription: a set of application state tied to a dialog ๐Ÿ“. This application state includes a pointer to the associated dialog, the event package name, and possibly an identification token. Event packages will define additional subscription state info. By definition, subscriptions exist in both a subscriber and a notifier ๐Ÿ”ฅ.
  • Subscription Migration: moving a subscription from one notifier to another notifier ๐Ÿฆ‹.

3. Node Behavior ๐ŸŽ€

3.1. Description of SUBSCRIBE Behavior

The SUBSCRIBE method is used to request current state and state updates from a remote node ๐Ÿ’….

3.1.1. Subscription Duration โฐ

SUBSCRIBE requests SHOULD contain an Expires header (defined in SIP [1]) ๐Ÿซถ. This expires value indicates how long the subscription lasts. To keep a subscription effective beyond the duration communicated in the Expires header, subscribers need to refresh it on a periodic basis by sending a new SUBSCRIBE message on the same dialog, as defined in SIP [1] ๐Ÿ”„.

If there's no Expires header 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 what was specified in the request ๐ŸŒธ. The period of time in the response is the one that defines how long the subscription lasts.

An expires parameter on the Contact header has no semantics for SUBSCRIBE ๐Ÿ™ˆ. It is explicitly NOT equivalent to an Expires header in a SUBSCRIBE request or response, so don't mix them up, bestie!

A natural consequence of this scheme is that a SUBSCRIBE with an Expires of 0 is 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 3.3.6. ๐Ÿ‘€

Notifiers may also wish to cancel subscriptions to events ๐Ÿ™…โ€โ™€๏ธ. This is useful, for example, when the resource a subscription refers to is no longer available. Further details on this mechanism are discussed in section 3.2.2.

3.1.2. Identification of Subscribed Events and Event Classes ๐Ÿ”

Identification of events is provided by three pieces of info: Request URI, Event Type, and (optionally) message body ๐Ÿงฉ.

The Request URI of a SUBSCRIBE request is the most important part, bestie ๐Ÿ‘‘. It contains enough info to route the request to the right entity, following the request routing procedures outlined in SIP [1]. It also contains enough info to identify the resource that event notification is wanted for. But it doesn't necessarily have enough info to uniquely identify the nature of the event. For example, sip:adam@dynamicsoft.com would be an appropriate URI to subscribe to for my presence state, and it would ALSO be an appropriate URI to subscribe to the state of my voice mailbox ๐Ÿ“ž๐Ÿ’….

Subscribers MUST include exactly one Event header in SUBSCRIBE requests ๐ŸŽฏ. It says which event, or class of events, they're subscribing to. The Event header contains a token that indicates the type of state a subscription is being requested for. This token is registered with the IANA and corresponds to an event package that further describes the semantics of the event or event class. The Event header MAY also contain an id parameter. If it's present, this id parameter contains an opaque token that identifies the specific subscription within a dialog. An id parameter is only valid within the scope of a single dialog ๐Ÿ†”.

If the event package that the event token corresponds to defines behavior associated with the body of its SUBSCRIBE requests, those semantics apply โœจ.

Event packages may also define parameters for the Event header. If they do, they must define the semantics for those parameters ๐Ÿ“.

3.1.3. Additional SUBSCRIBE Header Values ๐ŸŽ€

Because SUBSCRIBE requests create a dialog as defined in SIP [1], they MAY contain an Accept header ๐Ÿ’Œ. If it's present, this header indicates the body formats allowed in subsequent NOTIFY requests. Event packages MUST define the behavior for SUBSCRIBE requests without Accept headers. Usually, this will mean a single, default body type ๐Ÿ“.

Header values that aren't described in this document are to be interpreted as described in SIP [1] ๐Ÿ“–.

3.1.4. Subscriber SUBSCRIBE Behavior ๐Ÿซง

3.1.4.1. Requesting a Subscription ๐Ÿ™‹โ€โ™€๏ธ

SUBSCRIBE is a dialog-creating method, as described in SIP [1] ๐Ÿงต.

When a subscriber wants to subscribe to a particular state for a resource, it forms a SUBSCRIBE message ๐Ÿ’ซ. If the initial SUBSCRIBE is a request outside of a dialog (which it typically will be), its construction follows the procedures outlined in SIP [1] for UAC request generation outside of a dialog ๐Ÿ› ๏ธ.

This SUBSCRIBE request will be confirmed with a final response ๐Ÿ’…. 200-class responses mean the subscription has been accepted, and that a NOTIFY will be sent immediately ๐Ÿ””. A 200 response means the subscription has been accepted AND that the user is authorized to subscribe to the requested resource โœ…. A 202 response only means the subscription has been understood. Whether authorization has been granted might or might not be true ๐Ÿคทโ€โ™€๏ธ.

The Expires header in a 200-class response to SUBSCRIBE shows how long the subscription will actually stay active, unless it gets refreshed โณ.

Non-200 class final responses mean that no subscription or dialog has been created, and no subsequent NOTIFY message will be sent ๐Ÿ™…. All non-200 class responses (except for "489", which is described herein) have the same meanings and handling as described in SIP [1] ๐Ÿ“š.

A SUBSCRIBE request MAY include an id parameter in its Event header ๐Ÿ†”. This lets you tell apart multiple subscriptions in the same dialog ๐Ÿ‘ฏโ€โ™€๏ธ.

3.1.4.2. Refreshing of Subscriptions ๐Ÿ”„

At any time before a subscription expires, the subscriber can refresh the timer on it by sending another SUBSCRIBE request on the same dialog as the existing subscription ๐Ÿ•ฐ๏ธ. That request uses the same Event header id parameter, if one was present in the initial subscription. The handling for such a request is the same as for the initial creation of a subscription, except as described below ๐Ÿง .

If the initial SUBSCRIBE message contained an id parameter on the Event header, then refreshes of the subscription must also contain an identical id parameter. Otherwise, they'll be treated as new subscriptions in an existing dialog ๐Ÿšจ.

If a SUBSCRIBE request to refresh a subscription gets a "481" response, that means the subscription has been terminated AND the subscriber did NOT get notified of this fact ๐Ÿ˜ฑ. In this case, the subscriber should consider the subscription invalid. If the subscriber wants to re-subscribe to the state, they do it by composing an unrelated initial SUBSCRIBE request with a freshly-generated Call-ID and a new, unique "From" tag (see section 3.1.4.1.) ๐Ÿ”.

If a SUBSCRIBE request to refresh a subscription fails with a non-481 response, the original subscription is still considered valid for the duration of the most recently known Expires value ๐Ÿ’ช. That value is negotiated by SUBSCRIBE and its response, or communicated by NOTIFY in the Subscription-State header expires parameter.

Note that many such errors mean there may be a problem with the network or the notifier, so no further NOTIFY messages will be received ๐Ÿšฉ.

3.1.4.3. Unsubscribing ๐Ÿ‘‹

Unsubscribing is handled the same way as refreshing a subscription, except the Expires header is set to "0" ๐Ÿšซ. Note that a successful unsubscription will also trigger a final NOTIFY message ๐Ÿ.

3.1.4.4. Confirmation of Subscription Creation โœ…

The subscriber can expect to receive a NOTIFY message from each node that has processed a successful subscription or subscription refresh ๐Ÿ’Œ. Until the first NOTIFY message arrives, the subscriber should consider the state of the subscribed resource to be in a neutral state ๐Ÿ˜ถ. Documents that define new event packages MUST define this "neutral state" in a way that makes sense for their application (see section 4.4.7.) ๐Ÿงฉ.

Because of the potential for out-of-order messages and forking, the subscriber MUST be prepared to receive NOTIFY messages BEFORE the SUBSCRIBE transaction has completed ๐ŸŒ€.

Except as noted above, processing of this NOTIFY is the same as in section 3.2.4 ๐Ÿ™Œ.

3.1.5. Proxy SUBSCRIBE Behavior ๐Ÿ›ฐ๏ธ

Proxies need no additional behavior beyond what's described in SIP [1] to support SUBSCRIBE ๐Ÿงšโ€โ™€๏ธ. If a proxy wants to see all of the SUBSCRIBE and NOTIFY requests for a given dialog, it MUST record-route the initial SUBSCRIBE and any dialog-establishing NOTIFY requests. Such proxies SHOULD also record-route all other SUBSCRIBE and NOTIFY requests ๐Ÿ—บ๏ธ.

Note that subscribers and notifiers may choose to use S/MIME encryption of SUBSCRIBE and NOTIFY requests ๐Ÿ”. Because of that, proxies cannot rely on being able to access any info that isn't explicitly required to be proxy-readable by SIP [1] ๐Ÿ™ˆ.

3.1.6. Notifier SUBSCRIBE Behavior ๐Ÿ””

3.1.6.1. Initial SUBSCRIBE Transaction Processing โฐ

okay bestie, a SUBSCRIBE transaction should NEVER drag on longer than the automated processing takes ๐Ÿ’… notifiers MUST NOT wait for a user to respond before sending a final response to a SUBSCRIBE request ๐Ÿ™…โ€โ™€๏ธ

why so strict? it's so the non-INVITE transaction timeout timer F (see [1]) doesn't go off mid-SUBSCRIBE, because waiting on a human would often take longer than 64*T1 seconds ๐Ÿ˜ญ

The notifier SHOULD check that the event package named in the Event header is understood. If it isn't, the notifier SHOULD send back a 489 Bad Event response to say that the event/event class isn't understood ๐Ÿซ 

The notifier SHOULD also do any authentication and authorization its local policy calls for. See section 3.1.6.3 ๐Ÿ’–

The notifier MAY also check that the duration in the Expires header isn't too small. If and only if the expiration interval is greater than zero AND smaller than one hour AND less than a notifier-configured minimum, the notifier MAY return a 423 Interval too small error that includes a Min-Expires header field. The Min-Expires header field is described in SIP [1] ๐Ÿงš

If the notifier can immediately tell that it understands the event package, that the authenticated subscriber is authorized to subscribe, and that there are no other barriers to creating the subscription, it creates the subscription (and a dialog, if necessary) and returns a 200 OK response โœจ (unless doing that would reveal authorization policy in an undesirable way; see section 5.2.)

If the notifier can't create the subscription right away (like if it needs to wait for user input for authorization, or it's acting for another node that isn't reachable right now), or it wants to mask its authorization policy, it returns a 202 Accepted response ๐Ÿฆ‹ That response means the request was received and understood, but it doesn't necessarily mean the subscription has been authorized yet.

When a subscription is created in the notifier, it stores the event package name and the Event header id parameter (if present) as part of the subscription information ๐ŸŽ€

The Expires values in SUBSCRIBE 200-class responses work the same way they do in REGISTER responses: the server MAY shorten the interval, but MUST NOT lengthen it.

if the duration in a SUBSCRIBE message is unacceptably short, the notifier may be able to send a 423 response, like we covered earlier in this section ๐Ÿ‘€

200-class responses to SUBSCRIBE requests won't usually have anything useful beyond the subscription duration. Their main job is being a reliability mechanism ๐ŸŒธ The actual state info gets communicated later, through a NOTIFY request from the notifier.

The other response codes defined in SIP [1] may be used in response to SUBSCRIBE requests, as appropriate ๐Ÿ“


3.1.6.2. Confirmation of Subscription Creation/Refreshing ๐Ÿซถ

Okay so, when a notifier successfully accepts or refreshes a subscription, it MUST send a NOTIFY message immediately to share the current resource state with the subscriber. This NOTIFY goes out on the same dialog that was created by the SUBSCRIBE response. If the resource has no meaningful state when the SUBSCRIBE message is processed, this NOTIFY message MAY contain an empty or neutral body. See section 3.2.2. for more on NOTIFY message generation ๐Ÿ’œ

Note that a NOTIFY message is always sent immediately after any 200-class response to a SUBSCRIBE request, regardless of whether the subscription has already been authorized. no exceptions, it's giving consistency ๐Ÿ’…


3.1.6.3. Authentication/Authorization of SUBSCRIBE requests ๐Ÿ”

Privacy concerns may require notifiers to apply policy to figure out whether a particular subscriber is allowed to subscribe to a certain set of events. That policy can come from things like access control lists or real-time interaction with a user ๐Ÿ‘ฉโ€๐Ÿ’ป In general, authorizing subscribers before authenticating them isn't really useful.

SIP authentication mechanisms are discussed in SIP [1]. Now here's the twist: even if the notifier node usually acts as a proxy, authentication for SUBSCRIBE requests is ALWAYS done with a 401 response, not a 407; notifiers always act as user agents when accepting subscriptions and sending notifications ๐ŸŽญ

of course, when acting as a proxy, a node does normal proxy authentication (using 407). this is just a reminder that notifiers are always UAs, so they do UA authentication ๐Ÿง 

If authorization fails based on an access list or some other automated mechanism (i.e., it can be automatically and authoritatively determined that the subscriber is not authorized to subscribe), the notifier SHOULD reply to the request with a 403 Forbidden or 603 Decline response, unless doing so might reveal information that should stay private; see section 5.2. ๐Ÿšซ

If the notifier owner is interactively queried to decide whether a subscription is allowed, a 202 Accept response is returned immediately. A NOTIFY message still gets formed and sent in these cases, as described in the previous section ๐Ÿ“ฌ

If subscription authorization was delayed and the notifier wants to say it has been declined, it may do so by sending a NOTIFY message containing a Subscription-State header with a value of terminated and a reason parameter of rejected ๐Ÿ’€


3.1.6.4. Refreshing of Subscriptions ๐Ÿ”„

When a notifier gets a subscription refresh, and the subscriber is still authorized, the notifier updates the expiration time for the subscription. Just like with the initial subscription, the server MAY shorten the time until expiration, but MUST NOT increase it. The final expiration time goes in the Expires header of the response. If the duration in a SUBSCRIBE message is unacceptably short, the notifier SHOULD respond with a 423 Subscription Too Brief message โณ

If no refresh for a notification address arrives before its expiration time, the subscription is removed. When removing a subscription, the notifier SHOULD send a NOTIFY message with a Subscription-State value of terminated to let the subscriber know it's going away ๐Ÿ‘‹ If such a message is sent, the Subscription-State header SHOULD contain a reason=timeout parameter.

sending a NOTIFY when a subscription expires lets the corresponding dialog get terminated, if that's appropriate ๐Ÿซง

3.2. Description of NOTIFY Behavior ๐Ÿ“ฃ

NOTIFY messages are sent to tell subscribers about changes in state for things they've subscribed to. Subscriptions are typically set up using the SUBSCRIBE method, but other means might have been used too ๐Ÿฆ‹

If any non-SUBSCRIBE mechanisms are defined to create subscriptions, it's the responsibility of the people defining those mechanisms to make sure a NOTIFY message can be correlated to the matching subscription ๐Ÿ”— Designers are also warned to tell apart sending a NOTIFY message to a subscriber who knows about the subscription and sending one to an unsuspecting node. The latter is invalid and MUST receive a 481 Subscription does not exist response (unless some other 400- or 500-class error code is more applicable), as described in section 3.2.4. In other words, the subscription has to be known by BOTH the subscriber and the notifier to be valid, even if it was installed via a non-SUBSCRIBE mechanism ๐Ÿ™…โ€โ™€๏ธ

A NOTIFY does not terminate its subscription. In other words, a single SUBSCRIBE request may trigger several NOTIFY requests ๐Ÿ”


3.2.1. Identification of Reported Events, Event Classes, and Current State ๐ŸŽ€

Identifying the events being reported in a notification is very similar to how it's done for subscribing to events (see section 3.1.2.) ๐Ÿ’–

Just like in SUBSCRIBE requests, NOTIFY Event headers will contain a single event package name for which a notification is being generated. The package name in the Event header MUST match the Event header in the corresponding SUBSCRIBE message. If an id parameter was present in the SUBSCRIBE message, that id parameter MUST also be present in the corresponding NOTIFY messages ๐Ÿซถ

Event packages may define semantics for the body of their NOTIFY requests, and if they do, those semantics apply โœจ NOTIFY bodies are expected to provide extra details about the nature of the event that happened and the resulting resource state.

When present, the body of the NOTIFY request MUST be formatted into one of the body formats specified in the Accept header of the corresponding SUBSCRIBE request ๐Ÿงš This body will contain either the state of the subscribed resource or a pointer to that state in the form of a URI (see section 4.4.13). it's giving organized, no cap ๐Ÿ’…

3.2.2. Notifier NOTIFY Behavior

Okay so when a SUBSCRIBE request gets a 200-class response, the notifier MUST immediately build and send a NOTIFY request to the subscriber ๐Ÿ’–. And when the subscribed state changes, the notifier SHOULD immediately construct and send a NOTIFY request too, but that's subject to authorization, local policy, and throttling considerations โœจ.

A NOTIFY request counts as failed if the response times out, or if a non-200 class response code comes back with no Retry-After header and no implied further action to retry, like "401 Authorization Required". ๐Ÿ™ˆ

If the NOTIFY request fails because of a timeout, and the subscription was installed using a soft-state mechanism (such as SUBSCRIBE), the notifier SHOULD remove the subscription ๐Ÿงน

Why this matters: it stops the notifier from wasting bandwidth on subscribers who crashed or just vanished from the network ๐Ÿ’€ Those transmissions get sent multiple times, following the retransmission algorithm defined in SIP [1] (instead of the usual single send for clients that are working fine), so continuing to service a client that can't acknowledge anything could put real strain on the network. When a client restarts or gets its network connection back, it's expected to send SUBSCRIBE messages to refresh any stale state, and those messages re-install the subscriptions on all the relevant nodes ๐Ÿ”„

If the NOTIFY request fails because of an error response, and the subscription was installed using a soft-state mechanism, the notifier MUST remove the corresponding subscription ๐Ÿ˜ญ

A notify error response usually means something went wrong with the subscriber, or with some proxy on the way to the subscriber. If the subscriber is the problem, it makes the most sense to let it fix things and re-subscribe once the error is handled ๐Ÿ› ๏ธ If a proxy is the problem, the periodic SUBSCRIBE refreshes will put the subscription state back once the network issue is sorted out ๐Ÿฆ‹

If a NOTIFY request gets a 481 response, the notifier MUST remove the corresponding subscription, even if that subscription was installed by non-SUBSCRIBE means (such as an administrative interface) ๐Ÿšซ

If this rule didn't exist, subscribers that got a NOTIFY for an unknown subscription would have to send an error status code in response and also send a SUBSCRIBE request to remove it. That would make subscribers easy to abuse as amplifiers in denial of service attacks ๐Ÿ˜ฑ So we gave the 481 response a special meaning instead: it means the subscription must be cancelled under all circumstances ๐Ÿ”ฅ

NOTIFY requests MUST contain a Subscription-State header with a value of active, pending, or terminated ๐Ÿ’… The active value means the subscription has been accepted and authorized (in most cases; see section 5.2.). The pending value means the subscription has been received, but there isn't enough policy information to accept or deny it yet โณ The terminated value means the subscription is not active anymore ๐ŸŒ™

If the Subscription-State header value is active or pending, the notifier SHOULD also include an expires parameter in the Subscription-State header, which tells the subscriber how much time is left on the subscription โฐ The notifier MAY use this to shorten a subscription, but this mechanism MUST NOT be used to lengthen a subscription ๐Ÿ™…โ€โ™€๏ธ

Including expiration info for active and pending subscriptions is super useful in case the SUBSCRIBE request forks, because the subscriber might never get the response to a forked SUBSCRIBE ๐Ÿงš And note well: this expires value is a parameter on the Subscription-State header, not an Expires header ๐Ÿ‘€

If the Subscription-State header value is terminated, the notifier SHOULD also include a reason parameter ๐Ÿ“ The notifier MAY also include a retry-after parameter where that makes sense. For the details on the value and semantics of the reason and retry-after parameters, see section 3.2.4.

3.2.3. Proxy NOTIFY Behavior

Proxies don't need any extra behavior beyond what SIP [1] already describes in order to support NOTIFY ๐ŸŒธ If a proxy wants to see all of the SUBSCRIBE and NOTIFY requests for a given dialog, it MUST record-route the initial SUBSCRIBE and any dialog-establishing NOTIFY requests ๐Ÿ—บ๏ธ Those proxies SHOULD also record-route all the other SUBSCRIBE and NOTIFY requests too โœจ

Subscribers and notifiers are allowed to use S/MIME encryption on their SUBSCRIBE and NOTIFY requests ๐Ÿ” That means proxies can't count on reading anything that SIP [1] doesn't explicitly say must be proxy-readable ๐Ÿ™ˆ

3.2.4. Subscriber NOTIFY Behavior

Okay this one's a big deal ๐ŸŽ€ When a subscriber gets a NOTIFY request, it should check that the request matches at least one of its outstanding subscriptions. If it doesn't match, the subscriber MUST return a 481 Subscription does not exist response, unless another 400- or 500-class response fits better ๐Ÿ™…โ€โ™€๏ธ The rules for matching NOTIFY requests with subscriptions that create a new dialog are in section 3.3.4. Notifications for subscriptions that were created inside an existing dialog match if they're in the same dialog and their Event headers match (as described in section 7.2.1.) ๐Ÿฆ‹

If, for some reason, the event package named in the NOTIFY request's Event header isn't supported, the subscriber will respond with a 489 Bad Event response ๐Ÿšซ

To prevent spoofing of events, NOTIFY requests SHOULD be authenticated, using any defined SIP authentication mechanism ๐Ÿ”’

NOTIFY requests MUST contain Subscription-State headers that tell you the status of the subscription ๐Ÿ“‹

If the Subscription-State header value is active, it means the subscription has been accepted and (generally) authorized โœ… If the header also has an expires parameter, the subscriber SHOULD treat it as the authoritative subscription duration and adjust to match ๐Ÿซถ The retry-after and reason parameters have no meaning at all for active ๐Ÿคทโ€โ™€๏ธ

If the Subscription-State value is pending, the notifier got the subscription but doesn't have enough policy info to grant or deny it yet โณ If the header also has an expires parameter, the subscriber SHOULD treat it as the authoritative subscription duration and adjust accordingly. No further action is needed from the subscriber here ๐Ÿ˜Œ The retry-after and reason parameters have no meaning for pending either ๐Ÿ’ค

If the Subscription-State value is terminated, the subscriber should consider the subscription terminated ๐Ÿ›‘ The expires parameter has no meaning for terminated. If a reason code is there, the client should behave as described below. If there's no reason code, or an unknown one, the client MAY try to re-subscribe at any time. The exception is when a retry-after parameter is present: then the client SHOULD NOT try to re-subscribe until the number of seconds in retry-after has passed ๐Ÿ•ฐ๏ธ These are the defined reason codes:

  • deactivated: The subscription has been terminated, but the subscriber SHOULD retry right away with a new subscription. One of the main uses for this is letting subscriptions migrate between nodes ๐Ÿšš The retry-after parameter has no meaning for deactivated.
  • probation: The subscription has been terminated, but the client SHOULD try again later. If a retry-after parameter is also there, the client SHOULD wait at least that many seconds before trying to re-subscribe โณ
  • rejected: The subscription has been terminated because the authorization policy changed. Clients SHOULD NOT attempt to re-subscribe ๐Ÿšช The retry-after parameter has no meaning for rejected.
  • timeout: The subscription has been terminated because it wasn't refreshed before it expired ๐Ÿฅ€ Clients MAY re-subscribe immediately. The retry-after parameter has no meaning for timeout.
  • giveup: The subscription has been terminated because the notifier couldn't get authorization in a timely way ๐Ÿ˜ฎโ€๐Ÿ’จ If a retry-after parameter is also there, the client SHOULD wait at least that many seconds before trying to re-subscribe. Otherwise, the client MAY retry immediately, but it will probably end up back in the pending state ๐Ÿ”
  • noresource: The subscription has been terminated because the resource being monitored no longer exists ๐Ÿซฅ Clients SHOULD NOT attempt to re-subscribe. The retry-after parameter has no meaning for noresource.

Once the notification is considered acceptable to the subscriber, the subscriber SHOULD return a 200 response โœจ In general, NOTIFY responses aren't expected to have bodies, but they MAY, if the NOTIFY request contained an Accept header ๐Ÿ“จ

Other responses defined in SIP [1] may also be returned, as appropriate ๐Ÿงฉ A NOTIFY transaction should never last any longer than the time needed for automated processing โšก In particular, subscribers MUST NOT wait for a user response before returning a final response to a NOTIFY request ๐Ÿ™…โ€โ™€๏ธ๐Ÿ’…


3.3. General

3.3.1. Detecting support for SUBSCRIBE and NOTIFY

Neither SUBSCRIBE nor NOTIFY needs the Require or Proxy-Require headers, and there's no token defined for Supported headers either ๐Ÿ™Œ If clients need to check for support, they can probe for SUBSCRIBE and NOTIFY using the OPTIONS request defined in SIP [1] ๐Ÿ”

The presence of the Allow-Events header in a message is enough to show support for SUBSCRIBE and NOTIFY ๐Ÿ’œ

The methods parameter for Contact can also be used to specifically announce support for SUBSCRIBE and NOTIFY messages when registering ๐Ÿ“ฃ (See reference [8] for details on the methods parameter).

3.3.2. CANCEL requests

No semantics are associated with cancelling SUBSCRIBE or NOTIFY ๐Ÿ™ƒ

3.3.3. Forking

Following the rules for proxying non-INVITE requests in SIP [1], successful SUBSCRIBE requests will only get one 200-class response ๐Ÿฆ‹ But because of forking, the subscription may have been accepted by multiple nodes ๐ŸŒฟ So the subscriber MUST be ready to receive NOTIFY requests with From: tags that differ from the To: tag in the SUBSCRIBE 200-class response ๐Ÿซฃ

If multiple NOTIFY messages come in across different dialogs in response to one SUBSCRIBE message, each dialog stands for a different destination the SUBSCRIBE was forked to ๐ŸŒˆ For how subscribers should handle these situations, see section 4.4.9. ๐ŸŽ€

3.3.4. Dialog creation and termination ๐Ÿฆ‹

okay so if an initial SUBSCRIBE request isn't sent on a pre-existing dialog, the subscriber just waits for either a response to that SUBSCRIBE or a matching NOTIFY ๐Ÿ‘€โœจ

Responses match up with such a SUBSCRIBE if they have the same Call-ID, the same From header tag, and the same CSeq ๐ŸŽ€. The rules for comparing these headers are in SIP [1]. If a 200-class response matches such a SUBSCRIBE, it creates a new subscription and a new dialog, unless a matching NOTIFY already made them (see below) ๐Ÿ’…

NOTIFY requests match such SUBSCRIBEs if they have the same Call-ID, a To header tag parameter that matches the From header tag parameter of the SUBSCRIBE, and the same Event header field. The rules for comparing Event headers are in section 7.2.1. If a matching NOTIFY has a Subscription-State of "active" or "pending", it creates a new subscription and a new dialog, unless a matching response already did, as described above ๐Ÿซถ

If an initial SUBSCRIBE is sent on a pre-existing dialog, a matching 200-class response or successful NOTIFY request just creates a new subscription tied to that dialog ๐Ÿงš

Multiple subscriptions can live on a single dialog ๐ŸŒธ. Subscriptions can also exist in dialogs tied to INVITE-created application state, and to other application state made by mechanisms in other specifications. These sets of application state don't interact beyond the behavior described for a dialog (e.g., route set handling) ๐Ÿ’œ

A subscription is destroyed when a notifier sends a NOTIFY request with a Subscription-State of "terminated" ๐Ÿ’€

A subscriber may send a SUBSCRIBE request with an Expires header of 0 to trigger the sending of that NOTIFY request. But for the purposes of subscription and dialog lifetime, the subscription isn't considered terminated until the NOTIFY with a Subscription-State of "terminated" is sent. ๐Ÿ™ˆ

If a subscription's destruction leaves no other application state associated with the dialog, the dialog terminates. Destroying other application state (like the kind an INVITE creates) won't terminate the dialog if a subscription is still associated with it ๐ŸŒˆ

Note that the above behavior means a dialog created with an INVITE doesn't necessarily terminate when a BYE comes in. Similarly, if several subscriptions are associated with a single dialog, the dialog doesn't terminate until all of the subscriptions in it are destroyed. ๐Ÿ’…

3.3.5. State Agents and Notifier Migration ๐Ÿ”ฅ

When state agents (see section 4.4.11.) are used, it's often super handy to let subscriptions migrate between state agents and the nodes they're aggregating state for (or even among various state agents) ๐Ÿ”ฅ. Migration can be done by sending a NOTIFY with a Subscription-State header of "terminated" and a reason parameter of "deactivated". This NOTIFY is otherwise normal, and it's formed as described in section 3.2.2.

Upon receipt of this NOTIFY, the subscriber SHOULD attempt to re-subscribe (as described in the preceding sections). Note that this subscription gets set up on a new dialog, and it does not re-use the route set from the previous subscription dialog ๐Ÿงš

The actual migration happens by changing the policy (such as routing decisions) of one or more servers that the SUBSCRIBE request will be sent to, so that a different node ends up responding to it ๐Ÿฆ‹. This can be as simple as a change in the local policy of the notifier the subscription is migrating from, so that it acts as a proxy or redirect server instead of a notifier.

Whether, when, and why to perform notifier migrations may be described in individual event packages. Otherwise, these decisions are a matter of local notifier policy and are left up to individual implementations ๐ŸŒˆ

3.3.6. Polling Resource State ๐Ÿ“

A natural consequence of everything in the preceding sections is that an immediate fetch without a persistent subscription can be done by sending a SUBSCRIBE with an Expires of 0 ๐Ÿ“

Of course, an immediate fetch while a subscription is active can be done by sending a SUBSCRIBE with an Expires equal to the number of seconds remaining in the subscription โญ

Upon receipt of this SUBSCRIBE request, the notifier (or notifiers, if the SUBSCRIBE request was forked) will send a NOTIFY request containing resource state in the same dialog โœจ

Note that NOTIFY messages triggered by SUBSCRIBE messages with Expires headers of 0 will contain a Subscription-State value of "terminated", and a reason parameter of "timeout" ๐Ÿ’€

Polling of event state can cause significant increases in load on the network and on notifiers, so it should be used only sparingly ๐Ÿ™ˆ. In particular, polling SHOULD NOT be used in circumstances where it will typically result in more network messages than long-running subscriptions.

When polling is used, subscribers SHOULD attempt to cache authentication credentials between polls, so as to reduce the number of messages sent ๐Ÿ’…

3.3.7. Allow-Events header usage ๐Ÿ’–

The Allow-Events header, if present, includes a list of tokens which indicates the event packages supported by the client (if sent in a request) or server (if sent in a response). In other words, a node sending an Allow-Events header is advertising that it can process SUBSCRIBE requests and generate NOTIFY requests for all of the event packages listed in that header ๐Ÿ’–

Any node implementing one or more event packages SHOULD include an appropriate Allow-Events header indicating all supported events in all methods which initiate dialogs and their responses (such as INVITE), and in OPTIONS responses ๐Ÿ‘‘

This information is super useful, for example, in letting user agents render particular interface elements appropriately, depending on whether the events needed to implement those features are supported by the appropriate nodes ๐ŸŒธ

Note that Allow-Events headers MUST NOT be inserted by proxies.

3.3.8. PINT Compatibility ๐ŸŽ€

The Event header is considered mandatory for the purposes of this document. However, to maintain compatibility with PINT (see [2]), servers MAY interpret a SUBSCRIBE request with no Event header as requesting a subscription to PINT events. If a server does not support PINT, it SHOULD return 489 Bad Event to any SUBSCRIBE messages without an Event header ๐ŸŽ€

4. Event Packages ๐Ÿงš

This section covers several issues which should be taken into consideration when event packages based on SUBSCRIBE and NOTIFY are proposed ๐Ÿงš

4.1. Appropriateness of Usage ๐Ÿค”

When designing an event package using the methods described in this document for event notification, it's important to ask: is SIP an appropriate mechanism for the problem set? Is SIP being picked because of some unique feature the protocol provides (e.g., user mobility), or merely because "it can be done?" ๐Ÿค” If you find yourself defining event packages for notifications about, for example, network management or the temperature inside your car's engine, you may want to rethink your choice of protocol ๐Ÿš—๐Ÿ’€

Those interested in extending the mechanism defined in this document are urged to follow the development of "Guidelines for Authors of SIP Extensions" [7] for further guidance on appropriate uses of SIP. ๐Ÿ“š

Further, this mechanism is not expected to be used in applications where reportable events happen excessively rapidly (e.g., more than about once per second). A SIP network is generally going to be provisioned for a reasonable signalling volume, and sending a notification every time a user's GPS position changes by one hundredth of a second could easily overload such a network ๐Ÿ—บ๏ธ๐Ÿ˜ญ

4.2. Event Template-packages ๐ŸŒˆ

Normal event packages define a set of state applied to a specific type of resource, such as user presence, call state, and messaging mailbox state ๐Ÿ’œ

Event template-packages are a special type of package that defines a set of state applied to other packages, such as statistics, access policy, and subscriber lists. Event template-packages may even be applied to other event template-packages โœจ

To stretch the object-oriented analogy from earlier, event template-packages can be thought of as templatized C++ packages, which must be applied to other packages to be useful ๐Ÿงฉ

The name of an event template-package, as applied to a package, is formed by appending a period followed by the event template-package name to the end of the package. For example, if a template-package called "winfo" were applied to a package called "presence", the event token used in Event and Allow-Events would be presence.winfo ๐Ÿฆ‹

Event template-packages must be defined so that they can be applied to any arbitrary package. In other words, event template-packages cannot be tied specifically to one or a few "parent" packages in such a way that they won't work with other packages ๐Ÿซถ

4.3. Amount of State to be Conveyed ๐Ÿ“

When designing event packages, it's important to think about the type of information that will be conveyed during a notification ๐Ÿ“

A natural temptation is to convey merely the event (e.g., "a new voice message just arrived") without the accompanying state (e.g., "7 total voice messages"). This complicates implementation for subscribing entities, since they have to maintain complete state for the entity they've subscribed to, and it's also particularly susceptible to synchronization problems ๐Ÿ˜ตโ€๐Ÿ’ซ

There are two possible solutions to this problem that event packages may choose to implement ๐Ÿ’…

4.3.1. Complete State Information ๐Ÿ’–

For packages that typically convey state information that's reasonably small (on the order of 1 kb or so), it is suggested that event packages are designed to send complete state information when an event occurs ๐Ÿ’–

In some circumstances, conveying the current state alone may be insufficient for a particular class of events. In these cases, the event packages should include complete state information along with the event that occurred. For example, conveying "no customer service representatives available" may not be as useful as conveying "no customer service representatives available; representative sip:46@cs.xyz.int just logged off" ๐Ÿง โœจ

4.3.2. State Deltas โœจ

Okay so what if the state info is huge ๐Ÿ˜ญ? The event package can pick a delta scheme, where NOTIFYs only carry what changed instead of the whole state. It's giving efficiency ๐Ÿงฉ

Here's how it goes: any NOTIFY sent in immediate response to a SUBSCRIBE contains full state information. NOTIFY messages sent because of a state change only contain the state information that has changed, and the subscriber then merges that into what it already knows about the resource. Merge, not replace, bestie ๐Ÿ’œ

Any event package that supports delta changes to states MUST include a version number that increases by exactly one for each NOTIFY transaction in a subscription. Note that the state version number lives in the body of the message, not in a SIP header ๐ŸŽ€

Now the spicy part ๐ŸŒถ๏ธ If a NOTIFY shows up with a version number that jumped by more than one, the subscriber knows a state delta went missing. So it ignores that NOTIFY's state delta (it still keeps the version number, so it can detect message loss), and re-sends a SUBSCRIBE to force a NOTIFY with a complete state snapshot. Full reset, iconic ๐Ÿ‘‘


4.4. Event Package Responsibilities ๐Ÿ’…

Event packages aren't required to repeat anything this document already says, although they can if they want to be extra clear or emphasize something ๐ŸŒธ Usually though, packages should only describe the behavior that extends or modifies what's written here. No need to retype the whole thing, babe ๐Ÿ™ˆ

Heads up: any behavior marked with "SHOULD" or "MUST" in this document can't be weakened by extension documents ๐Ÿ’€ However, those documents can totally strengthen a "SHOULD" to a "MUST" if their application needs it. Upgrades only, no downgrades โญ

In addition to the normal sections you'd expect in standards-track RFCs and SIP extension documents, event package authors need to address each of the issues in the subsections below, whenever they apply ๐Ÿฆ‹

4.4.1. Event Package Name

This section MUST be present ๐Ÿซถ It defines the token name used to designate the event package, and it MUST include the info that appears in the IANA registration of the token. For how to register these types, see section 6 ๐Ÿ“

4.4.2. Event Package Parameters

If parameters are used on the Event header to modify the event package's behavior, the syntax and semantics of those headers MUST be clearly defined. No vibes-based parameters allowed ๐Ÿ™…โ€โ™€๏ธ

4.4.3. SUBSCRIBE Bodies

Most event packages (but not all!) will define syntax and semantics for SUBSCRIBE bodies ๐Ÿ“ These bodies usually modify, expand, filter, throttle, and/or set thresholds for the class of events being requested. Package designers are strongly encouraged to reuse existing MIME types for message bodies whenever it's practical, so nobody has to reinvent the wheel โœจ

This mandatory section defines which type or types of event bodies are expected in SUBSCRIBE requests, or specifies that no event bodies are expected. It should point to detailed definitions of the syntax and semantics for every referenced body type ๐Ÿ“š

4.4.4. Subscription Duration

It is RECOMMENDED that event packages give a suggested range of times that's considered reasonable for how long a subscription lasts โฐ Packages MUST also define a default Expires value to use if none is specified. Every subscription deserves a timer, periodt ๐Ÿ’–

4.4.5. NOTIFY Bodies

The NOTIFY body is how the resource's state gets reported to the subscriber ๐Ÿงš Each package MUST define which type or types of event bodies are expected in NOTIFY requests. Packages MUST specify or cite detailed specifications for the syntax and semantics of each event body.

Event packages also MUST define which MIME type is assumed if none is specified in the Accept header of the SUBSCRIBE request. Default MIME type era ๐ŸŒˆ

4.4.6. Notifier processing of SUBSCRIBE requests

This section describes what the notifier has to do when it gets a SUBSCRIBE request. It's required, no exceptions ๐Ÿ‘‘

This is also where you'd put details on how to authenticate subscribers, plus authorization issues for the package. Those authorization issues might include things like whether all SUBSCRIBE requests for this package get answered with 202 responses (see section 5.2.) ๐Ÿ”

4.4.7. Notifier generation of NOTIFY requests

This section is where the package explains how the notifier generates and sends a NOTIFY request ๐Ÿ”” It covers what events trigger a NOTIFY, how to compute the state info inside it, how to generate neutral or fake state to hide authorization delays and decisions from users, and whether notifications carry complete state or deltas (see section 4.3). Such a section is required, because obviously ๐Ÿ™„

This section may optionally describe the behavior used to process the subsequent response too ๐Ÿ’…

4.4.8. Subscriber processing of NOTIFY requests

This section describes what the subscriber does after it receives a NOTIFY request, including any logic needed to form a coherent resource state (if that applies) ๐Ÿงฉ It's the subscriber's glow-up moment โœจ

4.4.9. Handling of forked requests

Each event package MUST specify whether forked SUBSCRIBE requests are allowed to install multiple subscriptions. Ngl this one is a whole saga ๐Ÿฟ

If that's not allowed, the first potential dialog-establishing message creates a dialog. Any NOTIFY that matches the SUBSCRIBE message (meaning it matches To, From, the tag parameter of the From header, Call-ID, CSeq, Event, and the id parameter of the Event header) but doesn't match the dialog gets rejected with a 481 response ๐Ÿšซ Also, a 200-class response to the SUBSCRIBE can arrive after a matching NOTIFY has already been received, and those responses might not correlate to the same dialog the NOTIFY established. So, unless they're needed to complete the SUBSCRIBE transaction, those non-matching 200-class responses get ignored ๐Ÿ™ˆ

If installing multiple subscriptions from a single forked SUBSCRIBE is allowed, the subscriber establishes a new dialog towards each notifier by returning a 200-class response to each NOTIFY. Each dialog is handled as its own entity and refreshed independently of the others ๐Ÿฆ‹

When multiple subscriptions are allowed, the event package MUST specify whether merging the notifications into a single state is required, and how that merging is supposed to happen. Some packages might be built so each dialog ties to a mutually exclusive state that the other dialogs don't affect, and if that's the case it MUST be clearly stated ๐ŸŒธ

4.4.10. Rate of notifications

Each event package is expected to define a requirement (SHOULD or MUST strength) setting an absolute maximum on how fast a single notifier is allowed to generate notifications ๐Ÿข Each package MAY further define a throttle mechanism that lets subscribers limit the rate of notification even more ๐Ÿซถ

4.4.11. State Agents

Package designers should consider whether their package can benefit from network aggregation points (state agents) and/or nodes that act on behalf of other nodes ๐ŸŒ For example, a node might provide state info about a resource that can't or won't provide it itself. A classic example is a node that tracks a user's presence and availability on the network ๐Ÿงš

If state agents are used by the package, the package MUST specify how those state agents aggregate information and how they handle authentication and authorization. Event packages MAY also outline specific scenarios where notifier migrations take place ๐Ÿฆ‹

4.4.12. Examples

Event packages SHOULD include several demonstrative message flow diagrams, paired with several typical, syntactically correct, and complete messages ๐Ÿ“ธ

It is RECOMMENDED that documents describing event packages clearly say these examples are informative and not normative, with instructions telling implementors to refer to the main text for the exact protocol details ๐Ÿ“– Examples are the vibe, the main text is the truth ๐Ÿ’œ

4.4.13. Use of URIs to Retrieve State

Some event packages may define state information that's potentially too large to reasonably send in a SIP message ๐Ÿ˜ To fix that, event packages may include the ability to convey a URI instead of the state info. That URI then gets used to retrieve the actual state information ๐Ÿ”—

The precise mechanisms for conveying such URIs are out of scope for this document ๐Ÿคทโ€โ™€๏ธ


5. Security Considerations ๐Ÿ”

5.1. Access Control

The ability to accept subscriptions should be under the direct control of the notifier's user, since many event types are sensitive for privacy purposes ๐Ÿซฃ Similarly, the notifier should be able to selectively reject subscriptions based on the subscriber's identity (using access control lists), via standard SIP authentication mechanisms. How those access control lists get created and distributed is outside the scope of this document ๐Ÿ—๏ธ

5.2. Notifier Privacy Mechanism

Just returning a 200 or certain 4xx and 6xx responses to SUBSCRIBE requests can, in some situations, create privacy concerns by revealing sensitive policy information ๐Ÿ˜ฑ In these cases, the notifier SHOULD always return a 202 response. The subsequent NOTIFY message may not convey the true state, but it MUST appear to contain a potentially correct piece of data from the subscriber's point of view, indistinguishable from a valid response ๐ŸŽญ Information about whether a user is authorized to subscribe to the requested state is never conveyed back to the original user under these circumstances. Secrets stay secret, bestie ๐Ÿคซ

Individual packages, and their related documents, for which this mode of operation makes sense can further describe how and why to generate such potentially correct data. For example, this mode of operation is mandated by RFC 2779 [6] for user presence information ๐Ÿงพ

5.3. Denial-of-Service attacks

The current model (one SUBSCRIBE request triggers a SUBSCRIBE response and one or more NOTIFY requests) is a classic setup for an amplifier node to be used in a smurf attack ๐Ÿšจ Yikes, a whole disaster waiting to happen.

Also, creating state when a SUBSCRIBE request arrives can be used by attackers to eat up resources on a victim's machine, making it unusable ๐Ÿ’€

To reduce the chances of this kind of attack, notifier implementations SHOULD require authentication. Authentication issues are discussed in SIP [1] ๐Ÿ›ก๏ธ

5.4. Replay Attacks

Replaying either SUBSCRIBE or NOTIFY messages can have detrimental effects ๐Ÿ˜ญ

With SUBSCRIBE messages, attackers may be able to install any arbitrary subscription they witnessed being installed at some point in the past. Replaying NOTIFY messages may be used to spoof old state information (although a good versioning mechanism in the body of NOTIFY messages may help mitigate that attack). Also note that the prohibition on sending NOTIFY messages to nodes that haven't subscribed to an event helps reduce the effects of this attack too ๐Ÿ™…โ€โ™€๏ธ

To prevent these attacks, implementations SHOULD require authentication with anti-replay protection. Authentication issues are discussed in SIP [1] ๐Ÿ”

5.5. Man-in the middle attacks ๐Ÿ•ต๏ธโ€โ™€๏ธ

okay so even WITH authentication, sneaky man-in-the-middle attacks can still use SUBSCRIBE to ๐Ÿ’€ install random subscriptions, hijack ones that already exist, kill ones that are still going, or change the resource a subscription is pointed at. nah, not on my watch. ๐Ÿ™…โ€โ™€๏ธ To stop that, implementations SHOULD provide integrity protection across the "Contact", "Route", "Expires", "Event", and "To" headers of SUBSCRIBE messages, at a minimum. If SUBSCRIBE bodies are used to define further information about the state of the call, they SHOULD be included in the integrity protection scheme too. ๐Ÿ”’

Man-in-the-middle attackers can also try to use NOTIFY messages to fake state information and/or end subscriptions that are still active. ugh, the audacity ๐Ÿ˜ค To block that, implementations SHOULD provide integrity protection across the "Call-ID", "CSeq", and "Subscription-State" headers and the bodies of NOTIFY messages. ๐Ÿ›ก๏ธ

Integrity protection of message headers and bodies is discussed in SIP [1]. go read it, bestie ๐Ÿ“–

5.6. Confidentiality ๐Ÿคซ

ok so the state info inside a NOTIFY message could easily be sensitive stuff ๐Ÿ‘€ Implementations MAY encrypt that info to keep it confidential. ๐Ÿ”

It's less likely, but the info inside a SUBSCRIBE message could also be stuff users really don't want anyone seeing. ๐Ÿ™ˆ Implementations MAY encrypt that info to keep it confidential too.

So the remote party can hide anything it considers sensitive, all implementations SHOULD be able to handle encrypted SUBSCRIBE and NOTIFY messages. the glow-up is real ๐Ÿ’–

The mechanisms for providing confidentiality are detailed in SIP [1]. โœจ

6. IANA Considerations ๐ŸŒธ

this document sets up an event-type namespace, and that needs a central coordinating body. the one picked for the job is the Internet Assigned Numbers Authority (IANA). ๐Ÿ‘‘

there are two kinds of event-types: normal event packages and event template-packages (check out section 4.2 if you wanna see the details ๐Ÿ‘€). to avoid confusion, template-package names and package names share the same namespace. in other words, an event template-package MUST NOT share a name with a package. no duplicate names, periodt ๐Ÿ™…โ€โ™€๏ธ

we follow the rules from "Guidelines for Writing an IANA Considerations Section in RFCs" [4] ๐Ÿ“‹. normal event package identification tokens are handed out First Come First Served, and event template-package identification tokens are handed out on an IETF Consensus basis. ๐Ÿงš

Registrations with the IANA MUST include the token being registered and whether the token is a package or a template-package. Further, packages MUST include contact information for the party responsible for the registration and/or a published document which describes the event package. Event template-package token registrations MUST include a pointer to the published RFC which defines the event template-package. ๐Ÿ“

Registered tokens for packages and template-packages MUST NOT contain the character ".", because that's the character used to separate template-packages from packages. ๐Ÿšซ

6.1. Registration Information ๐Ÿ“š

since this document doesn't specify any package or template-package names, the initial IANA registration for event types is going to be empty. ๐Ÿซ  The rest of this section gives an example of the kind of info the IANA keeps track of, and it shows off all five possible combos of package type, contact, and reference. it's giving organized ๐Ÿ’…

the table below lists the event packages and template-packages defined in "SIP-Specific Event Notification" [RFC3265]. each name is marked as a package or a template-package under "Type". ๐ŸŽ€

Package Name      Type         Contact      Reference
------------      ----         -------      ---------
example1          package      [Roach]
example2          package      [Roach]      [RFC3265]
example3          package                   [RFC3265]
example4          template     [Roach]      [RFC3265]
example5          template                  [RFC3265]

PEOPLE
------
[Roach] Adam Roach <adam@dynamicsoft.com>

REFERENCES
----------
[RFC3265] Roach, A., "SIP-Specific Event Notification", RFC 3265,
          June 2002.

6.2. Registration Template ๐Ÿ“

this is the template you fill out to register a new SIP event package. pls be thorough, it's giving professional ๐Ÿ’ผ

To: ietf-sip-events@iana.org
Subject: Registration of new SIP event package

Package Name:

    (Package names must conform to the syntax described in
    section 7.2.1.)

Is this registration for a Template Package:

    (indicate yes or no)

Published Specification(s):

    (Template packages require a published RFC. Other packages
    may reference a specification when appropriate).

Person & email address to contact for further information:

6.3. Header Field Names ๐ŸŽ€

this document registers three new header field names, which are described elsewhere in the document. they get added to the header sub-registry under http://www.iana.org/assignments/sip-parameters. ๐Ÿงš

Header Name:   Allow-Events
Compact Form:  u
Header Name:   Subscription-State
Compact Form:  (none)

Header Name:   Event
Compact Form:  o

6.4. Response Codes ๐Ÿ”ข

this document registers two new response codes ๐Ÿ™Œ They get added to the method and response-code sub-registry under http://www.iana.org/assignments/sip-parameters. โœจ

Response Code Number:   202
Default Reason Phrase:  Accepted

Response Code Number:   489
Default Reason Phrase:  Bad Event

7. Syntax ๐Ÿงฉ

this section covers the syntax extensions needed for event notification in SIP. the semantics are over in section 3. ngl, the formal syntax definitions in this document are written in the ABNF format used in SIP [1], and they reference elements defined there, so keep SIP [1] open ๐Ÿ“–๐Ÿ’•

7.1. New Methods ๐Ÿฆ‹

this document adds two new SIP methods: SUBSCRIBE and NOTIFY. ๐Ÿฅน

this table expands on tables 2 and 3 in SIP [1].

Header                    Where    SUB NOT
------                    -----    --- ---
Accept                      R       o   o
Accept                     2xx      -   -
Accept                     415      o   o
Accept-Encoding             R       o   o
Accept-Encoding            2xx      -   -
Accept-Encoding            415      o   o
Accept-Language             R       o   o
Accept-Language            2xx      -   -
Accept-Language            415      o   o
Alert-Info                  R       -   -
Alert-Info                 180      -   -
Allow                       R       o   o
Allow                      2xx      o   o
Allow                       r       o   o
Allow                      405      m   m
Authentication-Info        2xx      o   o
Authorization               R       o   o
Call-ID                     c       m   m
Contact                     R       m   m
Contact                    1xx      o   o
Contact                    2xx      m   o
Contact                    3xx      m   m
Contact                    485      o   o
Content-Disposition                 o   o
Content-Encoding                    o   o
Content-Language                    o   o
Content-Length                      t   t
Content-Type                        *   *
CSeq                        c       m   m
Date                                o   o
Error-Info               300-699    o   o
Expires                             o   -
Expires                    2xx      m   -
From                        c       m   m
In-Reply-To                 R       -   -
Max-Forwards                R       m   m
Min-Expires                423      m   -
MIME-Version                        o   o
Organization                        o   -
Priority                    R       o   -
Proxy-Authenticate         407      m   m
Proxy-Authorization         R       o   o
Proxy-Require               R       o   o
RAck                        R       -   -
Record-Route                R       o   o
Record-Route           2xx,401,484  o   o
Reply-To                            -   -
Require                             o   o
Retry-After        404,413,480,486  o   o
Retry-After              500,503    o   o
Retry-After              600,603    o   o
Route                       R       c   c
RSeq                       1xx      o   o
Server                      r       o   o
Subject                     R       -   -
Supported                   R       o   o
Supported                  2xx      o   o
Timestamp                           o   o
To                         c(1)     m   m
Unsupported                420      o   o
User-Agent                          o   o
Via                         c       m   m
Warning                     R       -   o
Warning                     r       o   o
WWW-Authenticate           401      m   m

7.1.1. SUBSCRIBE method ๐Ÿ“ฉ

"SUBSCRIBE" gets added to the definition of the element "Method" in the SIP message grammar. โœ๏ธ

like every SIP method name, SUBSCRIBE is case sensitive, so be precise ๐Ÿง The SUBSCRIBE method is used to ask for asynchronous notification of an event or a set of events at some later time. โฐ

7.1.2. NOTIFY method ๐Ÿ””

"NOTIFY" also gets added to the definition of the element "Method" in the SIP message grammar. ๐ŸŽ‰

the NOTIFY method is how a SIP node gets told that an event it asked for earlier with a SUBSCRIBE has happened. it can also include more details about the event. the tea is served ๐Ÿต

7.2. New Headers ๐Ÿ’…

this table expands on tables 2 and 3 in SIP [1], as changed by what's described in section 7.1. ๐Ÿง

Header field      where proxy ACK BYE CAN INV OPT REG PRA SUB NOT
-----------------------------------------------------------------
Allow-Events        R          o   o   -   o   o   o   o   o   o
Allow-Events       2xx         -   o   -   o   o   o   o   o   o
Allow-Events       489         -   -   -   -   -   -   -   m   m
Event               R          -   -   -   -   -   -   -   m   m
Subscription-State  R          -   -   -   -   -   -   -   -   m

7.2.1. "Event" header ๐ŸŽฏ

"Event" gets added to the definition of the element "message-header" in the SIP message grammar. ๐Ÿ’–

so when we're matching responses and NOTIFY messages up with SUBSCRIBE messages, the event-type part of the "Event" header gets compared byte-by-byte, and so does the "id" parameter token (if it's there). an "Event" header that has an "id" parameter NEVER matches one without an "id" parameter. ๐Ÿ™…โ€โ™€๏ธ No other parameters get looked at during the comparison. ๐Ÿ”

Note that the forgoing text means that Event: foo; id=1234 would match Event: foo; param=abcd; id=1234, but not Event: foo (id does not match) or Event: Foo; id=1234 (event portion does not match). ๐Ÿ’€

this document doesn't define any event-type values. individual event packages will define those, and they MUST be registered with the IANA. ๐Ÿ“

There MUST be exactly one event type listed per event header. Multiple events per message are disallowed. one event per header, no exceptions, bestie ๐Ÿซถ

7.2.2. "Allow-Events" Header ๐Ÿฆ‹

Allow-Events gets added to the definition of the element "general-header" in the SIP message grammar. its usage is described in section 3.3.7. โœจ

7.2.3. "Subscription-State" Header ๐ŸŒˆ

Subscription-State gets added to the definition of the element "request-header" in the SIP message grammar. its usage is described in section 3.2.4. ๐ŸŽ€

7.3. New Response Codes ๐ŸŽ‰

7.3.1. "202 Accepted" Response Code ๐ŸŽ€

okay so the 202 response gets added to the "Success" header field definition ๐Ÿ’… and "202 Accepted" means exactly what it means in HTTP/1.1 [3] โœจ

7.3.2. "489 Bad Event" Response Code ๐Ÿ™ˆ

the 489 event response gets added to the "Client-Error" header field definition ๐Ÿ’€ "489 Bad Event" is for when the server doesn't understand the event package named in an "Event" header field. no cap, that's the whole vibe ๐Ÿซถ

7.4. Augmented BNF Definitions ๐Ÿงš

the Augmented BNF definitions for all the new and modified syntax bits are right here ๐Ÿ’– they use the same notation as SIP [1], and anything not defined in this section is defined in SIP and the docs it points to. iykyk ๐ŸŒธ

SUBSCRIBEm        = %x53.55.42.53.43.52.49.42.45 ; SUBSCRIBE in caps
NOTIFYm           = %x4E.4F.54.49.46.59 ; NOTIFY in caps
extension-method  = SUBSCRIBEm / NOTIFYm / token
Event             =  ( "Event" / "o" ) HCOLON event-type
                     *( SEMI event-param )
event-type        =  event-package *( "." event-template )
event-package     =  token-nodot
event-template    =  token-nodot
token-nodot       =  1*( alphanum / "-"  / "!" / "%" / "*"
                         / "_" / "+" / "`" / "'" / "~" )
event-param       =  generic-param / ( "id" EQUAL token )

Allow-Events =  ( "Allow-Events" / "u" ) HCOLON event-type
                *(COMMA event-type)

Subscription-State   = "Subscription-State" HCOLON substate-value
                       *( SEMI subexp-params )
substate-value       = "active" / "pending" / "terminated"
                       / extension-substate
extension-substate   = token
subexp-params        =   ("reason" EQUAL event-reason-value)
                       / ("expires" EQUAL delta-seconds)
                       / ("retry-after" EQUAL delta-seconds)
                       / generic-param
event-reason-value   =   "deactivated"
                       / "probation"
                       / "rejected"
                       / "timeout"
                       / "giveup"
                       / "noresource"
                       / event-reason-extension
event-reason-extension = token

8. Normative References โœจ

  • [1] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M. and E. Schooler, "SIP: Session Initiation Protocol", RFC 3261, June 2002.
  • [2] Petrack, S. and L. Conroy, "The PINT Service Protocol", RFC 2848, June 2000.
  • [3] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P. and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
  • [4] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 2434, October 1998.
  • [5] Bradner, S., "Key Words for Use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [6] Day, M., Aggarwal, S., Mohr, G. and J. Vincent, "Instant Messaging/Presence Protocol Requirements", RFC 2779, February 2000.

9. Informative References ๐Ÿ“š

  • [7] Rosenberg, J. and H. Schulzrinne, "Guidelines for Authors of SIP Extensions", Work in Progress.
  • [8] Schulzrinne, H. and J. Rosenberg, "SIP Caller Preferences and Callee Capabilities", Work in Progress.

10. Acknowledgements ๐Ÿซถ

thank you SO much to the people at the Events BOF at the 48th IETF meeting in Pittsburgh, and to everyone who dropped ideas and suggestions on the SIP Events mailing list ๐Ÿ’œ Henning Schulzrinne of Columbia University came up with the final three-tiered event identification scheme, Sean Olson gave miscellaneous guidance, Jonathan Rosenberg did a thorough scrubbing of the -00 draft, and the authors of the "SIP Extensions for Presence" document gave their input on SUBSCRIBE and NOTIFY request semantics. absolute legends, all of them ๐Ÿ‘‘

11. Notice Regarding Intellectual Property Rights ๐ŸŒˆ

the IETF has been notified of intellectual property rights claimed in regard to some or all of the specification in this document. for more info, check the online list of claimed rights at http://www.ietf.org/ipr.html

12. Author's Address ๐Ÿฆ‹

Adam Roach
dynamicsoft
5100 Tennyson Parkway
Suite 1200
Plano, TX 75024
USA

EMail: adam@dynamicsoft.com
Voice: sip:adam@dynamicsoft.com

the legal bits stay word-for-word, no edits, because they're serious business ๐Ÿ™

Copyright (C) The Internet Society (2002).  All Rights Reserved.

This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works.  However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.

The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.

This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Acknowledgement ๐Ÿ’–

funding for the RFC Editor function is currently provided by the Internet Society ๐ŸŽ€

๐Ÿ“ฆ where this page comes from