How to modifying INCOMING Caller ID NUMBER on Incredible PBX

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' =-

[Synopsis]
Gets or sets Caller*ID data on the channel.

[Description]
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: wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_CALLERID

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?

Yes I know that it is a CALLERID function. Regarding the +1 being sent out to the world I did already mention above that I am thinking it might be the cell phone company adding it, but I am not sure so I was hoping that someone on here who knew the SET CALLERID page settings would know if there was a way to do what I want to do. If not then it is the either the cell company adding the +1 or if not then the GUI simply does not allow you to strip what I want to. Anyway, if it is the cell phone compan then I am not about to try to convince a national phone company to change the way they pass a number.

Firstly do you want to remove the +1 on an inbound call to FreePBX (I am unsure if it’s inbound or outboudn)? If so can you post your trunk settings (take out the username and password and that sort of stuff). There is a context we can have you send calls to that will automatically remove the +1 but I need to see your setup first. (Huzzah you’ve now got FOUR FreePBX developers helping you!)

Pretty sure the +1 is being added to the CID AFTER the call leaves your PBX, either by your SIP trunk provider or the provider for the person receiving the call. My guess is this is something you will have to live with.

I want to remove the +1 on the CallerID that hits my iPhone as a result of being processed by my PBX, then sent out over the outgoing PBX trunk via voip.ms and then processed by Bell Canada which is the service provider for my iPhone. The SET CALLER ID function examples shown in the documentation referred to in the second post and that can be found here: wiki.freepbx.org/display/FPG/Set+CallerID+User+Guide state the following:

yet when I try it it strips out starting from* after* the +1 that indicates to me one of 3 scenarios is happening:

  1. The variable does not work the way described; or
  2. The +1 is being added to the Caller ID after the call leaves the PBX; or
  3. It is possible to have a Caller ID that is processed by the PBX which has a +1 on the incoming DID that is not strippable by the function in some cases even when properly set but works in other cases depending on what is incoming.

I have confirmed with voip.ms that they do not add anything to the CallerID and send the information as received. I doubt scenario 3 is possible. So, unless scenario 1. is the case, which I highly doubt, it must be Bell Canada that is adding the +1.

Does anyone think scenario 1 is actually possible? It seems to me the software works properly.

I can totally live with having the +1 but thought if I could strip it I would prefer that.

And, yes, the support here is outstanding and I really appreciate all of the help people have been providing me on here that has solved 99% of my problem. I can’t thank all of you enough.

If you SIP provider is sending you the CID in e164 format (e.g. +1NXXNXXXXXX) then you should either ask them to send it differently if that’s an option, OR instead of configuring your SIP trunk with from-pstn (or from-trunk) you can configure it with: “from-pstn-e164-us” which is a built in context in FreePBX that will do two things:

It will change any inbound DIDs coming in as either e164 or 11 digits DIDs into 10 digit DIDs, and it will change CID format into 10 digit CID’s for e164 number, and for international numbers it will change them from +XXXXXXX to 011XXXXXXX.

I confirmed with voip.ms that they cannot change the format they send the CID in. They said that they send it exactly the way they receive it. When I asked if they could send it in anything other than e164 format they said that was a good suggestion and to send it to their suggestion email.

I modified the peer details for my outgoing trunk as you suggested but it did not do the trick so this must isolate the issue down to the my cell phone provider adding the +1. Thanks for your help. I guess this is the end of the road for this issue.

Again, thanks for everyone’s help. Much appreciated!

1 Like

Actually, not the end of the story. I don’t have Caller Name ID because my cell phone provider does not provide it. What I really wanted to see when a DID came in on my iphone was MYCOMPANYNAME USA (for the USA Toll-Free DID) and the same for BUFFALO, CANADA and TORONTO when someone calls one of those DID’s. I could have changed cell phone providers but because I have a no-contract plan which is no longer offered and is 1/3rd of the price of similar plans today I don’t want to lose it as a new plan would cost me about $1,000/yr more. So the only way to do it was to have numbers represent the DID’s. However then I had a revelation.

What if I SET CALLER ID to strip out the entire CID for, say, the US Toll-Free DID and then prepended it with 10 3’s, then added ‘COMPANYNAME USA’ and 333-333-3333 to my iPhone contact list? Would MYCOMPANYNAME USA show up when the US Toll-Free DID was dialed? Yes, because notwithstanding I do not have Caller Name ID the iPhone is cross-referencing the # from my contacts list and pulling up the name associated with the #. So, I changed my other 3 DID’s to do the same.

This is going to be WAY better than having to look at the numbers on the iPhone to see which DID is being dialed. I don’t really care that much about the area code because I cannot remember all of the ones in the US & Canada anyway and I can easily click my voip.ms CDR report the instant a call gets dropped in order to find the # to call back if I didn’t get it during the call.

