ConnexCS ScriptForge

ConnexCS ScriptForge allows you to write ECMAScript 2015 (ES6) (aka Javascript) which is executed in a secure sandbox on the server. It is designed to be low latency and high throughput.

You can read more about how to find and use it here

Security changes for the deprecated runtime

The userspace database API and REST Knex driver have been removed. Knex remains an internal dependency for the runtime's own database queries.

cxRest.auth(token) now forwards the supplied opaque API token unchanged as a Bearer token. Calls using an email address to mint a symmetric JWT must migrate to an API token. All four REST methods use this authentication:

const api = require('cxRest').auth(process.env.CONNEXCS_API_TOKEN);
const customers = await api.get('customer');

The Deno REST bridge accepts the token as a string or {token: 'your-api-token'}. REST paths are restricted to the ConnexCS control panel API.

Sandbox require('axios') and its create() clients only connect to public HTTP/HTTPS destinations on ports 80 and 443. DNS answers are checked and the connection is pinned to a checked address, preserving TLS hostname validation. Redirects are rejected, requests have a total 60-second deadline including DNS, and responses (after decompression) and request bodies are limited to 10 MiB. There are currently no per-account port exceptions.

The sandbox client supports the callable Axios API, request, create, defaults, getUri, and the GET/DELETE/HEAD/OPTIONS/POST/PUT/PATCH helpers. Responses support json, text, and arraybuffer; streaming is disabled so size and duration limits apply to the complete response. Custom adapters, agents, transports, proxies, transforms, and interceptor hooks are not exposed. The direct https sandbox builtin is also removed. Host-side clients used by the runtime for its internal services retain their existing connectivity.

Run the security regression tests with npm test.

ESL listener binding

Set esl.bind in config.toml to listen on a specific local address:

[esl]
port = 7001
bind = "127.0.0.1"

IPv6 addresses such as ::1 are also supported. Omitting bind preserves listening on all interfaces. Restart the service after changing this setting.

Execution Types

Script

This is the fastest way to execute custom code and is "synchronous" execution. This should mainly be used for manipulations or calculations. It can not use libraries or work with Promises.

App

Feature rich applications which can include a preset (whitelist) of available modules, the penalty of the extra features is a slightly higher latency.

Driver

A driver works as an intemediary between ConnexCS and any external system. You can write drivers to bridge the ConnexCS DID provisioning system to a provider of your choice, or built more complicated alerts.

Example Applications

You can find our github repository for sample applications here

Use Cases

Below is a a short list of a few examples. However with a turing complete language, the possibilities are endless.

  • Do Not Call Lists
  • Custom Fraud Detection
  • Internal Automations
  • Capture and Process control panel and customer portal forms
  • Inbound & Outbound Call Filtering
  • Class 5 Programmable Voice Applications
  • DID Drivers
  • Time of Day Restrictions

Basics

Script & Apps (tipically) start with a main function the first parameter is (tipically) an object called data. In order to ensure that your application performs well, you should avoid doing anything which will make the execution last longer than 10 seconds (with the exception of Class 5 Programable Voice)

Class 4 Routing (Routes & DID)

After the routing engine has excuted its main function custom ScriptForge run last. It run presenting data as the output to the routing engine and expects the same object structure to be passed out. Use this with care as changes could affect the billing & stability of calls if not done correctly.

function main (data = {}) {
	// data.routing contains the same data you will find in the Logs
	// in the Raw Data Section
}

Class 5 Programmable Voice

The execution of the Programmable Voice script is done synchronously with the call. This means that (for example) you would initially run an await answer(), it would not progress to the next line untill our platform has finished executing the operation.

IMPORTANT - Ensure that ALL async functions are executed with await, otherwise the system will loose the synchronised state with your script and the connection will crash.

Second parameter is a ctx object

function main (data = {}, ctx) {
	// ctx contains class 5 ctx object 
}

Form Submission

Used to receive data from Form Builder in ConnexCS, which can be displayed in the control panel or customer portal.

function main (data = {}) {
	// data contains object containing key/value pairs from the form. 
}

Driver

A driver is a module export and can contain a number of pre-defined functions dependant on the integration, flow is an example for DID Driver.

module.export = {
	search: async function ({number}) {
		// Returns Array of Objects, e.g [{did:'1234'}]
	},
	allocate: async function ({did}) {
		// The information returned by this function will be passed to 
		// https://api-docs.connexcs.com/#api-Did-Create
	},
	release: async function ({did}) {
		// Returns True / False
	},
	list: async function () {
		// Returns Array of Objects, e.g [{did:'1234'}]
	}
}