Is it possible to route incoming calls based on area code?

I am trying to route my incoming calls based on the area codes. 810 and 586 would go to one desk, 248 and 313 to another, etc. Is this possible? And if so, how would I do it?


Assuming the CID comes in a 1810NXXXXXX or 1586NXXXXXX, try the following, and in this example, your DID is 2125551234:

DID: 2125551234
Destination: Extension 248

DID: 2125551234
Destination: Extension 313

I believe that will do it.

Ifbyphone provides call routing technology which allows you to route phone calls based on area code, time of day, day of week, and more.

For more details, visit:

If you are looking to route calls to specific stores, Ifbyphone has a specific Store Locator business solution which routes incoming customer phone calls to the nearest store or sales rep.

For more details, visit:


While this is a interesting service the intent of the question was how to do it inside FreePBX which something very easy to do inside FreePBX and was properly answered by the post you replied to.

Please restrain from doing it again as it seriously borders on self promotion and spamming.

Do you do that in a specific file or using the inbound routes module ?

I am using Piaf 1.3 and Freepbx 2.5 and trying to route incoming calls base on DID. Asterisk answers with this number is no longer in service. Remove the DID and the call is answered properly. The CLI shows the calls identified as Zap/4-1. How to route calls using the DID?

You’ll get the message “this number is no longer in service” when it can’t match the DID provided to any route in the system. So you have a mismatch in what you think the DID is and what your provider is giving you.

So you’ll need to make sure that the DID you are setting up for matches what your provider is giving you as It can vary from provider to provider and setup to setup. You can see what is actually provided by going into the asterisk CLI, and typing set verbose 5 . Then make a call and watch it.

For example I’ve asked our PRI provider to only provide the last 4 digits of the DID to us so knowing that all my DID’s have to be coded for 4 digits. Yours might provide more or less, common ones are 4, 7 and 10.

once you see what is actually being provided you can then match it.

If you really mean CID same thing goes as some providers will include the leading 1 and others will not here in the US.