Internet telephony Asterisk system. Until recently, only large institutions were able to afford their own telephone exchange. The commercial solutions that were available were based on closed proprietary standards, therefore they generated high costs even in basic configuration. Also, developing and extending such a system was costly and in most cases did not provide the desired flexibility. Business users were unsatisfied with the high licensing costs and the necessity to purchase and attach extendisve hardware modules or devices. The solution to those problems came whem Mark Spencer created Asterisk software. The platform conquered the business telecomunication sector in a very short time, evolving into a kind of base or standard that can serve and satisfy both the few telephones in a small office and entire call centers of large institutions, requiring low investment costs. WHAT IS ASTERISK? Asterisk isn t simply the software of a telephone exchange. Primarily, it s a media server, meant to handle all sorts of media. Since its integration with the Linux system, it allows users to make telephone calls, hold videoconferences, it handles e-mail, fax and voicemail service. It works on the basis of VoIP (Voice over IP), but will also function properly with traditional ISDN lines (with the help of appropriate cards, BRI or PRI lines can also be connected). The PBX (telephone exchange) of Asterisk covers all known commercial telephone exchange functions, which include: Transferring calls Call waiting Music on Hold Call Queuing (also with voice notification) Voice mail Fax Voice announcement service Interactive Voice Response (IVR)
Thanks to its almost limitless possibilities of integration with external applications, it is possible to extend the functionality of the exchange by some services, such as: Fax to e-mail Voice mail to e-mail Click to Call Text to Speech Voice recognition Integration with CRM system Auto-dialing for outgoing calls Writing AGI scripts is also possible, giving the possibility of introducing an almost unlimited number of modifications of the work of the telephone exchange. WHY ASTERISK? Asterisk has become serious competition to brandname telecommunication systems due to its low implementation costs, the ability to integrate it with other telephone or informatics systems, and the low costs of technical support. Contrary to the commercial systems, Asterisk doesn t require expensive hardware modules a medium-class server is sufficient for proper and reliable operation. Also, purchasing a license is required neither for the operating system that hosts the telephone exchange nor for Asterisk itself (except for some paid codecs). Figure 1 Figure 2 In addition there is no need to install additional telephone wiring, since the telephone stations can be connected with the central using the existing LAN network of the company. The fact that Asterisk is able to serve both hardware phones (fig. 1) and the so-called softphones (fig. 2) is also worth mentioning. A serious business advantage Asterisk provides is the ability to connect telephone stations located outside company headquarters (e.g. in a branch office) without having to install the elevated modules, as was the case in commercial headquarters. This allows to eliminate the cost of internal telephone calls, which can bring savings of up to 2000 zł per month.
An additional advantage is the existence of business Internet VoIP Service Operators (FreecoNet, among others), to which your company Asterisk can be connected. They offer attractive prices as compared to the call rates of incumbents (TP SA, Netia, etc.). As costs go, it is more profitable to make calls using the connection with the VoIP Operator in the case of companies that require frequent overseas calls or if the firm has multiple offices spread across multiple countries. In this case using the services of the VoIP Operator can bring in savings reaching even from a few to over a dozen thousand zł per month. EXAMPLE DIAGRAM OF INFRASTRUCTURE In this article we present the installation and configuration processes of the Asterisk Telephone Exchange. This configuration is most appropriate for small companies. The employees computers will be used as telephone stations (with the free program XLite installed). The presented telephone exchange will be connected through a network with the infrastructure of the VoIP Operator in this case FreecoNet, who offer a free SIP account in their system and assign a free-ofcharge telephone number can be used to test the functioning of VoIP services and the described telephone exchange. The proposed test telephone infrastructure is illustrated by the diagram below: Schema 1
TECHNICAL REQUIREMENTS The implementation of Asterisk begins with acquiring the necessary hardware the server. Seeing as the telecommunication system is key to a company s functioning, a stable hardware platform is of the utmost importance. While designing the hardware configuration of the server, the load (the number of simultaneous connections and working applications) that Asterisk will be subjected to must be kept in mind. If you plan on integrating the central with existing ISDN services, an ISDN card fitting the type of services provided by the telephone operator to the company (PRI or BRI lines) must be acquired. They may be Digium, Sangoma or OpenVox cards. INSTALLING THE EXCHANGE S OPERATING SYSTEM The installation starts with installing the operating system on a hardware platform. For the purpose of writing this article, the author applied a distribution of Linux CentOS 5.6 32 bit version, which can be downloaded from one of the mirrors. If you have 64-bit hardware architecture, you can use CentOS 5.6 64 bit (x86_64). We charge a distribution image of CentOS-5.6-i386-netinstall.iso and prepare the system installation CD. After starting the server, the welcome screen of the CentOS system should appear:
After starting the configuration options, we select the installation method of your choice (Installation Method). The desired method is the HTTP one. Next, we configure the server network cards, select the system partition and choose the software packages that will be installed in the operating system it is recommended to install only their minimal number, only the ones needed to start the application. If all installation options are configured correctly, the system starts downloading the relevant software packages from the Internet and installs them on the server:: CONFIGURING THE SERVER S OPERATTING SYSTEM After installing the CentOS operating system, whose job will be to host Asterisk software, we perform the steps that will allow us access to repositories belonging to Asterisk and the company Digium the manufacturer of software and libraries that cooperate with Asterisk: 1. First, we create both repository files so the software packages installer of CentOS system knows which network location to look for packages. To do this we issue the command: [root@localhost~]# touch /etc/yum.repos.d/centos-asterisk.repo 2. Then using an editor of choice (vi, nano, pico), we edit the file that we create, adding the following entries: [asterisk-tested] name=centos-$releasever - Asterisk - Tested baseurl=http://packages.asterisk.org/centos/$releasever/tested/$basearch/ enabled=0 gpgcheck=0 [asterisk-current] name=centos-$releasever - Asterisk - Current baseurl=http://packages.asterisk.org/centos/$releasever/current/$basearch/ enabled=1 gpgcheck=0
3. The next repository we add to our system is the Digium repository. To do this, we issue the command: [root@localhost~]# touch /etc/yum.repos.d/centos-digium.repo 4. To this file, we add the following entry: [digium-tested] name=centos-$releasever - Digium - Tested baseurl=http://packages.digium.com/centos/$releasever/tested/$basearch/ enabled=0 gpgcheck=0 [digium-current] name=centos-$releasever - Digium - Current baseurl=http://packages.digium.com/centos/$releasever/current/$basearch/ enabled=1 gpgcheck=0 After performing the above actions, the repositories of Asterisk s central should be available in the operating system. You can check if the configuration steps were performed correctly by issuing the command: [root@localhost~]# yum search asterisk After issuing the above command the system should provide a list of software packages associated with Asterisk. INSTALLING TELEPHONE EXCHANGE SOFTWARE After preparing the operating system to work with Asterisk software repositories, we must install Asterisk software. Before that happens, we need to create a user account (and a group) in the system, in which the software of the central will work. Next, we install the software of the PBX central. In writing this article, we assumed that it would be installed with most of the available modules and software. In order to begin the installation process, we issue the following command: [root@localhost~]# yum install asterisk18.i386 asterisk18-addons.i386 asterisk18-addons-bluetooth.i386 asterisk18- addons-core.i386 asterisk18-addons-mysql.i386 asterisk18-addons-ooh323.i386 asterisk18-alsa.i386 asterisk18- configs.i386 asterisk18-core.i386 asterisk18-curl.i386 asterisk18-doc.i386 asterisk18-odbc.i386 asterisk18-ogg.i386 asterisk18-pgsql.i386 asterisk18-resample.i386 asterisk18-snmp.i386 asterisk18-tds.i386 asterisk18-voicemail.i386
After completing the system installation procedure, we add the Asterisk service to the list of services the system is to automatically boot at startup: [root@localhost~]# chkconfig asterisk on Finally, we run the installed software with the command: [root@localhost~]# service asterisk start The operating system will inform us of starting the telephone exchange software, signaling the correctness of the installation by displaying the message: Starting asterisk: [ OK ] In addition, we can also verify the installation by logging onto the console panel. To do this, we issue the command: [root@localhost~]# asterisk -rvvvvvv The result of issuing the above command should be the following set of information: Asterisk 1.8.4.2, Copyright (C) 1999-2011 Digium, Inc. and others. Created by Mark Spencer <markster@digium.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= == Parsing '/etc/asterisk/asterisk.conf': == Found == Parsing '/etc/asterisk/extconfig.conf': == Found Connected to Asterisk 1.8.4.2 currently running on localhost (pid = 8124) Verbosity is at least 6 localhost*cli> If it appears, the software of the Asterisk central was started correctly. CONFIGURING THE ASTERISK TELEPHONE EXCHANGE For the telephone exchange to fulfill its purpose, after completing server configuration and telephone exchange installation steps, we must connect phones to the telephone exchange. Asterisk allows us to connect VoIP telephone hardware (example figure 1), the so-called hardphones, as well as telephone software (installed on a PC, becomes the equivalent of a telephone), the so-called softphone. The most popular softphone, which can be used with Asterisk, is the free XLite program, shown in figure 2, which can be downloaded off the Internet. In the implementation process described below, we will be using XLite.
To enable connecting XLite with the telephone exchange, it is necessary to establish a SIP account, which binds the internal telephone number with a specific user. To do this, we edit the sip.conf file, located in the /etc/ asterisk catalogue and add the following entries:: ; przykładowa definicja stacji telefonicznej w pliku sip.conf [2000] defaultuser=2000 ; nazwa użytkownika telefonu callerid="jan Kowalski" <2000> ; ID użytkownika secret=haslo ; hasło użytkownika type=friend host=dynamic; adres stacji telefonicznej jest zmienny (dhcp) context=wewnetrzne; kontekst, w którym umieszczamy wewnętrzne telefony disallow=all ; zabronienie użycia jakichkolwiek kodeków allow=alaw ; pozwolenie na użycie kodeka alaw allow=ulaw; pozwolenie na użycie kodeka ulaw allow=gsm; pozwolenie na użycie kodeka gsm nat=yes ; gdy serwer centrali jest za NAT-em qualify=yes ; canreinvite=no canredirect=no The subsequent telephone stations can be added in a simple manner: by copying the configuration entries and changing the internal telephone number assigned sequentially to the station (i.e. 2001, 2002 and so on) and the parameter CallerID. Next, we reload the telephone exchange settings using "sip reload" and configure the telephone stations in the XLite program according to entries we made previously and by the given pattern. After setting up all telephone stations, we make sure they established a connection with the Asterisk central. We do this from the level of the Asterisk console.
If the installed XLite application was configured correctly, the central should display a list of available telephone stations: localhost*cli> sip show peers Name/username Host Dyn Forcerport ACL Port Status 2000/2000 192.168.6.20 D N 64738 OK (29 ms) 2001/2001 192.168.6.21 D N 57634 OK (31 ms) 2 sip peers [Monitored: 2 online, 0 offline Unmonitored: 0 online, 0 offline] CONFIGURING TELEPHONE CALL ROUTES In the previous step, we configured telephone stations to enable their connection to the Asterisk telephone exchange server. In order to enable calls, though, we must define the routes by which the exchange will be making connections, depending on the telephone number selected by the user. In the beginning, we must enable the making of internal calls. In the article below, the author assumed the internal numbering of the company s telephones is included in the range from 2000 to 2020. Configuring the routes for calls within the company, we begin by adding the so-called context for internal calls. To do this, we locate the [default] section in the extensions.conf file and add the following entry: [default] include => wewnetrzne We have now informed the telephone exchange that it must normally consider the context of internal, where instructions detailing the exchange s behavior in case of choosing four-digit calls inside the firm will be placed. In order to define the abovementioned file, we add the appropriate entries that are meant to inform the exchange, that in case the user enters a four-digit code, starting with the digit 2 (the range of internal telephone numbers of our company), it should direct the call through the SIP channel to that number. For the introduced changes to come into effect, we open the exchange manager (using the command Asterisk rvvvv) and make the following command: localhost*cli> dialplan reload After issuing the above directive, connections between internal numbers should be possible. The exchange console will inform us of this as follows: localhost*cli> == Using SIP RTP CoS mark 5 -- Executing [2001@wewnetrzne:1] Dial("SIP/2000-00000002", "SIP/2001") in new stack == Using SIP RTP CoS mark 5 -- Called SIP/2001 -- SIP/2001-00000003 is ringing == Spawn extension (wewnetrzne, 2001, 1) exited non-zero on 'SIP/2000-00000002'
CONNECTING THE TELEPHONE EXCHANGE TO THE VoIP SERVICE PROVIDER The time has come to define the connection between the Asterisk telephone exchange and the VoIP service provider. To do this, we will edit the sip.conf file. In the [ general ] section we add entries that will enable the following actions: directing unknown calls to the default context, turning on the resolution of the domain after the SRV records, not allowing unauthorized calls, settings required by the operator, settings for gates/phones behind NAT, setting Asterisk s network address, setting the router s public address, for which it is Asterisk, other settings. We register our exchange with the VoIP telephony operator. In order to do that, we add the following directive in the sip.conf file: register => uzytkownik:haslo@sip.freeconet.pl/przychodzace przychodzace Next, we must define connections to the operator and from the operator, the so-called peers. In the next step, we make appropriate changes to the file extensions.conf. The only thing that remains is to test our configuration by calling the test number received from the FreecoNet operator (i.e. from a mobile phone).. Article created by Mariusz Hyra, Support Online Sp. z o.o. Sources: 1) http://ftp.ps.pl/pub/linux/centos/5.6/isos/i386/centos-5.6-i386-netinstall.iso
Support Online uses the Asterisk system in its own company. We both use Internet connections and secure the system with standard lines. We implement Internet telephony to our clients. We have extensive experience and knowledge both in the field of telecommunications and other IT solutions. If you are interested in using the Asterisk system or any other IT solutions in your company, please contact us: Support Online Sp. z o.o. tel. + 22 335 28 00 e-mail: support@so.com.pl www.support-online.pl