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

Hector Geraldino Hector.Geraldino at ipsoft.com
Thu Jan 31 22:18:41 MSK 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130131/6a579ccb/attachment.html 


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