<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY rfc2119 PUBLIC '' 'reference.RFC.2119.xml'>
  <!ENTITY rfc3261 PUBLIC '' 'reference.RFC.3261.xml'>
  <!ENTITY rfc3515 PUBLIC '' 'reference.RFC.3515.xml'>
  <!ENTITY rfc3840 PUBLIC '' 'reference.RFC.3840.xml'>
  <!ENTITY rfc3903 PUBLIC '' 'reference.RFC.3903.xml'>
  <!ENTITY rfc4321 PUBLIC '' 'reference.RFC.4321.xml'>
  <!ENTITY rfc4474 PUBLIC '' 'reference.RFC.4474.xml'>
  <!ENTITY rfc4538 PUBLIC '' 'reference.RFC.4538.xml'>
  <!ENTITY rfc5057 PUBLIC '' 'reference.RFC.5057.xml'>
  <!ENTITY rfc5589 PUBLIC '' 'reference.RFC.5589.xml'>
  <!ENTITY rfc5627 PUBLIC '' 'reference.RFC.5627.xml'>
  <!ENTITY rfc6665 PUBLIC '' 'reference.RFC.6665.xml'>
]>

<?rfc toc="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<?rfc sortrefs="yes" ?>
<?rfc strict="yes" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes" ?>
<?rfc symrefs="yes" ?>


<rfc number="7614" ipr="trust200902" submissionType="IETF" category="std" consensus="yes" >

<front>

<title abbrev="REFER Explicit Subscriptions">
Explicit Subscriptions for the REFER Method
</title>

<author initials="R." surname="Sparks" fullname="Robert Sparks" >
<organization>Oracle</organization>
<address>
<postal>
<street>7460 Warren Parkway, Suite 300</street>
<city>Frisco</city>
<region>Texas</region>
<code>75034</code>
<country>United States</country>
</postal>
<email>rjsparks@nostrum.com</email>
</address>
</author>

<date  month="August" year="2015"/>


<abstract> 

<t> 

The Session Initiation Protocol (SIP) REFER request, as defined by RFC 3515,
triggers an implicit SIP-Specific Event Notification framework subscription.
Conflating the start of the subscription with handling the REFER request makes
negotiating SUBSCRIBE extensions impossible and complicates avoiding SIP
dialog sharing. This document defines extensions to REFER that remove the
implicit subscription and, if desired, replace it with an explicit one.  

</t> 

</abstract>

</front>

<middle>

<section anchor="intro" title="Introduction">
<t>

REFER, as defined by <xref target="RFC3515"/>, triggers an implicit SIP-Specific
Event Framework subscription. Sending a REFER within a dialog established by an
INVITE results in dialog reuse and the associated problems described in <xref
target="RFC5057"/>.  The SIP-Specific Event Notification framework definition
<xref target="RFC6665"/> disallows such dialog reuse.  Call transfer, as
defined in <xref target="RFC5589"/>, thus requires sending a REFER request on a
new dialog, associating it with an existing dialog using the 'Target-Dialog'
mechanism defined in <xref target="RFC4538"/>.

</t><t> 

Because there is no explicit SUBSCRIBE request, the tools for negotiating
subscription details are unavailable for REFER subscriptions. This includes
negotiating subscription duration and providing information through Event
header field parameters. The use of the SIP 'Supported' and 'Require' extension
mechanisms <xref target="RFC3261"/> is complicated by the implicit
subscription. It is unclear whether or not the extension applies to handling the REFER
request itself, to the messages in the subscription created by the REFER, or to
both.  Avoiding this confusion requires careful specification in each
extension. Existing extensions do not provide this clarity.  

</t><t> 

This document defines two mechanisms that remove the implicit subscription, one
of which replaces it with an explicit one. The benefits of doing so include: 

</t><t>

<list style="symbols"> 

<t>Allowing REFER to be used within INVITE-created dialogs without creating
dialog reuse.</t>

<t>Allowing standard subscription parameter negotiation.</t> 

<t>Allowing standard negotiation of SIP extensions.</t> 

</list>
</t>

