Queues: Skip Busy Agents, call-limit or ringinuse

“Skip Busy Agents = Yes” does not work even if the agents have call waiting disabled by default. The agents are using SIP SJphone softphones and whenever they are on a conversation and another caller is in the queue, their phones ring.
Judging by the freepbx source code and http://www.freepbx.org/forum/freepbx/users/skip-busy-agents-causing-dropped-calls-on-transfer it seems that all “Skip Busy Agents” does is disable CW server-side. So if my agent extensions have CW disabled by default this won’t change anything behavior-wise.
The problem is that the SJphone softphone accepts multiple calls (always) so if the server doesn’t control CW when “in” the queue then the client softphone won’t behave as expected.

Asterisk 1.4+ has ringinuse=no in queues.conf which is not available in 1.2.

Both * 1.2 and 1.4+ have call-limit=1 which can be set for each agent extension so that they accept only one call at a time.

ringinuse is more flexible than call-limit as that would allow extensions with call waiting enabled receive only one call at a time from the queue.

Since I’m using 1.2.27 I’d want to use call-limit=1 since “Skip Busy Agents = Yes” seems to be failing in my setup.

I temporarily edited sip_additional.conf and added call-limit=1 to each agent extension and did a “sip reload”. At first it seemed to work as expected. After a while though, the agents stopped receiving calls from the queue even if they were not busy. The asterisk log showed messages like:

Mar 28 09:11:05 DEBUG[24676] chan_sip.c: Outgoing Call for 4012
Mar 28 09:11:05 NOTICE[24676] chan_sip.c: Call to peer ‘4012’ rejected due to usage limit of 1
Mar 28 09:11:05 VERBOSE[24676] logger.c: – Couldn’t call SIP/4012
Mar 28 09:11:05 DEBUG[24676] chan_sip.c: update_call_counter(4012) - decrement call limit counter
Mar 28 09:11:05 DEBUG[24676] chan_sip.c: Setting NAT on RTP to 524288
Mar 28 09:11:05 DEBUG[24676] chan_sip.c: Outgoing Call for 4013
Mar 28 09:11:05 NOTICE[24676] chan_sip.c: Call to peer ‘4013’ rejected due to usage limit of 1
Mar 28 09:11:05 VERBOSE[24676] logger.c: – Couldn’t call SIP/4013
Mar 28 09:11:05 DEBUG[24676] chan_sip.c: update_call_counter(4013) - decrement call limit counter
Mar 28 09:11:05 DEBUG[24676] app_queue.c: Everyone is busy at this time

(neither 4012 nor 4013 agents were busy)

So I had to remove call-limit=1 for each extension but a “sip reload” was not enough; I had to restart the Asterisk daemon.

Basically, my question is: does anyone have “Skip Busy Agents = Yes” working with softphones such as SJphone and * 1.2? If not, does someone know if call-limit is buggy in 1.2? I’m not ready yet to upgrade to 1.4 and use “ringinuse=no” (which, by the way, should be taken into consideration in future FreePBX releases)…

I filed a “bug report” here:


It’s a quick fix for “busy agents” for people running asterisk 1.4+.
It seems to work great.

  • 1.2 lacks this neat feature.

The problem is that the SJphone softphone accepts multiple calls (always) so if the server doesn’t control CW when “in” the queue then the client softphone won’t behave as expected.[/quote]
This is how almost all SIP phones work. The dialparties.agi script is what gates the calls if CW is disabled. Basically it checks the state of the destination extension and if it shows busy (meaning there is at least one call it is engaged with on the same server) then it will not attempt the next call. So it should work. (Or all sorts of other things will be broken). The ringinuse=no is a good one to add and we’ll take a look at it, but the lack of this is not the source of your current issues.

Thanks for the feedback.

Let me rephrase my first post since it was quite long.

I require that our SIP softphone agents receive only one call at a time (from any source). For example, if agent SIP/4012 is serving queue 4010 and is on the phone (InUse) then noone should be able to call that agent (not just for direct calls to 4012 but also from callers in the queue).

Dialparties.agi works great for direct peer calls, ie., if 4012 is on the phone (whether with a caller from the queue or someone else) and one tries to dial 4012, it will sound busy and reject the call. However, dialparties.agi (to my understanding) does not/cannot do anything once the Queue() application is running. So if 4012 is on the phone and more callers come in through the queue then 4012’s softphone will ring.

I’ve tested it in 1.4:
I set “skip busy agents” to yes and did not set ringinuse=no.
The queue member received multiple calls while busy if calls came from the queue (dialparties correctly flagged as busy calls going directly to the agent’s extension).
Then I set ringinuse=no and all works fine, ie. the agent can only receive one call at a time, whether from the queue (thanks to ringinuse) or elsewhere (thanks to dialparties.agi).

Please correct me if I’m wrong or overlooking something.

queue calls to extensions go through dialparites.agi, as they are all sent through channel Local. As a result, when the queue tries to send a call to the phone, the behavior should be just like if another extension tried to call that phone. That assumes that you are using normal agents and not trying to us agent.conf agents, which are not really supported but it is possible to get them to work.
If that is the case, then it would bypass dialparties.agi and suspect only ringinuse would have you desired effect. Is that the issue, are you using agents.conf agents?

