Incoming Route destination for matching DIDs

We purchased 100 DIDs (FreePBX Distro), and I want to configure an incoming route that accepts any DID.
How can I set the destination to be the same as the DID? I don’t want to create 100 destinations.
Do I need to create a custom context?

So I am not asking how to match multiple DIDs. I am asking how to make a single route that will go to the extension matching the DID.

Should I create a new “Custom Destination” and add custom code? Or is there a standard way to do this through the GUI?

I don’t think there is any way to do this through the GUI.

I created my own custom context in extensions_custom.conf and put it in the PEER section of the trunk.
In my code example here, all my extions are 4-digit numbers.

[Custom-from-Trunk]
exten => _555123XXXX,1,Goto(ext-local,${EXTEN:6},1)  ;strip the first 6 numbers so we can match the 4-digit extensions
include => from-pstn

Now I can take my 100 DIDs and send the calls directly to the matching extensions. And I only have to manage three lines of code instead of 100 incoming routes.
In the chat forum, it was mentioned that it would be a good feature request to have this as built-in functionality.

1 Like

You CAN do this through the GUI…

Just put an underscore before the first number in the DID field and then use the same numbers and letters that you would use for pattern matches anywhere else, i.e.

_2125551XXX

Would match
2125551000 to 2125551999

Well, am I not correct to think that although this will match the incoming DID, it still sends all the matches to a single extension? The problem isn’t matching the DIDs - it’s matching the extension.

Oh, I get it.

You can do what you want in the extensions module, using the Add Inbound DID Field, as you create each new extension (or you import them using the Bulk Extensions Module).

The idea was not have to create an inbound route for each extension. Of course I could create an extension AND an inbound route for each DID. I wanted to get around having to manage so many objects.

You don’t have to create an inbound route for each extension. When you create the extension itself, there’s a field for an associated DID for that extension in the extensions module.

That is just a shortcut. An inbound route is still created for each extension. You still end up with 100 routes. The idea is to have a single way to send incoming DIDs to matching extensions. A single dynamic route instead of 100 static routes. This can be done through code, but apparently not through the GUI.

BGM
Are you wanting for example

DID block
760 555 100 to 760 555 199

To strip 760 555 and then send the remaining digits to match extensions 100 - 199?

Ive done this in Cisco phone systems and not sure if you can do it in freepbx but im interested to see if someone posts a solution.

If you do end up having to create 100 routes, id use the bulk extension tool forsure, wouldnt take any time really to do it in the excel sheet and import it

Look at the [from-did-direct] context for an example, and send your calls to your new custom context based on it,just strip off the last n digits of EXTEN and send the call to from-internal to get your queues, extensions G’s etc. something like:-

goto(from-internal,${EXTEN:-4},1)

Fellows, my issue isn’t that it can’t be done - I’ve posted my own code (my reply to myself in this thread) that will do just what I’m saying. My issue is that you can’t do it through the GUI.

However, even though I could do it through code just like I’ve shown at top - I did create all the DIDs and extensions using the bulk upload. Problem was that if I used my own code above I wouldn’t be able to set the fax destination too unless I wrote MORE custom code. I don’t really want any custom code because I expect someone else to manage all of this after I’m gone!

Hi,

I am curious to know if this gets resolved and there is a way to do it in the gui. This is an interesting issue as I might face it soon too.

@BGM : if its not possible would you please open a feature request ticket with the freepbx guys so at least we can benefit all ? thanks.

bruno, here is the thread for the request:
http://issues.freepbx.org/browse/FREEPBX-8352

Hi,

thanks added to my watchlist.

B.

hello dear BGM
would you please explain more a bout your solution, i have the same problem with my 1000 did and i test your solution but it doesn’t work, may be i make some mistake i need your help
.thank you very much

I don’t know which of the many problems from the three year old thread you want to solve.

If you want all DID to match a single destination, just set up what’s called an “Any/Any” inbound route. The DID number is empty and the Caller ID Number is empty.

If you want to match a specific DID to a specific destination, the code that was posted in this thread. In fact, many of the possible solutions listed here may solve your problem, but you haven’t really stated what problem you are trying to solve.