All you want to know about Asterisk – VoIP system architecture – Part 2

Tags: AsteriskPacket SwitchingVoIPVoIP server

Published on: February 18, 2016 by Scott S

All you want to know about Asterisk – VoIP system architecture – Part 2


As mentioned in my previous blog, POTS/PSTN works based on circuit-switching technology and VoIP uses packet-switching.  Here I am trying to provide you some insights about  VoIP system architecture and its working

Packet Switching and Its role in VoIP

Packet switching technology is the technology used by data networks for communication. The data network mentioned here is the Internet network.

All the data is converted into data packets and then transmitted through a transmission medium. The transmission medium used by Internet are Ethernet cables, WLAN adapters etc. When two devices connected to an internet communicate, the sender converts all the data to be sent into small packets of equal/variable size. These packets of data are called data packets.The packets contain many metadata information like, the IP address of the destination device, the actual data, the source device IP, the packet number etc. So the sender sends the data packets into the transmission medium used by Internet.

For example, if a file having size 10mb needs to be sent from device1 to device2, the device1 converts the 10mb file to many packets. Lets consider that the file is split into 10 packets having 1mb each. Then all these 10 packets are sent into the transmission medium. All these 10 packets travel via different paths along the transmission medium and reach the destination(not necessary to be the correct order). All the packets reach the destination device using the destination IP address assigned to the packets. Once the packets reaches the destination device, the destination device knows how to rearrange the packets in the correct order for the file to be read/write using the metadata of the packets. This is how a packet switched circuit work.

See the digram given below. The packets travel via different paths along the network and reach the destination.

Screenshot from 2016-02-05 20:01:41


As you can see that the packets are sent via different channels, there is no need for a dedicated channel for the data to be transferred as compared to the PSTN circuit-switch technology.  In circuit-switched technology for the data to reach the destination, there needs a dedicated channel connected throughout the entire time till the data is received on the destination.

If circuit-switched technology was used by internet, the entire internet would have been slower. Imagine, to browse a website, if the connection is maintained between you and the web server for the entire time you browse, the total procedure becomes slow if there are more users. This is overcame by using the packet-switch technology where the packets are sent as and when needed. ie; instead of sending data over a dedicated line, packets are send via many paths or lines before it reach the destination.

Circuit-switching keeps the connection constantly open, whereas packet-switching opens connection as and only when there is a need or request. So in general VoIP uses Internet’s packet switching technology to provide voice services or also called a telephone service.

Working Of VoIP Calls

This scenario explains how we can replace the current PSTN telephone service entirely with a VoIP telephone service.

In-order to have a PSTN call we need to have a PSTN subscription. That means, there are several companies that offer PSTN services and we need to buy their service at a cost to enable PSTN service.  Similarly, to make a VoIP call we need to subscribe a VoIP service from a VoIP service provider like Callcentric, Vonage , Airtel etc.

Now lets consider an example where there are two parties, both having VoIP service subscription. They are both having only analog telephone phones which we normally use with the current PSTN connections. For an analog phone to work with VoIP, as mentioned in my previous blog we need an ATA(Analog Telephone Adapter). And with a VoIP subscription, we get a ATA that the VoIP provider provides. Now both the parties connect their analog telephone to their respective ATA’s and make the analog phone compatible with VoIP.

Now we shall see the procedure in placing/retrieving a call.

  • The calling party picks up the receiver to make a call, and a signal is sent to the connected ATA.
  • The ATA sends back a dial tone to the telephone, confirming that the telephone is connected to the Internet or VoIP network.
  • Then the calling party dials the number of the called party. This is stored as a digital data by the ATA.
  • This digital number data is sent via Internet to the VoIP provider call processor or VoIP Server as a call request.
  • The call processor determines whether the request made is a valid format or data and if valid, it converts the number into an  IP address.
  • On the receiver end, a signal is sent to the ATA, telling it to ask the connected phone to ring.
  • Once the receiver party picks the phone, a session is established between the called and the caller party by the VoIP server.  Actually both the analog phones acts as computers in an established VoIP session. This means that each telephone knows to expect packets of data from the each other. And between these two computers(analog phones) the normal internet network/infrastructure handles the call as if it were e-mail or a Web page or any other Internet related service. The systems implement two channels, one for each direction, as part of the session.
  • During the entire time of call the caller and the called party’s telephones transmit data packets back and forth. The ATA’s at each end maintain a closed circuit between the respective analog phones attached to it and it translates the packets as and when received to the analog audio signal for the receiver to hear.
  • Once the call is ended or the receiver is hung up, the circuit formed between the ATA and the telephone is closed. The ATA also sends a signal to the VoIP server to close the session initiated.


The conversion of analog audio signal to data packets was the first hurdle in the VoIP technology. The conversion of analog voice signals to data packets to be used by VoIP is done by codecs.

A codec stands for coder-decoder as in a modem(modulate-demodulate). It converts an audio signal into compressed digital form for transmission(coder) and then uncompresses the digital data packet into audio signal(decoder).

