Changing the caller number of an incoming call

We are using FreePBX along with a Sangoma A102DE and this connects to a legacy PABX using a QSIG trunk. Call routing is working as expected both ways. All PSTN is on the legacy PABX and sent to FreePBX over the single QSIG trunk. However we’d like to alter the calling number for PSTN calls and calls from legacy PABX extensions coming in to this single trunk on FreePBX.

  • Add a leading 0 to the calling number of incoming PSTN calls.
    Currently for example, incoming call will show as 2071234567, change to 02071234567

  • Remove the the first 3 digits from the 7 digit legacy extension number so that only 4 digits are presented to FreePBX users.
    Currently for example, internal calls from a legacy extension show as 7506500, we’d like to change this to show to 6500

We’ve tried creating an inbound route for a given extension with the destination set to Set Caller ID and then use the Set Caller ID module to append the missing 0 but this is a fair amount of work given we are migrating 100’s of users and secondly, 0 is then added to calls from legacy extensions so this isn’t going to work for us.

Really appreciate some pointers on how to at least get started with the above,

Thanks

Louis

You have a lot of moving parts there, so I’d pick an approach that makes sense to you and refine your requirements using a more “step wise” approach.

For example, start with the Trunk. Figure out what pieces you need to make that work the way you want it to.

Next, look at the Inbound Route. Remember that these are two completely separate things. By using this piecemeal model, you can adjust things at each stop and make the system operate the way you want it to.

As far as the CID (not CLI, that confused me for a second), there are a ton of ways to make this change. The simplest could be to look through the forums right now and look for the post about the guy that doesn’t want 1xxxxxx phones to be able to call 2xxxxxx extensions.

Many of the suggestions in that thread should give you access to the tools you need to modify your system.

Look at the context [from-pstn-e164-us] in extensions.conf as an example for a custom context to send inbound calls to.

Thanks for the info. I’ve taken a look at from-pstn-e164-us and can see how I’d alter this to suit my requirements. However, how can I add what I require to extensions_custom.conf and ensure this is processed and then control is passed back so the call routes as required? When I tried to add this earlier, it seemed to stop inbound callers ever reaching voicemail?

Thanks again

Louis

It’s a bit hard for me to guess what you are trying to do, the e164 context both manipulates the CallerID presented, usually to facilitate “calling back” , and sends the call to a “modified” extension than that which was received to suit locale.

If you are wanting 1-to-1 mapping of did’s to extensions look at the [from-did-direct] context in extensions.conf. whereby calls are sent straight to internal extensions by-passing the need for many inbound routes to match every individual extension, so maybe a hybrid of both ideas, where your context goto’s to either [from-pstn] extensions for inbound external calls and [from-did-direct] extensions for legacy extensions, you differntiate by looking at len(${EXTEN} where 7 is legacy extension and > 7 are PSTN calls.

Either way you will need to have inbound routes and extensions to macth your modified schema

I personally call this “normalizing”, local dialing rules, which might differ by trunk, (most phones don’t have a + key, not even cell phones, but hopefully we all know about + being metadata), so inbound calls from various sources need to be massaged to “look” like your locales expected behavior, similarly the user should be able to dial any number as if they were at home, so massage the outbound dialed calls by trunk and outbound route as necessary.

A simple analysis of all this will hopefully let you change the apparent caller by route, present her also as a dialable call back and adjust as appropriate on your outbound routes.

Here in SoCal we enforce 11 digit dialing, some places insist on 10 for one set and 11 for another (go figure :wink: ), different VSP’s might want you to dial 011 (+ in NANPland) some will accept +, so it goes on, both in NANP and any other location, (just look at Italian dialing !!)

Good Luck though.