[Freeswitch-users] Javascript and freeswitch

Steven Ayre steveayre at gmail.com
Fri May 20 02:45:19 MSD 2016


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 at 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 at 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 at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160519/c33c45bb/attachment.html 


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