Inbound call routing


Is there a way to seggregate inbound call routing to queues based on first four digit of phone number for example,

1300xxxxxx -> routed to one queue
1200xxxxxx -> routed to another queue
1800xxxxxx -> routed to yet another queue

is this possible ?

Best Regards
Chetan Jha

exten => _1300XXXXXX,1,Queue(oneQueue)


exten => _1300.,1,Queue(oneQueue)

although I suspect there is something missing from your requirement, as you lose the XXXXXX!

Hi David,

I basically want to set up Area wise inbound call queue for example if a call comes from area x 1305XXXX, i.e. Miami I will transfer the call to Miami Queue, and so on.

Best Regards
Chetan Jha

Hello Chetang.Jha.

Do you mean call routing based on caller’s ID ? So called ${CALLERID(num)} ?

If it is so, one way is to use ‘GotoIf’ application where you will distinguish ${CALLERID(num)} (I think you need only first N digits, to understand the city/state).

But here are two important moments:

  1. you need to have some base of area codes (if there’s a limited number of areas, the task is much more simple of course)
  2. voip providers may send you caller ID numbers in different formats like (country code)-(city/state code)-(subscriber’s number), or just (city/state code)-(subscriber’s number). SO, in such cases you need to add the missing digits to the incomplete ${CALLERID(num)}

It’s from my experience. But I hope that your voip provider(s) send you caller ID numbers in complete format.

We have one number the calls to which are free from all over the country. And this task is done not by our Asterisk servers, but by VoIP provider. If it identifies that a call is from city NNN, it forwards the call to our local number in that city (now to the Asterisk). If it identifies that the call is from city ZZZ, it forwards the call to a local ZZZ’s office number.

If you are talking about caller ID, not the called number, you can use “ex-girlfriend logic”, i.e.

exten => 1234/_1300.,1,Queue(queue-for-extenion-1234)

Hi David,

Here is an example,

I have a TFN or DID on which my callers will call me
my number is 180012345678 (example number)

the caller number is say for example

1305xxxxxxxxx [Miami Number]
1201xxxxxxxxx [New York Number]

I have 2 queues as per cities Queue 1 -> Miami, Queue 2 -> New York

And what I am looking at is from the first four digit 13xx, 12xx, i want to route the call to the queue which are city based,

Best Regards
Chetan Jha