Asterisk/FreePBX – How to restrict an extension to call certain extension only

There may come a time that you want a public access phone that can only dial out a certain set of extensions. To accomplish this, a custom context needs to be created and applied to that extension.

Here’s the scenario.
Extension 312 is the public access phone. This should only be able to dial x530 & x555. All other calls needs to be terminated.

Define the context in extensions_additional.conf

[from-intercom]
exten => 530,1,goto(from-internal,${EXTEN},1)
exten => 555,1,goto(from-internal,${EXTEN},1)
exten => _.,1,hangup()

If FreePBX, go inside the extension and the context from from-internal->from-intercom. Apply the settings and you’re good to go.

5 thoughts on “Asterisk/FreePBX – How to restrict an extension to call certain extension only”

  1. I think you’ll find that you can still transfer to other extensions not listed in the context with FreePBX, so this can’t be considered a complete solution.

    1. Hi Kevin,

      Thanks for the response. I didn’t think of transfer situation. This was created for a scenario where there’s a public access phone to dial one or two locations. We could disable transfer options from the handset itself. I’ll have to check if asterisk’s transfer feature codes would still work as well.

      I’ll update this with my findings.

Leave a Reply

Your email address will not be published. Required fields are marked *