Separate the two connections
The incoming request asks for call instructions. A subsequent media connection carries audio for that call. Associate both with the same call identifier so a second caller cannot inherit the first caller's context.
Handle a change of mind
Imagine Cece is reading opening hours when a caller interrupts to ask about parking. A useful turn handler can stop pending playback and record which answer the caller actually heard. Test the change with a real handset.
Close the call cleanly
A hangup can arrive while a model is composing a reply. Stop work tied to the media connection and mark the call complete once. FIIDA’s CYOO service uses Node.js to connect Twilio’s telephone media stream to the configured voice model.
