As a manager of a PBX with GSM and call recordings he did

Today, in the era of high technology and impeccable customer service, everyone wants to be on par. Many companies, regardless of rank and size, are constantly trying to make communication with the client more convenient and enjoyable. In our internet agency, the head of which I am, one of these “amenities” was the commissioning of a small mini-automatic telephone exchange based on Openvox and Asterisk, assembled by ourselves. But let's take it in order:

Problem


Phone - is one of the main channels of communication with customers in our work. There are a lot of calls that need to be processed per day. We refused to use the analog line right away, due to the greed and unreliability of local providers. Yes, and now analog technologies are outdated. The decision to use GSM was unanimous and unshakable. In the first few years of work, such an unkillable device was responsible for receiving calls:

Nokia C2-00


Initially, I and my partner took calls in turn, being in different corners of the same office. When a client called and listened to several signals of a soulless buzzer and asked to connect with someone, then with high probability he could hear the whistle of the wind that created this Finnish device, flying from one corner of the office to another. “Multichannel” was realized due to the presence of two SIM card slots in this phone. There was no talk of recording conversations, there was no voice greeting or menu, the method of transferring calls from one specialist to another was described above. Solid minuses, in general, and most importantly, the person who called us from the first minutes might have thought that he was calling another Sharashkin office from one and a half freelancers. Which was rather disappointing, because we did our work well, with guarantees and soul.

Having suffered a lot, one fine day I said the loud “Enough!” And the equally loud “We need to do something!”

Task


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

  • At least 3 GSM lines;
  • Head greetings;
  • Music instead of beeps;
  • Call hold;
  • Call transfer;
  • At least three independent tubes, expandable;
  • Flexible call forwarding settings;
  • Recording conversations;
  • AND HE;
  • List of contacts;
  • Minimum wires;
  • Compact equipment dimensions.

Solution selection


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: I called all the companies in the city that could install and configure PBXs. There were "a great many companies", namely one (oh, these regions), which said that if I multiply our budget by 4, I get an amount that would be enough for them to make all our Wishlist. I did not want to multiply by 4, so we move on to plan “B” - a cloud-based PBX. Fortunately, now there are many similar services with any functionality and to any wallet. But one thing confuses - the complete dependence of communication on the service: there is no Internet - there is no connection, on the service of those. work - no connection, not paid on time subscriber. fee - no connection. And a 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. The third option remained - “crutch-bicycle”. Well, more hemorrhoids, for that’s interesting. He stopped on it.

Selection and purchase of equipment and software


Since the budget is small, and I am a fan of all sorts of Linux and open source. Therefore, I immediately decided on the software - Asterisk as a telephony server. I used Ubuntu as the OS. Everything is not so simple with the equipment, after a little reflection and translating a bunch of paper, I concocted such a scheme:

telephony scheme

The main elements here are:

  • The server on which Asterisk is installed
  • GSM gateway
  • base of cordless handsets;
  • router, as a link;
  • handsets.

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

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

  • GSM Gateway OpenVox VoxStack VS-GW1202-4G - 16 932 rubles ;
  • Base and 1 tube Yealink W52P - 4,828 rubles ;
  • Two additional tubes Yealink W52H - 3 175 rubles .

I cross off three items from the list of equipment, the remaining two can be safely obtained at any computer store in our town. Yes, and a good reason to take a little walk:

  • As a server: Nettop DNS Porto 0166749 [Intel i5-3337U, 2x1800 MHz, 4096 MB, HDD 500 GB] - 11 500 rubles ;
  • Home router Zyxel Keenetic 4G II - 1,500 rubles .

Total: 37,921 rubles.
Well, very good, there is still ice cream left.
Note author: It was in the fall of 2014, so the prices are slightly lower than now.

Receiving and assembling equipment


Two weeks of excruciating waiting passed and the messed up courier handed me the long-awaited package. Content:

OpenVox VoxStack VS-GW1202-4G