<t>There are limitations on when it is appropriate to use the extension
that allows an explicit subscription, related directly to definition of
non-INVITE transaction handling SIP. These limitations are discussed in
<xref target="referrer-req"/>.
</t>

</section>

<section anchor="conventions" title="Conventions" >
<t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in <xref target= "RFC2119"/>.
</t>
</section>

<section anchor="overview" title="Overview">

<t>

This section provides a non-normative overview of the behaviors defined in
subsequent sections.

</t>


<section anchor="overview-explicit" title="Explicit Subscriptions">
<t>

A SIP User Agent (UA) that wishes to issue a REFER request that will not create
an implicit subscription, but will allow an explicit one,  will include a new
option tag, 'explicitsub', in the Require header field of the REFER request.
This REFER could be sent either within an existing dialog or as an
out-of-dialog request.

</t><t>

If the recipient of the REFER accepts the request, it will begin managing the
'refer' event state described in RFC 3515 and will provide a URI that will
reach an event server that will service subscriptions to that state. (In many
cases, the recipient of the REFER will perform the role of event server
itself.) That URI is returned in a new header field in the REFER response named
'Refer-Events-At'.

</t><t>

The UA that issued the REFER can now subscribe to the 'refer' event at the
provided URI, using a SUBSCRIBE request with a new dialog identifier. The full
range of negotiation mechanisms is available for its use in that request.  As
detailed in RFCs 6665 and 3515, the event server accepting the subscription
will send an immediate NOTIFY with the current refer event state, additional
NOTIFY messages as the refer state changes, and a terminal NOTIFY message when
the referred action is complete. It is, of course, possible that the initial
NOTIFY is also the terminal NOTIFY.

</t><t>

It is possible that the referred action is completed before the SUBSCRIBE
arrives at the event server. The server needs to retain the final refer event
state for some period of time to include in the terminal NOTIFY that will be
sent for such subscriptions. It is also possible that a SUBSCRIBE will never
arrive.

</t><t>

This extension makes it possible to separate the event server that will handle
subscriptions from the UA that accepted the REFER. Such a UA could use
mechanisms such as PUBLISH <xref target="RFC3903"/> to convey the refer event
state to the event server. This extension also makes it possible to allow more
than one subscription to the refer event state.

</t>
</section>

<section anchor="overview-nosub" title="No Subscriptions">

<t>

A UA that wishes to issue a REFER request that will not create an implicit
subscription and wishes to tell the recipient that it is not interested in creating
an explicit subscription will include a new option tag, 'nosub', in the 
Require header field of the REFER request. This REFER could be sent either
within an existing dialog or as an out-of-dialog request. 

</t><t>

If the recipient of the REFER accepts the request, it knows not to create an
implicit subscription and knows that no explicit subscription will be forthcoming.
The recipient will continue to process the request indicated in the Refer-To
header field as specified in RFC 3515, but it can avoid the cost of preparing
to handle any 'refer' event subscriptions related to this REFER request.
</t>

</section>

</section>

<section anchor="explicitprotocol" title="The Explicit Subscription Extension">

<section anchor="referrer-req" title="Sending a REFER">
<t>

To suppress the creation of any implicit subscription, and allow for an
explicit one, a UA forming a REFER request will include the option tag
'explicitsub' in the Require header field of the request.  The REFER request
is otherwise formed following the requirements of <xref target="RFC3515"/>.
Since this REFER has no chance of creating an implicit subscription, the UA MAY
send the REFER request within an existing dialog or out-of-dialog. 

</t><t>

Note that if the REFER forks (see <xref target="RFC3261"/>), only one final
response will be returned to the issuing UA. If it is important that the UA be
able to subscribe to any refer state generated by accepting this request, the
UA needs to form the request so that it will only be accepted in one place.
This can be achieved by sending the REFER request within an
existing dialog or by using the 'Target-Dialog' mechanism defined in <xref
target="RFC4538"/>.  If it is possible for the request to be accepted in more
than one location, and things would go wrong if the UA did not learn about each
location that the request was accepted, using this extension is not appropriate.

</t>
</section>

<section anchor="referrer-resp" title="Processing a REFER Response">
<t>

