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
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 <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
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@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 _______________________________________________ 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
You could use mod_fifo with the chimelist configured and avoid trying to replicate this manually. you can certainly do it from ESL because you have a socket connection to the channel and all the commands you send will be in the background. On Thu, Mar 18, 2010 at 4:02 PM, Tjardick van der Kraan < tjardick@vanderkraan.net> wrote:
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@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 <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900 _______________________________________________ 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
_______________________________________________ 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 <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
participants (2)
-
Anthony Minessale
-
Tjardick van der Kraan