Merging Two Different Queues

We are working on an application that requires a user to support two incoming queue types - one is for PSTN calls and the other is for video calls. We’ve assigned extensions 5001, 5002, …, 5010 to the PSTN queue and extensions 6001, 6002, …, 6010 to the video queue.

So, essentially, each user has been assigned two extensions. For example, we have the following assignments:

  • user1 => 5001/6001
  • user2 => 5002/6002

Right now, we’re using an AMI QueueSummary action to determine which queue has the longest hold time so we know which call to answer next. Our initial cut at this is working, however, we are wondering if there is a better way. We are maintaining state (e.g. queue status (paused/unpaused), user status), but, it diverges from Asterisk at times. This is causing some problems. One of the issues we’ve encountered is that if both queues are unpaused, a user can receive two calls simultaneously.

Is there a way in Asterisk to essentially merge these two queues into a single queue containing all of the incoming calls in arrival order? Doing this would allow us to unpause a single queue, knowing that the oldest call would be at the front of the queue. This would also allow us to treat both types of queues as a single queue, and, we wouldn’t need to add queueing logic to our application.

I appreciate the help.