Home Java Fast voice dialing in Asterisk

Fast voice dialing in Asterisk

by admin

There are already several articles on the use of speech recognition services in asterisk from Google and Yandex on the Hubra. But you always want to do something of your own in your own way.
So, I wanted to make a quick voice call to subscribers from the address book. When you work with several dozen people in the organization, every day sometimes you forget and confuse the internal numbers of subscribers (and there are not enough speed dial buttons for everyone). So you just need to push the button, said "Zina from the third mobile" and you answer Zina from the third on his mobile.
A short video demonstration of the work :
Wrote a small AGI server in node.js. Many people implement the logic of AGI in the dialplan as running scripts from the agi-bin folder, but you can run a server application on some network port and handle requests from asterisk.
In the asterisk dialplan we need practically one line which will redirect the call control from the dialplan to our voicer application.

//extensions.conf[default]exten => 1000, 1, AGI(agi://192.168.2.1:3000/)

In this case, you should clearly understand that if the logic is transferred from asterisk to AGI, but all work is still done on the asterisk.
Next. Calling 1000 (1), we hear the greeting (3), then we say a name, asterisk records a file(4), AGI-service sends it to Yandex or Google for recognition(5), gets a variant of recognition, looking for it in his list (6), in case of a successful variant makes a call to the specified number (7).
Voicer operating scheme:
Fast voice dialing in Asterisk

How do I start a voicer in my house?

A. Installing the application

  • Copy the repository and install the dependencies

B. Setting up the recognition service

V. Set up a name lookup (more on this later)
G. Setting up the dial plan by following the example above
d. Launch the application, make a test call.
(For a detailed step-by-step installation with commands, see readme )

How does a word search work?

In the appendix there is a test json-file attached, by filling in the matching name and channel you can get a ready file to search for matches. The channel in this case is a channel in asterisk sense. For example, SIP/123 or Local/8913XXXXXX@outbound. That is, if "Masha" is SIP/123, asterisk will connect to channel SIP/123 and "Masha mobile" is SIP/8913XXXXYYY@gate, the call will go to number through gate context. Of course, the outgoing communication should be configured on the asterisk beforehand.
File example :

[{"name": "Vasily", "channel": "SIP/Sf12345678"}, {"name": "Vasily Mobile", "channel": "Local/8913XXXXXXX@outbound"}]

Attached mongodb and mysql search scripts, you can modify to fit your address book.

More

Also in the settings, you need to specify the directory where the recorded files should be saved and the directory where to take the files to send them to the recognition service.
It would seem to be the same directory, but that’s as long as you run voicer on the same machine that you have asterisk running. If you have asterisk and voicer running on different machines (my case), the directory for recording is the directory on the machine with asterisk (AGI-server tells asterisk where to write the file with what the caller said) and the directory with files for recognition is the same directory with recorded files mounted to the machine with the running voicer.

Application repository on githab I hope someone will find this implementation of voice speed dial on asterisk useful.
Links to the npm used in the appendix : ding-dong (my fork node-agi ) – AGI server with wrappers on AGI commands, yandex-speech , google-speech – Wraps on Yandex and Google voice services.
Having the opportunity to compare speech recognition services, I can note the clearer recognition of names and surnames by Google. Yandex, for example, badly distinguished Pakhomov (defined as "Bad"), Vitalia ("Details"), etc.

You may also like