The UA will process responses to the REFER request as specified in <xref
target="RFC3515"/> (and, consequently, <xref target="RFC3261"/>).  In
particular, if the REFER was sent to an element that does not support or is
unwilling to use this extension, the response will contain a 420 (Bad
Extension) response code (see Section 8.1.3.5 of <xref target="RFC3261"/>). 
As that document states, the UA can retry the request without using this
extension.

</t><t>

If the UA receives a 2xx-class response, it will contain a Refer-Events-At
header field (<xref target="refer-events-at"/>) with a single URI as its value.
If the UA is interested in the state of the referenced action, it will
subscribe to the 'refer' event at that URI.

</t>
</section>

<section anchor="referree" title="Processing a Received REFER">
<t>

An element receiving a REFER request requiring the 'explicitsub' extension will
use the same admissions policies that are used without the extension, with
the addition that it is acceptable to admit an in-dialog REFER request
requiring this extension since it cannot create another usage inside that
dialog. In particular, see Section 5.2 of <xref target="RFC3515"/>.

</t><t>

Accepting a REFER request that requires 'explicitsub' does not create a dialog
or a new usage within an existing dialog. The element MUST NOT create an 
implicit subscription when accepting the REFER request. 

</t><t>

If the REFER request was received within an existing dialog,
the accepting element will not be acting as a SIP-Events notifier in the context
of that dialog. If it is not otherwise subject to becoming a notifier in the
context of the dialog, none of the requirements in <xref target="RFC6665"/>, particularly the
requirement to provide a Globally Routable User Agent URI (GRUU) as the local contact, apply to the message accepting
the REFER request.

</t><t>

An element that accepts a REFER request with 'explicitsub' in its Require
header field MUST return a 200 response containing a sip: or sips: URI 
in the Refer-Events-At header field 
that can
be used to subscribe to the refer event state associated with this REFER
request. This URI MUST uniquely identify this refer event state. The URI needs
to reach the event server when used in a SUBSCRIBE request from the element
that sent the REFER.  One good way to ensure the URI provided has that property
is to use a GRUU <xref target="RFC5627"/> for the event server. As discussed in
<xref target="security"/>, possession of this URI is often the only requirement
for authorizing a subscription to it.  Implementations SHOULD provide a URI
constructed in a way that is hard to guess. Again, using a GRUU (specifically,
a temporary GRUU) is one good way to achieve this property.

</t><t>

The accepting element will otherwise proceed with the processing defined
in <xref target="RFC3515"/>.
</t><t>


The event server identified by the Refer-Events-At URI could receive SUBSCRIBE
requests at any point after the response containing the Refer-Events-At
header field is sent.  Implementations should take care to ensure the event server
is ready to receive those SUBSCRIBE requests before sending the REFER response,
but as with all non-INVITE responses, the response should be sent as soon as
possible (see <xref target="RFC4321"/>). It is also possible that the referred
action may complete before any SUBSCRIBE request arrives. 
The event server will
need to maintain the final refer event state for a period of time after the action
completes in order to serve such subscriptions (see <xref target="referstate"/>). 
</t>



</section>

<section anchor="subscriber" title="Subscribing to the 'refer' Event">
<t>

A UA that possesses a URI obtained from a Refer-Events-At header field MAY
subscribe to the refer event state at that URI. It does so following the
requirements of <xref target="RFC6665"/>, placing the token 'refer' in the
Event header field and the URI in the Request-URI of the SUBSCRIBE request. 
The SUBSCRIBE request MUST NOT reuse any existing dialog identifiers.

</t><t>


Subsequent handling of the subscription MUST follow the requirements of <xref
target="RFC6665"/> and <xref target="RFC3515"/>.  In particular, as discussed
in Section 2.4.6 of <xref target="RFC3515"/>, the NOTIFY messages in the subscription might include an id
parameter in their Event header fields. Subsequent SUBSCRIBE requests used to
refresh or terminate this subscription MUST contain this id parameter. Note
that the rationale for the id parameter provided in that section is not
relevant when this extension is used. The URI returned in the Refer-Events-At
header field uniquely identifies appropriate state, making the id parameter
redundant. However, this behavioral requirement is preserved to reduce the
number of changes to existing implementations in order to support this
extension and to make it more likely that existing diagnostic tools will work
with little or no modification.