The gateway is a small block (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 purchasing another board that is inserted next to it. The gateway is connected to the local network using a standard twisted pair cable and to the electric network using a power adapter.

GSM Gateway OpenVox VoxStack VS-GW1202-4G

Base and tube Yealink W52P

Compact wireless base and three handsets. Each handset 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, one more base is simply bought up. The signal is powerful, good reception through a brick wall. There is no need to complain about the quality of communication.

Base and tube Yealink W52P


Nettop DNS Porto 0166749

The compact computer acts as a server. The size of the device is comparable to the aforementioned OpenVox. The characteristics are sufficient for the uninterrupted operation of telephony and the storage of call records for several months. And his name, by the way, is Artem.

Nettop DNS Porto 0166749

We put everything together in accordance with the approved scheme and install the Ubuntu OS:

Side PBX

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

Installation and setup



Initially install Asterisk itself and the GUI to it. A step-by-step manual on how to achieve this: http://wiki.enchtex.info/howto/asterisk/asterisk-ubuntu-10.04 . Why not freePBX? All felt-tip pens are different in taste and color, the article is aimed at beginners, but it seemed to me that the GUI from Digium is easier to install and operate, in other words, this is purely my opinion.

Now you need to "make friends" of OpenVox and Asterisk. This is easy enough to do. First, log in to the Asterisk web GUI (default: localhost : 8088), 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)
Profile Username: come up with a username
Password: come up with a password

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


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

Name - think of the name
User Name - the name of the user who invented earlier
Password - the password that invented earlier
Registration - This gateway registers with the endpoint

SIP -> SIP endpoints -> Add New SIp Endpoint

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

Now 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 - select the
Send Call Through trunk - select the openvox port.

For incoming calls everything is configured in the same way, the only item that may cause difficulties is the Forward Number parameter for the rules, here you need to write Extension on the asterisk side which will go the bell.

We continue to configure the Asterisk GUI, create users and rules for calls, here is a small manual on how to do it: http://invoip.net/2011/11/vvedenie-v-asterisk-gui/

After the initial setup of Asterisk and Openvox you need to set up the handset database, it also has a web interface, and the setup boils down to mapping Asterisk users to telephones. Now you can make and receive calls. It is time to do something more interesting.

We fasten various "whistles"


One of the most interesting Asterisk files is “extensions.conf”, it makes the bulk of settings. Using the GUI, create a voice menu and transfer all incoming calls to it, 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, calling us hears a voice greeting, in which he tells where he got. The greeting recording itself can be done either independently or by contacting a specialized company, where a professional announcer will record it with his voice, apply music and other sound effects. We drive into Google the “voice greeting record” and select what we liked. On average, one entry costs from 1,000 to 5,000 rubles. You will receive the recording in mp3 format, which is not very willing to work with Asterisk without dancing with a tambourine. 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


Put the resulting file in the “asterisk / sounds” folder and return to the menu editing. Initially, we need to pick up the phone and play the greeting, then connect to the right 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 move the path to the welcome file (only the file name, without the extension). In “Dial” we transfer 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 waiting music). You can find out about the rest of the “Dial” parameters here .

Call recording

After the voice greeting has started working and editing “extensions.conf” does not cause any difficulties, we will tighten the recording of conversations. Suppose that all entries are added to the directory broken down by year, month and day, and the name of the entry file contains the date, time and number of the caller. Sounds complicated? 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)}
....


Multichannel and call forwarding

In ovenvox, I inserted three SIM cards, two of them have numbers that you can make a call to, the third card is a backup. At the operator level, I set up forwarding from the first to the second, from the second to the third from the third back to the first. Thus, three complete lines for the call turned out. 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 larger, you can increase the number of SIM cards to 8 and set up the call queue.

Now let's build the logic in this way: the first client rings, the manager picks up phone number 1, the second incoming call happens right away, phone number 2 should ring, which the second manager will use. The third client will be connected to the third manager. To implement 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 solution is banal: we select the most responsible manager and write down his mobile phone number. Edit "extensions.conf" this way:

...
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 no one picked up the phone within 20 seconds, the call will be transferred to the specified mobile phone. On the client’s side, this will look like a slightly longer response time. You can go further and make redirects 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, they can always be improved. For example, a contact list can be loaded in an xml file from a CRM system.

Completion of work


Having assembled, tuned and checked everything, I enjoyed the work done. It remains all these boxes and wires, carefully removed somewhere out of sight, for example, in a large iron box:

Installation of mini-automatic telephone exchanges

Later it turned out that sticking the cordless handset base into a tin box is not a good idea, so they took it out a few days later and stuck it to the side.

conclusions


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

Also popular now: