VoxEngine Reference

VoxEngine is an application engine that runs your apps inside the VoxImplant cloud. Each call is processed according to call control logic written in JavaScript what makes VoxEngine an easy to use tool for web developers. In addition to standard ECMA5 JS functions there is a number of additional VoxEngine JS classes, functions and events available.

Some of them are part of the VoxEngine core that can be used without enabling additional modules, they are used almost in every scenario. Some additional functionality is available via modules that should be explicitly enabled by developers using require command.

VoxEngine Image

The decision about scenarios that should be executed during the call depends on the VoxImplant application rules. Learn more about VoxImplant Applications, Rules and Users in this article.

VoxEngine scenario example

VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
  // answer incoming call - e.call is instance of Call class
  e.call.answer();
  // add connected event handler
  e.call.addEventListener(CallEvents.Connected, handleCallConnected);
});

function handleCallConnected(e) {
  // Say greeting using built-in TTS
  e.call.say("Hello, you called Zingaya, please leave your message.", Language.US_ENGLISH_FEMALE);
  // Start recording audio after playback finish
  e.call.addEventListener(CallEvents.PlaybackFinished, startRecording);
}

function startRecording(e) {
  // Recording the call
  e.call.record();
  // Disconnect the call after 20 seconds
  setTimeout(VoxEngine.terminate, 20000);
}

VoxEngine Debugger

Since scenarios are executed by VoxEngine there is a way to debug them during the execution, it helps developers find problems faster. The debugger is available in VoxImplant Control Panel

VoxEngine session limits

In order to provide realtime execution speed, each JavaScript session has resource and actions limits:

  • Max 1000 users per account. Once the limit is reached, HTTP API will return error code 109 on attempt to create a new user. Contact us via support@voximplant.com to increase the user limit.
  • The unanswered incoming call is disconnected after 60 seconds.
  • Session without calls and without ACD requests is terminated after 60 seconds.
  • Session without calls and with at least one ACD request is terminated after 120 minutes.
  • JavaScript scenario size is limited to 256*1024 unicode chars.
  • JavaScript memory is limited to 16 megabytes.
  • JavaScript string length is limited to 8*1024*1024-1 unicode chars.
  • Callback execution time is limited to 1 second. This means that heavy computations should be moved to your own backends and accessed via HTTP requests.
  • Max 100 active timers.
  • Max 3 active HTTP requests. Exceeding requests are queued, up to a total HTTP requests limit. Before 'Terminating' event is emitted, VoxEngine will wait up to 90 seconds for active requests to complete and will call corresponding callbacks. Queued requests are silently dropped without any callbacks being called.
  • Max 35 simultaneous HTTP requests. This limit counts both active and queued requests. Initiating more requests will result in “Exceeded the HTTP connection count limit!” exception.
  • Max 2 active SMTP requests. Exceeding requests are queued, up to a total SMTP requests limit. Before 'Terminating' event is emitted, VoxEngine will wait up to 90 seconds for active requests to complete and will call corresponding callbacks. Queued requests are silently dropped without any callbacks being called.
  • Max 10 simultaneous SMTP requests. This limit counts both active and queued requests. Initiating more requests will result in “Exceeded the SMTP connection count limit!” exception.
  • Size of HTTP response handled by VoxEngine is limited to 2 megabytes.
  • Session is limited to a total of 50 incoming and outgoing calls. Exceeding calls will fail with 'CallEvents.Failed' event.
  • Session is limited to a total of 10 “dialing” calls that are not answered yet. Exceeding calls will fail with 'CallEvents.Failed' event.
  • Single SIP header field is limited to 200 bytes.
  • Calls more expensive than 20 cents per minute and calls to Africa are blocked by default for security reasons. Please contact us at support@voximplant.com to enable them. IMPORTANT: if this type of options was enabled for your account, then all child accounts created after it will have such options too.

GitHub

There are number of demos and examples available on our GitHub page