The description of Call#controllers is as follows:
# @return [Array<Adhearsion::CallController>] the set of call controllers executing on the call
I filed a pull request a few years back because this description led me to believe that controllers should be removed from this array once they have finished executing. It didn't get merged in the end.
What I didn't notice at the time was that controllers are not even added to this array when they are executed with invoke. Despite the existence of unit tests concerning multiple registered controllers, I cannot see where more than one would normally be registered. The register_controller method is only called from CallController#execute! and this is generally only used for the initial controller instantiated by the router. Was it accidentally missed for invoke?
In my case, I have an asynchronous CPA detector that needs to stop all components but by the time this triggers, the call has already moved onto a different controller. I can probably find a way around this but it would be handy if this just worked.
call.controllers.each(&:stop_all_components)