Utterance and confidence variables always return -1 (Google speech-recognition)

First I followed this page for installation: GitHub - zaf/asterisk-speech-recog: Speech recognition script for Asterisk that uses google's speech engine..
I did everything as it was on the page: I installed the necessary dependencies and copied the voice-recog.agi file to the agi-bin directory with the right permissions. I tortured this speech-recog.agi script until I had a nervous breakdown. I’ve been trying continuously for half a day now, but the values ​​of the ${utterance} and ${confidence} variables still return -1. Can someone tell me what the problem might be? Thanks in advance!

Here is my extensions_custom.conf file:

exten => 3839,1,Answer
exten => 3839,n,Wait(1)
exten => 3839,n,agi(googletts.agi,“Mondjon valamit magyarul, majd nyomja meg a kettőskereszt gombot”,hu)
exten => 3839,n,agi(speech-recog.agi,hu-HU)
exten => 3839,n,Verbose(1,The text you just said is: ${utterance})
exten => 3839,n,Verbose(1,The probability to be right is: ${confidence})
exten => 3839,n,Hangup()

If you’re using FreePBX, you will find more relevant support on their forum.

Does ‘agi set debug on’ yield any clues. If not, I’d add some code to ‘verbose’ any status returned by calls to Google’s service.

I have no knowledge of the status of the service, but it would not be the first time Google turned something off…

“If not, I’d add some code to ‘verbose’ any status returned by calls to Google’s service.”: How can I do this?

The AGI is written in Perl which is an interpreted language, so you can just edit speech-recog.agi directly.

If you don’t have Perl skills you will need to find someone to volunteer or contract.

I have successfully integrated Asterisk and Google Speech Recognition API, using PHP, If you want to use the GitHub project that you already posted you will need to address the questions directly to the developer.