I have 2 (hopefully final!) questions that I would appreciate someone answering if possible:

  1. If my cell phone company does not provide Caller Name ID but FreePBX does serve up a name to the outgoing trunk which is forwarded to my cell phone does that name get stripped out because the cell phone company does not expect the name as it does not provide Caller Name ID?

  2. In any event, how is the SET CALLER ID for CALLERID Name set? There are only examples in the documentation for CALLERID Number and reading through other areas of the documentation about variables did not help as they seem to be geared to internal programming… For example, if I wanted to set the CALLER ID NAME to BUFFALO how would I do it? The following settings I tried did not work:

BUFFALO${CALLERID(name)}
${CALLERID(BUFFALO)}
${CALLERID(name):BUFFALO}
${BUFFALO}

Given none of these worked and one of them is correct, I must assume then that my cell phone provider is the culprit.

Thanks in advance for anyone that can shed light on this.

Wireless carriers do not pass callerid name field to incoming calls to mobile devices that I have ever heard of. if they did, the name would be ‘dipped’ from local or national databases and would completely disregard the name you try to send out your trunk. They will however update their callerid name database in many cases with the outgoing cname of your mobile number so other carriers can ‘dip’ the registered name of the person calling them. In short, the carrier receiving the call has to ask a database for the name of the caller and transmit that info with the number and wireless carriers, from what I have seen, don’t do this at all. Most wireless phones have an internal address book that associates names and numbers anyway.

I am in Canada and Rogers, one of our major cell phone carriers, and their MVNO’s do pass caller ID name as they were my carrier before I switched to Virgin Mobile/Bell Canada who do not. No other Canadian cell phone carrier provides that service as far as I know.

I’m also in Canada (NS), and when I dial a Telus mobile phone from FreePBX thru voip.ms, I can see the FreePBX defined CallerID name displayed on the phone (tested with a single number). I also know that certain land lines that I call also get my CallerID name, though I have not tested to any great degree to figure out who gets what. Note that voip.ms has both premium and value routing which very certainly affects CallerID delivery, and there may well be a bunch of other things going on behind the scenes which could yield different results for different carriers.

I have seen it claimed many times that CallerID name delivery is not possible at all, or not possible to mobile, but my own experience in terminating calls within Canada tells me this is not always true. Best to just think of it as unreliable.

Thanks. Can anyone tell me how the name would be set in SET CALLER ID in my example for Buffalo above?

I may be out of date here, but without specifically configuring it, Outbound Trunks in FreePBX will strip out the CallerID Name. This was years ago because there are some carriers (various PRI carriers is what caused this years ago) that would completely reject the call if a CNAM was sent to them. This was deemed a reasonable thing to do since, as @mulderir pointed out, most carriers derive the CNAM at the receiving end of the call out of a Database the subscribe to, they do not get it from the originator.

So having agreed with @mulderir on this comment, there’s more history here to be had. When we made the above mentioned change years ago, to remove the CNAM, we subsequently received bug tickets from various Canadian customers. They told us that in Canada, at least in some cases, the CNAM transmitted to the telco was propagated to the far end vs. dipping out of a database. @lgaetz seems to have confirmed this in his testing. As such, at that time, we added a setting (it may have been an Advanced Setting, or it may be right in the Trunk page, I don’t recall right now and don’t have a GUI up in front of me to confirm) that would return the CNAM transmission out to trunks. It is off by default so you have to enable it to get that behavior.

So … I hope this information helps in any testing that is being done, or observations that seem to be conflicting between the more common CNAM delivered from databases, which is the case in the US and I believe most of the rest of the world, and the cases where it is being transmitted to the far end user. I would also venture to guess that you may find localized instances of this latter behavior on some carriers when a call is ‘in-net’ within their same network and they choose to never transmit the call out to the PSTN and then back to them, thus possibly propagating the received CNAM.

Sorry but I thought I would bump this again. Does anyone know the correct syntax for the question in my post regarding replace the Caller ID Name with ‘Buffalo’ 6 posts back?

I just can’t find any examples anywhere of how to do this.

Thanks in advance!

Sorry to bump yet again, but does anyone know?

Using the Set CallerID module, you can change the CallerID Name by:

  1. Prefixing the existing CallerID name with a fixed value, e.g PREFIX${CALLERID(name)}
  2. Replacing the existing CallerID name with a fixed value, e.g REPLACE
  3. Replacing the existing CallerID name with another Asterisk channel variable value, e.g. ${arbitrary_variable_name} Obviously, the channel variable has to be set at some point in the call flow so a more advanced feature.