[Freeswitch-users] moh background in Lua

Anthony Minessale anthony.minessale at gmail.com
Thu Mar 18 13:19:11 PDT 2010


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 at 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 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
>



-- 
Anthony Minessale II

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

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100318/6706f74c/attachment-0002.html 


More information about the FreeSWITCH-users mailing list