</t>
</section>

<section anchor="notifier-sub" title="Processing a Received SUBSCRIBE">
<t>

An event server receiving a SUBSCRIBE request will process it according to the
requirements of <xref target="RFC6665"/>.  The event server MAY choose to 
authorize the SUBSCRIBE request based on the Request-URI corresponding to
existing refer event state.  It MAY also require further authorization as
discussed in <xref target="security"/>.

</t><t>

When accepting a subscription, the event server will establish the initial
subscription duration using the guidance in Section 3.4 of <xref
target="RFC3515"/>. 

</t>
</section>

<section anchor="notifier-not" title="Sending a NOTIFY">
<t>

NOTIFY messages within a subscription are formed and sent following the
requirements in <xref target="RFC3515"/>. See, in particular, Section 2.4.5 of
that document.  

</t>

</section>

<section anchor="referstate" title="Managing 'refer' Event State">
<t>

As described in <xref target="RFC3515"/>, an element creates the state for
event 'refer' when it accepts a REFER request. It updates that state as the
referred request proceeds, ultimately reaching a state where the request has
completed and the final state is known.

</t><t>

In RFC 3515 implementations, it was a reasonable design choice to destroy the
refer event state immediately after sending the NOTIFY that terminated the
implicit subscription. This is not the case when using this extension. It is
possible for the referenced request to complete very quickly, perhaps sooner
than the time it takes the response to the REFER to traverse the network to the
UA that sent the request and the time it takes that agent to send the
SUBSCRIBE request for the event state to the URI the response provides. Thus, the
event server MUST retain the final refer event state for a reasonable period of
time, which SHOULD be at least 2*64*T1 (that is, 64 seconds), representing an
upper-bound estimate of the time it would take to complete two non-INVITE
transactions: the REFER and an immediate SUBSCRIBE.

</t><t>

If an otherwise acceptable SUBSCRIBE arrives during this retention period, the
subscription would be accepted and immediately terminated with a NOTIFY
containing the final event state with a Subscription-State of terminated with a
reason value of "noresource".

</t>
</section>


<section anchor="refer-events-at" title="The Refer-Events-At Header Field">
<t>



The Refer-Events-At header field is an extension-header as defined by <xref
target="RFC3261"/>. Its ABNF <xref target="RFC5234"/> is as follows: 

</t><t>

<figure><artwork>
Refer-Events-At = "Refer-Events-At" HCOLON
                    LAQUOT ( SIP-URI / SIPS-URI ) RAQUOT
                    *( SEMI generic-param ) 
</artwork></figure>

</t><t>

See <xref target="RFC3261"/> for the definition of the elements used in that production.

</t><t>

Note that this rule does not allow a full addr-spec as defined in RFC 3261, and it mandates the use of the angle brackets. That is:
<figure><artwork>
Refer-Events-At: &lt;sips:vPT3izGmo8NTxaPADRZvEAY22BKx@example.com;gr&gt;
</artwork></figure>
</t><t>
is well formed, but
</t><t>
<figure><artwork>
Refer-Events-At: sip:wsXa9mkHtPcGu8@example.com
</artwork></figure>
</t><t>
is invalid.
</t><t>

The Refer-Events-At header field is only meaningful in a 2xx-class response to a REFER request. 
If it appears in the header of any other SIP message, its meaning is
undefined, and it MUST be ignored.

</t>

</section>


</section>

<section anchor="nosubprotocol" title="The No Subscription Extension">

<section anchor="nosub-referrer-req" title="Sending a REFER">

<t>

To suppress the creation of any implicit subscription and signal that no explicit
subscription will be forthcoming, a UA forming a REFER request will include the
option tag 'nosub' in the Require header field of the request. The REFER request
is otherwise formed following the requirements of <xref target="RFC3515"/>. Since
this REFER has no chance of creating an implicit subscription, the UA MAY send
the REFER request within an existing dialog or out-of-dialog.

</t>

</section>

