How to Create a Dynamic IVR System with Tree-Structured JSON and ARA/ARI in Asterisk?

Hi everyone,

I am developing a dynamic IVR system where users can create their own call flows using a tree-structured JSON format.

My Goal:

  • Users can create dynamic IVR flows using a drag-and-drop builder (tree structure).
  • Convert this JSON tree into a working IVR dial plan in Asterisk using ARA (Asterisk Realtime Architecture).
  • Use ARI (Asterisk REST Interface) to strictly follow the IVR tree structure.

Problems I Am Facing:

  1. How can I dynamically generate and update the ARA dialplan based on the JSON tree structure?
  2. How do I ensure ARI strictly follows the tree structure in real-time?
  3. Is there a better approach to manage each user’s IVR flow using both ARA and ARI?

My Setup:

  • Asterisk 22 with ARI and ARA.
  • PostgreSQL for ARA and JSON tree data.
  • Node.js (TypeScript) with ARI for IVR logic.

You really have to pick one of those. Either you would convert it into dialplan, or you would write an ARI application that understands and does things - but ARI applications can not invoke normal dialplan applications, so you probably actually want dialplan.

I don’t really understand what you’re asking for otherwise. If you’re writing dialplan then Asterisk will do what you tell it to do in dialplan. Everything else is outside of Asterisk, and up to you to code and write.

I need to understand how to create a dynamic dial plan using ARA or a JSON data structure with ARI for a dynamic IVR application. My goal is to build a dynamic IVR system where each user can create their own IVR flow using a front-end call flow builder.

That’s an extremely broad general question.

What is a “user” in this context.

“user” is an individual or entity (such as a company or organization) who has access to the IVR (Interactive Voice Response) system and is authorized to create, modify, and manage their own IVR flow using the front-end call flow builder.

Which one should I use for dynamic IVR: ARI with JSON Tree Data or ARA with a real-time database and dynamic dial plan?

ARI can not invoke arbitrary dialplan applications. If you need that, then ARI is not a fit.

If you want to use existing dialplan applications and all the logic possible in dialplan, then use dialplan.

How can I update my dial plan dynamically? I cannot manually change it every time. I need to update it through the database. Is this possible?

If you want to do it dynamically then something you write has to take input (such as from this JSON thing you mentioned) and produce dialplan. This dialplan can either be stored in realtime dialplan (which means that if your database has issues Asterisk will have issues with every call going on) or it is written into extensions.conf (or included files in extensions.conf) and then Asterisk is reloaded (which means if your database has issues Asterisk will not be impacted).

Can you please guide me on how to achieve a dynamic dialplan configuration in Asterisk without requiring a reload, ensuring real-time updates? I need to connect a front-end call flow builder that provides tree-structured JSON data, and I want to convert this data to an Asterisk dialplan dynamically. I do not want any static configuration or frequent reloads.

If you have specific targeted questions or difficulties I may respond, but I won’t provide a guide for undertaking such an endeavour. I can’t speak for anyone else.

okay

On Monday 12 May 2025 at 14:04:52, aravindh-itgalax via Asterisk Community
wrote:

how to achieve a dynamic dialplan configuration in Asterisk without requiring
a reload, ensuring real-time updates?

a) what is your objection to performing a “dialplan reload” once the changes
you require are done? It doesn’t affect calls already in progress.

b) are you really sure you want real-time updates of your dialplan? Suppose
you want to modify something in the dialplan which involves 10 different lines
of code, maybe all in one context, maybe in several. I think it’s better to
be able to make all 10 changes and then tell Asterisk to “use this” rather
than make each change one after another and have Asterisk notice each one as
it happens, which may result in a broken dialplan, half-and-half between old
and new.

Antony.

–
Ich habe gerade ein Bier getrunken.
Jetzt habe ich kein Bock mehr :frowning:

I created a visual drag-and-drop custom call flow builder using JavaScript. It generates tree-structured JSON data. After I make a call, the call should execute based on my flow.

now I am currently using ARI

On Monday 12 May 2025 at 14:29:23, aravindh-itgalax via Asterisk Community
wrote:

I created a visual drag-and-drop custom call flow builder using JavaScript.
It generates tree-structured JSON data. After I make a call, the call
should execute based on my flow.

This doesn’t answer my question, and depending on how this JSON data becomes
an Asterisk dialplan, doesn’t address my point about half-done changes going
live.

Antony.

–
Neurotics build castles in the sky;
Psychotics live in them;
Psychiatrists collect the rent.

On Monday 12 May 2025 at 14:30:40, aravindh-itgalax via Asterisk Community
wrote:

now I am currently using ARI

So, in what way is this not a solution to your requirement?

Antony.

–
“In fact I wanted to be John Cleese and it took me some time to realise that
the job was already taken.”

  • Douglas Adams

okay thanks

I understand I will learn