FreePBX – COVID19 Helpline with remote agent access

I have been recently asked to help in a project to create a centralised helpline to support people in the Pitlochry and Moulin district that need help with their routine chores, while forced to stay home during the Coronavirus lockdown.

Collect their prescriptions from the chemist, bring a pint of milk and a loaf of bread and other minor chores.

The task wasn’t that simple, because the requirements were these:

  1. A single front facing number for the local area;
  2. A predetermined list of “helpers” personal phone numbers with the ability to make themselves available in autonomy;
  3. Management of incoming calls to avoid congestion;
  4. Automatically open and close according to a schedule;
  5. Robust audit.

Most of these features are an easy point-and-click job with FreePBX. A Queue and some Time Conditions will satisfy most of these requirements.
But number 2 was a sticky point. How can I allow an external agent to log-in to a queue?

And yes, I did “google” it. Some of the solutions required writing a specific dialplan where to point the external agents, or even writing an AGI script.

The risk to open a can of worms with unexpected bugs and unforeseen conflicts was too high for a service that – while not vital – had a degree of mission critical flavour. So I choose to stick with FreePBX inbuilt functions and features.

Now that the system is up and running, I’d like to publish the recipe I’ve concocted, so others struggling with this can build it with just a bit of patience on the FreePBX GUI. Stick with me because the method is a bit complicated but fairly repetitive. Once you get the hang of it it gets quite easy.

A quick look at the dialplan code created by FreePBX for the Queue Agent Login Toggle gave me the knowledge, inspiration and tools to make it happen.

Now, this is what you need:

  • A list of predetermined numbers of the volunteers that will be called;
  • A FreePBX with the following modules installed and enabled:
    • Extensions (!)
    • Follow Me
    • Misc Destinations
    • Queues
    • Set Caller ID
  • Time and patience.

We are building the stack in reverse, as those of you that work with FreePBX know we must.

Step 1

For each of the numbers in your list, create a Virtual Extension with Follow Me enabled and the following parameters changed from the default:

  • Initial Ring Time: 0;
  • Follow-Me List: the phone number of the volunteer, followed by #.
    Remove the extension number from the list.


  • Create them in a sequence (I started with 3001 onward);
  • Note the association between each phone number and the extension you are creating.

Step 2

Create a Queue, with the settings you prefer, and in the Queue Agents tab, Dynamic Agents field, add from the Quick Select drop down all the virtual extensions you created.

Please be careful that when no agents are logged in, the queue will behave in different manners depending on the settings you choose in the Capacity Options tab.

The default settings allow callers to enter the queue even if no agents are logged on, and will not kick out callers in the queue when the last agent logs out.

If you change any of these settings, including the Max Callers parameter, the caller failing to enter the queue or being kicked out after the last agent logs out will be sent to the destination you choose in the Fail Over Destination on the General Settings tab.

Step 3

Create a Misc Destination as follows:

  • Description: External Agent Queue Login/Logout
  • Dial: *45*<queue number>

For clarity, you must replace <queue number> with the number you assigned to the Queue you created in Step 2.

Step 4

For each of the volunteers calling in to register, create a Set CallerID destination with:

  • Description: the phone number of the volunteer (just as a reference, can be anything);
  • CallerID Name: Leave as default;
  • CallerID Number: the number of the Virtual Extension you created in Step 1 associated with their phone number;
  • Destination: the Misc Destination you created in step 3.

Step 5

Again, for each of the volunteers, create an Inbound Route that recognises their CallerID and directs the call to the corresponding Set CallerID destination you created at Step 4.

Simply enter in the CallerID Number parameter the phone number of the volunteer.

Verify in which format your VoIP provider is passing you the CallerID. As dialed? E.164?

Step 6

Create a generic Inbound Route without a specified CallerID, so to send any other caller to the Queue you created at Step 2.
You can put intermediate steps before, like a Time Condition if you want to limit access to callers to specific times or days, and so on.

Click “Apply Config”.


Call the Helpline number from a telephone in the volunteers’ list: your PBX should respond with “Agent Logged On” and the number of the Virtual Extension assigned to that phone number.

Check in Reports > Asterisk Info > Queues that the Virtual Extension the Volunteer’s phone is associated with is now in the Members list.

Make a call from a phone not in the list, and it should go to the Queue and ring your Volunteer.

Call again from the same volunteer’s phone, and your PBX should respond with “Agent Logged Off”. Again, check in Reports > Asterisk Info > Queues and the Virtual Extension associated with your volunteer’s phone number should have disappeared from the Members list.

Closing remarks

I told you it was a bit convoluted, but it’s really only a point-and-click exercise, all done with standard FreePBX features.

This system is a bit rigid, inflexible and requires a degree of manual maintenance if and when a new Volunteer comes: you must create a new set of Virtual Extension, Set CallerID, Inbound Route and add the new Virtual Extension to the queue.

You can leave old Volunteers in the system, so you can recycle their Inbound RouteSet CallerID and Virtual Extension when a new Volunteer joins.

This rigidity however, guarantees you that nobody can join the Queue as an agent entering any digit sequence, as access to the login feature is hardcoded in a Misc Destination and nobody can dial anything on that number to get access to that feature.

Sure, someone could hack the system spoofing the CallerID of the volunteer and log in to the queue. All that would happen is that the queue would call the volunteer, not the foolish hacker.

Shameless Plug

If you found this post helpful, remember that we know FreePBX inside out. If you need any work done, any help getting it right, any guidance to avoid the pitfalls, drop us a note.

Bookmark the permalink.

Comments are closed.