(solved) DID to extension mapping

Hi all,

Is there a way to map a range of DID’s (like _0123456XX) to a range of extensions (like 20XX) as a destination using an inbound route? (Instead of creating individual single DID inbound routes.)

Possibly using a custom destination? I’m also wondering if that would have any effects on other functions.

I’ve been searching these and trixbox’s fora, but to no avail.

I’m using AsteriskNOW 1.7.0 (FreePBX / Asterisk

Thanks in advance for your time!

Best regards,


Short answer: No, you need one DID that has it’s destination to one extension.

Long answer: Yes, you can create a custom destination that handles all this, but all features inside FreePBX will be lost.

You can use the Bulkextension and bulkdids modules to quickly set up all your DID’s and extensions and match them.

Thank you very much for the information Mikael!

I gave it a bit more thought this evening and had a go at the following (intermediate answer :wink:
I created a very simple context in extensions_custom.conf by manually editing the file (just to prevent duplicate context use):

include => from-did-direct

Then I created a custom destination named automap in FreePBX:


Finally I used the custom destination in the inbound route in FreePBX.
In my case I wanted my DID’s last 2 digits to match my internal extension range of 2xx. Off course any number of digits with any internal extension range can be used.

I tested it with voicemail and followme without issues. Which seems to make perfect sense because the normal single extension destinations look like ‘exten => s,n(dest-ext),Goto(from-did-direct,200,1)’. I’m only making the last 2 digits of the extension variable.

For me this allows maximum flexibility/simplicity. By just using specific routes before this ‘catch-all’ I can make exceptions to the mapping of the last 2 digits from the DIDs to extension.

Note that the provider needs to properly set the SIP contact field with the number dialed for the CALLERID(DNID) variable to be set and consequently for this to work…

Excuse me if I’ve overlooked something. It works for me and I hope it’s usefull for others too…