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

<front>
<title abbrev="SIP Instrument Identification">
Identifying Individual Telephone Instruments in SIP
</title>
<author initials="D. R." surname="Worley" fullname="Dale R. Worley">
       <organization abbrev="Nortel">
       Nortel Networks Corp.
       </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@nortel.com</email>
       <uri>http://www.nortel.com</uri>
   </address>
</author>
<date day="18" month="October" year="2009" />
<area>Transport</area>
<workgroup>SIPCORE</workgroup>
<keyword></keyword>
<abstract>
<t>
When requesting and reporting dialog status in SIP, users often want
to know the status of a particular telephone instrument,
rather than the status of an Address of Record (AOR).
The architecture of SIP makes it difficult to obtain the status of a
telephone instrument in a way that is convenient for use in common
situations, in particular, in an organization's PBX.
This document describes a method for identifying which telephone
instrument is making each registration request that is convenient to
deploy in PBXs.
This information can be used to obtain the status of individual
telephone instruments.
</t>

<t>
Unfortunately, although the method works well in practice, it violates
separation of concerns by carrying instrument identification
information in an authentication-related field.
This draft includes a preliminary discussion of better ways
to identify instruments.
</t>
</abstract>
</front>

<middle>

<section title="Method" anchor="purpose">

<t>
When requesting and reporting dialog status in
SIP<xref target="sip"/><xref target="dialog"/>, users often want
to know the
status of a particular telephone instrument (which may have several
"line appearances" of various Addresses of Record (AORs)),
rather than the status of an Address of Record (AOR) (which may appear
on several telephone instruments).
("Telephone instrument", or briefly, "instrument" is the term used for
individual telephone
devices in the telecom world.
We adopt it here to avoid the multiple meanings of the words "telephone"
and "phone".)
The architecture of SIP makes it difficult to obtain the status of a
telephone instrument in a way that is convenient for use in common
situations, in particular, in an organization's PBX.
</t>

<t>
This document describes a method by which a SIP registrar can
identify which telephone
instrument is making each registration request, a method that is convenient to
deploy in PBXs.
This information can be used by a proxy to route requests
to specified instruments.
This allows suitable SUBSCRIBE requests to be redirected to particular
instruments, allowing the status of an instrument (as opposed to an
AOR) to be obtained.
</t>

<t>
The fundamental difficulty is identifying the instrument which is the
source of each REGISTER request.
There are a number of straightforward methods of identifying the
registering instrument, all of which have significant drawbacks:

<list style="hanging">

