Is there any way to trigger a longest-waiting-call check across multiple Asterisk servers?
I’m building a system with two Asterisk instances. There are multiple queues, and an agent may belong to several queues at the same time.
When an agent switches from paused to unpaused, both Asterisk servers detect the change and may try to route a call to that agent. However, I need only one call—the global longest-waiting call across all Asterisk servers—to be routed.
I previously solved this using a backend server:
-
The backend retrieves all waiting calls from all queues the agent belongs to (across all Asterisk servers).
-
It then determines the globally longest waiting call and unpauses the agent only for that specific call.
This approach works correctly.
Now, I’m considering a new method where the Asterisk servers communicate with each other.
For example, inside try_calling or somewhere similar, I want to call ARI/AMI or another mechanism to check whether the current waiting call is the longest across all Asterisk servers for that agent.
Does anyone have advice on which approach would be better, or how to implement this more cleanly?