Introduction
Call Centres are an important aspect of any business that involves customer communication. For small to medium businesses, call centres can be hosted in-house to save cloud hosting costs and reduce network latency between the server and call centre agents. Moreover, it provides complete control over all operations and allows you to manage and make changes without hassle.
In this article, we are going to set up a minimalist version of a call centre to dial and receive calls with minimum requirements.
Architecture Overview
SIP Trunking is a method of delivering telephone services and unified communications to customers by using the Internet rather than traditional phone lines. SIP Trunking allows businesses to replace traditional PRI (Primary Rate Interface) lines and uses VoIP (Voice over Internet Protocol) to manage their communications at a much lower cost.
SIP Trunking requires a SIP Trunk Provider (e.g. Vonage) which is connected to an IP-PBX system (e.g. Asterisk) to handle VoIP calls. The IP-PBX system can be installed and hosted in-house without any complication. To make a phone call, a softphone (e.g. Zoiper) installed on a computer is connected to an IP-PBX system with a dedicated extension number and authentication credentials. This whole system can be visualised in the following diagram:
Prerequisites
To set up a complete in-house call centre solution, a few things will be required as it will make the installation and configuration process easier.
First of all, you will need to obtain an API key and Direct Inward Dialling (DID) number from Vonage. Vonage is a leading communications provider that gives developers access to APIs to send voice, video, and messages with advanced features like fraud and identity checks.
By signing up for a free account, you will have access to free credit, and straightforward documentation to use Vonage APIs.
Once sign-up is complete, proceed to purchase a Direct Inward Dialling (DID) number with your preferred country code. This is also referred to as Vonage Long Virtual Number (LVN) and helps businesses expand their local presence.
Also, you will require a Linux server, preferably Debian or Ubuntu, to host the Asterisk installation. Asterisk can be installed with a system having 1 GHz x86 CPU and 512 MB RAM, but for better performance, a 3 GHz CPU and 1 GB RAM are recommended.
For successful VoIP calls, you need to open the following ports on the firewall:
SIP: 5060 (UDP)
RTP: 10000 to 20000 (UDP)
There is one more optional but the recommended thing is to obtain a domain name or static IP address. This domain name or static IP address will always point to the Asterisk server to forward the calls easily. If you don’t have a domain name or static IP address in your hand, you can try several other possible options like DynDNS or Duck DNS
Vonage API Account
To complete this tutorial, you will need a Vonage API account. If you don’t have one already, you can sign up today and start building with free credit. Once you have an account, you can find your API Key and API Secret at the top of the Vonage API Dashboard.
Setup Asterisk
Install the Asterisk Server
The Asterisk server is very lightweight and has minimum hardware requirements on Linux server. Here is a brief overview of commands to install the Asterisk server on Debian 11 (bullseye):
sudo apt update # updates the package list from the repositories
sudo apt install wget build-essential subversion # install essential tools
cd /usr/src
sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz # download asterisk
sudo tar -xvf asterisk-18-current.tar.gz # extract files
# following set of commands will compile and install asterisk
# with example configuration files
cd asterisk-18*/
sudo contrib/scripts/install_prereq install
sudo ./configure
sudo make
sudo make install
sudo make samples
sudo make config # start asterisk automatically when system boots
sudo ldconfig # updates the system's shared library cache
sudo systemctl start asterisk # starts asterisk service
sudo systemctl enable asterisk # auto-start asterisk at boot time
Configure the Asterisk Server
Log into your Vonage SIP Trunking account to obtain API Key, for e.g. Master (c85…..), and API Secret which will be used as SIP username and password. For SIP Server (Proxy), refer to the documentation to pick the nearest endpoint according to your location (for e.g. sip-eu-3.vonage.com).
To connect to the Vonage SIP endpoint, SSH to the Asterisk server and add the following SIP configuration in /etc/asterisk/sip.conf:
[general]
context=public
allowguest=no
udpbindaddr=0.0.0.0
tcpenable=no
transport=udp
srvlookup=yes
nat=force_rport,comedia
register => SIP_USERNAME:SIP_PASSWORD@ip.nexmo.com
[outbound]
type=friend
context=from-internal
host=sip-eu-3.vonage.com
username=SIP_USERNAME
secret=SIP_PASSWORD
insecure=port,invite
canreinvite=no
disallow=all
allow=ulaw
nat=force_rport,comedia
Replace SIP_USERNAME and SIP_PASSWORD with your Vonage credentials.
The next step is to add a dial plan, which will allow users to connect to Asterisk and start making outbound calls. To do this, edit /etc/asterisk/extensions.conf:
[globals]
TRUNK=SIP/outbound
[from-internal]
; Extension for making an outgoing call
exten => _9.,1,NoOp(Outgoing call through SIP trunk)
same => n,Dial(${TRUNK}/${EXTEN:1})
same => n,Hangup()
In this example:
The globals section defines a global variable TRUNK which points to the outbound SIP trunk defined in sip.conf.
The from-internal context is used for extensions that make outgoing calls.
The pattern _9. matches any number that starts with 9 and is followed by one or more digits. This is commonly used to differentiate between internal and external calls.
${EXTEN:1} strips the leading 9 before sending the number to the SIP trunk.
Setup Softphone
Setting up a softphone requires both server and client configuration. First, we are going to add a softphone user with extension ‘1001’ by adding the following configuration in /etc/asterisk/sip.conf😀
[1001]
type=friend
context=from-internal
host=dynamic
secret=yourpassword
disallow=all
allow=ulaw
nat=force_rport,comedia
Restart Asterisk to apply all changes using sudo systemctl restart asterisk command.
To configure the client, download a softphone like Zoiper or linphone. Once the download is complete, run the installer on your computer and start the softphone. In the example below, we are using the Zoiper desktop application as a client. To register Zoiper softphone with the Asterisk server, enter 1001 as username, followed by yourpassword
Next, provide the local IP address of the Asterisk server (normally starting with 192.168.x.x)
Click skip for other options and it will finally show Zoiper client is connected:
To test the outbound call configuration, dial a number prefixed with 9, for example, to dial 18012312312, you would dial 918012312312
Setup Call Forwarding
So far we have configured our softphone to dial outgoing calls. In order to start receiving calls to the softphone we need to configure Vonage provided Direct Inward Dialling (DID) number, or sometimes called Long Virtual Number (LVN), to receive incoming calls and forward them to SIP URI hosted by the Asterisk server.
To do this, go to Numbers Dashboard and edit the number to see the configuration window. On the configuration window, select SIP under the Forward option. and enter the SIP URI that is hosted by the Asterisk server and click "Save".
Once the configuration is saved, the calls will be automatically forwarded to the Asterisk server. Here we need to edit /etc/asterisk/extensions.conf to describe which extension will handle incoming calls. In this example, we are forwarding incoming calls to agent with extension 1001.
[provider]
exten => _X.,1,NoOp(Someone is calling from provider) ; dial any number
same => n,Answer()
same => n,Wait(1)
same => n,Dial(SIP/1001,30,r)
Restart Asterisk to apply all changes using sudo systemctl restart asterisk command. From now on, if a caller dials LVN (as described in Fig-6.1) number, the call will be forwarded to the call centre agent with extension 1001 using softphone.
Further Configuration
Although not discussed here, it is possible to enable further configuration if necessary. For example Call Recording, IVR system, Monitoring and Reporting. All these features are enabled using dial plans. For details, please refer to Asterisk documentation.
Conclusion
In this article, we have successfully installed and configured a minimalist version of Asterisk with the capability of handling calls as well as making outbound calls. This server setup can be expanded to add extra features without hassle. To utilise the maximum efficiency of SIP services, it is highly recommended to visit the AI-capable, on-demand, elastic SIP trunking solution offered by Vonage.
Get in Touch
Have questions or feedback about this tutorial? Share your thoughts with us on Twitter) or our Vonage Community Slack channel quoting this article for quick response. You can also connect with me on Twitter.
Good luck and happy SIP Trunking!
Atique is a computer graduate and proficient Python developer with a passion for exploring new technologies. With a strong background in programming and system engineering, he holds over 10 years of experience in automation, testing, and integration. His interests span single-board computers, software-defined radios, and continuous experimentation with generative AI tools.