Queue/line status

Does FreePBX have a API or some other way for me to get the status of a queue/line? Right now we have for instance a tech support and a sales line and we sometimes close these for various reasons.

I want to be able to programmatically get the open/closed status to be able to send a notification in case we forget to open up the line again.

What do you mean “close”? can you explain please ?

There are no "API"s for Asterisk and FreePBX. We do have AMI (Asterisk Management Interface) and a couple other interfaces like it, but these aren’t Programming Interfaces, per se. You can also interact, under program control, with the Asterisk CLI - use it like you would any other interrogatory interface (ask question, wait for answer, parse answer, repeast).

With AMI and family, there are certainly ways to write programs that can do all sort of cool things, including what you are looking for.

There is also Commercial Queue management module that might do what you need. Check with Sangoma Sales for details and (perhaps) a test run to see if it works for you.

Not sure what the correct term is. But we close down certain lines, like sales, for incoming calls when we for example have internal meetings. So if someone tries to call during that time they just get a voice message saying we’re closed for the moment.

There are options in the queue setup that route calls for that queue to an alternate destination if no agents are logged into the queue. If your agents are dynamic, you can have them log out of the queue and the queue should roll the queue over to voicemail.

There is also a call routing module (which may be commercial) where you can set up a feature that routes calls for that queue to the queue when “Off” and to voicemail with “On”. You could even do it with a day/night selector, and just set the queue’s inbound to “night mode” when the queue is closed.

What we did for a scenario like this.

We used a call flow control:
Green = Primary Queue
Red = Ring Group.

The primary Queue is for normal use, all agents are added dynamically, so it’s their obligation to log in and out.
The ring group is for two other users who can take calls while the queue users are in a meeting or away.

Obviously: there’s a few users/managers who have the CFC BLF key on their phone to be able to control this.

Now, the queue is setup that is no agents are logged in, it should go to failover.
Failover is a custom destination that sends an email to a group of users with the text “No Agents Logged In - Call sent to Failover”. and then it goes to the mentioned ring group.

Hope that works for you…

Thanks for the suggestions but not what I’m looking for. I just want to be able with some sort of program to get the status of a queue, if it’s open or closed.

For instance if I could use fwconsole to get a status message of a certain queue I could then parse that using bash to give me a alert if the queue is closed inside business hours.

You still didn’t explain what you do to “open” or “close” the queue.
There’s tons of ways how to do that…

The queues do not “Open” or “Close”, it is the surrounding programing that determines if a call is in queue, like time conditions or call flow control. If you have logic setup based on agents being signed in and/or open, you can query that using the core show queue command from the Asterisk CLI, that will give you the signed in agents and their status (paused, etc.) for a queue.


Is that what you are looking for?

You might also be able to use the queue fail overs to trigger a custom context that alerts you somehow (send email, text, call, etc.). I believe this requires the Queues Pro commercial module.

Got some more information now. What we do when we want to “pause” or “close” a queue is that we call *279 which is how I understand it a macro which changes what is called time conditions.

So when we call it we enable a time condition and when we call it again we disable it. So what I want to is some way to find it if a certain time condition is active or not.

Does that information help in any way?


Two Options I can think of are:

  1. Add something to the macro that alerts you in the way you wish to be alerted.

  2. Under the Admin GUI: Reports>Asterisk Info>Subscriptions you will see a hint for the time condition *279 (you can use Ctrl+f to search for it). Right there you can see if it is “InUse” or “Idle”.

You could add this as a BLF hint to a phone, or build a script that scrapes this data from the Asterisk CLI using: core show hint

Thanks for your help! Managed to get the information with this command:

rasterisk -x "core show hints"

Only problem now is that I also need to check the time groups settings from the cli. So I know if we have an error there.

Does anyone know if I can get that information using the command line also?

Ok so I see now that everything is a timecondition that you can see using core show hints. Problem is they seem to have dependencies on each other. For instance we have a time condition that closes the phones some days during the year and it currently shows up as in use.

Building logic around these inuse or idle responses doesn’t really seem feasible. There isn’t any way to query freepbx to just check if an extension is accepting calls or not?

Question doesn’t follow.

If you have a time condition, it’s not there for an extension, it’s there for processing logic before the extension is ever queried. The extensions are all available to take calls at all times - the system decides (based on time conditions and other routing managers) whether to send to call to the extension. As such, just because it’s 9PM on Christmas, all the phones are ready to take calls, but no one is going to get one because the PBX is handling them.

Remember, calls don’t go from the outside world to a phone, they go to FreePBX/Asterisk (which talks to the world) and then are conferenced to the extension with F/A still in the loop.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.