Introduction to SIP

Introduction

A conventional telephone connection consists of three parts:

010-phone-connection

  1. from your telephone to the your telecom provider’s local exchange
  2. from your telecom provider’s exchange to the exchange of the telecom provider of the person you are calling
  3. from the exchange of the telecom provider of the person you are calling to the telephone of the person you are calling

In the world of internet telephony, things are the same.

This article is about the first and third parts of a connection and about services available in the second, when either the first part or the third part or both are conducted over the internet. This article concentrates on SIP, which is the emerging standard for internet telephony.

Terminology

Before we proceed any further, we need to introduce some terms that will be used again and again:

  • caller: the person making the call
  • callee or called party: the person receiving the call
  • PSTN: the international telephone network, including mobile telephone networks
  • POTS: the Plain Old Telephone Service; i.e. the service provided over PSTN
  • telephone number: uniquely identifies a telephone on PSTN
  • the internet: a general-purpose digital communications network
  • VoIP (Voice over IP):  another name for internet telephony
  • SIP (Session Initiation Protocol): a protocol for voice and video calls over the internet; i.e. a service provided over the internet
  • SIP address: identifies a telephone on the internet (but not uniquely: a telephone can have multiple SIP addresses and a call to a SIP address can ring multiple telephones). SIP addresses look just like email addresses; they are of the format sip:<username>@<sip-provider>. The ‘sip:’ prefix is the scheme name, i.e. the part of the URL that tells applications with which protocol to connect to the address.
  • call origination: establishing a connection from the caller to the international telephone network (if the caller is on PSTN) or to the internet (if the caller is on the internet)
  • call termination: establishing a connection from the international telephone network (if the callee is on PSTN) or from the internet (if the callee is on the internet) to the callee

Further new terms will be links to Wikipedia.

Introduction revisited

Incorporating the terms explained above, we can now succinctly say that a telephone connection consists of three parts:

  1. call origination
  2. from caller’s exchange to callee’s exchange
  3. call termination

Comparison of POTS over PSTN and SIP over the internet

The most important differences and similarities between POTS over PSTN and SIP over the internet are:

  • PSTN and the internet are both partially meshed networks
  • PSTN uses links (e.g. cables, optical fibres, satellites, cell sites) that are dedicated to POTS, whereas the internet is a general-purpose digital communications network
  • POTS delegates only limited control to the end users (that’s you!), whereas SIP allows a lot of control by end users (e.g. from which locations you can place and receive calls)
  • Telecom providers have recognized the advantages of SIP over POTS and are building infrastructures to facilitate a gradual and smooth migration from POTS to SIP
  • POTS is responsible for negotiating a connection and it is responsible for relaying audio data between caller and callee, which it does over the same connection, whereas SIP is responsible only for negotiating the connection (RTP or SRTP protocols are responsible for relaying audio data between caller and callee and they use a separate and more direct connection for this)
  • PSTN can only provide audio telephone services.
  • SIP can provide audio and video telephone services

For more differences and similarities see also:

Call origination and termination with POTS

As just mentioned, this article is concerned with using SIP but you probably still want to be reachable by people calling from PSTN, therefore we need to consider call origination and termination when using POTS:

020-pots-termination-origination

Method (1) shows the traditional way: pick up your analogue telephone and request a connection to a number by dialing it. The number is sent to your local exchange. If the call is not to a local number then the number is sent on to a regional exchange. If the call is not to a regional number then the number is sent on to a national exchange. If the call is not to a national number then the number is sent on to an international exchange. Once the connection has been established then audio data is relayed through the exchanges, from each telephone’s mouthpiece to the other telephone’s earpiece.

(Contrary to what has just been implied, exchanges are not always linked in a hierarchy of local, regional and national exchanges; more information is given below.)

Method (2) shows using a mobile telephone instead of an analogue telephone. Mobile telephones have radio transceivers and mini- or micro-SIM cards to allow them to send the requested number and to relay audio data with cell sites, which, in turn, are connected to the PSTN.

Call termination over POTS looks the same as call origination over POTS, but in the other direction.

