First - these are just opinions. As I reread your post, it occurs to me that I might be missing an important distinction. My first reading of your post sounded like you were looking for extension to outbound CID number mapping where the extension shows up as part of the outbound number. On reading it again, it occurs to me that you might be advocating for a ‘default CID’ instead of using Called ID information per extension. If that’s the case, a lot of the following is way outside what you’re looking for.
I’m not new to this, and I can only think of one place where I’ve worked that could use the kind of functionality you’re looking for. Most of the installations I’ve done needed a single outbound (or a few outbound) numbers that mapped to lots of extensions. The installations where there were multiple outbound Caller IDs mapped to one or more extensions are also relatively common. So, my experience with FreePBX is that ‘one to many’ and ‘many to one’ are relatively common. These cases are handled sufficiently through the mechanisms in the outbound contexts.
Example: Dr’s office - all extensions use the same standard inbound number, except for the in-office lab (which is a series of extensions) and the Cancer support line (which is a single extension). The other 40 phones in the system share the ‘standard’ outbound caller ID set in the Trunk. Note that each extension in the office has it’s own caller ID which is passed to the other local extensions, so the flexibility to have individual caller ID per extensions. This is isnt’ somethat for the 1% - I contend that it’s something that every installation I’ve done wanted and needed. The outbound caller ID is overwritten with the corporate caller ID for outside calls by the outbound trunk, so distance from the extension determines which caller ID is displayed.
The one place that was different was when we had extensions on the desk attached to the Defense Switched Network, and each phone had an extension number (4 digits) that mapped to a DSN number (7 digits) that also mapped to a commercial extension (10 digits). So, having seen exactly the installation you’re describing, I agree that the functionality could be a feature that would be handy.
The difference is that this isn’t the norm any more. These kinds of installations aren’t what most of my customers are looking for. If I DO need that kind of solution, I’d still set it up with Bulk Extensions when I install the system.
Could I write a outbound caller ID context that mapped the extension number to the rest of the phone number? Sure! Of course I could. In fact, I’m one of those saps that would write it and submit it here to be included in the FreePBX system. In fact, as I was writing this, I see that Dicko has written such a beast.
If I was designing a system to do that, I’d put a checkbox on the outbound trunk screen that said something like “map extensions onto outbound caller ID” and replace the last ‘n’ digits with the extension number where ‘n’ is the length of the extension number. Trivial to write, simple to put in place.
Someone should write that, and since this is open source, I think it should be someone that needs that functionality. The alternative is to find someone else to write it, or find a system that does that for you.
Now, as I write this, a number of issues pop up. With standard PBX systems, passing the outbound DNIS and ANI are handled as reasonably atomic operations - the digits passed out identifying the connection are just that - digits. In the SIP header, we don’t pass just DNIS and ANI, we pass a full string with caller ID and identification information (name and number). We set the outbound CID string with both of these items, not just the number. Because of that, there has to be some kind of agreement on how to map the extension into the outbound CID. With that wrinkle added, it might be a little more challenging to NOT do it on a per-extension basis.
As far as the dial-back rules, I’m not sure what the problem is you’re having there. The transforms you’re asking for are trivial to add without a single code change, just through outbound route and trunk rules, unless I’m under-thinking the problem, which is definitely possible.