Directional call limitations


I wonder if there somehow is possible (in Asterisk 1.4.21) to limit the amount of incoming calls to just one, but allow my phones to make multiple outgoing calls?

It seems the older version of Asterisk (1.2.X) had a: incominglimit and a: outgoinglimit setting, but those are now days deprecated and removed or has a equal function to: call-limit.

Any hints on how I can accomplish this are welcome or if this question already has been answered in a previous post, just point me the right direction, thanks!

You can always get creative and write some dialplan magic with global variables. Each time a call comes in or out you can change this variable. I would tag it as an incoming or outgoing call and then add and subtract to the call count of the phone. You can add as a call comes to the phone and delete on the hang up extension.

I don’t think sufficient locks are applied to prevent race conditions losing an update to the count.

You can always use an agi with mysql but that may be over doing it.

Thanks for all your answers, I might however have found a different solution from a back ported function/feature from 1.6 called: func_devstate and can be found on the following url:
or if you are running a:

What I’ve done is to monitor the state of the phone, with something like this before I attempt to Dial():

(I’m using AEL2 syntax)

} else


I’ll try this out on a small group of people tomorrow, hopefully no major issues or problems will arise from the implementation of this backport :smile:

Hi the backport works well and Is perfect for what you want to do


I have the same problem. But i have found the tip to use the GROUP / GROUP_COUNT to count the number of calls.
But i have not ound any really good examples of this use.

I want to check for number of calls before ai accept incoming.
I have several problems.

How to set GROUP(ext)=“call from” on one part of the call channel pair and
and GROUP(ext)=“call to” on the other part of the call channel pair.

if i set this before a call it will limit my nr of incoming calls. BUT if i transfer this call my line will not be free for calls until the transfered call ends.

anyone that can help me?

i tried this test code:

exten => 232,1,GotoIf($[${GROUP_COUNT(henrik)} >0]?bussy:)
exten => 232,n,Set(GROUP()=henrik)
exten => 232,n,Dial(SIP/232,60,rtk)
exten => 232,n(bussy),Busy()

another thing i tried was to use Dial with option G to get my hands on the two channels:

exten => 238,n,Dial(SIP/238,60,G(testgrupp^s^1))


exten => s,1,Goto(lbl_1)
exten => s,n,Goto(lbl_2)

exten => s,n(lbl_1),Set(GLOBAL(FR)=${CHANNEL})
exten => s,n,Set(GROUP(${CALLERID(num)})=1)
exten => s,n,Goto(lbl_3)

exten => s,n(lbl_2),Set(GLOBAL(TO)=${CHANNEL})
exten => s,n,Set(GROUP(${CALLERID(num)})=1)
exten => s,n(lbl_3),Bridge(${GLOBAL(FR)},${GLOBAL(TO)})

This is superunstable it might work but not always and using globals in this way cant be good at all.

Has someone done anything similar?