📜 ⬆️ ⬇️

As a mini PBX manager with GSM and call recordings did

Today, in the era of high technology and impeccable customer service, everyone wants to be on a level. Many companies, regardless of rank and size, constantly try to make communication with the client more convenient and more pleasant. In our intern agency, the manager, whom I am, one of such "amenities" was the commissioning of a small mini-PBX based on Openvox and Asterisk, assembled by hand. But let's order:

Problem


Telephone - is one of the main channels of communication with customers in our work. During the day there are many calls that need to be processed. We refused to use the analog line immediately, due to the greed and unreliability of local providers. Yes, and now obsolete analog technology. The decision to use GSM-communication was unanimous and unshakable. In the first few years of work for the reception of calls, this was the answer to such an unkillable device:

Nokia C2-00

')
Initially, calls were received by me and my partner in the queue, being in different corners of the same office. When a client called and listened to several signals of a soulless buzzer, he asked to connect with someone, then with high probability he could hear the wind whistling that created this Finnish device, flying from one corner of the office to another. “Multi-channel” was implemented due to the presence of two SIM-card slots in this phone. There was no talk about recording conversations, there was no voice greeting and menu, the method of transferring calls from one specialist to another was described above. Solid minuses, in general, and most importantly, that the person who called us from the first minutes would have thought that another sharashkin office was calling from one and a half freelancers. That was quite a shame, because we did our work well, with guarantees and soul.

Having had enough to suffer, one fine day I said a loud “Enough!” And no less loud “We need to do something!”

Task


It is necessary to make such a “piece”, which will solve all our problems, which will replace the old Nokia. This "thing" should be able to do the following:


Selection of solutions


To solve the problem, a budget of no less than 40,000 rubles of the Russian Federation was allocated. First of all, I chose the most trivial way, namely: phoned all the companies in the city that could install and configure the mini-PBX. The companies turned out to be “a great many”, namely one (oh, these regions), which said that if I multiply our budget by 4, then we get an amount that will be enough for them to do all our Wish list. I didn’t want to multiply by 4, so go to plan “B” - a cloud PBX. Fortunately, now there are many similar services with any functionality and for any wallet. But one thing confuses — the complete dependence of communication on service: there is no Internet — there is no connection, on the service of those. work - no connection, not on time paid subs. fee - no connection. Yes, and the service can at any time increase the cost of its services or not return data (call records, for example). This option also did not suit me. There was a third option - “bicycle-bicycle”. Well, hemorrhoids more interesting for that. On it and stopped.

Selection and purchase of equipment and software


Since the budget is small, and I'm a fan of all sorts of Linux and open source. Therefore, I immediately decided on the software - Asterisk as a telephony server. As the OS used Ubuntu. It's not so simple with the equipment, after a little thought and having transferred a bunch of paper, I concocted such a scheme:

telephony scheme

The main elements here are:


Everything works as follows: A call arrives at the gateway, it receives the call and sends it to the server using a twisted pair and router. The server “picks up the phone”, plays a greeting, throws a call to the standby mode and communicates with the base of the handsets. The base selects the desired handset and makes it ring. When the manager takes a call, the server connects the client and the manager.

I go to the nearest online store and put the following items in the basket:


I delete three items from the list of equipment, the remaining two can be easily obtained at any computer store in our town. And a good reason to walk a bit:


Total: 37921 rubles
Well, very well, even on the ice cream left.
Note author: It was in the fall of 2014, so prices are slightly lower than now.

Receipt and assembly of equipment


Two weeks of agonizing wait passed, and the curious courier handed me a long-awaited package. Content:

OpenVox VoxStack VS-GW1202-4G

The gateway is a small unit (about the size of a standard DVD drive) and a board that fits inside. This model of the gateway supports 4 SIM cards, but can be expanded to eight by buying another board, which is inserted side by side. The gateway connects to the local network with a normal twisted pair and into an electrical network using a power adapter.

GSM Gateway OpenVox VoxStack VS-GW1202-4G

Yealink W52P base and tubes

