That's too bad. Not sure what else you can do except maybe go into a loop after you send your execute command and then check every event that comes back and ignore everything until you get the execute complete event for the specific command you sent. If you have issued "myevents" that will be easier, but in any case you'll need to come up with a way to handle all that.
Or you could use ESL. :)
-MC
Well, I’m not using the Java ESL library but the Java ESL Client library (which doesn’t require the native libraries and is pure java-based).
Using this lib, when I send an execute command (using the SendMsg + execute: appName + execute-app-args: arguments) the thread isn’t being locked, so that’s my problem.
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins
Sent: Thursday, January 31, 2013 4:06 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Execute app in sync mode when using event sockets
Are you using the Java ESL library? If so it should have what you need to do sync vs. async on sending execute commands to the event socket. If you are not using ESL I would advise you to do so since it has solved this problem (and others) already.
More info here:
http://wiki.freeswitch.org/wiki/Event_Socket_Library
-MC
On Thu, Jan 31, 2013 at 11:18 AM, Hector Geraldino <Hector.Geraldino@ipsoft.com> wrote:
Hi,
I have a java app that uses mod_event_socket (inbound mode) to control FreeSWITCH. I can send api commands which, by default, are synchronous, so the thread locks until the command is successfully executed. The problem I’m facing is when I have to execute commands that are in other modules (like playback, or speak). As they are not api commands, I must send an execute appName + arguments, which by nature is executed in async mode.
What I want to achieve is to execute an speak command and wait until the TTS operation ends (blocking the thread). This sounds like a trivial use case: play some audio (TTS, file) and then execute the rest of the logic. It is easy to accomplish on the dialplan, but I just can’t figure out how to do it on an ESL application. Here’s what I’ve tried so far:
+ send execute speak command + api sleep and wait for the CHANNEL_EXECUTE_COMPLETE (to simulate a lock [sleep] and continue [break after event is received]), but the event arrives after the sleep command completes.
+ use uuid_broadcast uuid speak::args, doesn’t work
Any hints, ideas are welcomed.
Thank you!
Hector
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
--
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org