Call Us Today! 877.742.2583




Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: FI-391: (some) old wiki links fixed

...

Expand
titleClick here to expand Table of Contents
Panel
borderColorlightgray
bgColor#f7f7f7
borderWidth1
borderStyledotted

Table of Contents
maxLevel3
outlinetrue
indent1em
excludeAbout
stylenone
excludeAbout
printablefalse

V8 Supersedes SpiderMonkey

...

Note

From commit b76233266931ca0b53f3bcc589277b972d714216 (January 14'th 2014) in git master, FreeSWITCH has support for the Google V8 JavaScript (ECMAScript) engine. This is provided from the module mod_v8. In current git master mod_v8 is the default JavaScript engine. mod_v8 is a drop-in replacement for mod_spidermonkey, so the old scripts should work as before. There are two differences though, the SpiderMonkey engine has support for built in classes XML and File; these classes are not available in the V8 engine. mod_v8 provides a different XML interface, you can read more about it here: Javascript XML. mod_v8 will publish similar functions as the File class, but this is still work in progress so check the status of that functionality.

...

  • Uncomment languages/mod_v8 in modules.conf in your src directory (make it always build and install v8)
  • Run 'make mod_v8-install' to make and install just the v8 module
  • Edit conf/autoload_configs/modules.conf.xml in your FreeSWITCH™ install directory to load mod_v8
  • Restart freeswitch

For database support you will need an additional module compiled and installed. See the mod_spidermonkey_odbc page for installation instructions.

...

  • freeswitch 

Execution of a script

There are two methods for script execution, via an API call jsrun and via an application javascript. When you use the API a default Session object is not created, as there is no call to associate it with. By default, scripts will be loaded from the {FS_ROOT}/scripts directory, you may override this by placing a / as the first character in Unix-like systems or a x:\ in Windows systems as the script name.

Application

From the Dialplan, you simply call it as an application similar to:

...

jsrun /path/to/some/script.js

Examples

...