How to modifying INCOMING Caller ID NUMBER on Incredible PBX

I was sent here from the Incredible PBX forum as no one had a clue how to do this there:

Does anyone know how to modify the incoming Caller ID NUMBER using the Incredible PBX GUI without modifying the Asterisk code? I want to prepend a different digit (preferably with a hyphen such as ‘3-’) to the incoming Caller ID Number based on which of my 4 DID’s the incoming call is coming in on so when the CID Number is forwarded to my iPhone I know which ones are coming through the PBX and which ones are coming directly to it.

So, I am wondering if it can be done through the GUI or if not can the code be modified. If only the latter I likely cannot do it myself or can I? Do I have to learn programming? I did find an old post on here about how to do it through modifying Asterisk code but the link no longer goes to the document so I found it through the waybackmachine :

Can I pay someone to do it for me?

I am just a newbie on here so please go easy on me if I don’t the buzzwords or syntax.


See this wiki guide for the set-callerid module (note the comments as well, as they likely pertain to your situation.

This is not difficult, but there is a possibility that your SIP provider will not faithfully deliver the ‘corrupted’ CallerID value once you have added the prefix, particularly if you attempt to add a non-digit as you suggest. You can prefix the number with the Set CallerID module as @reconwireless noted above without using custom code.

The better way to do this IMO, is to use confirm calls feature of a ring group or Follow Me, which can play an announcement that you can customize for each incoming DID, a bit tedious because you need a separate Ring Group per DID, but with a small number of DID’s this is manageable.

And finally, if you want to pay to have it done for you, check out official FreePBX support at:


Thanks so much! That was excellent information. However I could still not get it to work.

I have checked and rechecked the instructions and am certain I have everything correct. Currently I have the Inbound Route set to an extension, then Follow Me for that ext is set to my iPhone #. Intra-Company is checked for Outbound route with the dial pattern to ########## (10 digits) and 1########## (1 + 10 digits) those digits being my cell #. is my only trunk. I have my CallerID Number set to 5${CALLERID(num)} and the destination set to the ext so that it would prepend 5 to the CID #. The number does not prepend when received by my iPhone or Softphone.

I confirmed with that they allow any callerID # to be past the I own or know. Non NANPA numbers are also allowed but they said that those calls aren’t always terminated correctly with such numbers. They expect 10 digit #'s for US/Canada.

Does anyone have any ideas of what the glitch could be? Thanks in advance!

Thanks. I have given up the non-digit idea. I am using Follow Me in order to have my cell phone ring when a call comes in, but I also realize I need not enter it in the Follow Me page but can instead set the cell phone # in my ring group and set the inbound route to my ring group. I am not sure which is better as both work.

As for having a separate ring group per DID I was hoping to achieve that with the Caller ID # prepend anyway as I would like to know if the call is coming from my US toll-free, Canadian toll-free, US local or Canadian local DID.

If I cannot get this running I may call the official paid FreePBX support, but I would at least like to know it is possible with Incredible PBX and instead of paying $150 and find out the simple answer is no.

Confirmed working. Tested with FreePBX 12 using the following call flow:

inbound route -> Set CallerID (add prefix) -> Local extension (with FM enabled to ext. DID) -> external DID (via

call arrived on my phone with the prefix intact via

Thanks so much for testing that for me. I have probably now checked my settings 10x and rang my phone 200 times with while tweaking things and still cannot get it to work. Would you mind checking my settings? I would really appreciate it. I have provided the screen captures below. I blanked out my 10 digit cell # just to keep it private. I have to put 1 image in a post as I am restricted as a new user. Thanks in advance if you don’t mind doing this for me.

If they are correct then could it be that Incredible PBX’s implementation of FreePBX simply does not work for setting the CallerID in the manner I want to? If my settings are correct then I am going to install FreePBX instead on the microSDHC card and try it on my RPi 2 B+. This website is dedicated to installing FreePBX 12 on the RPi and the downloads page shows it is being updated regularly: Or, is there some other website you would suggest for installing FreePBX on the RPi?

Thanks again.

So from the screen shots provided, it is not possible to determine if you are handling the inbound leg of the call correctly. In inbound routes, you need to direct the inbound call to the Set CallerID destination you created which does the CID modification, which in turn directs to ext 400 then to the exterior number. I don’t think you want intra-company checked on your outbound route, but your own testing will determine for sure.

I had initially missed the fact that you are running PIAF, which is a fork of FreePBX and not really supported here. Your paid support option in this case would be a best effort only, with no certainty that your system would behave in the same manor as the official FreePBX distro. Rather surprised they directed you here for support.

OMG!!! THANK YOU SOOOO MUCH! The inbound trunk was the problem! I am jumping up and down with happiness as I’ve been working on getting iPBX running the way I want for 5 days now!

Sorry, I forgot to include my Inbound route: Default screen shot. I had the Set Destination there set to my extension, not Set CallerID as I did not notice Set Caller ID in the drop down list before and had it set to my extension instead. Also, that was the one instruction missing from David Burgess’s very detailed instructions.

I checked intra-company because @reconwireless (2nd post here) kindly provided a link to the FreePBX documentation on setting CallerID and Dave Burgess’s instructed to do that:

3) Set the route as an “Intra-company” route. Doing this prevents the trunk CID from overriding the incoming CID as set by the “Set CallerID” function.

I tested it both ways and it does work without being checked. so perhaps it is only required on certain systems, but that would be odd since the occurs all within the PBX software, right? Perhaps it does not need to be set.

As for PIAF, all they advised me that there was a Set Caller ID, members disagreed as to whether it was for inbound or outbound CID and no one mentioned any other settings were required.

You have been so kind but I am wondering if you could help me with one other setting (notwithstanding I am with iPBX not FreePBX but I am happy to switch). I would like to have each of my 4 DID’s have a different prefix so I know if they are coming from US or Canada toll-free or a US or Canada local. I think this is what I need to do:

  1. Add 3 more extensions;
  2. Set Caller ID with a different prefix set to each destination extension:
  3. Add 3 more Inbound Routes and in each one enter a different DID in the DID Number field and the Destination set to the respective extension number: and
  4. Leave the outbound route as is.

Would that be correct? Thanks in advance.

1 Like

If I understand what is being asked, you need to replicate what is working now three more times, so each DID needs:

  1. a separate inbound route with the DID specified exactly as it is delivered by your sip provider directed to …
  2. a separate Set CallerID that prepends a different numeric prefix for each case

Then call flow from the Set CallerID continues as it is currently working. No additional extensions or outbound routes are necessary unless other circumstances dictate so.

This is FreePBX 101 basics and all answered in the wiki:

Thank you. Thank worked perfectly. I owe you a debt of gratitude. Likely if someone had not recommended iPBX first I would have used FreePBX instead. I am curious why there is even an iPBX if it is the same program with a different name?

For a ‘forwarded’ call as you are doing, it should not make a difference whether the route is an intra-company route or not. But if that route is used to go to a SIP provider and the PSTN, you do not want it to be an intra-compnay route. Doing such means that, when originating a call from your PBX, it will use the extension number and name for the CID, vs. the external CID number you have configured. This can have varying consequences when making calls, varying from the call being rejected because of a bogus CID, to the call being delivered with just your extension number (such as 4110) vs. your proper external CID.

Thanks. It looks then that one of the instructions were incorrect in the link provided in the second post.

I have successfully truncated my Caller ID to identify which of my 4 business DID’s is being dialed and forwarded to my cell phone by prepending a different set of digits to the beginning of each Caller ID and truncating everything after the area code. The shortened number allows me to identify it is a business call instantly vs a personal direct call merely by the fact the Caller ID is short without even looking at the numbers, but then the different digits prepended tell me if it is toll-free US, Canada or a local US or Canada DID call.

However, there is still one issue which is not the end of the world if it is not possible, but I would like to remove the '+1" at the beginning of the Caller ID. Currently for, say a call coming in from the 213 area code on my US Toll-Free DID, which I identify as such by a prepended 333, and everything after the area code stripped out so it shows as +1 (333) 213. The FreePBX documentation shows this:

but ‘Strip + From a phone number’, above, actually does not work as described. The variable 333${(CALLERID(num):1)} strips the first digit off the area code and also removes the brackets from the area code. So for my example above prepending 333 to, say, the number 213-123-4567 becomes +1 333131234567, ie the 2 which is the first digit of the area code is removed not the + sign. The same call as I have it set now, ie 333${(CALLERID(num):0:3)} becomes +1 (333) 213, which is acceptable but I would like to remove the +1 also.

Is there any way to make it become (333) 213? I’ve searched the documentation and internet but cannot find any guidance as to how to do this but am thinking that since the ‘Strip +’ instruction above does not work that maybe it is not possible. Perhaps it is is the destination cell phone provider adding the +1 after the call leaves the PBX so it is not there for the PBX Set CallerID function to strip?

That returns the number only. I realise that this is probably getting a bit over the top, but you might want to read up on the CALLERID function.

asterisk*CLI> core show function CALLERID

  -= Info about function 'CALLERID' =-

Gets or sets Caller*ID data on the channel.

Gets or sets Caller*ID data on the channel. Uses channel callerid by default
or optional callerid, if specified.
The allowable values for the <name-charset> field are the following:

… etc

Sorry, I don’t understand. I did actually spend hours reading about the Caller ID function and the variables associated with it. You are referencing the internal code in the Asterisk program which is already a page I found and read, among others, which is right here in case others want to know as you did not provide a link:

It did not enlighten me at all about how to set the variable in the SET CALLER ID field in the GUI in order to do what I explained above.

Can anyone else throw light on the issue I raised? Thanks in advance!

You’re using the CALLERID function. That’s what ${CALLERID(num)} is. This is internal asterisk stuff.

However, I’m pretty sure the +1 is being added by whoever is sending your calls out to the world anyway. You might need to speak to them?