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:
Less reliance on implementation and more portable code. Front of backend turns our structured JSON into more literal JSON. Back of backend turns JSON to TwML (for current implementation), or makes Asterisk calls (for old implementation), or something else.
Faster, just respond with pre-rendered TwiML when we can
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: