Speech Recognition IVR with Pocketsphinx

Status
Not open for further replies.

KonradSC

Active Member
Mar 10, 2017
166
98
28
Hey Everybody,

I played around voice enabling IVR's using mod_pocketsphinx. It seems to work pretty well however pocketsphinx's error rate is still pretty high. For instance, it often thought I said "six" instead of "two". Because of this I limited to the words in the grammar file to "zero, one, two, three, four". To get this working I took the old lua based IVR from Mark and added some logic for pocketsphinx. That made it so I could create an IVR in the web interface, then disable IVR, and make dialplan action to call the custom lua script.

Disclaimer: I have no idea of the performance cost. There are most likely bugs. Don't put this in production without testing!

Here are my notes:



Install mod_pocketsphinx:

apt-get install freeswitch-mod-pocketsphinx

Install wsj model for g722 calls:

http://www.speech.cs.cmu.edu/sphinx/models/wsj_jan2008/wsj_all_sc_5000_20080401.tar.gz

Extract to /usr/share/freeswitch/grammar/model/wsj1

chown -R www-data:www-data /usr/share/freeswitch/grammar/model/wsj1

Add the grammar file:

/usr/share/freeswitch/grammar/auto_attendant_basic.gram

Code:
#JSGF V1.0;

/**
  * JSGF Grammar for basic auto attendant
  */

grammar aa_basic;

<one> =  [ one ];
<two> =  [ two ];
<three> =  [ three ];
<four> =  [ four ];
<zero> =  [ zero ];

public <aa_basic> = <one> <two> <three> <four> <zero>;

Add lua script:
ivr_menu_asr.lua
chown www-data:www-data /usr/share/freeswitch/scripts/ivr_menu_asr.lua

Restart freeswitch

Create an IVR then disable it.

Get the UUID of the IVR

Create a new dialplan step:

Code:
<condition field="destination_number" expression="^007$">
    <action application="set" data="ivr_menu_uuid=YourIvrUuidGoesHere" inline="true"/>
    <action application="answer" data=""/>
    <action application="lua" data="ivr_menu_asr.lua"/>
</condition>
 

Attachments

  • ivr_menu_asr.lua
    20 KB · Views: 55

dangtuquy

New Member
Mar 10, 2021
1
0
1
33
A very helpful guideline for me to start with speech recognition in FreeSwitch. I think the main point that we need a good model, btw thank you so much for your post!
 
Status
Not open for further replies.