Rate this page:


Routing is required to tell the platform which scenarios should be executed when a call has arrived at the platform or the StartScenarios API method is called. Routing is done with the help of Rules. The most important thing to remember here is that If you don't have a rule, your scenario code won't work.

Creating Routing Rules

Any incoming call has two numbers associated with it: "caller ID" - the number of a person that made the call, and "dialed number". In case of an incoming call, Voximplant will execute scenario(s) associated with the first rule, in which a regular expression "pattern" matches a "dialed number".


Please note that the pattern is relevant only in case of inbound calls to the platform.

Pattern is a regular expression that a dialed number is checked against. The default .* pattern means that the rule executes your scenario on any call. +?[1-9]\d{1,14} pattern matches any phone number, 123.+ matches 1234, 12356, etc., and so on.

If multiple scenarios are assigned to one rule, they are executed one after another in a single context, allowing common JavaScript code reuse. A new rule can be created by switching to the Routing tab of an application and either by clicking Create in the center of the screen or New rule in the upper right corner.

This will open the New rule editor where the rule name and JavaScript scenarios for call processing can be specified. The Available Scenarios dropdown contains the list of all scenarios that can be added to the Assigned Scenarios list.

The same rule can be used in case of launching application scenarios via the StartScenarios API method to initiate an outbound call from the platform. In that case, AppEvents.CallAlerting won’t be fired.


If a call arrives into the platform and the destination number matches more than one rule then the first matching will be used.

Forcing a Rule for a specific number

There is another option available for routing of inbound calls, a specific Rule for call processing can be specified in phone number settings, if the number is attached to an application. This number-assigned rule will automatically be assigned for incoming calls and any other matching rule will be ignored. Click on the dot menu button and choose Edit. The routing rule can be specified in the Edit number form.

The same routing option is available for SIP registrations attached to an application.

Learn more about routing rules:

Now, when you know basic concepts of the platform related to call processing, feel free to check our Programmable Voice or Programmable Video sections.