Rewrite CID when calling extension

I have an extension that sets a CID when calling a different extension. I would like FreePBX/Asterisk to strip a few numbers off the CID before passing it on to the target extension. I can see how this type of CID modification can me done if a call comes in from a trunk or goes out to a trunk but I can’t figure out how to have the CID modified when calling between extensions.


What are you doing that the “Set Caller ID” function is not powerful enough for you?

I can see how to insert the Set Caller ID module into an inbound route but I don’t know how to insert it into a route from one extension to another.

I see what you’re doing.

I don’t think you can without modifying one of your local calling contexts. If I understand, you want to strip off the front of the extension to just display the last 3 or 4 digits. You will probably end up writing something like a "from-local-internal"or “from-internal-local” context to do that.

Look at the “from-internal” context (or whatever context you are using for your internal calls) in the extension*.conf files and see what “local” updates can get added for the real name. In there, you can do all kinds of things to make the local caller ID should be.

Another approach would be to modify your extensions to use the “local” caller ID you want all the time, and then modify the outbound caller ID for external calls. There are a couple of ways to do that (including, IIRC, a commercial module for handling outbound routes.)