<?xml version='1.0'?>
<!-- <!DOCTYPE rfc SYSTEM 'rfcXXXX.dtd'> -->
<?rfc strict="yes" ?>
<?rfc toc="yes" ?>
<rfc ipr="trust200902" category='exp' docName='draft-worley-aggregation-00'>

<front>
<title abbrev='SIP UA aggregation'>
Aggregating the media capabilities of SIP user agents using
third-party call control techniques
</title>
<author initials='D. R.' surname='Worley' fullname='Dale R. Worley'>
       <organization abbrev="Avaya">
       Avaya Inc.
       </organization>
   <address>
       <postal>
           <street>600 Technology Park Dr.</street>
           <city>Billerica</city>
           <region>MA</region>
           <code>01821</code>
           <country>US</country>
       </postal>
       <phone>+1 978 288 5505</phone>
       <email>dworley@avaya.com</email>
       <uri>http://www.avaya.com</uri>
   </address>
</author>
<date day="16" month="August" year="2011" />
<area>Transport</area>
<workgroup>SIP</workgroup>
<keyword></keyword>
<abstract>
<t>This document is concerned with the concept of SIP user agent
"aggregation", that is, where two or more user agents provide media
interfaces for media sessions that are controlled by one SIP dialog.
This facility is also called "disaggregated media" or "device
pairing".</t>
</abstract>
</front>

<middle>

<section title='Introduction' anchor='introduction'>

<t>This document is concerned with the concept of SIP user agent
"aggregation", that is, where two or more user agents provide media
interfaces for media sessions that are controlled by one SIP dialog.
This facility is also called "disaggregated media" or "device
pairing".</t>

<t>The approach to UA aggregation that is explored in this document is
one where a single "primary" UA is the SIP endpoint of the dialog to
the far-end UA and it manages that dialog and the interactions with
the other, "secondary" UAs that provide additional media interfaces.
The primary UA interacts with the secondary UAs using ordinary SIP
third-party call control (3PCC) operations, and so the secondary UAs
need to implement no facilities beyond ordinary SIP requirements.
Similarly, the far-end UA only sees an ordinary SIP dialog with the
primary UA, and so needs to implement no facilities beyond ordinary
SIP requirements.</t>

</section>

<section title='Expository conventions' anchor='expo'>

<t>In various situations, the operations described in this document
provide effects that vary enough from the user's point of view that
they can be considered different
modes of operation:</t>

<t><list style="numbered">

<t>The baseline model of operation is that these operations are
implemented by a SIP UA that can be used by the user as an ordinary
UA, allowing it to utilize other UAs as media interfaces.</t>

<t>The primary UA may not provide any media interfaces of its own.
This turns the UA into a B2BUA that manages the UA aggregation,
controlled by an interface it presents to the user.</t>

<t>The primary B2BUA may have no direct interface to the user, but
instead be "in the network", and be controlled by information
communicated to it by secondary UA(s) or other interfaces under
direction of the user.  E.g. the B2BUA could be controlled by
eavesdropping the media streams for DTMF signals, or by RPC requests
sent by a secondary UA.</t>

</list></t>

<t>In regard to SIP signaling, all of these modes of operation are
included in the baseline model, and so are not discussed separately.
However, for convenience of exposition, we will assume that the
primary UA has no media interfaces of its own.  The case where the
primary UA has media interfaces is modeled by separating the media
interfaces into a secondary UA that is co-located with the primary UA,
and which is always controlled by the primary UA through 3PCC SIP.</t>

<t>In most situations, the interactions between the primary and each
secondary are identical, and so illustrations will be limited to one
secondary UA.</t>

</section>

<section title='SIP operations' anchor='SIP'>

<t>We first illustrate how the various SIP signaling operations are
carried out.</t>

<section title='Originate a call' anchor='originating'>

<t>The first operation we consider is originating a call, aggregating
the media capabilities of the primary and secondary UAs.</t>

<t>In order to originate a call, the primary UA needs to obtain an SDP
offer from the secondary.  One way to do this is to send an offer-less
INVITE to the secondary.</t>

<t>This technique has the disadvantage that the initial INVITE to the
secondary must be answered on the secondary (unless the secondary is
somehow directed to automatically answer the call), and if the call to
the remote UA fails, the call to the secondary remains.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
P->S/INVITE
S->P/200 OK^SDP offer
P->R/INVITE^SDP offer
R->P/200 OK^SDP answer
P->R/ACK
P->S/ACK^SDP answer
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     | INVITE            |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     | SDP offer         |                   |
     |------------------>|                   |
     |                   | INVITE            |
     |                   | SDP offer         |
     |                   |------------------>|
     |                   | 200 OK            |
     |                   | SDP answer        |
     |                   |<------------------|
     |                   | ACK               |
     |                   |------------------>|
     | ACK               |                   |
     | SDP answer        |                   |
     |<------------------|                   |
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

<t>A second technique is to induce the secondary to send an INVITE to
the primary.  This can be done by sending an out-of-dialog REFER.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
P->S/REFER^Refer-To: P
S->P/INVITE^SDP offer
P->R/INVITE^SDP offer
R->P/200 OK^SDP answer
P->R/ACK
P->S/200 OK^SDP answer
S->P/ACK
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     | REFER             |                   |
     | Refer-To: P       |                   |
     |<------------------|                   |
     | INVITE            |                   |
     | SDP offer         |                   |
     |------------------>|                   |
     |                   | INVITE            |
     |                   | SDP offer         |
     |                   |------------------>|
     |                   | 200 OK            |
     |                   | SDP answer        |
     |                   |<------------------|
     |                   | ACK               |
     |                   |------------------>|
     | 200 OK            |                   |
     | SDP answer        |                   |
     |<------------------|                   |
     | ACK               |                   |
     |------------------>|                   |
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Answer a call' anchor='answer'>

<t>This call flow is for answering an incoming INVITE that has SDP, as
is usual.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
R->P/INVITE^SDP offer
P->S/INVITE^SDP offer
S->P/200 OK^SDP answer
P->S/ACK
P->R/200 OK^SDP answer
R->P/ACK
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | INVITE            |
     |                   | SDP offer         |
     |                   |<------------------|
     | INVITE            |                   |
     | SDP offer         |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     | SDP answer        |                   |
     |------------------>|                   |
     | ACK               |                   |
     |<------------------|                   |
     |                   | 200 OK            |
     |                   | SDP answer        |
     |                   |------------------>|
     |                   | ACK               |
     |                   |<------------------|
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

<t>This call flow is for an incoming INVITE without SDP.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
R->P/INVITE
P->S/INVITE
S->P/200 OK^SDP offer
P->R/200 OK^SDP offer
R->P/ACK^SDP answer
P->S/ACK^SDP answer
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | INVITE            |
     |                   |<------------------|
     | INVITE            |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     | SDP offer         |                   |
     |------------------>|                   |
     |                   | 200 OK            |
     |                   | SDP offer         |
     |                   |------------------>|
     |                   | ACK               |
     |                   | SDP answer        |
     |                   |<------------------|
     | ACK               |                   |
     | SDP answer        |                   |
     |<------------------|                   |
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Local release a call' anchor='local-release'>

