[Freeswitch-users] Execute app in sync mode when using event sockets

Hector Geraldino Hector.Geraldino at ipsoft.com
Fri Feb 1 00:34:46 MSK 2013


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 at lists.freeswitch.org [mailto:freeswitch-users-bounces at 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 at ipsoft.com<mailto:Hector.Geraldino at 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 at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto:FreeSWITCH-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130131/9d078f0d/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list