Note that:

  • call termination over POTS is not free of cost, regardless of whether the call originates on POTS or SIP (more information is given below)

Call origination and termination with SIP

030-sip-termination-origination

Method (3) shows a normal analogue telephone connected to a VoIP adapter. These adapters convert number requests (issued by the telephone when you dial a number) and voice data into their SIP equivalents. The SIP data is then sent, via your home router (that’s the broadband/DSL/cable router/modem provided by your ISP) to the internet. (It is not sent directly to the callee, but we’ll come to the details later.) VoIP adapters are cheap and easily accessible  (see below).

Method (4) shows an IP telephone, which is really just a normal analogue telephone with a VoIP adapter built into it.

Method (5) shows a Fritz!Box, which is really just a normal home router with a VoIP adapter built into it (note that Not all Fritz!Boxes have this facility)

Method (6) shows a smartphone talking to Fritz!Box. There are two ways this can be done:

  • By installing FRITZ!App Fon, you can turn your smartphone into a telephone extension
  • By configuring the Fritz!Box as a SIP server, making it akin to a SIP provider (see below)  and installing a softphone (see below) on the smartphone, you can turn your smartphone into a telephone extension

The second way is not recommended simply because it is confusing to have a SIP connection from the smartphone to the Fritz!Box and a SIP connection from the Fritz!Box to a SIP provider.

Method (7) shows a computer with microphone and loudspeaker running a so-called softphone (software emulating an IP telephone).

Method (8) shows a smartphone (which is just a small computer with a microphone, speaker, wireless network connection)  running a softphone application.

Call termination over SIP looks the same as call origination over SIP, but in the other direction.

Note that:

  • Calls originating on POTS and terminating SIP must cross from PSTN to the internet, which complicates matters (more information given below)

From caller’s exchange to callee’s exchange over POTS

POTS exchanges are not all directly linked to each other. Also, exchanges are not linked into a hierarchy. Instead, exchanges are linked into a partially meshed network, This implies that knowledge of the topology of the network is needed in order to route telephone connections. Each exchange has this knowledge and establishes a connection with an appropriate neighbouring exchange until the caller and callee are connected:

040-pots-routing

Note that:

  • the negotiation of the connection and the sending and receiving of audio data take the same route

More information about routing on PSTN can be found at:

From caller’s exchange to callee’s exchange over SIP

SIP exchanges connect to each other over the internet and so the routing is dictated by standard internet routing protocols:

050-sip-routing

Note that:

  • the negotiation of the connection and the sending and receiving of audio data take different routes.

More information about routing on the internet can be found at:

Equipment

Softphones

If you already have a computer or smartphone, then this is the cheapest way to get started with SIP. Some notable ones are:

See also:

VoIP adapters

Several are available on Amazon.

See also:

IP telephones

IP telephones used to be seen only at the office but have now reached the consumer market. Several are available on Amazon.

See also:

Services on POTS and SIP

Local Exchange Routing Guide

As mentioned above, knowledge of the topology of the PSTN network is needed in order to route telephone connections over it. The Local Exchange Routing Guide (LERG) is a database of links between PSTN telephone exchanges in North America. It is maintained by the Telecom Routing Administration (TRA) and it is provided to exchanges in order to help them route connections:

060-lerg

Similar databases exist for the each country and also for international links.

See also:

SIP providers

One of the aims of SIP is to allow people to keep the same SIP address while they move around. Of course, mobile telephones using PSTN also allow people to keep the same telephone number while they move around. But SIP allows them to move from one telephone to another and to keep the same SIP address, and even to have the underlying redirections scheduled automatically! But to make a moving person reachable necessitates that they ‘check in’ at a well-known and fixed location in order to indicate their current location, and it is through that well-known and fixed location that caller’s can locate the callee.

An analogy: in a work environment, you can leave a note indicating your current location on your office door (the well-known and fixed location):

070-im-in-the-datacenter

In the SIP world, your telephone tells your current location to the SIP provider with whom you have an account (the well-known and fixed location):

080-sip-registration

There are a lot of SIP providers out there, many of the them allow free registration. Some notable examples are:

Note that:

  • Calls originating on SIP and terminating on PSTN require the SIP provider to pay their telecom provider for the call they place over PSTN to your callee for you. In order to recover this cost your SIP provider will bill you. You can ‘buy minutes (on PSTN)’ from most SIP providers. If you have not bought minutes, then you will not be able to call telephones on PSTN
  • SIP providers generally offer voicemail services too; they know whether you are unreachable, busy or not answering, so they are in the perfect position to offer this service.

For more SIP providers see:

Services to help those with number-only keypads

Analogue telephones can only dial numbers and, with a keypad, also * and #. Therefore dialing <username>@<sip-provider> presents a problem:

085-address-book-entry-1

Regarding the <username> portion of a SIP address: when you register with a SIP provider, then, in addition to the username you requested, the SIP provider often allocates a numeric alias for that username.

E.g. sip:fred.bloggs@ekiga.net might also be sip:8123456789@ekiga.net.

<numeric-username>@<sip-provider> still contains non-numeric characters., but if the caller and the callee are using the same SIP provider, then the @<sip-provider> may be omitted, leaving <numeric-username>, which is dial-able.

But if the caller and callee are not using the same SIP provider then @<sip-provider> presents a problem:

086-address-book-entry-2

Regarding that @<sip-provider> portion of a SIP address: often SIP providers provide numeric aliases for other SIP providers. E.g. iptel.org provide the following aliases:

idsizecontainerflagsfilesystemmountpointnotes
efi partition550MBprimary partition tableefifat32-
boot partition1024MBprimary partition table-ext4/boot
LVM PVremainder of diskprimary partition table---
LVM VG 'vg0'100% of LVM PVLVM PV---
root15GBLVM VG 'vg0'-ext4/
remainderremainder of LVM VGLVM VG 'vg0'-affs1-prevent root soaking up all of space for LVM; will be deleted later; filesystem type chosen to be easily distinguished

E.g. if the caller has SIP provider iptel.org and the callee has SIP address sip:8123456789@ekiga.net, then the caller would dial 2223 8123456789.

Unfortunately, different SIP providers use different aliases for the same SIP provider, and the list of aliases does does not cover all SIP providers:

087-address-book-entry-3

As discussed earlier, SIPBroker is SIP provider. But they also maintain a very long list of other SIP providers for whom they have assigned aliases. These aliases are of the format *<number>. Such aliases can be dialed on numeric telephone keypads. SIPBroker have become the de-facto provider and resolver of numeric aliases for other SIP providers. Therefore the caller needs to know:

  • the caller’s SIP provider’s numeric alias for sipbroker.com (this information will be provided by the caller’s SIP provider itself, since it will vary from SIP provider to SIP provider)
  • SIPBroker’s numeric alias for the callee’s SIP provider (this can be found here)

E.g. If the caller has SIP provider iptel.org and the callee has SIP address sip:8123456789@ekiga.net, then the caller would dial 2220 *673 8123456789:

088-address-book-entry-4

SIP provideriptel.org's numeric prefix for SIP provider
ekiga.netno prefix necessary
iptel.org2220

If you have a VoIP adapter, Fritz!Box or other SIP-capable router, then it may be possible, via the device’s web interface, to add a numeric alias for a SIP address to an address book in the device. As shown in this screenshot from a Fritz!Box:

100-fritzbox-telefonbuch

E.g. the first entry in the above address book allows that Fritz!Box’s owner to dial **724 in order to reach me (if my SIP phone is running).

Note that:

  • From an analogue telephone connected to PSTN, you still cannot dial a numeric SIP address because POTS does not understand SIP addresses (numeric or otherwise); either the analogue telephone must be connected to the internet (via a VoIP adapter) or you must first dial a PSTN to SIP gateway (see below)

PSTN to SIP gateways

Call origination from PSTN terminating in SIP requires going through a gateway:

110-sipbroker-gateways

SIPBroker provide gateways in most countries. Once the caller connects to one of these gateways, he must dial *<sipbroker’s-numeric-alias-for-another-sip-provider><numeric-username>.

E.g. if the caller is in London, UK (inside 020 area) and trying to reach sip:8123456789@ekiga.net, then the caller should dial 33558806 *673 8123456789.

