FreePBX | Register | Issues | Wiki | Portal | Support

Google voice recognition


(D E) #1

When I last considered this option I had not done any work with the custom conf files. I have now done a little bit with them and as a result, am not so afraid as I was!

Am I right in thinking that Google Asterisk Speech Recognition is something that could work with FreePBX?

I will sign up for the API if so.

Thanks


(Itzik) #2

Never done that.

Start working on it, report back with your findings, and hopefully, we’ll be able to assist you getting it done.


(D E) #3

Thanks. The first hurdle I’ve encountered is installing perl-libwww - when I do an apt-get install, it just says it can’t find the module. I’ll plough on!


#4

apt-cache search libwww|grep perl


(D E) #5

I’ve swapped around the words so it’s libwww-perl instead of perl-libwww and now it’s installing. Don’t know if
a) I’ve misunderstood
b) the script author made a typo
c) it’s changed name

thanks!


#6

You will get used to the naming conventions of packages between versions of linux, there are none :wink:


(Dave Burgess) #7

Probably all of the above.


#8

Just a) he is following a method that assumes redhat, he is using debian.


(D E) #9

Even though this first attempt has failed (see below), I’m kinda elated(!) it even did …something!

[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [recordcheck@sub-record-check:2] Goto("SIP/SIPGATE_UK-00000005", "dontcare") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx_builtins.c: Goto (sub-record-check,recordcheck,3)
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [recordcheck@sub-record-check:3] Return("SIP/SIPGATE_UK-00000005", "") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [s@sub-record-check:20] Return("SIP/SIPGATE_UK-00000005", "") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [1@disa:4] Set("SIP/SIPGATE_UK-00000005", "_DISA=disa^1^newcall") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [1@disa:5] Set("SIP/SIPGATE_UK-00000005", "_DISACONTEXT=from-internal") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [1@disa:6] Set("SIP/SIPGATE_UK-00000005", "_KEEPCID=TRUE") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [1@disa:7] Set("SIP/SIPGATE_UK-00000005", "_HANGUP=THg") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [1@disa:8] Set("SIP/SIPGATE_UK-00000005", "TIMEOUT(digit)=5") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] func_timeout.c: Digit timeout set to 5.000
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [1@disa:9] Set("SIP/SIPGATE_UK-00000005", "TIMEOUT(response)=10") in new stack
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] func_timeout.c: Response timeout set to 10.000
[2019-06-14 16:10:09] VERBOSE[637][C-00000004] pbx.c: Executing [1@disa:10] DISA("SIP/SIPGATE_UK-00000005", "no-password,disa-dial") in new stack
[2019-06-14 16:10:19] VERBOSE[637][C-00000004] pbx.c: Executing [1234@disa-dial:1] NoOp("SIP/SIPGATE_UK-00000005", "called 1234 in from-internal by ID: 1") in new stack
[2019-06-14 16:10:19] VERBOSE[637][C-00000004] pbx.c: Executing [1234@disa-dial:2] Dial("SIP/SIPGATE_UK-00000005", "Local/1234@from-internal,300,THg") in new stack
[2019-06-14 16:10:19] VERBOSE[637][C-00000004] app_dial.c: Called Local/1234@from-internal
[2019-06-14 16:10:19] VERBOSE[739][C-00000004] pbx.c: Executing [1234@from-internal:1] Answer("Local/1234@from-internal-00000005;2", "") in new stack
[2019-06-14 16:10:19] VERBOSE[637][C-00000004] app_dial.c: Local/1234@from-internal-00000005;1 answered SIP/SIPGATE_UK-00000005
[2019-06-14 16:10:19] VERBOSE[740][C-00000004] bridge_channel.c: Channel Local/1234@from-internal-00000005;1 joined 'simple_bridge' basic-bridge <7d689d26-f81b-4434-9cc8-42d7c54002cf>
[2019-06-14 16:10:19] VERBOSE[637][C-00000004] bridge_channel.c: Channel SIP/SIPGATE_UK-00000005 joined 'simple_bridge' basic-bridge <7d689d26-f81b-4434-9cc8-42d7c54002cf>
[2019-06-14 16:10:19] VERBOSE[739][C-00000004] pbx.c: Executing [1234@from-internal:2] AGI("Local/1234@from-internal-00000005;2", "speech-recog.agi,en-US") in new stack
[2019-06-14 16:10:19] VERBOSE[739][C-00000004] res_agi.c: Launched AGI Script /var/lib/asterisk/agi-bin/speech-recog.agi
[2019-06-14 16:10:19] VERBOSE[739][C-00000004] file.c: <Local/1234@from-internal-00000005;2> Playing 'beep.alaw' (language 'en')
[2019-06-14 16:10:26] VERBOSE[739][C-00000004] res_agi.c: speech-recog.agi,en-US: Unable to get recognition data.
[2019-06-14 16:10:26] VERBOSE[739][C-00000004] res_agi.c: <Local/1234@from-internal-00000005;2>AGI Script speech-recog.agi completed, returning 0
[2019-06-14 16:10:26] VERBOSE[739][C-00000004] pbx.c: Executing [1234@from-internal:3] Verbose("Local/1234@from-internal-00000005;2", "1,The text you just said is: -1") in new stack
[2019-06-14 16:10:26] VERBOSE[739][C-00000004] app_verbose.c: The text you just said is: -1
[2019-06-14 16:10:26] VERBOSE[739][C-00000004] pbx.c: Executing [1234@from-internal:4] Verbose("Local/1234@from-internal-00000005;2", "1,The probability to be right is: -1") in new stack

(D E) #10

OK - first meaningful findings - the script returns with “unable to get recognition data”. - but I don’t know why. Yet.


(D E) #11

Looks to be failing at this point in the script:

# Send audio data for analysis #
my $uaresponse = $ua-&gt;post(
"$url:recognize?key=$key",
Content_Type =&gt; "application/json",
Content =&gt; encode_json(\%json),
);

warn "$name The response was:\n", $uaresponse-&gt;content if ($debug);
if (!$uaresponse-&gt;is_success) {
print "VERBOSE \"Unable to get recognition data.\" 3\n";
checkresponse();
die "$name Unable to get recognition data.\n";
}
my $jdata = decode_json($uaresponse-&gt;content);

#12

I would get the basics working first

https://cloud.google.com/speech-to-text/docs/basics

then select your language of choice from

https://cloud.google.com/speech-to-text/docs/samples


(system) closed #13

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