Inbound calls match specific number in Phonebook then ring specific Extension

Hi, folks.

I am scratching my head with this requirement, any clue / hints are very welcome.

The environment: Typical contact centre

The job to do: From specific VIP customer we want to always be a attended by the same Customer service lady. An example:

inbound 11111111 -----> ext 2020
inbound 2222222 -----> ext 2030
inbound any number ----> ring group of contact centre (Customer service)

That sound technically something like this:

Check the inbound calls numbers against the DB maybe Phonebook of FreePBX?, and if the number matched ring the specific extension.

Do you have any idea how to approach to do this. ?

Daniel W

I think the setting you want is in Inbound Routes. You can set the CallerID Number. The hover help reads:
Define the CallerID Number to be matched on incoming calls.

Leave this field blank to match any or no CID info. In addition to standard dial sequences, you can also put Private, Blocked, Unknown, Restricted, Anonymous and Unavailable in order to catch these special cases if the Telco transmits them.

1 Like

That is true, but is unwieldy in a large sense. Earlier in the year, we had a spirited and code-full discussion about using a custom inbound context to do this, or something very much like this. In the context, you search a name->value database (like in ASTDB or MySQL) to get the extension to match against the incoming CID. On match, you set the extension value and off you go. If you don’t find it, the context matches you to a general-purpose inbound context (like ‘from-pstn’ for example) and the call get processed as normal. IIRC, @comtech was a contributor to that discussion.

1 Like

That way can be useful, But we have 100 VIP customers, that will be a long list in inbound routes. ?

Thanks for the reply.


If you wanted to follow @MollyMae, you could use the bulk handler on inbound routes. This would let you update/add in mass. There are still a lot of routes, but it makes management easier.

We’ve done it as Dave has described and I would recommend that. It’s so clean to have just the one route.

For people wanting to stay 100% in FreePBX or are not strong on the DB side, we worked out an alternative using the asterisk phonebook module for the GUI.

  1. Put the caller ID number of the VIP, use the caller ID name to input the extension you wish to route to.
  2. Turn on superfecta on the inbound route.
  3. We built a small snippet of custom dialplan, that checked if the caller ID name was greater than 0, if yes, route to the number stored in the caller ID name, if no route to a default (IVR, number, whatever).

This was nice as you could import/export the phonebook from the GUI, or connect to the table directly.


Thanks you guys.

I super appreciated your help.

1 Like

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