Codecs does this conversion by sampling the audio signal several thousand times per second. For example, the G.711 codec samples the audio at 64000 times in a second. It then converts each tiny sample into digital data and compress it for transmission over the Internet/VoIP network.

There are mainly three different sampling rates:

  • 64,000 times per second
  • 32,000 times per second
  • 8,000 times per second

A G.729A codec has a sampling rate of 8,000 times per second and is the most commonly used codec in VoIP.

Codecs does the process of converting the analog audio signal to digital data packets is complete, but still doesn’t know where to send the data. This is where the VoIP Server or the call processor comes into play.

VoIP Server/Switch

The VoIP server can be a dedicated hardware solely built to act as a VoIP switch or can be software based like Asterisk. A VoIP switch is a program that does the mapping of packets. There are basically three functions that a switch/server does:

  • It knows the network endpoint and connects to it. A user connecting to VoIP service using a phone/computer is referred as an endpoint. So the caller and the called party are the endpoints.
  • The number associated with a particular endpoint.
  • The IP address of the endpoints.

The switch or the VoIP server has the database of the users and their associated phone numbers. There can be more than one switches for a VoIP provider. If the database of one server doesn’t have the information about a user, it then passes the request to another switch available until it finds the user. Once the user is found, it finds out the IP address of the user using similar requests. Once all the required details like the phone numbers, IP address etc are found, it sends back all the information to the IP phone/soft phone connected to the endpoints allowing the endpoints to exchange data between them.

So the switches can be an altogether different hardware as compared to computers or IP phones. But for VoIP to work flawlessly, all the devices connected to the VoIP service network(IP/soft phones, ATA’s, Switches, call processor/VoIP server) should be able to communicate with each other irrespective of the hardwares used. So, a common way of communication must be used by the devices connected to the VoIP network. These common way of communication is defined by Protocols.


As we know, the endpoint of a VoIP service/call can have either an analog telephone, or an IP phone or a Soft phone as the user interface, an ATA or other devices having the Codec to convert the audio signal to digital packets, and also a switch/server to map calls. So they are a combination of different hardwares and softwares running together.

How does this different hardwares and softwares communicate in a similar way?

The answer is, by using Protocols. A Protocol defines the ways in which devices having different specification connect to each other and to the network using VoIP.

There are many protocols that are currently used by VoIP. The most widely used protocol is H.323, a standard created by the International Telecommunication Union (ITU). The H.323 protocol was designed for video conferencing. The H.323 is not just a single protocol, rather many individual protocols combined that have been developed for specific applications.

Below is a table showing the complete H.323 protocol suite.

Screenshot from 2016-02-05 20:16:57

As mentioned H.323 is a combination of protocols. This allows it to be used for many application apart from VoIP too. That means, even though it is the widely used communication protocol it was not a dedicated VoIP protocol.Session Initiation Protocol (SIP) is a protocol that is tailored for VoIP sessions. SIP is a more streamlined protocol and is much smaller and efficient than H.323.

In my next tutorial on how to implement a VoIP server, I’ll be explaining Asterisk, an OpenSource software that can be configured as a VoIP server/switch that works using SIP protocol. Asterisk also supports other protocols like IAX, XMPP etc that are similar VoIP protocols, but I’m using SIP as the protocol.

Private Branch Exchange (PBX)

Using a VoIP service provider, you can make and receive VoIP calls over  external PSTN lines. Also, the VoIP technology can be used as an internal voice communication solution for organizations. ie; calls within an organization can be made over VoIP using the local area network.

The VoIP server working internally to route/map calls within the local area network of a company is known as a Private Branch Exchange(PBX). It’s basically a telephone system within an enterprise that maps calls between enterprise users. The below image shows the topology of a PBX. The Computers are having soft IP phones installed on them and there are physical IP phones too, connected to the same LAN. As you can see there is a PBX Server that handles mapping/call routing, also on the same LAN. This enables all the devices on the shown image for voice communication using VoIP(PBX).

Screenshot from 2016-02-05 20:54:09

So setting up a PBX using VoIP application can enable computers/devices within the internal network of a company for free voice calls. By using soft IP phones installed on computers, computers can be used to initiate voice calls.

I’ll be explaining on how to use Asterisk(VoIP application) to setup an internal PBX using both soft and hard phones in my next article.


Recommended Readings

VoIP Fundamentals

Asterisk PBX

Asterisk IVR

Get 24/7 technical helpdesk support

Category : Howtos, Linux

Scott S

Scott S

Scott follows his heart and enjoys design and implementation of advanced, sophisticated enterprise solutions. His never ending passion towards technological advancements, unyielding affinity to perfection and excitement in exploration of new areas, helps him to be on the top of everything he is involved with. This amateur bike stunting expert probably loves cars and bikes much more than his family. He currently spearheads the Enterprise Solutions and Infrastructure Consultancy wing of SupportSages.

You may also read:


Add new commentSIGN IN

Let's Connect

Get new updates


$0.000 items