I was looking for the information about the integration of with asterisk for a while, but due to various reasons, I haven’t had success to configure asterisk with .

I tried a lot to integrate Asterisk with voice recognition system but really I had a very hard time to configure sphinx2 in an appropriate way. There are lots of versions, but as for my experience the newer versions of (sphinx3 & sphinx4) will not work with Asterisk due to high audio conversion module frequency.

Below are the instructions on getting installed and running, it should work on any Linux distribution.

version 0.6 from

http://sourceforge.net/project/showfiles.php?group_id=1904

Untar it

# tar zxvf sphinx2-0.6.tar.gz

# cd sphinx2-0.6

# ./configure –prefix=/usr/local/

# make

# make install

This will install into /usr/local/

Now install the perl modules for

Download from

http://search.cpan.org/CPAN/authors/id/D/DJ/DJHD/-0.0801.tar.gz

# tar zxvf -0.0801.tar.gz

# cd -0.0801

# perl Makefile.PL –-prefix=/usr/local/

# make

# make install UNINSTALL=1

This should install the perl module. (You can also use “cpan” command to

install, and search for perl modules)

We will now install a simple dictionary with (YES, NO, ACCEPT, and

CANCEL)

Get the dictionary from

http://turnkey-solution.com/confirm.tgz

Install it

# cd /usr/local//share/sphinx2/model/lm/

# tar zxvf /usr/src/confirm.tgz

Now we need to replace the acoustic model.

Download

http://www.speech.cs.cmu.edu//models/hmm/communicator-2000-11-17-2.tgz

# cd /tmp

# tar zxvf /usr/src/communicator-2000-11-17-2.tgz

# cd communicator-2000-11-17-2/

# mv sphinx_2_format /usr/local//share/sphinx2/model/hmm/communicator

Thats done

Download Agi, client and server file:

# wget http://www.syednetworks.com/asterisk-sphinx.rar

Now use the downloaded files and save sc_client and sr_server

in /usr/local/bin and the agi file into /var/lib/asterisk/agi

Make sure turn them into executables by using “chmod +x filename”

command.

You will also need to install perl module Asterisk::AGI download and

install it with cpan or as done above.

Now start the server in one terminal

#/usr/local/bin/sr_server &

Now for testing you should record small phrases in “YES”, “NO”, “ACCEP”,

CANCEL, in small wave files (make sure use 8k bit rate, mono and 16

bits). You can use audacity for that.

Test the client

$ /usr/local/bin/sr_client accept.wav

Result: ACCEPT

$ /usr/local/bin/sr_client no.wav

Result: NO

$ /usr/local/bin/sr_client yes.wav

Result: YES

Now make an extension

exten => 300,1,AGI(sphinx_test.agi);
exten => 300,2,Hangup

Look at the asterisk console output while calling the extension, it will complain about some IVR files, make sure you put them in place. ANd then speak the simple phrases like above.


Tags: , , , ,

Related posts