Anyway, the full agi debug:
<PJSIP/1000-00000083>AGI Tx >> agi_request: googletts.agi
<PJSIP/1000-00000083>AGI Tx >> agi_channel: PJSIP/1000-00000083
<PJSIP/1000-00000083>AGI Tx >> agi_language: en
<PJSIP/1000-00000083>AGI Tx >> agi_type: PJSIP
<PJSIP/1000-00000083>AGI Tx >> agi_uniqueid: 1679575544.210
<PJSIP/1000-00000083>AGI Tx >> agi_version: 16.28.0
<PJSIP/1000-00000083>AGI Tx >> agi_callerid: 1000
<PJSIP/1000-00000083>AGI Tx >> agi_calleridname: Teodor Telefon
<PJSIP/1000-00000083>AGI Tx >> agi_callingpres: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callingani2: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callington: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callingtns: 0
<PJSIP/1000-00000083>AGI Tx >> agi_dnid: 3839
<PJSIP/1000-00000083>AGI Tx >> agi_rdnis: unknown
<PJSIP/1000-00000083>AGI Tx >> agi_context: from-internal
<PJSIP/1000-00000083>AGI Tx >> agi_extension: 3839
<PJSIP/1000-00000083>AGI Tx >> agi_priority: 3
<PJSIP/1000-00000083>AGI Tx >> agi_enhanced: 0.0
<PJSIP/1000-00000083>AGI Tx >> agi_accountcode:
<PJSIP/1000-00000083>AGI Tx >> agi_threadid: 140068252141312
<PJSIP/1000-00000083>AGI Tx >> agi_arg_1: Mondjon valamit magyarul, majd nyomja meg a kettőskereszt gombot
<PJSIP/1000-00000083>AGI Tx >> agi_arg_2: hu
<PJSIP/1000-00000083>AGI Tx >>
<PJSIP/1000-00000083>AGI Rx << CHANNEL STATUS
<PJSIP/1000-00000083>AGI Tx >> 200 result=6
<PJSIP/1000-00000083>AGI Rx << GET FULL VARIABLE ${CHANNEL(audionativeformat)}
<PJSIP/1000-00000083>AGI Tx >> 200 result=1 ((ulaw))
<PJSIP/1000-00000083>AGI Rx << STREAM FILE /tmp/4e9887750ecbbd3e09ae380c7fe7bb73 “”
<PJSIP/1000-00000083>AGI Tx >> 200 result=0 endpos=39744
<PJSIP/1000-00000083>AGI Tx >> agi_request: speech-recog.agi
<PJSIP/1000-00000083>AGI Tx >> agi_channel: PJSIP/1000-00000083
<PJSIP/1000-00000083>AGI Tx >> agi_language: en
<PJSIP/1000-00000083>AGI Tx >> agi_type: PJSIP
<PJSIP/1000-00000083>AGI Tx >> agi_uniqueid: 1679575544.210
<PJSIP/1000-00000083>AGI Tx >> agi_version: 16.28.0
<PJSIP/1000-00000083>AGI Tx >> agi_callerid: 1000
<PJSIP/1000-00000083>AGI Tx >> agi_calleridname: Teodor Telefon
<PJSIP/1000-00000083>AGI Tx >> agi_callingpres: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callingani2: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callington: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callingtns: 0
<PJSIP/1000-00000083>AGI Tx >> agi_dnid: 3839
<PJSIP/1000-00000083>AGI Tx >> agi_rdnis: unknown
<PJSIP/1000-00000083>AGI Tx >> agi_context: from-internal
<PJSIP/1000-00000083>AGI Tx >> agi_extension: 3839
<PJSIP/1000-00000083>AGI Tx >> agi_priority: 4
<PJSIP/1000-00000083>AGI Tx >> agi_enhanced: 0.0
<PJSIP/1000-00000083>AGI Tx >> agi_accountcode:
<PJSIP/1000-00000083>AGI Tx >> agi_threadid: 140068252141312
<PJSIP/1000-00000083>AGI Tx >> agi_arg_1: hu-HU
<PJSIP/1000-00000083>AGI Tx >>
<PJSIP/1000-00000083>AGI Rx << SET VARIABLE “utterance” “-1”
<PJSIP/1000-00000083>AGI Tx >> 200 result=1
<PJSIP/1000-00000083>AGI Rx << SET VARIABLE “confidence” “-1”
<PJSIP/1000-00000083>AGI Tx >> 200 result=1
<PJSIP/1000-00000083>AGI Rx << CHANNEL STATUS
<PJSIP/1000-00000083>AGI Tx >> 200 result=6
<PJSIP/1000-00000083>AGI Rx << GET FULL VARIABLE ${CHANNEL(audionativeformat)}
<PJSIP/1000-00000083>AGI Tx >> 200 result=1 ((ulaw))
<PJSIP/1000-00000083>AGI Rx << RECORD FILE /tmp/stt_kHyio5 sln “*” “-1” BEEP “s=6”
<PJSIP/1000-00000083>AGI Tx >> 200 result=42 (dtmf) endpos=29600
<PJSIP/1000-00000083>AGI Rx << VERBOSE “Unable to get recognition data.” 3
<PJSIP/1000-00000083>AGI Tx >> 200 result=1
The text you just said is: -1
The probability to be right is: -1
<PJSIP/1000-00000083>AGI Tx >> agi_request: googletts.agi
<PJSIP/1000-00000083>AGI Tx >> agi_channel: PJSIP/1000-00000083
<PJSIP/1000-00000083>AGI Tx >> agi_language: en
<PJSIP/1000-00000083>AGI Tx >> agi_type: PJSIP
<PJSIP/1000-00000083>AGI Tx >> agi_uniqueid: 1679575544.210
<PJSIP/1000-00000083>AGI Tx >> agi_version: 16.28.0
<PJSIP/1000-00000083>AGI Tx >> agi_callerid: 1000
<PJSIP/1000-00000083>AGI Tx >> agi_calleridname: Teodor Telefon
<PJSIP/1000-00000083>AGI Tx >> agi_callingpres: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callingani2: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callington: 0
<PJSIP/1000-00000083>AGI Tx >> agi_callingtns: 0
<PJSIP/1000-00000083>AGI Tx >> agi_dnid: 3839
<PJSIP/1000-00000083>AGI Tx >> agi_rdnis: unknown
<PJSIP/1000-00000083>AGI Tx >> agi_context: from-internal
<PJSIP/1000-00000083>AGI Tx >> agi_extension: 3839
<PJSIP/1000-00000083>AGI Tx >> agi_priority: 7
<PJSIP/1000-00000083>AGI Tx >> agi_enhanced: 0.0
<PJSIP/1000-00000083>AGI Tx >> agi_accountcode:
<PJSIP/1000-00000083>AGI Tx >> agi_threadid: 140068252141312
<PJSIP/1000-00000083>AGI Tx >> agi_arg_1: Amit mondtam szöveg: 36 70 235 9799
<PJSIP/1000-00000083>AGI Tx >> agi_arg_2: hu
<PJSIP/1000-00000083>AGI Tx >>
<PJSIP/1000-00000083>AGI Rx << CHANNEL STATUS
<PJSIP/1000-00000083>AGI Tx >> 200 result=6
<PJSIP/1000-00000083>AGI Rx << GET FULL VARIABLE ${CHANNEL(audionativeformat)}
<PJSIP/1000-00000083>AGI Tx >> 200 result=1 ((ulaw))
<PJSIP/1000-00000083>AGI Rx << STREAM FILE /tmp/9d067f7ff5fad2e90d7964b441ef0f84 “”
<PJSIP/1000-00000083>AGI Tx >> 200 result=0 endpos=63168
== Spawn extension (from-internal, 3839, 8) exited non-zero on ‘PJSIP/1000-00000083’

I already tried replacing verify_hostname => 1 with verify_hostname => 0 in the voice-recog.agi script, but the variables still return -1.

that’s response is from AGI. change de format file before you send to google?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.