Skip to content

akscf/mod_whisper_asr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 

Repository files navigation

Provides offline speech recognition features for the Freeswitch based on whisper_cpp.

version 1.0

Was capable to work with the first versions of whisper_cpp (not longer supported)

version 1.1_12062024

Capable to work with the latest version whisper_cpp (revelant on the date: 12.06.2024)
Before compile the module, you should build the whisper_cpp as a shared library and (possible) correct it's paths in the Makefile.
The issues: unfortunately i don't have enough time (now) to deeply dig what is going on, mb it's my mistake somewhere there.
But have the follogin (although the same time the whisperd works well):

2024-06-12 07:34:38.686528 99.73% [NOTICE] utils.c:115 transcribe samples=31360
terminate called after throwing an instance of 'std::length_error'
  what():  cannot create std::vector larger than max_size()
  Aborted (core dumped) ./bin/freeswitch -nf -nonat -nonatmap -nort

Usage example

<extension name="asr-tets">
 <condition field="destination_number" expression="^(3222)$">
    <action application="answer"/>
    <action application="sleep" data="1000"/>
    <action application="play_and_detect_speech" data="/tmp/test2.wav detect:whisper {lang=en}"/>
    <action application="log" data="CRIT SPEECH_RESULT=${detect_speech_result}"/>
    <action application="sleep" data="1000"/>
    <action application="hangup"/>
 </condition>
</extension>
# using freeswitch packages
apt update ; apt install libfreeswitch-dev libfreeswitch1 libfreeswitch1-dbg
cd mod_whisper_asr/sources
git clone https://github.com/ggerganov/whisper.cpp.git whisper
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j
make install