📜 ⬆️ ⬇️

Quick voice dialing on Asterisk

There are already several articles on using speech recognition services in asterisk from Google and Yandex on Habré. But you always want to do something of your own and somehow in your own way.

So, I wanted to make a quick voice call of subscribers from the address book. When you work with several dozens of people in an organization, you sometimes forget and confuse internal numbers of subscribers every day (there are not enough speed dialing buttons at all). So you just need to press a button, said “Zina from the third mobile” and Zina from the third on your mobile answers you.

A short video with a demonstration of work:
')


Wrote a small AGI server on node.js. Many implement the logic of AGI in dialplan as running scripts from the agi-bin folder, but you can run the server application on some network port and process requests from asterisk.

In the asterisk dialplan, we need almost one line that will redirect the call progress from the dialplan to our voicer application.

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

At the same time, it should be clearly understood that if the logic of the dialplan formation is transferred from asterisk to AGI, but all the work still happens on asterisk.

Further. Calling to number 1000 (1) we hear a greeting (3), then we pronounce the name, asterisk writes the file (4), the AGI service sends it to Yandex or Google for recognition (5), receives a recognition option, searches for it in its list ( 6), in case of finding a successful option, make a call to the specified number (7).

Voicer work scheme:



How to run a voicer?


A. Install the application

B. Configure the recognition service.

B. Configuring name search (more on that later)
G. Configure dialplan following the example above.
D. Run the application, make a test call.

(Detailed step-by-step installation with commands is given in the readme )

How does a word search work?


The application has a test json file attached, by filling in the matching name and channel, you can get a ready-made file to find matches. The channel in this case is a channel in the understanding of asterisk. For example, SIP / 123 or Local / 8913XXXXXX @ outbound. Those. if opposite “Masha” is SIP / 123, then asterisk connects you to SIP / 123 channel, and opposite “Masha Mobile” will be SIP / 8913XXXYYYYY @ gate, the call will go to the number through the context of gate. Of course, outbound communication must be configured on asterisk in advance.

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

The application includes a search script for mongodb and mysql, you can modify under your address book.

Additionally


Also in the settings you need to specify the directory where the recorded files should be saved, and the directory where to get the files to send them to the recognition service.

It would seem that this is one directory, but this is so while you are running voicer on the same machine as asterisk. If you have asterisk and voicer working on different machines (my case), the recording directory is the directory on the asterisk machine (the AGI server tells asterisk where to write the file with what the subscriber said), and the directory with files for Recognition is the same directory with recorded files mounted to the machine with a working voicer.

-

Application repository on githab I hope someone will benefit from this option for implementing voice speed dialing on asterisk.

Links to used npm in the application: ding-dong (my fork node-agi ) - AGI server with wrappers for AGI-commands, yandex-speech , google-speech - wrappers for voice services of Yandex and Google.

Having the ability to compare speech recognition services, I can note a clearer recognition of names and names by Google. Yandex, for example, poorly distinguished Pakhomov (defined as “Bad”), Vital (“Details”), etc.

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


All Articles