Voximplant has a JS-based core called VoxEngine which processes calls on the basis of JS scenarios and works with the latest EcmaScript syntax. The scenarios are based on the event-driven model, which means that developers can easily manipulate calls and track all the changes during a conversation by subscribing to events.
To start using VoxEngine, perform the next steps:
sign up for a Voximplant account
in your account, go the Applications section and create a new one, e.g., firstApp
go to the created application, switch to the Scenarios tab
click on the plus icon, enter a name for a scenario and press Enter. This will open a new tab in the online IDE on the right. Now you can right source.
For example, you can answer a call and play audio in it. In such a case, you call the say method and send this generated audio stream to an incoming call:
Every attempt to start a call using Voximplant creates a new independent call session in VoxEngine.
- A session always starts with the Started event due to an incoming call or an HTTP request.
- The next event depends on what started a session: it would be the CallAlerting event in case of a call or the HttpRequest event in case of an HTTP request.
- Next, the CallEvents can be triggered during a session: when a call is connected or when it is put on hold, when call recording is started, and so on.
Normally, the session’s ending is executed in the next steps:
- The Terminate method is called in a JS scenario OR the Failed event is triggered if a call failed.
- The Terminating event is triggered. Timers and any other external resources are not available after this event was triggered, but you can perform one HTTP request inside the event handler (e.g., to notify an external system about the fact that session is finished). When that request is finished (or no such request was made)…
- …the Terminated event is triggered.
A session without calls and ACD requests is terminated after 60 seconds.
Source code reusing
Once you've created a JS scenario, its code can be used:
- on behalf of your child accounts (subaccounts). Each subaccount has access to the parent's scenarios.
- as a part of a chain of scenarios bound to one rule. See the details further.
Each Voximplant application has a Routing tab where rules should be created. Rules group scenarios within an application and provide a way to start one or more scenarios to handle a single session. You can assign more than one scenario to a rule; therefore, those scenarios will be executed one by one in a similar way as web browsers execute scripts mounted on a web page.