You have to run the script within FreeSWITCH from the dialplan using the 'javascript' application in mod_v8, see https://freeswitch.org/confluence/display/FREESWITCH/mod_v8. That provides some extra objects and interfaces such as the Session object that you won't have defined if you're running it as a shell script. On 13 May 2016 at 14:47, Nduwayezu, Joselyne <35633@heb.be> wrote:
Hello,
How do you write script in javascript when you want to invoke it in the dialplan?
I tried this:
#!/usr/bin/js
session = new Session ("sofia/external/xxxx@yyyy.fr"); session.waitForanswer(10000); if(session.ready()) { session.sleep(1000); session.streamFile("path to the file");
But when i execute it, i get the error: ReferenceError: Session is not defined
How can i fix it?
NDUWAYEZU Joselyne
Haute École de Bruxelles _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
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