Hello again! IVR - today it is not even a chip, but a certain standard of work of the enterprise. In some cases, many, both customers and competitors, believe that if this IVR itself is not there, then “there” is a low quality of the services provided. This thing today will surprise no one. However, we are talking about the implementation of IVR in the lua language under Asterisk. And if you move from a regular recruitment plan to Lua, then something can be explained here.
Suppose that you already have the necessary files for the menu and they are in the right folder. It is possible that they were even used on the old config. Then, when describing the voice menu on Lua, we do (I did) like this:
We describe somewhere in the beginning of the file a table with files. Everything is more convenient in one place if necessary to change:
')
mhold = { m_hello = "custom/message_01";
Thus, you have described the fields in the plate with the indication of the files used. In my case - files with a greeting, some thankful words and a menu selection. There was also a backup (just in case) option in which each menu was split into its own file ...
Further, in the first article I specified the call ivr () in the foo () function in the description of incoming calls. So, in fact, in my example it worked like this:
Event - Incoming call. Call foo (). Check some conditions -> play greeting -> call ivr (). I lost the greeting myself before calling ivr ().
function ivr(d) app.noop(" .") app.noop("DID: "..d) app.background(mhold.m_menu,"","","menu") app.waitexten(3) return end
Not such a feature feature. app.background here is a call from the asterisk core of the voice menu. But you also need to make a description of the menu event in the extensions:
menu = { ["1"] = function(c,e) app.noop("Calling from menu by 1") app.playback(mhold.m_thx) CallSKS()
At the same time, in the description of incoming calls from_trunk, you need to add timeout processing, otherwise, if the client did not make a choice within the required time, the client will hear short beeps, and in the aster console you will see a code execution error.
from_trunk = { t = function() app.playback(mhold.m_thx) app.goto("local_ext","7090",1) end;
About IVR everything seems to be. Now one more thing: call time limit. Yes, unfortunately I had to do that. There were individual shots in the company who loved by long-distance just dozens of minutes, and for a month they spent hours chatting with friends, girlfriends, brothers, etc. Of course, these were punished with a ruble, but the position of the leadership was such that it was necessary to work at work. Asked to limit the talkers in time. The following example will show how to do this globally, with a sample of the direction (although perhaps not the best option).
In this case, I did a sample by the number of characters in the dialed number. If the number of characters exceeds the number of characters of our city, excluding the code of our city, then this is a call by intercity. Cellular local ones are processed separately, therefore they do not fall under this rule (in the last article about DEF codes). But cellular intercity - hit. In my example, there is a limit of 10 minutes. for 7 (or 8?) minutes, the subscriber hears a light beep. In this function, you can add processing only specific "villains." Can these villains
put in the table and look at it already, but you can pull out the mysql database and the data from there, as it is convenient for anyone ...
Everything. Goodbye everyone!