[Freeswitch-users] moh background in Lua

Tjardick van der Kraan tjardick at vanderkraan.net
Thu Mar 18 13:02:31 PDT 2010


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




More information about the FreeSWITCH-users mailing list