SIP URI and URL. Part 1 (URI, URL and URN)

Published on August 19, 2013

SIP URI and URL. Part 1 (URI, URL and URN)

    In the previous two articles, we examined the basics of SIP communication.

    1. SIP customer interaction. Part 1 (Easy Interaction)
    2. SIP customer interaction. Part 2 (Interaction using a proxy server)

    Further, I propose to deal with such an important component of SIP as SIP URI. We came across them before when we talked about the From, To, and other fields, but did not pay enough attention to them.

    In this short article, we will look at what URIs are and what they consist of. In the next article, we will focus on the URI and URL in the SIP protocol.


    Wikipedia says the following: URI (English Uniform Resource Identifier) ​​- a unified (uniform) resource identifier. It is pronounced in English like [yu-ar-ah], Russian is more often spoken [uri]. A URI is a sequence of characters that identifies an abstract or physical resource. Previously called the Universal Resource Identifier - a universal resource identifier.

    In this case, the URI can indicate both the location of the resource (URL) and its name (URN). And it may contain both. That is, URLs and URNs are special cases of URIs.

    The URI is built according to certain rules and consists of a mandatory scheme and hierarchical part, as well as an optional request (it is preceded by a "?") And a fragment (it is preceded by a "#"). The hierarchical part, in turn, consists of an optional Authority (I think translation will only complicate understanding) and a mandatory path. Authority includes Userinfo (login and password), host and port. In addition, the path may contain so-called parameters. Parameters are not often used, but we are lucky - they are present in the SIP URI. On the diagram, it looks like this:

    It looks pretty confusing, so I will give an example:


    The URL (Uniform Resource Locator) indicates the path (location) of the object and the method of accessing it. For example, points to the main page of English Wikipedia and suggests using the http protocol as an access method.

    The URL is described in RFC 1738 . This RFC describes various schemes for ftp, http, nntp, etc. Since a URL is a special case of a URI, a scheme in the general case looks exactly the same, however, various parts of it are relevant for different protocols. For example, for the telnet protocol, the URL scheme is as follows:

    Interesting fact: Tim Berners-Lee, the founder of the URL, later regretted that he dotted the domain names within the URL. The URL might look like this:


    URN is not used as part of SIP, but without it the story would not be complete.

    URN (Uniform Resource Name) is a unique name for an object. The URN includes the name of the namespace and identifier in that space. A typical example of a URN is the ISDN name of a book. URN consists of NID (namespace identifier or namespace identifier) ​​and NSS (namespace-specific string or unique namespace for this namespace). Schematically, it looks like this:

    To become completely clear, I will give the following example. Suppose we want to describe a certain Ivan.

    URN in this case will look like this: Russian passport: Ivan Ivanov, passport series 1234 number 123456. Where “RF passport” is the name of the namespace identifier, and “Ivan Ivanov, passport series 1234 number 123456” is a unique name in this space.

    Using this URN, we uniquely identify Ivan, but cannot determine his location. Here the URL will help us. It may look something like this: a car: the city of N / st M / apartment of L . Where “car” is the method of gaining access, and “city N ...” is the way.

    Summarize. The URN responds identifies the resource by name and answers the question “What?”. URL - indicates the path and method of accessing the resource and answers the questions “Where?” And “How?”. At the same time, URNs and URLs are special cases of URIs.