[Freeswitch-users] Putting javascript to sleep

Birgit Arkesteijn birgit at westhawk.co.uk
Mon Nov 17 06:30:35 PST 2008


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:
> 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 at consiglia.dk 
> <mailto:jbr at 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 at 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>




More information about the FreeSWITCH-users mailing list