<t hangText="IP address:">
The IP address from which the request originated (as given by the
Contact header, the Via header, or the packet's origin address) cannot
be relied upon to be the true address of the instrument due to NAT
or application-level gateway processing.
In addition, the IP address of an instrument can change due to network
address reassignment or relocation of the instrument on the network.
</t>

<t hangText="MAC address:">
The MAC address of the instrument's network interface will not change
over time, but it is impossible to obtain if the instrument is not on
the same network segment as the registrar.
</t>

<t hangText="'instance' parameter value in the Contact:">
The 'instance' parameter value in the Contact is easily obtainable and
does not change with network modifications.
However, not all instruments provide an 'instance' parameter.
Also, an instrument may change its instance value when its software is
updated, so as to invalidate information about the instrument that is
cached by other elements, as exemplified by this guideline in [gruu-implement]:
<list style="empty">
<t>
As other SIP agents may use the instance ID and/or GRUU
as a key to cache information about the UA and its
capabilities, it is recommended that when a new version
of software is installed into the UA, the UA should
obtain a new instance ID.
</t>
</list>
We have also observed that some instruments use different instance
parameter values for different line appearances.
In addition, instance parameter values are usually UUID-based URNs, which are
tedious for system administrators to enter into a provisioning system.
</t>

<t hangText="URI parameters:">
URI parameters could be applied to the AORs of the line appearances on
the instrument.
But URI parameters are not configurable on some popular instruments.
</t>

<t hangText="user-part URI parameters:">
An alternative to URI parameters is the nonstandardized concept of
"user-part parameters", that is suffixing ";name=value" on the
user-part of the AOR.
(User-part parameters are not described in [sip], but since ';' and
'=' are syntactically allowed in user-parts, they are a semantic
extension to [sip].)
Since instruments allow the user-part of the AOR to be configured,
user-part parameters can always be added.
Unfortunately, some intermediate network elements modify or delete user-part
parameters.
In addition, most instruments display the entire SIP user-part
to the user.
</t>

<t hangText="SIP extensions:">
It would be simple enough to have instruments provide a suitable
identifier in an extension header, but it would be difficult to
persuade vendors to implement the extension.
</t>

</list>

</t>

<t>
The method described in this document depends on the fact that in a
practical PBX, the
PBX's provisioning system generates configuration files which are read
by the instruments to set up their SIP configuration.
The PBX provisioning system inserts into the configuration file of
each instrument an identifier of the instrument, which the instrument
then returns in its REGISTER requests.
This allows the registrar to correlate the instrument with the
configuration file that it loaded, and hence with the identity of the
instrument as understood by the PBX provisioning system.
</t>

<t>
In practice, each instrument uses its MAC address to obtain a unique
configuration file using a network data transfer protocol (e.g.,
HTTP, HTTPS, FTP, or TFTP) requesting a file name that is derived from
the instrument's MAC address.
This makes it convenient to choose a string representation of an
instrument's
MAC address as the unique identifier of that instrument.
For syntactic convenience, we omit the colons from the string
representation, and require each identifier to have a consistent case.
</t>

<t>
It is challenging to determine a way to embed the instrument
identifier in a instrument's configuration in a way that will guarantee
that it is returned in each REGISTER request without the instrument's
specific cooperation.
It appears that in practice, the sole datum that is handled opaquely
from the instrument's configuration file, through the instrument and the
network, to the registrar, is the
"authentication user", the value of the username field of the
Authorization or Proxy-Authorization header.
Hence, we insert the instrument identification by configuring the
authentication user as "real-user/instrument-identifier".
(Because the instrument identifier does not contain '/', parsing is
unique even if the real authentication user contains '/'.)
</t>

</section>

<section title="Using Instrument Identifiction" anchor="using">

<t>
Once we have arranged for each REGISTER to carry identification of the
instrument that sent it, the registrar can record the identification
in the database record of the registration.
This allows us to define a special set of URIs which designate the
collection of all contacts registered by a given instrument.
In principle, this is similar to the redirection of AORs, which are mapped into
the set of all contacts for a particular AOR, but instead selecting records from
the registration database based on the instrument identification datum
rather than the user datum..
</t>

<t>
A further elaboration is to define another special set of URIs which
designate the collection of all contacts for a given AOR that are also
registered by a given instrument.
This will usually select only one registration, for a single line
appearance.
</t>

</section>

<section title="Example" anchor="example">

<t>
A typical usage pattern is as follows:
</t>

<t><figure><artwork><![CDATA[
PBX            PBX              Config. file     UA 69/70     UA 71
Provisioning   Proxy/Registrar  for 0000DEADBEEF

    |              |                |              |            |
    |  F1 PUT /0000DEADBEEF                        |            |
    |     line1.aor=sip:69@example.net             |            |
    |     line1.authuser=69/0000DEADBEEF           |            |
    |     line1.authpassword=XYZZY                 |            |
    |     line1.authrealm=example.net              |            |
    |     line2.aor=sip:70@example.net             |            |
    |     line2.authuser=70/0000DEADBEEF           |            |
    |     line2.authpassword=plugh                 |            |
    |     line2.authrealm=example.net              |            |
    |------------------------------>|              |            |
    |              |                |              |            |
    |              |                |  F2 GET /0000DEADBEEF     |
    |              |                |<-------------|            |
    |              |                |              |            |
    |              |                |  F3 200 OK   |            |
    |              |                |     ...      |            |
    |              |                |--------------|            |
    |              |                |              |            |
    |              |  F4 REGISTER sip:example.net               |
    |              |     To: sip:69@example.net                 |
    |              |     Contact: sip:69@10.3.14.159            |
    |              |     Proxy-Authorization: Digest            |
    |              |        username="69/0000DEADBEEF", ...     |
    |              |     ...                                    |
    |              |<------------------------------|            |
    |              |                |              |            |
    |              |  F5 200 OK     |              |            |
    |              |------------------------------>|            |
    |              |                |              |            |
    |              |  F6 REGISTER sip:example.net               |
    |              |     To: sip:70@example.net                 |
    |              |     Contact: sip:70@10.3.14.159            |
    |              |     Proxy-Authorization: Digest            |
    |              |        username="70/0000DEADBEEF", ...     |
    |              |     ...                                    |
    |              |<------------------------------|            |
    |              |                |              |            |
    |              |  F7 200 OK     |              |            |
    |              |------------------------------>|            |
    |              |                |              |            |
    |              |  F8 SUBSCRIBE sip:~~in~0000DEADBEEF@example.net
    |              |<-------------------------------------------|
    |              |                |              |            |
    |              |  F9 SUBSCRIBE sip:69@10.3.14.159           |
    |              |------------------------------>|            |
    |              |                |              |            |
    |              |  F10 200 OK    |              |            |
    |              |<------------------------------|            |
    |              |                |              |            |
    |              |  F11 SUBSCRIBE sip:70@10.3.14.159          |
    |              |------------------------------>|            |
    |              |                |              |            |
    |              |  F12 200 OK    |              |            |
    |              |<------------------------------|            |
    |              |                |              |            |
    |              |  F13 200 OK    |              |            |
    |              |------------------------------------------->|
    |              |                |              |            |
    |              |                |  F14 NOTIFY sip:71@10.9.7.8
    |              |                |  From: sip:69@10.3.14.159
    |              |                |              |----------->|
    |              |                |              |            |
    |              |                |              |  F15 200 OK
    |              |                |              |<-----------|
    |              |                |              |            |
    |              |                |  F16 NOTIFY sip:71@10.9.7.8
    |              |                |  From: sip:70@10.3.14.159
    |              |                |              |----------->|
    |              |                |              |            |
    |              |                |              |  F17 200 OK
    |              |                |              |<-----------|
    |              |                |              |            |
]]></artwork></figure></t>

<t>
F1 PUT  PBX Provisioning -> Configuration file for MAC 0000DEADBEEF
</t>

<t>
By some means, the PBX provisioning system writes the
configuration file for the instrument with MAC address
0000DEADBEEF.  The configuration information specifies the first
line appearance is for sip:69@example.net, with the the
"authentication user" name of "69/000DEADBEEF", which is the
"real" authentication user name, followed by its instrument
identifier, which is its MAC address (without separators, in
upper case).  Similar configuration information is given for the
second line appearance, sip:70@example.net.
</t>

<t>
F2 GET
</t>

<t>
Instrument 0000DEADBEEF requests its configuration file using its
preferred method.
</t>

<t>
F3 200 OK
</t>

<t>
Instrument 0000DEADBEEF receives its configuration file.
</t>

<t>
F4 REGISTER  Instrument -> PBX Proxy/Registrar
</t>

<t>
The instrument sends a REGISTER request for AOR
sip:69@example.net to the proxy/registrar.  After a
407 authentication challenge, the re-sent REGISTER request
contains a Proxy-Authorization header whose username value is as
specified in the instrument's configuration file,
"69/0000DEADBEEF".  The first portion, "69", is used by the 
proxy/registrar to look up
the associated password.  The second portion, "0000DEADBEEF", is
stored in the registration record to identify the instrument
whose contact address has been registered.
</t>

<t>
F6 REGISTER  Instrument -> PBX Proxy/Registrar
</t>

<t>
Similarly, the instrument sends a REGISTER request for AOR
sip:70@example.net to the proxy/registrar.
</t>

<t>
F8 SUBSCRIBE sip:~~in~0000DEADBEEF@example.net
</t>

<t>
User agent 71 sends a SUBSCRIBE request to
sip:~~in~0000DEADBEEF@example.net to obtain dialog information
for instrument 0000DEADBEEF.  The user-part prefix shown here,
"~~in~", is the one used in the sipXecs open-source
PBX system<xref target="sipXecs"/>.
This
particularly ugly string is chosen to minimize the likelihood of
colliding with user-chosen user-parts.
</t>

<t>
F9 SUBSCRIBE sip:69@10.3.14.159<vspace/>
F11 SUBSCRIBE sip:70@10.3.14.159
</t>

<t>
The SUBSCRIBE request is forked to the two contacts for
sip:~~in~0000DEADBEEF@example.net, which are the two line
appearances on the instrument 0000DEADBEEF.
</t>

<t>
F14 NOTIFY sip:10.9.8.7 / From: sip:69@10.3.14.159<vspace/>
F16 NOTIFY sip:10.9.8.7 / From: sip:70@10.3.14.159
</t>

<t>
Each SUBSCRIBE request received at instrument 0000DEADBEEF
generates a subscription.
The NOTIFYs from these subscriptions tell user
agent 71 the complete status of instrument 0000DEADBEEF.
</t>

</section>

<section title="Interoperability" anchor="interoperability">

<t>
This method makes very limited demands on components of a SIP
system other than the PBX's provisioning system and proxy/registrar
because the authentication user name is passed transparently by
elements between the instrument and the proxy/registrar.
</t>

<t>
This method does require that the configuration file for an
instrument can set the authentication user for a line appearance
independently of the user name of the AOR to be registered.
This has been found to be possible on all models of SIP phone that
have been tested to date.
Industry intelligence is that some popular SIP provisioning systems
require that this be possible, which suggests that all commercially
successful SIP phones will have this capability.
</t>

<t>
This method was implemented in the sipXecs open-source
PBX system<xref target="sipXecs"/> and
tested at SIPit 25<xref target="sipit"/> using five makes of SIP
phone.
It was seen to work with all five makes.
</t>

</section>

<section title="Future Improvements" anchor="future">

<t>
As well as this method works, it is a hack
that violates separation of concerns because instrument identification
information is carried in a field which is intended for authentication
information.
This requires all elements that need to authenticate the source of a
request to understand the syntax of the authentication user name.
This burden is smaller for centralized systems, but in decentralized
systems, there may be a large number of elements that need to
authenticate requests, requiring a broad distribution of information
that in principle should be encapsulated in the "user name and
password" database.
</t>

<t>
The philosophically ideal way to identify instruments is
via the SIP "instance id".
The instance id is used to support the "SIP outbound" 
mechanism<xref target="outbound"/>, the GRUU
mechanism<xref target="gruu"/>, and the SIP Forum's UA configuration
system<xref target="ua-config"/>.
</t>

<t>
There are two distinct ways to use the SIP instance id to support
instrument identification:
<list style="numbers">
<t>
The instance id is carried in the "+sip.instance" field parameter of
each Contact in each REGISTER request.
The proxy/registrar can extract the instance id and use it to label each
registration database record.
Once the registrations are labelled with instrument identifications,
requests can be directed to special URIs that route to the registered
contacts of a specific instrument.
</t>
<t>
Each instrument can register a single special contact which is intended to
identify the instrument as a whole rather than any line appearance on
the instrument.
This contact can be recognized by containing the instance id as either
a component of the
contact URI or as a "+sip.instance" field parameter.
With this method, the functions described in this document are be
implemented by sending SIP requests to this special contact.
E.g., the overall dialog status of the instrument would be obtained by
a dialog subscription to the special contact.
</t>
</list>
</t>

<t>
A number of problems need to be overcome before the instance id can be
used to provide instrument identification:

<list style="numbers">

<t>
While the authentication user name is a baseline part of SIP and is
always configurable by a PBX's provisioning system, 
the SIP instance id is not part of baseline SIP, and user agents need
to be upgraded to support the SIP instance id.
In practice, only some makes of instrument support SIP instance ids.
</t>

<t>
Ideally, all line appearances on an instrument would use the same
instance id.
Whether this is required by the RFCs is not entirely clear (probably
because there has never been any reason to debate doing so).
In practice, some instruments do use different instance ids for each
line appearance that they register.
However, since the preferred format of instance ids is a URN derived
from a UUID, which is in turn based on the MAC address of the instrument,
it is straightforward to extract the instrument's MAC address from each
instance id, and the extracted MAC addresses of the various line
appearances will be the same.
</t>

<t>
The PBX's provisioning system needs to be able to map instance ids
into its internal instrument identities, which likely requires having
the user enter the instrument identifiers into the provisioning system.
It would be inconvenient to use full instance id URNs for this reason:
UUID-based URNs are quite long and tedious to type.
However, using the base MAC addresses of the URNs as the
instrument identifiers would be convenient, as
they are short enough to be convenient to enter and most SIP phones are
clearly labeled with their MAC address
</t>

<t>
The reverse problem can happen with software-based instruments:
The provisioning system needs to output an instrument
identifier which can be input into the instrument, as the network
interface of the hardware platform is not "owned" by the instrument,
and the instrument may not be the only one on the platform.
In the method of this document, doing so is relatively simple, since the
instrument's interface allows the authentication user name to be entered
directly by the user.
To utilize the instance id, the instrument needs to allow its instance id
to be configured, or else it needs to output its instance id so that
it can be entered into the provisioning system.
</t>

</list>

</t>

</section>

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

<t>
There is one known security consideration for this method:
In ordinary usage of digest authentication, the registrar (and any
other element that needs to
verify an Authorization or Proxy-Authorization header) does not need
to know the password associated with an authentication user, but only
needs to know the digest authentication A1 value, which is a hash of
the authentication user, the authentication password, and the authentication
realm.<xref target="digest"/>
With this method, the registrar must know the authentication password,
as the A1 value will depend on the authentication user in the request,
which varies depending on the instrument sending the request.
</t>

<t>
This increased exposure of the authentication password does not
increase the vulnerability of a single SIP
system, since disclosure of A1 also allows an attacker to impersonate
the authentication user on that system.
But exposure of the authentication password (as opposed to the A1 value)
also compromises the
authentication user on any other SIP system
which the attacker can identify as using the same authentication
password for that authentication user.
</t>

<t>
In practice, this does not seem to be a problem as the
authentication passwords are usually generated pseudorandomly by the
PBX provisioning system and communicated to the instruments through
their configuration files.
As a result, authentication users on different systems will have
different authentication passwords, so the compromise of the
authentication user's password on one system will not
compromise the authentication user on other systems.
</t>

</section>

<section title='Acknowledgments' anchor='ack'>

<t>
Thanks to Scott Lawrence for critiquing the method presented here and
suggesting the development of an improved method, leading to the
discussion started in <xref target="future"/>.
</t>

</section>

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

<section title="draft-worley-sipcore-instrument-identification-00" anchor="00">

<t>
Initial version.
</t>

</section>

</section>

</middle>

<back>

<references title="Normative References">

<reference anchor="sip">
<!-- RFC 3261 -->
    <front>
        <title>SIP: Session Initiation Protocol</title>
        <author initials="J." surname="Rosenberg"><organization/></author>
        <author initials="H." surname="Schulzrinne"><organization/></author>
        <author initials="G." surname="Camarillo"><organization/></author>
        <author initials="A." surname="Johnston"><organization/></author>
        <author initials="J." surname="Peterson"><organization/></author>
        <author initials="R." surname="Sparks"><organization/></author>
        <author initials="M." surname="Handley"><organization/></author>
        <author initials="E." surname="Schooler"><organization/></author>
        <date month="June" year="2002"/>
    </front>
    <seriesInfo name="RFC" value="3261" />
    <format type="TXT"
            target="ftp://ftp.isi.edu/in-notes/rfc3261.txt" />
</reference>

</references>

<references title="Informative References">

<reference anchor="dialog">
<!-- RFC 4235 -->
    <front>
        <title>An INVITE-Initiated Dialog Event Package for the
                   Session Initiation Protocol (SIP)</title>
        <author initials="J." surname="Rosenberg"><organization/></author>
        <author initials="H." surname="Schulzrinne"><organization/></author>
        <author initials="R." surname="Mahy"><organization/></author>
        <date month="November" year="2005"/>
    </front>
    <seriesInfo name="RFC" value="4235" />
    <format type="TXT"
            target="http://www.ietf.org/rfc/rfc4235.txt" />
</reference>

<reference anchor="digest">
<!-- RFC 2617 -->
    <front>
        <title>HTTP Authentication: Basic and Digest Access Authentication</title>
        <author initials="J." surname="Franks"><organization/></author>
        <author initials="P." surname="Hallam-Baker"><organization/></author>
        <author initials="J." surname="Hostetler"><organization/></author>
        <author initials="S." surname="Lawrence"><organization/></author>
        <author initials="P." surname="Leach"><organization/></author>
        <author initials="A." surname="Luotonen"><organization/></author>
        <author initials="L." surname="Stewart"><organization/></author>
        <date month="June" year="1999"/>
    </front>
    <seriesInfo name="RFC" value="2617" />
    <format type="TXT"
            target="http://www.ietf.org/rfc/rfc2617.txt" />
</reference>

<reference anchor="gruu">
<!-- draft-ietf-sip-gruu-15 -->
    <front>
	<title>Obtaining and Using Globally Routable User Agent (UA)
                   URIs (GRUU) in the Session Initiation Protocol (SIP)</title>
	<author initials="J." surname="Rosenberg"><organization/></author>
	<date month="October" year="2007" />
    </front>
    <seriesInfo name="Internet-Draft" value="draft-ietf-sip-gruu-15"/>
    <format type="TXT"
	    target="http://www.ietf.org/internet-drafts/draft-ietf-sip-gruu-15"/>
</reference>

<reference anchor="gruu-implement">
<!-- draft-worley-sip-gruu-implement-02 -->
    <front>
	<title>Guidelines for Implementing the GRUU Support in User Agents</title>
	<author initials="D." surname="Worley"><organization/></author>
	<date month="February" year="2007" />
    </front>
    <seriesInfo name="Internet-Draft" value="draft-worley-sip-gruu-implement-02"/>
    <format type="TXT"
	    target="http://www.ietf.org/internet-drafts/draft-worley-sip-gruu-implement-02"/>
</reference>

<reference anchor="outbound">
<!-- draft-ietf-sip-outbound-20 -->
    <front>
	<title>Managing Client Initiated Connections in the Session Initiation Protocol</title>
	<author initials="C." surname="Jennings"><organization/></author>
	<author initials="R." surname="Mahy"><organization/></author>
	<date month="June" year="2009" />
    </front>
    <seriesInfo name="Internet-Draft" value="draft-ietf-sip-outbound-20"/>
    <format type="TXT"
	    target="http://www.ietf.org/internet-drafts/draft-ietf-sip-outbound-20"/>
</reference>

<reference anchor="sipit">
<!-- SIPit -->
    <front>
	<title>https://www.sipit.net/SIPit25_Summary</title>
	<author><organization/></author>
    </front>
    <format type="TXT"
	    target="http://sipxecs.sipfoundry.org/"/>
</reference>

<reference anchor="sipXecs">
<!-- sipXecs -->
    <front>
	<title>http://sipxecs.sipfoundry.org</title>
	<author><organization/></author>
    </front>
    <format type="TXT"
	    target="http://sipxecs.sipfoundry.org/"/>
</reference>

<reference anchor="ua-config">
<!-- UA-Config -->
    <front>
	<title>User Agent Configuration Recommendation</title>
	<author initials="S." surname="Lawrence"><organization/></author>
	<date month="September" year="2009" />
    </front>
    <format type="TXT"
	    target="http://www.ietf.org/internet-drafts/draft-worley-sip-gruu-implement-02"/>
</reference>

</references>

</back>

</rfc>

