📜 ⬆️ ⬇️

Office telephony on Asterisk + FreePBX

Prehistory

For some political reasons, I was faced with the task of transferring the telephony of our office from the hybrid analog PBX Panasonic KX-TDA200 to SIP. Simplified the task of having an SCS in the office, and made it difficult for operators to use panels with buttons for quickly switching calls.

Considered options:

Being a supporter of free software, I persuaded the authorities to accept the third option. Moreover, I just released a server that could be used for this task.

Procurement and preparation

To communicate with the city telephone networks, the OpenVox DE130E was purchased. Phones were purchased by Grandstream .

I put on the server:

Assembly

I decided to take Asterisk not from the package, but from the source code, since there was no certainty that it would work from the package with the OpenVox board.
')
DAHDI driver for OpenVox

Instructions for building and configuring DAHDI drivers are available on the openvox website ( PDF ). No ambushes were met. Zhelezyaka immediately saw the stream.

Asterisk

Asterisk I took version 10.9.0 (yes, they recently changed the principle of numbering versions). I downloaded, unpacked, said ./configure; make menuconfig ./configure; make menuconfig , just like in the old days for the kernel. First ambush - for menuconfig need ncurses, newt or GTK. Moreover, since we collect from source, we need -dev versions of libraries (this is also true for all other packages delivered in the process).
asterisk menuconfig is clear and convenient, if some component cannot be assembled, then it is written that you need to add it to make the assembly. For example, for a fax, libspandsp-dev had to be delivered. Do not forget to restart ./configure after installing the libraries. If additional files are required for assembly, they will be downloaded automatically.

For FreePBX to work, it is necessary that Asterisk has a manager interface. You need to remember to turn on this module, and before installing FreePBX, put the imputed password and permissions in the /etc/asterisk/manager.conf file.

So, all components are selected, you can run standard make; make install make; make install . Installing FreePBX will require us to run asterisk, so let's say make samples .

Attention! After this, when you start, you will get an absolutely live asterisk in the configuration "for example", which is not a model of security. In other words - turn off the firewall.

FreePBX requires Asterisk and Apache to spin from the same user, so we create the user and the asterisk group, register them in the Apache config. Permishy on files FreePBX will adjust on their own.

Freepbx

Surprisingly, no rake appeared. I downloaded, strictly according to the instructions, created a database, user, ran the scripts, launched. You can go to the interface settings.

Customization


Initial setup

On the first screen of the administration interface in the “FreePBX Notices” area, a lot of messages appeared that there are many configuration files in / etc / asterisk that FreePBX itself should manage. I deleted these files (saved copies). When you click the big red “Apply Config” button, FreePBX generated the necessary files by itself.

Selection of FreePBX Modules

Went to “Admin - Module Admin”. Noted repositories Basic, Extended and just in case Unsupported. I clicked on "Check Online" and got the opportunity to collect modules for myself. In addition to the default settings, I chose:


Preparing phone settings

Group settings of phones are very conveniently done using the End Point Manager.

In the Connectivity - End Point Configuration, you need to select the manufacturer and phone models that we use. Just for starters, you should click on “Check for Updates”, as the project is quite lively and constantly releases new models.

Then in the Connectivity - End Point Advanced Settings you need to set the path to the directory from where tftp distributes files. And now there are several options:

I registered one phone for each model, edited the settings templates, and then when entering each device I indicated its MAC address and selected the model and the template. After this, End Point Manager generated the correct cfgMAC files and put them in a directory for distribution via tftp.

DHCP setup

For the phones to pick up their configs correctly, you need to tell them about it. Here is a piece from the /etc/dhcp/dhcpd.conf file:
 subnet 192.168.xxx.0 netmask 255.255.255.0 { range 192.168.xxx.10 192.168.xxx.240; server-name "192.168.xxx.1"; option domain-name "my.domain"; option domain-name-servers 192.168.xxx.1; option domain-search "my.domain"; option routers 192.168.xxx.1; option nntp-server 192.168.xxx.1; option tftp-server-name "192.168.xxx.1"; next-server 192.168.xxx.1; } 

Pay attention to where there are quotes, and where not. 192.168.xxx.1 - address of the server on which the whole system is spinning.

End of setting

To configure the lines of communication with the outside world is the screen "Connectivity - Trunks". Your SIP providers are also registered there, and, in my case, flow through the OpenVox board.
To describe how incoming calls will be handled, configure the “Connectivity - Inbound Routes”. I have there for the flow indicated what incoming numbers where to send the call (in what format the DID number will be sent check with the operator).
To describe how to handle outgoing calls, use the “Connectivity - Outbound Routes”. Here you can configure, for example, intercity via sipnet, or the choice of an operator based on the dialed prefix.

Additional goodies

FreePBX automatically generates all configuration files, but what to do if you want a strange one? Fortunately, the developers have provided such desires. In every context, macro or subroutine used, there is a mandatory inclusion of the element element -custom element.
Put your own additional chips in the file /etc/asterisk/extensions_custom.conf . I, for example, added this:
 ; Talking clock for Russian [sub-hr24format-custom] exten => ru,1,Playback(at-tone-time-exactly) exten => ru,n,SayUnixTime(${FutureTime},,kM) exten => ru,n,Return() ; Directed FAX [app-fax-custom] exten => 667,1,Set(FAX_FOR_NUM=${CONNECTEDLINE(num)}) exten => 667,n,NoOp(Directed call transfer from ${CALLERID(all)} for ${FAX_FOR_NUM}) exten => 667,n,GoTo(ext-fax,${FAX_FOR_NUM},1) 

With the first block everything is clear, out of the box there is simply no setting for the Russian language of the clock. But the second block may be interesting. By default, the system fax is on number 666 (yes, FreePBX authors clearly consider faxes to be evil). When connecting with this number, the fax is received and sent to the e-mail address indicated in the system as the “system fax recipient” (I have this shared folder in Exchange, but there is usually nothing except spam that gets there). And what to do if the fax in manual mode wants to take our chief accountant Ivan Ivanovich? And he certainly does not want to shine him in a shared folder. I have in the settings of the phone Ivan Ivanovich:
 Fax: Enabled Fax Email: Ivan.Ivanov@my.domain 

And now, if Ivan Ivanovich transfers the call to number 667, then the received fax will be sent to his personal mail. Do not forget to set up GhostScript so that poor Ivan Ivanovich would not suffer trying to open tiff.

findings



Future plans

Put hylafax and send faxes, not just receive.
Put the Phonebook module, make a general office phone book and show not only the number, but also the name of the caller during incoming calls.
Put the TAPI driver and give people the opportunity to call contacts directly from Outlook.

I omitted many of the details that are obvious to me in this article, I will answer questions with pleasure.

Source: https://habr.com/ru/post/158057/


All Articles