100 number block direct dialing to extensions

Hello dear FreePBX community,
I am in possession of a number trunk with a 100 number block from 00-99, which I can attach to the master number. Now I want to solve the direct dialing to an extension a bit smarter. So far I have created a separate inbound route for each extension. Since this is a bit tedious in the long run, I have seen that I can specify a range for the phone number in the inbound route.

My question: can I use the range to route from 00-99 directly to the corresponding extension? Currently I can specify the range, but I can only select one extension as destination. Or do I have a mistake here?

Best regards
Florian

There is a context [from-did-direct] that is designed exactly for that.

Maps the 4 least significant digits to your endpoints

That brings already times light into the darkness hehe.
How exactly do I apply this? Where must / can this context be entered?

Just send your inbound calls to that context make sure you have 4digit endpoints defined

You can safely edit that context if you prefer 3 digits

I have now added the following to /etc/asterisk/extentions_custom.conf:

[from-did-direct-custom]
exten => _X.,n,Goto(from-did-direct,${EXTEN},1)

Let’s see if this works. But what do I have to specify here?

Its easier than that, on the inbound route, just type it in

In which field please? :sweat_smile:

You can do this from the FreePBX gui with minimal effort. This method will let you select how many digits of the DID number are selected for matching the extension number. In this case, I use the last 3-digits. I have an incoming 11-digit DID number but only want the last 3 digits for my extensions. The target translates the number starting after the 8th digit so I get digits 9 thru 11 which equate to my extension number. The illustration below takes anything coming into the trunk that matches the first 8 digits and extracts the last three to correspond to the extension numbers on the system.

Go to Admin > Custom Destinations.
Create a new Custom Destination so that it looks like this:

Then set the incoming route to the custom destination you created:

2 Likes

@kenn10’s approach is decent, but I would recommend a few changes:

  1. Use caution when sending pstn calls to the from-internal context as a misconfig here could easily have unintended consequences. I would recommend using the previously mentioned from-did-direct as it’s specifically limited to local extensions but still allows FMFM to work.
  2. If your intent is to isolate the final 3 digits, it’s more intuitive to use ${EXTEN:-3}
  3. In freepbx, it’s conventional to use the channel variable FROM_DID to reference the DID for the call. Using EXTEN will only work in very rare cases in FreePBX.
1 Like

Thanks for the suggestions @lgaetz. We communicated offline and everything is working. I’ve never experienced any issues using the EXTEN variable but we changed it to FROM_DID for his implementation.

2 Likes

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