Incoming calls routing

Dear all,

I have decided to write here because I´m fighting with our good friend Asterisk+Freepbx since several days, but now I´m in a dead end.

My intention is to implement something like this: I have at home my professional office (I´m a freelance consultant) and I need a incoming call flow that, first, identify my personal contacts ( my family, friends… about 20 numbers) and then send them to a specific extension with specific voicebox, message, etc… and all the rest (suppoused professional contacts not identified) be sent to a different flow (whith a day/nigth mode, IVR,etc).

I have to advance that it is not possible to get a different number (to have a “personal number” and a “bussines number”) because of the cost, so I have to solve it by identifying the incoming number and having a “family and friends datadase” or something like this.

Please, Help… I´m stuck in this problem…


Add an incoming route for each of the known family and with the CallerID Number for each route. Make a default route for all other numbers.

I thought it, but as I´m not an expert I thought too that, maybe, it was possible to build an “elegant” solution which allows me writing a list of numbers instead of different incoming routes…

Elegant is possible, but may be more difficult than a separate inbound route for each CID.

Thanks a lot.

As I said, I´m not an expert, so I can´t evaluate how difficult a solution is.


Individual routes is the easiest and fastest way to solve your problem. If there are 20 friends and family members you need 21 routes. 20 for the friends and family and 1 default route for any numbers not in the friends and family list. 21 routes total can be done in about 15 minutes.

The problem with friends and family is the list grows over time, and they tend to change phone numbers periodically. I would not hesitate to give the instructions linked above at least a read, it is not that difficult. It basically involves a manual install of two third party modules, a one time configuration of a dynamic route then add your names/numbers to the other.

My bad. I really have not looked at the solution you posted lgaetz. I would certainly recommend looking at it too.

It seems a little hard, but I will try. I hope not break anything…


I’m the same person who began the post, but I had a problem with my account and I have changed it.

I have followed all the steps but as I was not able to make it work properly (It didn’t follow the rules I wrote in the dynamic route module, executing all the time the same action without attending the different CID segments I implemented), I looked the logs and I saw this:

[2013-06-03 22:29:51] WARNING[5848][C-00000410]: pbx.c:4621 pbx_extension_helper: No application ‘MYSQL’ for extension (dynroute-2, s, 1)
== Spawn extension (dynroute-2, s, 1) exited non-zero on ‘SIP/pstn-000003d0’

Does it mean that the DB Module (“SmartHomeRoute”) is not properly deployed?

Thanks in advance.

What version of dynroutes are you using?

I installed it throught the Freepbx interface.

You are several versions out of date. Download and install the 2.11 beta and if that doesn’t work try the latest 2.10 version:


I’ve updated the module to version 2.10 and i have the same error message:

WARNING[3468][C-00000003]: pbx.c:4621 pbx_extension_helper: No application ‘MYSQL’ for extension (dynroute-2, s, 2)

I have checked the rest of the configuratiuion and it seems to be ok:

  1. I have a linksys spa 3102 to route incoming calls to asterisk (it seems to work ok)

  2. In asterisk I have an in bound route that sends any inbound call from exterior (from linksys spa) to Destination “Dinamic Routes”: “HouseLineRoute”

  3. In asterisk I have a Dinamic Route called “HouseLineRoute” with this info:
    Change Name:HouseLineRoute
    Get DTMF input: No
    Timeout: 0
    Input Variable:
    Announcement: None
    Host: localhost
    Database: Asterisk
    Username: Root
    Query: select destination from smarthomeroute where cid like '%[NUMBER]'
    Result Variable:

With these routes:

Default: Time Conditions -> FueraDeHorario
Familia: Extensions -> <100> Inalambrico

The Time condition “FueraDeHorario” check if the in coming call is in office hours:

Destination if time matches: IVRPorDefecto
Destination if time does not match: Annoucement -> “fuera de horario”

After the annoucement it should go to the extension <01> voicemail.

After this description of my configuration, the results:

It doesn´t matter what I do, but everytime the call goes to the Annoucement “Fuera de horario”

Any suggestion?


Sorry, I forgot to say that Y have a group of phone numbers (about 20 “SmartHome Route” with family and friends numbers. All of them have “Familia” as destination)

All the rest of numbers must go to “Default” Route, but I have no numbers with “Default” as destination, because it is not possible to know all of them.

I suspect that here is something wrong, but i´m not sure.


I keep on trying but without results.

In this point I have make the IVR working (when alone) but I keep on trouble with the Dynamic routes

I have tried 3 of the 4 R in debugging process (Reintentar, Reiniciar, Reinstalar, Rezar) (in english: Retry, Restart, Reinstall, Pray). :slight_smile: