Nowadays there are lots of services, ways and platforms creating a setting for telecommunication for absolutely different goals and destinations. In this article, we are going to tell you more about Asterisk telephone system and configuration. Asterisk in complex with needed equipment is similar to classic PBX because of several features: usage SIP, VoIP protocols. There are lots of opportunities you will receive after Asterisk configuration. Freezvon Company helps to figure out what is Asterisk service and how to use it in a profitable way.

Definition of Asterisk and why do you need this

Asterisk is a cross-breed of OpenSource TDM, voice packet of PBX and IVR platforms with ACD functionality. Unofficial Asterisk can be called one of the most powerful, flexible and widespread integrated telecommunication program products.

Its name comes symbol of star (*), which means any card to any file name in such operating systems as UNIX, DOS, LINUX. As Asterisk PBX station has interface of any software and compatible to any telephone app without tie-in. Installation of Asterisk is possible to:

  • Ubuntu;
  • Windows;
  • CentOS;
  • Debian;
  • FreeBSD;
  • Linux;
  • Solaris;
  • OpenBSD.

In order to find detailed instruction concerning setting of Asterisk, just make a request via Internet. There you will get great amount of articles devoted to this subject. In general, Asterisk is a medium part between telephone technologies and phone applications creating steady field for usage of mixed telephone field. Such services as VoIP, SIP and others go into telephone technologies.

How to set Asterisk for call accepting?

Asterisk was created for interface and technologies cooperation. Its own aim was support of all possible types of telephone technologies. In order to get and make calls, just set Asterisk. File sip.conf includes parameters, which belong to access configuration of SIP to Asterisk server. Below there is a setting of Asterisk which can be added to file configuration sip.conf.

Such settings are suitable when you set a calls forwarding to SIP account received from us. In case you want to get calls to our server where Asterisk has been already set, then no settings are required. All of them you do on your own concerning your requirements.

If you will accept calls with SIP-account, which will be set in Asterisk then in personal cabinet you will be able to choose forwarding type SIP and indicate a username/number or name you want to be displayed in a system.

In case you have decided to get direct calls without SIP-accounts, then in redirection settings write: name@IP server:port

Instructions on how to set up Asterisk to receive calls.

After registering, you will receive an email with your "SIP-settings". Add the necessary sip trunk settings to perform its registration.

Data that must be entered to configure Asterisk:

  • The name is - SIP_ID of the user.
  • Username - your sip-login from personal account.
  • Password - your password from sip, from the "SIP-settings" section of your personal account.
  • Domain - the IP address of the server or its name from which calls will come.
  • Context = this is the name of the script that tells Asterisk to perform various actions on call processing, depending on where it came from.

* CallerID (number or name of the caller) for incoming calls is transmitted by the provider in the automatic mode in the data packet (VoIP packet). You can always use Asterisk to make calls through our SIP trunk, but this requires separate settings, depending on your system and needs.

Editing sip.conf

register => <sip account>:<yourpassword>
username=<sip account>

In this case, the freezvon name of the trunk, <sip account> is the sip account number that will come in the letter with the settings, <yourpassword> — the password for the sip account. Save the file and give the command in the sip reload asterisk console to re-read it:


Right here in the console, you can check the registration of your peer with the provider with the help of the command: sip show peers


Trunk registration with the command:

sip show registry


Trunk configured, in fact, connected the number. But this is not enough to make and receive calls. Need to edit dialplan.

Dial-plan — call routing plan

To make outgoing and receiving incoming calls, you need to edit the file etc/asterisk/extensions.conf and bring it to the following form:

;Outgoing calls

;Call to three-digit extension numbers
exten => _XXX,1,Dial(SIP/${EXTEN})

;Call to an external number in which four or more digits via a trunk
exten => _XXX.,1,Dial(SIP/${EXTEN}@freezvon)

With such a dialplan, when dialing a three-digit number, you call the local number, and when dialing any city number, you can call it without any additional digits. Immediately dial the number.

;Incoming calls from freezvon trunk
;Incoming calls from freezvon trunk are directed to extension 100
exten => _X.,1,Dial(SIP/100)

The context [freezvon-in] describes the behavior of an incoming call. In our case, all incoming calls from the freezvon trunk will be sent to the internal Vulture number 100

Save the dial-plan and reboot the asterisk with a single reload, command, or separately reboot the sip reload and dialplan reload commands:


Connecting subscribers and checking internal calls

You need to make some general settings and add users. We will work with the configuration file /etc/asterisk/sip.conf



Asterisk security on CentOS with fail2ban

If your asterisk has an external ip address, or a port is sent to it from an external ip, then you need to protect against brute force and other multiple connections. We organize protection using the well-known and popular fail2bantool. It's easy to do, fail2ban upports astersik out of the box. Simply install it and activate some settings.

Install fail2ban on the server with asterisk:

#yum install -y fail2ban

We include recording in the event log file of type security. To do this, open the file /etc/asterisk/logger.conf and uncomment the line:

security => security

Re-read log storage settings:

# asterisk -x "logger reload"

A new security file has appeared in the / var / log / asterisk folder. We will transfer his records to fail2ban for analysis. Open the /etc/fail2ban/jail.conf file, look for the [asterisk] section there and change the path to the log file and add the jail activation line:

logpath = /var/log/asterisk/security
enabled = true

Run fail2ban and add to autorun:

# systemctl start fail2ban
# systemctl enable fail2ban

In order for fail2ban to work, iptables must be running and configured. I also note that by default, fail2ban in centos 7 uses firewalld commands. If you have disabled it and are using bare iptables, then you need to delete the /etc/fail2ban/jail.d/00-firewalld.conf file and restart fail2ban. If this is not done, it will not work.

This completes the detailed and feature-rich asterisk configuration.

You can always use Asterisk for making calls via our SIP, but for this you need separate settings depending on your system and requirements. For receiving more details, contact us and solve your problems with unclear moments in virtual telephony services. We provide you with safety, success and favorable quality of our telephony system.