Compact wireless base and three handsets. Each tube is equipped with a charging station, has a color display and a belt clip. Everything looks pretty neat. The base is designed for a maximum of 5 phones. In case of further expansion, another database will be purchased. Signal powerful, good reception through the brick wall. There is no need to complain about the quality of communication either.

Yealink W52P base and tubes


Nettop DNS Porto 0166749

A compact computer acts as a server. The size of the device is comparable to the above-mentioned OpenVox. Characteristics are sufficient for uninterrupted telephony and keeping records of conversations for several months. And his name is, by the way, Artem.

Nettop DNS Porto 0166749

Putting it all together in accordance with the approved scheme and installing the Ubuntu OS:

Fast PBX

Now everything is ready to go to the most interesting step: setting up our server.

Installation and Setup



Initially install Asterisk itself and the GUI to it. Step-by-step manual how to achieve this: http://wiki.enchtex.info/howto/asterisk/asterisk-ubuntu-10.04 . Why not freePBX? The taste and color of all the markers are different, the article is aimed at beginners, but it seemed to me that the Digium GUI is easier to install and use, in other matters, this is purely my opinion.

Now we need to make friends with OpenVox and Asterisk. Make it simple enough. First, we enter the Asterisk web GUI (by default: localhost : 8088), we will enter the login and password specified during installation. Without hesitation, we go along the path: Trunks -> VOIP Trunks -> New SIP / IAX Trunk and specify the following settings:

Type: sip
Context Naming: Based on Username
Provider Name: openvox
Hostname: openvox address (default: 172.16.99.1)
Username: create a username
Password: we invent a password

Trunks -> VOIP Trunks -> New SIP / IAX Trunkmage


Further we follow the address openvox (by default: 172.16.99.1, default login and password is admin: admin) and we see the control panel. Click SIP -> SIP endpoints -> Add New SIp Endpoint:

Name - think up a name
User Name - the username that was invented earlier
Password - the password that was invented earlier
Registration - this gateway registers with the endpoint

SIP -> SIP endpoints -> Add New SIp Endpoint

Go to ADVANCED -> Asterisk CLI and write the sip show registry, if successful, we will see "1 SIP registrations", which means that everything works.

Now we will configure the rules for incoming and outgoing calls in ROUTING -> Call Routing Rules -> New Call Routing Rule.

Outgoing:

Routing Name - the name of the route (let it be “out-route”)
Call Comes in From - choose a trunk
Send Call Through - select the openvox port

For incoming calls, everything is configured in a similar way; the only item that can cause difficulties is the “Forward Number” parameter for the rules, here you need to write an Extension on the asterisk side to which the call will go.

Let's continue with the Asterisk GUI setup, create users and rules for calls, here’s a small manual how to do it: http://invoip.net/2011/11/vvedenie-v-asterisk-gui/

After the initial configuration of Asterisk and Openvox is made, you need to configure the base of the handsets, it also has a web interface, and the configuration is reduced to the comparison of Asterisk users and telephone sets. Now you can make and receive calls. It is time to do something more interesting.

We fasten various kinds of "whistles"


One of the most interesting Asterisk files is “extensions.conf”, where most of the settings are made. Through the GUI, we will create a voice menu and translate all incoming calls to it, let's call it “voicemenu-custom-1”. After that, you can set various parameters of that menu using either the built-in GUI editor, or by opening the extensions.conf file in any text editor.

Voice greeting

Initially, it was thought that the client, having called us, heard a voice greeting in which he was informed where he had got. The recording of the greeting itself can be done both independently and by contacting a specialized company, where a professional announcer will record it with his voice, impose music and other sound effects. We drive in Google "voice greeting recording" and choose what you like. On average, one record costs from 1000 to 5000 rubles. You will receive the recording in mp3 format, which is not very willing to work with Asterisk without dancing with a tambourine. Let's convert the file to a format convenient for Asterisk:

sudo apt-get install sox lame lame --decode musicfile.mp3 musicfile.wav sox -V musicfile.wav -r 8000 -c 1 -t ul hello.ulaw 


