VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
jbr at consiglia.dk Guest
|
Posted: Fri Nov 14, 2008 5:49 pm Post subject: [Freeswitch-users] Putting javascript to sleep |
|
|
I have worked on making a set of scripts and dialplans for a traditional queue, which rings the agents. I have published suggestions and ideas on the WIKI, but I’m still not satisfied with the solution. One of the challenges has been to emulate a sleep command as known in php and many other languages. I have solved it by creating a session for the sake of this, and run session.execute(“sleep”, 5000), but this solution pivots on the creation of the session, and it not very clean in my opinion. So my question is: are there any elegant ways of putting javascript to sleep in FS? /Jon |
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Fri Nov 14, 2008 6:02 pm Post subject: [Freeswitch-users] Putting javascript to sleep |
|
|
I believe this is a limitation in JavaScript. There is no "sleep" command or function, just some setTimeout kind of thing where you launch a function after a predetermined interval. I think with js you're stuck with an inelegant solution...
-MC
On Fri, Nov 14, 2008 at 2:42 PM, Jon Bruel <jbr@consiglia.dk (jbr@consiglia.dk)> wrote:
|
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Fri Nov 14, 2008 8:16 pm Post subject: [Freeswitch-users] Putting javascript to sleep |
|
|
we added our own msleep function to js
msleep(<milliseconds>);
On Fri, Nov 14, 2008 at 4:56 PM, Michael Collins <msc@freeswitch.org (msc@freeswitch.org)> wrote:
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
jbr at consiglia.dk Guest
|
Posted: Sat Nov 15, 2008 3:08 am Post subject: [Freeswitch-users] Putting javascript to sleep |
|
|
Thanks Anthony, the msleep function is really nice, but I have some problems getting it to work. Somehow it fucks up the system, which becomes unresponsive after I have run it in a javascript. Should I just wait for the next release, or do you want a more detailed error report through the appropriate channels? /Jon |
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Sat Nov 15, 2008 12:25 pm Post subject: [Freeswitch-users] Putting javascript to sleep |
|
|
i don't know what you are talking about exactly
i made this script test.js
for(x = 0; x < 10; x++) {
msleep(1000);
consoleLog("info", "ITERATION " + (x + 1) + "\n");
}
consoleLog("info", "DONE");
and did
jsrun /path/to/test.js
and it seems to work fine.
On Sat, Nov 15, 2008 at 2:05 AM, Jon Bruel <jbr@consiglia.dk (jbr@consiglia.dk)> wrote:
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
birgit at westhawk.co.uk Guest
|
Posted: Mon Nov 17, 2008 9:33 am Post subject: [Freeswitch-users] Putting javascript to sleep |
|
|
Hi all,
I noticed before that in order to sleep for 6 seconds I have to call
msleep(600);
and NOT
msleep(6000);
So I created the script
/usr/local/freeswitch/scripts/sleep6.js:
consoleLog("info", "sleep");
msleep(600);
consoleLog("info", "after 600");
msleep(6000);
consoleLog("info", "after 6000");
and when I run it
jsrun sleep6.js
I get the following output:
2008-11-17 14:25:08 [INFO] sleep6.js:1 console_log() sleep
2008-11-17 14:25:13 [INFO] sleep6.js:1 console_log() after 600
2008-11-17 14:26:01 [INFO] sleep6.js:1 console_log() after 6000
(I removed the prompt from the output for easy reading)
Cheers, Birgit
On 15/11/08 17:23, Anthony Minessale wrote:
Quote: | i don't know what you are talking about exactly
i made this script test.js
for(x = 0; x < 10; x++) {
msleep(1000);
consoleLog("info", "ITERATION " + (x + 1) + "\n");
}
consoleLog("info", "DONE");
and did
jsrun /path/to/test.js
and it seems to work fine.
On Sat, Nov 15, 2008 at 2:05 AM, Jon Bruel <jbr@consiglia.dk
<mailto:jbr@consiglia.dk>> wrote:
Thanks Anthony, the msleep function is really nice, but I have some
problems getting it to work. Somehow it fucks up the system, which
becomes unresponsive after I have run it in a javascript. Should I
just wait for the next release, or do you want a more detailed error
report through the appropriate channels? /Jon
|
--
-- Birgit Arkesteijn, birgit@westhawk.co.uk,
-- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK
-- Company no: 1769350
-- Registered Office:
-- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK.
-- tel.: +44 (0)161 237 0660
-- <URL: http://www.westhawk.co.uk>
_______________________________________________
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 |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|