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

I wrote a complete VXML interpreter using ARI. In my opinion VXML is where chances are on any IVR related market. My point is, if you are just asking if your idea of running a json based ivr in Asterisk is possible, the answer is yes, it is certainly possible. How to do it is totally on you though. Perhaps you need to practice your Asterisk more?

1 Like

As jcolp said, if you are using ARI, you don’t need to put your JSON into the dialplan via ARA. Write your JSON to a database from your editor (no interaction with Asterisk needed for this part), read it when a call comes in with your ARI app, and walk the IVR flow in ARI. Implement all your IVR functionality in your ARI code. There’s no need for any dialplan, therefore no ā€œreloadā€ needed for changes. When you save changes to the DB the next call automatically gets the updated change.

I’ve done something very similar to what you’re wanting to do for the company where I work. A call comes into Asterisk and goes immediately to stasis in the IVR app. All functional parts of the IVR flow are in the ARI app, and each object in the JSON represents a block of the drag-n-drop IVR flow along with the links to next blocks. I wouldn’t exactly call it tree structured JSON tho since the flow can loop and there may be more than one path to a node of the IVR. I’d suggest you maybe think of it more like a state machine.

Write an ARI function for each functional block in your IVR. Then you just store what the block type is and what are the next block options based on the exit conditions in the JSON. The main function looks at the node type in the JSON and calls the corresponding function to process based on current call state or possibly take DTMF or voice input. In my case there’s a numeric reference assigned to each JSON object representing a block in the flow inside an encompassing IVR JSON object. Each function returns the next block number so i can pull that block info from the JSON to get block type and the next block links. Main part is just a for loop to walk the structure with a case statement for block type. You can track the call info as a structure/object you pass along to each function or assign info to channel variables, whatever as needed so that it travels with the channel.

In this design adding a new IVR function just takes adding a new block type/function to provide that functionality. So it is more or less modular.

Regards,
Ron

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.