<t>Terminating a call is straightforward, as it only requires
terminating the dialogs with the remote and the secondary</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
P->R/BYE
R->P/200 OK
P->S/BYE
S->P/200 OK
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | BYE               |
     |                   |------------------>|
     |                   | 200 OK            |
     |                   |<------------------|
     | BYE               |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     |------------------>|                   |
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Remote release a call' anchor='remote-release'>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
R->P/BYE/200 OK
P->S/BYE/200 OK
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | BYE               |
     |                   |<------------------|
     |                   | 200 OK            |
     |                   |------------------>|
     | BYE               |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     |------------------>|                   |
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Remote re-INVITE' anchor='reinvite-remote'>

<t>This call flow is for a re-INVITE (an in-dialog INVITE) with SDP
received from the remote.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
R->P/re-INVITE^SDP offer
P->S/re-INVITE^SDP offer
S->P/200 OK^SDP answer
P->S/ACK
P->R/200 OK^SDP answer
R->P/ACK
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | re-INVITE         |
     |                   | SDP offer         |
     |                   |<------------------|
     | re-INVITE         |                   |
     | SDP offer         |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     | SDP answer        |                   |
     |------------------>|                   |
     | ACK               |                   |
     |<------------------|                   |
     |                   | 200 OK            |
     |                   | SDP answer        |
     |                   |------------------>|
     |                   | ACK               |
     |                   |<------------------|
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

<t>This call flow is for a re-INVITE (an in-dialog INVITE) without SDP
received from the remote.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
R->P/re-INVITE
P->S/re-INVITE
S->P/200 OK^SDP offer
P->R/200 OK^SDP offer
R->P/ACK^SDP answer
P->S/ACK^SDP answer
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | re-INVITE         |
     |                   |<------------------|
     | re-INVITE         |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     | SDP offer         |                   |
     |------------------>|                   |
     |                   | 200 OK            |
     |                   | SDP offer         |
     |                   |------------------>|
     |                   | ACK               |
     |                   | SDP answer        |
     |                   |<------------------|
     | ACK               |                   |
     | SDP answer        |                   |
     |<------------------|                   |
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Local re-INVITE' anchor='reinvite-local'>

<t>This call flow is for a re-INVITE (an in-dialog INVITE) generated
locally that contains updated SDP.  In the illustration, the re-INVITE
is initiated by secondary S1 by sending a re-INVITE to the primary.
(E.g., because it has gone on-hold).  Another secondary, S2, must be
prompted to start an offer/answer cycle.</t>

<t>This pattern can be used for a re-INVITE initiated by the primary
by considering all secondaries in the same role as S2 in the
illustration.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
S1->P/re-INVITE^SDP offer
P->S2/re-INVITE
S2->P/200 OK^SDP offer
P->R/re-INVITE^SDP offer
R->P/200 OK^SDP answer
P->R/ACK
P->S1/200 OK^SDP answer
S1->P/ACK
P->S2/ACK^SDP answer
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | re-INVITE         |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   | re-INVITE         |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP offer         |                   |
     |                   |------------------>|                   |
     |                   |                   | re-INVITE         |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | 200 OK            |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     | ACK               |                   |                   |
     |-------------------------------------->|                   |
     |                   | ACK               |                   |
     |                   | SDP answer        |                   |
     |                   |<------------------|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>This call flow is for a re-INVITE (an in-dialog INVITE) generated
locally that contains no SDP.  In the illustration, the re-INVITE
is initiated by secondary S1 by sending a re-INVITE to the primary.
(E.g., because it has gone on-hold).  Another secondary, S2, must be
prompted to start an offer/answer cycle.</t>

<t>This pattern can be used for a re-INVITE initiated by the primary
by considering all secondaries in the same role as S2 in the
illustration.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
S1->P/re-INVITE
P->R/re-INVITE
R->P/200 OK^SDP offer
P->S1/200 OK^SDP offer
S1->P/ACK^SDP answer
P->S2/re-INVITE^SDP offer
S2->P/200 OK^SDP answer
P->S2/ACK
P->R/ACK^SDP answer
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | re-INVITE         |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | re-INVITE         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP offer         |
     |                   |                   |<------------------|
     | 200 OK            |                   |                   |
     | SDP offer         |                   |                   |
     |<--------------------------------------|                   |
     | ACK               |                   |                   |
     | SDP answer        |                   |                   |
     |-------------------------------------->|                   |
     |                   | re-INVITE         |                   |
     |                   | SDP offer         |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP answer        |                   |
     |                   |------------------>|                   |
     |                   | ACK               |                   |
     |                   |<------------------|                   |
     |                   |                   | ACK               |
     |                   |                   | SDP answer        |
     |                   |                   |------------------>|
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Remote INVITE with Replaces' anchor='invite-replaces'>

