[Freeswitch-users] moh background in Lua

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


Hi Anthony,

Thanks for the quick and detailed reply.

Could i pick your brain on the last remark, what i'd like to do is:

- play a configurable time of hold music (30 seconds in the example)  
but this will be a variable later
- play a message (and optionally detect dtmf if needed)
- if no dtmf then continue music

and loop the above.

So basically creating an inbound holding point for people to wait  
before their call is answered, but give them the option to leave the  
'queue' to direct them else where.

Would in the async ESL i be able to stop the stream of music or would  
i need to do a bridge to local/9999 and unbridge to continue when i  
want to? Would ESL be the best way to
do this ?

Thanks for the help so far.

Regards,

Tj


On 18 Mar 2010, at 21:19, Anthony Minessale wrote:

> 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
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org
> pstn:+19193869900
> _______________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100318/e4d12078/attachment-0002.html 


More information about the FreeSWITCH-users mailing list