Last updated:

VoIP - Voice over Internet Protocol

VoIP (Voice over Internet Protocol) is a technology that allows you to make voice calls using an internet connection instead of a traditional phone line. VoIP converts the voice into a digital signal, transmits it over the Internet, and then converts it back at the other end so you can speak to anyone with a regular phone number.

Why

How VoIP Works

Here’s a basic overview of how a VoIP call is made:

  1. Your phone connects to your switch/router in your Local Area Network (LAN).
  2. When you dial a telephone number, your IP phone tells your VoIP service provider to call the other party.
  3. Your VoIP service establishes the call and exchanges data packets from your IP phone.
  4. Your VoIP phone converts your voice into digital data and compresses it for transmission.
  5. The data is sent over the Internet in data packets to the VoIP provider.
  6. On the other end, the process is reversed and data is uncompressed into voice for the other party.

Example

Vonage (my employer) is a leading Communication API provider that offers a wide range of services for voice, messaging, authentication, and more. Let’s take a closer look at how to make a voice call using the Vonage Voice API.

Here’s an example of making an outbound call using the Vonage Voice API and Node.js:

const Vonage = require('@vonage/server-sdk');

const vonage = new Vonage({
  apiKey: 'YOUR_API_KEY',
  apiSecret: 'YOUR_API_SECRET',
  applicationId: 'YOUR_APPLICATION_ID',
  privateKey: './private.key'
});

vonage.calls.create({
  to: [{
    type: 'phone',
    number: 'destination number'
  }],
  from: {
    type: 'phone',
    number: 'source number'
  },
  ncco: [{
    "action": "talk",
    "text": "This is a text-to-speech call from Vonage"
  }]
}, (error, response) => {
  if (error) console.error(error)
  if (response) console.log(response)
});

In this example:

  1. We import the Vonage server SDK and create a new instance with our API key, secret, application ID, and private key file.
  2. We use the vonage.calls.create method to make the call, specifying the “to” and “from” numbers.
  3. We define the call flow using a Vonage Call Control Object (NCCO), which in this case uses the “talk” action to perform text-to-speech.

Many more features and options for customizing the call experience are supported - learn more in the Vonage Voice API documentation.

Where to next

VoIP is incresingly becoming a replacement for traditional telephony - internet bandwidth and quality of service play a major role.