Asterisk integration with Sphinx Voice recognition system

 

I was looking for the information about the integration of Sphinx 4 with asterisk for a while, but due to various reasons, I haven't had success to configure asterisk with Sphinx. I tried a lot to integrate Asterisk with Sphinx voice recognition system but really I had a very hard time to configure sphinx2 in an appropriate way. There are lots of Sphinx versions, but as for my experience the newer versions of Sphinx (sphinx3 & sphinx4) will not work with Asterisk due to high Sphinx audio conversion module frequency.

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

Download sphinx2 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/sphinx

# make

# make install

This will install sphinx into /usr/local/sphinx

Now install the perl modules for Sphinx

Download Speech-Recognizer-SPX from

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

# tar zxvf Speech-Recognizer-SPX-0.0801.tar.gz

# cd Speech-Recognizer-SPX-0.0801

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

# 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/sphinx/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/sphinx/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/sphinx/share/sphinx2/model/hmm/communicator

Thats done

Download Agi, client and Sphinx 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 sphinx 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.

37 Responses to Asterisk integration with Sphinx Voice recognition system

  1. kevin January 16, 2007 at 11:17 pm #

    Hi,
    Thanks for the excellent instruction.
    But I got error while I am trying to start the sphnix server:
    #./sr_server.dat &
    ——————————
    Can’t load
    ‘/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Speech/Recognizer/SPX/SPX.so’
    for module Speech::Recognizer::SPX: libsphinx2.so.0:
    cannot open shared object file: No such file or
    directory at
    /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm
    line 230.
    at ./sr_server.dat line 15
    Compilation failed in require at ./sr_server.dat line
    15.
    BEGIN failed–compilation aborted at ./sr_server.dat
    line 15.
    —————————-

    Need Advice,

    Many thanks
    Kevin

  2. Syed Saud January 20, 2007 at 3:44 am #

    Kavin, what OS you are using for the Sphinx? it looks like you’re trying to install a perl module that provides an interface to a c library, which is not installed.

    Please try to install Recognizer again properly.

  3. Lucian June 27, 2007 at 9:50 pm #

    I have the same problem as kevin using:
    [root@bk sphinx2-0.6]# uname -a
    Linux bk 2.6.18-1.2849.fc6 #1 SMP Fri Nov 10 12:45:28 EST 2006 i686 i686 i386 GNU/Linux

    Using this OS: [root@ktel model]# uname -a
    Linux ktel 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 2006 i686 i686 i386 GNU/Linux
    all the things goes fine and is working

  4. Vinay August 10, 2007 at 9:51 am #

    Can someone post the confirm.tgz in an alternate site. The original site http://turnkey-solution.com is down.

    Or if someone can email me the dictionary it would be great as well :)

    My id is “bsvinay” at good old “gmail” dot “com”.

    Thanks,
    Vinay

  5. Vinay August 10, 2007 at 10:29 am #

    Never mind, I found out how to create confirm.tgz.

    Create a text file containing four lines for Yes, No, Accept and Cancel.

    And use this link to create your lm files

    http://www.speech.cs.cmu.edu/tools/lmtool.html

  6. vbuchyn November 14, 2007 at 2:46 pm #

    Hi there. Thanx for article!
    I’m runnig freebsd 6.2

    uname -a
    FreeBSD usaster.intellecom.ua 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Wed Nov 7 17:16:04 EET 2007 root@usaster.intellecom.int:/usr/obj/usr/src/sys/MYKERN i386

    When I try to compile Speech-Recognizer-SPX-0.0801 I got an error:
    cp SPX.pm blib/lib/Speech/Recognizer/SPX.pm
    cp SPX/Config.pm blib/lib/Speech/Recognizer/SPX/Config.pm
    cp SPX/Server.pm blib/lib/Speech/Recognizer/SPX/Server.pm
    /usr/bin/perl /usr/local/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/local/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap SPX.xs > SPX.xsc && mv SPX.xsc SPX.c
    Please specify prototyping behavior for SPX.xs (see perlxs manual)
    cc -c -I/usr/local/include -DAPPLLIB_EXP=”/usr/local/lib/perl5/5.8.8/BSDPAN” -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -g -O2 -DVERSION=\”0.0801\” -DXS_VERSION=\”0.0801\” -DPIC -fPIC “-I/usr/local/lib/perl5/5.8.8/mach/CORE” SPX.c
    SPX.xs: In function `new_seg_sv’:
    SPX.xs:294: error: structure has no member named `fsg_state’
    *** Error code 1

    Stop in /root/.cpan/build/Speech-Recognizer-SPX-0.0801.

    Sphinx2 directory is /usr/local (installed from ports)
    perl version 5.8.8_1

    What I’m doing wrong?
    Thanx.

  7. 850t November 22, 2007 at 12:34 pm #

    When I run the following command,
    #/usr/local/bin/sr_server &

    messages keep pumping onto my console, is that normal or not?

    Also, when I do sr_client yes.wav, I did not receive any result. Anyone know why?

  8. 850t November 24, 2007 at 8:23 am #

    INFO: uttproc.c(1186): Batchmode
    WARNING: “uttproc.c”, line 739: NO AGC
    WARNING: “search.c”, line 2587: UTTERANCE TOO SHORT; IGNORED
    SERVER RESULT:

    What’s wrong?

  9. gamezer0 June 7, 2008 at 10:25 pm #

    Hi!

    The asterisk-sphinx.zip file has disappeared from http://www.kohat.pk/asterisk-sphinx.zip

    Could anyone upload it to any server or send my by email (gamezer0@DELETETHISgmail.com), please?

    Thanks.

  10. admin June 11, 2008 at 1:30 pm #

    Gamezer,

    You can download Sphinx server, client and AGI files from here:
    http://www.syednetworks.com/asterisk-sphinx.rar

  11. Fred June 29, 2008 at 9:45 pm #

    Was looking for a guide that how to LumexVox AGI script with Asterisk. I’d appreciate if somebody post about LumenVox Speech Recognition. Thanks

  12. ryan August 20, 2008 at 8:28 am #

    has anyone come up with a solution for the issue described in comment 1 by kevin. It seems that there is not much information on this on google.

    help appreciated

  13. ryan August 20, 2008 at 9:35 pm #

    Well i figured out the problem after some hours.

    you apparently need to create symbolic links

    in /usr/lib/ for the modules that are not found by per.

    the modules are located in /usr/local/sphinx/lib

  14. mike August 28, 2008 at 8:57 am #

    or you could add /usr/local/sphinx/lib to /etc/ld.so.conf and then type ldconfig, which will enable the library loader to find the needed libs..

  15. Dipendra January 10, 2009 at 1:57 pm #

    while running server like
    #./sr_server.dat &
    it shows output like ..

    [trixbox1.localdomain bin]# -bash: /usr/local/bin/sr_server.dat: /usr/bin/perl^M: bad interpreter: No such file or directory

    [2]+ Exit 126 sr_server.dat

    what is the problem and how to resolve it .?

  16. Vin January 13, 2009 at 6:55 pm #

    Hi,

    I am trying to install Speech-Recognizer-SPX module but it is giving errors. I tried using:
    ./configure and make. When I write make, it gives me errors:

    cp SPX.pm blib/lib/Speech/Recognizer/SPX.pm
    cp SPX/Config.pm blib/lib/Speech/Recognizer/SPX/Config.pm
    cp SPX/Server.pm blib/lib/Speech/Recognizer/SPX/Server.pm
    make[1]: Entering directory `/home/xxx/Download/SpeechRecognitionFolder/Speech-Recognizer-SPX-0.09/FE’
    cp MFCC.pm ../blib/lib/Audio/MFCC.pm
    /usr/bin/perl /usr/lib/perl5/5.10.0/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.10.0/ExtUtils/typemap MFCC.xs > MFCC.xsc && mv MFCC.xsc MFCC.c
    Please specify prototyping behavior for MFCC.xs (see perlxs manual)
    gcc -std=gnu99 -c -I/usr/local/include/sphinxbase -I/usr/local/include/pocketsphinx -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -g -O2 -DVERSION=\”0.02\” -DXS_VERSION=\”0.02\” -fPIC “-I/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE” MFCC.c
    MFCC.xs: In function ‘XS_Audio__MFCC_init’:
    MFCC.xs:279: error: ‘param_t’ undeclared (first use in this function)
    MFCC.xs:279: error: (Each undeclared identifier is reported only once
    MFCC.xs:279: error: for each function it appears in.)
    MFCC.xs:279: error: expected ‘;’ before ‘par’
    MFCC.xs:285: error: ‘par’ undeclared (first use in this function)
    MFCC.xs:317: warning: implicit declaration of function ‘fe_init’
    MFCC.xs:317: warning: assignment makes pointer from integer without a cast
    MFCC.xs: In function ‘XS_fe_tPtr_process_utt’:
    MFCC.xs:348: error: dereferencing pointer to incomplete type
    MFCC.xs:348: error: dereferencing pointer to incomplete type
    MFCC.xs:349: error: dereferencing pointer to incomplete type
    MFCC.xs:352: error: dereferencing pointer to incomplete type
    MFCC.xs:354: error: dereferencing pointer to incomplete type
    MFCC.xs: In function ‘XS_fe_tPtr_end_utt’:
    MFCC.xs:370: error: dereferencing pointer to incomplete type
    MFCC.xs:370: error: dereferencing pointer to incomplete type
    MFCC.xs:379: error: dereferencing pointer to incomplete type
    MFCC.xs:379: error: dereferencing pointer to incomplete type
    MFCC.xs:380: error: dereferencing pointer to incomplete type
    MFCC.xs:383: error: dereferencing pointer to incomplete type
    MFCC.xs:385: error: dereferencing pointer to incomplete type
    MFCC.xs: In function ‘XS_fe_tPtr_DESTROY’:
    MFCC.xs:405: warning: implicit declaration of function ‘fe_close’
    make[1]: *** [MFCC.o] Error 1
    make[1]: Leaving directory `/home/xxx/Download/SpeechRecognitionFolder/Speech-Recognizer-SPX-0.09/FE’
    make: *** [subdirs] Error 2

    Could you please suggest what could be the problem. I have Perl5.10 installed with cpan. Running on Fedora 10 Linux.

  17. Faisal January 29, 2009 at 12:19 pm #

    Hi Dipendra,

    Have you found a solution for your problem. I am having the exact same issue. Is it something to do with my lack of centos knowledge?

    Faisal

  18. admin January 29, 2009 at 6:26 pm #

    In Windows, the end of a line is CRLF (Carriage-Return, Line-Feed). In Unix-like systems, it is just LF. So when you try to run that script, every line has an extra CR on the end.

    The way to fix this is to use some sort of utility to fix that. You might use the utility dos2unix if you have it installed, or just go download it. i.e

    # dos2unix /usr/local/bin/sr_server.dat

  19. Faisal February 3, 2009 at 11:01 am #

    Hey admin,

    Thanks for the help. That solves one of the problems. Now I am stuck at this…

    [trixbox1.localdomain bin]# sr_server.dat
    Can’t load ‘/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Speech/Recognizer/SPX/SPX.so’ for module Speech::Recognizer::SPX: libsphinx2.so.0: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
    at /usr/local/bin/sr_server.dat line 15
    Compilation failed in require at /usr/local/bin/sr_server.dat line 15.
    BEGIN failed–compilation aborted at /usr/local/bin/sr_server.dat line 15.

    I have tried to find my way through DynaLoader.pm but its way over my head and sr_server.dat line 15 seems pretty straightforward. Any suggestions?

    Thanks

  20. Faisal February 19, 2009 at 5:01 pm #

    Hi all,

    Just wondering. Is it because I did not install the Speech Recognize SPX module properly?

    Any Ideas?

    Faisal

  21. Faisal February 26, 2009 at 12:18 pm #

    U get the error because the lib is not found by dynamic loader. U
    need to add sphinx shared library in the path:

    export LD_LIBRARY_PATH=/usr/local/sphinx/lib

    I managed to get the script running in my environment.

  22. Tom Gob March 30, 2009 at 9:16 pm #

    First off, thanks for the great instructions.

    Everything installed perfectly, but when I test it, I get empty results (for both command line and agi tests).

    Any idea what the problem might be? Below is my output.

    INFO: uttproc.c(1186): Batchmode
    INFO: uttproc.c(1382): Samples histogram (00000013) (4/8/16/30/32K): 1.4%(31) 0.0%(0) 28.5%(614) 68.8%(1483) 1.2%(26); max: 31862
    WARNING: “uttproc.c”, line 739: NO AGC
    SFrm Efrm AScr/Frm AScr LScr BSDiff LatDen PhPerp Word (FWDTREE) (00000013)
    ———————————————————————
    0 14 -175973 -2639605 0 -133529 6 1.45
    15 24 -180273 -1802731 -147782 -135065 7 1.23
    INFO: search.c(2643): FWDTREE: (00000013 -4590118 (A=-4442336 L=-147782))
    INFO: search.c(2555): 181 words recognized (7/fr)
    INFO: search.c(2558): 514 phones in topsen (20/fr)
    INFO: search.c(2560): 106875 senones evaluated (4275/fr)
    INFO: search.c(2562): 398 channels searched (15/fr), 64 1st, 329 last
    INFO: search.c(2566): 291 words for which last channels evaluated (11/fr)
    INFO: search.c(2568): 2 candidate words for entering last phone (0/fr)
    SFrm EFrm AScr/Frm AScr PathScr BSDiff LatDen PhPerp Word (Bestpath) (00000013)
    ————————————————————————
    INFO: searchlat.c(939): BESTPATH: (00000013 -4658325)
    INFO: searchlat.c(942): 2 nodes, 1 links searched

    INFO: uttproc.c(507): 0.24 SoS, 0.03 sec elapsed, 0.15 xRT, 0.01 sec CPU, 0.04 xRT

    SERVER RESULT:

    Thanks in advance.

  23. Vikas April 29, 2009 at 11:58 am #

    Thanks for comprehensive and flawless instructions. I have compiled all and now testing the sphinx for YES and NO.wav

    Server Side:
    ./sr_server.dat &
    This running fine.

    Client Side:
    when i give ./sr_client.dat YES.wav I get the following error

    bash: ./sr_client.dat: /usr/bin/perl^M: bad interpreter: No such file or directory

    Does anyone have idea about the above error.

    Please help me know about the same if anyone is aware of the error ASAP.

    Regards,
    Vikas Jayaprakash

  24. Ronald Chan June 9, 2009 at 11:12 pm #

    I can confirm this works!!!
    INFO: uttproc.c(1186): Batchmode
    INFO: uttproc.c(1382): Samples histogram (00000005) (4/8/16/30/32K): 99.8%(23977) 0.1%(34) 0.0%(2) 0.0%(7) 0.0%(2); max: 32767
    WARNING: “uttproc.c”, line 739: NO AGC
    SFrm Efrm AScr/Frm AScr LScr BSDiff LatDen PhPerp Word (FWDTREE) (00000005)
    ———————————————————————
    0 90 -187160 -17031636 0 -156672 9 1.92
    91 119 -197806 -5736393 -153983 -138699 7 1.54 YES
    120 141 -195546 -4302018 -230270 -156439 11 2.26 ++BREATH++
    142 215 -167297 -12380034 -230270 -145117 8 1.72 SIL
    216 251 -195542 -7039529 -230270 -152149 11 2.16 ++BACKGROUND++
    252 294 -211386 -9089613 -230270 -158100 10 2.09 ++BACKGROUND++
    295 297 -269022 -807066 -49346 -171008 10 1.00
    INFO: search.c(2643): FWDTREE: YES (00000005 -57510698 (A=-56386289 L=-1124409))
    INFO: search.c(2555): 3043 words recognized (10/fr)
    INFO: search.c(2558): 9888 phones in topsen (33/fr)
    INFO: search.c(2560): 1273950 senones evaluated (4275/fr)
    INFO: search.c(2562): 12396 channels searched (41/fr), 1911 1st, 8384 last
    INFO: search.c(2566): 3766 words for which last channels evaluated (12/fr)
    INFO: search.c(2568): 489 candidate words for entering last phone (1/fr)
    SFrm EFrm AScr/Frm AScr PathScr BSDiff LatDen PhPerp Word (Bestpath) (00000005)
    ————————————————————————
    91 119 1360988 39468667 56797476 -138699 7 1.54 YES
    INFO: searchlat.c(939): BESTPATH: YES (00000005 -57604542)
    INFO: searchlat.c(942): 11 nodes, 37 links searched

    INFO: uttproc.c(507): 2.97 SoS, 0.09 sec elapsed, 0.03 xRT, 0.08 sec CPU, 0.03 xRT

    SERVER RESULT: YES
    sphinx_test.agi: CONFIRM: YES
    — AGI Script sphinx_test.agi completed, returning 0
    — Executing [4000@internal:2] Hangup(“SIP/100-b7815b80”, “”) in new stack
    == Spawn extension (internal, 4000, 2) exited non-zero on ‘SIP/100-b7815b80’

  25. Andrew August 30, 2009 at 5:39 pm #

    Hello!
    Have a problem like “http://www.syednetworks.com/asterisk-integration-with-sphinx-voice-recognition-system#comment-5245”

    # uname -a
    Linux ss 2.6.16.60-0.21 #1 SMP Tue May 6 12:41:02 UTC 2008 x86_64 x86_64 x86_64 GNU/Linux
    SUSE Linux Enterprise Server 10 (x86_64)
    VERSION = 10
    PATCHLEVEL = 2

    # gcc –version
    gcc (GCC) 4.1.2 20070115 (SUSE Linux)

    #/usr/local/bin/sr_client yes.wav
    Result:

    at server log:
    INFO: uttproc.c(1186): Batchmode
    WARNING: “uttproc.c”, line 739: NO AGC
    WARNING: “search.c”, line 2587: UTTERANCE TOO SHORT; IGNORED
    SERVER RESULT:

    Trying others wav. http://pbxinaflash.net/source/sphinx/?C=M;O=A

    Please help.

  26. GriZmio November 6, 2009 at 7:52 pm #

    i had the same error:
    INFO: uttproc.c(1186): Batchmode
    WARNING: “uttproc.c”, line 739: NO AGC
    WARNING: “search.c”, line 2587: UTTERANCE TOO SHORT; IGNORED
    SERVER RESULT:

    so i checked if sox was installed and sourprise, it wasnt, only its libraries.
    after an aptitude install sox, it works like charm.
    hope it helps someone in the future. :-)

  27. Oscar Mendez February 25, 2010 at 7:42 pm #

    In my case the sr_server and sr_client are working over a centOs (elastix 1.2-4) distribution.
    I made the extension in the extensions_custom.conf file (at the from-internal-custom context). Nevertheless, when I try to reach the extension using a X-lite softphone I receive the recording saying 'the person you're calling is unavailable' and the call ends. The 1234 demo extension is working (doesn't executes AGI's), what makes me think that the problem is on the configuration of the extension.
    Also, I tried to execute another AGI (weather.agi) but didn't work.
    From the asterisk CLI I got:
    -- Executing [300@from-internal:1] AGI("SIP/333-08245a30", "sphinx_test.agi") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/sphinx_test.agi
        -- AGI Script sphinx_test.agi completed, returning 0
        -- Executing [300@from-internal:2] Hangup("SIP/333-08245a30", "") in new stack
      == Spawn extension (from-internal, 300, 2) exited non-zero on 'SIP/333-08245a30'
        -- Executing [h@from-internal:1] Macro("SIP/333-08245a30", "hangupcall") in new stack
        -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/333-08245a30", "w") in new stack
        -- Executing [s@macro-hangupcall:2] NoCDR("SIP/333-08245a30", "") in new stack
        -- Executing [s@macro-hangupcall:3] GotoIf("SIP/333-08245a30", "1?skiprg") in new stack
        -- Goto (macro-hangupcall,s,6)
        -- Executing [s@macro-hangupcall:6] GotoIf("SIP/333-08245a30", "1?skipblkvm") in new stack
        -- Goto (macro-hangupcall,s,9)
        -- Executing [s@macro-hangupcall:9] GotoIf("SIP/333-08245a30", "1?theend") in new stack
        -- Goto (macro-hangupcall,s,11)
        -- Executing [s@macro-hangupcall:11] Hangup("SIP/333-08245a30", "") in new stack
      == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/333-08245a30' in macro 'hangupcall'
      == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/333-08245a30'


    Does anybody know what I am doing wrong?
    I would really apreciate any help

  28. Oscar Mendez February 25, 2010 at 7:52 pm #

    I'm almost finishing the integration, but I have a problem making the extentions. I have an elastix 1.2-4 system and I put the extension code in the extensions_custom.conf file at the from-internal-custom section.
    When I try to reach the extension 300 I get a recording of unavailability and the call ends.
    The asterisk CLI output is:
      — Executing [300@from-internal:1] AGI("SIP/333-0913a608", "sphinx_test.agi") in new stack
        — Launched AGI Script /var/lib/asterisk/agi-bin/sphinx_test.agi
        — AGI Script sphinx_test.agi completed, returning 0
        — Executing [300@from-internal:2] Hangup("SIP/333-0913a608", "") in new stack
      == Spawn extension (from-internal, 300, 2) exited non-zero on 'SIP/333-0913a608'
        — Executing [h@from-internal:1] Macro("SIP/333-0913a608", "hangupcall") in new stack
        — Executing [s@macro-hangupcall:1] ResetCDR("SIP/333-0913a608", "w") in new stack
        — Executing [s@macro-hangupcall:2] NoCDR("SIP/333-0913a608", "") in new stack
        — Executing [s@macro-hangupcall:3] GotoIf("SIP/333-0913a608", "1?skiprg") in new stack
        — Goto (macro-hangupcall,s,6)
        — Executing [s@macro-hangupcall:6] GotoIf("SIP/333-0913a608", "1?skipblkvm") in new stack
        — Goto (macro-hangupcall,s,9)
        — Executing [s@macro-hangupcall:9] GotoIf("SIP/333-0913a608", "1?theend") in new stack
        — Goto (macro-hangupcall,s,11)
        — Executing [s@macro-hangupcall:11] Hangup("SIP/333-0913a608", "") in new stack
      == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/333-0913a608' in macro 'hangupcall'
      == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/333-0913a608'
      == Parsing '/etc/asterisk/manager.conf': Found
      == Parsing '/etc/asterisk/manager_additional.conf': Found
      == Parsing '/etc/asterisk/manager_custom.conf': Found
      == Manager 'admin' logged on from 127.0.0.1
        — Remote UNIX connection
        — Remote UNIX connection disconnected
        — Remote UNIX connection
        — Remote UNIX connection disconnected
        — Remote UNIX connection
        — Remote UNIX connection disconnected
        — Remote UNIX connection
        — Remote UNIX connection disconnected
        — Executing [300@from-internal:1] AGI("SIP/333-0913a608", "sphinx_test.agi") in new stack
        — Launched AGI Script /var/lib/asterisk/agi-bin/sphinx_test.agi
        — AGI Script sphinx_test.agi completed, returning 0
        — Executing [300@from-internal:2] Hangup("SIP/333-0913a608", "") in new stack
      == Spawn extension (from-internal, 300, 2) exited non-zero on 'SIP/333-0913a608'
        — Executing [h@from-internal:1] Macro("SIP/333-0913a608", "hangupcall") in new stack
        — Executing [s@macro-hangupcall:1] ResetCDR("SIP/333-0913a608", "w") in new stack
        — Executing [s@macro-hangupcall:2] NoCDR("SIP/333-0913a608", "") in new stack
        — Executing [s@macro-hangupcall:3] GotoIf("SIP/333-0913a608", "1?skiprg") in new stack
        — Goto (macro-hangupcall,s,6)
        — Executing [s@macro-hangupcall:6] GotoIf("SIP/333-0913a608", "1?skipblkvm") in new stack
        — Goto (macro-hangupcall,s,9)
        — Executing [s@macro-hangupcall:9] GotoIf("SIP/333-0913a608", "1?theend") in new stack
        — Goto (macro-hangupcall,s,11)
        — Executing [s@macro-hangupcall:11] Hangup("SIP/333-0913a608", "") in new stack
      == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/333-0913a608' in macro 'hangupcall'
      == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/333-0913a608'
     
    I don't know what I am doing wrong.
    I would really appreciate any help.

  29. David April 25, 2010 at 4:30 am #

    hello everyone

    I saw an error of its kind in the forum but I still can not solve my problem. I use debian lenny and perl5.10.1. Here is the error:
    cp SPX.pm blib/lib/Speech/Recognizer/SPX.pm
    cp SPX/Config.pm blib/lib/Speech/Recognizer/SPX/Config.pm
    cp SPX/Server.pm blib/lib/Speech/Recognizer/SPX/Server.pm
    make[1]: entrant dans le répertoire « /root/Speech-Recognizer-SPX-0.09/FE »
    cp MFCC.pm ../blib/lib/Audio/MFCC.pm
    /usr/bin/perl /usr/share/perl/5.10.1/ExtUtils/xsubpp  -typemap /usr/share/perl/5.10/ExtUtils/typemap  MFCC.xs > MFCC.xsc && mv MFCC.xsc MFCC.c
    Please specify prototyping behavior for MFCC.xs (see perlxs manual)
    cc -c  -I/usr/local/include/sphinxbase -I/usr/local/include/pocketsphinx   -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2   -DVERSION=\"0.02\" -DXS_VERSION=\"0.02\" -fPIC "-I/usr/lib/perl/5.10/CORE"   MFCC.c
    MFCC.xs: In function ‘XS_Audio__MFCC_init’:
    MFCC.xs:279: error: ‘param_t’ undeclared (first use in this function)
    MFCC.xs:279: error: (Each undeclared identifier is reported only once
    MFCC.xs:279: error: for each function it appears in.)
    MFCC.xs:279: error: expected ‘;’ before ‘par’
    MFCC.xs:285: error: ‘par’ undeclared (first use in this function)
    MFCC.xs: In function ‘XS_fe_tPtr_process_utt’:
    MFCC.xs:348: error: dereferencing pointer to incomplete type
    MFCC.xs:348: error: dereferencing pointer to incomplete type
    MFCC.xs:349: error: dereferencing pointer to incomplete type
    MFCC.xs:352: error: dereferencing pointer to incomplete type
    MFCC.xs:354: error: dereferencing pointer to incomplete type
    MFCC.xs: In function ‘XS_fe_tPtr_end_utt’:
    MFCC.xs:370: error: dereferencing pointer to incomplete type
    MFCC.xs:370: error: dereferencing pointer to incomplete type
    MFCC.xs:379: error: dereferencing pointer to incomplete type
    MFCC.xs:379: error: dereferencing pointer to incomplete type
    MFCC.xs:380: error: dereferencing pointer to incomplete type
    MFCC.xs:383: error: dereferencing pointer to incomplete type
    MFCC.xs:385: error: dereferencing pointer to incomplete type
    make[1]: *** [MFCC.o] Erreur 1
    make[1]: quittant le répertoire « /root/Speech-Recognizer-SPX-0.09/FE »
    make: *** [subdirs] Erreur 2

     

  30. mashudu July 14, 2010 at 12:16 pm #

    has anyone managed to sort out the NO AGI problem? I have tried reinstalling sox but still no luck.
    Thanks.
     
     
    INFO: uttproc.c(1186): Batchmode
    INFO: uttproc.c(1382): Samples histogram (00000005) (4/8/16/30/32K): 1.6%(43) 0.0%(0) 29.3%(792) 67.6%(1827) 1.6%(42); max: 31860
    WARNING: "uttproc.c", line 739: NO AGC
     SFrm Efrm   AScr/Frm        AScr     LScr   BSDiff LatDen PhPerp Word (FWDTREE) (00000005)
     ———————————————————————
        0    2    -227379     -682138        0  -160768      1   2.18 <s>
        3   31    -175113    -5078289  -147782  -142159      9   1.53 </s>
    INFO: search.c(2643): FWDTREE:  (00000005 -5908209 (A=-5760427 L=-147782))
    INFO: search.c(2555):      270 words recognized (8/fr)
    INFO: search.c(2558):      817 phones in topsen (25/fr)
    INFO: search.c(2560):   136800 senones evaluated (4275/fr)
    INFO: search.c(2562):      720 channels searched (22/fr), 112 1st, 580 last
    INFO: search.c(2566):      390 words for which last channels evaluated (12/fr)
    INFO: search.c(2568):       17 candidate words for entering last phone (0/fr)
     SFrm EFrm   AScr/Frm        AScr     PathScr   BSDiff LatDen PhPerp Word (Bestpath) (00000005)
     ————————————————————————
    INFO: searchlat.c(939): BESTPATH:  (00000005 -5976416)
    INFO: searchlat.c(942):        2 nodes, 1 links searched
     
    INFO: uttproc.c(507):   0.31 SoS,   0.02 sec elapsed,  0.07 xRT,   0.01 sec CPU,  0.03 xRT
     
    SERVER RESULT:
    Result:

  31. ghost October 29, 2010 at 5:47 pm #

    about the error, make sure it can be executed by doing a “chmod +x sphinx_test.agi”
    might help??
    also check this page, lots of good info,especially in the comments:http://www.latinsud.com/pub/asterisk-sphinx/asterisk-sphinx.html

  32. Cecilia Arenas December 3, 2010 at 7:56 pm #

    Hi,
    I have the same problem as Oscar Mendez, when I call the 300 extension I just get a recording of unavailability and the call ends, the sphinx server works fine because I tested it with the sr_client and I have results.

    Anyone has solved this problem?

  33. Cecilia Arenas December 6, 2010 at 3:23 pm #

    Hi,

    I already solved the problem about the unavailability of the extension, but I dont receive any result my server output is this:

    INFO: uttproc.c(1382): Samples histogram (00000018) (4/8/16/30/32K): 40.9%(9) 9.
    1%(2) 9.1%(2) 31.8%(7) 9.1%(2); max: 32767
    WARNING: “uttproc.c”, line 739: NO AGC
    WARNING: “search.c”, line 2587: UTTERANCE TOO SHORT; IGNORED
    SERVER RESULT:

    I already checked of sox was installed as someone suggested but that’s not the problem

  34. mostafa February 10, 2011 at 8:57 am #

    thanks for your help, but i need some explanation for the last lines:

    “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.”

    we need to create IVR and set a new context in the file extension_custom.conf ??

  35. Qasim Khan March 21, 2012 at 11:29 pm #

    i am new in asterisk. i have assigned a task to setup an IVR that takes caller name, number and address and save them in DB like MySQL or MSMSQL. i have some understanding with PHP AGI but nor perl. please help me to install sphinx on asterisk and give me some example to work with PHP AGI.

  36. ismail March 30, 2012 at 7:59 am #

    — Launched AGI Script /var/lib/asterisk/agi-bin/sphinx_test.agi
    AGI Tx >> agi_request: sphinx_test.agi
    AGI Tx >> agi_channel: SIP/1001-00000003
    AGI Tx >> agi_language: en
    AGI Tx >> agi_type: SIP
    AGI Tx >> agi_uniqueid: 1333079832.3
    AGI Tx >> agi_version: 1.8.11.0-digiumphones1
    AGI Tx >> agi_callerid: 1001
    AGI Tx >> agi_calleridname: device
    AGI Tx >> agi_callingpres: 0
    AGI Tx >> agi_callingani2: 0
    AGI Tx >> agi_callington: 0
    AGI Tx >> agi_callingtns: 0
    AGI Tx >> agi_dnid: 2002
    AGI Tx >> agi_rdnis: unknown
    AGI Tx >> agi_context: miu
    AGI Tx >> agi_extension: 2002
    AGI Tx >> agi_priority: 2
    AGI Tx >> agi_enhanced: 0.0
    AGI Tx >> agi_accountcode:
    AGI Tx >> agi_threadid: -1228039280
    AGI Tx >>
    AGI Rx << verbose "Failed to execute '/var/lib/asterisk/agi-b in/sphinx_test.agi': No such file or directory" 1
    sphinx_test.agi: Failed to execute '/var/lib/asterisk/agi-bin/sphinx_test.agi': No such file or directory
    AGI Tx >> 200 result=1
    — Executing [2002@miu:3] Playback(“SIP/1001-00000003”, “custom/orig_magdi”) in new stack
    — Playing ‘custom/orig_magdi.gsm’ (language ‘en’)
    — Executing [2002@miu:4] Hangup(“SIP/1001-00000003”, “”) in new stack
    == Spawn extension (miu, 2002, 4) exited non-zero on ‘SIP/1001-00000003’

  37. Farrukh June 11, 2013 at 11:08 pm #

    when I run /usr/local/bin/sr_client yes.wav the command stucks for ever no error and no response please help me ,

Leave a Reply