Limit only incoming calls from trunk

I want to limit only calls FROM trunk and not to limit calls TO trunk. Is this config enough for that?

[isp]
call-limit=20
type=peer
host=10.20.30.40
context=from_isp
disallow=all
allow=g729,alaw
qualify=no
nat=no
canreinvite=no

call-limit= parameter limits the maximum ammount of ALL (incomming and outgoing) calls for a sip peer.

So your feature can not be implemented so simply. I think you will have to use a AstDB and clever dialplan scripting to achieve what you want.

You need to use groupcount for this
heres a snippit of what to do

exten => s,n, Set(GROUP()=OUTBOUND_GROUP)
exten => s,n, GotoIf($[${GROUP_COUNT(OUTBOUND_GROUP)} > 4]?Exceeded); goto Exceeded if moe than 4 call?

Exceeded will do what you want to the call when its over 4 otherwise he call carries on in the dialplan.

Now returned to this trouble again and see this brilliant solution.

This can limit calls by any criteria! Cool!