<section anchor="nosub-referrer-resp" title="Processing a REFER Response">

<t>

The UA will process responses to the REFER request as specified in <xref
target="RFC3515"/> (and, consequently, <xref target="RFC3261"/>).  In
particular, if the REFER was sent to an element that does not support or is
unwilling to use this extension, the response will contain a 420 (Bad
Extension) response code (see Section 8.1.3.5 of <xref target="RFC3261"/>). 
As that document states, the UA can retry the request without using this
extension.

</t>

</section>

<section anchor="nosub-referree" title="Processing a Received REFER">

<t>

An element receiving a REFER request requiring the 'nosub' extension 
will use the same admissions policies that would be used without the
extension, with the addition that it is acceptable to admit an in-dialog
REFER request requiring this extension since it cannot create another
usage inside that dialog. In particular, see Section 5.2 of
<xref target="RFC3515"/>.

</t><t>

Accepting a REFER request that requires 'nosub' does not create a dialog
or a new usage within an existing dialog. The element MUST NOT create
an implicit subscription when accepting the REFER request.  Furthermore, 
the element accepting the REFER request is not required to maintain any 
state for serving refer event subscriptions.

</t><t>
If the REFER is received within an existing dialog, the accepting element will
not be acting as a SIP-Events notifier in the context of that dialog. If it is
not otherwise subject to becoming a notifier in the context of the dialog,
none of the requirements in <xref target="RFC6665"/>, particularly the requirement to provide a
GRUU as the local contact, apply to the message accepting the REFER request.

</t><t>

The accepting element will otherwise proceed with the processing defined
in <xref target="RFC3515"/>.

</t>

</section>

</section>

<section anchor="tags" title="The 'explicitsub' and 'nosub' Option Tags">
<t>

This document defines the 'explicitsub' option tag, used to signal the use of
the extension defined in <xref target="explicitprotocol"/>, and the 'nosub' option
tag, used to signal the use of the extension defined in <xref target="nosubprotocol"/>.

</t><t>
   The use of either option tag in a Require header field is only
   defined when it appears in a REFER request or a response to a
   REFER request.  A UA MUST NOT include the 'explicitsub' or 'nosub'
   option tag in the Require header field of any request other than
   REFER.  A UA MUST NOT include the 'explicitsub' or 'nosub' option
   tag in the Require header field of any SIP response other than a
   200 or 421 response to a REFER request.

</t><t>
   The 'explicitsub' and 'nosub' option tags MAY appear in the Supported
   header field of SIP messages and in the sip.extensions feature tag
   defined in <xref target="RFC3840"/>.  This signals only that the UA including the
   value is aware of the extensions.  In particular, a UA can only
   invoke the use of one of the extensions in a request.  A UA MUST NOT
   include either option tag in the Require header field of a 200 response
   to a REFER request if that tag was not present in the Require header field
   of the request. A User Agent Server (UAS) that is processing a REFER
   request that lists 'explicitsub' or 'nosub' in its Supported header field
   and wishes to use one of those extensions will return a 421 response
   indicating which extension is required.

</t>

</section>

<section anchor="updates" title="Updates to RFC 3515">
<t>

The requirement in Section 2.4.4 of <xref target="RFC3515"/> to reject
out-of-dialog SUBSCRIBE requests to event 'refer' is removed. An element
MAY accept a SUBSCRIBE request to event 'refer', following the requirements
and guidance in this document. REFER is no longer the only mechanism that 
can create a subscription to event 'refer'. 

</t>

</section>

<section anchor="security" title="Security Considerations">
<t>

The security considerations of <xref target="RFC3515"/> all still apply to a REFER request
using this extension. The security considerations there for the implicit subscription apply
to any explicit subscription for the 'refer' event.

</t><t>

This update to RFC 3515 introduces a new authorization consideration. An
element receiving an initial SUBSCRIBE request to the 'refer' event needs to
decide whether the subscriber should be allowed to see the refer event state.
In RFC 3515, this decision was conflated with accepting the REFER request, and
the only possible subscriber was the element that sent the REFER. With this
update, there may be multiple subscribers to any given refer event state.

</t><t>

