IVR entry target to another IVR based on few digits from caller number

I want to configure on FreePBX distro more complex IVR which would behave as fallows.
Some costumer call to IVR1 number, on IVR1 i have:
Entry 1 : Digit 1, Destination extension XXXX
Entry 2 : Digit 2, Destination IVR2
Entry 3 : Digit 3, Destination -> And here I would like to have a mechanism which, based on the first digits of the caller number, redirects connection to one of several IVRs For example
if Caller Number 22XXXXXXX go to IVR10
else if Caller Number 2323XXXXX go to IVR11
else if Caller Number 33XXXXXXX go to IVR12
else go to IVR99
Entry 5 : Digit4 Destination -> queue 1234

Anyone can help Me to setup such mechanism or maybe is achievable by some additional module ?

That kind of smacks of a custom context.

You can write one - I’d start with the ‘e164’ context in extensions.conf (that will give you a template for chopping up a Caller ID and how to continue from there).

If you’re not comfortable with doing that kind of work, there are people here that might have some code for you. If not, I’m sure Sangoma can do it.

This comes up enough that maybe we should ask for a module called “Area Code Redirector” that allows you to send a call to another destination based on the first “n” digits of the caller id.

The third party module dynroutes will probably do this.

I think I could mash some code together for you that you could use. Need some clarification in your terminology.

My interpretation
Customer calls main number and IVR #1 answers:

“Press 1 if you know the persons 4 digit extension” ->caller press 1 and says “please enter 4 digit extension now”

“Press 2 to goto [some other] department” -> callers press 2 - sends them to IVR #2 “you’ve reached “Sales” dept”

“Press 3 if you know your account #” (i’m assuming the 22xx 2323xx 33xx values are not phone numbers?)
-> callers press 3 and something like “please enter your 9 digit account number”
-> caller enters their 9 digit pin/account number and based on the first few values, it sends them to an appropriate IVR
-> caller enters anything else other than 22 2323 33 at the start, goes to IVR 99

“Press 5” -> not sure what you exactly want here, i need some clarification, but if they select it, send to queue 1234

That correct?

Hi, dickson.
My main problem is when Customer press 3 in your interpretation, others options is to show example to different actions in my IVR.
And your interpretation after pressing 3 is wrong. This 22XXXXXXX , 2323XXXXX, 3XXXXXXX are patterns from Telephone number from which the customer calls. For example customer telephone number is 232388943 then caller number math to pattern and connection should be send to IVR11, Io caller number start with 22 then should be send to IVR10 ,etc. And fail save if the caller number does not match to any pattern or caller number is set to hidden, empty ore something like that, they should be send to IVR99.

You can do this with the default inbound routes module. Use the cid field to fill the pattern that you want and guide the calls to each different ivr. With some trial n error you will get it. You don’t need custom dialplan.

Hi astbox

If I understood correctly description the CID field, when I use it, all calls from customer (with mat customer phone number and cid field) will be intercepted by this inbound route and customer will not ever reach IVR, on any other inbound identified by DID number.

… assuming the DID field is clear OR the CID Priority Route option is selected.

Yes the caller will get to the specified destination of this rule. Be sure to check the box that cynjut mentions.