SIGN UP
Navigation

VoxEngine

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 ES2018 functions there is a number of additional VoxEngine JS classes, functions and events available.

Core VoxEngine functionality is available via the global VoxEngine namespace:

VoxEngine.callPSTN("+71234567890", myVerifiedPhoneNumber);

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 810241024-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.
  • Timers and any other external resourses are not available for the application after the 'Terminating' event was triggered, but the application can perform one HTTP request to notify external system about the fact that session is finished.
  • Max 3 active HTTP requests. Exceeding requests are queued, up to a total HTTP requests limit. Before 'Terminating' event is triggered, 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 triggered, 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 call attempts. Both successful and failed calls are counted toward this limit. Exceeding calls will fail with 'CallEvents.Failed' event where 'code' is 403 and 'reason' is a description string like "Call limit reached". Use the "Call list" module for a big number of outgoing calls and the "Conference" module for a big number of participants in a single call.
  • Session is limited to a total of 10 “dialing” calls that are not answered yet at any given moment. Exceeding calls will fail with 'CallEvents.Failed' event where 'code' is 403 and 'reason' is a description string like "Call limit reached".
  • 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.
  • All call* methods trigger the Failed event with 480 code if there is no answer after 60 sec. The methods are: callConference, callPSTNcallSIP, callUser and callUserDirect.
  • Maximum size of content sending during call is 8192 bytes. It is applied to the sendInfo and sendMessage methods.

GitHub

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