I have a large application with over 1000 extensions. Each extensions in the system has a DID number to it, with the last 4 for the DID matching the extension. Instead of having a inbound route for each extension, as they own over 6000 numbers and they change users and numbers frequently, is there a way to make a default inbound route that if no DID matches one of the exceptions, send the call to the station that ends in the last 4 digits if there is one? I know and have setup the Outbound loopback trunk for dialing a DID internally, can I do something similar for Inbound?
You would need custom dialplan to do this. Perhaps your own context that does a
DIALPLAN_EXISTS on the last 4 digits in context
from-did-direct and if not proceed to
from-pstn. There is a bit to it all, something we could knock up for you at Sangoma Support. With this you extension numbers would supersede your inbound routes.
Simplifying, you could have your own context that discards all but 4 digits of the DID and then proceeds to
from-pstn, that would allow your inbound routes to supersede any extensions.
Building on @lgaetz’ suggestion, If your ‘exceptions’ where also 4 digits and within the owned 6000 , then just goto the ‘last4’ of the DID in [from-internal] perhaps.
I’m more surprised that no one has asked for a context to do this prior to now.
As stated, make a custom context to figure out the extension.
[did-to-ext] stuff here
Then make a Custom Destination that sends to it.
Then make an inbound route or three depending on what oyu need for a pattern match for the DIDs and make the destination the above custom destination.
Or, ya know, you could just use the predefined context that’s existed for years expressly for this purpose:
; from-did-direct: ; ; forces ext-findmefollow to take precedence over ext-local. Also exposed to ; the public side to allow an extension number to be used as an external DID ; without requiring inbound routes to be created, common in many PRI installations ; where the last 4 digits are used as the extnension and DIDs are delivered in ; 4 digit formats.
Edit: Does that match only on extension? Makes sense based on the description. So if I needed to match on the outbound CID declared in the extension, this would not work. Just clarifying.
Edit 2: I’m not the OP. Just curious.
The from-did-direct works if only the last 4 are sent, the context just letters find me have preference, so yes, but you need to strip off all but the last four in your inbound context
Building on @sorvani’s suggestion to use a Custom Destination with an inbound route w/pattern match, you get a 100% GUI solution by using a custom dest of:
Ahh, ok. I see that. That is a good suggestion and I will try it. Thanks!
I love sticking with the GUI as much as possible. This is a much better choice than a custom context.
The solutions provided here is great.
There’s also another option: if you can get your provider to send 4 digit DID’s then it will automatically match the extensions if there’s no entry for that 4 digit DID in the inbound route.
Almost , but from
; forces ext-findmefollow to take precedence over ext-local. Also exposed to
; the public side to allow an extension number to be used as an external DID
; without requiring inbound routes to be created, common in many PRI installations
; where the last 4 digits are used as the extnension and DIDs are delivered in
; 4 digit formats.
include => ext-findmefollow
include => ext-local
freepbx*CLI> dialplan show from-pstn [ Context 'from-pstn' created by 'pbx_config' ] Include => 'from-pstn-custom' [pbx_config] Include => 'ext-did' [pbx_config] Include => 'ext-did-post-custom' [pbx_config] Include => 'from-did-direct' [pbx_config] Include => 'ext-did-catchall' [pbx_config]
This trunk context will first match on inbound routes, then if not finding a match there will attempt to match a local extension.
Throughout this thread are references to 4 digits, possibly creating the misconception that
from-did-direct requires exactly 4 digits. It should be noted that there is nothing magical about the number 4, any digit sequence will work. The four comes comes from PRI providers who historically have provided 4 digits here in NANP land.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.