When user dials External DID redirect to Internal Destination - On Mass

We have now transitioned all of our offices to SIP trunks and FreePBX. The decision has been wonderful. Now we are realizing that our staff are conditioned to call each office with the external DID instead of dialing the Front Desk Ring group at each office.

Because of this ingrained habit, we are paying for both the outbound dial trunk and inbound receive trunk each time a staff member calls another site.

We went through the exercise a couple months ago to connect all sites to our “central” hub. We can now call any site, from any other site without using a carrier SIP trunk. Each site has extensions/ring groups/queues etc that start with the “Site Extension”

Extension Example:
Site 1: 100-100 (Site Operator)
Site 2: 101-100 (Site Operator)
Site 3: 102-100 (Site Operator)
Queues Example:
Site 1: 100-1000 (Main Ring Group)
Site 2: 101-1000 (Main Ring Group)
Site 3: 102-1000 (Main Ring Group)

My question is this:
Is there some way we can redirect when a DID is dialed to to the proper ring group/queue etc if it is internal, on mass?

I am imagining a “Master Directory” where we can store the DID and Internal Destination (Ring group, Extension etc). Each of our Phone Servers can then use this Master Directory to resolve Company Owned DIDs before attempting to use an external trunk to process the call.

It would need to be centrally stored because we add DIDs almost weekly right now as we add sites/services.

I did find this post about doing it on a small scale

@lgaetz was helpful on explaining it.

However, we need to extend this idea to multiple sites and many DIDs. It is not currently scale-able for us to have to add/update a DID <> internal route combination on each PBX each time a change is made

There are a couple of “Master Directories” out there, ENUM and DUNDI seem the best fit, if you have a limited set of servers but all kinda related , I would go with DUNDI trunks, for a more dynamic solution ENUM but both take a little RTFM’ing.

Thanks @dicko

I have been researching both. At the Moment we have 7 servers. We are projected to have around 100+ if we grow as expected.

Do you know if DUNDi or ENUM would be functional with this many servers? I have no experience at all with either option

DUNDI would be a PITA, ENUM probably, but If I had that many PBIX’s (yuck , PBI ? , and I do) I would use a SIP proxy or two for all your servers’ inbound and outbound calls. My preference is Kamailio.

Thank you @dicko

I just ran a test with ENUM. Once I understood the proper DNS settings in Microsoft DNS it worked! I was able to use our “Local” custom contexts which emulate dialing internally.

For example, each PBX is setup with a “LoopAround” trunk and some custom contexts.

A DNS (ENUM) record that takes an External DID and resolves it to Local\1001000@from-internal.

From here, the PBX either processes the call at the local server (if the extension/ring group lives on that server) or passes it to the central server via IAX2. The Central server then connects it to the correct remote PBX

All of our sites share DNS via Active Directory services. Implementing ENUM may be extremely easy.


I have looked at Kamailio a couple times as various needs have come up. I will continue to keep it around as an option. Right now we are trying to avoid sending all calls to the central hub because our connectivity relies on VPN over Consumer “Business” Internet lines.

Though failure is limited, it may still happen right now.

hat’s the great thing about a SIP proxy, no audio goes through it, just the signaling, when you get it properly, then no DNS to worry about (well, maybe some SRV records), no AD , no ENUM no loop-backs or iax2 trunking, and on top of that it can be clustered for failover

@dicko you have me intrigued now. I will look more into it.

1 Like