Summary:ASTERISK-10706: call limits not work as expected (limitonpeer, busy-level)
Reporter:pj (pj)Labels:
Date Opened:2007-11-07 05:05:54.000-0600Date Closed:2007-11-19 12:33:26.000-0600
Versions:Frequency of
Description:probably most wanted scenario is to let users place unlimited number of outgoing calls from their sip phones (to be able to transfer etc.), but indicate busy condition for calls to their phones, when one call already exist (no matter if incomming or outgoing).
to achieve this, I set 'limitonpeer=yes' in [general] to be able to limit only outgoing calls from asterisk to sip device (peer from asterisk perspective, incomming call from sip phone perspective) and set call-limit=1 in type=friend phone definition.
but seems, that limitonpeer=yes is actualy not working, because from sip phone I can place only single call, so limited is also 'user' part in asterisk phone definition.
I tried also set call-limit=2 and busy-level=1, but this permit call to sip phone, even if I have already placed call from this phone. I think that 'busy-level' should work or count calls fot both directions, to correctly indicate 'busy' condition if user already has call.


this shows, that even if I have 'limitonpeer=yes', limit is applied on both parts 'user' and 'peer'

sip show inuse
* User name               In use          Limit
324                       0               1
* Peer name               In use          Limit
324                       0/0/0           1

sip show settings
 Call limit peers only:  Yes

text from sip.conf.sample
;limitonpeer = yes              ; Apply call limits on peers only.
Comments:By: Eliel Sardanons (eliel) 2007-11-07 08:32:27.000-0600

I think that limitonpeer is just a workaround to use a single structure to store the call-limit  of a peer or a user and prevent weird conditions while putting a call on-hold or other rare situations that block the peer/user and doesn't decrement the call-limit on hangup. If the call is incoming or outgoing and limitonpeer=yes it will be check call-limit only in the peer structure.

By: Olle Johansson (oej) 2007-11-19 03:02:56.000-0600

busy-level is just for signalling to subscribers, not used in the dial plan for dialling out to the peer. For controlling that, you better use the dialplan functions (groupcount etc) for control.  The call limit is enforced in the dial plan.

We might want to add busy-level to the sip_peer() dialplan function, so you can use that to enforce busy-level in the dialplan.

By: Olle Johansson (oej) 2007-11-19 03:08:51.000-0600

Committing a patch to svn trunk. If that solution doesn't work for you, please re-open this bug report. Thanks.

By: Digium Subversion (svnbot) 2007-11-19 03:10:10.000-0600

Repository: asterisk
Revision: 89406

U   trunk/channels/chan_sip.c

r89406 | oej | 2007-11-19 03:10:09 -0600 (Mon, 19 Nov 2007) | 9 lines

Adding busy-level to the SIP_PEER() dialplan function.

With this, you can control the peer in the dialplan, so you avoid placing outbound
calls when the device has reached busy-level.
Reported by pj.

Closes bug ASTERISK-10706


By: Olle Johansson (oej) 2007-11-19 03:12:22.000-0600

Fixed in svn trunk, rev 89406

By: pj (pj) 2007-11-19 12:29:00.000-0600

Hi, thanks for patch, still some issues:
- to be consistent with sip.conf 'busy-level', shouldn't be also sippeer item called busy-level, instead of busylevel (or maybe change to busylevel in sip.conf)?
- why we can't use comma "," to separate arguments in SIPPEER, I think, that pipe "|" is now deprecated
- I think, it should work without need to GROUP_COUNT & SIPPEER busylimit checking, eg. when try to dial extension, where busylevel limit is reached, simply do not call this extension
- if I make call FROM sip phone (ie. asterisks friend user part), 'sip show inuse' still shows zero in 'in use' column of 'user' configuration part
* User name               In use          Limit
324                       0               2
instead calls are counted in 'peer' section,
when I make call FROM phone, it shows:
* Peer name               In use          Limit
324                       1/0/0           2

- 'limit 2' is still displayed in 'user' part, even if I have 'limitonpeer=yes' in sip.conf

when I have one call FROM sip phone and make concurent call TO phone, 'sip show inuse' displays:
324                       2/1/0           2
but after hangup it displays some weird values, even if phone s idle, like:
* Peer name               In use          Limit
324                       -1/0/0          2
it can be repaired, only with restarting asterisk

By: Olle Johansson (oej) 2007-11-19 12:32:29.000-0600

- I think, it should work without need to GROUP_COUNT & SIPPEER busylimit checking, eg. when try to dial extension, where busylevel limit is reached, simply do not call this extension

That's not a bug, but a feature request. I don't agree.

You're mixing several bug reports into one. Please report each bug in a separate report and let's stick to the topic of this bug report - the busy level. I've added a fix so you can make this happen in your dialplan. The other bugs needs to be reported separatedly with proper log files. THank you.