it’s a matter of what you define as an agent. If the agent “Local/123” then it is just as FreePBX expects it, if the agent is “SIP/123” then it is not and further more, you will have other issues like subsequent transfers to voicemail failing and similar.

I am not using agents.conf. I do not define agents anywhere. I have a script running all the time which adds/removes queue members according to different conditions such as time of day, day of the week, available users, etc, etc.

This script calls {Add,Remove}QueueMember…

So I guess that these aren’t “normal agents” and require ringinuse.

I see.

My phpagi script now makes calls such as:

$status = $asm->QueueAdd(“4050”, “Local/[email protected]/n”);
$status = $asm->QueueRemove(“4050”, “Local/[email protected]/n”);

and I removed ringinuse=no.

The behavior is now what I’m looking for.

Thank you for the hint.

By the way, should I be using the /n option?

So, finally, I don’t know where ringinuse could come in handy.
However, it doesn’t hurt to set it.
Also, ringinuse might be more resource-efficient than running dialparties.agi each time an agent is being reached.
But it’s not something that’s worrying me.

So I won’t mind if you disregard my bug report.

Thanks for your time.

when you use Local/[email protected] for your format, and set ringinuse, does it still try to dial the call or is the queue able to tell that Local/4053 is busy through the hint? if setting ringinuse keeps the queue from even trying to dial then it is useful to add. If it does not, then it is not as useful although we may still add it since some people do use channel agent type agents which I’m guessing it may work with (we would have to test).

Here’s what I did:

  • enabled call waiting in freepbx for sip exten 4053
  • set “skip busy agents” to No in 4050 queue
  • reloaded freepbx
  • edited queue_additional and added ringinuse=no for the 4050 queue
  • from the *CLI I did a “reload”
  • executed a script which did: QueueAdd(“4050”, “Local/[email protected]”);
  • checked that everything was in place with a “show queue 4050”

I called 4053 directly, picked up the phone. Then I called 4050 but, alas, 4053 started ringing while in use. Of course, same thing happens if I call 4050, agent 4053 picks it up, then call 4050 again and 4053 rings while in use.

So ringinuse=no does not work with Local/. However, it does work with SIP/.

k - then it probably works with Agent/* also - so from what you describe, probably no harm and some benefit for putting ringinuse when that is set in case others have special applications and are not using the Local/* way that we do by default.

I’m having the same problem - is there a quick and elegant fix for this using the GUI using the same code for dynamic agents (xxxx* to login, xxxx** to logout), or do I have to add different code into the custom conf files? What is the recommended fix for this currently?

This is really weird, but i’m having the EXACT opposite problem!!

When an agent is busy talking on the phone and a call comes in, it sits in the queue waiting for the agent to be freed. Currently, there is no way for my agents to know that someone is waiting in the queue.

I’d like to change this, so when a second call comes in, the agents phone will show call waiting (along with caller ID information) so they know someone is in the queue.

So far, i haven’t been able to do this, even though the agents extension has Call Waiting enabled and the Queue has Skip Busy Agents set to No.

Any help would be appreciated.

pmathews: I never defined agents that could login/logout so I can’t say much about it but if you require ringinuse you will need to use * 1.4 and customize freepbx (http://www.freepbx.org/trac/ticket/2768)

newnewuser: I don’t know if this is the right forum section to post this but I think that your situation is due to the fact that your client hardware/software is rejecting multiple calls. So you seem to have it setup ok on the server but not on the clients. Just a thought.

vieri, thats what i thought at first, but when i set my IVR to directly call the agent, then call waiting works fine and the agent’s phone rights and displays the Caller ID information of the second caller.


IVR -> agent (call waiting works)
IVR -> queue -> agent (call waiting doesn’t work, call stays in the queue until agent hangs up)

is there another forum more suitable to my problem? i’d appreciate some help please.

there is a Call Waiting module in FreePBX, i’ve installed/enabled it but i don’t see any difference.

I’d try posting to the asterisk-user mailing list. Some users there also use freepbx/trixbox. You’d have to post your queue*.conf files and specify the clients you use.

it’s not a queues issues from the sound of it, unless they are doing something non standard (using agents.conf or other). The best thing to do is attach a CLI trace (verbose level 5) of the attempted call that is not behaving as it should and see if someone can provide some assistance. That or getting paid support to help them through it are both options.

Obviously I can’t add it in queue_additional.conf, because is a FPBX generated file. The other though is to edit the php file which is /admin/modules/queues/functions_inc.php

but, how do you add the code of the bug report? directly below the “function queues_add(…)” line?

I already did that… but after that, the line “set ringinuse=no” is not added anywhere in the queue_additional.conf file… even if I create a new queue, or reload changes in an existing queue or aything. Is there a service that i need to restart for the php to start generating the “set ringinuse=no” line?

I am using asterisk 1.4 and the latest freepbx version via PBX in a Flash.


You would add it using either queues_custom.conf or queues_post_custom.conf.

For more info please see: http://freepbx.org/configuration_files

fskrotzki, are you sure?

The reason I am asking this is because it looks like the ringinuse=no atribute must be inside of the queue specs. That is why people were trying to add it in to the functions_inc.php so everytime that Freepbx generates the code for the queue_additionals.conf the attribute ring in use was included.

Am I right???

i really wish it was as easy as you suggest fskrotzki… Please let me know.