Note that:

  • the caller pays for the call to SIPBroker
  • SIP to PSTN gateways are SIP providers, but they charge for this

See also:

INUM

INUM was a service to provide PSTN telephone numbers for SIP addresses. The special country/area code +883 5100 was allocated for this purpose.

If a PSTN telephone originated a call with this prefix, then the POTS exchange tried to terminate the call over SIP:

120-inum

E.g. if Fred Bloggs had SIP account sip:fred.bloggs@ekiga.net and that SIP provider had arranged for the allocation of the INUM +883 5100 1234 5678 then calling that number would result in a SIP call to sip:fred.bloggs@ekiga.net.

Note that:

  • INUM has been decomissioned!
  • Calls to INUM were charged at local rates or below (this was a condition applied to telecom providers who wished to make the service available to their customers).
  • Some free SIP providers also allocated a INUM number at the same time as you registered with them (e.g. ippi.fr).

More details about the INUM service can be found at:

PSTN to INUM gateways

Unfortunately, not all POTS exchanges were willing to route calls to INUM, presumably because they were not willing to connect to INUM over PSTN while charging the caller only the cost of a local call.

E.g. British Telecom routed to INUM but TalkTalk did not route to INUM.

But the INUM people had their own gateways between PSTN, which were reachable by dialing local numbers, and INUM:

130-inum-gateways

ENUM

ENUM is a service to allow PSTN telephone numbers to redirect the call to SIP addresses (compare this with description of the INUM service above). The caller’s telephone (PSTN or VoIP) or an intermediate exchange looks up the callee’s telephone number in DNS to see if an alternative SIP address has been provided. E.g. if the callee’s number is +43 780 004711, then the caller’s telephone does this:

phone$ host -t naptr 1.1.7.4.0.0.0.8.7.3.4.e164.arpa | grep sip
1.1.7.4.0.0.0.8.7.3.4.e164.arpa has NAPTR record 100 10 "u" "E2U+sip" "!^.*$!sip:enum-test@sip.nemox.net!" .
phone$

and then redirects the call over SIP to enum-test@sip.nemox.net.

Note that:

  • if using Ekiga softphone, then when entering a numeric SIP address without @<sip-provider>, then Ekiga will try an ENUM lookup to see if it can make a SIP call instead
  • telephone numbers used in ENUM DNS lookups must include start with the country code (e.g. 43 for Austria)

See also:

Test numbers

SIP addressnumeric equivalent (excluding caller's SIP provider's prefix for sipbroker.com)notes
sip:411@ideasip.com*850 411automated directory inquiries service
sip:3246@iptel.org*478 3246 echo test (only accessible by iptel.org customers)
sip:music@iptel.org-listen to music
sip:904@mouselike.org*645 904menu-driven multi-test service

More test numbers can be found at:

Conferencing

SIP addressnumeric equivalent (excluding caller's SIP provider's prefix for sipbroker.com)notes
sip:000777NNN@iptel.org*478 0000 777 NNN

Note that:

  • Caller-created conference rooms on ekiga.net seem to be broken

See also:

  • nothing yet

Miscellaneous

Comparison of Skype and SIP

The most important differences and similarities between Skype and SIP are:

  • Amongst other things, Skype is the name of the propriety protocol, whereas SIP is an open and industry standard protocol
  • Skype is a small group of products (e.g. Skype, Skypephone) developed by Microsoft Skype Division that use the Skype protocol, whereas there are many products developed by many vendors that use the SIP protocol

For more information about Skype see:

How to add a SIP account to a Fritz!Box that has had this facility blocked by the ISP

The procedure that was previously documented here does not work with recent firmware. There is a new procedure (in German).

How to route calls over the right line with a Fritz!Box

140-outgoing-call-line-selection-on-fritzbox

E.g. With the above list of connections, it is possible to dial:

  • dial *124# 3246 to reach IPtel’s echo server
  • dial *124# 2223 82489539 to reach me on ekiga.net
  • dial *124# 2220 *673 82489539 to reach me on ekiga.net

See also