Limiting inbound (origination) calls

Was under the impression from the tool-tip in trunks for the field ‘Maximum Channels’ the number entered would limit the inbound calls using the context from-trunk-trunk-name in Trunk Sip Settings. Currently the Maximum Channels is set to 5 but as shown below, its not working.
CLI> core show channels
11 active channels
9 active calls

Is there any way to limit the number of concurrent inbound calls?

Did you change the context= setting to that context?

try core show channels verbose , Asterisk is a B2BUA so all calls will have at least an A and a B channel,so 9 ‘active calls’ will probably have less than your ‘maximum channel’ count

Controls the maximum number of outbound channels (simultaneous calls) that can be used on this trunk. Inbound calls are not counted against the maximum. Leave blank to specify no maximum.

Emphasis added.

The max channels field in the trunk config is only to limit outbound channels, and the limit can either include inbound channels or not.

1 Like

It was set already to context=from-trunk-sip-trunkname

And it is the only inbound trunk? There arent other trunks accepting inbound calls?

Yes its the only trunk.

Then we need to see debugs of inbound calls not being counted.

Hi Dicko,
core show channels indicated 9 active calls. Queue show queue# showed 8 calls holding and one active call. But the max channels is set to 5. For now I have limited max callers in queue but will have to fix the failover to be more gentle than it is right now.

I thought (incorrectly?) max channels = max calls (in+out) provided the sip trunk setting context is set.

Are there things like voicemail or other features being used. Because 9 calls and 11 active channels is sounding more like 2 two channel calls and 7 one channel calls.

Inbound route => queue. Failover => hangup Got to change that hangup… to abrupt. No voicemail or other goodies.

Perhaps use GROUP_COUNT for inbound calls?

Show a debug of this failing to track inbound calls.

This is how I do it, modify to suit your needs:

same => n,Noop(--------- Inbound call limiter check ---------)
same => n,Set(GROUP()=call_count)
same => n,Noop(----------------------------------------------)
same => n,Noop(Configured Call Limit: 50 )
same => n,Noop(Current number of calls, inc this call: : ${GROUP_COUNT(call_count)})
same => n,Noop(----------------------------------------------)
same => n,GotoIf($[${GROUP_COUNT(call_count)} > 50 ]?hangup())
same => n,Noop(---- Inbound call limiter check : PASS -------)
same => n,Noop(----------------------------------------------)

It’s strongly recommended NOT to use that, rather use from-pstn-xyz.

1 Like


If the OP decides to use the code, they can modify it as they see fit

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.