Separate "offline" IVR when no one is connected?

Hello,

I’ll try to explain as good as possible:
We currently have a simple set up - when someone calls there is an annoucement and he lands in a menu (I guess the correct term is “IVR”) where he has two options: 1 sends him to a queue that rings all extensions (set as static agents). 2 sends you directly to a voicemail with custom voicemail announcement (directly recorded from the phone).

Now I want when no one is online (no phone is connected) that the user lands in a separate IVR with a different announcement that only has option 2 (sending him to a voicemail).

How would I do that?
I tried a few thing but they don’t seem to work.

Thanks!

It would require you to check the status of every device on the system before you routed them somewhere else. I’m not sure why you would need to do this. You can just set the queue if there are no agents logged in to send them to some place else.

But the queue comes after the IVR. And I want people to directly go to a separate IVR if no agent is connected, and don’t even send them to the main IVR at all.

Then you will need to write custom stuff that will do what you need. Check if there are registered contacts and do what you need based on that.

So freepbx can’t do that - send callers to another IVR if no agents are logged in?

Can it do it? Yes. Can it do it as is? No.

Alright, thank you!

A little custom dialplan could do this… The following with some tweaks would be added as the destination from your inbound route:

[app-queue-ivr-router]

exten => s,1(start),NoOp(=== Queue Member Check Router for queue 9001 ===)
exten => s,n,Set(MEMBERS=${QUEUE_MEMBER_COUNT(9001,free)})
exten => s,n,NoOp(Queue 9001 currently has ${MEMBERS} free members)
exten => s,n,GotoIf($["${MEMBERS}" > "0"]?has-members)
exten => s,n(no-members),Goto(ivr-1,s,1)     ; No free agents → alternate IVR
exten => s,n(has-members),Goto(ivr-2,s,1)    ; Free agents available → normal IVR
exten => s,n(hangup),Hangup()

Not a terrible solution but could become obnoxous to maintain if things change a lot. This would go in to /etc/asterisk/extensions_custom.conf otherwise it will be nuked on reload. change IVR and queue name.

I don’t think the OP wants there to be members free. I think he wants to detect a queue empty condition, of some sort. Also that particular function is deprecated in favour of QUEUE_MEMBER().

It doesn’t look like QUEUE_MEMBER() directly returns an indication as to whether there would be an immediate empty queue return, although it might be possible to combine the figures. Also I’m not sure exactly what it means by logged in, and there is a good chance that is not the same concept as a FreePBX user would associate with the term, so that would need checking, probably in the code.

(The exact conditions for empty queue conditions are configurable, e.g. you can include or exclude paused members.)

I’ll try to explain things a little better/in depth maybe that clears some things up:
We have a small online radio station (we are just 2 people) and use freepbx for our phone number used for our ocasional live shows.

We have 4 extensions: Me, my friend, an extra one and one used for a voicemail.
We connect to freepbx using a softphone app on our PC’s.

Our freepbx setup is fairly simple:
Caller calls → Announcement → IVR with two options: Option 1 goes to a queue with music that rings extensions 1, 2 and 3 (so all except the voicemail; there are set as static agents), option 2 goes directly to the voicemail.

Now I want that if no one is online (so none of us two has it’s softphone app open and connected to freepbx) the scenario to be: Caller calls → Announcement → different IVR with only option 2 (the voicemail).

Is that doable as is in freepbx?

Couldn’t you just add extension 1, 2, and 3 to a Ring Group? Set the timer to ring for however many seconds seems reasonable. If no one answers the call then the caller is then sent to another Destination. In this case it could be the voice mailbox extension. The voice mailbox greeting would essentially announce what you’d like to tell the caller.

Seeing that you are working with Queues and it sounds like you are looking for the caller to immediately be sent out if no one is logged in, this might not be a good fit. Just putting it out there as a possibility. :grinning_face:

Exactly, if no one is logged in it should directly go to the other IVR

I think the OP wants to avoid the caller explicitly saying they want to queue then being immediately thrown out of the queue to the voicemail that they originally rejected.

I haven’t checked on whether these options are supported by FreePBX, but Asterisk has a concept of an empty queue, which is one no agents currently active (you can select different detailed definitions). You can set the queue to do the check when the call is first added, or to check for the empty condition arising whilst the call is in the queue. However, there isn’t a direct method to check whether whether the queue is empty of members, without actually trying to enter the queue. The closest you could probably get is to set a very short timeout. That might just work if you have an initial announcement longer than the timeout, but I can’t guarantee that.

You’re overlooking what was just said by the OP. The agents are static, they are always logged in.

This goes back to what I said originally, you would need to see if there are any registered contacts to determine this.

So to recap, the OP isn’t looking for if agents are logged in or if agents are available to take calls. If none of the three users have their softphones active and registered to the PBX then send to this special IVR. This isn’t about the queue agents or their status, it’s about the endpoints and if they are registered.

Exactly. If none of our softphones are active, the caller should be send to that other IVR.

Anyways, thank you all for your input!

In the dialplan I did if the endpoints aren’t registered there will be no “free” agents, it should accomplish the desired task.

There will also be no free agents if all the agents are on calls. I believe the OP wanted the caller to be able to go into the queue, in that case.