[Help Needed] Building IVR System with Twilio + FreePBX + Node.js Backend

Hi everyone,

I’m currently working on building a complete IVR (Interactive Voice Response) system with the following goals:

  • Receive incoming calls on a Twilio number
  • Route calls dynamically based on IVR flow stored in PostgreSQL
  • Allow agents to make outbound calls
  • Manage IVR flow and logic using Node.js (with ARI)

Here’s what I’ve done so far:

:white_check_mark: Purchased a Twilio phone number
:white_check_mark: Set up Asterisk + FreePBX server
:white_check_mark: Built a Node.js backend that uses Asterisk ARI to handle call logic
:white_check_mark: Created API endpoints to store and retrieve IVR flows (using PostgreSQL)


:red_question_mark: What I Need Help With:

  1. How do I connect the Twilio number with Asterisk/FreePBX for inbound calls?
  • Should I use SIP trunking?
  • Do I need to register a SIP domain with Twilio and route it to Asterisk?
  • How can I ensure incoming calls reach the Stasis() application?
  1. Once the call reaches Asterisk, how do I trigger my Node.js logic using ARI?
  • I’ve registered my ARI app (ivrapp) and listening on StasisStart, but it’s not receiving events yet.
  • What dialplan or context config is required to ensure the call enters Stasis(ivrapp)?
  1. How to allow outbound calls for agents via Asterisk (using Twilio or any other SIP trunk)?

For anyone reading this, it is also on the FreePBX forum: