Trunk differentiate the number of incoming and outgoing communications [SOLVED]

I have a couple of cases where you are asked to me that the maximum number of outgoing calls is different from the number of incoming calls.

In the trunk configuration of FreePBX I’ve seen that you can specify the number of simultaneous communications but I do not think we can differentiate between the number of outgoing and incoming

Is there a way?

Solved! :

/etc/asterisk/extensions_custom.conf

[from-incoming-limit]
exten => _.,1,Set(GROUP()=limit)
exten => _.,n,Set(COUNT=${GROUP_COUNT(limit)})
exten => _.,n,NoOp(There are ${COUNT} incoming calls.)
exten => _.,n,GotoIf($[${COUNT} > 1]?denied:continue)
exten => _.,n(denied),NoOp(There are too many calls up already. Hang up.)
exten => _.,n,HangUp()
exten => _.,n(continue),Goto(from-trunk,${EXTEN},1)
;include => from-trunk

1 Like