Skip to main content

The Problem of Finding a Peer on the Internet

When two devices need to communicate with each other, they both need to know the other’s IP address.
In some cases, you can subscribe to a static IP from your provider, though this usually involves an additional cost and is not always available (example: cooperatives that provide private subnets).
To overcome these limitations, signaling protocols were developed, among which the most important is: SIP (Session Initiation Protocol).

What is SIP?

SIP is a communication protocol between devices connected to the Internet.
Its primary function is to allow two devices to find each other and establish a session without previously knowing their IP addresses.
  • Each SIP client has an address formatted similarly to an email:
    sip:[email protected]
  • Both clients must register with a SIP Server, which keeps the list of IPs updated.
  • The server acts as an “initial intermediary,” but data transfer is point-to-point between clients.
  • The system validates identity via username + password.

Basic SIP Call Flow

  1. Client A sends an INVITE to the SIP Server.
  2. The server relays the request to B.
  3. B responds with RINGING → the server relays it to A.
  4. If B accepts, it sends OK → relayed to A.
  5. Both clients receive the IP addresses and session parameters (SDP: sample rate, channels, codec).
  6. Audio/data flows directly between A and B.
  7. To end, a BYE → OK is sent.
SIP is similar to email, but in real time.
A client can even subscribe to presence notifications from its contacts.
In scenarios with routers/firewalls, NAT intervenes, adding complexity to the connection.
Full specification: RFC 3261 – SIP: Session Initiation Protocol
https://datatracker.ietf.org/doc/html/rfc3261

How do I get a SIP account?

There are many providers (free and paid).
Some offer limited free accounts; others include minutes to conventional phone service through a monthly subscription.

Practical Guide

You can consult the official guide:
SIP Account Configuration Guide in Linphone
When creating an account, the provider supplies the following data:
  1. SIP Address
    Example:
    • sip:[email protected]
      Sometimes the fields are provided separately (username + server).
      Also called SIP identity, SIP URL, or SIP URI.
  2. Domain
    Example:
    • sip:radiovirtual.linphone.org
    • sip:radiovirtual.onsip.com
      Also known as URL of Registrar or Reg Server.
  3. Realm (Authentication realm)
    • May be the same as the domain.
    • Usually configured as “*”.
  4. Username / Auth Username
    • Some systems differentiate between a generic username and an authentication username.
    • Example:
      • Username: Luis_Garcia
      • Auth Username: lgarcia77
    • If the provider supplies a single piece of data → both are the same.
  5. Password
    • Password provided for validation against the server.

Example SIP Addresses

sip:[email protected] sip:[email protected]
As with email addresses, there are no restrictions:
a client on one SIP provider can call another registered with a different provider.

Other theoretical definitions

IP Address

  • Every device connected to the Internet has an IP address.
  • Format: four numbers separated by dots (e.g., 192.168.0.100).
  • The hierarchical organization allows for message routing.

Public IP vs Private IP

  • Within a LAN, devices use private IPs, which are not externally visible.
  • The router assigns a public IP to the entire network and acts as a firewall.

NAT (Network Address Translation)

  • Translates private IPs on the LAN to the router’s public IP.
  • Allows multiple devices to share a single external IP.
  • Different types of NAT exist, which can affect SIP.
More info: RFC 2663 – NAT Terminology
https://datatracker.ietf.org/doc/html/rfc2663

STUN

Session Traversal Utilities for NAT
Allows a client behind NAT to discover its public IP and the type of NAT in use.
Defined in RFC 5389.

TURN

Traversal Using Relays around NAT
Uses relay servers for clients behind symmetric NAT.
Defined in RFC 8656.

ICE

Interactive Connectivity Establishment
Combines NAT traversal techniques (STUN, TURN) to establish a connection between two devices on different LANs.
Defined in RFC 8445.