Skip to main content
Asterisk’s ARI (Asterisk REST Interface) exposes a WebSocket event stream and REST API that lets your application control call flow from outside Asterisk entirely. Unlike AGI, a single ARI application handles all concurrent calls in one process — making it better suited for high call volumes and dynamic routing logic. This guide uses the ari-client npm package.
Store your credential as an environment variable. Never hard-code hk_live_… tokens in source files, dialplans, or configuration files committed to version control. Use an environment variable (HUMAIN_CREDENTIAL) or a secrets manager and inject the value at runtime.

Prerequisites

  • Asterisk 18+ with the res_ari module enabled
  • Node.js 18+
  • A Humain device credential

Step 1 — Enable ARI in Asterisk

Edit /etc/asterisk/ari.conf:
Edit /etc/asterisk/http.conf to enable the built-in HTTP server:
Reload:

Step 2 — Create the Stasis application

Create humain-ari.js:

Step 3 — Dialplan entry point

Route inbound calls into your Stasis application:
Reload:

Step 4 — Run the application

You should see:
Place a test call. The console will log each stage of the call lifecycle.

AGI vs ARI — which should I use?

For most deployments, AGI is simpler to set up and maintain. Use ARI when you need to react to mid-call events, dynamically join or split bridges, or handle hundreds of concurrent calls in a single application.