International calling is expensive. Tourists often hunt for free Wi-Fi spots in cafes and airports to call their families back home.
But what makes international calling so expensive? And how does WhatsApp allow calling for free?
PSTN calling burns money
PSTN calls run on phone lines, which aren't shared during calls.
If you have a single line, and two people want to make a call simultaneously, one will go through while the other will hear 'All phone lines are busy at the moment'.
This is a bad user experience, so phone companies lay many lines for peak concurrent calls.
Adding lines translates to physical wires and infrastructure. When not in use, these phone lines just add to the company's cost. So fixed costs are high.
On top of that, long-distance(STD) and International calls require multiple lines to be busy simultaneously. This means others can't talk while you do.
All of the above costs bubble up to your phone bills.
How does WhatsApp do it for free?
WhatsApp uses a different network technology: VOIP.
VOIP stands for Voice over IP. As the name suggests, the calls are routed over IP addresses.
Unlike PSTN, concurrent internet calls can use the same physical line. If two people try to talk on a single line simultaneously, their data is packeted and sent using TCP to destinations, over the same line.
1. Animated diagram of PSTN vs. VOIP packet switching.
This is very efficient, especially for long-distance calls. You no longer need to reserve multiple lines for just one call!
The result? WhatsApp calls cost next to nothing. So they offer it to customers for free.
Meta's infrastructure that scales to 100 million international calls
Although VOIP calls are cheap, they have a reputation for poor quality.
International calls have high latency and sometimes drop mid-conversation. Meta decided to revamp their calling architecture based on these problems.
Let's say A wants to call B. A needs a path to route and transmit their audio signal to B. B needs a way to be notified of A's call. These functions are performed by a relay server, that ensures packets sent by A and B reach their destination.
In international calls, the distances between A and B are large. Choosing a server that is close to both parties is impossible. Sometimes, the relay server is much closer to one party than other, leading to poor overall call experience. Since distances are long, choosing a relay server between both parties may lead to packet loss from both sides.
An example would be a person in India calling a person in the US. Choosing a relay server in US or India will lead to a bad experience due to distance skew. Choosing a relay server in-between in Europe will also lead to high packet loses on both sides.
2. The problem with international calling.
Meta decided to have each call managed by two servers. These servers are chosen to be close to A and B respectively.
And since the servers are connected by Meta's backbone network, their communication is fast and reliable (Meta's Content Delivery Network runs on top of this backbone).
3. Regional relay servers for higher-quality international calls.
The result was a 40% reduction in call latency. Meta also observed a 5% improvement in bitrate with fewer packet retries.
A big win for international calling, cheers!
If you are looking for more system design content, try our course here.