What is VoIP and how to set it up with Asterisk

27.07.2021 958 0

When was the last time you made a traditional phone call? Perhaps you do not even remember. Currently, most people call through the Internet. Different providers and applications already offer phone services, and they have totally changed the users’ habits and the phone call experience. 

Once upon a time, phone calls meant dialing to call someone (only voice transmission). Today, it can mean the use of video besides audio, custom caller ID, auto attendants, call recording, voicemail to e-mail… no matter in which end of the world you are situated. 

What is VoIP?

VoIP stands for voice over Internet Protocol. It is the alternative for making and receiving phone calls through the Internet, using different technologies for multimedia transmission. In a nutshell, VoIP transforms phone calls into data that can be sent through the Internet.

That is why your Internet connection can be used to deliver phone services, instead of the regular landline of a local phone provider or a mobile network. 

The Voice-over-Internet Protocol (VoIP) relies on different Internet standards to work properly.

Financially, VoIP is a good method for handling calls that can be used for free online calls and low-cost calls to regular phones and mobile phones.

When was VoIP invented?

VoIP was invented in 1995. Some highlights of its history will follow.

In 1995, the Israeli company VocalTec invented the Internet phone, for a person to call someone, when both are using the same software and connected to a microphone and the speakers. Only audio was transmitted.

1996, sending voicemails through the Internet to a specific phone got possible. Some problems like broken connection, quality of the sound, and silence lapses still needed improvement. During that year, VocalTec and Microsoft joined forces to get Microsoft Netmeeting. The traditional talking and teamwork were about to change a lot.

1998, VocalTec announced phone-to-phone and computer-to-telephone possibilities via VoIP. 

The upcoming decade clearly saw the advantages of IP (Internet protocol) to transfer information. Development emphasized the enhancement of quality, speed, cost, and VoIP integration to different software and hardware. Users realized the cost-effectiveness of international calls.

The improvement of the session initiation protocol (SIP) was also a key factor. Hosted VoIP was adopted thanks to SIP; therefore, applications could work on pretty much every available phone system. This protocol allowed better security, a trunk system on the Internet that made connection easier.

The manufacturers of VoIP communication hardware got the ability to switch voice data packets into readable information for public telephone networks. Before this improvement, the CPU (of the users involved in a call) had to make this switch.

In 2003, the Skype beta version got born. It was possible to make computer calls (voice only) totally free of cost. Later, the instant messaging appeared, and users were able to call landlines and mobile phones. The highest point for Skype was in 2005, when the communication tools became absolutely popular its incorporation of the video chat feature.

Obviously, more companies got interested in the technology. And soon more solutions appeared on the market including not only the audio VoIP calls, but also video calls, instant messaging, real-time meetings, collaborating, conferencing, and more possibilities combined in the same application. 

How does VoIP work?

VoIP transforms voice (analog signal) into a digital signal and your microphone is the one that makes this signal conversion. The new signal is compressed and then, sent through the Internet using the IP protocol. The call is established for the users involved via a VoIP service (server) and calling application. VoIP servers can connect calls to different telephone networks. The data at the end is decompressed for the receiving side to hear the voice sound of the person who initially called. 

Commonly a VoIP setting up requires a phone and a SIP server (usually VoIP service provider). Regular users only need a connection to the Internet, modem, router, and a calling application to use VoIP.

Functions, which VoIP needs to work

At first sight, it seems like a simple process. However, when we go deeper on the technical side, many functions are needed to establish a proper communication through VoIP. And all the machinery must work orchestrated to succeed.

  • Transmission of data packets. It involves their transport across the network, and all mechanisms to guarantee their proper delivery. Acknowledging receipt of data, re-transmission of the missing packets, etc. 
  • Creation and management for every session (call). Meaning the connection and negotiation between peers to settle the conditions for the communication to happen. 
  • Security. From access controls, identity verification of computers or people involved in the communication, to encryption of data and more measures not to risk integrity and privacy of the content. 
  • Description of media. The kind of media to be sent (audio, video…), the method to encode and decode, send, and receive such data. 
  • Media transfer during the call (files, text, audio, video, etc).
  • Signaling. Many tasks are required at this point. Announcement users’ presence and contact data, location of users and contact data, dialing, reports of call status, negotiation, controls like mute, hold, transferring, etc.
  • Quality evaluation. All possible statistics about factors that affect communication and users’ satisfaction should be collected in order to improve the service.

Due to all these needs, different Internet protocols (proprietary and open-standards-based) take part in the VoIP process. See the following examples:

  • SIP (session initiation protocol). It controls and signals multimedia communication sessions.
  • SDP (session description protocol). It is a set of rules to initiate and announce multimedia communications. It does not deliver media streams. It works on the negotiation between endpoints about parameters like media types, network metrics, and more.
  • RTP (real-time transport protocol). It transfers real-time audio and video data.
  • RTCP (real-time transport control protocol). It provides statistics and status about the streaming. 
  • SRTP (secure real-time transport protocol), RTP’s encrypted version.
  • MGCP (media gateway control protocol). It manages media gateways.
  • XMPP (extensible messaging and presence protocol). It provides presence information, instant messaging, and organizes the contact list.
  • Jingle. Control for peer-to-peer sessions. Compatible with XMPP.

