Mod lumenvox

From FreeSWITCH Wiki

Jump to: navigation, search

Contents

Speech Server

Downloading

Go to ftp://Linux7.5:yi08rzgs@LumenVox.com and browse to the appropriate Linux Distro. If on Debian, use the CentOS distribution in order to follow along exactly with this guide. Otherwise, take a wild guess for the closest match.

The speech server file will look something like: LumenVoxSRE-7.5-303.el4.i386.rpm

Installing on Red Hat

Should be as easy as

rpm -i LumenVoxSRE-7.5-303.el4.i386.rpm

Installing on Debian

  • Extracting Contents

You will need the rpm2cpio utility, which apt-get install rpm should include.

$ mkdir /tmp/lv; cd /tmp/lv
$ rpm2cpio LumenVoxSRE-7.5-303.el4.i386.rpm | cpio -idmv
$ mv etc/init.d/lvdaemon /etc/init.d
$ mv opt/* /opt
  • Symlinking libnspr4.so

On debian etch

$ cd /usr/lib
$ ln -s libnspr4.so.0d libnspr4.so

or if you are running an older version of debian and don't have libnspr4.so.0d, try the following:

$ cd /usr/lib
$ ln -s /usr/local/freeswitch/lib/libnspr4.so .
  • Installing Boost Regex

If you dont already have the boost regex library, you may need to install this. Try apt-cache search boost.

  • Hacking start script
    • Comment out the line . /etc/init.d/functions
    • Replace daemon $LV_EXE with $LV_EXE
    • In stop section, replace killproc with ... [INSERT EQUIVALENT]. Maybe try killall LVSRE


Installing on Ubuntu Hardy Heron 8.04

  • Install dependencies
$ sudo apt-get install rpm libspeex1 libxslt1.1
  • Extracting Contents
$ sudo mkdir /tmp/lv; cd /tmp/lv
$ sudo rpm2cpio LumenVoxSRE-7.5-303.el4.i386.rpm | cpio -idmv
$ sudo mv etc/init.d/lvdaemon /etc/init.d
$ sudo mv opt/* /opt
  • Symlinking libnspr4.so

On Ubuntu

$ cd /usr/lib
$ sudo ln -s /usr/local/freeswitch/lib/libnspr4.so .
  • Installing Boost Regex

If you dont already have the boost regex library, you may need to install this.

$ sudo apt-get install libboost-regex1.34.1
  • Hacking start script "/etc/init.d/lvdaemon"
$ sudo nano /etc/init.d/lvdaemon
    • Comment out the line ". /etc/init.d/functions" by prepending a "#" to the line. It should now look like
# . /etc/init.d/functions

    • Replace daemon $LV_EXE with $LV_EXE (around line 38)
    • In stop section, replace killproc with ... [INSERT EQUIVALENT]. Maybe try "killall LVSRE"
      • You may want to test to see if the command is on the system by doing the following at the command prompt:
$ sudo killall LVSRE
      • If the "killall" command is not available then do:
$ sudo apt-get install sysvutils

Starting Speech Server

/etc/init.d/lvdaemon start

Mod_Lumenvox

This is the glue between freeswitch and the Lumenvox speech server.

Building

  • Add asr_tts/mod_lumenvox to modules.conf
  • Modify src/mod/asr_tts/mod_lumenvox/Makefile so that LVENGINE_DIR points to where you installed lumenvox and add LVINCLUDE and LVLIB variables with appropriate values.
LVENGINE_DIR=/opt/lumenvox/engine_7.5
LVINCLUDE=$(LVENGINE_DIR)/include
LVLIB=$(LVENGINE_DIR)/lib
  • Run $ make install

Configuring

  • Build/Enable Mod_spidermonkey and make sure it loads before mod_lumenvox in the modules.conf.xml.
  • Edit modules.conf.xml to include asr_tts/mod_lumenvox
  • Add /opt/lumenvox/engine_7.5/lib to /etc/ld.so.conf and re run ldconfig

The following environment variables must be exported (adapted to your lumenvox version/location)

export LV_LICENSE="/opt/lumenvox/licenseserver_7.5/bin"
export LVSRE_DIR=/opt/lumenvox/engine_7.5/
export LVBIN=$LVSRE_DIR/bin
export LVLIB=$LVSRE_DIR/lib
export LVINCLUDE=$LVSRE_DIR/include
export LVLANG=$LVSRE_DIR/Lang
export LVRESPONSE=$LVSRE_DIR/Lang
export LD_LIBRARY_PATH=$LVLIB:$LD_LIBRARY_PATH
export LD_RUN_PATH=$LVLIB:$LD_RUN_PATH

NOTE that if LVLANG or LVRESPONSE are not defined, the engine will bomb out with a cryptic error what(): basic_string::_S_construct NULL not valid

  • Restart freeswitch
  • Check the output on the console and make sure no errors loading module

Verifying Correct Setup

At this point, even without a license server running, it is possible to verify your setup. There is no point in buying a license until the system is installed and configured correctly.

  • Go to your freeswitch install dir (eg, /usr/local/freeswitch), cd scripts, and copy everything from /usr/src/freeswitch/scripts into this directory recursively
  • Create a script
var dft_min = 100;
var dft_confirm = 600;
session.answer()
console_log("\n\n speech stuff \n\n")
include("js_modules/SpeechTools.jm");
var asr = new SpeechDetect(session, "lumenvox", "127.0.0.1");
var obtainer = new SpeechObtainer(asr, 1, 5000);
obtainer.setGrammar("order", "pizza/order.gram", "result", dft_min, dft_confirm, true);
obtainer.addItem("delivery,size,crust,startover,add_topping,rem_topping");
obtainer.run()
console_log("\n\n done speech stuff \n\n")
  • Map an extension to invoke this script, dial the extension.
  • If all goes well, you should see something like:
2007-05-22 15:53:47 [DEBUG] mod_lumenvox.cpp:59 log_callback() [AppLog:0]Port not opened due to license limitations

License Server

Download/Install

Go to ftp://Linux7.5:yi08rzgs@LumenVox.com and browse to the appropriate Linux Distro.

Download File: LumenVoxLicenseServer-7.5-303.el4.i386.rpm

$ mkdir /tmp/lv; cd /tmp/lv
$ rpm2cpio LumenVoxLicenseServer-7.5-303.el4.i386.rpm | cpio -idmv
$ mv etc/init.d/lumenvoxlm /etc/init.d
$ mv opt/* /opt

Starting License Server

Debian users: Will need to apply same sort of hacks to script as mentioned above, as well as remove the lines that try to touch /var/lock/subsys/./license_server OR create the /var/lock/subsys directory.

/etc/init.d/lumenvoxlm start

Obtaining License Key

The software cannot actually be used for speech decoding until you have a valid license key.

Contact Brian West via email or irc to purchase a license key. Any sales help support the project.

Generating Info.bts file

$ cd /opt/lumenvox/licenseserver_7.5/bin
$ ./getlvsystem_info

NOTE: once you generate this on a particular machine, you will ONLY be able to run the license server on that machine. If you want to test with speech servers on different machines, make sure the machine were you run the license server is accessible to all.

Debian Users: you can give it a shot, but this will probably fail (Debian not officially supported yet) and you will need to contact Lumenvox technical support to generate an Info.bts for you.

Uploading Info.bts

Login to Lumenvox Customer Portal and click License Upload link in your default deployment. Upload the Info.bts file generated in previous step.

Download license

After uploading Info.bts, there will be a new link for the deployment called License Download. Download this file.

Install license

$ cd /opt/lumenvox/licenseserver_7.5/bin
$ ./license_mgr -i /path/to/License123.bts

Should see message:

License server has successfully merged license file 

Additionally, lumenvox will have created a License.bts file in the same directory. To attempt to verify the license was installed, run ./license_mgr -d and you should see the license listed.

Although it is not mentioned in the lumenvox documentation, you may need to copy License.bts into the engine/bin directory. If the license does not seem to be installed, tail all of the .log files when running ./license_mgr -d and look for any errors trying to load the License.bts file, copy the License.bts file to that location.

Configure Speech Engine

By default, the speech engine will look for a license server on 127.0.0.1. However if you have the license server running on another machine, edit /opt/lumenvox/engine_7.5/bin/license_client.conf to connect to that IP.

Testing

First retry the step above: Verifying Correct Setup. Then try the pizza demo

Pizza demo

  • Download the grammar files from here
  • Move extracted pizza directory to scripts directory under freeswitch install (eg, /usr/local/freeswitch/scripts)
  • Convert .ul files to .wav files with
sox Foo.ul -w -s -r 8000 Foo.wav
  • Go to your freeswitch install dir (eg, /usr/local/freeswitch), cd scripts, and copy everything from /usr/src/freeswitch/scripts into this directory recursively
  • Make an extension like
 <extension name="pizza">
   <condition field="destination_number" expression="^2006$">
     <action application="javascript" data="/usr/local/freeswitch/scripts/pizza.js"/>
   </condition>
 </extension>
  • Dial extension

Troubleshooting

Invalid asr module error

If you see

2007-05-22 13:16:10 [ERR] switch_core_asr.c:46 switch_core_asr_open() invalid asr module [lumenvox] 

it means the mod_lumenvox module was not properly loaded. Check the console output after startup.

_S_construct NULL not valid

If you see

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
Aborted (core dumped)

This is Lumenvox's cryptic way of telling you that one or both of the following environment variables were set to invalid locations: LVLANG and LVRESPONSE

To fix it, run the following commands before starting freeswitch:

export LV_LICENSE="/opt/lumenvox/licenseserver_7.5/bin"
export LVSRE_DIR=/opt/lumenvox/engine_7.5/
export LVBIN=$LVSRE_DIR/bin
export LVLIB=$LVSRE_DIR/lib
export LVINCLUDE=$LVSRE_DIR/include
export LVLANG=$LVSRE_DIR/Lang
export LVRESPONSE=$LVSRE_DIR/Lang
export LD_LIBRARY_PATH=$LVLIB:$LD_LIBRARY_PATH
export LD_RUN_PATH=$LVLIB:$LD_RUN_PATH

undefined symbol: PR_LocalTimeParameters

2007-05-24 15:03:39 [ERR] switch_loadable_module.c:704 switch_loadable_module_load_file() 
Error Loading module /usr/local/freeswitch/mod/mod_lumenvox.so
**../lib/libjs.so: undefined symbol: PR_LocalTimeParameters**

Problem Description

  • mod_lumenvox links against the freeswitch version of libjs.so (javascript library)
  • when the mod_lumenvox module is loaded, libjs.so has not been loaded yet
  • the loading fails

Workaround

Build/Enable Mod_spidermonkey and make sure it loads before mod_lumenvox in the modules.conf.xml.

If you can figure out how to tweak the mod_lumenvox/Makefile so that it links against the version of libjs.so that ships with lumenvox, please post it here.

Unable to install license

You try to use the license_mgr utility to install/merge a license and get the error:

License server failed to merge license file, see log message

Solution: if you are using Debian or any other distribution not officially supported by Lumenvox, then this is pretty much an expected event. Try contacting Lumenvox and asking them to generate an Info.bts on your behalf.

Segmentation fault

If you run one of the example scripts from this page and see the following on the console:

2007-06-12 00:22:38 [DEBUG] mod_lumenvox.cpp:257 lumenvox_asr_open() Port Opened 2 8000khz.
2007-06-12 00:22:38 [DEBUG] mod_lumenvox.cpp:132 state_change_callback() State: [READY] total bytes: [0] recorded bytes: [0]
Segmentation fault (core dumped)

with a backtrace:

#0  0xb24b3abd in std::ostream::flush () from /usr/lib/libstdc++.so.6
#1  0xb24975c5 in std::istream::sentry::sentry () from /usr/lib/libstdc++.so.6
#2  0xb249893b in std::istream::get () from /usr/lib/libstdc++.so.6
#3  0xb22317e2 in srgsFlexLexer::LexerInput ()
   from /opt/lumenvox/engine_7.5/lib/liblv_lvspeechgrammar.so
#4  0xb2230ed0 in srgsFlexLexer::yy_get_next_buffer ()
   from /opt/lumenvox/engine_7.5/lib/liblv_lvspeechgrammar.so
#5  0xb2237ebf in SRGS_LEXER::yylex ()
   from /opt/lumenvox/engine_7.5/lib/liblv_lvspeechgrammar.so
#6  0xb2231774 in SRGS_PARSER::yylex ()
   from /opt/lumenvox/engine_7.5/lib/liblv_lvspeechgrammar.so
#7  0xb2231eda in SRGSBISON::yyparse ()
etc..

then you should contact Lumenvox tech support and report the problem. The above error happened with Lumenvox 7.5 on Debian Sarge (which is officially unsupported by Lumenvox), though your mileage may vary. There is no known fix.

Personal tools