TIPS Asterisk Speech Recognition

John Squared

New Member
Joined
Jan 25, 2016
Messages
8
Reaction score
0
Hello,

I have a question regarding the Asterisk speech recognition that uses the Google API. How would I go about having the following dialplan work without requiring that # be pressed after the user says the number they want to dial? I see some vague references to this, but I am unsure how to go about implementing it. Been going crazy trying to figure this out, any help will be greatly appreciated.

Here's my dialplan:

[custom-voicedial]

exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,agi(googletts.agi,"Please say one, plus the number you want to dial, followed by the pound sign",en)
exten => s,n(record),agi(speech-recog.agi,en-US)
exten => s,n,GotoIf($["${confidence}" > "0.8"]?success:retry)
exten => s,n(success),Goto(dial)
exten => s,n(retry),agi(googletts.agi,"Can you please repeat?",en)
exten => s,n,Goto(dial)
exten => s,n(dial),Noop(= Script returned: ${status} , ${id} , ${confidence} , ${utterance} =)$
exten => s,n,Set(NUM2CALL=${utterance})
exten => s,n,agi(googletts.agi,"${utterance}")
exten => s,n,Dial(SIP/flowrouteLA/"${NUM2CALL}")
exten => s,n,Hangup

Thanks!
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,634
Reaction score
846
Read the code, the istructions are at the top

#!/usr/bin/env perl

#
# AGI script that renders speech to text using Google's Speech API.
#
# Copyright (C) 2011 - 2014, Lefteris Zafiris <[email protected]>
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the COPYING file
# at the top of the source tree.
#
# -----
# Usage
# -----
# agi(speech-recog.agi,[lang],[timeout],[intkey],[NOBEEP])
# Records from the current channel until 2 seconds of silence are detected
# (this can be set by the user by the 'timeout' argument, -1 for no timeout) or the
# interrupt key (# by default) is pressed. If NOBEEP is set, no beep sound is played
# back to the user to indicate the start of the recording.
# The recorded sound is send over to googles speech recognition service and the
# returned text string is assigned as the value of the channel variable 'utterance'.
# The scripts sets the following channel variables:
# utterance : The generated text string.
# confidence : A value between 0 and 1 indicating how 'confident' the recognition engine
# feels about the result. Values bigger than 0.95 usually mean that the
# resulted text is correct.
#
# User defined parameters:
# Speech API key from google:
# $key
#
# Default language:
# $language
#
# Default timeout:
# $timeout (value in seconds of silence before recording is stopped)
#
# Default interupt key:
# $intkey (can be any digit from 0 to 9 or # and *, or a combination of them)
#
# Sample rate:
# $samplerate (value in Hz. 0 for atuomatic detection per channel/call, 16000 for
# use with wideband codecs, 8000 for traditional codecs.
#
# Profanity filter:
# $pro_filter (0:disable, 1: remove profanities, 2: mask profanities)
#
# Encode voice using speex:
# $use_speex (0: disable, 1: enable) **_Highly experimental_**
# works only with patched speex encoder that supports MIME "x-speex-with-header-byte"
# https://github.com/zaf/Speex-with-header-bytes
#
# SSL:
# $use_ssl (0: disable, 1: enable)
#
 

John Squared

New Member
Joined
Jan 25, 2016
Messages
8
Reaction score
0
Thanks for the reply, but problem I am having is that I have to enter # after speaking in order to get things to work. All I want to do is when prompted speak the number to dial and have the script progress to the next step without me pressing #. Is this possible?
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,634
Reaction score
846
Actually not so, did you read actually the code you implemented and call it appropriately?, unless you specify the timeout the timeout is two seconds, you can make it specifically n if you want. by default it is 2. If it's not working, bitch at the author, not here.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,202
Reaction score
5,224
You can set a timeout value in the AGI script. Then pressing # isn't required. We do it in the Incredible PBX setup.
 

John Squared

New Member
Joined
Jan 25, 2016
Messages
8
Reaction score
0
Ward,

Thanks for your response and suggestion. I'm assuming you are referring to:

# Default max silence timeout #
my $timeout = 2;

# Absolute Recording timeout #
my $abs_timeout = -1;

# Default interrupt key #
my $intkey = "#";

I've tried setting different values for the timeout variable but can't seem to get the recording to stop and get sent by itself without the use of having an interrupt key set. Any suggestions?

Thanks!
 

Members online

No members online now.

Forum statistics

Threads
25,819
Messages
167,800
Members
19,247
Latest member
abuhyder
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top