This document allows an element to accept an initial SUBSCRIBE request based on
having a Request-URI that identifies existing refer event state. (Such a URI
will have previously been sent in the Refer-Events-At header field in a
successful REFER response). The element retrieving that URI from the response
and any elements that element shares the URI with are authorized to SUBSCRIBE
to the event state.  Consequently, the URI should be constructed so that it is
not easy to guess and should be protected against eavesdroppers when
transmitted. 
<xref target="RFC3261"/> details mechanisms for providing such protection, such as 
sending SIP messages over Transport Layer Security (TLS) or Datagram TLS
(DTLS). See the Security Considerations section of <xref
target="RFC3261"/> for considerations when using other security mechanisms. An
event server receiving a REFER request over an unprotected transport can
redirect the requester to use a protected transport before accepting the
request. A good way to ensure that subscriptions use a protected transport is
to only construct sips: URIs.  The event server can also require any of the
additional authorization mechanisms allowed for any SIP request. For example,
the event server could require a valid assertion of the subscriber's identity
using <xref target="RFC4474"/>.

</t><t>

The URI provided in a Refer-Events-At header field will be used as the
Request-URI of SUBSCRIBE requests. A malicious agent could take advantage of
being able to choose this URI in ways similar to the ways an agent sending a
REFER request can take advantage of the Refer-To URI, as described in the
Security Considerations section of <xref target="RFC3515"/>. In particular, the malicious agent
could cause a SIP SUBSCRIBE to be sent as raw traffic towards a victim. If the
victim is not SIP aware and the SUBSCRIBE is sent over UDP, there is (at most)
a factor of 11 amplification due to retransmissions of the request.  The
potential for abuse in this situation is lower than that of the Refer-To URI,
since the URI can only have a sip: or sips: scheme, and is only provided in a
REFER response. A malicious agent would have to first receive a REFER request
to take advantage of providing a Refer-Events-At URI.

</t>

</section>

<section anchor="iana" title="IANA Considerations">


<section title="Register the 'explicitsub' Option Tag">
<t>

The option tag 'explicitsub' has been registered in the 'Option Tags' subregistry of
the 'Session Initiation Protocol (SIP) Parameters' registry by adding a row
with these values:

</t>
<t>Name: explicitsub</t>
<t>Description: This option tag identifies an extension to REFER to suppress
the implicit subscription and provide a URI for an explicit subscription.</t>
<t>Reference: RFC 7614 (this document)</t>
</section>

<section title="Register the 'nosub' Option Tag">
<t>

The option tag 'nosub' has been registered in the 'Option Tags' subregistry of the
'Session Initiation Protocol (SIP) Parameters' registry by adding a row with
these values:

</t>
<t>Name: nosub</t>
<t>Description: This option tag identifies an extension to REFER to suppress
the implicit subscription and indicate that no explicit subscription is
forthcoming.</t>

<t>Reference: RFC 7614 (this document)</t>
</section>

<section title="Register the Refer-Events-At Header Field">
<t>
The header field described in <xref target="refer-events-at"/> has been registered
in the 'Header Fields' subregistry of the 'Session Initiation Protocol (SIP)
Parameters' registry by adding a row with these values:

</t>
<t>Header Name: Refer-Events-At</t>
<t>compact: none</t>
<t>Reference: RFC 7614 (this document)</t>
</section>

</section>

</middle>
<back>

<references title="Normative References">
<?rfc include="reference.RFC.2119"?>
<?rfc include="reference.RFC.3261"?>
<?rfc include="reference.RFC.3515"?>
<?rfc include="reference.RFC.3840"?>
<?rfc include="reference.RFC.5234"?>
<?rfc include="reference.RFC.6665"?>

</references>

<references title="Informative References">

<?rfc include="reference.RFC.3903"?>
<?rfc include="reference.RFC.4321"?>
<?rfc include="reference.RFC.4474"?>
<?rfc include="reference.RFC.4538"?>
<?rfc include="reference.RFC.5057"?>
<?rfc include="reference.RFC.5589"?>
<?rfc include="reference.RFC.5627"?>

</references>

</back>
	
</rfc>
