See this thread for background: Checking Queue Caller Count with Dynamic Routes
Suppose you have a traditional Boss/Secretary arrangement where you want most calls to the boss to be intercepted by a secretary/admin assistant. The secretary acts as gatekeeper and has the ability to call the boss or transfer callers to the boss. And also suppose we have a select group of executives that can call the boss directly and bypass the secretary. If the accountcode is not already in use for accounting or pinsets, then one way we might do this is as follows:
Have a MIsc Application or virtual extension configured that everyone uses to call the boss.
Have the boss’ true extension be a secret. The boss’ CID Num Alias is set to the MIsc. Application.
For each extension that has the ability to call the boss directly, edit their extension, advanced tab and set the accountcode to ‘boss’ or whatever string you prefer. (A clever idea by @billsimon source.)
The Misc Application or virt extension goes to a Dynamic Route, and the dynroute is configured with Asterisk Variable, has substitutions disabled and this expression:
The above expression will return a 0 if there is no match, or a 1 if there is a match. You can then create dynroute destinations of 0 and 1 with the appropriate destination for each, one to the secretary and one to the boss’ true extension.