<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: [Freeswitch-users] Am I using play_and_detect_speech correctly?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Thanks for your response, Hector!<BR>
<BR>
Yeah, I am using detect_speech via a similar way to yours.<BR>
<BR>
What I am more interested in is to use detect_speech app to handle user's barge-in.<BR>
<BR>
After Chris mentioned the barge-in can be also handled by detect_speech I gave it a further thinking.<BR>
Yeah, I could first "speak" the utterance and immediately resume ASR, then try to catch the begin_speaking event,<BR>
then stop the TTS -- using this way to handle the user barge-in.<BR>
(Chris, you may have a better idea, would you please let me know if you do?)<BR>
<BR>
One thing I am worry about is that stopping currently playing media or utterance seems not work for me.<BR>
When I recently try "api uuid_break <uuid>" it stopped currently playing music but also stopped playing following utterances<BR>
which I sent to TTS soon later on after uuid_break.<BR>
<BR>
Anyway I will try it further again and let you all know what I will get.<BR>
<BR>
Cheers,<BR>
<BR>
Xing<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: freeswitch-users-bounces@lists.freeswitch.org on behalf of Hector Geraldino<BR>
Sent: Wed 8/1/2012 16:52<BR>
To: FreeSWITCH Users Help<BR>
Subject: Re: [Freeswitch-users] Am I using play_and_detect_speech correctly?<BR>
<BR>
You need to send a detect_speech command with sendmsg + execute:<BR>
<BR>
sendmsg <uuid><BR>
call-command: execute<BR>
execute-app-name: detect_speech<BR>
execute-app-arg: grammar_name //e.g. unimrcp:nuance5-mrcp2-prod nuancegrm nuancegrm<BR>
<BR>
This will trigger an DETECTED_SPEECH event (you need to add this event to your filters, in case you're filtering the events). The detected speech will be part of the bodyLines of the event. I'm using Java ESL client libraries (org.freeswitch.esl.client) and my code looks like:<BR>
<BR>
protected void handleEslEvent(ChannelHandlerContext ctx, EslEvent event) {<BR>
if (event.getEventName().equals("DETECTED_SPEECH")) {<BR>
if (event.getEventBodyLines().size() > 0) {<BR>
<BR>
final String uuid = event.getEventHeaders().get("Unique-ID");<BR>
stopSpeechDetection(uuid);<BR>
<BR>
//detected speech<BR>
StringBuilder bodyLines = new StringBuilder();<BR>
<BR>
for (String line : event.getEventBodyLines()) {<BR>
bodyLines.append(line);<BR>
}<BR>
}<BR>
}<BR>
}<BR>
<BR>
private void stopSpeechDetection(CallSession call) {<BR>
// sendMessage(uuid, "detect_speech", "stop");<BR>
}<BR>
<BR>
g.luck!<BR>
<BR>
From: freeswitch-users-bounces@lists.freeswitch.org [<A HREF="mailto:freeswitch-users-bounces@lists.freeswitch.org">mailto:freeswitch-users-bounces@lists.freeswitch.org</A>] On Behalf Of Liu, Xingkun<BR>
Sent: Wednesday, August 01, 2012 4:49 AM<BR>
To: FreeSWITCH Users Help; FreeSWITCH Users Help<BR>
Subject: Re: [Freeswitch-users] Am I using play_and_detect_speech correctly?<BR>
<BR>
<BR>
Hi Chris,<BR>
<BR>
Many thanks for your info and suggestions!<BR>
<BR>
Would you please tell me a bit more or any clue about the idea of using detect_speech APP to handle<BR>
barge-in over ESL? It is an interesting idea to try but for now I don't have any clue how it could be<BR>
done over Java ESL without touching or modifying detect_speech APP codes.<BR>
<BR>
Thanks again!<BR>
<BR>
Best regards,<BR>
<BR>
Xing<BR>
<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: freeswitch-users-bounces@lists.freeswitch.org<<A HREF="mailto:freeswitch-users-bounces@lists.freeswitch.org">mailto:freeswitch-users-bounces@lists.freeswitch.org</A>> on behalf of Christopher Rienzo<BR>
Sent: Tue 7/31/2012 13:44<BR>
To: FreeSWITCH Users Help<BR>
Subject: Re: [Freeswitch-users] Am I using play_and_detect_speech correctly?<BR>
<BR>
I looked over the code again last night and verified that<BR>
play_and_detect_speech should try to stop detection before loading the<BR>
grammar. However, that scenario is not really tested, so try the<BR>
workaround first. If that doesn't work, open a jira ticket with detailed<BR>
logs so it can be fixed.<BR>
<BR>
You can use the detect_speech APP to do everything over ESL. It is a lot<BR>
more work, but once you figure it out, you have the freedom to do whatever<BR>
you want, including handling barge-in. play_and_detect_speech is designed<BR>
to handle the typical use case.<BR>
<BR>
Chris<BR>
<BR>
<BR>
<BR>
On Tue, Jul 31, 2012 at 3:59 AM, x.liu <x.liu@hw.ac.uk<<A HREF="mailto:x.liu@hw.ac.uk">mailto:x.liu@hw.ac.uk</A>>> wrote:<BR>
<BR>
> Hi Chris,<BR>
><BR>
> Okay, thanks! I will have tries to see how it works.<BR>
><BR>
> For the normal use of the app: play_and_detect_speech, will it resume<BR>
> previous ASR session,<BR>
> or will it stop previous session and restart a new session each time when<BR>
> I issue it via ESL?<BR>
><BR>
> For the app of detect_speech, I can first to start an ASR session by<BR>
> "detect_speech speechMod grammar grammarPath",<BR>
> then I can do "detect_speech pause", or "detect_speech resume" or<BR>
> "detect_speech stop".<BR>
> But for play_and_detect_speech, I am not sure how it works in terms of<BR>
> starting, pause, resume/restart sequence.<BR>
><BR>
> The play_and_detect_speech is a very good, useful app as it supports the<BR>
> barge-in. So we definitely need to use it.<BR>
><BR>
> Thanks!<BR>
><BR>
> Xing<BR>
><BR>
><BR>
><BR>
><BR>
><BR>
> On 07/31/2012 12:53 AM, Christopher Rienzo wrote:<BR>
><BR>
> You are using that APP in a way that hasn't been tested. Try to do<BR>
> "speech_detect pause" and see if that helps. It will reserve your ASR<BR>
> session for reuse while "speech_detect stop" will tear it down completely.<BR>
> If that doesn't work, open a jira ticket and attach a full call trace.<BR>
> It's difficult to understand exactly what is happening from your<BR>
> description.<BR>
><BR>
><BR>
> Chris<BR>
><BR>
><BR>
><BR>
> On Mon, Jul 30, 2012 at 5:38 PM, Liu, Xingkun <X.Liu@hw.ac.uk<<A HREF="mailto:X.Liu@hw.ac.uk">mailto:X.Liu@hw.ac.uk</A>>> wrote:<BR>
><BR>
>> Hello,<BR>
>><BR>
>> I am using play_and_detect_speech with Java ESL in my IVR applications.<BR>
>><BR>
>> Previously I call it again each time after I receive any recognition<BR>
>> event,<BR>
>> like recognition complete, no-input-timeout, or recognition-timeout,<BR>
>> it seems to work fine.<BR>
>><BR>
>> Now I have changed my app to issue play_and_detect_speech command based on<BR>
>> my available system utterances as well as the speech event.<BR>
>><BR>
>> I.e., I use a separate thread to constantly check if there is a system<BR>
>> utterance coming in<BR>
>> from another component of my application, if there is any utterance I<BR>
>> issue the command which will<BR>
>> speak the new utterance and listen to user input no matter whether or not<BR>
>> previous<BR>
>> command has finished. And if there is any speech event (recognition<BR>
>> result, timeout etc.)<BR>
>> the play_and_detect_speech command is also issued but with playing<BR>
>> silence.<BR>
>><BR>
>> Obviously the new command will stop the utterance speaking of the<BR>
>> previous command if it is not finished.<BR>
>><BR>
>> My question is<BR>
>><BR>
>> will the new play_and_detect_speech command also stop the previous ASR<BR>
>> listening<BR>
>> or will there be many ASR listening channel and sending speech data (or<BR>
>> silence) to ASR server?<BR>
>><BR>
>> Do I need to explicitly issue a "stop" commnad before issuing a new<BR>
>> play_and_detect_speech?<BR>
>> If yes, how to do that, by "detect_speech stop"?<BR>
>><BR>
>> Recently there is a network traffice problem (lots of connections /data<BR>
>> transportation to the ASR server machine)<BR>
>> when I am running my application. I am not sure if this is because of<BR>
>> other issues<BR>
>> or because of my new changes to the way of using play_and_detect_speech.<BR>
>><BR>
>> Please any one could shed a light on this?<BR>
>><BR>
>> Many thanks!<BR>
>><BR>
>> Xing<BR>
>><BR>
>><BR>
>> ------------------------------<BR>
>><BR>
>> *Heriot-Watt University is the Sunday Times Scottish University of the<BR>
>> Year 2011-2012.*<BR>
>><BR>
>> We invite research leaders and ambitious early career researchers to<BR>
>> join us in leading and driving research in key inter-disciplinary themes.<BR>
>> Please see www.hw.ac.uk/researchleaders<<A HREF="http://www.hw.ac.uk/researchleaders">http://www.hw.ac.uk/researchleaders</A>> for further information and how<BR>
>> to apply.<BR>
>><BR>
>> Heriot-Watt University is a Scottish charity registered under charity<BR>
>> number SC000278.<BR>
>><BR>
>> _________________________________________________________________________<BR>
>> Professional FreeSWITCH Consulting Services:<BR>
>> consulting@freeswitch.org<<A HREF="mailto:consulting@freeswitch.org">mailto:consulting@freeswitch.org</A>><BR>
>> <A HREF="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</A><BR>
>><BR>
>> FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>
>> <A HREF="http://www.cudatel.com">http://www.cudatel.com</A><BR>
>><BR>
>> Official FreeSWITCH Sites<BR>
>> <A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A><BR>
>> <A HREF="http://wiki.freeswitch.org">http://wiki.freeswitch.org</A><BR>
>> <A HREF="http://www.cluecon.com">http://www.cluecon.com</A><BR>
>><BR>
>> Join Us At ClueCon - Aug 7-9, 2012<BR>
>><BR>
>> FreeSWITCH-users mailing list<BR>
>> FreeSWITCH-users@lists.freeswitch.org<<A HREF="mailto:FreeSWITCH-users@lists.freeswitch.org">mailto:FreeSWITCH-users@lists.freeswitch.org</A>><BR>
>> <A HREF="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>
>> UNSUBSCRIBE:<A HREF="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR>
>> <A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A><BR>
>><BR>
>><BR>
><BR>
><BR>
> _________________________________________________________________________<BR>
> Professional FreeSWITCH Consulting Services:consulting@freeswitch.orghttp://www.freeswitchsolutions.com<BR>
><BR>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Serverhttp://www.cudatel.com<BR>
><BR>
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://wiki.freeswitch.orghttp://www.cluecon.com<BR>
><BR>
> Join Us At ClueCon - Aug 7-9, 2012<BR>
><BR>
> FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users<<A HREF="mailto:listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users">mailto:listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A>><BR>
> UNSUBSCRIBE:<A HREF="http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org">http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org</A><<A HREF="http://lists.freeswitch.org/mailman/options/freeswitch-usershttp:/www.freeswitch.org">http://lists.freeswitch.org/mailman/options/freeswitch-usershttp:/www.freeswitch.org</A>><BR>
><BR>
><BR>
><BR>
> ------------------------------<BR>
><BR>
> *Heriot-Watt University is the Sunday Times Scottish University of the<BR>
> Year 2011-2012.*<BR>
><BR>
> We invite research leaders and ambitious early career researchers to join<BR>
> us in leading and driving research in key inter-disciplinary themes. Please<BR>
> see www.hw.ac.uk/researchleaders<<A HREF="http://www.hw.ac.uk/researchleaders">http://www.hw.ac.uk/researchleaders</A>> for further information and how to<BR>
> apply.<BR>
><BR>
> Heriot-Watt University is a Scottish charity registered under charity<BR>
> number SC000278.<BR>
><BR>
> _________________________________________________________________________<BR>
> Professional FreeSWITCH Consulting Services:<BR>
> consulting@freeswitch.org<<A HREF="mailto:consulting@freeswitch.org">mailto:consulting@freeswitch.org</A>><BR>
> <A HREF="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</A><BR>
><BR>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>
> <A HREF="http://www.cudatel.com">http://www.cudatel.com</A><BR>
><BR>
> Official FreeSWITCH Sites<BR>
> <A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A><BR>
> <A HREF="http://wiki.freeswitch.org">http://wiki.freeswitch.org</A><BR>
> <A HREF="http://www.cluecon.com">http://www.cluecon.com</A><BR>
><BR>
> Join Us At ClueCon - Aug 7-9, 2012<BR>
><BR>
> FreeSWITCH-users mailing list<BR>
> FreeSWITCH-users@lists.freeswitch.org<<A HREF="mailto:FreeSWITCH-users@lists.freeswitch.org">mailto:FreeSWITCH-users@lists.freeswitch.org</A>><BR>
> <A HREF="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>
> UNSUBSCRIBE:<A HREF="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR>
> <A HREF="http://www.freeswitch.org">http://www.freeswitch.org</A><BR>
><BR>
><BR>
<BR>
________________________________<BR>
<BR>
Heriot-Watt University is the Sunday Times Scottish University of the Year 2011-2012.<BR>
<BR>
We invite research leaders and ambitious early career researchers to join us in leading and driving research in key inter-disciplinary themes. Please see www.hw.ac.uk/researchleaders<<A HREF="http://www.hw.ac.uk/researchleaders">http://www.hw.ac.uk/researchleaders</A>> for further information and how to apply.<BR>
<BR>
Heriot-Watt University is a Scottish charity registered under charity number SC000278.<BR>
<BR>
</FONT>
</P>
<br>
<hr>
<br>
<font face="arial, helvetica" size="-1">
<b>Heriot-Watt University is the Sunday Times Scottish University of the Year 2011-2012.</b>
</font>
<br><br>
<font face="arial,helvetica" size="-1">
We invite research leaders and ambitious early career researchers to
join us in leading and driving research in key inter-disciplinary themes.
Please see www.hw.ac.uk/researchleaders for further information and how
to apply.
</font>
<br><br>
<font face="arial,helvetica" size="-2">
Heriot-Watt University is a Scottish charity registered under charity number SC000278.
<br>
</font>
</BODY>
</HTML>