The resulting file, put in the folder "asterisk / sounds" and go back to editing the menu. Initially, we need to pick up the phone and lose the greeting, then connect with the desired user:

 exten=s,1,Answer() exten=s,2,Background(/var/lib/asterisk/sounds/hello) exten=s,3,Dial(SIP/500,30,tm) 


In “Background” we overeat the path to the greeting file (only the file name, without the extension). In “Dial” we give the Asterisk user ID, the time in seconds that is needed to play the greeting and two parameters “t” (allows the answering user to transfer the call) and “m” (play standby music). About the rest of the parameters "Dial" can be found here .

Conversation recording

After the voice greeting has started and editing “extensions.conf” is easy, we can add a recording of conversations. Let all records be added to directories divided by years, months and days, and the name of the record file contains the date, time and number of the caller. Sounds hard? And it is done simply:

 ... exten=s,n,Set(fname=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)}_${CALLERID(number)}_in) exten=s,n,MixMonitor(    /${STRFTIME(${EPOCH},,%Y)}/${STRFTIME(${EPOCH},,%m)} .... 


Multi-channel and redirection

In ovenvox, I inserted three SIM cards, to two of them are attached numbers to which you can make a call, the third card is reserved. At the operator level, set up call forwarding from the first to the second, from the second to the third, from the third back to the first. Thus, we got three full lines for the call. I want to emphasize that the flow of calls in my company is large, but not so much that three people would call at the same time, so this scheme is acceptable to me. If the flow becomes more, you can increase the number of SIM cards to 8 and set up a queue of calls.

Now we will build the logic in this way: the first client calls, the manager picks up the telephone number 1, the second incoming call immediately occurs, the telephone number 2 should ring, which the second manager will use. The third client will be connected with the third manager. To realize this, you can use the “GotoIf” condition:

 ... exten=s,n,Dial(SIP/500,30,tm) exten=s,n,GotoIf($[${DIALSTATUS}=BUSY]?ZANAT,1) exten=ZANAT,1,Dial(SIP/501,30,tm) exten=ZANAT,2,GotoIf($[${DIALSTATUS}=BUSY]?ZANAT1,1) exten=ZANAT1,1,Dial(SIP/502,30,tm) exten=ZANAT1,2,GotoIf($[${DIALSTATUS}=BUSY]?ZANAT2,1) exten=ZANAT2,1,Dial(SIP/500,30,tm) ... 

But what happens if no one picks up the phone? Suppose everyone left for lunch or the call arrived on a day off. The exit is banal: we select the most responsible manager and write down his mobile phone number. We rule "extensions.conf" as follows:

 ... exten=s,n,Dial(SIP/500,30,tm) exten=s,n,GotoIf($[${DIALSTATUS}=BUSY]?ZANAT,1) exten=s,n,Dial(SIP/8914XXXXXXX@openvox,20,tm) ... 

Now, if nobody picked up the phone within 20 seconds, the call will be transferred to the specified mobile phone. From the client’s side, this will look like a slightly increased response time. You can go ahead and make forwarding after hours without waiting, but I will not consider this case.

Transfer, caller ID, contact list

All these functions are supported by default and work well enough to satisfy the needs of my company, but if you want, you can always improve them. For example, the list of contacts can be uploaded in the xml file from the CRM system.

Completion of work


Having collected everything, setting it up and checking it out, I enjoyed a lot of the work done. It remains all these boxes and wires, gently remove somewhere out of sight, for example in a large iron box:

Installation of PBX

Later it turned out that putting the base of the cordless tubes into the tin box was not the best idea, so after a couple of days they took it out and stuck it to the side.

findings


About 4 months have passed since the events described. During this time, minor deficiencies were eliminated and everything works clearly and without failures. Without taking into account the time of delivery of the glands, all the work took about 5 days of time. As a result, customers and managers are satisfied, calls are being written, voice greetings are played, music in the handsets is heard, the level of service is growing. Thank you all for your attention, I hope that my story was useful and interesting.

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


All Articles