<t>This call flow is for an INVITE with a Replaces header that is
received from the remote UA.  Generally, the INVITE is handled as
would an INVITE without a Replaces header, whether or not the INVITE
contains SDP.  But as the INVITE is
passed on to the secondary UA, the Replaces header value is changed to
name the dialog between the primary and secondary that matches the
dialog between the primary and the remote UA that is named in the
original Replaces header.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R1/Remote 1
guy/R2/Remote 2
P->S/INVITE^Call-Id: 1-S
S->P/200 OK^Call-Id: 1-S^SDP offer
P->R1/INVITE^Call-Id: 1-R^SDP offer
R1->P/200 OK^Call-Id: 1-R^SDP answer
P->R1/ACK^Call-Id: 1-R
P->S/ACK^Call-Id: 1-S^SDP answer
S..R2/Call 1 established
R2->P/INVITE^Call-Id: 2-R^Replaces: 1-R^SDP offer
P->S/INVITE^Call-Id: 2-S^Replaces: 1-S^SDP offer
S->P/200 OK^Call-Id: 2-S^SDP answer
P->S/ACK^Call-Id: 2-S
S->P/BYE^Call-Id: 1-S/200 OK^Call-Id: 1-S
P->R2/200 OK^Call-Id: 2-R^SDP answer
R2->P/ACK^Call-Id: 2-R
P->R1/BYE^Call-Id: 1-R/200 OK^Call-Id: 1-R
--><![CDATA[ Secondary            Primary            Remote 1            Remote 2
     |                   |                   |                   |
     | INVITE            |                   |                   |
     | Call-Id: 1-S      |                   |                   |
     |<------------------|                   |                   |
     | 200 OK            |                   |                   |
     | Call-Id: 1-S      |                   |                   |
     | SDP offer         |                   |                   |
     |------------------>|                   |                   |
     |                   | INVITE            |                   |
     |                   | Call-Id: 1-R      |                   |
     |                   | SDP offer         |                   |
     |                   |------------------>|                   |
     |                   | 200 OK            |                   |
     |                   | Call-Id: 1-R      |                   |
     |                   | SDP answer        |                   |
     |                   |<------------------|                   |
     |                   | ACK               |                   |
     |                   | Call-Id: 1-R      |                   |
     |                   |------------------>|                   |
     | ACK               |                   |                   |
     | Call-Id: 1-S      |                   |                   |
     | SDP answer        |                   |                   |
     |<------------------|                   |                   |
     | Call 1 established                    |                   |
     |...........................................................|
     |                   | INVITE            |                   |
     |                   | Call-Id: 2-R      |                   |
     |                   | Replaces: 1-R     |                   |
     |                   | SDP offer         |                   |
     |                   |<--------------------------------------|
     | INVITE            |                   |                   |
     | Call-Id: 2-S      |                   |                   |
     | Replaces: 1-S     |                   |                   |
     | SDP offer         |                   |                   |
     |<------------------|                   |                   |
     | 200 OK            |                   |                   |
     | Call-Id: 2-S      |                   |                   |
     | SDP answer        |                   |                   |
     |------------------>|                   |                   |
     | ACK               |                   |                   |
     | Call-Id: 2-S      |                   |                   |
     |<------------------|                   |                   |
     | BYE               |                   |                   |
     | Call-Id: 1-S      |                   |                   |
     |------------------>|                   |                   |
     | 200 OK            |                   |                   |
     | Call-Id: 1-S      |                   |                   |
     |<------------------|                   |                   |
     |                   | 200 OK            |                   |
     |                   | Call-Id: 2-R      |                   |
     |                   | SDP answer        |                   |
     |                   |-------------------------------------->|
     |                   | ACK               |                   |
     |                   | Call-Id: 2-R      |                   |
     |                   |<--------------------------------------|
     |                   | BYE               |                   |
     |                   | Call-Id: 1-R      |                   |
     |                   |------------------>|                   |
     |                   | 200 OK            |                   |
     |                   | Call-Id: 1-R      |                   |
     |                   |<------------------|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Remote REFER' anchor='refer'>

<t>This call flow is for receiving a REFER within the dialog from the
remote UA, or an out-of-dialog REFER whose Target-Dialog header
specifies the dialog with the remote UA.
The REFER is duplicated and sent to the secondary UA, with the
Refer-To URI changed to that of the primary UA.
The resulting INVITE is generated in much the same way as for
originating a call.
</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
P->S/INVITE^Call-Id: 1-S
S->P/200 OK^Call-Id: 1-S^SDP offer
P->R/INVITE^Call-Id: 1-R^SDP offer
R->P/200 OK^Call-Id: 1-R^SDP answer
P->R/ACK^Call-Id: 1-R
P->S/ACK^Call-Id: 1-S^SDP answer
S..R/Call 1 established
R->P/REFER^Call-Id: 1-R^Refer-To: R2
P->S/REFER^Call-Id: 1-S^Refer-To: P
S->P/INVITE^Call-Id: 2-S^SDP offer
P->R/INVITE^Call-Id: 2-R^SDP offer
R->P/200 OK^Call-Id: 2-R^SDP answer
P->R/ACK^Call-Id: 2-R
P->S/200 OK^Call-Id: 2-S^SDP answer
S->P/ACK^Call-Id: 2-S
S->P/BYE^Call-Id: 1-S/200 OK^Call-Id: 1-S
P->R/BYE^Call-Id: 1-P/200 OK^Call-Id: 1-P
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     | INVITE            |                   |
     | Call-Id: 1-S      |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     | Call-Id: 1-S      |                   |
     | SDP offer         |                   |
     |------------------>|                   |
     |                   | INVITE            |
     |                   | Call-Id: 1-R      |
     |                   | SDP offer         |
     |                   |------------------>|
     |                   | 200 OK            |
     |                   | Call-Id: 1-R      |
     |                   | SDP answer        |
     |                   |<------------------|
     |                   | ACK               |
     |                   | Call-Id: 1-R      |
     |                   |------------------>|
     | ACK               |                   |
     | Call-Id: 1-S      |                   |
     | SDP answer        |                   |
     |<------------------|                   |
     | Call 1 established                    |
     |.......................................|
     |                   | REFER             |
     |                   | Call-Id: 1-R      |
     |                   | Refer-To: R2      |
     |                   |<------------------|
     | REFER             |                   |
     | Call-Id: 1-S      |                   |
     | Refer-To: P       |                   |
     |<------------------|                   |
     | INVITE            |                   |
     | Call-Id: 2-S      |                   |
     | SDP offer         |                   |
     |------------------>|                   |
     |                   | INVITE            |
     |                   | Call-Id: 2-R      |
     |                   | SDP offer         |
     |                   |------------------>|
     |                   | 200 OK            |
     |                   | Call-Id: 2-R      |
     |                   | SDP answer        |
     |                   |<------------------|
     |                   | ACK               |
     |                   | Call-Id: 2-R      |
     |                   |------------------>|
     | 200 OK            |                   |
     | Call-Id: 2-S      |                   |
     | SDP answer        |                   |
     |<------------------|                   |
     | ACK               |                   |
     | Call-Id: 2-S      |                   |
     |------------------>|                   |
     | BYE               |                   |
     | Call-Id: 1-S      |                   |
     |------------------>|                   |
     | 200 OK            |                   |
     | Call-Id: 1-S      |                   |
     |<------------------|                   |
     |                   | BYE               |
     |                   | Call-Id: 1-P      |
     |                   |------------------>|
     |                   | 200 OK            |
     |                   | Call-Id: 1-P      |
     |                   |<------------------|
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Seizing a secondary UA' anchor='seize'>

<t>When the primary UA wants to incorporate a secondary UA into the
call, it can initiate a re-INVITE cycle either with an SDP offer
from its end, or an offer from the remote end.
The first call flow generates the SDP offer at the primary's end.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
P->S1/INVITE/200 OK^SDP offer
P->R/INVITE^SDP offer/200 OK^SDP answer
P->R/ACK
P->S1/ACK^SDP answer
S1..R/Call established using S1
P->S1/re-INVITE/200 OK^SDP offer
P->S2/INVITE/200 OK^SDP offer
P->R/INVITE^SDP offer/200 OK^SDP answer
P->R/ACK
P->S1/ACK^SDP answer
P->S2/ACK^SDP answer
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | INVITE            |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | INVITE            |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     | Call established using S1             |                   |
     |...........................................................|
     | re-INVITE         |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   | INVITE            |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP offer         |                   |
     |                   |------------------>|                   |
     |                   |                   | INVITE            |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     |                   | ACK               |                   |
     |                   | SDP answer        |                   |
     |                   |<------------------|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>The second call flow generates the SDP offer at the remote end.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
P->S1/INVITE/200 OK^SDP offer
P->R/INVITE^SDP offer/200 OK^SDP answer
P->R/ACK
P->S1/ACK^SDP answer
S1..R/Call established using S1
P->R/re-INVITE/200 OK^SDP offer
P->S1/re-INVITE^SDP offer/200 OK^SDP answer
P->S2/INVITE^SDP offer/200 OK^SDP answer
P->R/ACK^SDP answer
P->S1/ACK
P->S2/ACK
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | INVITE            |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | INVITE            |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     | Call established using S1             |                   |
     |...........................................................|
     |                   |                   | re-INVITE         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP offer         |
     |                   |                   |<------------------|
     | re-INVITE         |                   |                   |
     | SDP offer         |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP answer        |                   |                   |
     |-------------------------------------->|                   |
     |                   | INVITE            |                   |
     |                   | SDP offer         |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP answer        |                   |
     |                   |------------------>|                   |
     |                   |                   | ACK               |
     |                   |                   | SDP answer        |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     |<--------------------------------------|                   |
     |                   | ACK               |                   |
     |                   |<------------------|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Releasing a secondary UA' anchor='release'>

<t>When the primary UA wants to remove a secondary UA from the
call, it needs to release the dialog with the secondary and
perform a re-INVITE cycle to rearrange the media streams.
The first call flow generates the SDP offer at the primary's end.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
P->S1/INVITE/200 OK^SDP offer
P->S2/INVITE/200 OK^SDP offer
P->R/INVITE^SDP offer/200 OK^SDP answer
P->R/ACK
P->S1/ACK^SDP answer
P->S2/ACK^SDP answer
S1..R/Call established using S1 and S2
P->S1/re-INVITE/200 OK^SDP offer
P->R/INVITE^SDP offer/200 OK^SDP answer
P->R/ACK
P->S1/ACK^SDP answer
P->S2/BYE/200 OK
S1..R/Call established using S1
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | INVITE            |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   | INVITE            |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP offer         |                   |
     |                   |------------------>|                   |
     |                   |                   | INVITE            |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     |                   | ACK               |                   |
     |                   | SDP answer        |                   |
     |                   |<------------------|                   |
     | Call established using S1 and S2      |                   |
     |...........................................................|
     | re-INVITE         |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | INVITE            |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     |                   | BYE               |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   |------------------>|                   |
     | Call established using S1             |                   |
     |...........................................................|
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>The second call flow generates the SDP offer at the remote end.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
P->S1/INVITE/200 OK^SDP offer
P->S2/INVITE/200 OK^SDP offer
P->R/INVITE^SDP offer/200 OK^SDP answer
P->R/ACK
P->S1/ACK^SDP answer
P->S2/ACK^SDP answer
S1..R/Call established using S1 and S2
P->R/re-INVITE/200 OK^SDP offer
P->S1/re-INVITE^SDP offer/200 OK^SDP answer
P->R/ACK^SDP answer
P->S1/ACK
P->S2/BYE/200 OK
S1..R/Call established using S1
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | INVITE            |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   | INVITE            |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP offer         |                   |
     |                   |------------------>|                   |
     |                   |                   | INVITE            |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     |                   | ACK               |                   |
     |                   | SDP answer        |                   |
     |                   |<------------------|                   |
     | Call established using S1 and S2      |                   |
     |...........................................................|
     |                   |                   | re-INVITE         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP offer         |
     |                   |                   |<------------------|
     | re-INVITE         |                   |                   |
     | SDP offer         |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP answer        |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | ACK               |
     |                   |                   | SDP answer        |
     |                   |                   |------------------>|
     | ACK               |                   |                   |
     |<--------------------------------------|                   |
     |                   | BYE               |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   |------------------>|                   |
     | Call established using S1             |                   |
     |...........................................................|
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

</section>

<section title='Glare' anchor='glare'>

<t>Question:  How do we handle glare situations?  Various operations
can be initiated various elements simultaneously, and some operations
can fail.  We need recovery strategies for these situations.</t>

<t>At what point has the primary UA committed to complete a sequence of
operations?  Upon sending an INVITE, or upon sending a response to an
INVITE.</t>

<t>Let's suppose we get a remote re-INVITE, but during the processing
a secondary sends a re-INVITE.  The primary can reject the secondary's
re-INVITE with 491.  If the secondary accepts the primary's re-INVITE,
the sequence can continue.  But the secondary can reject the primary's
re-INVITE with 491.  How should the primary continue?</t>

<t>One alternative is to reject the remote's re-INVITE with 491.
Another approach would be to wait (based on RFC 3261 section 14.1)
and send its re-INVITE again.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
R->P/re-INVITE^SDP offer
P->S/re-INVITE^SDP offer
S->P/re-INVITE
P->S/491 Request Pending/ACK
S->P/491 Request Pending/ACK
S..R/Alternative 1:
P->R/491 Request Pending/ACK
S..R/Alternative 2:
P->S/re-INVITE^SDP offer
S->P/200 OK^SDP answer/ACK
P->R/200 OK^SDP answer/ACK
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | re-INVITE         |
     |                   | SDP offer         |
     |                   |<------------------|
     | re-INVITE         |                   |
     | SDP offer         |                   |
     |<------------------|                   |
     | re-INVITE         |                   |
     |------------------>|                   |
     | 491 Request Pending                   |
     |<------------------|                   |
     | ACK               |                   |
     |------------------>|                   |
     | 491 Request Pending                   |
     |------------------>|                   |
     | ACK               |                   |
     |<------------------|                   |
     | Alternative 1:    |                   |
     |.......................................|
     |                   | 491 Request Pending
     |                   |------------------>|
     |                   | ACK               |
     |                   |<------------------|
     | Alternative 2:    |                   |
     |.......................................|
     | re-INVITE         |                   |
     | SDP offer         |                   |
     |<------------------|                   |
     | 200 OK            |                   |
     | SDP answer        |                   |
     |------------------>|                   |
     | ACK               |                   |
     |<------------------|                   |
     |                   | 200 OK            |
     |                   | SDP answer        |
     |                   |------------------>|
     |                   | ACK               |
     |                   |<------------------|
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

<t>This leads to an alternative approach:  Instead of worrying about
glare specifically, just consider that any request sent to any UA
may receive a failure response for unknown reasons.  Our sequencing
must be able to recover from this.  In most cases, the goal is to
abort the operation.  The exceptions are (1) attempting to tear down
the entire call structure, and (2) releasing a secondary, both of
which should succeed (attain the desired state) even if the other
UAs are non-responsive.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S/Secondary
guy/P/Primary
guy/R/Remote
R->P/re-INVITE^SDP offer
P->S/re-INVITE^SDP offer
S->P/4xx Ugh/ACK
P->R/400 Request Failed/ACK
--><![CDATA[ Secondary            Primary             Remote
     |                   |                   |
     |                   | re-INVITE         |
     |                   | SDP offer         |
     |                   |<------------------|
     | re-INVITE         |                   |
     | SDP offer         |                   |
     |<------------------|                   |
     | 4xx Ugh           |                   |
     |------------------>|                   |
     | ACK               |                   |
     |<------------------|                   |
     |                   | 400 Request Failed
     |                   |------------------>|
     |                   | ACK               |
     |                   |<------------------|
     |                   |                   |
     |                   |                   |
]]></artwork>
</figure>

<t>Although this case doesn't have the problem that the primary
commits to a transaction before it obtains commitment from all the
other UAs.</t>

<t>Here is an example with a worse failure.  The remote sends a
re-INVITE, causing the primary to send re-INVITEs to the secondaries.
The first secondary completes the re-INVITE sequence, but the second
secondary fails.  At this point, there is no consistent set of SDP
states that can be used, as Secondary 1 has renegotiated its SDP but
Secondary 2 has not.  (Although it is possible that Secondary 1's
answer SDP is the same as it provided previously, in which case the
primary could send an error response to the remote and be in a
consistent state.)</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
R->P/re-INVITE^SDP offer
P->S1/re-INVITE^SDP offer/200 OK^SDP answer
P->S1/ACK
P->S2/re-INVITE^SDP offer/4xx Ugh
P->S2/ACK
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     |                   |                   | re-INVITE         |
     |                   |                   | SDP offer         |
     |                   |                   |<------------------|
     | re-INVITE         |                   |                   |
     | SDP offer         |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP answer        |                   |                   |
     |-------------------------------------->|                   |
     | ACK               |                   |                   |
     |<--------------------------------------|                   |
     |                   | re-INVITE         |                   |
     |                   | SDP offer         |                   |
     |                   |<------------------|                   |
     |                   | 4xx Ugh           |                   |
     |                   |------------------>|                   |
     |                   | ACK               |                   |
     |                   |<------------------|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>One possible solution is for the primary to wait a short time and
then initiate a re-INVITE sequence.  If that sequence completes
successfully, the SDP state will be correct again.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
P->R/400 SDP Negotiation Failed
S1..R/Wait
P->R/re-INVITE/200 OK^SDP offer
P->S1/re-INVITE^SDP offer/200 OK^SDP answer
P->S1/ACK
P->S2/re-INVITE^SDP offer/200 OK^SDP answer
P->S2/ACK
P->R/ACK^SDP answer
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     |                   |                   | 400 SDP Negotiation Failed
     |                   |                   |------------------>|
     | Wait              |                   |                   |
     |...........................................................|
     |                   |                   | re-INVITE         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP offer         |
     |                   |                   |<------------------|
     | re-INVITE         |                   |                   |
     | SDP offer         |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP answer        |                   |                   |
     |-------------------------------------->|                   |
     | ACK               |                   |                   |
     |<--------------------------------------|                   |
     |                   | re-INVITE         |                   |
     |                   | SDP offer         |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP answer        |                   |
     |                   |------------------>|                   |
     |                   | ACK               |                   |
     |                   |<------------------|                   |
     |                   |                   | ACK               |
     |                   |                   | SDP answer        |
     |                   |                   |------------------>|
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>A more drastic solution is for the primary to replace all the
existing dialogs with new ones, using INVITEs with the Replaces
header.  In principle, this should have the same effect as doing
re-INVITEs, but in practice, it seems more likely to not correctly
carry forward into the new dialogs any state the UAs are maintaining
about the old dialogs.  On the other hand, it's more likely to clear
any erroneous state the UAs are maintaining about the old dialogs.
A simplified diagram of this approach looks like the previous
diagram:</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
P->R/400 SDP Negotiation Failed
S1..P/Wait
P->R/INVITE^Replaces/200 OK^SDP offer
P->S1/re-INVITE^Replaces^SDP offer/200 OK^SDP answer
P->S1/ACK
P->S2/re-INVITE^Replaces^SDP offer/200 OK^SDP answer
P->S2/ACK
P->R/ACK^SDP answer
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     |                   |                   | 400 SDP Negotiation Failed
     |                   |                   |------------------>|
     | Wait              |                   |                   |
     |.......................................|                   |
     |                   |                   | INVITE            |
     |                   |                   | Replaces          |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP offer         |
     |                   |                   |<------------------|
     | re-INVITE         |                   |                   |
     | Replaces          |                   |                   |
     | SDP offer         |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     | SDP answer        |                   |                   |
     |-------------------------------------->|                   |
     | ACK               |                   |                   |
     |<--------------------------------------|                   |
     |                   | re-INVITE         |                   |
     |                   | Replaces          |                   |
     |                   | SDP offer         |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP answer        |                   |
     |                   |------------------>|                   |
     |                   | ACK               |                   |
     |                   |<------------------|                   |
     |                   |                   | ACK               |
     |                   |                   | SDP answer        |
     |                   |                   |------------------>|
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>With any of these approaches, we should probably use the SDP
mapping that was in effect before the failure to guide the correlation
of the media streams during the SDP negotiation
to minimize disruptions in the user experience.</t>

<t>In any case, we need a robust strategy to handle the various
failure situations.</t>

</section>

</section>

<section title='SDP processing' anchor='SDP'>

<t>To a considerable extent, SDP processing is decoupled from SIP
signaling.  The fundamental SDP processing operations are (1)
receiving SDP from the remote UA and from it generating SDP for each
secondary, and (2) receiving SDP from each secondary and assembling
them into SDP for the remote UA.  Each offer/answer exchange which
passes through the primary contains one of each of these
operations.</t>

<t>(Question:  Can we avoid involving a particular secondary in an
offer/answer exchange, just reusing its last offer?
No:  The answer might be different than previously, and there is no
way to present the answer to the secondary.  Since it's an answer, we
can't present it as an offer to the secondary, and if we prompt the
secondary for a new offer, it might be different from and incompatible
with the "last offer" that we presented to get the answer.)</t>

<t>SDP assembly/disassembly is driven by a mapping which specifies
which media streams to/from the secondaries are connected to which
media streams to/from the remote.  The handling of offers and answers
and the manipulation of the mapping is constrained by the offer-answer
model:<xref target="offer-answer"/></t>

<t><list style="numbered">

<t>The mapping is separate for each aggregation group (which
encompasses a dialog to the remote, and the group of dialogs to the
secondaries for that dialog).</t>

<t>The long-term identity of each stream to the remote is its m= line
sequence number.</t>

<t>The long-term identity of each stream to a secondary is the
secondary UA identity and its m= line sequence number.</t>

<t>Each secondary stream can be connected to only one remote stream,
and vice-versa.  But streams of either type can be in a non-connected
state.</t>

<t>When a new stream appears in an incoming offer, it must
be connected to a new stream in an outgoing offer, or else left
disconnected.</t>

<t>New streams cannot appear in an incoming answer, as answers are not
allowed to add streams relative to the corresponding
offer.</t>

<t>When processing an incoming offer stream, it can be disconnected from the
stream that it was connected to, and connected to a new stream in the
outgoing offer.</t>

<t>The processing of answers uses the mapping that was
established when processing the corresponding offers.</t>

</list></t>

<t>(Question:  In abstract, we assume that if a UA that supports, e.g.,
video, and it receives SDP containing multiple video streams, but all
but one of them has been marked rejected (port = 0), the UA will
identify the non-rejected video stream and connect its video resources
to that stream.  But this sort of operation is not, strictly
speaking, specified and has almost never been done in
the past, so UAs may not support it as they should.  If they don't,
how do we have to re-architect aggregation?)</t>

<t>The atomic processing problem here is that when processing a stream
in an incoming offer, we must decide which stream in which outgoing
offer it is to be connected to, if any.  The input information to this
decision is</t>

<t><list style="numbered">

<t>whether the stream is marked rejected in the offer,</t>

<t>the stream, if any, that it is already connected to,</t>

<t>the media type of the stream,</t>

<t>the user-prescribed prioritization of the UAs
on the outgoing side for receiving media of this type,</t>

<t>whether outgoing-side UAs are already receiving a stream of this type, and
thus presumed not to be capable of handling further streams of this
type.</t>

</list></t>

<t>(Question:  However, the prioritization of secondaries may depend on knowledge
of what media the UA supports.  How do we determine that?)</t>

<section title="Example 1">

<t>In this example of SDP processing, a call is initiated and later
another secondary UA is seized and then released.
After each operation, the state of the SDP mapping is shown:  Each
stream is represented by a line of text, showing the connected media
streams and the media type the stream carries.
Streams of the remote UA are named R.1, R.2, etc.
Streams of secondary UA 1 are name S1.1, S1.2, etc., and similarly for
other secondary UAs.
Streams that are not connected are shown as connected to "x".</t>

<figure align='left'>
<artwork><![CDATA[
Call initiated; audio offered by S1.

    S1.1 --audio-- R.1

S2 seized, which offers video, and R accepts.

    S1.1 --audio-- R.1

    S2.1 --audio-- x
    S2.2 --video-- R.2

S2 released.

    S1.1 --audio-- R.1
       x --video-- R.2
]]></artwork>
</figure>

</section>

<section title="Example 2">

<t>This example continues the previous example.
S2 is seized again, and R's video stream (R.2) is directed to it.
Here we are assuming that streams can be "reused",
that is, connected to another stream after it has been
unconnected.  This violates the non-reuse of codec number rules,
but probably works in practice.</t>

<figure align='left'>
<artwork><![CDATA[
S2 seized again, which offers audio and video.

    S1.1 --audio-- R.1

    S2.1 --audio-- x
    S2.2 --video-- R.2

S2 released.

    S1.1 --audio-- R.1
       x --video-- R.2
]]></artwork>
</figure>

</section>

<section title="Example 3">

<t></t>

<figure align='left'>
<artwork><![CDATA[
Call received, video is offered by R, but not used by S1.

    S1.1 --audio-- R.1
       x --video-- R.2

S2 is seized, which offers video, and R accepts.

    S1.1 --audio-- R.1

    S2.1 --audio-- x
    S2.2 --video-- R.2
]]></artwork>
</figure>

<t>We know we can implement this if R generates the offer.  Can we implement
it if S2 generates the offer?</t>

<t>This is a version of the payload-type-number problem in
draft-worley-service-example.  In this case, R.2 hasn't seen any
remote SDP yet, so no payload numbers have been sent to R.2.</t>

<t>(That isn't strictly correct:  R.2 has seen the rejection response in the
first offer/answer exchange, but it appears that the pro-forma format
number in that m= line is ignored.</t>

<t>But in general, R.2 may have SDP history.  Should we care about
previous use of payload numbers?  We probably don't have to in
practice.  But I think we could avoid doing so even in theory by
connecting S2.2 to a new stream, R.3:</t>

<figure align='left'>
<artwork><![CDATA[
    S1.1 --audio-- R.1

    S2.1 --audio-- x
       x --video-- R.2
    S2.2 --video-- R.3
]]></artwork>
</figure>

<t>But how likely is it that R.3 will be handled correctly?  That is,
given that video stream R.2 was rejected, will R accept the offered
R.3?  I expect many UAs to not sort through many streams to find the
one audio and one video stream that are not rejected.</t>

</section>

<section title="Knowing what media a secondary will accept" anchor="knowing">

<t>Success and stablity in mapping would seem to rest on having complete
knowledge of the media facilities provided by each UA.  In the case of a
secondary, this suggests that one get an offer from it first, so as to
know what media types (and how many streams) it is willing to
process.</t>

<t>This can be done straightforwardly in most situations, but it's hard
when answering a call that comes with an offer.  At that point, we
don't know what the secondaries have to offer.  One possibility is
sending an OPTIONS request to get a sample SDP offer.  Another is to
just remember the secondary device's capabilities from previous
usage.  A third is to use either REFER or offer-less INVITE to force
the secondary to provide an offer (and then reject or release the
resulting dialog).  Or perhaps an OPTIONS can be used as a query.</t>

</section>

</section>

<section title="SDP Negotiation" anchor="negotiation">

<t>There is further ugliness if the UAs use ICE or require other
negotiation.  Generally, negotiations assume a number of offer/answer
cycles between the endpoints.  But if there are secondaries, the
various endpoints will generate re-INVITEs/UPDATEs out of sync with
each other.</t>

</section>

<section title="Operations stimulated by a secondary" anchor="stimulus">

<t>In this section we consider the situation where the primary UA does
not have a user interface and instead is mostly controlled by
operations initiated by one of its secondary UAs.
This situation obtains especially when the primary is a B2BUA "in the
network".
We will designate the controlling UA "Secondary 1".
This is made more difficult by assuming that Secondary 1 does not have
any facilities specifically for controlling the aggregating primary.</t>

<section title='Originate a call' anchor='stimulus-originating'>

<t>In this case,
primary obtains an offer from the secondary, and must solicit offers
from the other secondaries.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
S1->P/INVITE^SDP offer
P->S2/INVITE
S2->P/200 OK^SDP offer
P->R/INVITE^SDP offer
R->P/200 OK^SDP answer
P->R/ACK
P->S1/200 OK^SDP answer
S1->P/ACK
P->S2/ACK^SDP answer
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | INVITE            |                   |                   |
     | SDP offer         |                   |                   |
     |-------------------------------------->|                   |
     |                   | INVITE            |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   | SDP offer         |                   |
     |                   |------------------>|                   |
     |                   |                   | INVITE            |
     |                   |                   | SDP offer         |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   | SDP answer        |
     |                   |                   |<------------------|
     |                   |                   | ACK               |
     |                   |                   |------------------>|
     | 200 OK            |                   |                   |
     | SDP answer        |                   |                   |
     |<--------------------------------------|                   |
     | ACK               |                   |                   |
     |-------------------------------------->|                   |
     |                   | ACK               |                   |
     |                   | SDP answer        |                   |
     |                   |<------------------|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

</section>

<section title="Blind transfer" anchor="stimulus-blind-transfer">

<t>Secondary 1 executes a blind transfer by sending an in-dialog
REFER.
The primary must pass the REFER through to the remote UA.
The remote UA executes the REFER.
Eventually, either the remote UA or Secondary 1 terminates the
aggregated call.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
S1..R/Call is set up
S1->P/REFER^Refer-To: X
R->P/NOTIFY
P->S1/NOTIFY/200 OK
P->R/200 OK
R->P/NOTIFY
P->S1/NOTIFY/200 OK
P->R/200 OK
S1..R/Call is released by R
R->P/BYE/200 OK
P->S1/BYE/200 OK
P->S2/BYE/200 OK
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     | Call is set up    |                   |                   |
     |...........................................................|
     | REFER             |                   |                   |
     | Refer-To: X       |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | NOTIFY            |
     |                   |                   |<------------------|
     | NOTIFY            |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | 200 OK            |
     |                   |                   |------------------>|
     |                   |                   | NOTIFY            |
     |                   |                   |<------------------|
     | NOTIFY            |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | 200 OK            |
     |                   |                   |------------------>|
     | Call is released by R                 |                   |
     |...........................................................|
     |                   |                   | BYE               |
     |                   |                   |<------------------|
     |                   |                   | 200 OK            |
     |                   |                   |------------------>|
     | BYE               |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     |-------------------------------------->|                   |
     |                   | BYE               |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   |------------------>|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>Alternatively, Secondary 1 can release the call:</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R/Remote
R->P/NOTIFY
P->S1/NOTIFY/200 OK
P->R/200 OK
S1..R/Call is released by S1
S1->P/BYE/200 OK
P->R/BYE/200 OK
P->S2/BYE/200 OK
--><![CDATA[Secondary 1         Secondary 2           Primary             Remote
     |                   |                   |                   |
     |                   |                   | NOTIFY            |
     |                   |                   |<------------------|
     | NOTIFY            |                   |                   |
     |<--------------------------------------|                   |
     | 200 OK            |                   |                   |
     |-------------------------------------->|                   |
     |                   |                   | 200 OK            |
     |                   |                   |------------------>|
     | Call is released by S1                |                   |
     |...........................................................|
     | BYE               |                   |                   |
     |-------------------------------------->|                   |
     | 200 OK            |                   |                   |
     |<--------------------------------------|                   |
     |                   |                   | BYE               |
     |                   |                   |------------------>|
     |                   |                   | 200 OK            |
     |                   |                   |<------------------|
     |                   | BYE               |                   |
     |                   |<------------------|                   |
     |                   | 200 OK            |                   |
     |                   |------------------>|                   |
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

</section>

<section title="Consultative transfer" anchor="stimulus-consultative-transfer">

<t>Secondary 1 executes a consultative transfer by creating a second
call to R2 and then sending an in-dialog REFER to R1 containing a
Refer-To URI that has a Replaces header.</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
opt/messageFormatIndent/ 
guy/S1/Secondary 1
guy/S2/Secondary 2
guy/P/Primary
guy/R1/Remote 1
guy/R2/Remote 2
S1..R2/Call to R1 is set up (with dialogs 1-S1, 1-S2, and 1-R1)
S1..R2/Call to R2 is set up (with dialogs 2-S1, 2-S2, and 2-R2)
S1->P/REFER^Call-Id: 1-S1^Refer-To: P?Replaces=1-S2
P->R1/REFER^Call-Id: 1-R1^Refer-To: R2?Replaces=2-R2
R1->P/200 OK
P->S1/200 OK
R1->P/NOTIFY
P->S1/NOTIFY/200 OK
P->R1/200 OK
R1->R2/INVITE^Call-Id: 3^Replaces: 2-R2/200 OK
R1->P/NOTIFY
P->S1/NOTIFY/200 OK
P->R1/200 OK
S1..R2/Call to R1 is released by R1
S1..R2/Call to R2 is released by R2
--><![CDATA[Secondary 1         Secondary 2           Primary            Remote 1            Remote 2
     |                   |                   |                   |                   |
     | Call to R1 is set up (with dialogs 1-S1, 1-S2, and 1-R1)  |                   |
     |...............................................................................|
     | Call to R2 is set up (with dialogs 2-S1, 2-S2, and 2-R2)  |                   |
     |...............................................................................|
     | REFER             |                   |                   |                   |
     | Call-Id: 1-S1     |                   |                   |                   |
     | Refer-To: P?Replaces=1-S2             |                   |                   |
     |-------------------------------------->|                   |                   |
     |                   |                   | REFER             |                   |
     |                   |                   | Call-Id: 1-R1     |                   |
     |                   |                   | Refer-To: R2?Replaces=2-R2            |
     |                   |                   |------------------>|                   |
     |                   |                   | 200 OK            |                   |
     |                   |                   |<------------------|                   |
     | 200 OK            |                   |                   |                   |
     |<--------------------------------------|                   |                   |
     |                   |                   | NOTIFY            |                   |
     |                   |                   |<------------------|                   |
     | NOTIFY            |                   |                   |                   |
     |<--------------------------------------|                   |                   |
     | 200 OK            |                   |                   |                   |
     |-------------------------------------->|                   |                   |
     |                   |                   | 200 OK            |                   |
     |                   |                   |------------------>|                   |
     |                   |                   |                   | INVITE            |
     |                   |                   |                   | Call-Id: 3        |
     |                   |                   |                   | Replaces: 2-R2    |
     |                   |                   |                   |------------------>|
     |                   |                   |                   | 200 OK            |
     |                   |                   |                   |<------------------|
     |                   |                   | NOTIFY            |                   |
     |                   |                   |<------------------|                   |
     | NOTIFY            |                   |                   |                   |
     |<--------------------------------------|                   |                   |
     | 200 OK            |                   |                   |                   |
     |-------------------------------------->|                   |                   |
     |                   |                   | 200 OK            |                   |
     |                   |                   |------------------>|                   |
     | Call to R1 is released by R1          |                   |                   |
     |...............................................................................|
     | Call to R2 is released by R2          |                   |                   |
     |...............................................................................|
     |                   |                   |                   |                   |
     |                   |                   |                   |                   |
]]></artwork>
</figure>

</section>

</section>

<section title="Replacing the primary" anchor='replacing'>

<t>It may become necessary to replace the primary with a new primary
without interrupting the call.  This will generally require
establishing new dialogs with the remote UA and with the secondaries.
Because of this, the new primary will have to organize the SDP mapping
itself (as the ordering an significance of the m= lines may be
different in the new dialogs compared to the old dialogs).</t>

<t>Since the SDP mapping does not need to be transferred to the new
primary, the information that needs to be transferred is relatively
small, being limited to the dialog identifiers of the dialogs with the
remote and the secondaries, so that the new primary can send
INVITE-with-Replaces to them.</t>

<t>One way to arrange this is to have the old primary send a REFER to
the new primary, carrying a Refer-To header with a Replaces value,
directing the new primary to establish a dialog with the remote UA.
An additional header, "Secondaries", carries the contact URIs of the
secondaries with Replaces values containing the dialog identifiers of
the dialogs with the secondaries.  In order to allow the old primary
to test a putative new primary for its support of the aggregation-transfer
feature, a "secondaries" option-tag is used:</t>

<figure align='left'>
<artwork>
<!-- @callplot
opt/startLine/2
opt/startColumn/5
opt/linePitch/2
opt/columnPitch/20
opt/messageFormat/%2$s 
guy/S/Secondary
guy/OP/Old primary
guy/NP/New primary
guy/R/Remote
OP->S/INVITE^Call-Id: 1-S
S->OP/200 OK^Call-Id: 1-S^SDP offer
OP->R/INVITE^Call-Id: 1-R^SDP offer
R->OP/200 OK^Call-Id: 1-R^SDP answer
OP->R/ACK^Call-Id: 1-R
OP->S/ACK^Call-Id: 1-S^SDP answer
S..R/Call established by old primary
OP->NP/REFER sip:New-primary^Secondaries: S?Replaces=1-S...^Require: secondaries/200 OK
NP->S/INVITE^Call-Id: 2-S^Replaces: 1-S
S->NP/200 OK^Call-Id: 2-S^SDP offer
S->OP/BYE^Call-Id: 1-S/200 OK^Call-Id: 1-S
NP->R/INVITE^Call-Id: 2-R^Replaces: 1-R^SDP offer
R->NP/200 OK^Call-Id: 2-R^SDP answer
NP->R/ACK^Call-Id: 2-R
R->OP/BYE^Call-Id: 1-R/200 OK^Call-Id: 1-R
NP->S/ACK^Call-Id: 2-S^SDP answer
S..R/Call established by new primary
--><![CDATA[ Secondary          Old primary         New primary           Remote
     |                   |                   |                   |
     |INVITE             |                   |                   |
     |Call-Id: 1-S       |                   |                   |
     |<------------------|                   |                   |
     |200 OK             |                   |                   |
     |Call-Id: 1-S       |                   |                   |
     |SDP offer          |                   |                   |
     |------------------>|                   |                   |
     |                   |INVITE             |                   |
     |                   |Call-Id: 1-R       |                   |
     |                   |SDP offer          |                   |
     |                   |-------------------------------------->|
     |                   |200 OK             |                   |
     |                   |Call-Id: 1-R       |                   |
     |                   |SDP answer         |                   |
     |                   |<--------------------------------------|
     |                   |ACK                |                   |
     |                   |Call-Id: 1-R       |                   |
     |                   |-------------------------------------->|
     |ACK                |                   |                   |
     |Call-Id: 1-S       |                   |                   |
     |SDP answer         |                   |                   |
     |<------------------|                   |                   |
     |Call established by old primary        |                   |
     |...........................................................|
     |                   |REFER sip:New-primary                  |
     |                   |Secondaries: S?Replaces=1-S...         |
     |                   |Require: secondaries                   |
     |                   |------------------>|                   |
     |                   |200 OK             |                   |
     |                   |<------------------|                   |
     |INVITE             |                   |                   |
     |Call-Id: 2-S       |                   |                   |
     |Replaces: 1-S      |                   |                   |
     |<--------------------------------------|                   |
     |200 OK             |                   |                   |
     |Call-Id: 2-S       |                   |                   |
     |SDP offer          |                   |                   |
     |-------------------------------------->|                   |
     |BYE                |                   |                   |
     |Call-Id: 1-S       |                   |                   |
     |------------------>|                   |                   |
     |200 OK             |                   |                   |
     |Call-Id: 1-S       |                   |                   |
     |<------------------|                   |                   |
     |                   |                   |INVITE             |
     |                   |                   |Call-Id: 2-R       |
     |                   |                   |Replaces: 1-R      |
     |                   |                   |SDP offer          |
     |                   |                   |------------------>|
     |                   |                   |200 OK             |
     |                   |                   |Call-Id: 2-R       |
     |                   |                   |SDP answer         |
     |                   |                   |<------------------|
     |                   |                   |ACK                |
     |                   |                   |Call-Id: 2-R       |
     |                   |                   |------------------>|
     |                   |BYE                |                   |
     |                   |Call-Id: 1-R       |                   |
     |                   |<--------------------------------------|
     |                   |200 OK             |                   |
     |                   |Call-Id: 1-R       |                   |
     |                   |-------------------------------------->|
     |ACK                |                   |                   |
     |Call-Id: 2-S       |                   |                   |
     |SDP answer         |                   |                   |
     |<--------------------------------------|                   |
     |Call established by new primary        |                   |
     |...........................................................|
     |                   |                   |                   |
     |                   |                   |                   |
]]></artwork>
</figure>

<t>Note that if the old primary is participating in the call as a
media interface (and wishes to continue doing so), it must provide in
the Secondaries header a contact URI and dialog identifiers by which
the new primary can access the interface.  Similarly, if the new
primary may have been participating as a secondary, it must be
prepared to receive its own contact URI in the Secondaries header.</t>

</section>

<section title='Security Considerations' anchor='security'>

<section title='User Agent Authentication' anchor='authentication'>

<t>If the primary UA needs to authenticate itself to the remote UA or
to intermediate proxies, it needs to possess the credentials to do so.
This could be problematic if the primary UA does not really possess a
SIP user name of its own, but is representing a "leader" secondary
UA.</t>

<t>The primary UA could be given access to the credentials of all the
leader secondaries that it is working for.  It might limit its use of
these credentials based on the user which the leader secondary
authenticates itself as.</t>

<t>Alternatively, the primary UA could function as a quasi-proxy,
passing requests and responses between the leader secondary and the
remote.  This allows the leader UA to authenticate itself to the
remote.</t>

</section>

</section>

<section title="Revision History" anchor="revision">

<!--
<section title="Changes from draft-worley-aggregation-00 to draft-worley-aggregation-01" anchor="changes-00-01">

<t>
xxx
</t>

</section>
-->

<section title="draft-worley-aggregation-00" anchor="changes-00">

<t>
Initial version.
</t>

</section>

</section>

</middle>

<back>

<references title='Normative References'>

<reference anchor="offer-answer">
<!-- RFC 3264 -->
    <front>
	<title>An Offer/Answer Model with the Session Description Protocol (SDP)</title>
        <author initials="J." surname="Rosenberg"><organization/></author>
        <author initials="H." surname="Schulzrinne"><organization/></author>
	<date month="June" year="2002"/>
    </front>
    <seriesInfo name="RFC" value="3264" />
    <format type="TXT"
            target="ftp://ftp.isi.edu/in-notes/rfc3264.txt" />
</reference>

</references>

<!-- <references title="Informative References">

</references> -->

</back>

</rfc>