Advantages of using VoIP

  • The very low costs, users and businesses have to pay for long-distance calls, makes VoIP extremely attractive. Your business for sure pays already an ISP (Internet service provider). Since VoIP operates on the Internet’s infrastructure (different protocols, cable, and fiber broadband…) you get and make all the IP phone calls you need without paying extra fees. It’s not exactly free but it feels like. Especially when you compare with the high rates that traditional (landlines), analog (yes, there are places where it still works) and mobile companies still charge for a single call.
  • It offers more functions than traditional services (landlines) or mobile ones can. 
  • VoIP systems and all their features can be used via an accessible online dashboard. Users can easily organize, add, or remove contacts, etc. 
  • The VoIP data is saved in the cloud offering better security.
  • To call you only need an Internet connection (router and modem), a VoIP calling application, or a SIP compatible phone.
  • It works pretty much on every device, computer, phone, tablet, etc.
  • The quality of the sound is much better than the one offered by landlines and it improves every day.
  • More than two people can take part in the communication. This feature makes it ideal for businesses, their employees, and partners to collaborate, no matter of their location.

Disadvantages of using VoIP

  • Its quality and general performance rely totally on having a good quality Internet connection. Meaning having enough bandwidth. Choosing a good ISP (Internet service provider) becomes key to receive a good or bad VoIP service. For instance, latency can be caused by a poor Internet connection.
  • If there is a power outage, you will lose the Internet connection. Therefore, you could not call emergency services or someone in case of an urgent situation.

VoIP performance metrics

The following are factors that have an impact on the performance of VoIP. They are also helpful to evaluate its quality:

  • Latency. It takes a specific time for data packets to be transported to their destination. The delays in this process can affect communication.
  • Loss of data packets. When data packets do not reach their destination, data errors, data corruption, unsteadiness in video and audio, etc. can occur.
  • Unsteadiness. It is also known as jitter and it refers to the interruptions that can happen during the traffic flow of the digital signal.
  • Users’ experience evaluation. Input about communication performance and satisfaction of users help providers to fix problems and improve quality. Such information is gotten by using scores to qualify calls’ quality. 

How to install free VoIP server on your server

We are going to install a free VoIP server software that you could use on your Cloud Server or Dedicated Server. The software is open-source, free and it allows you:

  • to have a VoIP server.
  • create as many users as you like.
  • perform free calls from one softphone to another over the Internet (SIP).
  • have the privacy that VoIP software companies like Viber, Whatsapp, Messenger, Skype, and others cannot guarantee you.
  • Use with devices like computers, tablets, and phones by installing VoIP client software.

Here we will not get on the topic of how to communicate with others via the Publicly Switched Telephone Network (PSTN) that has a traditional phone system. The easiest way to add this functionality is with a paid service from an upstream trunk provider.

The software that we will use for the VoIP server is called Asterisk and we will install it on Ubuntu 20.04. It is free, but you can always ask the Asterisk’s team for support and other additional premium services. 

Log in to your remote server:

ssh root@IP_Address -p Port_number

You need to put the IP address and the port. Then use your credentials to enter. 

Check that everything is up-to-date:

apt-get update -y
apt-get upgrade -y

Install the required dependencies that will allow you to build the Asterisk server:

apt-get install build-essential git autoconf wget subversion pkg-config libjansson-dev libxml2-dev uuid-dev libsqlite3-dev libtool -y

Then install DAHDI for VoIP to traditional phones, if you need it in the future. To download it use:

cd /opt
git clone -b next git://git.asterisk.org/dahdi/linux dahdi-linux

Change to the downloaded directory and compile the downloaded item: 

cd dahdi-linux
make
make install

Now we need to configure it and install it too: 

cd dahdi-tools
autoreconf -i
./configure
make install
make install-config
dahdi_genconf modules

You will need LibPRI to allow Asterisk to communicate with ISDN: 

git clone https://gerrit.asterisk.org/libpri libpri
cd libpri

And install it:

make
make install

Download the Asterisk software: 

git clone -b 18 https://gerrit.asterisk.org/asterisk asterisk-18

Change to the downloaded directory and after that install the dependencies:

cd asterisk-18/
contrib/scripts/get_mp3_source.sh
contrib/scripts/install_prereq install

Go to the configuration of the Asterisk server:

./configure

And install the modules that you need: 

make menuselect

There you can navigate with the Arrow keys and select with Enter the modules that you want. Enable the Addons, Core sound, MOH, and Extra Sound.  

Build the Asterisk with:

make -j2

and then:

make installing

Install the documentation and the basic configuration of PBX:

make samples
make basic-pbx
make config

Update the libraries with:

ldconfig

Create a new Asterisk user:

adduser --system --group --home /var/lib/asterisk --no-create-home --gecos "Asterisk PBX" asterisk

And then edit the default config:

nano /etc/default/asterisk

Remove the comment from those lines:

AST_USER="asterisk"
AST_GROUP="asterisk"

Set ownership and permissions:

chown -R asterisk: /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
chmod -R 750 /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk

Now that all have been installed, start the Asterisk service with:

systemctl start asterisk

Add Asterisk to start when system reboot:

systemctl enable asterisk

Finally use:

asterisk -vvvr

You have already successfully installed a VoIP server. You can use it to add users and facilitate communications. The users need to install any VoIP client software (like Microsip), log in with their username and password, and connect to the server by using its IP address in the settings. 

Conclusion

VoIP has really changed the concept and cost of phone calls. It can seem like an easy process, but it truly involves many technologies to operate. Its adoption has grown fast worldwide and the current environment is strongly supporting VoIP due to its flexibility. It is getting common for more people to attend meetings, education, business negotiations, etc. through video conferencing. This only confirms VoIP’s utility, success, and brilliant future. 

If you want to keep reading exciting articles from the tech world, you can continue with the following:

Leave a Reply

Your email address will not be published.