The script is executing in the foreground and is being executed on your channel.

You cannot tell the channel to do something else because it's already running your script so
it can only run something else on top of it.

you have 2 choices:

1) use the socket app in async mode and external scripts with an ESL plugin.
2) instead of executing the script on the session launch a script in a sep thread with the current uuid
    ad an argument then execute park and let the script control the channel remotely

Even better reconsider what you want to do and avoid working against the grain of how the existing architecture is flowing and you will have the best results.
 


On Thu, Mar 18, 2010 at 3:02 PM, Tjardick van der Kraan <tjardick@vanderkraan.net> wrote:
Hi.

I'm trying to create a lua script but would like a certain task (music
on hold) to be 'backgrounded':

-- Loop while the call is active
while (session:ready() == true) do
   -- do something here
   session:execute("playback", moh)
   freeswitch.consoleLog("INFO","Started music on hold.\n");
   -- do some stuff while playing music
   session:sleep(30000);
  -- Maybe we need a way to stop music or playback will stop
automatically?
  session:execute("playback", "/sounds/we_will_answer_asap.wav")
  freeswitch.consoleLog("INFO","Play'ed announcement.\n");
end

"ofcourse" currently the only thin that happens is the music and my
loop does not continue.
Is there a way to start/stop music in the background?

I guess in Asterisk language i will need the command StartMusicOnHold...

Thanks for any suggestions.

Regards,

Tj

_______________________________________________
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



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900