Call routing based on prefix or DID

I have a customer with a good question.

This customer has 4 business places with 4 DIDs. They want all DIDs to be answered by the same IVR (For Sales press 1, for Service, press 2, etc.)

For all DIDs, I add a prefix to identify which DID was called (ex: Mtl-,Laval-, etc). This way, the person answering knows where the call is from.

Here is the tricky part:
For every option in the IVR, the destination has to be different for all 4 DIDs.
If caller called DID 4501234567 and chose option 1, call Ring Group A
If caller called DID 5141234567 and chose option 1, call Ring Group B
and so on.

I know I can do this by creating one IVR for every DID, but I don’t wan’t to do this. With all the Callflow and TimeConditions I have to check, it will get out of hands.

Is there a function that can “check” the called DID or caller Id prefix and route the call accordingly, but only after pressing an option in an IVR ? It’s like using an Inbound Rule, but after an IVR option is pressed. Is that possible ?

Thanks in advance for any help or advice you can provide, I’m scratching my head here !

Not already included in any FreePBX module. But surely doable the manual way. I guess you would have to store the DID and then route the call based on the stored value.

I could do this with some custom dialplan and a bunch of Custom Destinations, but the result would be no easier to maintain than just creating 4 different IVRs.

1 Like

Exactly this. Just make 4 IVR using the same announcement and set your destinations appropriately.

That’s what I was affraid of… The IVR is really complex (multiple call flows, ring groups, time conditions) so doing it 4 times will be a nightmare to manage !

I guess I would need a “If, then, else” module and using the DID as a variable.

Thanks for answering everyone !

That is not how an IVR works, it simply inbound calls press 123 go to your destinations.

If you are doing anything else, that would be a different function.

I know how an IVR works
To be more precise: The options in my IVR point to call flow controls, time conditions, etc. These destinations would need to be different for every DID, so it would be a lot of work to create 4 IVR like this.
In total, I would need 12 time conditions, 12 time groups, 16 call flows, 8 ring groups, 12 sub IVRs, and on and on. Imagine the mess when I need to make a change.

The point no one has really made out loud is that this is really hard to do with FreePBX. You are describing a typical multi-tenant configuration, and we just don’t do multi-tenant well here.

This has nothing to do with multi-tenant. This has to do with a poorly designed call flow.

If he wants (as he claims) to have a single IVR, then all the time conditions and call flow controls need to be in front of the IVR and not behind it.

I’ve never come across the business call flow that I needed to have the inbound route point to an IVR and then to a disaster of conditions.

When things like this get complicated, I sit down with a whiteboard and the principle decision makers at the company and we map everything out. First from a what is envisioned point of view, and then reworking it into a technical equivalent.

What would you need all of these? I have a driving school that has four locations, they all have the same RGs and Queues, they route calls based on their locations Time Conditions and IVR options.

I’m really confused right now as to how you have four locations but need three times the RGs, TCs, everything. How many do you actually need per location?

1 Like

I also needed such DID condition module many times. I have a complex logic with time conditions and queues for different customers, which is one and the same, but at the end voicemails should go to different e-mail addresses depending on DID for example. I create VMs with Custom Destinations. Now I duplicate it in order to achieve this functionality. I was thinking about creating such a module (probably based on Time conditions module) but I never had a time to read how to create a new FreePBX module.

1 Like

The third party module, Dyanamic Routes already exists and, last time I tested, worked in ver. 14. You could branch a call flow based on the value of channel var, ${FROM_DID}.

1 Like

I guess something like this:

exten => s,1,Answer
exten => s,n,GotoIf($["${FROM_DID}"="12125556601"]?ext-group,501,1)
exten => s,n,GotoIf($["${FROM_DID}"="12125556602"]?ext-group,502,1)
exten => s,n,GotoIf($["${FROM_DID}"="12125556603"]?ext-group,503,1)
exten => s,n,GotoIf($["${FROM_DID}"="12125556604"]?ext-group,504,1)
exten => s,n,Goto(ext-group,500,1) ;in case there is an error in the DID

I knew I couldn’t be the only one needing this. Thanks for all the info, I will probably try the third party module.

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