📜 ⬆️ ⬇️

FreePBX: the simplest set of customer responsibility

Hello again!

Today I want to talk about such a useful feature as the automatic dialing of a responsible manager. This feature saves a lot of time and, most importantly, your client’s nerves. Well, some more money if you like queues with long greetings.

Imagine - how nice it is to the client. He calls the same number that he called for the first time, but immediately gets on his manager - of course, if he is free. Without greetings, secretaries, waiting in line and other things. The secretary, by the way, will also be easier.
')
Usually this requires a link to your accounting system (CRM) - unless, of course, you have one. It is not easy and expensive (again - usually, I do it for my customers inexpensively :). But what to do if accounting systems, where communications are stored between customer numbers and their responsible ones, are not present, or there are difficulties with the integration of telephony and the accounting system?

Perhaps you will find a simple solution. This is a choice from the CDR (call reports) of the last customer’s call to a short extension number and routing to it. If there is no such call in the database, then the client will fall into the common queue. If the secretary transferred the client to the manager, the manager became responsible. The minus of the system is that the last person who received the call or to which the call was transferred becomes responsible.

In short, the system routes the client to the last person the client spoke to. No dads, moms and loans :)

If this path is yours, then great. By tradition, everything is only in a webmord.


Everything happens on FreePBX 2.11 / Asterisk 11.x. But I am sure that for other versions and / or systems based on Asterisk to do the same is not a problem.

We need a module Smart Routes. The module with html corrected by me can be taken here: yadi.sk/d/UE1dr4kctkNCH
The module looks frightening, but for our task it will fit with minimal changes from the default. Find the module in the new Other menu item and create a new route.

image

The most interesting thing here is the SQL query to the `cdr` table of the` asteriskcdrdb` database, which is most likely available through ODBC. You can look at the name of the ODBC element in the res_odbc_additional.conf file .

The request itself:
SELECT `dst` FROM `cdr` WHERE `src` = '${CALLERID(num)}' AND `disposition` = 'ANSWERED' AND `dst` LIKE '1__' AND `lastapp` = 'DIAL' AND `billsec` > 5 ORDER BY `calldate` DESC LIMIT 1 


He will select one entry where the source is the caller’s number, the destination number starts with “1” and 3 characters long, the call status: answered and the duration of this answer will be more than 5 seconds. Sorting will select the last record by date.

This request will return a specific internal number to the module, for example, 101. But it still needs to be properly routed.
To do this, in the Destinations section, you will have to list all possible options and configure them:

image

We specify the routes by coincidence and in the case of non-response. This is usually a public queue, or a group, or another entry point.
We specify it as Default Destination.

Below, in the Database Settings section, we configure access to MYSQL and database. This is usually ODBC, you need to specify the name of the dsn to access the table. If your CDR works, then it already exists in the system:

image

Or configure access by the “outdated” host, login, password and database name.

It remains to indicate the Smart Routes module and our route to the Inbound Routes, and everything starts working. This setup with verification took me ten times less time than writing this article.

Thank you all for your time! Well, I went to prepare for the sea, not for nothing that I moved in three months ago :)

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


All Articles