futel / dialplan-functions

Serves documents etc to Twilio for Futel
Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

Simplify rendering #58

Open kra opened 2 months ago

kra commented 2 months ago

The bulk of the IVRs is rendering from JSON to XML. Code reads JSON and eventually responds with TwiML. Simplify this code by reducing it to smaller transform steps. Instead of "read human workable JSON and decide what XML to output", transform in stages to more verbose JSON and then verbose XML.

For example, menu key list: JSON sequence of entries (key, label) => single JSON sequence of strings (key statement, label statement) => repeated JSON sequence of strings (N iterations of statements) => TwiML string

Probably add attributes so the renderer knows when to start and end.

Either transform the desired part of the document or have a sequence of walkers and tell them when to start and stop.

Motivations: