\section{SIP Uniform Resource Locators}
\label{sec:sip-url}

SIP URLs are used within SIP messages to indicate the originator
(\header{From}), current destination (\header{Request-URI}) and final
recipient (\header{To}) of a SIP request, and to specify redirection
addresses (\header{Contact}).  A SIP URL can also be embedded in web
pages or other hyperlinks to indicate that a particular user or service
can be called via SIP.  When used as a hyperlink, the SIP URL indicates
the use of the {\INVITE} method.

The SIP URL scheme is defined to allow setting SIP
\header{request-header} fields and the SIP \header{message-body}.

\motivation{This corresponds to the use of \header{mailto:} URLs.  It
makes it possible, for example, to specify the subject, urgency or media
types of calls initiated through a web page or as part of an email
message.}

<<<<<<< url.tex
A SIP URL follows the guidelines of RFC 2396 \cite{rfc2396} and has the
syntax shown in Fig.~\ref{fig:url_syntax}.  Note that \header{reserved}
characters have to be escaped and that the ``set of characters reserved
within any given URI component is defined by that component.  In
general, a character is reserved if the semantics of the URI changes if
the character is replaced with its escaped US-ASCII encoding''
\cite{rfc2396}.
=======
A SIP URL follows the guidelines of RFC 2396 \cite{rfc2396} and has
the syntax shown in Fig.~\ref{fig:url_syntax}.
\begin{changebar}
The syntax is
described using Augmented Backus-Naur Form (See Section
\ref{sec:abnf}). 
\end{changebar}
Note that \header{reserved} characters have to be
escaped and that the ``set of characters reserved within any given URI
component is defined by that component.  In general, a character is
reserved if the semantics of the URI changes if the character is
replaced with its escaped US-ASCII encoding''
\cite{rfc2396}.
>>>>>>> 1.21

\begin{figure}[htpb]
\inputtxt{url_syntax}
\caption{SIP URL syntax}
\label{fig:url_syntax}
\end{figure}

\begin{figure}[htbp]
\inputtxt{phone_syntax}
\caption{SIP URL syntax; telephone subscriber}
\label{fig:phone_syntax}
\end{figure}

The URI character classes referenced above are described in
Appendix~\ref{sec:abnf}.

\begin{description}

\item[\header{user}:] If the \header{host} is an Internet telephony
gateway, the \header{user} field {\MAY} also encode a telephone number
using the notation of \header{telephone-subscriber}
(Fig.~\ref{fig:phone_syntax}).  The telephone number is a special case
of a user name and cannot be distinguished by a BNF.  Thus, a URL
parameter, \header{user}, is added to distinguish telephone numbers from
user names.  The \header{phone} identifier is to be used when connecting
to a telephony gateway.  Even without this parameter, recipients of SIP
URLs {\MAY} interpret the pre-@ part as a phone number if local
restrictions on the name space for user name allow it.

If a server handles SIP addresses for another domain, it {\MUST}
URL-encode the ``@'' character (\%40).  The '';'' character {\MUST} be
URL-encoded, as otherwise it is not possible to distinguish, in one
parsing pass, the case {\tt host;parameter} and {\tt
user;moreuser@host}.

\item[\header{password}:] The SIP scheme {\MAY} use the format
``\header{user:password}'' in the \header{userinfo} field.  The use of
passwords in the \header{userinfo} is {\NOTRECOMMENDED}, because the
passing of authentication information in clear text (such as URIs) has
proven to be a security risk in almost every case where it has been
used.

\item[\header{host}:] The \header{mailto:} URL and RFC 822 email
addresses require that numeric host addresses (``host numbers'') are
enclosed in square brackets (presumably, since host names might be
numeric), while host numbers without brackets are used for all other
URLs.  The SIP URL requires the latter form, without brackets.

\item[\header{port}:] If missing, the port number is assumed to be the
SIP default port, 5060.

