Controlling what extensions can dial other extensions

I am configuring a small private PBX with extensions that can call each other (no ITSP involved.) What is the appropriate mechanism to use when configuring Asterisk if I want to have certain extensions be able to dial only certain other extensions?

For example: given extensions 10 through 19, I want 10 to be able to dial 12, 16, and 18, and I want it to be able to receive calls from 13-19.

I know I can make it happen by giving each extension its own context and writing up custom dial plans in extensions.conf, but I was hoping there was some more automated way to do this. Does something like that exist? Akin to an ā€œACLā€ but for extensions rather than IPs?

Thanks!

I think you are being confused by talking about the originator as an extension. For Asterisk it is a device. It might not have any extension number, or it might have many.

Contexts are the right way of doing this, as they are set for the device, not the extension.

It would be unusual for a real life organisation to require a context for every originating device. Also it is likely that several extensions could be treated the same, so they could be included as a context for that whole group, into other contexts.

It would be possible to do caller ID matches, to block specific callers to a particular extension.)

Gotcha ā€“ so ā€œendpointā€, ā€œdeviceā€, and ā€œoriginatorā€ are synonyms here, right?

It would be unusual for a real life organisation to require a context for every originating device.

I do agree; the person Iā€™m setting this up for is interested to have this much flexibility, though, so the infrastructure I build needs to be capable.

Thanks for the info!

You could create a rows in astdb containing ā€˜sourceā€™ and ā€˜destinationā€™ and then use the DB function to answer the ā€˜can source call destinationā€™ query.

Thanks ā€“ So the astdb is just key/value, right? (reading about it now) So I would do something like store a key of ā€œcallmap/3612ā€ with value ā€œ1ā€ or whatever, to indicate that 36 can call 12, and when a call comes in I can use DB_EXISTS to see if that key is present. Is that basically what you mean?

Iā€™d put a dash between the source and destination. It helps visually separate the S and D, and if you ever have to accommodate longer numbers or alpha, youā€™re set. It may come in handy if you ever need to use the CUT function since it is the default delimiter.

Iā€™d use ā€˜yesā€™ over ā€˜1ā€™ because it ā€˜reads betterā€™ and makes your intent more obvious.

family key value
callmap 36-12 yes
callmap chconnor-sedwards yes
1 Like