Purpose of Call#controllers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Purpose of Call#controllers

James Le Cuirot
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.

https://github.com/adhearsion/adhearsion/pull/517

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)

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Purpose of Call#controllers

Ben Langfeld-2
I know you asked me to comment here, but I have nothing conclusive I can say. It does appear to be some kind of mistake.

On Tuesday, 25 April 2017 15:29:24 UTC+1, James Le Cuirot wrote:
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.

<a href="https://github.com/adhearsion/adhearsion/pull/517" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fadhearsion%2Fadhearsion%2Fpull%2F517\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzxt6znV76DOvDeMCVTnzW8pAuaw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fadhearsion%2Fadhearsion%2Fpull%2F517\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzxt6znV76DOvDeMCVTnzW8pAuaw&#39;;return true;">https://github.com/adhearsion/adhearsion/pull/517

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)

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.