\item[URL parameters:] SIP URLs can define specific parameters of the
request.  URL parameters are added after the \header{host} component and
are separated by semi-colons.  The \header{transport} parameter
determines the the transport mechanism (UDP or TCP).  UDP is to be
assumed when no explicit transport parameter is included.  The
\header{maddr} parameter provides the server address to be contacted for
this user, overriding the address supplied in the \header{host} field. 
This address is typically a multicast address, but could also be the
address of a backup server.  The \header{ttl} parameter determines the
time-to-live value of the UDP multicast packet and {\MUST} only be used
if \header{maddr} is a multicast address and the transport protocol is
UDP.  The \header{user} parameter was described above.  For example, to
specify to call {\tt j.doe@big.com} using multicast to {239.255.255.1}
with a ttl of 15, the following URL would be used:

\begin{verbatim}
  sip:j.doe@big.com;maddr=239.255.255.1;ttl=15
\end{verbatim}

The \header{transport}, \header{maddr}, and \header{ttl} parameters
{\MUSTNOT} be used in the \header{From} and \header{To} header fields
and the \header{Request-URI}; they are ignored if present. 

\item[Headers:] Headers of the SIP request can be defined with the ``?''
mechanism within a SIP URL.  The special \header{hname}
``\header{body}'' indicates that the associated \header{hvalue} is the
\header{message-body} of the SIP \header{INVITE} request.  Headers
{\MUSTNOT} be used in the \header{From} and \header{To} header fields
and the \header{Request-URI}; they are ignored if present. 

\item[Method:] The method of the SIP request can be specified with the
\header{method} parameter.
This parameter {\MUSTNOT} be used in the \header{From} and \header{To}
header fields and the \header{Request-URI}; they are ignored if present. 

\end{description}

Table~\ref{tab:url} summarizes where the components of the SIP URL can
be used and what default values they assume if not present.

\begin{table}[htbp]
\begin{center}
\begin{tabular}{lllllll}
& default & \header{Req.-URI} & \header{To} & \header{From} & \header{Contact} & external\\
\header{user}            &    --       & x & x & x & x & x\\
\header{password}        &    --       & x & x &   & x & x\\
\header{host}            & mandatory   & x & x & x & x & x\\
\header{port}            &   5060      & x & x & x & x & x\\ 
\header{user-param}      & \header{ip} & x & x & x & x & x\\
\header{method}          & {\INVITE}   &   &   &   & x & x\\ 
\header{maddr-param}     &    --       &   &   &   & x & x\\ 
\header{ttl-param}       &     1       &   &   &   & x & x\\ 
\header{transp.-param}   &    --       &   &   &   & x & x\\ 
\header{headers}         &    --       &   &   &   & x & x\\
\end{tabular}
\end{center}
\caption{Use and default values of URL components for SIP headers,
\header{Request-URI} and references}

\label{tab:url}
\end{table}

Examples of SIP URLs are:
\begin{verbatim}
  sip:j.doe@big.com
  sip:j.doe:secret@big.com;transport=tcp
  sip:j.doe@big.com?subject=project%20x&priority=urgent
  sip:+1-212-555-1212:1234@gateway.com;user=phone
  sip:1212@gateway.com
  sip:alice@10.1.2.3
  sip:alice@example.com
  sip:alice%40example.com@gateway.com
  sip:alice@registrar.com;method=REGISTER
\end{verbatim}

Within a SIP message, URLs are used to indicate the source and intended
destination of a request, redirection addresses and the current
destination of a request.  Normally all these fields will contain SIP
URLs.

SIP URLs are case-insensitive, so that for example the two URLs {\tt
sip:j.doe@example.com} and {\tt SIP:J.Doe@Example.com} are equivalent. 
All URL parameters are included when comparing SIP URLs for equality.

SIP header fields {\MAY} contain non-SIP URLs.  As an example, if a call
from a telephone is relayed to the Internet via SIP, the SIP
\header{From} header field might contain a phone URL.
