[Freeswitch-users] Issue with Javascript setTimeout

Normando Hall nhall at unixlan.com.ar
Mon Jan 25 08:53:07 MSK 2016


Hello everybody.

I am coding a js script to do somethings, and I want to add a global
timeout, to call a function to play a file and hangup. But the function
called inmediatelly.
Also tested with setInterval, the same behaviour.


function playTimeout(despedida){
    if (session.ready()) {
        logger("TIMEOUT");
        session.execute("playback", sonidos + "/TIMEOUT.wav");
        session.execute("sleep","500");
        logger(despedida);
        session.execute("playback", sonidos + "/" + despedida + ".wav");
        session.hangup();
    }
    exit("TIMEOUT");
}


setTimeout(playTimeout(despedida),120000);
.
.
.
my script continue

Any help is welcome!

Thank you
Normando




Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list